CRI Middleware Library Reference Manual : ADXF

Constants

[Menu]

ADXF_STAT_~
Handle status

Description

The constants shown below indicate the handle status.

Define | Remarks
--- | ---
ADXF_STAT_STOP | Data reading stopped
ADXF_STAT_READING | Data reading in progress
ADXF_STAT_READEND | Data reading ended
ADXF_STAT_ERROR | Error on reading data

[Menu]

ADXF_SEEK_~
Seek type

Description

The following constants are used as reference for moving the access pointer. They are specified as arguments of the ADXF_Seek function.

Define | Remarks
--- | ---
ADXF_SEEK_SET | Top of file
ADXF_SEEK_CUR | Current position
ADXF_SEEK_END | End of file

Process Macros

[Menu]

ADXF_CALC_PTINFO_SIZE
Calculation partition information size

Format
int ADXF_CALC_PTINFO_SIZE(n);
Input

n: number of inside file in AFS file

Output

None.

Return Value

Partition information size (unit : byte)

Description

Calculates partition information size.

This macro is used for the following functions.

ADXF_LoadPartitionNw

ADXF_LoadPartitionFromAfsNw

[Menu]

ADXF_CALC_PTINFO_FMGL_SIZE
Calculation partition information size

Format
int ADXF_CALC_PTINFO_FMGL_SIZE(n);
Input

n: number of inside file in AFS file

Output

None.

Return Value

Partition information size (unit : byte)

Description

Calculates partition information size.

This macro is used for the following functions.

ADXF_LoadPartitionFmgLongNw

ADXF_LoadPartitionFromAfsFmgLongNw

Data Types

[Menu]

ADXF
ADXF handle

Description Stores information about file access for each file. Generated by the functions ADXF_Open and ADXF_OpenAfs. These data are referenced in almost every file access.

Functions

[Menu]

ADXF_Init
Library initialization

Format
void ADXF_Init(void);
Input

None.

Output

None.

Return Value

None.

Description

Initializes the library

Remarks

Since this is called by the ADXT_Init function (ADX playback library initialization), it normally needs not be called by an application.

[Menu]

ADXF_Finish
Library shutdown

Format
void ADXF_Finish(void);
Input

None.

Output

None.

Return Value

None.

Description

Performs shutdown processing for the library.

Remarks

Since this is called by the ADXT_Finish function (ADX playback library shutdown), it normally needs not be called by an application.

[Menu]

ADXF_GetPtinfoSize
Get partition information size

Format
Sint32 ADXF_GetPtinfoSize(Sint32 ptid);
Input

ptid:partition ID

Output

None.

Return Value

Partition information size (unit: bytes)

Description

Gets the size of the set partition information.

[Menu]

ADXF_LoadPartitionNw
Load partition information (No wait)

Format
Sint32 ADXF_LoadPartitionNw(Sint32 ptid, const Char8 *fname, void *dir, void *ptinfo);
Input

ptid:partition ID (0 - 255)

fname:AFS file name

dir :Directory information

Output

ptinfo:partition information read-in area

Return Value

Error code

Description

Requests to read partition information of AFS file. And sets the partition ID. After you called this function, you have to check status by ADXF_GetPtStat function and wait for partition load to complete. You can use the partition if partition load will complete.

Inside file is managed 2 byte per file. The size of 'ptinfo' is calculated by ADXF_CALC_PTINFO_SIZE().

Example

    // Partition-load the sample.afs file
    ADXF_LoadPartitionNw(0, "sample.afs", NULL, ptinfo);
    for (;;) {
        if (ADXF_GetPtStat(0) == ADXF_STAT_READEND) {
            break;
        }
        ADXM_ExecMain();
    }

[Menu]

ADXF_LoadPartitionRangeNw
Load partition information by specified the range (No wait)

Format
Sint32 ADXF_LoadPartitionRangeNw(Sint32 ptid, const Char8 *fname, void *dir, Sint32 offset_sct, Sint32 range_sct, void *ptinfo);
Input

ptid:partition ID (0 - 255)

fname:AFS file name

dir :Directory information

offset_sct:offset[sector]

range_sct:size[sector]

Output

ptinfo:partition information read-in area

Return Value

Error code

Description

