tinyusb  0.4
Click here to lend your support to tinyusb donation and make a donation at pledgie.com
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages

Data Structures

struct  osal_queue_t
 

Macros

#define osal_tick_get   tusb_tick_get
 
#define OSAL_TASK_DEF(code, stack_depth, prio)
 
#define OSAL_TASK_REF
 
#define osal_task_create(x)   TUSB_ERROR_NONE
 
#define OSAL_TASK_FUNCTION(task_func, p_para)   tusb_error_t task_func(void * p_para)
 
#define TASK_RESTART   state = 0
 
#define OSAL_TASK_LOOP_BEGIN
 
#define OSAL_TASK_LOOP_END
 
#define osal_task_delay(msec)
 
#define OSAL_SUBTASK_INVOKED_AND_WAIT(subtask, status)
 
#define OSAL_SUBTASK_BEGIN   OSAL_TASK_LOOP_BEGIN
 
#define OSAL_SUBTASK_END   OSAL_TASK_LOOP_END
 
#define SUBTASK_EXIT(error)
 
#define _SUBTASK_ASSERT_ERROR_HANDLER(error, func_call)   func_call; TASK_RESTART; return error
 
#define SUBTASK_ASSERT_STATUS(sts)
 
#define SUBTASK_ASSERT_STATUS_WITH_HANDLER(sts, func_call)
 
#define SUBTASK_ASSERT(condition)
 
#define SUBTASK_ASSERT_WITH_HANDLER(condition, func_call)
 
#define OSAL_SEM_DEF(name)   osal_semaphore_t name
 
#define OSAL_SEM_REF(name)   &name
 
#define osal_semaphore_wait(sem_hdl, msec, p_error)
 
#define OSAL_MUTEX_DEF(name)   osal_mutex_t name
 
#define OSAL_MUTEX_REF(name)   &name
 
#define osal_mutex_wait   osal_semaphore_wait
 
#define OSAL_QUEUE_DEF(name, queue_depth, type)
 
#define OSAL_QUEUE_REF(name)   (&name)
 
#define osal_queue_receive(queue_hdl, p_data, msec, p_error)
 

Typedefs

typedef volatile uint8_t osal_semaphore_t
 
typedef osal_semaphore_tosal_semaphore_handle_t
 
typedef osal_semaphore_t osal_mutex_t
 
typedef osal_semaphore_handle_t osal_mutex_handle_t
 
typedef osal_queue_tosal_queue_handle_t
 

Functions

uint32_t tusb_tick_get (void)
 
static osal_semaphore_handle_t osal_semaphore_create (osal_semaphore_t *p_sem) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE
 
static tusb_error_t osal_semaphore_post (osal_semaphore_handle_t sem_hdl) ATTR_ALWAYS_INLINE
 
static void osal_semaphore_reset (osal_semaphore_handle_t sem_hdl) ATTR_ALWAYS_INLINE
 
static osal_mutex_handle_t osal_mutex_create (osal_mutex_t *p_mutex) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE
 
static tusb_error_t osal_mutex_release (osal_mutex_handle_t mutex_hdl) ATTR_ALWAYS_INLINE
 
static void osal_mutex_reset (osal_mutex_handle_t mutex_hdl) ATTR_ALWAYS_INLINE
 
static osal_queue_handle_t osal_queue_create (osal_queue_t *const p_queue) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE
 
static tusb_error_t osal_queue_send (osal_queue_handle_t const queue_hdl, void const *data) ATTR_ALWAYS_INLINE
 
static void osal_queue_flush (osal_queue_handle_t const queue_hdl) ATTR_ALWAYS_INLINE
 

Detailed Description

Macro Definition Documentation

#define OSAL_QUEUE_DEF (   name,
  queue_depth,
  type 
)
Value:
STATIC_ASSERT(queue_depth < 256, "OSAL Queue only support up to 255 depth");\
type name##_buffer[queue_depth];\
osal_queue_t name = {\
.buffer = (uint8_t*) name##_buffer,\
.depth = queue_depth,\
.item_size = sizeof(type)\
}

Definition at line 243 of file osal_none.h.

#define osal_queue_receive (   queue_hdl,
  p_data,
  msec,
  p_error 
)
Value:
do {\
timeout = osal_tick_get();\
state = __LINE__; case __LINE__:\
if( queue_hdl->count == 0 ) {\
if ( (msec != OSAL_TIMEOUT_WAIT_FOREVER) && ( timeout + osal_tick_from_msec(msec) <= osal_tick_get() )) /* time out */ \
*(p_error) = TUSB_ERROR_OSAL_TIMEOUT;\
else\
return TUSB_ERROR_OSAL_WAITING;\
} else{\
/*TODO mutex lock hal_interrupt_disable */\
memcpy(p_data, queue_hdl->buffer + (queue_hdl->rd_idx * queue_hdl->item_size), queue_hdl->item_size);\
queue_hdl->rd_idx = (queue_hdl->rd_idx + 1) % queue_hdl->depth;\
queue_hdl->count--;\
/*TODO mutex unlock hal_interrupt_enable */\
*(p_error) = TUSB_ERROR_NONE;\
}\
}while(0)

