at26.h
Default mainpageat91libmemoriesspi-flashat26.h
Description Overview  
Description
Purpose
The AT26 serial firmware 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 AT26 instance and configures SPI chip select pin using AT26_Configure().
  2. Detect DF and returns DF description corresponding to the device connected using AT26_FindDevice().This function shall be called by the application before AT26_SendCommand().
  3. Sends a command to the DF through the SPI using AT26_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.
      // Program page
      error = AT26_SendCommand(pAt26, AT26_BYTE_PAGE_PROGRAM, 4,
              pData, writeSize, 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.
      // Start a read operation
      error = AT26_SendCommand(pAt26, AT26_READ_ARRAY_LF, 
              4, pData, size, address, 0, 0);
      
    3. This function does not block; its optional callback will be invoked when the transfer completes.
  4. Check the AT26 driver is ready or not by polling AT26_IsBusy().