Japanese
PROGRAMMER'S GUIDEBackup Library User's Manual
Back | ■
Backup Library User's Manual/Reference

Detailed specifications


■Data specifications

 one
View
table
 Title

data specifications

 Data

Storage device connection information

 Data Name

BupConfig

 No

1

typedef struct BupConfig {
  Uint16 unit_id; /* Unit ID */
  Uint16 partition; /* number of partitions */
} BupConfig;

*If unit_id is 0, it means not connected.

 Equipment type
 unit_id
 partition
 Built-in memory
 1
 1
 external cartridge
 2
 1 


 one
View
table
 Title

data specifications

 Data

Status information

 Data Name

BupStat

 No

2

typedef struct BupStat {
  Uint32 totalsize; /* Total capacity() */
  Uint32 totalblock; /* Number of blocks */
  Uint32 blocksize; /* 1 block size() */
  Uint32 freesize; /* Free space */
  Uint32 freeblock; /* Number of free blocks */
  Uint32 datanum; /* Number of writable items */
} BupStat;

datanum stores the value for the size specified by datasize in BUP_Stat().


 one
View
table
 Title

data specifications

 Data

date time

 Data Name

BupDate

 No

3

typedef struct BupDate {
  Uint8 year; /* Year (1980 subtracted from the Western calendar) */
  Uint8 month; /* Month (1-12) */
  Uint8 day; /* day (1-31) */
  Uint8 time; /* Hour (0~23) */
  Uint8 min; /* minutes (0-59) */
  Uint8 week; /* Day of the week (Sun 0 - Sat 6) */
} BupDate;

 one
View
table
 Title

data specifications

 Data

directory information

 Data Name

BupDir

 No

4

typedef struct BupDir {
  Uint8 filename[12]; /* filename */
                        /* (11 ASCII characters + NUL, total 12 bytes) */
  Uint8 comment[11]; /* Comment */
                        /* (10 ASCII characters + NUL, total 11 bytes) */
  Uint8 language; /* Language type of comment */
                        /* Japanese: BUP_JAPANESE */
                        /* English: BUP_ENGLISH */
                        /* French: BUP_FRANCAIS */
                        /* German: BUP_DEUTSCH */
                        /* Spanish: BUP_ESPANOL */
                        /* Italian: BUP_ITALIANO */
  Uint32 date; /* date time data */
  Uint32 datasize; /* Data size (unit: bytes) */
  Uint16 blocksize; /* Data size (unit: block) */
} BupDir;

■Function specifications


 one
View
table
 Title

function specification

 Func

Initializing the backup library

 Function

BUP_Init

 No

1

Format
void BUP_Init(Uint32 *libaddr,Uint32 *workbuff,BupConfig conf[3])
input
libaddr: Specify the address to load the library The size of the library is 16K bytes.
workbuff: Pointer to the library work area The work area requires 8192 bytes. Since longword access may be required, be sure to secure it as Uint32.
output
conf: Get information about the connected storage device.
function
Loads the backup library into the specified memory area and performs preprocessing for use. Information about attached storage devices can be obtained. Each of the three tables corresponds to the following device numbers.

 device number
 Equipment type
 0
 Built-in memory cartridge
 1
 Memory cartridge or parallel interface
 2
 serial interface

remarks
Be sure to prepare three storage device connection information tables.
example
#define BUP_START_ADDR 0x6??????
#include "sega_bup.h"
Uint32 workmemory[2048+30];

  void sample()
  {
    BupConfig conf[3];

    BUP_Init(BUP_START_ADDR, workmemory, conf);
    ......
  }

 one
View
table
 Title

function specification

 Func

Partition selection

 Function

BUP_SelPart

 No

2

Format
Sint32 BUP_SelPart(Uint32 device,Uint16 num)
input
device: device number
 device number
Storage device
 0
 Built-in memory
 1
 Memory cartridge or parallel interface
 2
 serial interface
num: Partition number
0~(number of partitions - 1)
output
none
function value
0: Success
Others: failure
function
Make partition selection. In the initial state, partition 0 is selected.

 one
View
table
 Title

function specification

 Func

Execute format

 Function

BUP_Format

 No

3

Format
Sint32 BUP_Format(Uint32 device)
input
device: device number
 device number
Storage device
 0
 Built-in memory
 1
 Memory cartridge or parallel interface
 2
 serial interface
output
none
function value
0: Success
BUP_WRITE_PROTECT: With write protection
Others: failure
function
Initialize the backup storage device.
For partitioned backup storage devices, format only the current partition.

 one
View
table
 Title

function specification

 Func

Get status

 Function

BUP_Stat

 No

4

Format
Sint32 BUP_Stat(Uint32 device,Uint32 datasize,BupStat *stat)
input
device: device number
 device number