Requests to read partition information of AFS file by specified the range. And sets the partition ID. After you called this function, you have to check status by ADXF_GetPtStat function and wait for partition load to complete. You can use the partition if partition load will complete.

Inside file is managed 2 byte per file. The size of 'ptinfo' is calculated by ADXF_CALC_PTINFO_SIZE().

Example

    // Partition-load from 200 sector to 1000 sector of the sample.dat file as AFS file
    ADXF_LoadPartitionRangeNw(0, "sample.dat", NULL, 200, 1000, ptinfo);
    for (;;) {
        if (ADXF_GetPtStat(0) == ADXF_STAT_READEND) {
            break;
        }
        ADXM_ExecMain();
    }

[Menu]

ADXF_LoadPartitionFromAfsNw
Load partition information (for nested AFS file)

Format
Sint32 ADXF_LoadPartitionFromAfsNw(Sint32 set_ptid, Sint32 rd_ptid, Sint32 rd_flid, void *ptinfo);
Input

set_ptid:partition ID for loading and setting(0 - 255)

rd_ptid:partition ID reading AFS file

rd_flid:file ID reading AFS file

Output

ptinfo:partition information read-in area

Return Value

Error code

Description

Requests to read partition information of AFS file. And sets the partition ID. After you called this function, you have to check status by ADXF_GetPtStat function and wait for partition load to complete. You can use the partition if partition load will complete.

Inside file is managed 2 byte per file. The size of 'ptinfo' is calculated by ADXF_CALC_PTINFO_SIZE().

Remarks

This function is used when the partition information of AFS file in AFS file is read. AFS file specified by rd_ptid and rd_flid can be used by the partition of set_ptid. An inside file can be opened by ADXF_OpenAfs().

Example

    // Partition-load the sample.afs file
    ADXF_LoadPartitionNw(0, "sample.afs", NULL, ptinfo1);
    for (;;) {
        if (ADXF_GetPtStat(0) == ADXF_STAT_READEND) {
            break;
        }
        ADXM_ExecMain();
    }
    // Partition-load the inside file of ID 0 within the sample.afs file
    ADXF_LoadPartitionFromAfsNw(1, 0, 0, ptinfo2);
    for (;;) {
        if (ADXF_GetPtStat(1) == ADXF_STAT_READEND) {
            break;
        }
        ADXM_ExecMain();
    }

[Menu]

ADXF_LoadPartitionFmgLongNw
Load partition information (for 128Mbytes or more of file)

Format
Sint32 ADXF_LoadPartitionFmgLongNw(Sint32 ptid, const Char8 *fname, void *dir, void *ptinfo);
Input

ptid:partition ID (0 - 255)

fname:AFS file name

dir :Directory information

Output

ptinfo:partition information read-in area

Return Value

Error code

Description

Requests to read partition information of AFS file. And sets the partition ID. After you called this function, you have to check status by ADXF_GetPtStat function and wait for partition load to complete. You can use the partition if partition load will complete.

Inside file is managed 4 byte per file. The size of 'ptinfo' is calculated by ADXF_CALC_PTINFO_FMGL_SIZE().

Remarks

128 Mbytes or more of inside file is treated by this function.

Example

    ptinfo = malloc(ADXF_CALC_PTINFO_FMGL_SIZE(100));
    ADXF_LoadPartitionFmgLongNw(0, "sample.afs", NULL, ptinfo);
    for (;;) {
        if (ADXF_GetPtStat(0) == ADXF_STAT_READEND) {
            break;
        }
        ADXM_ExecMain();
    }

[Menu]

ADXF_LoadPartitionFromAfsFmgLongNw
Load partition information (for nested AFS file, for 128Mbytes or more of file)

Format
Sint32 ADXF_LoadPartitionFromAfsFmgLongNw(Sint32 set_ptid, Sint32 rd_ptid, Sint32 rd_flid, void *ptinfo);
Input

set_ptid:partition ID for loading and setting(0 - 255)

rd_ptid:partition ID reading AFS file

rd_flid:file ID reading AFS file

Output

ptinfo:partition information read-in area

Return Value

Error code

Description

Requests to read partition information of AFS file. And sets the partition ID. After you called this function, you have to check status by ADXF_GetPtStat function and wait for partition load to complete. You can use the partition if partition load will complete.

Inside file is managed 4 byte per file. The size of 'ptinfo' is calculated by ADXF_CALC_PTINFO_FMGL_SIZE().

