Implementation of SDMMC LLD Mode

Issue #192 resolved
Patryk Kubiak created an issue

General Description

The goal of the task is to implement part of SDMMC driver - LLD Mode. Note, that it is not the SDMMC LLD but a part of SDMMC core driver responsible for handling the LLD part. The mode should handle SDMMC LLD with all interrupts and interface has to be compatible with oC_SDMMC_Mode_Interface_t structure.

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

Mode information

  • Mode - oC_SDMMC_Mode_LLD
  • ModeName - "lld"

Related tasks

  • [ #191 ] - Implementation of SDMMC driver - General SDMMC architecture
  • [ #187 ] - LLD for SDMMC (STM32F7) - Implementation of LLD for STM32F7
  • [ #189 ] - LLD for SDMMC (STM32F4) - Implementation of LLD for STM32F4

Mode context structure

struct ModeContext_t
{
    /** @brief Field for object content verification (calculated by function #oC_CountObjectControl ) */
    oC_ObjectControl_t                  ObjectControl;
    /** @brief The semaphore is ready to take if new data is ready to receive */
    oC_Semaphore_t                      DataReadyToReceiveSemaphore;
    /** @brief The semaphore is ready to take if a module is ready to send new data */
    oC_Semaphore_t                      ReadyToSendNewDataSemaphore;
    /** @brief The semaphore is ready to take if last command has been sent */
    oC_Semaphore_t                      CommandSentSemaphore;
    /** @brief The semaphore is ready to take if last command response has been received */
    oC_Semaphore_t                      CommandResponseReceivedSemaphore;
    /** @brief The configuration of the LLD */
    oC_SDMMC_LLD_Config_t               LLDConfig;
};

Required Interface

// Turns on the mode
oC_ErrorCode_t oC_SDMMC_Mode_LLD_TurnOn( void );
// Turns off the mode
oC_ErrorCode_t oC_SDMMC_Mode_LLD_TurnOff( void );
// Checks if the given configuration is possible to set by using the mode
bool oC_SDMMC_Mode_LLD_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_LLD_Configure( const oC_SDMMC_Config_t * Config , oC_SDMMC_Context_t Context );
// Unconfigures the mode
oC_ErrorCode_t oC_SDMMC_Mode_LLD_Unconfigure( oC_SDMMC_Context_t Context );
// Sends SD/MMC command to card
oC_ErrorCode_t oC_SDMMC_Mode_LLD_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_LLD_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_LLD_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_LLD_InitializeCard( oC_SDMMC_Context_t Context , oC_Time_t Timeout );

Comments (9)

  1. Log in to comment