Storage device
 0
 Built-in memory
 1
 Memory cartridge or parallel interface
 2
 serial interface
datasize: Specify the size of the data you want to write in units.
output
stat: status information
function value
Return device status
0: Success
BUP_NON: Not connected
BUP_UNFORMAT: unformatted
function
Get status information.

 one
View
table
 Title

function specification

 Func

writing data

 Function

BUP_Write

 No

5

Format
Sint32 BUP_Write(Uint32 device,BupDir *dir,Uint8 *data,Uint8 owsw)
input
device: device number
 device number
Storage device
 0
 Built-in memory
 1
 Memory cartridge or parallel interface
 2
 serial interface
dir: File management information (input other than dir.blocksize)
data: Pointer to write data owsw: Overwrite check mode ON: Do not write if a file with the same name exists.
OFF: If a file with the same name exists, it will be overwritten.
output
none
function value
 function value
 meaning
 0
 success
 BUP_NON
 disconnected
 BUP_UNFORMAT
 unformatted
 BUP_WRITE_PROTECT
 With write protection
 BUP_FOUND
 A file with the same name exists.
 other
 failure
function
Write data to backup storage device

 one
View
table
 Title

function specification

 Func

Loading data

 Function

BUP_Read

 No

6

Format
Sint32 BUP_Read(Uint32 device, Uint8 *fname,Uint8 *data)
input
device: device number
 device number
Storage device
 0
 Built-in memory
 1
 Memory cartridge or parallel interface
 2
 serial interface
fname: Specify the file name (must be 11 characters in ASCII)
output
data: pointer to the buffer to read from
function value
 function value
 meaning
 0
 success
 BUP_NON
 disconnected
 BUP_UNFORMAT
 unformatted
 BUP_NOT_FOUND
 file not found
 BUP_BROKEN
 file is corrupted
 other
 failure
function
Load data from backup storage.

 one
View
table
 Title

function specification

 Func

Delete data

 Function

BUP_Delete

 No

7

Format
Sint32 BUP_Delete(Uint32 device, Uint8 *fname)
input
device: device number
 device number
Storage device
 0
 Built-in memory
 1
 Memory cartridge or parallel interface
 2
 serial interface
fname: File name (must be 11 characters in ASCII)
output
none
function value
 function value
 meaning
 0
 success
 BUP_NON
 disconnected
 BUP_UNFORMAT
 unformatted
 BUP_NOT_FOUND
 file not found
 BUP_WRITE_PROTECT
 With write protection
 other
 failure
function
Delete data on backup storage devices.

 one
View
table
 Title

function specification

 Func

Get directory information

 Function

BUP_Dir

 No

8

Format
Sint32 BUP_Dir(Uint32 device, Uint8 *fname,Uint16 dirsize,BupDir *dir)
input
device :Device number
 device number
Storage device
 0
 Built-in memory
 1
 Memory cartridge or parallel interface
 2
 serial interface
fname: Specify the file name (up to 11 characters in ASCII)
dirsize: Specify the number of secured directory information
output
dir: directory information is stored
function value
Number of hits for directory information.
function
Search for a file name using a prefix match and store directory information in a table.
The number of directory information items found by the search is returned as the function value.
If it is negative, it means that the table size is insufficient, and you can check the number of items by reversing the sign.
(If tbsize is set to 10 and there are 11 results, -11 is returned)

 one
View
table
 Title

function specification

 Func

Data matching

 Function

BUP_Verify

 No

9

Format
Sint32 BUP_Verify(Uint32 device,Uint8 *filename,Uint8 *data)
input
device :Device number
 device number
Storage device
 0
 Built-in memory
 1
 Memory cartridge or parallel interface
 2
 serial interface
filename: File name (must be 11 characters in ASCII)
data: pointer to collation data
output
none
function value
 function value
 meaning
 0
 success
 BUP_NON
 disconnected
 BUP_UNFORMAT
 unformatted
 BUP_NO_MATCH
 data doesn't match
 BUP_NOT_FOUND
 file not found
 BUP_BROKEN
 file is corrupted
function
Verify the data written to the backup file.

 one
View
table
 Title

function specification

 Func

Expanding date-time data

 Function

BUP_GetDate

 No

10

Format
void BUP_GetDate(Uint32 pdate,BupDate *date)
input
update: Date and time data for directory information
date : date time table
output
none
function value
none
function
Expand date and time data in the directory information table.

 one
View
table
 Title

function specification

 Func

Compressing date-time data

 Function

BUP_SetDate

 No

11

Format
Uint32 BUP_SetDate(BupDate *date)
input
date: date time
output
none
function value
Date/time data format data in directory information table
function
Compress date and time data in the directory information table.

Back |■
PROGRAMMER'S GUIDEBackup Library User's Manual
Copyright SEGA ENTERPRISES, LTD., 1997