Remarks

This function is used when the partition information of AFS file in AFS file is read. AFS file specified by rd_ptid and rd_flid can be used by the partition of set_ptid. An inside file can be opened by ADXF_OpenAfs().

128 Mbytes or more of inside file is treated by this function.

[Menu]

ADXF_GetPtStat
Get partition loading state

Format
Sint32 ADXF_GetPtStat(Sint32 ptid);
Input

ptid:partition ID (0 - 255)

Output

None.

Return Value

partition loading status (status: ADXF_STAT_ - )

Define | Remarks
--- | ---
ADXF_STAT_STOP | Data reading stopped
ADXF_STAT_READING | Data reading in progress
ADXF_STAT_READEND | Data reading completed
ADXF_STAT_ERR | Error on reading data

Description

Gets the partition loading status.

By this function you have to check status after you called ADXF_LoadPartitionNw function and wait for partition load to complete. You can use the partition if partition load will complete.

[Menu]

ADXF_StopPtLd
Stop to load partition information

Format
void ADXF_StopPtLd(void);
Input

None.

Output

None.

Return Value

None.

Description

Stops to load partition information. If you break partition load, you cannot use the partition information.

[Menu]

ADXF_Open
Open file

Format
ADXF ADXF_Open(const Char8 *fname, void *atr);
Input

fname:file name

atr :file attribute

Output

None.

Return Value

ADXF handle, NULL in case of error

Description

Opens the specified file and returns the ADXF handle.

Remarks

This function is the blocking function. Process is blocked in the function until the specified file is opened.

To avoid the block of the process, you should use the file information cache or the ADXF_OpenNw function.

[Menu]

ADXF_OpenNw
Begins the file open

Format
ADXF ADXF_OpenNw(const Char8 *fname, void *atr);
Input

fname:file name

atr :file attribute

Output

None.

Return Value

ADXF handle, NULL in case of error

Description

Creates the ADXF handle, and begins the file open.

Remarks

This function is the non-blocking function. Process is not blocked in this function.

This function returns the ADXF handle, even if the file open failed. If the file open failed, the ADXF handle's status becomes ADXF_STAT_ERROR.

Note

Following functions block the process, when called before the file open has been completed.

- ADXF_GetFsizeSct

- ADXF_GetFsizeByte

- ADXF_GetFsizeByte64

- ADXF_Seek

- ADXF_Close

To avoid the block of the process, you should check whether the file has been opened, using the ADXF_IsOpened function.

Example

    /* Begins the file open */
    adxf = ADXF_OpenNw(fname, NULL);

    /* Wait until file open has been completed */
    for (;;) {
        /* Checks whether file has been opened */
        bl_ret = ADXF_IsOpened(adxf);
        if (bl_ret != FALSE) {
            break;
        }

        /* Checks the error */
        stat = ADXF_GetStat(adxf);
        if (stat == ADXF_STAT_ERROR) {
            /* Error processing */
            ...
        }

        /* Server function */
        ADXM_ExecMain();
        ADXM_WatiVsync();
    }

    /* Gets the file size */
    nsct = ADXF_GetFsizeSct(adxf);
        :

[Menu]

ADXF_OpenRange
Open file by specified the range

Format
ADXF ADXF_OpenRange(const Char8 *fname, void *atr, Sint32 offset_sct, Sint32 range_sct)
Input

fname:file name

atr :file attribute

offset_sct:offset[sector]

range_sct:size[sector]

Output

None.

Return Value

ADXF handle, NULL in case of error

Description

Opens the specify file name and the range as a sector.

[Menu]

ADXF_OpenAfs
Open file (AFS format)

Format
ADXF ADXF_OpenAfs(Sint32 ptid, Sint32 flid);
Input

ptid:partition ID

flid:file ID

Output

None.

Return Value

ADXF handle, NULL in case of error

Description

Opens AFS file specified by partition ID and file ID, and returns ADXF handle.

Remarks

This function is the blocking function. Process is blocked in the function until the specified file is opened.

To avoid the block of the process, you should use the file information cache or the ADXF_OpenAfsNw function.

[Menu]

ADXF_OpenAfsNw
Begins the file open (AFS format)

Format
ADXF ADXF_OpenAfsNw(Sint32 ptid, Sint32 flid);
Input

