usbh: cleanup

This commit is contained in:
Nicolas Reinecke 2016-11-14 01:32:28 +01:00
parent 3abfddc447
commit de0c3e70c6
5 changed files with 34 additions and 33 deletions

View File

@ -1,5 +1,5 @@
/*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -23,8 +23,8 @@
*/
#ifndef HAL_STM32_OTG_H_
#define HAL_STM32_OTG_H_
#ifndef HAL_STM32_OTG_H
#define HAL_STM32_OTG_H
/**
* @brief Number of the implemented endpoints in OTG_FS.
@ -571,7 +571,7 @@ typedef struct {
#define HCCHAR_EPDIR (1U<<15) /**< Endpoint direction. */
#define HCCHAR_EPNUM_MASK (15U<<11) /**< Endpoint number mask. */
#define HCCHAR_EPNUM(n) ((n)<<11) /**< Endpoint number value. */
#define HCCHAR_MPS_MASK (0x7FFU<<0) /**< Maximum packet size mask. */
#define HCCHAR_MPS_MASK (0x7FFU<<0) /**< Maximum packet size mask. */
#define HCCHAR_MPS(n) ((n)<<0) /**< Maximum packet size value. */
/** @} */
@ -590,6 +590,7 @@ typedef struct {
interrupt. */
#define HCINT_STALL (1U<<3) /**< STALL response received
interrupt. */
#define HCINT_AHBERR (1U<<2) /**< AHB error interrupt. */
#define HCINT_CHH (1U<<1) /**< Channel halted. */
#define HCINT_XFRC (1U<<0) /**< Transfer completed. */
/** @} */
@ -611,7 +612,7 @@ typedef struct {
interrupt mask. */
#define HCINTMSK_STALLM (1U<<3) /**< STALL response received
interrupt mask. */
#define HCINTMSK_AHBERRM (1U<<2)
#define HCINTMSK_AHBERRM (1U<<2) /**< AHB error interrupt mask. */
#define HCINTMSK_CHHM (1U<<1) /**< Channel halted mask. */
#define HCINTMSK_XFRCM (1U<<0) /**< Transfer completed mask. */
/** @} */
@ -924,6 +925,6 @@ typedef struct {
*/
#define OTG_HS ((stm32_otg_t *)OTG_HS_ADDR)
#endif /* _STM32_OTG_H_ */
#endif /* STM32_OTG_H */
/** @} */

View File

@ -59,7 +59,7 @@ static void otg_rxfifo_flush(USBHDriver *usbp);
static void otg_txfifo_flush(USBHDriver *usbp, uint32_t fifo);
/*===========================================================================*/
/* Little helper functions. */
/* Little helper functions. */
/*===========================================================================*/
static inline void _move_to_pending_queue(usbh_ep_t *ep) {
list_move_tail(&ep->node, ep->pending_list);
@ -84,7 +84,7 @@ static inline void _transfer_completed(usbh_ep_t *ep, usbh_urb_t *urb, usbh_urbs
#endif
/*===========================================================================*/
/* Functions called from many places. */
/* Functions called from many places. */
/*===========================================================================*/
static void _transfer_completedI(usbh_ep_t *ep, usbh_urb_t *urb, usbh_urbstatus_t status) {
osalDbgCheckClassI();
@ -487,7 +487,7 @@ static uint32_t _write_packet(struct list_head *list, uint32_t space_available)
/*===========================================================================*/
/* API. */
/* API. */
/*===========================================================================*/
void usbh_lld_ep_object_init(usbh_ep_t *ep) {
@ -614,7 +614,7 @@ bool usbh_lld_urb_abort(usbh_urb_t *urb, usbh_urbstatus_t status) {
/*===========================================================================*/
/* Channel Interrupts. */
/* Channel Interrupts. */
/*===========================================================================*/
//CTRL(IN) CTRL(OUT) INT(IN) INT(OUT) BULK(IN) BULK(OUT) ISO(IN) ISO(OUT)
@ -951,7 +951,7 @@ static inline void _hcint_int(USBHDriver *host) {
/*===========================================================================*/
/* Host interrupts. */
/* Host interrupts. */
/*===========================================================================*/
static inline void _sof_int(USBHDriver *host) {
udbg("SOF");
@ -1214,7 +1214,7 @@ static void usb_lld_serve_interrupt(USBHDriver *host) {
/*===========================================================================*/
/* Interrupt handlers. */
/* Interrupt handlers. */
/*===========================================================================*/
#if STM32_USBH_USE_OTG1
@ -1239,7 +1239,7 @@ OSAL_IRQ_HANDLER(STM32_OTG2_HANDLER) {
/*===========================================================================*/
/* Initialization functions. */
/* Initialization functions. */
/*===========================================================================*/
static void otg_core_reset(USBHDriver *usbp) {
stm32_otg_t *const otgp = usbp->otg;
@ -1450,7 +1450,7 @@ void usbh_lld_start(USBHDriver *usbh) {
}
/*===========================================================================*/
/* Root Hub request handler. */
/* Root Hub request handler. */
/*===========================================================================*/
usbh_urbstatus_t usbh_lld_root_hub_request(USBHDriver *usbh, uint8_t bmRequestType, uint8_t bRequest,
uint16_t wvalue, uint16_t windex, uint16_t wlength, uint8_t *buf) {

View File

@ -15,8 +15,8 @@
limitations under the License.
*/
#ifndef HAL_USBH_LLD_H_
#define HAL_USBH_LLD_H_
#ifndef HAL_USBH_LLD_H
#define HAL_USBH_LLD_H
#include "hal.h"
@ -150,4 +150,4 @@ uint8_t usbh_lld_roothub_get_statuschange_bitmap(USBHDriver *usbh);
#endif
#endif /* HAL_USBH_LLD_H_ */
#endif /* HAL_USBH_LLD_H */

View File

@ -69,7 +69,7 @@ static bool _classdriver_load(usbh_device_t *dev, uint8_t class,
/*===========================================================================*/
/* Checks. */
/* Checks. */
/*===========================================================================*/
static inline void _check_dev(usbh_device_t *dev) {
@ -92,7 +92,7 @@ static inline void _check_urb(usbh_urb_t *urb) {
}
/*===========================================================================*/
/* Main driver API. */
/* Main driver API. */
/*===========================================================================*/
void usbhObjectInit(USBHDriver *usbh) {
@ -143,7 +143,7 @@ void usbhResume(USBHDriver *usbh) {
}
/*===========================================================================*/
/* Endpoint API. */
/* Endpoint API. */
/*===========================================================================*/
void usbhEPObjectInit(usbh_ep_t *ep, usbh_device_t *dev, const usbh_endpoint_descriptor_t *desc) {
@ -183,7 +183,7 @@ static void _ep0_object_init(usbh_device_t *dev, uint16_t wMaxPacketSize) {
/*===========================================================================*/
/* URB API. */
/* URB API. */
/*===========================================================================*/
void usbhURBObjectInit(usbh_urb_t *urb, usbh_ep_t *ep, usbh_completion_cb callback,
@ -350,7 +350,7 @@ void _usbh_urb_completeI(usbh_urb_t *urb, usbh_urbstatus_t status) {
}
/*===========================================================================*/
/* Synchronous API. */
/* Synchronous API. */
/*===========================================================================*/
usbh_urbstatus_t usbhBulkTransfer(usbh_ep_t *ep,
@ -419,7 +419,7 @@ usbh_urbstatus_t usbhControlRequest(usbh_device_t *dev,
}
/*===========================================================================*/
/* Standard request helpers. */
/* Standard request helpers. */
/*===========================================================================*/
#define USBH_GET_DESCRIPTOR(type, value, index) \
@ -523,7 +523,7 @@ bool usbhStdReqGetInterface(usbh_device_t *dev,
/*===========================================================================*/
/* Device-related functions. */
/* Device-related functions. */
/*===========================================================================*/
static uint8_t _find_address(USBHDriver *host) {
@ -846,7 +846,7 @@ bool usbhDeviceReadString(usbh_device_t *dev, char *dest, uint8_t size,
/*===========================================================================*/
/* Port processing functions. */
/* Port processing functions. */
/*===========================================================================*/
static void _port_connected(usbh_port_t *port);
@ -1078,7 +1078,7 @@ void _usbh_port_disconnected(usbh_port_t *port) {
/*===========================================================================*/
/* Hub processing functions. */
/* Hub processing functions. */
/*===========================================================================*/
#if HAL_USBH_USE_HUB
@ -1176,7 +1176,7 @@ static void _hub_process(USBHDriver *host) {
#endif
/*===========================================================================*/
/* Main processing loop (enumeration, loading/unloading drivers, etc). */
/* Main processing loop (enumeration, loading/unloading drivers, etc). */
/*===========================================================================*/
void usbhMainLoop(USBHDriver *usbh) {
@ -1200,7 +1200,7 @@ void usbhMainLoop(USBHDriver *usbh) {
/*===========================================================================*/
/* IAD class driver. */
/* IAD class driver. */
/*===========================================================================*/
#if HAL_USBH_USE_IAD
static usbh_baseclassdriver_t *iad_load(usbh_device_t *dev, const uint8_t *descriptor, uint16_t rem);
@ -1258,7 +1258,7 @@ static void iad_unload(usbh_baseclassdriver_t *drv) {
/*===========================================================================*/
/* Class driver loader. */
/* Class driver loader. */
/*===========================================================================*/
static const usbh_classdriverinfo_t *usbh_classdrivers_lookup[] = {

View File

@ -68,7 +68,7 @@
/*===========================================================================*/
/* USB Class driver loader for MSD */
/* USB Class driver loader for MSD */
/*===========================================================================*/
USBHMassStorageDriver USBHMSD[HAL_USBHMSD_MAX_INSTANCES];
@ -234,7 +234,7 @@ static void _msd_unload(usbh_baseclassdriver_t *drv) {
/*===========================================================================*/
/* MSD Class driver operations (Bulk-Only transport) */
/* MSD Class driver operations (Bulk-Only transport) */
/*===========================================================================*/
@ -290,7 +290,7 @@ typedef struct {
/* ----------------------------------------------------- */
/* SCSI Commands */
/* SCSI Commands */
/* ----------------------------------------------------- */
/* Read 10 and Write 10 */
@ -584,7 +584,7 @@ static msd_result_t scsi_write10(USBHMassStorageLUNDriver *lunp, uint32_t lba, u
/*===========================================================================*/
/* Block driver data/functions */
/* Block driver data/functions */
/*===========================================================================*/
USBHMassStorageLUNDriver MSBLKD[HAL_USBHMSD_MAX_LUNS];