Ejemplo n.º 1
0
/******************************************************************************
  Function:
    void DRV_NVM_SST25VF064_Read(   uint32_t address,
                                    uint8_t *pData, 
                                    uint16_t nCount )

  Summary:
    Reads an array of bytes from the specified address.
    
  Description:
    This routine reads an array of bytes from the specified address location. The
    read array is saved to the location pointed to by pData. The number of bytes 
    to be read is specified by nCount.

  Parameters:
    address - starting address of the array to be read
    pData   - pointer to the destination of the read array
    nCount  - specifies the number of bytes to be read

  Returns:
    None
******************************************************************************/
void DRV_NVM_SST25VF064_Read(uint32_t address, uint8_t *pData, uint16_t nCount)
{
    while(!SPILOCK(spiInitData.channel));

    SPIINITIALIZE((DRV_SPI_INIT_DATA *)&spiInitData);

    SST25CSLow();

    PUTSPIBYTE(spiInitData.channel, SST25_CMD_READ);
    PUTSPIBYTE(spiInitData.channel, ((SST25_ADDRESS)address).uint8Address[2]);
    PUTSPIBYTE(spiInitData.channel, ((SST25_ADDRESS)address).uint8Address[1]);
    PUTSPIBYTE(spiInitData.channel, ((SST25_ADDRESS)address).uint8Address[0]);  

    DRV_SPI_GetBuffer(spiInitData.channel, pData, nCount);

    SST25CSHigh();
    SPIUNLOCK(spiInitData.channel);
}
Ejemplo n.º 2
0
/******************************************************************************
  Function:
    void DRV_NVM_M25P80_Read(   uint32_t address,
                                uint8_t *pData,
                                uint16_t nCount )

  Summary:
    Reads an array of bytes from the specified address.

  Description:
    This routine reads an array of bytes from the specified address location. The
    read array is saved to the location pointed to by pData. The number of bytes
    to be read is specified by nCount.

  Parameters:
    address - starting address of the array to be read
    pData   - pointer to the destination of the read array
    nCount  - specifies the number of bytes to be read

  Returns:
    None
******************************************************************************/
void DRV_NVM_M25P80_Read(uint32_t address, uint8_t *pData, uint16_t nCount)
{
    while(!SPILOCK(spiInitData.channel));

    DRV_SPI_Initialize((DRV_SPI_INIT_DATA *)&spiInitData);

    DRV_NVM_M25P80_ChipSelectEnable();

    PUTSPIBYTE(spiInitData.channel, M25P80_CMD_READ);
    PUTSPIBYTE(spiInitData.channel, ((M25P80_ADDRESS) address).uint8Address[2]);
    PUTSPIBYTE(spiInitData.channel, ((M25P80_ADDRESS) address).uint8Address[1]);
    PUTSPIBYTE(spiInitData.channel, ((M25P80_ADDRESS) address).uint8Address[0]);

    DRV_SPI_GetBuffer(spiInitData.channel, pData, nCount);

    DRV_NVM_M25P80_ChipSelectDisable();
    SPIUNLOCK(spiInitData.channel);
}