Implementation of SDMMC SPI Mode

Issue #193 new
Patryk Kubiak created an issue

General Description

The goal of the task is to implement part of SDMMC driver - SPI Mode. The module has to configure and use SPI driver to communicate with the card. The interface has to be compatible with oC_SDMMC_Mode_Interface_t structure.

Trello link: https://trello.com/c/hOFe00bo

Mode information

  • Mode - oC_SDMMC_Mode_SPI
  • ModeName - "spi"

Related tasks

  • [ #191 ] - Implementation of SDMMC driver - General SDMMC architecture

Mode context structure

struct ModeContext_t
{
    /** @brief Field for object content verification (calculated by function #oC_CountObjectControl ) */
    oC_ObjectControl_t                  ObjectControl;
    /** @brief Context of the configured SPI */
    oC_SPI_Context_t                    SpiContext;
    /** @brief Set to `true` if SPI has been configured by the SDMMC driver */
    bool                                SpiConfigured;
};

Required Interface

// Turns on the mode
oC_ErrorCode_t oC_SDMMC_Mode_SPI_TurnOn( void );
// Turns off the mode
oC_ErrorCode_t oC_SDMMC_Mode_SPI_TurnOff( void );
// Checks if the given configuration is possible to set by using the mode
bool oC_SDMMC_Mode_SPI_IsSupported( const oC_SDMMC_Config_t * Config , oC_SDMMC_Context_t Context );
// Prepares the mode to work with the given configuration
oC_ErrorCode_t oC_SDMMC_Mode_SPI_Configure( const oC_SDMMC_Config_t * Config , oC_SDMMC_Context_t Context );
// Unconfigures the mode
oC_ErrorCode_t oC_SDMMC_Mode_SPI_Unconfigure( oC_SDMMC_Context_t Context );
// Sends SD/MMC command to card
oC_ErrorCode_t oC_SDMMC_Mode_SPI_SendCommand( oC_SDMMC_Context_t Context , oC_SDMMC_Command_t * Command , oC_Time_t Timeout );
// Reads data by using the mode
oC_ErrorCode_t oC_SDMMC_Mode_SPI_ReadData( oC_SDMMC_Context_t Context , char * outBuffer, oC_MemorySize_t * Size , oC_Time_t Timeout );
// Writes data by using the mode
oC_ErrorCode_t oC_SDMMC_Mode_SPI_WriteData( oC_SDMMC_Context_t Context ,  const char * Buffer, oC_MemorySize_t * Size , oC_Time_t Timeout );
// Initializes card after detection
oC_ErrorCode_t oC_SDMMC_Mode_SPI_InitializeCard( oC_SDMMC_Context_t Context , oC_Time_t Timeout );

Comments (8)

  1. Log in to comment