add ASSERT POINTER support

add hid host and separate hid host & device
update host project setting with EA4357 board
add para checking test for hid host
This commit is contained in:
hathach
2013-01-18 14:39:42 +07:00
parent 7976e2fd55
commit d8c8b9e38a
16 changed files with 816 additions and 73 deletions

View File

@@ -58,14 +58,6 @@
// TODO refractor
#include "common/common.h"
#ifdef TUSB_CFG_DEVICE
#include "device/dcd.h"
#endif
#ifdef TUSB_CFG_HOST
#include "device/hcd.h"
#endif
/** \struct USB_HID_MouseReport_t
* \brief Standard HID Boot Protocol Mouse Report.
*
@@ -78,7 +70,7 @@ typedef ATTR_PREPACKED struct
int8_t Y; /**< Current delta Y movement on the mouse. */
} ATTR_PACKED USB_HID_MouseReport_t;
/** \struct USB_HID_KeyboardReport_t
/** \struct tusb_keyboard_report_t
* \brief Standard HID Boot Protocol Keyboard Report.
*
* Type define for a standard Boot Protocol Keyboard report
@@ -88,7 +80,7 @@ typedef ATTR_PREPACKED struct
uint8_t Modifier; /**< Keyboard modifier byte, indicating pressed modifier keys (a combination of HID_KEYBOARD_MODIFER_* masks). */
uint8_t Reserved; /**< Reserved for OEM use, always set to 0. */
uint8_t KeyCode[6]; /**< Key codes of the currently pressed keys. */
} ATTR_PACKED USB_HID_KeyboardReport_t;
} ATTR_PACKED tusb_keyboard_report_t;
/** \enum USB_HID_MOUSE_BUTTON_CODE
* \brief Button codes for HID mouse
@@ -158,48 +150,18 @@ enum USB_HID_LOCAL_CODE
HID_Local_Turkish_F
};
#ifdef DEVICE_ROMDRIVER
/** \brief Initialize HID driver
*
* \param[in] para1
* \param[out] para2
* \return Error Code of the \ref TUSB_ERROR enum
* \note
*/
TUSB_Error_t tusb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *const pIntfDesc, uint8_t const * const pHIDReportDesc, uint32_t ReportDescLength, uint32_t* mem_base, uint32_t* mem_size);
/** \brief Notify HID class that usb is configured
*
* \param[in] para1
* \param[out] para2
* \return Error Code of the \ref TUSB_ERROR enum
* \note
*/
TUSB_Error_t tusb_hid_configured(USBD_HANDLE_T hUsb);
/** \brief Used by Application to send Keycode to Host
*
* \param[in] para1
* \param[out] para2
* \return Error Code of the \ref TUSB_ERROR enum
* \note
*/
TUSB_Error_t tusb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], uint8_t numkey);
/** \brief
*
* \param[in] para1
* \param[out] para2
* \return Error Code of the \ref TUSB_ERROR enum
* \note
*/
TUSB_Error_t tusb_hid_mouse_send(uint8_t buttons, int8_t x, int8_t y);
#ifdef TUSB_CFG_DEVICE
#include "device/dcd.h"
#include "hid_device.h"
#endif
#ifdef TUSB_CFG_HOST
#include "host/hcd.h"
#include "hid_host.h"
#endif
#ifdef __cplusplus
}
#endif