rename dcd_11u_13u_qhd_t::total_bytes to nbytes to prevent confusion
introduce scsi_data to mscd_interface_t to make tusbd_msc_scsi_cb buffer's address no longer to be required in USB ram section --> save usb ram for lpc11/13u
This commit is contained in:
@@ -321,135 +321,4 @@ tusb_error_t hidd_xfer_cb(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32
|
||||
return TUSB_ERROR_NONE;
|
||||
}
|
||||
|
||||
#if defined(CAP_DEVICE_ROMDRIVER)
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
#if TUSB_CFG_DEVICE_HID_KEYBOARD
|
||||
TUSB_CFG_ATTR_USBRAM uint8_t hidd_keyboard_buffer[1024]; // TODO memory reduce
|
||||
TUSB_CFG_ATTR_USBRAM hid_keyboard_report_t hid_keyboard_report;
|
||||
static volatile bool bKeyChanged = false;
|
||||
#endif
|
||||
|
||||
#if TUSB_CFG_DEVICE_HID_MOUSE
|
||||
TUSB_CFG_ATTR_USBRAM uint8_t hidd_mouse_buffer[1024]; // TODO memory reduce
|
||||
TUSB_CFG_ATTR_USBRAM hid_mouse_report_t hid_mouse_report;
|
||||
static volatile bool bMouseChanged = false;
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// APPLICATION API
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// IMPLEMENTATION
|
||||
//--------------------------------------------------------------------+
|
||||
ErrorCode_t HID_GetReport( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t* plength)
|
||||
{
|
||||
USB_HID_CTRL_T* pHidCtrl = (USB_HID_CTRL_T*) hHid;
|
||||
|
||||
/* ReportID = SetupPacket.wValue.WB.L; */
|
||||
if (pSetup->wValue.WB.H == HID_REQUEST_REPORT_INPUT)
|
||||
return (ERR_USBD_STALL); /* Not Supported */
|
||||
|
||||
switch (pHidCtrl->protocol)
|
||||
{
|
||||
#if TUSB_CFG_DEVICE_HID_KEYBOARD
|
||||
case HID_PROTOCOL_KEYBOARD:
|
||||
*pBuffer = (uint8_t*) &hid_keyboard_report;
|
||||
*plength = sizeof(hid_keyboard_report_t);
|
||||
|
||||
if (!bKeyChanged)
|
||||
{
|
||||
memset(pBuffer, 0, *plength);
|
||||
}
|
||||
bKeyChanged = false;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if TUSB_CFG_DEVICE_HID_MOUSE
|
||||
case HID_PROTOCOL_MOUSE:
|
||||
*pBuffer = (uint8_t*) &hid_mouse_report;
|
||||
*plength = sizeof(hid_mouse_report_t);
|
||||
|
||||
if (!bMouseChanged)
|
||||
{
|
||||
memset(pBuffer, 0, *plength);
|
||||
}
|
||||
bMouseChanged = false;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return (LPC_OK);
|
||||
}
|
||||
|
||||
ErrorCode_t HID_SetReport( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t length)
|
||||
{
|
||||
/* we will reuse standard EP0Buf */
|
||||
if (length == 0)
|
||||
return LPC_OK;
|
||||
|
||||
/* ReportID = SetupPacket.wValue.WB.L; */
|
||||
if (pSetup->wValue.WB.H != HID_REQUEST_REPORT_OUTPUT)
|
||||
return (ERR_USBD_STALL); /* Not Supported */
|
||||
|
||||
return (LPC_OK);
|
||||
}
|
||||
|
||||
ErrorCode_t HID_EpIn_Hdlr (USBD_HANDLE_T hUsb, void* data, uint32_t event)
|
||||
{
|
||||
if (USB_EVT_IN == event)
|
||||
{
|
||||
USB_HID_CTRL_T* pHidCtrl = (USB_HID_CTRL_T*)data;
|
||||
switch(pHidCtrl->protocol)
|
||||
{
|
||||
#if TUSB_CFG_DEVICE_HID_KEYBOARD
|
||||
case HID_PROTOCOL_KEYBOARD:
|
||||
if (!bKeyChanged)
|
||||
{
|
||||
memset(&hid_keyboard_report, 0, sizeof(hid_keyboard_report_t));
|
||||
}
|
||||
ROM_API->hw->WriteEP(hUsb, pHidCtrl->epin_adr, (uint8_t*) &hid_keyboard_report, sizeof(hid_keyboard_report_t));
|
||||
bKeyChanged = false;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if TUSB_CFG_DEVICE_HID_MOUSE
|
||||
case HID_PROTOCOL_MOUSE:
|
||||
if (!bMouseChanged)
|
||||
{
|
||||
memset(&hid_mouse_report, 0, sizeof(hid_mouse_report_t));
|
||||
}
|
||||
ROM_API->hw->WriteEP(hUsb, pHidCtrl->epin_adr, (uint8_t*) &hid_mouse_report, sizeof(hid_mouse_report_t));
|
||||
bMouseChanged = false;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return LPC_OK;
|
||||
}
|
||||
|
||||
ErrorCode_t HID_EpOut_Hdlr (USBD_HANDLE_T hUsb, void* data, uint32_t event)
|
||||
{
|
||||
if (USB_EVT_OUT == event)
|
||||
{
|
||||
// not used yet
|
||||
// uint8_t outreport[8];
|
||||
// USB_HID_CTRL_T* pHidCtrl = (USB_HID_CTRL_T*)data;
|
||||
// ROM_API->hw->ReadEP(hUsb, pHidCtrl->epout_adr, outreport);
|
||||
}
|
||||
return LPC_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user