Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -Burp src/usb.c usbmod/usb.c
- --- src/usb.c 2015-09-01 12:33:27.691869900 +0200
- +++ usbmod/usb.c 2015-09-02 14:51:54.694726800 +0200
- @@ -285,8 +285,10 @@ void USBDevEndpointStall(uint32 ulBase,
- (usEndpoint == USB_EP_12) || (usEndpoint == USB_EP_13) ||
- (usEndpoint == USB_EP_14) || (usEndpoint == USB_EP_15));
- + usEndpoint = usEndpoint >> 4;
- +
- /*SAFETYMCUSW 184 S <INSPECTED> "Reason - LDRA tool issue."*/
- - USBD_REG_SET_ONE(usbd0Regs->epnum, (USBD_EP_NUM_EP_SEL | usFlags)); /* Select EP */
- + USBD_REG_SET_ONE(usbd0Regs->epnum, (USBD_EP_NUM_EP_SEL | (usEndpoint & USBD_EP_NUM_EP_NUM_MASK) | usFlags)); /* Select EP */
- /*SAFETYMCUSW 184 S <INSPECTED> "Reason - LDRA tool issue."*/
- USBD_REG_SET_ONE(usbd0Regs->ctrl, USBD_CTRL_SET_HALT); /* halt the selected EP */
- @@ -296,6 +298,8 @@ void USBDevEndpointStall(uint32 ulBase,
- /*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Statically defined non-null hardware register address" */
- USBD_REG_BIT_CLR(usbd0Regs->epnum, USBD_EP_NUM_EP_SEL); /* Deselct EP */
- + usEndpoint = usEndpoint << 4;
- +
- return;
- }
- @@ -333,15 +337,19 @@ void USBDevEndpointStallClear(uint32 ulB
- (usEndpoint == USB_EP_14) || (usEndpoint == USB_EP_15));
- ASSERT((usFlags & ~(USB_EP_DEV_IN | USB_EP_DEV_OUT)) == 0);
- + usEndpoint = usEndpoint >> 4;
- +
- /* Select the specified endpoint and clear the stall */
- /*SAFETYMCUSW 184 S <INSPECTED> "Reason - LDRA tool issue."*/
- - USBD_REG_SET_ONE(usbd0Regs->epnum, (USBD_EP_NUM_EP_SEL | usFlags));
- + USBD_REG_SET_ONE(usbd0Regs->epnum, (USBD_EP_NUM_EP_SEL | (usEndpoint & USBD_EP_NUM_EP_NUM_MASK) | usFlags));
- /*SAFETYMCUSW 184 S <INSPECTED> "Reason - LDRA tool issue."*/
- USBD_REG_BIT_SET(usbd0Regs->ctrl, USBD_CTRL_CLR_HALT);
- /*SAFETYMCUSW 184 S <INSPECTED> "Reason - LDRA tool issue."*/
- /*SAFETYMCUSW 185 S <INSPECTED> "Reason - LDRA tool issue."*/
- /*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Statically defined non-null hardware register address" */
- USBD_REG_BIT_CLR(usbd0Regs->epnum, USBD_EP_NUM_EP_SEL);
- +
- + usEndpoint = usEndpoint << 4;
- }
- /** ***************************************************************************
- @@ -454,7 +462,7 @@ uint16 USBEndpointDataAvail(uint32 ulBas
- /* Setup the epnum register. Note that it's always OUT EP */
- /*SAFETYMCUSW 184 S <INSPECTED> "Reason - LDRA tool issue."*/
- - USBD_REG_SET_ONE(usbd0Regs->epnum, (USBD_EP_NUM_EP_SEL | usEndpoint | USBD_EP_DIR_OUT));
- + USBD_REG_SET_ONE(usbd0Regs->epnum, (USBD_EP_NUM_EP_SEL | (usEndpoint & USBD_EP_NUM_EP_NUM_MASK) | USBD_EP_DIR_OUT));
- /* Read the count from the RXFstat register */
- retVal = usbd0Regs->rxf_stat & USBD_RXFSTAT_RXF_COUNT;
- @@ -536,13 +544,9 @@ sint32 USBEndpointDataGet(uint32 ulBase,
- pucData[i] = *((volatile uint8 *)(&usbd0Regs->data));
- }
- - /* Restore the epnym register */
- + /* Restore the epnum register */
- usbd0Regs->epnum = usEpNum;
- - /* setup to receive data on ep */
- - /*SAFETYMCUSW 184 S <INSPECTED> "Reason - LDRA tool issue."*/
- - USBD_REG_SET_ONE(usbd0Regs->ctrl, USBD_CTRL_SET_FIFO_EN);
- -
- usEndpoint = usEndpoint << 4;
- return(0);
- @@ -574,7 +578,7 @@ void USBDevGetSetupPacket (uint32 ulBase
- /*SAFETYMCUSW 94 S MR:11.4 <INSPECTED> "Reason - Acceptable deviation."*/
- pSetupFifo = (volatile uint8 *)(&usbd0Regs->data);
- - /* Select the setup IFO. This will clear the event flag */
- + /* Select the setup FIFO. This will clear the event flag */
- usbd0Regs->epnum = USBD_EP_NUM_SETUP_SEL;
- /* Extract the setup packet */
- @@ -651,11 +655,10 @@ void USBDevEndpointDataAck(uint32 ulBase
- /* backup the EP number to restore later */
- epNum = usbd0Regs->epnum & USBD_EP_NUM_EP_NUM_MASK;
- - /* Select the endpoint, (Always read (in) endpoint) */
- - usbd0Regs->epnum = USBD_EP_DIR_OUT | USBD_EP_NUM_EP_SEL | (usEndpoint & USBD_EP_NUM_EP_NUM_MASK);
- + usEndpoint = usEndpoint >> 4;
- /*SAFETYMCUSW 184 S <INSPECTED> "Reason - LDRA tool issue."*/
- - USBD_REG_SET_ONE(usbd0Regs->epnum, (USBD_EP_NUM_EP_SEL | usEndpoint | USBD_EP_DIR_OUT));
- + USBD_REG_SET_ONE(usbd0Regs->epnum, (USBD_EP_NUM_EP_SEL | (usEndpoint & USBD_EP_NUM_EP_NUM_MASK) | USBD_EP_DIR_OUT));
- /* Clear endpoint */
- /*SAFETYMCUSW 184 S <INSPECTED> "Reason - LDRA tool issue."*/
- USBD_REG_SET_ONE(usbd0Regs->ctrl, USBD_CTRL_CLR_EP);
- @@ -667,10 +670,12 @@ void USBDevEndpointDataAck(uint32 ulBase
- /*SAFETYMCUSW 185 S <INSPECTED> "Reason - LDRA tool issue."*/
- USBD_REG_BIT_CLR(usbd0Regs->epnum, USBD_EP_NUM_EP_SEL);
- - /* Restore the epnym register */
- + /* Restore the epnum register */
- /*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Statically defined non-null hardware register address" */
- usbd0Regs->epnum = epNum;
- + usEndpoint = usEndpoint << 4;
- +
- return;
- }
- diff -Burp src/usbdcdc.c usbmod/usbdcdc.c
- --- src/usbdcdc.c 2015-09-01 12:33:27.680868800 +0200
- +++ usbmod/usbdcdc.c 2015-09-02 14:32:47.055080400 +0200
- @@ -1335,8 +1335,15 @@ ProcessDataToHost(const tUSBDCDCDevice *
- */
- txSize = (uint32)psInst->usLastTxSize;
- psInst->usLastTxSize = 0u;
- - psDevice->pfnTxCallback(psDevice->pvTxCBData, USB_EVENT_TX_COMPLETE,
- - txSize, (void *)0);
- + if (txSize == DATA_OUT_EP_MAX_SIZE)
- + {
- + USBDCDCPacketWrite((void *)psDevice, 0, 0, TRUE);
- + }
- + else
- + {
- + psDevice->pfnTxCallback(psDevice->pvTxCBData, USB_EVENT_TX_COMPLETE,
- + txSize, (void *)0);
- + }
- return (TRUE);
- }
- diff -Burp src/usbdconfig.c usbmod/usbdconfig.c
- --- src/usbdconfig.c 2015-09-01 12:33:27.684869200 +0200
- +++ usbmod/usbdconfig.c 2015-09-02 14:22:13.702854800 +0200
- @@ -545,8 +545,8 @@ USBDeviceConfig(uint32 ulIndex, const tC
- USBDevCfgLock(USBD_0_BASE);
- /* Send a zero packet */
- - USBEndpointDataPut(USBD_0_BASE, 0u, 0, 0u);
- - USBEndpointDataSend(USBD_0_BASE, 0u, (uint32)USBD_EP_DIR_IN);
- + USBEndpointDataPut(USBD_0_BASE, USB_EP_0, 0, 0u);
- + USBEndpointDataSend(USBD_0_BASE, USB_EP_0, (uint32)USBD_EP_DIR_IN);
- /*
- * If we get to the end, all is well.
- diff -Burp src/usbdenum.c usbmod/usbdenum.c
- --- src/usbdenum.c 2015-09-01 12:33:27.687869500 +0200
- +++ usbmod/usbdenum.c 2015-09-02 14:24:42.441362100 +0200
- @@ -1939,6 +1939,8 @@ USBDGetDescriptor(void * pvInstance, tUS
- if(lIndex == -1)
- {
- USBDCDStallEP0(0u);
- + psUSBControl->pEP0Data = 0u;
- + psUSBControl->ulEP0DataRemain = 0u;
- break;
- }
- @@ -1985,6 +1987,8 @@ USBDGetDescriptor(void * pvInstance, tUS
- * just stall the request.
- */
- USBDCDStallEP0(0u);
- + psUSBControl->pEP0Data = 0u;
- + psUSBControl->ulEP0DataRemain = 0u;
- }
- break;
- }
- @@ -3026,7 +3030,7 @@ USBDeviceIntHandlerInternal(uint32 uInde
- USBDIntHandlerSof(USBD_0_BASE);
- }
- - USBIntEnable(USBD_0_BASE, (uint16)0xB9u);
- + USBIntEnable(USBD_0_BASE, USBD_INT_EN_ALL);
- USBIntStatusClear(uIrqSrc);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement