This section lists the APIs, hosted in the CC32xx SDK (peripheral library) necessary for I2S configuration.
void SDHostInit(unsigned long ulBase)
- Description: This function configures the SD host module, enabling internal submodules.
- Parameters: ulBase – Base address of the SD host module
- Return: None
void SDHostCmdReset(unsigned long ulBase)
- Description: This function resets the SD host command line.
- Parameters: ulBase – Base address of the SD host module
- Return: None
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
- SDHOST_INT_BADA: Bad Data error interrupt
- SDHOST_INT_DMARD: Read DMA done interrupt
- SDHOST_INT_DMAWR: Write DMA done interrupt
- Return: None
void SDHostIntDisable(unsigned long ulBase, unsigned long ulIntFlags)
- Description: This function disables the indicated SD host interrupt sources. Only enabled sources can be reflected to the processor interrupt.
- Parameters:
- ulBase – Base address of the SD host module
- ulIntFlags – Bit mask of the interrupt sources to be disabled
The ulIntFlags parameter has the same definition as the ulIntFlags parameter to SDHostIntEnable(). - Return: None
unsigned long SDHostIntStatus(unsigned long ulBase)
- Description: This function returns the interrupt status for the specified SD host.
- Parameters: ulBase – Base address of the SD host module.
- Return: Returns the current interrupt status, enumerated as a bit field of values described in SDHostIntEnable()
void SDHostIntClear(unsigned long ulBase,unsigned long ulIntFlags)
- Description: The specified SD host interrupt sources are cleared, so that they no longer assert. This function must be called in the interrupt handler to keep the interrupt from being recognized again immediately upon exit.
- Parameters:
- ulBase – Base address of the SD host module
- ulIntFlags – Bit mask of the interrupt sources to be cleared
The ulIntFlags parameter has the same definition as the ulIntFlags parameter to SDHostIntEnable(). - Return: None
void SDHostCardErrorMaskSet(unsigned long ulBase, unsigned long ulErrMask)
- Description: This function sets the card status error mask for response type R1, R1b, R5, R5b, and R6. The parameter ulErrMask is the bit mask of card status errors to be enabled. If the corresponding bits in the card status field of a response are set, then the host controller indicates a card error interrupt status. Only bits referenced as type E (error) in the status field in the response can set a card status error.
- Parameters:
- ulBase – Base address of the SD host module
- ulErrMask – Bit mask of card status errors to be enabled
- Return: None
unsigned long SDHostCardErrorMaskGet(unsigned long ulBase)
- Description: This function gets the card status error mask for response type R1, R1b, R5, R5b, and R6.
- Parameters: ulBase – Base address of the SD host module
- Return: Returns the current card status error
void SDHostSetExpClk(unsigned long ulBase, unsigned long ulSDHostClk, unsigned long ulCardClk)
- Description: This function configures the SD host interface to supply the specified clock to the connected card.
- Parameters:
- ulBase – Base address of the SD host module
- ulSDHostClk – The rate of clock supplied to SD host module
- ulCardClk – Required SD interface clock
- Return: None
void SDHostRespGet(unsigned long ulBase, unsigned long ulRespnse[4])
- Description: This function gets the response from the SD card for the last command send.
- Parameters:
- ulBase – Base address of the SD host module
- ulRespnse – 128-bit response
- Return: None
void SDHostBlockSizeSet(unsigned long ulBase, unsigned short ulBlkSize)
- Description: This function sets the block size of the data transfer.
- Parameters:
- ulBase – Base address of the SD host module
- ulBlkSize – Transfer block size in bytes
The parameter ulBlkSize is the size of each data block in bytes. This size should be in a range from 0 to 210. - Return: None
void SDHostBlockCountSet(unsigned long ulBase, unsigned short ulBlkCount)
- Description: This function sets block count for the data transfer. This block count must be set for each block transfer.
- Parameters:
- ulBase – Base address of the SD host module
- ulBlkCount – Number of blocks
- Return: None
tBoolean SDHostDataNonBlockingWrite(unsigned long ulBase, unsigned long ulData)
- Description: This function writes one data word into the SD host write buffer. The function returns true if a space was available in the buffer; else returns false.
- Parameters:
- ulBase – Base address of the SD host module
- ulData – Data word to be transferred
- Return: Return true on success, false otherwise
tBoolean SDHostDataNonBlockingRead(unsigned long ulBase, unsigned long *pulData)
- Description: This function reads a data word from the SD host read buffer. The function returns true if data was available in the buffer; else returns false.
- Parameters:
- ulBase – Base address of the SD host module
- pulData – Pointer to data word to be transferred
- Return: Return true on success, false otherwise
void SDHostDataWrite(unsigned long ulBase, unsigned long ulData)
- Description: This function writes \e ulData into the SD host write buffer. If there is no space in the write buffer, this function waits until a space is available before returning.
- Parameters:
- ulBase – Base address of the SD host module
- ulData – Data word to be transferred
- Return: None
void SDHostDataRead(unsigned long ulBase, unsigned long *ulData)
- Description: This function reads a single data word from the SD host read buffer. If there is no data available in the buffer, the function waits until a data word is received before returning.
- Parameters:
- ulBase – Base address of the SD host module
- pulData – Pointer to data word to be transferred
- Return: None