CC3200 Peripheral Driver Library User's Guide: Secure_Digital_Host_api

CC3200 Peripheral Driver

CC3200 Peripheral Driver Library User's Guide  1.2.0
Secure_Digital_Host_api

Functions

void SDHostInit (unsigned long ulBase)
 
void SDHostCmdReset (unsigned long ulBase)
 
long SDHostCmdSend (unsigned long ulBase, unsigned long ulCmd, unsigned ulArg)
 
tBoolean SDHostDataNonBlockingWrite (unsigned long ulBase, unsigned long ulData)
 
void SDHostDataWrite (unsigned long ulBase, unsigned long ulData)
 
void SDHostDataRead (unsigned long ulBase, unsigned long *pulData)
 
tBoolean SDHostDataNonBlockingRead (unsigned long ulBase, unsigned long *pulData)
 
void SDHostIntRegister (unsigned long ulBase, void(*pfnHandler)(void))
 
void SDHostIntUnregister (unsigned long ulBase)
 
void SDHostIntEnable (unsigned long ulBase, unsigned long ulIntFlags)
 
void SDHostIntDisable (unsigned long ulBase, unsigned long ulIntFlags)
 
unsigned long SDHostIntStatus (unsigned long ulBase)
 
void SDHostIntClear (unsigned long ulBase, unsigned long ulIntFlags)
 
void SDHostCardErrorMaskSet (unsigned long ulBase, unsigned long ulErrMask)
 
unsigned long SDHostCardErrorMaskGet (unsigned long ulBase)
 
void SDHostSetExpClk (unsigned long ulBase, unsigned long ulSDHostClk, unsigned long ulCardClk)
 
void SDHostRespGet (unsigned long ulBase, unsigned long ulRespnse[4])
 
void SDHostBlockSizeSet (unsigned long ulBase, unsigned short ulBlkSize)
 
void SDHostBlockCountSet (unsigned long ulBase, unsigned short ulBlkCount)
 

Detailed Description

Function Documentation

void SDHostBlockCountSet ( unsigned long  ulBase,
unsigned short  ulBlkCount 
)

Set the block size and count for data transfer

Parameters
ulBaseis the base address of SDHost module
ulBlkCountis the number of blocks

This function sets block count for the data transfer. This needs to be set for each block transfer.

See also
SDHostBlockSizeSet()
Returns
None.
void SDHostBlockSizeSet ( unsigned long  ulBase,
unsigned short  ulBlkSize 
)

Set the block size for data transfer

Parameters
ulBaseis the base address of SDHost module
ulBlkSizeis the transfer block size in bytes

This function sets the block size the data transfer.

The parameter ulBlkSize is size of each data block in bytes. This should be in range 0 - 2^10.

Returns
None.
unsigned long SDHostCardErrorMaskGet ( unsigned long  ulBase)

Gets the card status error mask.

Parameters
ulBaseis the base address of SDHost module

This function gets the card status error mask for response type R1, R1b, R5, R5b and R6 response.

Returns
Returns the current card status error.
void SDHostCardErrorMaskSet ( unsigned long  ulBase,
unsigned long  ulErrMask 
)

Sets the card status error mask.

Parameters
ulBaseis the base address of SDHost module
ulErrMaskis the bit mask of card status errors to be enabled

This function sets the card status error mask for response type R1, R1b, R5, R5b and R6 response. 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 respose are set then the host controller indicates a card error interrupt status. Only bits referenced as type E (error) in status field in the response can set a card status error.

Returns
None
void SDHostCmdReset ( unsigned long  ulBase)

Resets SDHost command line

Parameters
ulBaseis the base address of SDHost module.

This function assers a soft reset for the command line

Returns
None.
long SDHostCmdSend ( unsigned long  ulBase,
unsigned long  ulCmd,
unsigned  ulArg 
)

Sends command over SDHost interface

Parameters
ulBaseis the base address of SDHost module.
ulCmdis the command to send.
ulArgis the argument for the command.

This function send command to the attached card over the SDHost interface.

The ulCmd parameter can be one of SDHOST_CMD_0 to SDHOST_CMD_63. It can be logically ORed with one or more of the following:

  • SDHOST_MULTI_BLK for multi-block transfer
  • SDHOST_WR_CMD if command is followed by write data
  • SDHOST_RD_CMD if command is followed by read data
  • SDHOST_DMA_EN if SDHost need to generate DMA request.
  • SDHOST_RESP_LEN_136 if 136 bit response is expected
  • SDHOST_RESP_LEN_48 if 48 bit response is expected
  • SDHOST_RESP_LEN_48B if 48 bit response with busy bit is expected

The parameter ulArg is the argument for the command

Returns
Returns 0 on success, -1 otherwise.
tBoolean SDHostDataNonBlockingRead ( unsigned long  ulBase,
unsigned long *  pulData 
)

Reads single data word from the SDHost read buffer

Parameters
ulBaseis the base address of SDHost module.
pulDatais pointer to read data variable.

