From 859317842837095a406a0ff7866091c012e1923e Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sat, 22 Sep 2012 16:08:41 +0200 Subject: Use strongly typed enumeration for EPType to avoid name conflicts. --- usb/dwc_otg.h | 2 +- usb/f1_usb.h | 2 +- usb/generic.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'usb') 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) { -- cgit v1.2.3