summaryrefslogtreecommitdiff
path: root/usb
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2012-09-22 16:08:41 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2012-09-22 16:08:41 +0200
commit859317842837095a406a0ff7866091c012e1923e (patch)
treecd1ad52ddd976bf4679db0c7d388b93b7da5e483 /usb
parent0ca572bc7a0fbe26b216cab519d89187ae49a28b (diff)
Use strongly typed enumeration for EPType to avoid name conflicts.
Diffstat (limited to 'usb')
-rw-r--r--usb/dwc_otg.h2
-rw-r--r--usb/f1_usb.h2
-rw-r--r--usb/generic.h4
3 files changed, 4 insertions, 4 deletions
diff --git a/usb/dwc_otg.h b/usb/dwc_otg.h
index 673d418..ccfaf03 100644
--- a/usb/dwc_otg.h
+++ b/usb/dwc_otg.h
@@ -73,7 +73,7 @@ class USB_otg : public USB_generic {
uint8_t in = ep & 0x80;
ep &= 0x7f;
- uint32_t epctl = ((type == Control ? 0 : type == Isochronous ? 1 : type == Bulk ? 2 : 3) << 18);
+ uint32_t epctl = ((type == EPType::Control ? 0 : type == EPType::Isochronous ? 1 : type == EPType::Bulk ? 2 : 3) << 18);
epctl |= (1 << 31) | (1 << 28) | (1 << 15) | (ep == 0 ? 64 : size); // EPENA, USBAEP, SD0PID
if(ep == 0) {
diff --git a/usb/f1_usb.h b/usb/f1_usb.h
index f59ccab..166c051 100644
--- a/usb/f1_usb.h
+++ b/usb/f1_usb.h
@@ -30,7 +30,7 @@ class USB_f1 : public USB_generic {
uint32_t old_epr = usb.reg.EPR[ep];
//uint32_t new_epr = 0x3220;
- uint32_t new_epr = 0x8080 | ((type == Bulk ? 0 : type == Control ? 1 : type == Isochronous ? 2 : 3) << 9) | ep;
+ uint32_t new_epr = 0x8080 | ((type == EPType::Bulk ? 0 : type == EPType::Control ? 1 : type == EPType::Isochronous ? 2 : 3) << 9) | ep;
if(in || ep == 0) {
usb.bufd[ep].ADDR_TX = buf_end;
diff --git a/usb/generic.h b/usb/generic.h
index 87fe089..8c9a965 100644
--- a/usb/generic.h
+++ b/usb/generic.h
@@ -13,7 +13,7 @@ struct desc_t {
};
enum SetupStatus {Unhandled, Ok, Stall};
-enum EPType {Control, Bulk, Interrupt, Isochronous};
+enum class EPType {Control, Bulk, Interrupt, Isochronous};
class USB_class_driver {
friend class USB_generic;
@@ -139,7 +139,7 @@ class USB_generic {
void handle_reset() {
current_configuration = 0;
- hw_conf_ep(0, Control, 64);
+ hw_conf_ep(0, EPType::Control, 64);
}
void handle_setup(const uint32_t* bufp) {