From 62ae417add4f4806ae9b1bcf910708c4f0b8173b Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 1 May 2015 18:45:22 +0700 Subject: [PATCH] formatting --- demos/host/src/msc_cli.c | 6 ++++-- tinyusb/class/cdc.h | 18 +++++++++++------ tinyusb/class/cdc_rndis.h | 12 +++++++---- tinyusb/class/hid.h | 24 ++++++++++++++-------- tinyusb/class/msc.h | 18 +++++++++++------ tinyusb/common/tusb_errors.h | 3 ++- tinyusb/common/tusb_types.h | 36 ++++++++++++++++++++++----------- tinyusb/device/dcd_lpc175x_6x.h | 6 ++++-- tinyusb/device/usbd.c | 3 ++- tinyusb/device/usbd_dcd.h | 3 ++- 10 files changed, 86 insertions(+), 43 deletions(-) diff --git a/demos/host/src/msc_cli.c b/demos/host/src/msc_cli.c index ea7750da..0f61458f 100644 --- a/demos/host/src/msc_cli.c +++ b/demos/host/src/msc_cli.c @@ -52,7 +52,8 @@ enum { ASCII_BACKSPACE = 8, }; -typedef enum { +typedef enum +{ CLI_ERROR_NONE = 0, CLI_ERROR_INVALID_PARA, CLI_ERROR_INVALID_PATH, @@ -98,7 +99,8 @@ CLI_COMMAND_TABLE(CLI_PROTOTYPE_EXPAND) // Expand to enum value //--------------------------------------------------------------------+ #define CLI_ENUM_EXPAND(command, function, description) CLI_CMDTYPE_##command, -typedef enum { +typedef enum +{ CLI_COMMAND_TABLE(CLI_ENUM_EXPAND) CLI_CMDTYPE_COUNT }cli_cmdtype_t; diff --git a/tinyusb/class/cdc.h b/tinyusb/class/cdc.h index ab9ada2b..0fd25cc5 100644 --- a/tinyusb/class/cdc.h +++ b/tinyusb/class/cdc.h @@ -55,7 +55,8 @@ /// CDC Pipe ID, used to indicate which pipe the API is addressing to (Notification, Out, In) -typedef enum { +typedef enum +{ CDC_PIPE_NOTIFICATION , ///< Notification pipe CDC_PIPE_DATA_IN , ///< Data in pipe CDC_PIPE_DATA_OUT , ///< Data out pipe @@ -66,7 +67,8 @@ typedef enum { // CDC COMMUNICATION INTERFACE CLASS //--------------------------------------------------------------------+ /// Communication Interface Subclass Codes -typedef enum { +typedef enum +{ CDC_COMM_SUBCLASS_DIRECT_LINE_CONTROL_MODEL = 0x01 , ///< Direct Line Control Model [USBPSTN1.2] CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL , ///< Abstract Control Model [USBPSTN1.2] CDC_COMM_SUBCLASS_TELEPHONE_CONTROL_MODEL , ///< Telephone Control Model [USBPSTN1.2] @@ -82,7 +84,8 @@ typedef enum { } cdc_comm_sublcass_type_t; /// Communication Interface Protocol Codes -typedef enum { +typedef enum +{ CDC_COMM_PROTOCOL_ATCOMMAND = 0x01 , ///< AT Commands: V.250 etc CDC_COMM_PROTOCOL_ATCOMMAND_PCCA_101 , ///< AT Commands defined by PCCA-101 CDC_COMM_PROTOCOL_ATCOMMAND_PCCA_101_AND_ANNEXO , ///< AT Commands defined by PCCA-101 & Annex O @@ -94,7 +97,8 @@ typedef enum { //------------- SubType Descriptor in COMM Functional Descriptor -------------// /// Communication Interface SubType Descriptor -typedef enum { +typedef enum +{ CDC_FUNC_DESC_HEADER = 0x00 , ///< Header Functional Descriptor, which marks the beginning of the concatenated set of functional descriptors for the interface. CDC_FUNC_DESC_CALL_MANAGEMENT = 0x01 , ///< Call Management Functional Descriptor. CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT = 0x02 , ///< Abstract Control Management Functional Descriptor. @@ -148,7 +152,8 @@ typedef enum{ // MANAGEMENT ELEMENT REQUEST (CONTROL ENDPOINT) //--------------------------------------------------------------------+ /// Communication Interface Management Element Request Codes -typedef enum { +typedef enum +{ CDC_REQUEST_SEND_ENCAPSULATED_COMMAND = 0x00, ///< is used to issue a command in the format of the supported control protocol of the Communications Class interface CDC_REQUEST_GET_ENCAPSULATED_RESPONSE = 0x01, ///< is used to request a response in the format of the supported control protocol of the Communications Class interface. @@ -198,7 +203,8 @@ typedef enum { // MANAGEMENT ELEMENENT NOTIFICATION (NOTIFICATION ENDPOINT) //--------------------------------------------------------------------+ /// Communication Interface Management Element Notification Codes -typedef enum { +typedef enum +{ NETWORK_CONNECTION = 0x00, ///< This notification allows the device to notify the host about network connection status. RESPONSE_AVAILABLE = 0x01, ///< This notification allows the device to notify the hostthat a response is available. This response can be retrieved with a subsequent \ref CDC_REQUEST_GET_ENCAPSULATED_RESPONSE request. diff --git a/tinyusb/class/cdc_rndis.h b/tinyusb/class/cdc_rndis.h index 3b4413c2..8076a5bb 100644 --- a/tinyusb/class/cdc_rndis.h +++ b/tinyusb/class/cdc_rndis.h @@ -56,7 +56,8 @@ #endif /// RNDIS Message Types -typedef enum { +typedef enum +{ RNDIS_MSG_PACKET = 0x00000001UL, ///< The host and device use this to send network data to one another. RNDIS_MSG_INITIALIZE = 0x00000002UL, ///< Sent by the host to initialize the device. @@ -80,7 +81,8 @@ typedef enum { }rndis_msg_type_t; /// RNDIS Message Status Values -typedef enum { +typedef enum +{ RNDIS_STATUS_SUCCESS = 0x00000000UL, ///< Success RNDIS_STATUS_FAILURE = 0xC0000001UL, ///< Unspecified error RNDIS_STATUS_INVALID_DATA = 0xC0010015UL, ///< Invalid data error @@ -243,7 +245,8 @@ typedef struct { //--------------------------------------------------------------------+ /// NDIS Object ID -typedef enum { +typedef enum +{ //------------- General Required OIDs -------------// RNDIS_OID_GEN_SUPPORTED_LIST = 0x00010101, ///< List of supported OIDs RNDIS_OID_GEN_HARDWARE_STATUS = 0x00010102, ///< Hardware status @@ -283,7 +286,8 @@ typedef enum { } rndis_oid_type_t; /// RNDIS Packet Filter Bits \ref RNDIS_OID_GEN_CURRENT_PACKET_FILTER. -typedef enum { +typedef enum +{ RNDIS_PACKET_TYPE_DIRECTED = 0x00000001, ///< Directed packets. Directed packets contain a destination address equal to the station address of the NIC. RNDIS_PACKET_TYPE_MULTICAST = 0x00000002, ///< Multicast address packets sent to addresses in the multicast address list. RNDIS_PACKET_TYPE_ALL_MULTICAST = 0x00000004, ///< All multicast address packets, not just the ones enumerated in the multicast address list. diff --git a/tinyusb/class/hid.h b/tinyusb/class/hid.h index ed289421..23ab3f66 100644 --- a/tinyusb/class/hid.h +++ b/tinyusb/class/hid.h @@ -56,34 +56,39 @@ * @{ */ /// HID Subclass -typedef enum { +typedef enum +{ HID_SUBCLASS_NONE = 0, ///< No Subclass HID_SUBCLASS_BOOT = 1 ///< Boot Interface Subclass }hid_subclass_type_t; /// HID Protocol -typedef enum { +typedef enum +{ HID_PROTOCOL_NONE = 0, ///< None HID_PROTOCOL_KEYBOARD = 1, ///< Keyboard HID_PROTOCOL_MOUSE = 2 ///< Mouse }hid_protocol_type_t; /// HID Descriptor Type -typedef enum { +typedef enum +{ HID_DESC_TYPE_HID = 0x21, ///< HID Descriptor HID_DESC_TYPE_REPORT = 0x22, ///< Report Descriptor HID_DESC_TYPE_PHYSICAL = 0x23 ///< Physical Descriptor }hid_descriptor_type_t; /// HID Request Report Type -typedef enum { +typedef enum +{ HID_REQUEST_REPORT_INPUT = 1, ///< Input HID_REQUEST_REPORT_OUTPUT, ///< Output HID_REQUEST_REPORT_FEATURE ///< Feature }hid_request_report_type_t; /// HID Class Specific Control Request -typedef enum { +typedef enum +{ HID_REQUEST_CONTROL_GET_REPORT = 0x01, ///< Get Report HID_REQUEST_CONTROL_GET_IDLE = 0x02, ///< Get Idle HID_REQUEST_CONTROL_GET_PROTOCOL = 0x03, ///< Get Protocol @@ -165,7 +170,8 @@ typedef struct ATTR_PACKED } hid_mouse_report_t; /// Standard Mouse Buttons Bitmap -typedef enum { +typedef enum +{ MOUSE_BUTTON_LEFT = BIT_(0), ///< Left button MOUSE_BUTTON_RIGHT = BIT_(1), ///< Right button MOUSE_BUTTON_MIDDLE = BIT_(2) ///< Middle button @@ -188,7 +194,8 @@ typedef struct ATTR_PACKED } hid_keyboard_report_t; /// Keyboard modifier codes bitmap -typedef enum { +typedef enum +{ KEYBOARD_MODIFIER_LEFTCTRL = BIT_(0), ///< Left Control KEYBOARD_MODIFIER_LEFTSHIFT = BIT_(1), ///< Left Shift KEYBOARD_MODIFIER_LEFTALT = BIT_(2), ///< Left Alt @@ -199,7 +206,8 @@ typedef enum { KEYBOARD_MODIFIER_RIGHTGUI = BIT_(7) ///< Right Window }hid_keyboard_modifier_bm_t; -typedef enum { +typedef enum +{ KEYBOARD_LED_NUMLOCK = BIT_(0), ///< Num Lock LED KEYBOARD_LED_CAPSLOCK = BIT_(1), ///< Caps Lock LED KEYBOARD_LED_SCROLLLOCK = BIT_(2), ///< Scroll Lock LED diff --git a/tinyusb/class/msc.h b/tinyusb/class/msc.h index a2ebca0d..cfd9b5e8 100644 --- a/tinyusb/class/msc.h +++ b/tinyusb/class/msc.h @@ -56,7 +56,8 @@ // Mass Storage Class Constant //--------------------------------------------------------------------+ /// MassStorage Subclass -typedef enum { +typedef enum +{ MSC_SUBCLASS_RBC = 1 , ///< Reduced Block Commands (RBC) T10 Project 1240-D MSC_SUBCLASS_SFF_MMC , ///< SFF-8020i, MMC-2 (ATAPI). Typically used by a CD/DVD device MSC_SUBCLASS_QIC , ///< QIC-157. Typically used by a tape device @@ -72,14 +73,16 @@ enum { /// \brief MassStorage Protocol. /// \details CBI only approved to use with full-speed floopy disk & should not used with highspeed or device other than floopy -typedef enum { +typedef enum +{ MSC_PROTOCOL_CBI = 0 , ///< Control/Bulk/Interrupt protocol (with command completion interrupt) MSC_PROTOCOL_CBI_NO_INTERRUPT = 1 , ///< Control/Bulk/Interrupt protocol (without command completion interrupt) MSC_PROTOCOL_BOT = 0x50 ///< Bulk-Only Transport }msc_protocol_type_t; /// MassStorage Class-Specific Control Request -typedef enum { +typedef enum +{ MSC_REQUEST_GET_MAX_LUN = 254, ///< The Get Max LUN device request is used to determine the number of logical units supported by the device. Logical Unit Numbers on the device shall be numbered contiguously starting from LUN 0 to a maximum LUN of 15 MSC_REQUEST_RESET = 255 ///< This request is used to reset the mass storage device and its associated interface. This class-specific request shall ready the device for the next CBW from the host. }msc_request_type_t; @@ -87,7 +90,8 @@ typedef enum { /// \brief Command Block Status Values /// \details Indicates the success or failure of the command. The device shall set this byte to zero if the command completed /// successfully. A non-zero value shall indicate a failure during command execution according to the following -typedef enum { +typedef enum +{ MSC_CSW_STATUS_PASSED = 0 , ///< MSC_CSW_STATUS_PASSED MSC_CSW_STATUS_FAILED , ///< MSC_CSW_STATUS_FAILED MSC_CSW_STATUS_PHASE_ERROR ///< MSC_CSW_STATUS_PHASE_ERROR @@ -123,7 +127,8 @@ STATIC_ASSERT(sizeof(msc_cmd_status_wrapper_t) == 13, "size is not correct"); //--------------------------------------------------------------------+ /// SCSI Command Operation Code -typedef enum { +typedef enum +{ SCSI_CMD_TEST_UNIT_READY = 0x00, ///< The SCSI Test Unit Ready command is used to determine if a device is ready to transfer data (read/write), i.e. if a disk has spun up, if a tape is loaded and ready etc. The device does not perform a self-test operation. SCSI_CMD_INQUIRY = 0x12, ///< The SCSI Inquiry command is used to obtain basic information from a target device. SCSI_CMD_MODE_SELECT_6 = 0x15, ///< provides a means for the application client to specify medium, logical unit, or peripheral device parameters to the device server. Device servers that implement the MODE SELECT(6) command shall also implement the MODE SENSE(6) command. Application clients should issue MODE SENSE(6) prior to each MODE SELECT(6) to determine supported mode pages, page lengths, and other parameters. @@ -137,7 +142,8 @@ typedef enum { }scsi_cmd_type_t; /// SCSI Sense Key -typedef enum { +typedef enum +{ SCSI_SENSEKEY_NONE = 0x00, ///< no specific Sense Key. This would be the case for a successful command SCSI_SENSEKEY_RECOVERED_ERROR = 0x01, ///< ndicates the last command completed successfully with some recovery action performed by the disc drive. SCSI_SENSEKEY_NOT_READY = 0x02, ///< Indicates the logical unit addressed cannot be accessed. diff --git a/tinyusb/common/tusb_errors.h b/tinyusb/common/tusb_errors.h index 74777e67..98abe0aa 100644 --- a/tinyusb/common/tusb_errors.h +++ b/tinyusb/common/tusb_errors.h @@ -94,7 +94,8 @@ /// \brief Error Code returned -typedef enum { +typedef enum +{ ERROR_TABLE(ERROR_ENUM) TUSB_ERROR_COUNT }tusb_error_t; diff --git a/tinyusb/common/tusb_types.h b/tinyusb/common/tusb_types.h index 724b4dbd..7f774e13 100644 --- a/tinyusb/common/tusb_types.h +++ b/tinyusb/common/tusb_types.h @@ -48,21 +48,24 @@ #endif /// defined base on EHCI specs value for Endpoint Speed -typedef enum { +typedef enum +{ TUSB_SPEED_FULL = 0, TUSB_SPEED_LOW , TUSB_SPEED_HIGH }tusb_speed_t; /// defined base on USB Specs Endpoint's bmAttributes -typedef enum { +typedef enum +{ TUSB_XFER_CONTROL = 0 , TUSB_XFER_ISOCHRONOUS , TUSB_XFER_BULK , TUSB_XFER_INTERRUPT }tusb_xfer_type_t; -typedef enum { +typedef enum +{ TUSB_DIR_HOST_TO_DEV = 0, TUSB_DIR_DEV_TO_HOST = 1, @@ -71,7 +74,8 @@ typedef enum { /// USB Descriptor Types (section 9.4 table 9-5) -typedef enum { +typedef enum +{ TUSB_DESC_TYPE_DEVICE = 0x01 , TUSB_DESC_TYPE_CONFIGURATION = 0x02 , TUSB_DESC_TYPE_STRING = 0x03 , @@ -86,7 +90,8 @@ typedef enum { TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC = 0x24 }tusb_std_descriptor_type_t; -typedef enum { +typedef enum +{ TUSB_REQUEST_GET_STATUS =0 , ///< 0 TUSB_REQUEST_CLEAR_FEATURE , ///< 1 TUSB_REQUEST_RESERVED , ///< 2 @@ -102,20 +107,23 @@ typedef enum { TUSB_REQUEST_SYNCH_FRAME ///< 12 }tusb_std_request_code_t; -typedef enum { +typedef enum +{ TUSB_REQUEST_TYPE_STANDARD = 0, TUSB_REQUEST_TYPE_CLASS, TUSB_REQUEST_TYPE_VENDOR } tusb_control_request_type_t; -typedef enum { +typedef enum +{ TUSB_REQUEST_RECIPIENT_DEVICE =0, TUSB_REQUEST_RECIPIENT_INTERFACE, TUSB_REQUEST_RECIPIENT_ENDPOINT, TUSB_REQUEST_RECIPIENT_OTHER } tusb_std_request_recipient_t; -typedef enum { +typedef enum +{ TUSB_CLASS_UNSPECIFIED = 0 , ///< 0 TUSB_CLASS_AUDIO = 1 , ///< 1 TUSB_CLASS_CDC = 2 , ///< 2 @@ -143,11 +151,13 @@ typedef enum { TUSB_CLASS_VENDOR_SPECIFIC = 0xFF }tusb_std_class_code_t; -typedef enum { +typedef enum +{ MISC_SUBCLASS_COMMON = 2 }misc_subclass_type_t; -typedef enum { +typedef enum +{ MISC_PROTOCOL_IAD = 1 }misc_protocol_type_t; @@ -160,7 +170,8 @@ enum { #define TUSB_DESC_CONFIG_POWER_MA(x) ((x)/2) /// Device State -typedef enum { +typedef enum +{ TUSB_DEVICE_STATE_UNPLUG = 0 , TUSB_DEVICE_STATE_ADDRESSED , TUSB_DEVICE_STATE_CONFIGURED , @@ -172,7 +183,8 @@ typedef enum { TUSB_DEVICE_STATE_INVALID_PARAMETER }tusb_device_state_t; -typedef enum { +typedef enum +{ TUSB_EVENT_NONE = 0, TUSB_EVENT_XFER_COMPLETE, TUSB_EVENT_XFER_ERROR, diff --git a/tinyusb/device/dcd_lpc175x_6x.h b/tinyusb/device/dcd_lpc175x_6x.h index cfdcb27b..fe3c509c 100644 --- a/tinyusb/device/dcd_lpc175x_6x.h +++ b/tinyusb/device/dcd_lpc175x_6x.h @@ -131,7 +131,8 @@ enum { }; //------------- SIE Command Code -------------// -typedef enum { +typedef enum +{ SIE_CMDPHASE_WRITE = 1, SIE_CMDPHASE_READ = 2, SIE_CMDPHASE_COMMAND = 5 @@ -176,7 +177,8 @@ enum { SIE_SELECT_ENDPOINT_BUFFER2_FULL_MASK = BIT_(6) }; -typedef enum { +typedef enum +{ SIE_SET_ENDPOINT_STALLED_MASK = BIT_(0), SIE_SET_ENDPOINT_DISABLED_MASK = BIT_(5), SIE_SET_ENDPOINT_RATE_FEEDBACK_MASK = BIT_(6), diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c index 61a9ab63..bba32a6b 100644 --- a/tinyusb/device/usbd.c +++ b/tinyusb/device/usbd.c @@ -114,7 +114,8 @@ bool tusbd_is_configured(uint8_t coreid) //------------- OSAL Task -------------// enum { USBD_TASK_QUEUE_DEPTH = 16 }; -typedef enum { +typedef enum +{ USBD_EVENTID_SETUP_RECEIVED = 1, USBD_EVENTID_XFER_DONE }usbd_eventid_t; diff --git a/tinyusb/device/usbd_dcd.h b/tinyusb/device/usbd_dcd.h index 5c99c3c1..f6b085cf 100644 --- a/tinyusb/device/usbd_dcd.h +++ b/tinyusb/device/usbd_dcd.h @@ -59,7 +59,8 @@ enum { USBD_INTERFACE_NUM_MAX = 16 // USB specs specify up to 16 endpoints per device }; -typedef enum { +typedef enum +{ USBD_BUS_EVENT_RESET = 1, USBD_BUS_EVENT_UNPLUGGED, USBD_BUS_EVENT_SUSPENDED,