CTRDG_WriteAgbFlashSectorAsync

Syntax

#include <nitro/ctrdg.h>
void CTRDG_WriteAgbFlashSectorAsync(u16 sec_num, u8* src, CTRDG_TASK_FUNC callback);
  

Arguments

sec_num Destination flash sector number.
src Source address.
callback Callback function called when the data write process ends.

Return Values

None.

Description

Asynchronously writes one sector (4 KB) of data beginning from the address given by src into the target sector number. The CTRDG_EraseAgbFlashSector function is called from this function, and data is written after the sector is erased. To find out how many bytes remain available while this function is executing, access the global variable flash_remainder. To find out whether the write process succeeded, access the result member of the CTRDGTaskInfo structure used as an argument to the callback function that returns after this function is called. Returns zero if the write process succeeds. Returns a nonzero value if the write process fails or if the target sector number is out of range.

The access cycle setting does not need to be set in advance because it is created inside the function. In addition, the OS_InitTick function must be called in advance because clock ticks are used by this function to measure timeouts.

Note: All interrupts are disabled inside this function, and the cartridge bus is locked for a set period. In particular, when this function is called, do not use DMA that starts automatically during direct sound and V/H blank synchronization, display synchronization, cartridge request, and so on.

Note that the AGB backup device cannot be accessed normally with IS-NITRO-DEBUGGER version 1.66 or earlier.

/*  callback  function  */
typedef u32 (*CTRDG_TASK_FUNC) (struct CTRDGiTaskInfo_tag *);

See Also

CTRDG_EraseAgbFlashSector
CTRDG_WriteAgbFlashSector
CTRDG_WriteAndVerifyAgbFlash
CTRDG_WriteAndVerifyAgbFlashAsync

Revision History

2006/05/25 Added a description that the AGB backup device cannot be accessed normally with IS-NITRO-DEBUGGER version 1.66 or earlier.
2006/04/07 Initial version.


CONFIDENTIAL