summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2022-08-17 20:12:37 +0800
committersakumisu <[email protected]>2022-08-17 20:12:37 +0800
commit54c52944d2454df1abcebd7e089bc67b6a1cad9d (patch)
tree80ef758ec123d4188903e29dcab44f5a2f475ce6 /common
parent2b31cad4ff4d0a86ee65cac173828efc956120f4 (diff)
remove comments to reduce rows
Diffstat (limited to 'common')
-rw-r--r--common/usb_dc.h57
-rw-r--r--common/usb_def.h2
-rw-r--r--common/usb_hc.h34
-rw-r--r--common/usb_util.h21
4 files changed, 28 insertions, 86 deletions
diff --git a/common/usb_dc.h b/common/usb_dc.h
index 0910283a..4caf8705 100644
--- a/common/usb_dc.h
+++ b/common/usb_dc.h
@@ -35,35 +35,20 @@ extern "C" {
* Structure containing the USB endpoint configuration.
*/
struct usbd_endpoint_cfg {
- /** The number associated with the EP in the device
- * configuration structure
- * IN EP = 0x80 | \<endpoint number\>
- * OUT EP = 0x00 | \<endpoint number\>
- */
- uint8_t ep_addr;
- /** Endpoint Transfer Type.
- * May be Bulk, Interrupt, Control or Isochronous
- */
- uint8_t ep_type;
- /** Endpoint max packet size */
- uint16_t ep_mps;
+ uint8_t ep_addr; /* Endpoint addr with direction */
+ uint8_t ep_type; /* Endpoint type */
+ uint16_t ep_mps; /* Endpoint max packet size */
};
/**
- * @brief USB Device Core Layer API
- * @defgroup _usb_device_core_api USB Device Core API
- * @{
- */
-
-/**
* @brief init device controller registers.
- * @return 0 on success, negative errno code on fail.
+ * @return On success will return 0, and others indicate fail.
*/
int usb_dc_init(void);
/**
* @brief deinit device controller registers.
- * @return 0 on success, negative errno code on fail.
+ * @return On success will return 0, and others indicate fail.
*/
int usb_dc_deinit(void);
@@ -72,43 +57,35 @@ int usb_dc_deinit(void);
*
* @param[in] addr Device address
*
- * @return 0 on success, negative errno code on fail.
+ * @return On success will return 0, and others indicate fail.
*/
int usbd_set_address(const uint8_t addr);
/**
* @brief configure and enable endpoint.
*
- * This function sets endpoint configuration according to one specified in USB.
- * endpoint descriptor and then enables it for data transfers.
- *
- * @param [in] ep_desc Endpoint descriptor byte array.
+ * @param [in] ep_cfg Endpoint config.
*
- * @return true if successfully configured and enabled.
+ * @return On success will return 0, and others indicate fail.
*/
int usbd_ep_open(const struct usbd_endpoint_cfg *ep_cfg);
/**
* @brief Disable the selected endpoint
*
- * Function to disable the selected endpoint. Upon success interrupts are
- * disabled for the corresponding endpoint and the endpoint is no longer able
- * for transmitting/receiving data.
- *
- * @param[in] ep Endpoint address corresponding to the one
- * listed in the device configuration table
+ * @param[in] ep Endpoint address
*
- * @return 0 on success, negative errno code on fail.
+ * @return On success will return 0, and others indicate fail.
*/
int usbd_ep_close(const uint8_t ep);
/**
* @brief Set stall condition for the selected endpoint
*
- * @param[in] ep Endpoint address corresponding to the one
- * listed in the device configuration table
+ * @param[in] ep Endpoint address
*
- * @return 0 on success, negative errno code on fail.
+ *
+ * @return On success will return 0, and others indicate fail.
*/
int usbd_ep_set_stall(const uint8_t ep);
@@ -118,18 +95,18 @@ int usbd_ep_set_stall(const uint8_t ep);
* @param[in] ep Endpoint address corresponding to the one
* listed in the device configuration table
*
- * @return 0 on success, negative errno code on fail.
+ * @return On success will return 0, and others indicate fail.
*/
int usbd_ep_clear_stall(const uint8_t ep);
/**
* @brief Check if the selected endpoint is stalled
*
- * @param[in] ep Endpoint address corresponding to the one
- * listed in the device configuration table
+ * @param[in] ep Endpoint address
+ *
* @param[out] stalled Endpoint stall status
*
- * @return 0 on success, negative errno code on fail.
+ * @return On success will return 0, and others indicate fail.
*/
int usbd_ep_is_stalled(const uint8_t ep, uint8_t *stalled);
diff --git a/common/usb_def.h b/common/usb_def.h
index 043eadaa..c4042733 100644
--- a/common/usb_def.h
+++ b/common/usb_def.h
@@ -46,7 +46,7 @@
/**< maximum packet size (MPS) for EP 0 */
#define USB_CTRL_EP_MPS 64
-// USB PID Types
+/* USB PID Types */
#define USB_PID_OUT (0x01) /* Tokens */
#define USB_PID_IN (0x09)
#define USB_PID_SOF (0x05)
diff --git a/common/usb_hc.h b/common/usb_hc.h
index 78575388..5896387d 100644
--- a/common/usb_hc.h
+++ b/common/usb_hc.h
@@ -31,6 +31,7 @@ extern "C" {
typedef void (*usbh_asynch_callback_t)(void *arg, int nbytes);
typedef void *usbh_epinfo_t;
+
/**
* @brief USB Endpoint Configuration.
*
@@ -38,38 +39,24 @@ typedef void *usbh_epinfo_t;
*/
struct usbh_endpoint_cfg {
struct usbh_hubport *hport;
- /** The number associated with the EP in the device
- * configuration structure
- * IN EP = 0x80 | \<endpoint number\>
- * OUT EP = 0x00 | \<endpoint number\>
- */
- uint8_t ep_addr;
- /** Endpoint Transfer Type.
- * May be Bulk, Interrupt, Control or Isochronous
- */
- uint8_t ep_type;
- uint8_t ep_interval;
- /** Endpoint max packet size */
- uint16_t ep_mps;
+ uint8_t ep_addr; /* Endpoint addr with direction */
+ uint8_t ep_type; /* Endpoint type */
+ uint16_t ep_mps; /* Endpoint max packet size */
+ uint8_t ep_interval; /* Endpoint interval */
+ uint16_t ep_mps; /* Endpoint max packet size */
};
/**
- * @brief USB Host Core Layer API
- * @defgroup _usb_host_core_api USB Host Core API
- * @{
- */
-
-/**
* @brief usb host software init, used for global reset.
*
- * @return int
+ * @return On success will return 0, and others indicate fail.
*/
int usb_hc_sw_init(void);
/**
* @brief usb host controller hardware init.
*
- * @return int
+ * @return On success will return 0, and others indicate fail.
*/
int usb_hc_hw_init(void);
@@ -77,8 +64,7 @@ int usb_hc_hw_init(void);
* @brief get port connect status
*
* @param port
- * @return true
- * @return false
+ * @return On success will return 0, and others indicate fail.
*/
bool usbh_get_port_connect_status(const uint8_t port);
@@ -86,7 +72,7 @@ bool usbh_get_port_connect_status(const uint8_t port);
* @brief reset roothub port
*
* @param port port index
- * @return int
+ * @return On success will return 0, and others indicate fail.
*/
int usbh_reset_port(const uint8_t port);
diff --git a/common/usb_util.h b/common/usb_util.h
index 4a7fbb83..cef8915a 100644
--- a/common/usb_util.h
+++ b/common/usb_util.h
@@ -138,23 +138,11 @@
#define HI_BYTE(x) ((uint8_t)((x & 0xFF00) >> 8))
#endif
-/**
- * @def MAX
- * @brief The larger value between @p a and @p b.
- * @note Arguments are evaluated twice.
- */
#ifndef MAX
-/* Use Z_MAX for a GCC-only, single evaluation version */
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
-/**
- * @def MIN
- * @brief The smaller value between @p a and @p b.
- * @note Arguments are evaluated twice.
- */
#ifndef MIN
-/* Use Z_MIN for a GCC-only, single evaluation version */
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
@@ -208,13 +196,6 @@
(field)[3] = (uint8_t)((value) >> 0); \
} while (0)
-#define REQTYPE_GET_DIR(x) (((x) >> 7) & 0x01)
-#define REQTYPE_GET_TYPE(x) (((x) >> 5) & 0x03U)
-#define REQTYPE_GET_RECIP(x) ((x)&0x1F)
-
-#define GET_DESC_TYPE(x) (((x) >> 8) & 0xFFU)
-#define GET_DESC_INDEX(x) ((x)&0xFFU)
-
#define WBVAL(x) (x & 0xFF), ((x >> 8) & 0xFF)
#define DBVAL(x) (x & 0xFF), ((x >> 8) & 0xFF), ((x >> 16) & 0xFF), ((x >> 24) & 0xFF)
@@ -239,6 +220,4 @@
19, 18, 17, 16, 15, 14, 13, 12, 11, 10, \
9, 8, 7, 6, 5, 4, 3, 2, 1, 0
-#define USB_DESC_SECTION __attribute__((section("usb_desc"))) __USED __ALIGNED(1)
-
#endif