ptid:partition ID

flid:file ID

Output

None.

Return Value

ADXF handle, NULL in case of error

Description

Creates the ADXF handle, and begins the AFS file open.

Remarks

This function is the non-blocking function. Process is not blocked in this function.

This function returns the ADXF handle, even if the file open failed. If the file open failed, the ADXF handle's status becomes ADXF_STAT_ERROR.

Note

Following functions block the process, when called before the file open has been completed.

- ADXF_GetFsizeSct

- ADXF_GetFsizeByte

- ADXF_GetFsizeByte64

- ADXF_Seek

- ADXF_Close

To avoid the block of the process, you should check whether the file has been opened, using the ADXF_IsOpened function.

Example

    /* Begins the file open */
    adxf = ADXF_OpenAfsNw(patid, flid);

    /* Wait until file open has been completed */
    for (;;) {
        /* Checks whether file has been opened */
        bl_ret = ADXF_IsOpened(adxf);
        if (bl_ret != FALSE) {
            break;
        }

        /* Checks the error */
        stat = ADXF_GetStat(adxf);
        if (stat == ADXF_STAT_ERROR) {
            /* Error processing */
            ...
        }

        /* Server function */
        ADXM_ExecMain();
        ADXM_WatiVsync();
    }

    /* Gets the file size */
    nsct = ADXF_GetFsizeSct(adxf);
        :

[Menu]

ADXF_IsOpened
File open check

Format
Bool ADXF_IsOpened(ADXF adxf);
Input

adxf :ADXF handle

Output

None.

Return Value

TRUE=the file has been opened, FALSE=the file has not been opened yet

Description

Checks whether the file has been opened.

[Menu]

ADXF_Close
Close file

Format
void ADXF_Close(ADXF adxf);
Input

adxf :ADXF handle

Output

None.

Return Value

None.

Description

Closes the specified ADXF handle.

[Menu]

ADXF_ReadNw
Start data read

Format
Sint32 ADXF_ReadNw(ADXF adxf, Sint32 nsct, void *buf);
Input

adxf:ADXF handle

nsct:read data volume (unit: sectors)

buf :read-in area

Output

None.

Return Value

Read request size (unit: sectors)

Description

Issues data read request. When requested access is completed, the access pointer advances to the sector specified by nsct.

Remarks

The user has to notice because the buf address boundary is different in each platform.

When the specified number of read sectors extends beyond the file end, the number of sectors to the file end is returned, and file read is performed to the file end.

Note

The returned value of the ADXF_ReadNw function is only 'request' size. Actual read size might not be same.

If you need actual read size, you should call the ADXF_GetNumReadSct function, after reading process has been completed.

In the following cases, request size will not be same as actual read size.

- The file pointer has reached the end of file.

- The reading error has occurred.

- The reading process has been stopped by the ADXF_Stop function.

[Menu]

ADXF_Stop
Stop data read

Format
Sint32 ADXF_Stop(ADXF adxf);
Input

adxf :ADXF handle

Output

None.

Return Value

Access pointer at stop point

Description

Stops the data loading process.

[Menu]

ADXF_StopNw
Stop data read(No wait)

Format
Sint32 ADXF_StopNw(ADXF adxf);
Input

adxf :ADXF handle

Output

None.

Return Value

Access pointer at request to stop

Description

Requests to stop the data loading process.

[Menu]

ADXF_ExecServer
Server function

Format
void ADXF_ExecServer(void);
Input

None.

Output

None.

Return Value

None.

Description

Updates the internal state.

Remarks

Applications do not need to call this function, because it is called automatically by the Vsync interrupt.

[Menu]

ADXF_Seek
Move access pointer

Format
Sint32 ADXF_Seek(ADXF adxf, Sint32 pos, Sint32 type);
Input

adxf :ADXF handle

pos:access pointer move amount (unit: sectors)

type:move reference (seek type: ADXF_SEEK_ - )

Define | Remarks
--- | ---
ADXF_SEEK_SET | Top of file
ADXF_SEEK_CUR | Current position
ADXF_SEEK_END | End of file

Output

None.

Return Value

Access pointer position

Description

Moves the access pointer to a position at "pos" sectors from "type". When a move beyond the end of the file is specified, the access pointer moves to the end of the file.

Note

