1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-10 15:30:55 +00:00

trezorhal: formatting nits in usb

This commit is contained in:
Pavol Rusnak 2018-01-23 01:34:47 +01:00
parent 11a5825928
commit 919e2b9c3b
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
6 changed files with 49 additions and 49 deletions

View File

@ -11,9 +11,9 @@
#include <stdint.h>
#include "secbool.h"
#define USB_EP_DIR_MASK 0x80
#define USB_EP_DIR_OUT 0x00
#define USB_EP_DIR_IN 0x80
#define USB_EP_DIR_MSK 0x80
typedef struct __attribute__((packed)) {
uint8_t bLength;

View File

@ -34,10 +34,10 @@ secbool usb_hid_add(const usb_hid_info_t *info) {
return secfalse; // Not enough space in the configuration descriptor
}
if ((info->ep_in & USB_EP_DIR_MSK) != USB_EP_DIR_IN) {
if ((info->ep_in & USB_EP_DIR_MASK) != USB_EP_DIR_IN) {
return secfalse; // IN EP is invalid
}
if ((info->ep_out & USB_EP_DIR_MSK) != USB_EP_DIR_OUT) {
if ((info->ep_out & USB_EP_DIR_MASK) != USB_EP_DIR_OUT) {
return secfalse; // OUT EP is invalid
}
if (info->rx_buffer == NULL) {

View File

@ -29,8 +29,8 @@
// Data Phase Transfer Direction (bmRequest)
#define USB_REQ_DIR_MASK 0x80
#define USB_H2D 0x00
#define USB_D2H 0x80
#define USB_REQ_DIR_H2D 0x00
#define USB_REQ_DIR_D2H 0x80
// Class-Specific Request Codes for PSTN subclasses
#define USB_CDC_SET_LINE_CODING 0x20
@ -59,13 +59,13 @@ secbool usb_vcp_add(const usb_vcp_info_t *info) {
return secfalse; // Not enough space in the configuration descriptor
}
if ((info->ep_cmd & USB_EP_DIR_MSK) != USB_EP_DIR_IN) {
if ((info->ep_cmd & USB_EP_DIR_MASK) != USB_EP_DIR_IN) {
return secfalse; // IN CMD EP is invalid
}
if ((info->ep_in & USB_EP_DIR_MSK) != USB_EP_DIR_IN) {
if ((info->ep_in & USB_EP_DIR_MASK) != USB_EP_DIR_IN) {
return secfalse; // IN EP is invalid
}
if ((info->ep_out & USB_EP_DIR_MSK) != USB_EP_DIR_OUT) {
if ((info->ep_out & USB_EP_DIR_MASK) != USB_EP_DIR_OUT) {
return secfalse; // OUT EP is invalid
}
if ((info->rx_buffer_len == 0) || (info->rx_buffer_len & (info->rx_buffer_len - 1)) != 0) {
@ -357,7 +357,7 @@ static int usb_vcp_class_setup(USBD_HandleTypeDef *dev, usb_vcp_state_t *state,
}
switch (req->bmRequest & USB_REQ_DIR_MASK) {
case USB_D2H:
case USB_REQ_DIR_D2H:
switch (req->bRequest) {
case USB_CDC_GET_LINE_CODING:
USBD_CtlSendData(dev, UNCONST(&line_coding), MIN(req->wLength, sizeof(line_coding)));
@ -367,7 +367,7 @@ static int usb_vcp_class_setup(USBD_HandleTypeDef *dev, usb_vcp_state_t *state,
break;
}
break;
case USB_H2D:
case USB_REQ_DIR_H2D:
if (req->wLength > 0) {
USBD_CtlPrepareRx(dev, cmd_buffer, MIN(req->wLength, sizeof(cmd_buffer)));
}

View File

@ -36,10 +36,10 @@ secbool usb_webusb_add(const usb_webusb_info_t *info) {
return secfalse; // Not enough space in the configuration descriptor
}
if ((info->ep_in & USB_EP_DIR_MSK) != USB_EP_DIR_IN) {
if ((info->ep_in & USB_EP_DIR_MASK) != USB_EP_DIR_IN) {
return secfalse; // IN EP is invalid
}
if ((info->ep_out & USB_EP_DIR_MSK) != USB_EP_DIR_OUT) {
if ((info->ep_out & USB_EP_DIR_MASK) != USB_EP_DIR_OUT) {
return secfalse; // OUT EP is invalid
}
if (info->rx_buffer == NULL) {