+/rtos
git clone https://git.julia.blue/+/rtos
326af29
master
1//***************************************************************************** 2// 3// usbdhidmouse.h - Public header file for the USB HID Mouse device class 4// driver 5// 6// Copyright (c) 2008-2017 Texas Instruments Incorporated. All rights reserved. 7// Software License Agreement 8// 9// Texas Instruments (TI) is supplying this software for use solely and 10// exclusively on TI's microcontroller products. The software is owned by 11// TI and/or its suppliers, and is protected under applicable copyright 12// laws. You may not combine this software with "viral" open-source 13// software in order to form a larger program. 14// 15// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 16// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 17// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 19// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 20// DAMAGES, FOR ANY REASON WHATSOEVER. 21// 22// This is part of revision 2.1.4.178 of the Tiva USB Library. 23// 24//***************************************************************************** 25 26#ifndef __USBDHIDMOUSE_H__ 27#define __USBDHIDMOUSE_H__ 28#include "usblib/device/usbdhid.h" 29 30//***************************************************************************** 31// 32// If building with a C++ compiler, make all of the definitions in this header 33// have a C binding. 34// 35//***************************************************************************** 36#ifdef __cplusplus 37extern "C" { 38#endif 39 40//***************************************************************************** 41// 42//! \addtogroup hid_mouse_device_class_api 43//! @{ 44// 45//***************************************************************************** 46 47//***************************************************************************** 48// 49// PRIVATE 50// 51// The first few sections of this header are private defines that are used by 52// the USB HID mouse code and are here only to help with the application 53// allocating the correct amount of memory for the HID mouse device code. 54// 55//***************************************************************************** 56 57//***************************************************************************** 58// 59// PRIVATE 60// 61// The size of the mouse input report sent to the host. 62// 63//***************************************************************************** 64#define MOUSE_REPORT_SIZE 3 65 66//***************************************************************************** 67// 68// PRIVATE 69// 70// This enumeration holds the various states that the mouse can be in during 71// normal operation. 72// 73//***************************************************************************** 74typedef enum { 75// 76// Unconfigured. 77// 78eHIDMouseStateUnconfigured , 79 80// 81// No keys to send and not waiting on data. 82// 83eHIDMouseStateIdle , 84 85// 86// Waiting on report data from the host. 87// 88eHIDMouseStateWaitData , 89 90// 91// Waiting on data to be sent out. 92// 93eHIDMouseStateSend 94}tMouseState ; 95 96//***************************************************************************** 97// 98// PRIVATE 99// 100// This structure provides the private instance data structure for the USB 101// HID Mouse device. This structure forms the RAM workspace used by each 102// instance of the mouse. 103// 104//***************************************************************************** 105typedef struct { 106// 107// The USB configuration number set by the host or 0 of the device is 108// currently unconfigured. 109// 110uint8_t ui8USBConfigured ; 111 112// 113// The protocol requested by the host, USB_HID_PROTOCOL_BOOT or 114// USB_HID_PROTOCOL_REPORT. 115// 116uint8_t ui8Protocol ; 117 118// 119// A buffer used to hold the last input report sent to the host. 120// 121uint8_t pui8Report [MOUSE_REPORT_SIZE ]; 122 123// 124// The current state of the mouse interrupt IN endpoint. 125// 126volatile tMouseState iMouseState ; 127 128// 129// The idle timeout control structure for our input report. This is 130// required by the lower level HID driver. 131// 132tHIDReportIdle sReportIdle ; 133 134// 135// This is needed for the lower level HID driver. 136// 137tUSBDHIDDevice sHIDDevice ; 138}tHIDMouseInstance ; 139 140//***************************************************************************** 141// 142//! This structure is used by the application to define operating parameters 143//! for the HID mouse device. 144// 145//***************************************************************************** 146typedef struct { 147// 148//! The vendor ID that this device is to present in the device descriptor. 149// 150const uint16_t ui16VID ; 151 152// 153//! The product ID that this device is to present in the device descriptor. 154// 155const uint16_t ui16PID ; 156 157// 158//! The maximum power consumption of the device, expressed in milliamps. 159// 160const uint16_t ui16MaxPowermA ; 161 162// 163//! Indicates whether the device is self- or bus-powered and whether or not 164//! it supports remote wakeup. Valid values are USB_CONF_ATTR_SELF_PWR or 165//! USB_CONF_ATTR_BUS_PWR, optionally ORed with USB_CONF_ATTR_RWAKE. 166// 167const uint8_t ui8PwrAttributes ; 168 169// 170//! A pointer to the callback function which is called to notify 171//! the application of events relating to the operation of the mouse. 172// 173const tUSBCallback pfnCallback ; 174 175// 176//! A client-supplied pointer which is sent as the first 177//! parameter in all calls made to the mouse callback, pfnCallback. 178// 179void * pvCBData ; 180 181// 182//! A pointer to the string descriptor array for this device. This array 183//! must contain the following string descriptor pointers in this order. 184//! Language descriptor, Manufacturer name string (language 1), Product 185//! name string (language 1), Serial number string (language 1),HID 186//! Interface description string (language 1), Configuration description 187//! string (language 1). 188//! 189//! If supporting more than 1 language, the descriptor block (except for 190//! string descriptor 0) must be repeated for each language defined in the 191//! language descriptor. 192// 193const uint8_t * const * ppui8StringDescriptors ; 194 195// 196//! The number of descriptors provided in the ppStringDescriptors 197//! array. This must be (1 + (5 * (num languages))). 198// 199const uint32_t ui32NumStringDescriptors ; 200 201// 202//! The private instance data for this device. This memory must 203//! remain accessible for as long as the mouse device is in use and must 204//! not be modified by any code outside the HID mouse driver. 205// 206tHIDMouseInstance sPrivateData ; 207}tUSBDHIDMouseDevice ; 208 209//***************************************************************************** 210// 211//! This return code from USBDHIDMouseStateChange() indicates success. 212// 213//***************************************************************************** 214#define MOUSE_SUCCESS 0 215 216//***************************************************************************** 217// 218//! This return code from USBDHIDMouseStateChange() indicates that an error was 219//! reported while attempting to send a report to the host. A client should 220//! assume that the host has disconnected if this return code is seen. 221// 222//***************************************************************************** 223#define MOUSE_ERR_TX_ERROR 2 224 225//***************************************************************************** 226// 227//! USBDHIDMouseStateChange() returns this value if it is called before the 228//! USB host has connected and configured the device. All mouse state 229//! information passed on the call is been ignored. 230// 231//***************************************************************************** 232#define MOUSE_ERR_NOT_CONFIGURED 4 233 234//***************************************************************************** 235// 236//! Setting this bit in the ui8Buttons parameter to USBDHIDMouseStateChange() 237//! indicates to the USB host that button 1 on the mouse is pressed. 238// 239//***************************************************************************** 240#define MOUSE_REPORT_BUTTON_1 0x01 241 242//***************************************************************************** 243// 244//! Setting this bit in the ui8Buttons parameter to USBDHIDMouseStateChange() 245//! indicates to the USB host that button 2 on the mouse is pressed. 246// 247//***************************************************************************** 248#define MOUSE_REPORT_BUTTON_2 0x02 249 250//***************************************************************************** 251// 252//! Setting this bit in the ui8Buttons parameter to USBDHIDMouseStateChange() 253//! indicates to the USB host that button 3 on the mouse is pressed. 254// 255//***************************************************************************** 256#define MOUSE_REPORT_BUTTON_3 0x04 257 258//***************************************************************************** 259// 260// API Function Prototypes 261// 262//***************************************************************************** 263extern void * USBDHIDMouseInit (uint32_t ui32Index , 264tUSBDHIDMouseDevice * psMouseDevice ); 265extern void * USBDHIDMouseCompositeInit (uint32_t ui32Index , 266tUSBDHIDMouseDevice * psMouseDevice , 267tCompositeEntry * psCompEntry ); 268extern void USBDHIDMouseTerm (void * pvMouseDevice ); 269extern void * USBDHIDMouseSetCBData (void * pvMouseDevice ,void * pvCBData ); 270extern uint32_t USBDHIDMouseStateChange (void * pvMouseDevice ,int8_t i8DeltaX , 271int8_t i8DeltaY ,uint8_t ui8Buttons ); 272extern void USBDHIDMousePowerStatusSet (void * pvMouseDevice ,uint8_t ui8Power ); 273extern bool USBDHIDMouseRemoteWakeupRequest (void * pvMouseDevice ); 274 275//***************************************************************************** 276// 277// Close the Doxygen group. 278//! @} 279// 280//***************************************************************************** 281 282//***************************************************************************** 283// 284// Mark the end of the C bindings section for C++ compilers. 285// 286//***************************************************************************** 287#ifdef __cplusplus 288} 289#endif 290 291#endif // __USBDHIDMOUSE_H__