CTRDG_Read

# CTRDG_EraseAgbFlashSectorAsync

## C Specification

      #include <nitro/ctrdg.h>

      void CTRDG_EraseAgbFlashSectorAsync(u16 sec_num, CTRDG_TASK_FUNC callback);

## Arguments

sec_num | Target flash sector number
callback | Callback function called when the data erase process ends

## Return Values

None.

## Description

Asynchronously erases the data in the sector with the specified target sector number.
Normally, this routine does not need to be called before writing because it is called inside the writing routine.
To find out whether the Erase process succeeded, access 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 Erase process succeeded; returns non-zero if the target sector number 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_EraseAgbFlashChip, CTRDG_EraseAgbFlashSector, CTRDG_EraseAgbFlashChipAsync
`

## Revision History

04/07/2006 Initial version.

CONFIDENTIAL