www.ti.com
Peripheral Library APIs
371
SWRU543–January 2019
Submit Documentation Feedback
Copyright © 2019, Texas Instruments Incorporated
SD Host Controller Interface
long SDHostCmdSend(unsigned long ulBase, unsigned long ulCmd, unsigned ulArg)
• Description: This function sends a command to the attached card over the SD host interface.
Parameters:
– ulBase – Base address of the SD host module
– ulCmd – Command to be send to the card
– ulArg – Argument for the command
The ulCmd parameter can be in the range from SDHOST_CMD_0 to SDHOST_CMD_63. It can be
logically ORed with one or more of the following:
– SDHOST_MULTI_BLK: For multiblock transfer
– SDHOST_WR_CMD: If the command is followed by write data
– SDHOST_RD_CMD: If the command is followed by read data
– SDHOST_DMA_EN: If data transfer must generate a DMA request
• Return: Returns 0 on success, –1 otherwise
void SDHostIntRegister(unsigned long ulBase, void (*pfnHandler)(void))
• Description: This function registers the interrupt handler and enables the global interrupt in the
interrupt controller; specific interrupts must be enabled using SDHostIntEnable(). The interrupt handler
must clear the interrupt source.
• Parameters:
– ulBase – Base address of the SD host module
– pfnHandler – Pointer to the SD host interrupt handler function
• Return: None
void SDHostIntUnregister(unsigned long ulBase)
• Description: This function unregisters the interrupt handler and clears the handler to be called when
an SD host interrupt occurs. This also masks off the interrupt in the interrupt controller, so that the
interrupt handler is no longer called.
• Parameters: ulBase – Base address of the SD host module
• Return: None
void SDHostIntEnable(unsigned long ulBase, unsigned long ulIntFlags)
• Description: This function enables the indicated SD host interrupt sources. Only enabled sources can
be reflected to the processor interrupt; disabled sources have no effect on the processor.
• Parameters:
– ulBase – Base address of the SD host module
– ulIntFlags – Bit mask of the interrupt sources to be enabled
The ulIntFlags parameter is the logical OR of any of the following:
– SDHOST_INT_CC: Command Complete interrupt
– SDHOST_INT_TC: Transfer Complete interrupt
– SDHOST_INT_BWR: Buffer Write Ready interrupt
– SDHOST_INT_BWR: Buffer Read Ready interrupt
– SDHOST_INT_ERRI: Error interrupt
• SDHOST_INT_ERRI is valid only with SDHostIntStatus(), and is internally logical OR of all error
status bits. Setting SDHOST_INT_ERRI alone as ulIntFlags does not generate any interrupt.
– SDHOST_INT_CTO: Command Timeout error interrupt
– SDHOST_INT_CEB: Command End Bit error interrupt
– SDHOST_INT_DTO: Data Timeout error interrupt
– SDHOST_INT_DCRC: Data CRC error interrupt
– SDHOST_INT_DEB: Data End Bit error
– SDHOST_INT_CERR: Cart Status Error interrupt