void DisableChip( void )
{
Io2_Set( 10 ) ; //chip disable
}
/******************************************************************************
* Function Name : System delay a while
* Description : after write cmmand , address , or data , there may be a short
* delay needed
* Input : The count
* Output : None
* Return : None
*******************************************************************************/
void SystemDelay( u32 nCount )
{
u32 nBegin ;
for( nBegin = 0 ; nBegin < nCount ; nBegin ++ )
{
nBegin = nBegin ;
}
}
/* Private functions ---------------------------------------------------------*/
/*******************************************************************************
* Function Name : FSMC_NAND_Init
* Description : Configures the FSMC and GPIOs to interface with the NAND memory.
* This function must be called before any write/read operation
* on the NAND.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void FSMC_NAND_Init(void)
{
/* first data0 -> data7 , set as gpio pin */
LPC_IOCON->PIO2_0 &= ~0x07;
LPC_IOCON->PIO2_1 &= ~0x07;
LPC_IOCON->PIO2_2 &= ~0x07;
LPC_IOCON->PIO2_3 &= ~0x07;
LPC_IOCON->PIO2_4 &= ~0x07;
LPC_IOCON->PIO2_5 &= ~0x07;
LPC_IOCON->PIO2_6 &= ~0x07;
LPC_IOCON->PIO2_7 &= ~0x07;
/********************************************************************
********************************************************************/
void RBDetect( void )
{//This function do not work correct ...
DATA_BUS_INPUT();
PrintU32( LPC_GPIO2->DATA ) ;
//program dead here , can't detect R/B from high to low
while( (LPC_GPIO2->DATA) & 0x800 ); //wait until high to low
SystemDelay(2);
while( !((LPC_GPIO2->DATA) & 0x800) ); //wait until low to high
}
/*************************************************************************/