CMSIS-Driver_PIC32CZ-MC70  
Peripheral Library (PLIB) Documentation
 
Loading...
Searching...
No Matches
HSMCI Interface

Driver API for HSMCI (plib_hsmci.h) More...

Data Structures

struct  HSMCI_COMMAND
 Parameters for a command issued on the HSMCI bus via HSMCI_SendCommand(). More...
 

Typedefs

typedef uint32_t HSMCI_BUS_WIDTH
 Type definition for the HSMCI SD/SDIO bus width selection (SDCBUS in HSMCI_SDCR). Use one of the HSMCI_SDCR_SDCBUS_*_Val constants from the component header.
 
typedef uint32_t HSMCI_RESPONSE_TYPE
 Type definition for the HSMCI command response type selection (RSPTYP in HSMCI_CMDR). Use one of the HSMCI_CMDR_RSPTYP_*_Val constants from the component header.
 
typedef uint32_t HSMCI_TRANSFER_CMD
 Type definition for the HSMCI data transfer command selection (TRCMD in HSMCI_CMDR). Use one of the HSMCI_CMDR_TRCMD_*_Val constants from the component header.
 
typedef uint32_t HSMCI_TRANSFER_DIR
 Type definition for the HSMCI data transfer direction selection (TRDIR in HSMCI_CMDR). Use one of the HSMCI_CMDR_TRDIR_*_Val constants from the component header.
 
typedef uint32_t HSMCI_TRANSFER_TYPE
 Type definition for the HSMCI data transfer type selection (TRTYP in HSMCI_CMDR). Use one of the HSMCI_CMDR_TRTYP_*_Val constants from the component header.
 
typedef uint32_t HSMCI_SPECIAL_CMD
 Type definition for the HSMCI special command selection (SPCMD in HSMCI_CMDR). Use one of the HSMCI_CMDR_SPCMD_*_Val constants from the component header.
 
typedef uint32_t HSMCI_SDIO_SPECIAL_CMD
 Type definition for the HSMCI SDIO special command selection (IOSPCMD in HSMCI_CMDR). Use one of the HSMCI_CMDR_IOSPCMD_*_Val constants from the component header.
 
typedef void(* HSMCI_CALLBACK) (uint32_t status)
 Function pointer type for HSMCI event callback.
 

Functions

void HSMCI_ResetSoftware (void)
 Performs a software reset of the HSMCI peripheral.
 
void HSMCI_Enable (void)
 Enables the HSMCI peripheral.
 
void HSMCI_Disable (void)
 Disables the HSMCI peripheral.
 
void HSMCI_SetPowerSave (bool enable)
 Enables or disables power save mode.
 
void HSMCI_SetClockDivider (uint8_t clk_div, bool clk_odd)
 Sets the MCI clock divider and odd-division setting.
 
void HSMCI_SetPowerSavingDivider (uint8_t pws_div)
 Sets the power saving clock divider.
 
void HSMCI_SetReadProof (bool enable)
 Enables or disables Read Proof (deactivates the MCI clock during read data if the internal FIFO is full).
 
void HSMCI_SetWriteProof (bool enable)
 Enables or disables Write Proof (deactivates the MCI clock during write data if the internal FIFO is full).
 
void HSMCI_SetForceByteTransfer (bool enable)
 Enables or disables forcing byte transfers for the last transfer of a data block when the block length is not a multiple of four bytes.
 
void HSMCI_SetPaddingValue (bool high_level)
 Sets the padding value driven on the data bus when there is no more data to transfer.
 
void HSMCI_SetBusWidth (HSMCI_BUS_WIDTH width)
 Selects the SD/SDIO bus width.
 
void HSMCI_SetDataTimeout (uint8_t cycles, uint8_t multiplier)
 Sets the data timeout period.
 
void HSMCI_SetCompletionSignalTimeout (uint8_t cycles, uint8_t multiplier)
 Sets the CE-ATA completion signal timeout period.
 
