MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Disk

Overview

SD Disk Function

DSTATUS sd_disk_initialize (uint8_t physicalDrive)
 Initializes SD disk. More...
 
DSTATUS sd_disk_status (uint8_t physicalDrive)
 Gets SD disk status. More...
 
DRESULT sd_disk_read (uint8_t physicalDrive, uint8_t *buffer, uint32_t sector, uint8_t count)
 Reads SD disk. More...
 
DRESULT sd_disk_write (uint8_t physicalDrive, const uint8_t *buffer, uint32_t sector, uint8_t count)
 Writes SD disk. More...
 
DRESULT sd_disk_ioctl (uint8_t physicalDrive, uint8_t command, void *buffer)
 SD disk IO operation. More...
 

SD over SPI Disk Function

DSTATUS sdspi_disk_initialize (uint8_t physicalDrive)
 Initializes SD disk over SPI. More...
 
DSTATUS sdspi_disk_status (uint8_t physicalDrive)
 Gets SD over SPI disk status. More...
 
DRESULT sdspi_disk_read (uint8_t physicalDrive, uint8_t *buffer, uint32_t sector, uint8_t count)
 Reads SD disk over SPI. More...
 
DRESULT sdspi_disk_write (uint8_t physicalDrive, const uint8_t *buffer, uint32_t sector, uint8_t count)
 Writes to SD disk over SPI. More...
 
DRESULT sdspi_disk_ioctl (uint8_t physicalDrive, uint8_t command, void *buffer)
 SD over SPI disk IO operation. More...
 
void spi_init (void)
 Initializes the SPI.
 
status_t spi_set_frequency (uint32_t frequency)
 Sets the SPI bus frequency. More...
 
status_t spi_exchange (uint8_t *in, uint8_t *out, uint32_t size)
 Transfers data over SPI bus in full-duplex way. More...
 
void timer_init (void)
 Initializes the timer to generator 1ms interrupt used to get current time in milliseconds.
 
uint32_t timer_get_current_milliseconds (void)
 Gets current time in milliseconds. More...
 
void sdspi_host_init (void)
 Initializes the host descriptor.
 

Function Documentation

DSTATUS sd_disk_initialize ( uint8_t  physicalDrive)
Parameters
physicalDrivePhysical drive number.
Return values
STA_NOINITFailed.
RES_OKSuccess.
DSTATUS sd_disk_status ( uint8_t  physicalDrive)
Parameters
physicalDrivePhysical drive number.
Return values
STA_NOINITFailed.
RES_OKSuccess.
DRESULT sd_disk_read ( uint8_t  physicalDrive,
uint8_t *  buffer,
uint32_t  sector,
uint8_t  count 
)
Parameters
physicalDrivePhysical drive number.
bufferThe data buffer pointer to store read content.
sectorThe start sector number to be read.
countThe sector count to be read.
Return values
RES_PARERRFailed.
RES_OKSuccess.
DRESULT sd_disk_write ( uint8_t  physicalDrive,
const uint8_t *  buffer,
uint32_t  sector,
uint8_t  count 
)
Parameters
physicalDrivePhysical drive number.
bufferThe data buffer pointer to store write content.
sectorThe start sector number to be written.
countThe sector count to be written.
Return values
RES_PARERRFailed.
RES_OKSuccess.
DRESULT sd_disk_ioctl ( uint8_t  physicalDrive,
uint8_t  command,
void *  buffer 
)
Parameters
physicalDrivePhysical drive number.
commandThe command to be set.
bufferThe buffer to store command result.
Return values
RES_PARERRFailed.
RES_OKSuccess.
DSTATUS sdspi_disk_initialize ( uint8_t  physicalDrive)
Parameters
physicalDrivePhysical drive number.
Return values
STA_NOINITFailed.
RES_OKSuccess.
DSTATUS sdspi_disk_status ( uint8_t  physicalDrive)
Parameters
physicalDrivePhysical drive number.
Return values
STA_NOINITFailed.
RES_OKSuccess.
DRESULT sdspi_disk_read ( uint8_t  physicalDrive,
uint8_t *  buffer,
uint32_t  sector,
uint8_t  count 
)
Parameters
physicalDrivePhysical drive number.
bufferThe data buffer pointer to store read content.
sectorThe start sector number to be read.
countThe sector count to be read.
Return values
RES_PARERRFailed.
RES_OKSuccess.
DRESULT sdspi_disk_write ( uint8_t  physicalDrive,
const uint8_t *  buffer,
uint32_t  sector,
uint8_t  count 
)
Parameters
physicalDrivePhysical drive number.
bufferThe data buffer pointer to store write content.
sectorThe start sector number to be written.
countThe sector count to be written.
Return values
RES_PARERRFailed.
RES_OKSuccess.
DRESULT sdspi_disk_ioctl ( uint8_t  physicalDrive,
uint8_t  command,
void *  buffer 
)
Parameters
physicalDrivePhysical drive number.
commandThe command to be set.
bufferThe buffer to store command result.
Return values
RES_PARERRFailed.
RES_OKSuccess.
status_t spi_set_frequency ( uint32_t  frequency)
Parameters
frequencyThe frequency to set.
Return values
kStatus_SuccessSuccess.
kStatus_FailFailed.
status_t spi_exchange ( uint8_t *  in,
uint8_t *  out,
uint32_t  size 
)
Parameters
inThe buffer to save the data to be sent.
outThe buffer to save the data to be read.
sizeThe transfer data size.
Returns
The status of the function DSPI_MasterTransferPolling().
uint32_t timer_get_current_milliseconds ( void  )
Returns
Current time in milliseconds.