1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.1.0 for Windows">
6<META http-equiv="Content-Style-Type" content="text/css">
7<TITLE>CTRDG_WriteAndVerifyAgbFlash</TITLE>
8<LINK rel="stylesheet" href="../css/nitro.css" type="text/css">
9</HEAD>
10<BODY>
11<H1 align="left">CTRDG_WriteAndVerifyAgbFlash <IMG src="../image/NTR.gif" align="middle"></H1>
12<H2>Syntax</H2>
13<DL>
14  <DD>
15  <PRE><CODE>#include &lt;nitro/ctrdg.h&gt;</CODE></PRE>
16  <PRE><CODE>u32 CTRDG_WriteAndVerifyAgbFlash(u16 sec_num, u8* src, u32 verifysize)
17  </CODE></PRE>
18Corresponding AGB function: <A href="coordinate.html"><CODE>u32 ProgramFlashSectorEx2(u16 secNo,u8 *src,u32 verifySize)</CODE></A>
19</DL>
20<H2>Arguments</H2>
21<TABLE border="1">
22  <TBODY>
23    <TR>
24<TD><SPAN class="argument">sec_num</SPAN></TD>
25<TD>Destination flash sector number.</TD>
26    </TR>
27    <TR>
28<TD><SPAN class="argument">src</SPAN></TD>
29<TD>Source address.</TD>
30    </TR>
31    <TR>
32<TD><SPAN class="argument">verifysize</SPAN></TD>
33<TD>Verify size in bytes.</TD>
34    </TR>
35  </TBODY>
36</TABLE>
37<H2>Return Values</H2>
38<P>Returns zero if the process ends normally. Returns a nonzero value if the process fails, and the error address on the device side when there is a verification error.</P>
39<H2>Description</H2>
40<P>Internally uses the <A href="CTRDG_WriteAgbFlashSector.html"><CODE>CTRDG_WriteAgbFlashSector</CODE></A> function to write data and then the <A href="CTRDG_VerifyAgbFlash.html"><CODE>CTRDG_VerifyAgbFlash</CODE></A> function to verify data for the number of bytes given by <SPAN class="argument">verifysize</SPAN>. If there is an error, the function retries up to the number of times specified by <CODE>CTRDB_AGB_FLASH_RETRY_MAX</CODE> (defined in <CODE>AgbFlash.h</CODE>). <B>Note:</B> When checking error codes, this function returns an error code using 16 out of 32 bits when there is a write error, but returns a 32-bit error address on the device side when there is a verification error.</P>
41<P>The access cycle setting does not need to be set in advance because it is created inside the function. In addition, the <A href="../os/time/OS_InitTick.html"><CODE>OS_InitTick</CODE></A> function must be called in advance because clock ticks are used by this function to measure timeouts.</P>
42<P><B>Note:</B> 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.</P>
43<P>Note that the AGB backup device cannot be accessed normally with IS-NITRO-DEBUGGER version 1.66 or earlier.</P>
44<H2>See Also</H2>
45<P><A href="CTRDG_WriteAgbFlashSector.html"><CODE>CTRDG_WriteAgbFlashSector</CODE></A><BR> <A href="CTRDG_VerifyAgbFlash.html"><CODE>CTRDG_VerifyAgbFlash</CODE></A><BR> <A href="CTRDG_WriteAndVerifyAgbFlash.html"><CODE>CTRDG_WriteAndVerifyAgbFlash</CODE></A><BR> <A href="CTRDG_WriteAndVerifyAgbFlashAsync.html"><CODE>CTRDG_WriteAndVerifyAgbFlashAsync</CODE></A></P>
46<H2>Revision History</H2>
47<P>2006/05/25 Added a description that the AGB backup device cannot be accessed normally with IS-NITRO-DEBUGGER version 1.66 or earlier.<BR> 2006/04/07 Initial version.</P>
48<hr><p>CONFIDENTIAL</p></body>
49</HTML>
50