SD API#

SD_ConfigureMemSeg()#

Description#

Configures the memory segment where SD module data structures will be allocated.

Files#

sd.h/sd.c

Prototype#

void SD_ConfigureMemSeg (MEM_SEG  *p_seg                         MEM_SEG  *p_seg_buf)

Arguments#

p_seg

Pointer to memory segment to use when allocating control data. Can be the same segment used for p_seg_buf. DEF_NULL means general purpose heap segment.

p_seg_buf

Pointer to memory segment to use when allocating data buffers. Can be the same segment used for p_seg. DEF_NULL means general purpose heap segment.

Returned Value#

None.

Notes / Warnings#

  1. Calling this function is optional, if it is not called, the default value will be used.

  2. This function MUST be called before the IO SD module is initialized via the IO_Init() function.

SD_ConfigureIO_FnctHandleQty()#

Description#

Configures the maximum number of SD IO Functions for all the SD buses.

Files#

sd.h/sd.c

Prototype#

void SD_ConfigureIO_FnctHandleQty (CPU_SIZE_T  fnct_handle_qty)

Arguments#

fnct_handle_qty

Max number of SD IO function handles.

Returned Value#

None.

Notes / Warnings#

  1. Calling this function is optional, if it is not called, the default value will be used.

  2. This function MUST be called before the IO SD module is initialized via the IO_Init() function.

SD_ConfigureEventQty()#

Description#

Configures the maximum number of events for all the SD buses.

Files#

sd.h/sd.c

Prototype#

void  SD_ConfigureEventQty (CPU_SIZE_T  event_qty)

Arguments#

event_qty

Quantity of events.

Returned Value#

None.

Notes / Warnings#

  1. Calling this function is optional, if it is not called, the default value will be used.

  2. This function MUST be called before the IO SD module is initialized via the IO_Init() function.

SD_ConfigureXferQty()#

Description#

Configures the maximum number of simultaneous transfers for all the SD buses.

Files#

sd.h/sd.c

Prototype#

void  SD_ConfigureXferQty (CPU_SIZE_T  xfer_qty)

Arguments#

xfer_qty

Quantity of transfers.

Returned Value#

None.

Notes / Warnings#

  1. Calling this function is optional, if it is not called, the default value will be used.

  2. This function MUST be called before the IO SD module is initialized via the IO_Init() function.

SD_ConfigureEventFncts()#

Description#

Sets the structure of callback that will be used by the IO SD module to notify the application of certain events.

Files#

sd.h/sd.c

Prototype#

void SD_ConfigureEventFncts (const SD_EVENT_FNCTS  *p_event_fncts)

Arguments#

p_event_fncts

Pointer to a structure containing the event functions to call. [Content MUST be persistent]

Returned Value#

None.

Notes / Warnings#

  1. Calling this function is optional, if it is not called, the default value will be used.

  2. This function MUST be called before the IO SD module is initialized via the IO_Init() function.

SD_ConfigureCoreTaskStk()#

Description#

Configures the SD core task's stack.

Files#

sd.h/sd.c

Prototype#

void SD_ConfigureCoreTaskStk (CPU_INT32U    stk_size_elements,
                               void         *p_stk)

Arguments#

stk_size_elements

Size, in stack elements, of the task's stack.

p_stk

Pointer to base of the task's stack. If DEF_NULL, stack will be allocated from KAL's memory segment.

Returned Value#

None.

Notes / Warnings#

  1. Calling this function is optional, if it is not called, the default value will be used.

  2. This function MUST be called before the IO SD module is initialized via the IO_Init() function.

  3. In order to change the priority of the IO SD core task, use the function SD_CoreTaskPrioSet().

SD_ConfigureAsyncTaskStk()#

Description#

Configures the SD async task's stack.

Files#

sd.h/sd.c

Prototype#

void SD_ConfigureAsyncTaskStk (CPU_INT32U   stk_size_elements,
                               void        *p_stk)

Arguments#

stk_size_elements

Size, in stack elements, of the task's stack.

p_stk

Pointer to base of the task's stack. If DEF_NULL, stack will be allocated from KAL's memory segment.

Returned Value#

None.

Notes / Warnings#

  1. Calling this function is optional, if it is not called, the default value will be used.

  2. This function MUST be called before the IO SD module is initialized via the IO_Init() function.

  3. In order to change the priority of the IO SD core task, use the function SD_AsyncTaskPrioSet().

SD_CoreTaskPrioSet()#

Description#

Assigns a new priority to the IO SD core task.

Files#

sd.h/sd.c

Prototype#

void SD_CoreTaskPrioSet (CPU_INT08U   prio,
                          RTOS_ERR    *p_err)

Arguments#

prio

New priority of the the core task.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function:

  • RTOS_ERR_NONE

  • RTOS_ERR_INVALID_ARG

Returned Value#

None.

Notes / Warnings#

  1. This function cannot be called before the IO SD module has been initialized via the IO_Init() function.

SD_AsyncTaskPrioSet()#

Description#

Assigns a new priority to the IO SD async task.

Files#

sd.h/sd.c

Prototype#