This function stops the current reading process. If ADXF handle's status is ADXF_STAT_READING, it becomes to ADXF_STAT_STOP.

[Menu]

ADXF_Tell
Get access pointer

Format
Sint32 ADXF_Tell(ADXF adxf);
Input

adxf:ADXF handle

Output

None.

Return Value

Access pointer position (unit: sectors)

Description

Gets the access pointer position.

[Menu]

ADXF_GetFsizeSct
Get file size

Format
Sint32 ADXF_GetFsizeSct(ADXF adxf);
Input

adxf:ADXF handle

Output

None.

Return Value

File size (unit: sectors)

Description

Gets the size of the specified file.

[Menu]

ADXF_GetFsizeByte
Get file size

Format
Sint32 ADXF_GetFsizeByte(ADXF adxf);
Input

adxf:ADXF handle

Output

None.

Return Value

File size (unit: byte)

Description

Gets the size of the specified file.

[Menu]

ADXF_GetNumReqSct
Get read request information

Format
Sint32 ADXF_GetNumReqSct(ADXF adxf, Sint32 *seekpos);
Input

adxf:ADXF handle

Output

seekpos:read position

Return Value

Requested read data volume (unit: sectors)

Description

Gets the read position and data volume requested by the ADXF_ReadNw function.

[Menu]

ADXF_GetNumReadSct
Get actual number of read sectors

Format
Sint32 ADXF_GetNumReadSct(ADXF adxf);
Input

adxf:ADXF handle

Output

None.

Return Value

Read data volume (unit: sectors)

Description

Gets the actually read amount of data.

[Menu]

ADXF_GetStat
Get handle status

Format
Sint32 ADXF_GetStat(ADXF adxf);
Input

adxf:ADXF handle

Output

None.

Return Value

ADXF handle internal status (status: ADXF_STAT_ - )

Define | Remarks
--- | ---
ADXF_STAT_STOP | Data reading stopped
ADXF_STAT_READING | Data reading in progress
ADXF_STAT_READEND | Data reading completed
ADXF_STAT_ERR | Error on reading data

Description

Gets the internal status of the ADXF handle.

[Menu]

ADXF_GetStatRead
Get read status

Format
Sint32 ADXF_GetStatRead(ADXF adxf);
Input

adxf:ADXF handle

Output

None.

Return Value

1=data read is in progress, 0=data read is stopped

Description

Gets current status of data read.

[Menu]

ADXF_GetFileSize
Get file size

Format
Sint32 ADXF_GetFileSize(const Char8 *fname);
Input

fname:file name

Output

None.

Return Value

File size (unit: bytes)

Description

Gets the size of the specified file.

[Menu]

ADXF_IsExistFile
Check of file existence

Format
Bool ADXF_IsExistFile(const Char8 *fname);
Input

fname:file name

Output

None

Return Value

TRUE=file exist, FALSE=otherwise

Description

Checks whether file exist.

Remarks

This function does not return error callback even if file does not exist.

[Menu]

ADXF_SetupRofs
Setup of ROFS

Format
void ADXF_SetupRofs(void *sprmr);
Input

sprmr: ROFS setup parameter structure

Output

None.

Return Value

None.

Description

Sets up the ROFS.

[Menu]

ADXF_ShutdownRofs
Shutdown of ROFS

Format
void ADXF_ShutdownRofs(void);
Input

None.

Output

None.

Return Value

None.

Description

Shuts down the ROFS.

[Menu]

ADXF_AddRofsVol
Addition of ROFS volume

Format
Sint32 ADXF_AddRofsVol(Char8 *volname, Char8 *imgname);
Input

volname: volume name

imgname: image file name

Output

None.

Return Value

Error code

Description

Adds the specified image file as volume. You have to add device name to parameter "imgname"

[Menu]

ADXF_DelRofsVol
Deletion of ROFS volume

Format
void ADXF_DelRofsVol(Char8 *volname);
Input

volname: volume name

Output

None.

Return Value

None.

Description

Deletes the specified volume.

[Menu]

ADXF_SetDefDev
Set default device

Format
void ADXF_SetDefDev(Char8 *devname);
Input

devname: device name

Output

None.

Return Value

None.

Description

Sets the specified device to default device.

Copyright (c) 2001-2006 CRI Middleware Co.,LTD.