change cmock ignore to args only
implementing usbh_host.c
This commit is contained in:
@@ -68,7 +68,7 @@ extern "C"
|
||||
//--------------------------------------------------------------------+
|
||||
// Assert Helper
|
||||
//--------------------------------------------------------------------+
|
||||
#define ASSERT_FILENAME __BASE_FILE__
|
||||
#define ASSERT_FILENAME __FILE__
|
||||
#define ASSERT_FUNCTION __PRETTY_FUNCTION__
|
||||
#define ASSERT_STATEMENT _PRINTF("assert at %s: %s :%d :\n", ASSERT_FILENAME, ASSERT_FUNCTION, __LINE__)
|
||||
|
||||
|
@@ -66,6 +66,7 @@
|
||||
ENTRY(TUSB_ERROR_CLASS_DEVICE_DONT_SUPPORT)\
|
||||
ENTRY(TUSB_ERROR_CLASS_DATA_NOT_AVAILABLE)\
|
||||
ENTRY(TUSB_ERROR_OSAL_TIMEOUT)\
|
||||
ENTRY(TUSB_ERROR_OSAL_TASK_FAILED)\
|
||||
ENTRY(TUSB_ERROR_OSAL_QUEUE_FAILED)\
|
||||
ENTRY(TUSB_ERROR_FAILED)\
|
||||
|
||||
|
@@ -58,9 +58,11 @@
|
||||
//--------------------------------------------------------------------+
|
||||
STATIC_ usbh_device_info_t device_info_pool[TUSB_CFG_HOST_DEVICE_MAX];
|
||||
|
||||
#define ENUM_DEPTH 2
|
||||
//STATIC_ osal_queue_t queue_enumerate;
|
||||
//STATIC_ uint8_t queue_enumerate_buffer[ENUM_DEPTH*sizeof(usbh_enumerate_t)];
|
||||
OSAL_TASK_DEF(enumeration_task, usbh_enumerate_task, 128, OSAL_PRIO_HIGH);
|
||||
|
||||
#define ENUM_QUEUE_DEPTH 5
|
||||
OSAL_DEF_QUEUE(enumeration_queue, ENUM_QUEUE_DEPTH, uin32_t);
|
||||
osal_queue_handle_t enumeration_queue_hdl;
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// PUBLIC API (Parameter Verification is required)
|
||||
@@ -77,7 +79,11 @@ tusbh_device_status_t tusbh_device_status_get (tusb_handle_device_t const device
|
||||
tusb_error_t usbh_init(void)
|
||||
{
|
||||
memset(device_info_pool, 0, sizeof(usbh_device_info_t)*TUSB_CFG_HOST_DEVICE_MAX);
|
||||
// ASSERT_STATUS(osal_queue_create());
|
||||
|
||||
ASSERT_STATUS( osal_task_create(&enumeration_task) );
|
||||
enumeration_queue_hdl = osal_queue_create(&enumeration_queue);
|
||||
ASSERT_PTR(enumeration_queue_hdl, TUSB_ERROR_OSAL_QUEUE_FAILED);
|
||||
|
||||
return TUSB_ERROR_NONE;
|
||||
}
|
||||
|
||||
|
@@ -77,11 +77,14 @@
|
||||
typedef uint32_t osal_timeout_t;
|
||||
|
||||
//------------- Task -------------//
|
||||
typedef uint32_t osal_task_t;
|
||||
#define OSAL_TASK_DEF(name, code, stack_depth, prio) \
|
||||
osal_task_t name
|
||||
|
||||
#define OSAL_TASK_LOOP
|
||||
#define OSAL_TASK_LOOP_BEGIN
|
||||
#define OSAL_TASK_LOOP_END
|
||||
|
||||
typedef uint32_t osal_task_t;
|
||||
tusb_error_t osal_task_create(osal_task_t *task);
|
||||
|
||||
//------------- Semaphore -------------//
|
||||
@@ -94,6 +97,10 @@ tusb_error_t osal_semaphore_post(osal_semaphore_handle_t const sem_hdl);
|
||||
//------------- Queue -------------//
|
||||
typedef uint32_t osal_queue_t;
|
||||
typedef void* osal_queue_handle_t;
|
||||
|
||||
#define OSAL_DEF_QUEUE(name, queue_depth, type) \
|
||||
osal_queue_t name
|
||||
|
||||
osal_queue_handle_t osal_queue_create(osal_queue_t *queue);
|
||||
|
||||
#endif
|
||||
|
@@ -65,6 +65,12 @@ enum
|
||||
OSAL_TIMEOUT_WAIT_FOREVER = 1
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
OSAL_PRIO_LOW,
|
||||
OSAL_PRIO_NORMAL,
|
||||
OSAL_PRIO_HIGH
|
||||
}osal_prio_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -73,7 +73,7 @@ typedef uint32_t osal_timeout_t;
|
||||
// OSAL_TASK_LOOP_ENG
|
||||
// }
|
||||
//--------------------------------------------------------------------+
|
||||
#define osal_task_create(code, name, stack_depth, parameters, prio)
|
||||
//#define osal_task_create(code, name, stack_depth, parameters, prio)
|
||||
|
||||
#define OSAL_TASK_LOOP \
|
||||
static uint16_t state = 0;\
|
||||
|
Reference in New Issue
Block a user