void SD_AsyncTaskPrioSet (CPU_INT08U   prio,
                          RTOS_ERR    *p_err)

Arguments#

prio

New priority of the the async task.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function:

  • RTOS_ERR_NONE

  • RTOS_ERR_INVALID_ARG

Returned Value#

None.

Notes / Warnings#

  1. This function cannot be called before the IO SD module has been initialized via the IO_Init() function.

SD_OperationsTimeoutSet()#

Description#

Assigns a new timeout value for SD operations.

Files#

sd.h/sd.c

Prototype#

void SD_OperationsTimeoutSet (CPU_INT32U   timeout_ms,
                               RTOS_ERR    *p_err)

Arguments#

timout_ms

New timeout value, in ms.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function:

  • RTOS_ERR_NONE

Returned Value#

None.

Notes / Warnings#

  1. This function cannot be called before the IO SD module has been initialized via the IO_Init() function.

SD_BusAdd()#

Description#

Adds a SD bus.

Files#

sd.h/sd.c

Prototype#

SD_BUS_HANDLE SD_BusAdd (const CPU_CHAR  *name,
                                RTOS_ERR  *p_err)

Arguments#

name

Name of SD bus controller.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function:

  • RTOS_ERR_NONE

  • RTOS_ERR_NOT_AVAIL

  • RTOS_ERR_WOULD_OVF

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_NOT_FOUND

  • RTOS_ERR_WOULD_BLOCK

  • RTOS_ERR_IS_OWNER

  • RTOS_ERR_SEG_OVF

  • RTOS_ERR_OS_SCHED_LOCKED

  • RTOS_ERR_ABORT

  • RTOS_ERR_TIMEOUT

Returned Value#

None.

Notes / Warnings#

None.

SD_BusHandleGetFromName()#

Description#

Gets SD bus handle from its name.

Files#

sd.h/sd.c

Prototype#

SD_BUS_HANDLE SD_BusHandleGetFromName (const CPU_CHAR   *name)

Arguments#

name

Name of SD bus controller.

Returned Value#

Handle to SD bus.

Notes / Warnings#

None.

SD_BusStart()#

Description#

Starts SD bus controller.

Files#

sd.h/sd.c

Prototype#

void SD_BusStart (SD_BUS_HANDLE    bus_handle,
                   RTOS_ERR        *p_err)

Arguments#

bus_handle

Handle to SD bus.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function:

  • RTOS_ERR_NONE

  • RTOS_ERR_INVALID_HANDLE

Returned Value#

None.

Notes / Warnings#

None.

SD_BusStop()#

Description#

Stops SD bus controller.

Files#

sd.h/sd.c

Prototype#

void SD_BusStop (SD_BUS_HANDLE   bus_handle,
                  RTOS_ERR       *p_err)

Arguments#

bus_handle

Handle to SD bus.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function:

  • RTOS_ERR_NONE

  • RTOS_ERR_INVALID_HANDLE

Returned Value#

None.

Notes / Warnings#

None.

SD_AlignReqGet()#

Description#

Gets required buffer alignment.

Files#

sd.h/sd.c

Prototype#

CPU_SIZE_T SD_AlignReqGet (SD_BUS_HANDLE   bus_handle,
                            RTOS_ERR       *p_err)

Arguments#

bus_handle

Handle to SD bus.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function:

  • RTOS_ERR_NONE

Returned Value#

Required alignment, in octets.

Notes / Warnings#

None.

SD_CardTypeGet()#

Description#

Gets type of SD card currently connected.

Files#

sd.h/sd.c

Prototype#

SD_CARDTYPE SD_CardTypeGet (SD_BUS_HANDLE   bus_handle,
                             RTOS_ERR       *p_err)

Arguments#

bus_handle

Handle to SD bus.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function:

  • RTOS_ERR_NONE

Returned Value#

Type of SD card.

Notes / Warnings#

None.

SD_BSP_BusCardDetectEvent()#

Description#

Reports card detect event to IO-SD core task.

Files#

sd.h/sd.c

Prototype#

void  SD_BSP_BusCardDetectEvent (SD_BUS_HANDLE  bus_handle)

Arguments#

bus_handle

Handle to SD bus.

Returned Value#

None.

Notes / Warnings#

None.

SD_BSP_BusCardRemoveEvent()#

Description#

Reports card remove event to IO-SD core task.

Files#

sd.h/sd.c

Prototype#

void  SD_BSP_BusCardRemoveEvent (SD_BUS_HANDLE  bus_handle)

Arguments#

bus_handle

Handle to SD bus.

Returned Value#

None.

Notes / Warnings#

None.

IO_SD_CARD_CTRLR_REG()#

Description#

Registers a IO SD controller to the platform manager.

Files#

sd.h

Prototype#

IO_SD_CARD_CTRLR_REG (name                       p_drv_info)

Arguments#

name

Unique name for the IO SD controller. It is recommended to follow the standard "sdX", where X is a digit.

p_drv_info

Pointer to the SD Bus driver hardware information structure of type SD_CARD_CTRLR_DRV_INFO.

Returned Value#

None.

Notes / Warnings#

  1. This macro should normally be called from the BSP.