CTRDG_Read

# CTRDG_IdentifyAgbBackup

## C Specification

      #include <nitro/ctrdg.h>

      u16 CTRDG_IdentifyAgbBackup(CTRDGBackupType type);

      Corresponding AGB function: u16 IdentifyFlash_512K()
      Corresponding AGB function: u16 IdentifyFlash_1M()

## Arguments

type | Represents the type of backup device mounted in the NITRO cartridge.

## Return Values

Returns 0 if successful. Returns a non-zero value if it fails.

## Description

This function specifies the backup device that is mounted in the NITRO cartridge.
If the backup device is a flash memory, the flash ID is read, the type of flash mounted in the cartridge is identified, the flash capacity and sector size is obtained, the access speed is set, and each access function for the corresponding flash is set.
The flash data obtained can be accessed using the global variable CTRDGFlashType *AgbFlash.
This function must be called once before accessing the backup device (including read access).
This function returns an error if the device could not be identified and disables all access functions.

The access cycle setting does not need to be set beforehand because it is created inside the function.
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, if CTRDG_BACKUP_TYPE_FLASH_512K or CTRDG_BACKUP_TYPE_FLASH_1M is specified as the argument, a write operation to the device will be executed. Note that backup data may be damaged if a different type of device from the given argument is installed in the NITRO cartridge.

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.)

## See Also

## Revision History

04/07/2006 Initial version.

CONFIDENTIAL