target/linux/at91/image/dfboot/src/at45.c
/*----------------------------------------------------------------------*/
/* \fn    AT91F_DataFlashGetStatus					*/
/* \brief Read the status register of the dataflash			*/
/*----------------------------------------------------------------------*/
\fn    AT91F_DataFlashGetStatus
\brief Read the status register of the dataflash
\ fn AT91F_DataFlashGetStatus \ brief Read the status register of the dataflash
static AT91S_DataFlashStatus AT91F_DataFlashGetStatus(AT91PS_DataflashDesc pDesc)
{
	AT91S_DataFlashStatus status;
	pDesc->command[0] = DB_STATUS;
	pDesc->command[1] = 0;
	pDesc->DataFlash_state = GET_STATUS;
    	pDesc->tx_data_size    = 0 ; 
    	pDesc->tx_cmd_pt       = pDesc->command ;
    	pDesc->rx_cmd_pt       = pDesc->command ;
    	pDesc->rx_cmd_size     = 2 ;
    	pDesc->tx_cmd_size     = 2 ;
    	status = AT91F_SpiWrite (pDesc);
	pDesc->DataFlash_state = *( (unsigned char *) (pDesc->rx_cmd_pt) +1);
	return status;
}
static AT91S_DataFlashStatus AT91F_DataFlashGetStatus ( AT91PS_DataflashDesc pDesc ) { AT91S_DataFlashStatus status ; pDesc -> command [ 0 ] = DB_STATUS ; pDesc -> command [ 1 ] = 0 ; pDesc -> DataFlash_state = GET_STATUS ; pDesc -> tx_data_size = 0 ; pDesc -> tx_cmd_pt = pDesc -> command ; pDesc -> rx_cmd_pt = pDesc -> command ; pDesc -> rx_cmd_size = 2 ; pDesc -> tx_cmd_size = 2 ; status = AT91F_SpiWrite ( pDesc ) ; pDesc -> DataFlash_state = * ( ( unsigned char * ) ( pDesc -> rx_cmd_pt ) + 1 ) ; return status ; }
\fn    AT91F_DataFlashGetStatus
\brief Read the status register of the dataflash
\ fn AT91F_DataFlashGetStatus \ brief Read the status register of the dataflash
/* first send the read status command (D7H) */ /* Transmit the command and receive response */