mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-25 23:38:06 +00:00
house keeping
This commit is contained in:
parent
fd49cff8e8
commit
41fee0f488
@ -1,59 +1,57 @@
|
||||
/*
|
||||
* test_msc_host.c
|
||||
*
|
||||
* Created on: May 6, 2013
|
||||
* Author: hathach
|
||||
*/
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@file test_msc_host.c
|
||||
@author hathach (tinyusb.org)
|
||||
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
* Copyright (c) 2012, hathach (tinyusb.org)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the tiny usb stack.
|
||||
*/
|
||||
@section LICENSE
|
||||
|
||||
Software License Agreement (BSD License)
|
||||
|
||||
Copyright (c) 2013, hathach (tinyusb.org)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
This file is part of the tinyusb stack.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "unity.h"
|
||||
#include "tusb_option.h"
|
||||
#include "errors.h"
|
||||
#include "binary.h"
|
||||
#include "type_helper.h"
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
}
|
||||
|
||||
void tearDown(void)
|
||||
{
|
||||
}
|
||||
|
||||
#define _TINY_USB_SOURCE_FILE_
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// INCLUDE
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// INTERNAL OBJECT & FUNCTION DECLARATION
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// IMPLEMENTATION
|
||||
//--------------------------------------------------------------------+
|
||||
void test_()
|
||||
{
|
||||
// TEST_IGNORE();
|
||||
}
|
||||
|
@ -64,22 +64,22 @@ typedef struct
|
||||
tusb_descriptor_configuration_t configuration;
|
||||
|
||||
#if 0 //&& IAD_DESC_REQUIRED
|
||||
tusb_descriptor_interface_association_t CDC_IAD;
|
||||
tusb_descriptor_interface_association_t CDC_IAD;
|
||||
#endif
|
||||
|
||||
#if 0 //&& TUSB_CFG_DEVICE_CDC
|
||||
//CDC - Serial
|
||||
//CDC Control Interface
|
||||
tusb_descriptor_interface_t CDC_CCI_Interface;
|
||||
tusb_descriptor_interface_t CDC_CCI_Interface;
|
||||
CDC_HEADER_DESCRIPTOR CDC_Header;
|
||||
CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR CDC_ACM;
|
||||
CDC_UNION_1SLAVE_DESCRIPTOR CDC_Union;
|
||||
tusb_descriptor_endpoint_t CDC_NotificationEndpoint;
|
||||
tusb_descriptor_endpoint_t CDC_NotificationEndpoint;
|
||||
|
||||
//CDC Data Interface
|
||||
tusb_descriptor_interface_t CDC_DCI_Interface;
|
||||
tusb_descriptor_endpoint_t CDC_DataOutEndpoint;
|
||||
tusb_descriptor_endpoint_t CDC_DataInEndpoint;
|
||||
tusb_descriptor_interface_t CDC_DCI_Interface;
|
||||
tusb_descriptor_endpoint_t CDC_DataOutEndpoint;
|
||||
tusb_descriptor_endpoint_t CDC_DataInEndpoint;
|
||||
#endif
|
||||
|
||||
//------------- HID Keyboard -------------//
|
||||
|
@ -91,8 +91,8 @@ static inline void hidh_interface_close(uint8_t dev_addr, hidh_interface_info_t
|
||||
}
|
||||
|
||||
// called from public API need to validate parameters
|
||||
tusb_error_t hidh_interface_get_report(uint8_t dev_addr, uint8_t * const report, hidh_interface_info_t *p_hid) ATTR_ALWAYS_INLINE;
|
||||
tusb_error_t hidh_interface_get_report(uint8_t dev_addr, uint8_t * const report, hidh_interface_info_t *p_hid)
|
||||
tusb_error_t hidh_interface_get_report(uint8_t dev_addr, void * report, hidh_interface_info_t *p_hid) ATTR_ALWAYS_INLINE;
|
||||
tusb_error_t hidh_interface_get_report(uint8_t dev_addr, void * report, hidh_interface_info_t *p_hid)
|
||||
{
|
||||
//------------- parameters validation -------------//
|
||||
ASSERT_INT(TUSB_DEVICE_STATE_CONFIGURED, tusbh_device_get_state(dev_addr), TUSB_ERROR_DEVICE_NOT_READY);
|
||||
@ -130,7 +130,7 @@ bool tusbh_hid_keyboard_is_supported(uint8_t dev_addr)
|
||||
return tusbh_device_is_configured(dev_addr) && pipehandle_is_valid(keyboard_data[dev_addr-1].pipe_hdl);
|
||||
}
|
||||
|
||||
tusb_error_t tusbh_hid_keyboard_get_report(uint8_t dev_addr, uint8_t instance_num, uint8_t * const report)
|
||||
tusb_error_t tusbh_hid_keyboard_get_report(uint8_t dev_addr, uint8_t instance_num, void* report)
|
||||
{
|
||||
(void) instance_num;
|
||||
return hidh_interface_get_report(dev_addr, report, &keyboard_data[dev_addr-1]);
|
||||
@ -156,7 +156,7 @@ bool tusbh_hid_mouse_is_supported(uint8_t dev_addr)
|
||||
return tusbh_device_is_configured(dev_addr) && pipehandle_is_valid(mouse_data[dev_addr-1].pipe_hdl);
|
||||
}
|
||||
|
||||
tusb_error_t tusbh_hid_mouse_get_report(uint8_t dev_addr, uint8_t instance_num, uint8_t * const report)
|
||||
tusb_error_t tusbh_hid_mouse_get_report(uint8_t dev_addr, uint8_t instance_num, void * report)
|
||||
{
|
||||
(void) instance_num;
|
||||
return hidh_interface_get_report(dev_addr, report, &mouse_data[dev_addr-1]);
|
||||
|
@ -58,7 +58,7 @@
|
||||
// KEYBOARD Application API
|
||||
//--------------------------------------------------------------------+
|
||||
bool tusbh_hid_keyboard_is_supported(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_hid_keyboard_get_report(uint8_t dev_addr, uint8_t instance_num, uint8_t * report) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_hid_keyboard_get_report(uint8_t dev_addr, uint8_t instance_num, void * report) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_interface_status_t tusbh_hid_keyboard_status(uint8_t dev_addr, uint8_t instance_num) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
extern uint8_t const hid_keycode_to_ascii_tbl[2][128]; // TODO used weak attr if build failed without KEYBOARD enabled
|
||||
@ -70,7 +70,7 @@ void tusbh_hid_keyboard_isr(uint8_t dev_addr, uint8_t instance_num, tusb_event_t
|
||||
// MOUSE Application API
|
||||
//--------------------------------------------------------------------+
|
||||
bool tusbh_hid_mouse_is_supported(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_hid_mouse_get_report(uint8_t dev_addr, uint8_t instance_num, uint8_t * const report) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_hid_mouse_get_report(uint8_t dev_addr, uint8_t instance_num, void* report) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_interface_status_t tusbh_hid_mouse_status(uint8_t dev_addr, uint8_t instance_num) ATTR_WARN_UNUSED_RESULT;
|
||||
//------------- Application Callback -------------//
|
||||
void tusbh_hid_mouse_isr(uint8_t dev_addr, uint8_t instance_num, tusb_event_t event) ATTR_WEAK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user