X-Git-Url: http://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/bb58af2076c30e41d353ec193deddf54f6c3b8e8..d537298fdd7d39e4cb0e74e8e6d227245d638afe:/core/usbcdc/usbcore.c diff --git a/core/usbcdc/usbcore.c b/core/usbcdc/usbcore.c index fe09bbd..fe33aba 100644 --- a/core/usbcdc/usbcore.c +++ b/core/usbcdc/usbcore.c @@ -169,7 +169,6 @@ void USB_StatusOutStage (void) { static inline uint32_t USB_ReqGetStatus (void) { uint32_t n, m; - uint16_t* ep0 = (uint16_t __attribute__((packed)) *)EP0Buf; switch (SetupPacket.bmRequestType.BM.Recipient) { case REQUEST_TO_DEVICE: @@ -177,7 +176,7 @@ static inline uint32_t USB_ReqGetStatus (void) { break; case REQUEST_TO_INTERFACE: if ((USB_Configuration != 0) && (SetupPacket.wIndex.WB.L < USB_NumInterfaces)) { - *ep0 = 0; + *((uint16_t __attribute__((packed)) *)EP0Buf) = 0; EP0Data.pData = EP0Buf; } else { return (FALSE); @@ -187,7 +186,7 @@ static inline uint32_t USB_ReqGetStatus (void) { n = SetupPacket.wIndex.WB.L & 0x8F; m = (n & 0x80) ? ((1 << 16) << (n & 0x0F)) : (1 << n); if (((USB_Configuration != 0) || ((n & 0x0F) == 0)) && (USB_EndPointMask & m)) { - *ep0 = (USB_EndPointHalt & m) ? 1 : 0; + *((uint16_t __attribute__((packed)) *)EP0Buf) = (USB_EndPointHalt & m) ? 1 : 0; EP0Data.pData = EP0Buf; } else { return (FALSE); @@ -364,6 +363,7 @@ static inline uint32_t USB_ReqGetDescriptor (void) { return (TRUE); } + /* * Get Configuration USB Request * Parameters: None (global SetupPacket) @@ -376,6 +376,7 @@ static inline uint32_t USB_ReqGetConfiguration (void) { case REQUEST_TO_DEVICE: // Added cast to avoid warnings due to USB_Configuration being volatile (KTownsend) EP0Data.pData = (uint8_t *)&USB_Configuration; + //EP0Data.pData = &USB_Configuration; break; default: return (FALSE); @@ -562,6 +563,7 @@ static inline uint32_t USB_ReqSetInterface (void) { return (set); } + /* * USB Endpoint 0 Event Callback * Parameters: event