void HSMCI_SetBlockLength (uint16_t block_count, uint16_t block_length)
 Sets the block count and block length used by the next data transfer.
 
void HSMCI_SendCommand (const HSMCI_COMMAND *command)
 Writes the command argument and command register, issuing a command on the HSMCI bus.
 
uint32_t HSMCI_GetResponse (uint8_t index)
 Retrieves a word of the response of the last issued command.
 
uint32_t HSMCI_ReadData (void)
 Reads a 32-bit word from the HSMCI receive data register.
 
void HSMCI_WriteData (uint32_t data)
 Writes a 32-bit word to the HSMCI transmit data register.
 
uint32_t HSMCI_ReadFIFOData (uint16_t index)
 Reads a 32-bit word from the HSMCI internal FIFO memory aperture.
 
void HSMCI_WriteFIFOData (uint16_t index, uint32_t data)
 Writes a 32-bit word to the HSMCI internal FIFO memory aperture.
 
uint32_t HSMCI_GetStatus (void)
 Retrieves the current HSMCI status register (HSMCI_SR) value.
 
bool HSMCI_CommandIsReady (void)
 Checks whether the HSMCI command register is ready to accept a new command.
 
bool HSMCI_ReceiverIsReady (void)
 Checks whether the HSMCI receive data register holds data ready to be read.
 
bool HSMCI_TransmitterIsReady (void)
 Checks whether the HSMCI transmit data register is ready to accept new data.
 
bool HSMCI_DataTransferIsInProgress (void)
 Checks whether a data transfer is currently in progress.
 
bool HSMCI_IsNotBusy (void)
 Checks whether the HSMCI interface (card data line) is busy.
 
bool HSMCI_TransferIsDone (void)
 Checks whether the current data transfer has completed.
 
void HSMCI_EnableInterrupt (uint32_t flag)
 Enables one or more HSMCI interrupt sources.
 
void HSMCI_DisableInterrupt (uint32_t flag)
 Disables one or more HSMCI interrupt sources.
 
uint32_t HSMCI_GetInterruptMask (void)
 Retrieves the current HSMCI interrupt mask register value.
 
void HSMCI_EnableDMA (uint8_t chunk_size)
 Enables DMA hardware handshaking and sets the DMA channel read/write chunk size.
 
void HSMCI_DisableDMA (void)
 Disables DMA hardware handshaking.
 
void HSMCI_SetFIFOMode (bool enable)
 Selects the HSMCI internal FIFO control mode.
 
void HSMCI_SetFlowErrorResetControl (bool enable)
 Selects the flow error flag (OVRE/UNRE) reset control mode.
 
void HSMCI_SetHighSpeedMode (bool enable)
 Enables or disables High Speed mode.
 
void HSMCI_SetLastBlockSync (bool enable)
 Enables or disables synchronization of a pending command on the last block of the current data transfer.
 
void HSMCI_SetWriteProtection (bool enable)
 Enables or disables write protection for the HSMCI configuration registers.
 
bool HSMCI_GetWriteProtectionViolation (uint16_t *violation_src)
 Retrieves the write protection violation status.
 
void HSMCI_SetCallbackHandler (HSMCI_CALLBACK callback)
 Registers the callback function to be invoked from the HSMCI ISR.
 

Variables

uint8_t HSMCI_COMMAND::cmd_number
 
uint32_t HSMCI_COMMAND::argument
 
HSMCI_RESPONSE_TYPE HSMCI_COMMAND::response_type
 
HSMCI_SPECIAL_CMD HSMCI_COMMAND::special_cmd
 
HSMCI_SDIO_SPECIAL_CMD HSMCI_COMMAND::sdio_special_cmd
 
HSMCI_TRANSFER_CMD HSMCI_COMMAND::transfer_cmd
 
HSMCI_TRANSFER_DIR HSMCI_COMMAND::transfer_dir
 