This function reads a data word from the SDHost read buffer. The function returns true if there was data available in to buffer else returns false.

Returns
Return true on success, false otherwise.
tBoolean SDHostDataNonBlockingWrite ( unsigned long  ulBase,
unsigned long  ulData 
)

Writes a data word into the SDHost write buffer.

Parameters
ulBaseis the base address of SDHost module.
ulDatais data word to be transfered.

This function writes a single data word into the SDHost write buffer. The function returns true if there was a space available in the buffer else returns false.

Returns
Return true on success, false otherwise.
void SDHostDataRead ( unsigned long  ulBase,
unsigned long *  pulData 
)

Waits for a data word from the SDHost read buffer

Parameters
ulBaseis the base address of SDHost module.
pulDatais pointer to read data variable.

This function reads a single data word from the SDHost read buffer. If there is no data available in the buffer the function will wait until a data word is received before returning.

Returns
None.
void SDHostDataWrite ( unsigned long  ulBase,
unsigned long  ulData 
)

Waits to write a data word into the SDHost write buffer.

Parameters
ulBaseis the base address of SDHost module.
ulDatais data word to be transfered.

This function writes ulData into the SDHost write buffer. If there is no space in the write buffer this function waits until there is a space available before returning.

Returns
None.
void SDHostInit ( unsigned long  ulBase)

Configures SDHost module.

Parameters
ulBaseis the base address of SDHost module.

This function configures the SDHost module, enabling internal sub-modules.

Returns
None.
void SDHostIntClear ( unsigned long  ulBase,
unsigned long  ulIntFlags 
)

Clears the individual interrupt sources.

Parameters
ulBaseis the base address of SDHost module.
ulIntFlagsis a bit mask of the interrupt sources to be cleared.

The specified SDHost 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.

The ulIntFlags parameter has the same definition as the ulIntFlags parameter to SDHostIntEnable().

Returns
None.
void SDHostIntDisable ( unsigned long  ulBase,
unsigned long  ulIntFlags 
)

Enable individual interrupt source for the specified SDHost

Parameters
ulBaseis the base address of SDHost module.
ulIntFlagsis a bit mask of the interrupt sources to be enabled.

This function disables the indicated SDHost interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

The ulIntFlags parameter has the same definition as the ulIntFlags parameter to SDHostIntEnable().

Returns
None.
void SDHostIntEnable ( unsigned long  ulBase,
unsigned long  ulIntFlags 
)

Enable individual interrupt source for the specified SDHost

Parameters
ulBaseis the base address of SDHost module.
ulIntFlagsis a bit mask of the interrupt sources to be enabled.

This function enables the indicated SDHost interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

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_BRR Buffer Read Ready interrupt
  • SDHOST_INT_ERRI Error 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

    Note that SDHOST_INT_ERRI can only be used with

    See also
    SDHostIntStatus() and is internally logical OR of all error status bits. Setting this bit alone as ulIntFlags doesn't generates any interrupt.
    Returns
    None.
void SDHostIntRegister ( unsigned long  ulBase,
void(*)(void)  pfnHandler 
)

Registers the interrupt handler for SDHost interrupt

Parameters
ulBaseis the base address of SDHost module
pfnHandleris a pointer to the function to be called when the SDHost interrupt occurs.

This function does the actual registering of the interrupt handler. This function enables the global interrupt in the interrupt controller; specific SDHost interrupts must be enabled via SDHostIntEnable(). It is the interrupt handler's responsibility to clear the interrupt source.

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.
unsigned long SDHostIntStatus ( unsigned long  ulBase)

Gets the current interrupt status.

Parameters
ulBaseis the base address of SDHost module.

This function returns the interrupt status for the specified SDHost.

Returns
Returns the current interrupt status, enumerated as a bit field of values described in SDHostIntEnable().
void SDHostIntUnregister ( unsigned long  ulBase)

Unregisters the interrupt handler for SDHost interrupt

Parameters
ulBaseis the base address of SDHost module

This function does the actual unregistering of the interrupt handler. It clears the handler to be called when a SDHost interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler no longer is called.

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.
void SDHostRespGet ( unsigned long  ulBase,
unsigned long  ulRespnse[4] 
)

Get the response for the last command.

Parameters
ulBaseis the base address of SDHost module
ulRespnseis 128-bit response.

This function gets the response from the SD card for the last command send.

Returns
None.
void SDHostSetExpClk ( unsigned long  ulBase,
unsigned long  ulSDHostClk,
unsigned long  ulCardClk 
)

Sets the SD Card clock.

Parameters
ulBaseis the base address of SDHost module
ulSDHostClkis the rate of clock supplied to SDHost module
ulCardClkis the required SD interface clock

This function configures the SDHost interface to supply the specified clock to the connected card.

Returns
None.
Generated on Thu Feb 18 2016 13:22:02 for CC3200 Peripheral Driver Library User's Guide by   doxygen 1.8.11