at45.h
Default mainpageat91libmemoriesspi-flashat45.h
Description Overview  
Description
Purpose
The Dataflash driver is based on top of the corresponding Spi driver. A Dataflash structure instance has to be initialized using the DF_Init function. Then basic dataflash operations can be launched using macros such as DF_continuous_read. These macros invoke the DF_Command() function which invokes the DPI low driver using the SPI_SendCommand() function. Beware to compute the dataflash internal address, the dataflash sector description must be known (DataflashDesc). Dataflash can be automatically detected using the DF_Scan() function. !!!Usage

  1. Initializes an AT45 instance and configures SPI chip select pin using AT45_Configure().
  2. Detect DF and returns DF description corresponding to the device connected using AT45_FindDevice().This function shall be called by the application before AT45_SendCommand.
  3. Sends a command to the DF through the SPI using AT45_SendCommand(). The command is identified by its command code and the number of bytes to transfer.
    1. Example code for sending command to write a page to DF.
      // Issue a page write through buffer 1 command
      error = AT45_SendCommand(pAt45, AT45_PAGE_WRITE_BUF1, 4, 
              pBuffer, size, address, 0, 0);
      
    2. Example code for sending command to read a page from DF. If data needs to be received, then a data buffer must be provided.
      // Issue a continuous read array command
      error = AT45_SendCommand(pAt45, AT45_CONTINUOUS_READ_LEG, 8,
              pBuffer, size, address, 0, 0);
      
    3. This function does not block; its optional callback will be invoked when the transfer completes.
  4. Check the AT45 driver is ready or not by polling AT45_IsBusy().