HSMCI_TRANSFER_TYPE HSMCI_COMMAND::transfer_type
 
bool HSMCI_COMMAND::open_drain
 
bool HSMCI_COMMAND::max_latency_64cyc
 
bool HSMCI_COMMAND::boot_ack
 
bool HSMCI_COMMAND::ata_completion_signal
 

Description

Driver API for HSMCI (plib_hsmci.h)

Usage Example

The following example demonstrates typical usage of the HSMCI peripheral:

/*******************************************************************************
* Copyright (C) 2026 Microchip Technology Inc. and its subsidiaries.
*
* Subject to your compliance with these terms, you may use Microchip software
* and any derivatives exclusively with Microchip products. It is your
* responsibility to comply with third party license terms applicable to your
* use of third party software (including open source software) that may
* accompany Microchip software.
*
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
* EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
* WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
* INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
* WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
* BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
* FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
* ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
* THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
******************************************************************************/
/*******************************************************************************
* @file configure_hsmci.c
* @brief HSMCI peripheral initialization and interrupt callback example.
*
* This example demonstrates how to configure the High Speed Multimedia
* Card Interface (HSMCI) peripheral for SD/MMC card communication using:
* - Slow identification clock during startup
* - 1-bit bus mode during card detection
* - Read/write proof protection
* - Interrupt-driven command and transfer completion handling
*
* The callback handler is registered to process command-ready and
* transfer-done events generated by the HSMCI peripheral.
******************************************************************************/
#include "plib_hsmci.h"
static void HmsciCallback(uint32_t status)
{
if ((status & (HSMCI_SR_CMDRDY_Msk | HSMCI_SR_XFRDONE_Msk)) != 0U)
{
/* Handle command-ready / transfer-done event */
}
}
int32_t configure_hsmci(void)
{
/* Slow identification-rate clock divider value. */
const uint8_t HSMCI_INIT_CLKDIV = 14U;
/* Power saving divider disabled. */
const uint8_t HSMCI_INIT_PWSDIV = 0U;
/* Data timeout cycle count. */
const uint8_t HSMCI_INIT_DTOCYC = 7U;
/* Software reset of the HSMCI peripheral */
/* Disable write protection to allow register configuration */
/* Slow identification-rate clock, no power saving divider */
HSMCI_SetClockDivider(HSMCI_INIT_CLKDIV, false);
HSMCI_SetPowerSavingDivider(HSMCI_INIT_PWSDIV);
/* 1-bit bus width until the card's capabilities are known */
HSMCI_SetBusWidth(HSMCI_SDCR_SDCBUS_1_Val);
/* Data timeout: DTOCYC x DTOMUL cycles */
HSMCI_SetDataTimeout(HSMCI_INIT_DTOCYC,
(uint8_t)HSMCI_DTOR_DTOMUL_1024_Val);
/* Avoid FIFO overrun/underrun during transfers */
/* Enable the HSMCI peripheral */
/* Register callback and enable interrupts */
HSMCI_SetCallbackHandler(&HmsciCallback);
HSMCI_EnableInterrupt(HSMCI_IER_CMDRDY_Msk |
HSMCI_IER_XFRDONE_Msk);
/* Re-enable write protection */
return 0;
}
void HSMCI_SetClockDivider(uint8_t clk_div, bool clk_odd)
Sets the MCI clock divider and odd-division setting.
void HSMCI_SetBusWidth(HSMCI_BUS_WIDTH width)
Selects the SD/SDIO bus width.
void HSMCI_SetReadProof(bool enable)
Enables or disables Read Proof (deactivates the MCI clock during read data if the internal FIFO is fu...
void HSMCI_ResetSoftware(void)
Performs a software reset of the HSMCI peripheral.
void HSMCI_EnableInterrupt(uint32_t flag)
Enables one or more HSMCI interrupt sources.
void HSMCI_Enable(void)
Enables the HSMCI peripheral.
void HSMCI_SetWriteProof(bool enable)
Enables or disables Write Proof (deactivates the MCI clock during write data if the internal FIFO is ...
void HSMCI_SetPowerSavingDivider(uint8_t pws_div)
Sets the power saving clock divider.
void HSMCI_SetCallbackHandler(HSMCI_CALLBACK callback)
Registers the callback function to be invoked from the HSMCI ISR.
void HSMCI_SetDataTimeout(uint8_t cycles, uint8_t multiplier)
Sets the data timeout period.
void HSMCI_SetWriteProtection(bool enable)
Enables or disables write protection for the HSMCI configuration registers.

Typedef Documentation

◆ HSMCI_BUS_WIDTH

typedef uint32_t HSMCI_BUS_WIDTH

Type definition for the HSMCI SD/SDIO bus width selection (SDCBUS in HSMCI_SDCR). Use one of the HSMCI_SDCR_SDCBUS_*_Val constants from the component header.

◆ HSMCI_CALLBACK

typedef void(* HSMCI_CALLBACK) (uint32_t status)

Function pointer type for HSMCI event callback.

Parameters
statusHSMCI status register value (masked by the interrupt mask register) at the time of the interrupt.

◆ HSMCI_RESPONSE_TYPE

typedef uint32_t HSMCI_RESPONSE_TYPE

Type definition for the HSMCI command response type selection (RSPTYP in HSMCI_CMDR). Use one of the HSMCI_CMDR_RSPTYP_*_Val constants from the component header.

◆ HSMCI_SDIO_SPECIAL_CMD

typedef uint32_t HSMCI_SDIO_SPECIAL_CMD

Type definition for the HSMCI SDIO special command selection (IOSPCMD in HSMCI_CMDR). Use one of the HSMCI_CMDR_IOSPCMD_*_Val constants from the component header.

◆ HSMCI_SPECIAL_CMD

typedef uint32_t HSMCI_SPECIAL_CMD

Type definition for the HSMCI special command selection (SPCMD in HSMCI_CMDR). Use one of the HSMCI_CMDR_SPCMD_*_Val constants from the component header.

◆ HSMCI_TRANSFER_CMD

typedef uint32_t HSMCI_TRANSFER_CMD

Type definition for the HSMCI data transfer command selection (TRCMD in HSMCI_CMDR). Use one of the HSMCI_CMDR_TRCMD_*_Val constants from the component header.

◆ HSMCI_TRANSFER_DIR

typedef uint32_t HSMCI_TRANSFER_DIR

Type definition for the HSMCI data transfer direction selection (TRDIR in HSMCI_CMDR). Use one of the HSMCI_CMDR_TRDIR_*_Val constants from the component header.

◆ HSMCI_TRANSFER_TYPE

typedef uint32_t HSMCI_TRANSFER_TYPE

Type definition for the HSMCI data transfer type selection (TRTYP in HSMCI_CMDR). Use one of the HSMCI_CMDR_TRTYP_*_Val constants from the component header.

Function Documentation

◆ HSMCI_CommandIsReady()

bool HSMCI_CommandIsReady ( void )

Checks whether the HSMCI command register is ready to accept a new command.

Note
Reads HSMCI_SR, which clears its read-to-clear flags in hardware (CMDRDY itself is not one of them). Avoid calling this while interrupt-driven operation is active, as it can clear other pending flags before HSMCI_Handler() observes them.
Returns
true if command ready, false otherwise.

◆ HSMCI_DataTransferIsInProgress()

bool HSMCI_DataTransferIsInProgress ( void )

Checks whether a data transfer is currently in progress.

Note
Reads HSMCI_SR, which clears its read-to-clear flags in hardware (DTIP itself is not one of them). Avoid calling this while interrupt-driven operation is active, as it can clear other pending flags before HSMCI_Handler() observes them.
Returns
true if a data transfer is in progress, false otherwise.

◆ HSMCI_Disable()

void HSMCI_Disable ( void )

Disables the HSMCI peripheral.

Returns
void

◆ HSMCI_DisableDMA()

void HSMCI_DisableDMA ( void )

Disables DMA hardware handshaking.

Returns
void

◆ HSMCI_DisableInterrupt()

void HSMCI_DisableInterrupt ( uint32_t flag)

Disables one or more HSMCI interrupt sources.

Parameters
flagBitwise OR of HSMCI_IDR_*_Msk values representing the interrupt sources to disable.
Returns
void

◆ HSMCI_Enable()

void HSMCI_Enable ( void )

Enables the HSMCI peripheral.

Returns
void

◆ HSMCI_EnableDMA()

void HSMCI_EnableDMA ( uint8_t chunk_size)

Enables DMA hardware handshaking and sets the DMA channel read/write chunk size.

Parameters
chunk_size3-bit chunk size value (refer to HSMCI_DMA_CHKSIZE field definitions).
Returns
void

◆ HSMCI_EnableInterrupt()

void HSMCI_EnableInterrupt ( uint32_t flag)

Enables one or more HSMCI interrupt sources.

Parameters
flagBitwise OR of HSMCI_IER_*_Msk values representing the interrupt sources to enable.
Returns
void

◆ HSMCI_GetInterruptMask()

uint32_t HSMCI_GetInterruptMask ( void )

Retrieves the current HSMCI interrupt mask register value.

Returns
32-bit interrupt mask register value.

◆ HSMCI_GetResponse()

uint32_t HSMCI_GetResponse ( uint8_t index)

Retrieves a word of the response of the last issued command.

Parameters
indexResponse register index (0-3, only relevant for a 136-bit response).
Returns
32-bit response value.

◆ HSMCI_GetStatus()

uint32_t HSMCI_GetStatus ( void )

Retrieves the current HSMCI status register (HSMCI_SR) value.

Note
Reading HSMCI_SR clears its read-to-clear flags in hardware. Avoid calling this while interrupt-driven operation is active, as it can clear flags before HSMCI_Handler() observes them.
Returns
32-bit status register value.

◆ HSMCI_GetWriteProtectionViolation()

bool HSMCI_GetWriteProtectionViolation ( uint16_t * violation_src)

Retrieves the write protection violation status.

Parameters
violation_srcPointer to a variable that will receive the violation source identifier.
Returns
true if a write protection violation has occurred, false otherwise.

◆ HSMCI_IsNotBusy()

bool HSMCI_IsNotBusy ( void )

Checks whether the HSMCI interface (card data line) is busy.

Note
Reads HSMCI_SR, which clears its read-to-clear flags in hardware (NOTBUSY itself is not one of them). Avoid calling this while interrupt-driven operation is active, as it can clear other pending flags before HSMCI_Handler() observes them.
Returns
true if the HSMCI is not busy, false if busy.

◆ HSMCI_ReadData()

uint32_t HSMCI_ReadData ( void )

Reads a 32-bit word from the HSMCI receive data register.

Returns
32-bit data value.

◆ HSMCI_ReadFIFOData()

uint32_t HSMCI_ReadFIFOData ( uint16_t index)

Reads a 32-bit word from the HSMCI internal FIFO memory aperture.

Parameters
indexFIFO word index (0-255).
Returns
32-bit data value.

◆ HSMCI_ReceiverIsReady()

bool HSMCI_ReceiverIsReady ( void )

Checks whether the HSMCI receive data register holds data ready to be read.

Note
Reads HSMCI_SR, which clears its read-to-clear flags in hardware (RXRDY itself is not one of them). Avoid calling this while interrupt-driven operation is active, as it can clear other pending flags before HSMCI_Handler() observes them.
Returns
true if receiver ready, false otherwise.

◆ HSMCI_ResetSoftware()

void HSMCI_ResetSoftware ( void )

Performs a software reset of the HSMCI peripheral.

Returns
void

◆ HSMCI_SendCommand()

void HSMCI_SendCommand ( const HSMCI_COMMAND * command)

Writes the command argument and command register, issuing a command on the HSMCI bus.

Parameters
commandPointer to the command parameters to issue.
Returns
void

◆ HSMCI_SetBlockLength()

void HSMCI_SetBlockLength ( uint16_t block_count,
uint16_t block_length )

Sets the block count and block length used by the next data transfer.

Parameters
block_countMMC/SDIO block count, or SDIO byte count.
block_lengthData block length in bytes.
Returns
void

◆ HSMCI_SetBusWidth()

void HSMCI_SetBusWidth ( HSMCI_BUS_WIDTH width)

Selects the SD/SDIO bus width.

Parameters
widthRequested bus width; one of the HSMCI_SDCR_SDCBUS_*_Val constants from the component header.
Returns
void

◆ HSMCI_SetCallbackHandler()

void HSMCI_SetCallbackHandler ( HSMCI_CALLBACK callback)

Registers the callback function to be invoked from the HSMCI ISR.

Parameters
callbackPointer to the callback function (NULL to clear).
Returns
void

◆ HSMCI_SetClockDivider()

void HSMCI_SetClockDivider ( uint8_t clk_div,
bool clk_odd )

Sets the MCI clock divider and odd-division setting.

Parameters
clk_div8-bit clock divider value.
clk_oddtrue if the divider is odd, false otherwise.
Returns
void

◆ HSMCI_SetCompletionSignalTimeout()

void HSMCI_SetCompletionSignalTimeout ( uint8_t cycles,
uint8_t multiplier )

Sets the CE-ATA completion signal timeout period.

Parameters
cycles4-bit completion signal timeout cycle number (CSTOCYC).
multiplier3-bit completion signal timeout multiplier (CSTOMUL).
Returns
void

◆ HSMCI_SetDataTimeout()

void HSMCI_SetDataTimeout ( uint8_t cycles,
uint8_t multiplier )

Sets the data timeout period.

Parameters
cycles4-bit data timeout cycle number (DTOCYC).
multiplier3-bit data timeout multiplier (DTOMUL).
Returns
void

◆ HSMCI_SetFIFOMode()

void HSMCI_SetFIFOMode ( bool enable)

Selects the HSMCI internal FIFO control mode.

Parameters
enabletrue to select the new FIFO control mode, false to select the legacy mode.
Returns
void

◆ HSMCI_SetFlowErrorResetControl()

void HSMCI_SetFlowErrorResetControl ( bool enable)

Selects the flow error flag (OVRE/UNRE) reset control mode.

Parameters
enabletrue so flags are only cleared by writing HSMCI_CMDR, false to clear on read.
Returns
void

◆ HSMCI_SetForceByteTransfer()

void HSMCI_SetForceByteTransfer ( bool enable)

Enables or disables forcing byte transfers for the last transfer of a data block when the block length is not a multiple of four bytes.

Parameters
enabletrue to enable forced byte transfers, false to disable.
Returns
void

◆ HSMCI_SetHighSpeedMode()

void HSMCI_SetHighSpeedMode ( bool enable)

Enables or disables High Speed mode.

Parameters
enabletrue to enable, false to disable.
Returns
void

◆ HSMCI_SetLastBlockSync()

void HSMCI_SetLastBlockSync ( bool enable)

Enables or disables synchronization of a pending command on the last block of the current data transfer.

Parameters
enabletrue to enable, false to disable.
Returns
void

◆ HSMCI_SetPaddingValue()

void HSMCI_SetPaddingValue ( bool high_level)

Sets the padding value driven on the data bus when there is no more data to transfer.

Parameters
high_leveltrue to pad with 0xFF, false to pad with 0x00.
Returns
void

◆ HSMCI_SetPowerSave()

void HSMCI_SetPowerSave ( bool enable)

Enables or disables power save mode.

Parameters
enabletrue to enable power save mode (MCI clock only asserted on card bus cycles), false to disable (MCI clock always asserted).
Returns
void

◆ HSMCI_SetPowerSavingDivider()

void HSMCI_SetPowerSavingDivider ( uint8_t pws_div)

Sets the power saving clock divider.

Parameters
pws_div3-bit power saving divider value.
Returns
void

◆ HSMCI_SetReadProof()

void HSMCI_SetReadProof ( bool enable)

Enables or disables Read Proof (deactivates the MCI clock during read data if the internal FIFO is full).

Parameters
enabletrue to enable, false to disable.
Returns
void

◆ HSMCI_SetWriteProof()

void HSMCI_SetWriteProof ( bool enable)

Enables or disables Write Proof (deactivates the MCI clock during write data if the internal FIFO is full).

Parameters
enabletrue to enable, false to disable.
Returns
void

◆ HSMCI_SetWriteProtection()

void HSMCI_SetWriteProtection ( bool enable)

Enables or disables write protection for the HSMCI configuration registers.

Parameters
enabletrue to enable, false to disable.
Returns
void

◆ HSMCI_TransferIsDone()

bool HSMCI_TransferIsDone ( void )

Checks whether the current data transfer has completed.

Note
Reads HSMCI_SR, which clears its read-to-clear flags in hardware (XFRDONE itself is not one of them). Avoid calling this while interrupt-driven operation is active, as it can clear other pending flags before HSMCI_Handler() observes them.
Returns
true if the transfer is done, false otherwise.

◆ HSMCI_TransmitterIsReady()

bool HSMCI_TransmitterIsReady ( void )

Checks whether the HSMCI transmit data register is ready to accept new data.

Note
Reads HSMCI_SR, which clears its read-to-clear flags in hardware (TXRDY itself is not one of them). Avoid calling this while interrupt-driven operation is active, as it can clear other pending flags before HSMCI_Handler() observes them.
Returns
true if transmitter ready, false otherwise.

◆ HSMCI_WriteData()

void HSMCI_WriteData ( uint32_t data)

Writes a 32-bit word to the HSMCI transmit data register.

Parameters
data32-bit data value.
Returns
void

◆ HSMCI_WriteFIFOData()

void HSMCI_WriteFIFOData ( uint16_t index,
uint32_t data )

Writes a 32-bit word to the HSMCI internal FIFO memory aperture.

Parameters
indexFIFO word index (0-255).
data32-bit data value.
Returns
void

Variable Documentation

◆ argument

uint32_t HSMCI_COMMAND::argument

Command argument.

◆ ata_completion_signal

bool HSMCI_COMMAND::ata_completion_signal

true = CE-ATA completion signal expected.

◆ boot_ack

bool HSMCI_COMMAND::boot_ack

true = boot acknowledge expected.

◆ cmd_number

uint8_t HSMCI_COMMAND::cmd_number

Command index (0-63).

◆ max_latency_64cyc

bool HSMCI_COMMAND::max_latency_64cyc

true = 64-cycle latency, false = 5-cycle.

◆ open_drain

bool HSMCI_COMMAND::open_drain

true = open drain, false = push-pull.

◆ response_type

HSMCI_RESPONSE_TYPE HSMCI_COMMAND::response_type

Expected response type.

◆ sdio_special_cmd

HSMCI_SDIO_SPECIAL_CMD HSMCI_COMMAND::sdio_special_cmd

SDIO special command selection.

◆ special_cmd

HSMCI_SPECIAL_CMD HSMCI_COMMAND::special_cmd

Special command selection.

◆ transfer_cmd

HSMCI_TRANSFER_CMD HSMCI_COMMAND::transfer_cmd

Data transfer command.

◆ transfer_dir

HSMCI_TRANSFER_DIR HSMCI_COMMAND::transfer_dir

Data transfer direction.

◆ transfer_type

HSMCI_TRANSFER_TYPE HSMCI_COMMAND::transfer_type

Data transfer type.