Definition at line 293 of file osal_none.h.

#define osal_semaphore_wait (   sem_hdl,
  msec,
  p_error 
)
Value:
do {\
timeout = osal_tick_get();\
state = __LINE__; case __LINE__:\
if( *(sem_hdl) == 0 ) {\
if ( ( ((uint32_t) (msec)) != OSAL_TIMEOUT_WAIT_FOREVER) && (timeout + osal_tick_from_msec(msec) <= osal_tick_get()) ) /* time out */ \
*(p_error) = TUSB_ERROR_OSAL_TIMEOUT;\
else\
return TUSB_ERROR_OSAL_WAITING;\
} else{\
(*(sem_hdl))--; /*TODO mutex hal_interrupt_disable consideration*/\
*(p_error) = TUSB_ERROR_NONE;\
}\
}while(0)

Definition at line 178 of file osal_none.h.

#define OSAL_SUBTASK_INVOKED_AND_WAIT (   subtask,
  status 
)
Value:
do {\
state = __LINE__; case __LINE__:\
{\
status = subtask; /* invoke sub task */\
if (TUSB_ERROR_OSAL_WAITING == status) /* sub task not finished -> continue waiting */\
return TUSB_ERROR_OSAL_WAITING;\
}\
}while(0)

Definition at line 106 of file osal_none.h.

#define osal_task_delay (   msec)
Value:
do {\
timeout = osal_tick_get();\
state = __LINE__; case __LINE__:\
if ( timeout + osal_tick_from_msec(msec) > osal_tick_get() ) /* time out */ \
return TUSB_ERROR_OSAL_WAITING;\
}while(0)

Definition at line 95 of file osal_none.h.

#define OSAL_TASK_LOOP_BEGIN
Value:
ATTR_UNUSED static uint32_t timeout = 0;\
static uint16_t state = 0;\
(void) timeout; /* timemout can possible unsued */ \
switch(state) { \
case 0: { \
#define ATTR_UNUSED
This attribute, attached to a function, means that the function is meant to be possibly unused...
Definition: compiler_gcc.h:124

Definition at line 81 of file osal_none.h.

#define OSAL_TASK_LOOP_END
Value:
default:\
TASK_RESTART;\
}}\
return TUSB_ERROR_NONE;

Definition at line 88 of file osal_none.h.

#define SUBTASK_ASSERT (   condition)
Value:
ASSERT_DEFINE_WITH_HANDLER(_SUBTASK_ASSERT_ERROR_HANDLER, , , \
(condition), TUSB_ERROR_OSAL_TASK_FAILED, "%s", "evaluated to false")

Definition at line 137 of file osal_none.h.

#define SUBTASK_ASSERT_STATUS (   sts)
Value:
ASSERT_DEFINE_WITH_HANDLER(_SUBTASK_ASSERT_ERROR_HANDLER, , tusb_error_t status = (tusb_error_t)(sts),\
TUSB_ERROR_NONE == status, status, "%s", TUSB_ErrorStr[status])
tusb_error_t
Error Code returned.
Definition: tusb_errors.h:97

Definition at line 128 of file osal_none.h.

#define SUBTASK_ASSERT_STATUS_WITH_HANDLER (   sts,
  func_call 
)
Value:
ASSERT_DEFINE_WITH_HANDLER(_SUBTASK_ASSERT_ERROR_HANDLER, func_call, tusb_error_t status = (tusb_error_t)(sts),\
TUSB_ERROR_NONE == status, status, "%s", TUSB_ErrorStr[status])
tusb_error_t
Error Code returned.
Definition: tusb_errors.h:97

Definition at line 132 of file osal_none.h.

#define SUBTASK_ASSERT_WITH_HANDLER (   condition,
  func_call 
)
Value:
ASSERT_DEFINE_WITH_HANDLER(_SUBTASK_ASSERT_ERROR_HANDLER, func_call, ,\
condition, TUSB_ERROR_OSAL_TASK_FAILED, "%s", "evaluated to false")

Definition at line 141 of file osal_none.h.

#define SUBTASK_EXIT (   error)
Value:
do {\
TASK_RESTART; return error;\
}while(0)

Definition at line 120 of file osal_none.h.