CTRDG_Read

# CTRDG_WriteAgbFlashSectorAsync

## C Specification

      #include <nitro/ctrdg.h>

      void CTRDG_WriteAgbFlashSectorAsync(u16 sec_num, u8* src, CTRDG_TASK_FUNC callback);

## Arguments

sec_num | Represents the target flash sector number
src | Represents the source write address
callback | Represents the callback function called when the data write process ends

## Return Values

None.

## Description

This function asynchronously writes one sector (4 kbytes) of data beginning from the address given by "src" into the target sector No.
CTRDG_EraseAgbFlashSector is called inside this routine and data is written after the sector is erased.
You can find out how many bytes remain available while this routine is executing by accessing the global variable flash_remainder.
You can find out whether the write process succeeded by accessing the result member of the CTRDGTaskInfo structure used as an argument to the callback function that returns after this routine is called.
Returns zero if the write process succeeds. Returns non-zero if the write process fails or if the target sector No. is out of range.

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

Note: All interrupts are disabled inside this function and the catridge bus is locked for a set period.
In particular, do not use DMA for automatic startup during direct sound and V/H blank synchronization, display synchronization, or cartridge request.

In addition, the AGB backup device cannot be accessed normally by the IS-NITRO-DEBUGGER.
However, be sure to check operations using an actual DS handheld unit since normal access is possible with actual DS units.
(This will be fixed in a future version of IS-NITRO-DEBUGGER.)

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

## See Also

`CTRDG_EraseAgbFlashSector, CTRDG_WriteAgbFlashSector, CTRDG_WriteAndVerifyAgbFlash, CTRDG_WriteAndVerifyAgbFlashAsync
`

## Revision History

04/07/2006 Initial version.

CONFIDENTIAL