USBD_OS_Init

Description

Initialize USB RTOS layer internal objects.

Files

usbd_internal.h/usbd_os.c

Prototype

void  USBD_OS_Init (USBD_ERR  *p_err);


Arguments

p_err

Pointer to variable that will receive the return error code from this function.

Returned Value

None.

Callers

USB device core layer.

Implementation guidelines

  1. The followings RTOS resources are required by the stack and should be allocated in when this function is called.
    1. One task for core and asynchronous events.
    2. One queue that can hold up to USBD_CORE_EVENT_NBR_TOTAL events.
    3. USBD_CFG_MAX_NBR_DEV x USBD_CFG_MAX_NBR_EP_OPEN semaphores and mutex for endpoints operations.

    4. If tracing is enabled, a semaphore and a task to manage debug events allocation and debug events processing respectively.
  2. If any error happen, USBD_ERR_OS_INIT_FAIL should be assigned to p_err and the function should return immediately. Otherwise, USBD_ERR_NONE should be assigned to p_err.