diff --git a/__app_test_mode/src/main.xc b/__app_test_mode/src/main.xc index 5e9f4cdc..3e7627a3 100644 --- a/__app_test_mode/src/main.xc +++ b/__app_test_mode/src/main.xc @@ -9,7 +9,7 @@ XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL}; XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL}; - + int main() { chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; diff --git a/examples/AN00124_CDC_VCOM_class/src/main.xc b/examples/AN00124_CDC_VCOM_class/src/main.xc index f6730f25..2955bb63 100644 --- a/examples/AN00124_CDC_VCOM_class/src/main.xc +++ b/examples/AN00124_CDC_VCOM_class/src/main.xc @@ -17,9 +17,9 @@ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABL XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, XUD_EPTYPE_INT, XUD_EPTYPE_BUL}; /* Application task */ -void app_virtual_com(client interface usb_cdc_interface cdc) +void app_virtual_com(client interface usb_cdc_interface cdc) { - while (1) + while (1) { char cdc_char = cdc.get_char(); cdc.put_char(cdc_char); @@ -28,7 +28,7 @@ void app_virtual_com(client interface usb_cdc_interface cdc) } } -int main() +int main() { /* Channels to communicate with USB endpoints */ chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; @@ -39,7 +39,7 @@ int main() par { on USB_TILE: XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, + null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); on USB_TILE: Endpoint0(c_ep_out[0], c_ep_in[0]); diff --git a/examples/AN00125_mass_storage_class/src/main.xc b/examples/AN00125_mass_storage_class/src/main.xc index c4e425f3..08358cab 100644 --- a/examples/AN00125_mass_storage_class/src/main.xc +++ b/examples/AN00125_mass_storage_class/src/main.xc @@ -35,7 +35,7 @@ int main() par { on USB_TILE: XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, + null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); on USB_TILE: Endpoint0(c_ep_out[0], c_ep_in[0]); diff --git a/examples/AN00125_mass_storage_class/src/mass_storage.xc b/examples/AN00125_mass_storage_class/src/mass_storage.xc index eb886aab..f28060c8 100644 --- a/examples/AN00125_mass_storage_class/src/mass_storage.xc +++ b/examples/AN00125_mass_storage_class/src/mass_storage.xc @@ -13,108 +13,108 @@ #include "flashlib.h" on tile[0]: fl_SPIPorts spiPort = { - XS1_PORT_1A, - XS1_PORT_1B, - XS1_PORT_1C, - XS1_PORT_1D, - XS1_CLKBLK_1 + XS1_PORT_1A, + XS1_PORT_1B, + XS1_PORT_1C, + XS1_PORT_1D, + XS1_CLKBLK_1 }; -fl_DeviceSpec flashSpec[1] = {FL_DEVICE_NUMONYX_M25P16}; // Equivalent of Micron M25P16 - -int pagesPerBlock_g = 0; -int bytesPerPage_g = 0; -unsigned char pageBuffer_g[MASS_STORAGE_BLOCKLENGTH]; - -void massStorageInit() { - fl_connectToDevice(spiPort, flashSpec, 1); - fl_setBootPartitionSize(FLASH_PARTITION_SIZE); - bytesPerPage_g = fl_getPageSize(); - pagesPerBlock_g = (MASS_STORAGE_BLOCKLENGTH / bytesPerPage_g); -} - -int massStorageWrite(unsigned int blockNr, unsigned char buffer[]) { - for(int i = 0; i < pagesPerBlock_g; i++) { - for(int j = 0; j < bytesPerPage_g; j++) { - pageBuffer_g[j] = buffer[i * bytesPerPage_g + j]; - } - fl_writeDataPage(blockNr * pagesPerBlock_g + i, buffer); - } - return 0; -} - -int massStorageRead(unsigned int blockNr, unsigned char buffer[]) { - for(int i = 0; i < pagesPerBlock_g; i++) { - fl_readDataPage(blockNr * pagesPerBlock_g + i, pageBuffer_g); - for(int j = 0; j < bytesPerPage_g; j++) { - buffer[i * bytesPerPage_g + j] = pageBuffer_g[j]; - } - } - return 0; -} - -int massStorageSize() { -#if DETECT_AS_FLOPPY - return FLOPPY_DISK_SIZE; -#else - int x = fl_getNumDataPages(); - return x / pagesPerBlock_g; -#endif -} -//Flash_Functions_end -static unsigned char inquiryAnswer[36] = { - 0x00, // Peripheral Device Type (PDT) - SBC Direct-access device - 0x80, // Removable Medium Bit is Set - 0x02, // Version - 0x02, // Obsolete[7:6],NORMACA[5],HISUP[4],Response Data Format[3:0] - 0x1f, // Additional Length - 0x73, // SCCS[7],ACC[6],TPGS[5:4],3PC[3],Reserved[2:1],PROTECT[0] - 0x6d, // BQUE[7],ENCSERV[6],VS[5],MULTIP[4],MCHNGR[3],Obsolete[2:1],ADDR16[0] - 0x69, // Obsolete[7:6],WBUS116[5],SYNC[4],LINKED[3],Obsolete[2],CMDQUE[1],VS[0] - 'X', 'M', 'O', 'S', 'L', 'T', 'D', 0, // Vendor Identification - 'F', 'l', 'a', 's', 'h', ' ', 'D', 'i', 's', 'k', 0, ' ', ' ', ' ', ' ', ' ', // Product Identification - '0', '.', '1', '0' // Product Revision Level -}; - -static unsigned char modeSenseAnswer[4] = { - 0x04, 0x00, 0x10, 0x00 -}; - -//Reference: http://www.usb.org/developers/docs/devclass_docs/usb_msc_boot_1.0.pdf -static unsigned char requestSenseAnswer[18] = { - 0x70, // Error Code - 0x00, // Segment Number (Reserved) - 0x02, // ILI, Sense Key - 0x00, 0x00, 0x00, 0x00, // Information - 0x0A, // Additional Sense Length (n-7), i.e. 17-7 - 0x00, 0x00, 0x00, 0x00, // Command Specific Information - 0x3A, // Additional Sense Code - 0x00, // Additional Sense Qualifier (optional) - 0x00, 0x00, 0x00, 0x00 // Reserved -}; - -static unsigned char blockBuffer[MASS_STORAGE_BLOCKLENGTH]; - -/* This function receives the mass storage endpoint transfers from the host */ -void massStorageClass(chanend chan_ep1_out,chanend chan_ep1_in, int writeProtect) -{ - unsigned char commandBlock[CBW_SHORT_PACKET_SIZE]; - unsigned char commandStatus[CSW_SHORT_PACKET_SIZE]; - unsigned host_transfer_length = 0; - int readCapacity[8]; - int readLength, readAddress; - int dCBWSignature = 0, bCBWDataTransferLength = 0; - int bmCBWFlags = 0, bCBWLUN = 0, bCBWCBLength = 0; - int Operation_Code = 0; - XUD_Result_t result; - int ready = 1; - - debug_printf("USB Mass Storage class demo started\n"); - - /* Load some default CSW to reduce response time delay */ - memset(commandStatus,0,CSW_SHORT_PACKET_SIZE); - /* Signature helps identify this data packet as a CSW */ - (commandStatus, int[])[0] = byterev(CSW_SIGNATURE); +fl_DeviceSpec flashSpec[1] = {FL_DEVICE_NUMONYX_M25P16}; // Equivalent of Micron M25P16 + +int pagesPerBlock_g = 0; +int bytesPerPage_g = 0; +unsigned char pageBuffer_g[MASS_STORAGE_BLOCKLENGTH]; + +void massStorageInit() { + fl_connectToDevice(spiPort, flashSpec, 1); + fl_setBootPartitionSize(FLASH_PARTITION_SIZE); + bytesPerPage_g = fl_getPageSize(); + pagesPerBlock_g = (MASS_STORAGE_BLOCKLENGTH / bytesPerPage_g); +} + +int massStorageWrite(unsigned int blockNr, unsigned char buffer[]) { + for(int i = 0; i < pagesPerBlock_g; i++) { + for(int j = 0; j < bytesPerPage_g; j++) { + pageBuffer_g[j] = buffer[i * bytesPerPage_g + j]; + } + fl_writeDataPage(blockNr * pagesPerBlock_g + i, buffer); + } + return 0; +} + +int massStorageRead(unsigned int blockNr, unsigned char buffer[]) { + for(int i = 0; i < pagesPerBlock_g; i++) { + fl_readDataPage(blockNr * pagesPerBlock_g + i, pageBuffer_g); + for(int j = 0; j < bytesPerPage_g; j++) { + buffer[i * bytesPerPage_g + j] = pageBuffer_g[j]; + } + } + return 0; +} + +int massStorageSize() { +#if DETECT_AS_FLOPPY + return FLOPPY_DISK_SIZE; +#else + int x = fl_getNumDataPages(); + return x / pagesPerBlock_g; +#endif +} +//Flash_Functions_end +static unsigned char inquiryAnswer[36] = { + 0x00, // Peripheral Device Type (PDT) - SBC Direct-access device + 0x80, // Removable Medium Bit is Set + 0x02, // Version + 0x02, // Obsolete[7:6],NORMACA[5],HISUP[4],Response Data Format[3:0] + 0x1f, // Additional Length + 0x73, // SCCS[7],ACC[6],TPGS[5:4],3PC[3],Reserved[2:1],PROTECT[0] + 0x6d, // BQUE[7],ENCSERV[6],VS[5],MULTIP[4],MCHNGR[3],Obsolete[2:1],ADDR16[0] + 0x69, // Obsolete[7:6],WBUS116[5],SYNC[4],LINKED[3],Obsolete[2],CMDQUE[1],VS[0] + 'X', 'M', 'O', 'S', 'L', 'T', 'D', 0, // Vendor Identification + 'F', 'l', 'a', 's', 'h', ' ', 'D', 'i', 's', 'k', 0, ' ', ' ', ' ', ' ', ' ', // Product Identification + '0', '.', '1', '0' // Product Revision Level +}; + +static unsigned char modeSenseAnswer[4] = { + 0x04, 0x00, 0x10, 0x00 +}; + +//Reference: http://www.usb.org/developers/docs/devclass_docs/usb_msc_boot_1.0.pdf +static unsigned char requestSenseAnswer[18] = { + 0x70, // Error Code + 0x00, // Segment Number (Reserved) + 0x02, // ILI, Sense Key + 0x00, 0x00, 0x00, 0x00, // Information + 0x0A, // Additional Sense Length (n-7), i.e. 17-7 + 0x00, 0x00, 0x00, 0x00, // Command Specific Information + 0x3A, // Additional Sense Code + 0x00, // Additional Sense Qualifier (optional) + 0x00, 0x00, 0x00, 0x00 // Reserved +}; + +static unsigned char blockBuffer[MASS_STORAGE_BLOCKLENGTH]; + +/* This function receives the mass storage endpoint transfers from the host */ +void massStorageClass(chanend chan_ep1_out,chanend chan_ep1_in, int writeProtect) +{ + unsigned char commandBlock[CBW_SHORT_PACKET_SIZE]; + unsigned char commandStatus[CSW_SHORT_PACKET_SIZE]; + unsigned host_transfer_length = 0; + int readCapacity[8]; + int readLength, readAddress; + int dCBWSignature = 0, bCBWDataTransferLength = 0; + int bmCBWFlags = 0, bCBWLUN = 0, bCBWCBLength = 0; + int Operation_Code = 0; + XUD_Result_t result; + int ready = 1; + + debug_printf("USB Mass Storage class demo started\n"); + + /* Load some default CSW to reduce response time delay */ + memset(commandStatus,0,CSW_SHORT_PACKET_SIZE); + /* Signature helps identify this data packet as a CSW */ + (commandStatus, int[])[0] = byterev(CSW_SIGNATURE); /* Initialise the XUD endpoints */ XUD_ep ep1_out = XUD_InitEp(chan_ep1_out); @@ -127,124 +127,124 @@ void massStorageClass(chanend chan_ep1_out,chanend chan_ep1_in, int writeProtect while(1) { unsigned char bCSWStatus = CSW_STATUS_CMD_PASSED; - // Get Command Block Wrapper (CBW) - if(XUD_RES_OKAY == (result = XUD_GetBuffer(ep1_out, (commandBlock, char[CBW_SHORT_PACKET_SIZE]), host_transfer_length)) ) - { - /* The CBW shall start on a packet boundary and shall end as a short packet - * with exactly 31 (0x1F) bytes transferred - */ - assert(host_transfer_length == CBW_SHORT_PACKET_SIZE); - /* verify Signature - that helps identify this packet as a CBW */ - dCBWSignature = commandBlock[0] | commandBlock[1] << 8 | - commandBlock[2] << 16 | commandBlock[3] << 24; - assert(dCBWSignature == CBW_SIGNATURE); - - bCBWDataTransferLength = commandBlock[8] | commandBlock[9]<<8 | - commandBlock[10] << 16 | commandBlock[11] << 24; - - bmCBWFlags = commandBlock[12]; bCBWLUN = (commandBlock[13] & 0x0F); - assert(bCBWCBLength = (commandBlock[14] & 0x1F) <= 16); - Operation_Code = commandBlock[15]; - - switch(Operation_Code) - { - case TEST_UNIT_READY_CMD: // Test unit ready: - bCSWStatus = ready ? CSW_STATUS_CMD_PASSED : CSW_STATUS_CMD_FAILED; - break; - - case REQUEST_SENSE_CMD: // Request sense - requestSenseAnswer[2] = ready ? STATUS_GOOD : STATUS_CHECK_CONDITION; - result = XUD_SetBuffer(ep1_in, requestSenseAnswer, sizeof(requestSenseAnswer)); - break; - - case INQUIRY_CMD: // Inquiry - result = XUD_SetBuffer(ep1_in, inquiryAnswer, sizeof(inquiryAnswer)); - break; - - case START_STOP_CMD: // start/stop - ready = ((commandBlock[19] >> 1) & 1) == 0; - break; - - case MODE_SENSE_6_CMD: // Mode sense (6) - case MODE_SENSE_10_CMD: // Mode sense (10) // For Mac OSX - if (writeProtect) modeSenseAnswer[2] |= 0x80; - - result = XUD_SetBuffer(ep1_in, modeSenseAnswer, sizeof(modeSenseAnswer)); - break; - - - case MEDIUM_REMOVAL_CMD: // Medium removal - break; - - case RECEIVE_DIAGNOSTIC_RESULT_CMD: - memset(readCapacity,0x0000,sizeof(readCapacity)); - result = XUD_SetBuffer(ep1_in, (readCapacity, unsigned char[8]), 32); - break; - - case READ_FORMAT_CAPACITY_CMD: // Read Format capacity (UFI Command Spec) - readCapacity[0] = byterev(8); - readCapacity[1] = byterev(massStorageSize()); - readCapacity[2] = byterev(MASS_STORAGE_BLOCKLENGTH) | (DETECT_AS_FLOPPY ? NO_CARTRIDGE_IN_DRIVE : FORMATTED_MEDIA); - result = XUD_SetBuffer(ep1_in, (readCapacity, unsigned char[8]), 12); - break; - - case READ_CAPACITY_CMD: // Read capacity - readCapacity[0] = byterev(massStorageSize()-1); - readCapacity[1] = byterev(MASS_STORAGE_BLOCKLENGTH); - result = XUD_SetBuffer(ep1_in, (readCapacity, unsigned char[8]), 8); - break; - - case READ_CAPACITY_16_CMD: - memset(readCapacity,0x0000,sizeof(readCapacity)); - readCapacity[1] = byterev(massStorageSize()-1); - readCapacity[2] = byterev(MASS_STORAGE_BLOCKLENGTH); - result = XUD_SetBuffer(ep1_in, (readCapacity, unsigned char[8]), 32); - break; - - case READ_10_CMD: // Read (10) - readLength = commandBlock[22] << 8 | commandBlock[23]; - readAddress = commandBlock[17] << 24 | commandBlock[18] << 16 | - commandBlock[19] << 8 | commandBlock[20]; - for(int i = 0; i < readLength ; i++) { - bCSWStatus |= massStorageRead(readAddress, blockBuffer); - result = XUD_SetBuffer(ep1_in, blockBuffer, MASS_STORAGE_BLOCKLENGTH); - readAddress++; } - break; - - case WRITE_10_CMD: // Write - readLength = commandBlock[22] << 8 | commandBlock[23]; - readAddress = commandBlock[17] << 24 | commandBlock[18] << 16 | - commandBlock[19] << 8 | commandBlock[20]; - for(int i = 0; i < readLength ; i++) { - result = XUD_GetBuffer(ep1_out, (blockBuffer, char[128 * 4]),host_transfer_length); - bCSWStatus |= massStorageWrite(readAddress, blockBuffer); - readAddress++; } - break; - - default: - debug_printf("Invalid Operation Code Received : 0x%x\n",Operation_Code); - bCSWStatus = CSW_STATUS_CMD_FAILED; - break; - } - } - - /* Check for result, if it is found as XUD_RES_RST, then reset Endpoints */ - if(result == XUD_RES_RST) { - XUD_ResetEndpoint(ep1_out,ep1_in); - break; - } - - /* Setup Command Status Wrapper (CSW). The CSW shall start on a packet boundry - * and shall end as a short packet with exactly 13 (0x0D) bytes transferred */ - /* The device shall echo the contents of dCBWTag back to the host in the dCSWTag */ - commandStatus[4] = commandBlock[4]; - commandStatus[5] = commandBlock[5]; - commandStatus[6] = commandBlock[6]; - commandStatus[7] = commandBlock[7]; - commandStatus[12] = bCSWStatus; - - if(XUD_RES_RST == XUD_SetBuffer(ep1_in, commandStatus, CSW_SHORT_PACKET_SIZE)) - XUD_ResetEndpoint(ep1_out,ep1_in); - - } //while(1) -} // END of massStorageClass + // Get Command Block Wrapper (CBW) + if(XUD_RES_OKAY == (result = XUD_GetBuffer(ep1_out, (commandBlock, char[CBW_SHORT_PACKET_SIZE]), host_transfer_length)) ) + { + /* The CBW shall start on a packet boundary and shall end as a short packet + * with exactly 31 (0x1F) bytes transferred + */ + assert(host_transfer_length == CBW_SHORT_PACKET_SIZE); + /* verify Signature - that helps identify this packet as a CBW */ + dCBWSignature = commandBlock[0] | commandBlock[1] << 8 | + commandBlock[2] << 16 | commandBlock[3] << 24; + assert(dCBWSignature == CBW_SIGNATURE); + + bCBWDataTransferLength = commandBlock[8] | commandBlock[9]<<8 | + commandBlock[10] << 16 | commandBlock[11] << 24; + + bmCBWFlags = commandBlock[12]; bCBWLUN = (commandBlock[13] & 0x0F); + assert(bCBWCBLength = (commandBlock[14] & 0x1F) <= 16); + Operation_Code = commandBlock[15]; + + switch(Operation_Code) + { + case TEST_UNIT_READY_CMD: // Test unit ready: + bCSWStatus = ready ? CSW_STATUS_CMD_PASSED : CSW_STATUS_CMD_FAILED; + break; + + case REQUEST_SENSE_CMD: // Request sense + requestSenseAnswer[2] = ready ? STATUS_GOOD : STATUS_CHECK_CONDITION; + result = XUD_SetBuffer(ep1_in, requestSenseAnswer, sizeof(requestSenseAnswer)); + break; + + case INQUIRY_CMD: // Inquiry + result = XUD_SetBuffer(ep1_in, inquiryAnswer, sizeof(inquiryAnswer)); + break; + + case START_STOP_CMD: // start/stop + ready = ((commandBlock[19] >> 1) & 1) == 0; + break; + + case MODE_SENSE_6_CMD: // Mode sense (6) + case MODE_SENSE_10_CMD: // Mode sense (10) // For Mac OSX + if (writeProtect) modeSenseAnswer[2] |= 0x80; + + result = XUD_SetBuffer(ep1_in, modeSenseAnswer, sizeof(modeSenseAnswer)); + break; + + + case MEDIUM_REMOVAL_CMD: // Medium removal + break; + + case RECEIVE_DIAGNOSTIC_RESULT_CMD: + memset(readCapacity,0x0000,sizeof(readCapacity)); + result = XUD_SetBuffer(ep1_in, (readCapacity, unsigned char[8]), 32); + break; + + case READ_FORMAT_CAPACITY_CMD: // Read Format capacity (UFI Command Spec) + readCapacity[0] = byterev(8); + readCapacity[1] = byterev(massStorageSize()); + readCapacity[2] = byterev(MASS_STORAGE_BLOCKLENGTH) | (DETECT_AS_FLOPPY ? NO_CARTRIDGE_IN_DRIVE : FORMATTED_MEDIA); + result = XUD_SetBuffer(ep1_in, (readCapacity, unsigned char[8]), 12); + break; + + case READ_CAPACITY_CMD: // Read capacity + readCapacity[0] = byterev(massStorageSize()-1); + readCapacity[1] = byterev(MASS_STORAGE_BLOCKLENGTH); + result = XUD_SetBuffer(ep1_in, (readCapacity, unsigned char[8]), 8); + break; + + case READ_CAPACITY_16_CMD: + memset(readCapacity,0x0000,sizeof(readCapacity)); + readCapacity[1] = byterev(massStorageSize()-1); + readCapacity[2] = byterev(MASS_STORAGE_BLOCKLENGTH); + result = XUD_SetBuffer(ep1_in, (readCapacity, unsigned char[8]), 32); + break; + + case READ_10_CMD: // Read (10) + readLength = commandBlock[22] << 8 | commandBlock[23]; + readAddress = commandBlock[17] << 24 | commandBlock[18] << 16 | + commandBlock[19] << 8 | commandBlock[20]; + for(int i = 0; i < readLength ; i++) { + bCSWStatus |= massStorageRead(readAddress, blockBuffer); + result = XUD_SetBuffer(ep1_in, blockBuffer, MASS_STORAGE_BLOCKLENGTH); + readAddress++; } + break; + + case WRITE_10_CMD: // Write + readLength = commandBlock[22] << 8 | commandBlock[23]; + readAddress = commandBlock[17] << 24 | commandBlock[18] << 16 | + commandBlock[19] << 8 | commandBlock[20]; + for(int i = 0; i < readLength ; i++) { + result = XUD_GetBuffer(ep1_out, (blockBuffer, char[128 * 4]),host_transfer_length); + bCSWStatus |= massStorageWrite(readAddress, blockBuffer); + readAddress++; } + break; + + default: + debug_printf("Invalid Operation Code Received : 0x%x\n",Operation_Code); + bCSWStatus = CSW_STATUS_CMD_FAILED; + break; + } + } + + /* Check for result, if it is found as XUD_RES_RST, then reset Endpoints */ + if(result == XUD_RES_RST) { + XUD_ResetEndpoint(ep1_out,ep1_in); + break; + } + + /* Setup Command Status Wrapper (CSW). The CSW shall start on a packet boundry + * and shall end as a short packet with exactly 13 (0x0D) bytes transferred */ + /* The device shall echo the contents of dCBWTag back to the host in the dCSWTag */ + commandStatus[4] = commandBlock[4]; + commandStatus[5] = commandBlock[5]; + commandStatus[6] = commandBlock[6]; + commandStatus[7] = commandBlock[7]; + commandStatus[12] = bCSWStatus; + + if(XUD_RES_RST == XUD_SetBuffer(ep1_in, commandStatus, CSW_SHORT_PACKET_SIZE)) + XUD_ResetEndpoint(ep1_out,ep1_in); + + } //while(1) +} // END of massStorageClass diff --git a/examples/AN00126_printer_class/src/main.xc b/examples/AN00126_printer_class/src/main.xc index 0ecedeb4..c55dbdc0 100644 --- a/examples/AN00126_printer_class/src/main.xc +++ b/examples/AN00126_printer_class/src/main.xc @@ -58,7 +58,7 @@ void print_string(unsigned char *string, unsigned size) void printer_main(chanend c_ep_prt_out) { unsigned size; - unsigned char print_packet[1024]; // Buffer for storing printer packets sent from host + unsigned char print_packet[1024]; // Buffer for storing printer packets sent from host debug_printf("USB printer class demo started\n"); @@ -68,7 +68,7 @@ void printer_main(chanend c_ep_prt_out) while (1) { // Perform a blocking read waiting for data to be received at the endpoint - XUD_GetBuffer(ep_out, print_packet, size); + XUD_GetBuffer(ep_out, print_packet, size); debug_printf("**** Received %d byte print buffer ****\n", size); print_string(print_packet, size); } @@ -83,7 +83,7 @@ int main() par { on USB_TILE: XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, + null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); on USB_TILE: Endpoint0(c_ep_out[0], c_ep_in[0]); diff --git a/examples/AN00127_video_class/src/main.xc b/examples/AN00127_video_class/src/main.xc index 0a5eed46..4c847900 100644 --- a/examples/AN00127_video_class/src/main.xc +++ b/examples/AN00127_video_class/src/main.xc @@ -36,7 +36,7 @@ int main() { par { on USB_TILE: XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, + null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); on USB_TILE: Endpoint0(c_ep_out[0], c_ep_in[0]); diff --git a/examples/AN00129_hid_class/src/main.c b/examples/AN00129_hid_class/src/main.c index 34737382..f528538a 100644 --- a/examples/AN00129_hid_class/src/main.c +++ b/examples/AN00129_hid_class/src/main.c @@ -194,7 +194,7 @@ void Endpoint0(chanend_t chan_ep0_out, chanend_t chan_ep0_in) DECLARE_JOB(hid_mouse, (chanend_t)); /* - * This function responds to the HID requests + * This function responds to the HID requests * - It draws a square using the mouse moving 40 pixels in each direction * - The sequence repeats every 500 requests. */ @@ -202,7 +202,7 @@ void hid_mouse(chanend_t chan_ep_hid) { unsigned int counter = 0; enum {RIGHT, DOWN, LEFT, UP} state = RIGHT; - + printf("hid_mouse: %x\n", chan_ep_hid); XUD_ep ep_hid = XUD_InitEp(chan_ep_hid); @@ -295,4 +295,4 @@ int main() ); return 0; -} \ No newline at end of file +} diff --git a/examples/AN00129_hid_class/src/main.xc b/examples/AN00129_hid_class/src/main.xc index 439b2147..0cd1b1b1 100644 --- a/examples/AN00129_hid_class/src/main.xc +++ b/examples/AN00129_hid_class/src/main.xc @@ -1,7 +1,7 @@ // Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xud_device.h" -#include "hid_defs.h" +#include "hid_defs.h" /* Number of Endpoints used by this app */ #define EP_COUNT_OUT 1 @@ -17,7 +17,7 @@ XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, X void Endpoint0(chanend c_ep0_out, chanend c_ep0_in); /* - * This function responds to the HID requests + * This function responds to the HID requests * - It draws a square using the mouse moving 40 pixels in each direction * - The sequence repeats every 500 requests. */ @@ -25,7 +25,7 @@ void hid_mouse(chanend chan_ep_hid) { unsigned int counter = 0; enum {RIGHT, DOWN, LEFT, UP} state = RIGHT; - + XUD_ep ep_hid = XUD_InitEp(chan_ep_hid); for(;;) @@ -67,7 +67,7 @@ void hid_mouse(chanend chan_ep_hid) unsafe { /* global buffer 'g_reportBuffer' defined in hid_defs.h */ char * unsafe p_reportBuffer = g_reportBuffer; - + p_reportBuffer[1] = x; p_reportBuffer[2] = y; diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.xc b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.xc index b2b6ed42..c1ce8164 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.xc +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.xc @@ -58,7 +58,7 @@ void tcpString(char s[], unsigned int rsp_packet[], unsigned &rsp_len) { (rsp_packet, unsigned char[])[HEADERS_LEN_TCP+len] = 0; patchTCPHeader(rsp_packet, len, ACK | PSH | FIN); - + rsp_len = HEADERS_LEN_TCP + len; stream[stream_index].sequenceNumber += len; return; diff --git a/examples/AN00131_CDC_EDC_class/src/main.xc b/examples/AN00131_CDC_EDC_class/src/main.xc index c06fd8dc..1519a8ae 100644 --- a/examples/AN00131_CDC_EDC_class/src/main.xc +++ b/examples/AN00131_CDC_EDC_class/src/main.xc @@ -34,7 +34,7 @@ int main() { par { on USB_TILE: XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, + null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); on USB_TILE: Endpoint0(c_ep_out[0], c_ep_in[0]); diff --git a/examples/AN00132_image_class/host/ptp.h b/examples/AN00132_image_class/host/ptp.h index 73a84221..5cb087a0 100644 --- a/examples/AN00132_image_class/host/ptp.h +++ b/examples/AN00132_image_class/host/ptp.h @@ -466,7 +466,7 @@ typedef struct _PTPObjectInfo PTPObjectInfo; #define PTP_DPC_NIKON_E3AAFlashMode 0xD076 #define PTP_DPC_NIKON_E4ModelingFlash 0xD077 #define PTP_DPC_NIKON_BracketSet 0xD078 -#define PTP_DPC_NIKON_E6ManualModeBracketing 0xD079 +#define PTP_DPC_NIKON_E6ManualModeBracketing 0xD079 #define PTP_DPC_NIKON_BracketOrder 0xD07A #define PTP_DPC_NIKON_E8AutoBracketSelection 0xD07B #define PTP_DPC_NIKON_BracketingSet 0xD07C diff --git a/examples/AN00132_image_class/src/main.xc b/examples/AN00132_image_class/src/main.xc index 6bb66a92..60e6714c 100644 --- a/examples/AN00132_image_class/src/main.xc +++ b/examples/AN00132_image_class/src/main.xc @@ -165,7 +165,7 @@ int main() par { on USB_TILE: XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, + null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); on USB_TILE: Endpoint0(c_ep_out[0], c_ep_in[0]); diff --git a/examples/AN00135_test_and_measurement_class/src/main.c b/examples/AN00135_test_and_measurement_class/src/main.c index 00ac29eb..0fa1975f 100644 --- a/examples/AN00135_test_and_measurement_class/src/main.c +++ b/examples/AN00135_test_and_measurement_class/src/main.c @@ -49,7 +49,7 @@ void _usbtmc_bulk_endpoints(chanend_t c_ep_out, chanend_t c_ep_in) XUD_SetReady_Out (ep_out, host_transfer_buf); SCPI_initialize_parser(); - + SELECT_RES( CASE_THEN(c_ep_out, xud_getdata_select_handler), CASE_THEN(c_ep_in, xud_setdata_select_handler)) @@ -91,11 +91,11 @@ void _usbtmc_bulk_endpoints(chanend_t c_ep_out, chanend_t c_ep_in) case REQUEST_VENDOR_SPECIFIC_IN: /* Handle any vendor specific command messages */ break; - + default: break; } - + /* Mark EP as ready again */ XUD_SetReady_Out (ep_out, host_transfer_buf); continue; @@ -110,7 +110,7 @@ void _usbtmc_bulk_endpoints(chanend_t c_ep_out, chanend_t c_ep_in) XUD_SetReady_Out (ep_out, host_transfer_buf); continue; } - + } diff --git a/examples/AN00135_test_and_measurement_class/src/main.xc b/examples/AN00135_test_and_measurement_class/src/main.xc index ef520060..2031667b 100644 --- a/examples/AN00135_test_and_measurement_class/src/main.xc +++ b/examples/AN00135_test_and_measurement_class/src/main.xc @@ -27,7 +27,7 @@ int main() par { on USB_TILE: XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, + null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); on USB_TILE: Endpoint0(c_ep_out[0], c_ep_in[0]); diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/debug.c b/examples/AN00135_test_and_measurement_class/src/scpi_parser/debug.c index 832bd939..2b7ebd01 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/debug.c +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/debug.c @@ -2,7 +2,7 @@ * Copyright (c) 2012-2013 Jan Breuer, * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,10 +28,10 @@ /** * @file scpi_debug.c * @date Thu Nov 15 10:58:45 UTC 2012 - * + * * @brief Debugging SCPI - * - * + * + * */ #include @@ -40,7 +40,7 @@ /** * Debug function: show current command and its parameters * @param context - * @return + * @return */ scpi_bool_t SCPI_DebugCommand(scpi_t * context) { size_t res; @@ -48,6 +48,6 @@ scpi_bool_t SCPI_DebugCommand(scpi_t * context) { res = fwrite(context->paramlist.parameters, 1, context->paramlist.length, stdout); (void)res; printf("\" - %lu\r\n", (unsigned long)context->paramlist.length); - + return TRUE; } diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/error.c b/examples/AN00135_test_and_measurement_class/src/scpi_parser/error.c index b85fa56f..16133694 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/error.c +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/error.c @@ -2,7 +2,7 @@ * Copyright (c) 2012-2013 Jan Breuer, * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,10 +28,10 @@ /** * @file scpi_error.c * @date Thu Nov 15 10:58:45 UTC 2012 - * + * * @brief Error handling and storing routines - * - * + * + * */ #include @@ -95,7 +95,7 @@ int16_t SCPI_ErrorPop(scpi_t * context) { /** * Return number of errors/events in the queue * @param context - * @return + * @return */ int32_t SCPI_ErrorCount(scpi_t * context) { int16_t result = 0; @@ -176,7 +176,7 @@ const char * SCPI_ErrorTranslate(int16_t err) { case 0: return "No error"; #define X(def, val, str) case def: return str; LIST_OF_ERRORS - #undef X + #undef X default: return "Unknown error"; } } diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/ieee488.c b/examples/AN00135_test_and_measurement_class/src/scpi_parser/ieee488.c index 73701ec9..924f8a02 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/ieee488.c +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/ieee488.c @@ -2,7 +2,7 @@ * Copyright (c) 2012-2013 Jan Breuer, * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,10 +28,10 @@ /** * @file scpi_ieee488.c * @date Thu Nov 15 10:58:45 UTC 2012 - * + * * @brief Implementation of IEEE488.2 commands and state model - * - * + * + * */ #include "scpi/parser.h" @@ -105,7 +105,7 @@ void SCPI_RegSet(scpi_t * context, scpi_reg_name_t name, scpi_reg_val_t val) { if ((name >= SCPI_REG_COUNT) || (context->registers == NULL)) { return; } - + /* store old register value */ old_val = context->registers[name]; @@ -148,8 +148,8 @@ void SCPI_RegSet(scpi_t * context, scpi_reg_name_t name, scpi_reg_val_t val) { case SCPI_REG_OPERE: regUpdate(context, SCPI_REG_OPER); break; - - + + case SCPI_REG_COUNT: /* nothing to do */ break; @@ -191,10 +191,10 @@ void SCPI_EventClear(scpi_t * context) { } /** - * *CLS - This command clears all status data structures in a device. + * *CLS - This command clears all status data structures in a device. * For a device which minimally complies with SCPI. (SCPI std 4.1.3.2) * @param context - * @return + * @return */ scpi_result_t SCPI_CoreCls(scpi_t * context) { SCPI_EventClear(context); @@ -207,7 +207,7 @@ scpi_result_t SCPI_CoreCls(scpi_t * context) { /** * *ESE * @param context - * @return + * @return */ scpi_result_t SCPI_CoreEse(scpi_t * context) { int32_t new_ESE; @@ -220,7 +220,7 @@ scpi_result_t SCPI_CoreEse(scpi_t * context) { /** * *ESE? * @param context - * @return + * @return */ scpi_result_t SCPI_CoreEseQ(scpi_t * context) { SCPI_ResultInt(context, SCPI_RegGet(context, SCPI_REG_ESE)); @@ -230,7 +230,7 @@ scpi_result_t SCPI_CoreEseQ(scpi_t * context) { /** * *ESR? * @param context - * @return + * @return */ scpi_result_t SCPI_CoreEsrQ(scpi_t * context) { SCPI_ResultInt(context, SCPI_RegGet(context, SCPI_REG_ESR)); @@ -240,14 +240,14 @@ scpi_result_t SCPI_CoreEsrQ(scpi_t * context) { /** * *IDN? - * + * * field1: MANUFACTURE * field2: MODEL * field4: SUBSYSTEMS REVISIONS - * + * * example: MANUFACTURE,MODEL,0,01-02-01 * @param context - * @return + * @return */ scpi_result_t SCPI_CoreIdnQ(scpi_t * context) { SCPI_ResultString(context, context->idn[0]); @@ -260,7 +260,7 @@ scpi_result_t SCPI_CoreIdnQ(scpi_t * context) { /** * *OPC * @param context - * @return + * @return */ scpi_result_t SCPI_CoreOpc(scpi_t * context) { SCPI_RegSetBits(context, SCPI_REG_ESR, ESR_OPC); @@ -270,7 +270,7 @@ scpi_result_t SCPI_CoreOpc(scpi_t * context) { /** * *OPC? * @param context - * @return + * @return */ scpi_result_t SCPI_CoreOpcQ(scpi_t * context) { /* Operation is always completed */ @@ -281,7 +281,7 @@ scpi_result_t SCPI_CoreOpcQ(scpi_t * context) { /** * *RST * @param context - * @return + * @return */ scpi_result_t SCPI_CoreRst(scpi_t * context) { if (context && context->interface && context->interface->reset) { @@ -293,7 +293,7 @@ scpi_result_t SCPI_CoreRst(scpi_t * context) { /** * *SRE * @param context - * @return + * @return */ scpi_result_t SCPI_CoreSre(scpi_t * context) { int32_t new_SRE; @@ -306,7 +306,7 @@ scpi_result_t SCPI_CoreSre(scpi_t * context) { /** * *SRE? * @param context - * @return + * @return */ scpi_result_t SCPI_CoreSreQ(scpi_t * context) { SCPI_ResultInt(context, SCPI_RegGet(context, SCPI_REG_SRE)); @@ -316,7 +316,7 @@ scpi_result_t SCPI_CoreSreQ(scpi_t * context) { /** * *STB? * @param context - * @return + * @return */ scpi_result_t SCPI_CoreStbQ(scpi_t * context) { SCPI_ResultInt(context, SCPI_RegGet(context, SCPI_REG_STB)); @@ -326,7 +326,7 @@ scpi_result_t SCPI_CoreStbQ(scpi_t * context) { /** * *TST? * @param context - * @return + * @return */ scpi_result_t SCPI_CoreTstQ(scpi_t * context) { int result = 0; @@ -340,7 +340,7 @@ scpi_result_t SCPI_CoreTstQ(scpi_t * context) { /** * *WAI * @param context - * @return + * @return */ scpi_result_t SCPI_CoreWai(scpi_t * context) { (void) context; diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/config.h b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/config.h index 703465d3..618cf863 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/config.h +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/config.h @@ -2,7 +2,7 @@ * Copyright (c) 2012-2013 Jan Breuer, * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,10 +28,10 @@ /** * @file config.h * @date Wed Mar 20 12:21:26 UTC 2013 - * + * * @brief SCPI Configuration - * - * + * + * */ #ifndef __SCPI_CONFIG_H_ diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/constants.h b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/constants.h index 34b88960..8e0a5296 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/constants.h +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/constants.h @@ -2,7 +2,7 @@ * Copyright (c) 2012-2013 Jan Breuer, * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,10 +28,10 @@ /** * @file scpi_constants.h * @date Thu Nov 15 10:58:45 UTC 2012 - * + * * @brief SCPI Device constants - * - * + * + * */ #ifndef SCPI_CONSTANTS_H @@ -49,7 +49,7 @@ extern "C" { #define SCPI_DEFAULT_3 "1" #define SCPI_DEFAULT_4_REVISION "01-01" -/* 21.21 :VERSion? +/* 21.21 :VERSion? * YYYY.V * YYYY = SCPI year * V = SCPI revision diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/debug.h b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/debug.h index b1e80470..0bd6148c 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/debug.h +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/debug.h @@ -2,7 +2,7 @@ * Copyright (c) 2012-2013 Jan Breuer, * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,10 +28,10 @@ /** * @file scpi_debug.h * @date Thu Nov 15 10:58:45 UTC 2012 - * + * * @brief SCPI debug function - * - * + * + * */ #ifndef SCPI_DEBUG_H diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/fifo.h b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/fifo.h index 63ba6b49..c1dc1467 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/fifo.h +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/fifo.h @@ -2,7 +2,7 @@ * Copyright (c) 2012-2013 Jan Breuer, * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,10 +28,10 @@ /** * @file scpi_fifo.h * @date Thu Nov 15 10:58:45 UTC 2012 - * + * * @brief basic FIFO implementation - * - * + * + * */ #ifndef SCPI_FIFO_H diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/ieee488.h b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/ieee488.h index f9c02ce3..9702703c 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/ieee488.h +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/ieee488.h @@ -2,7 +2,7 @@ * Copyright (c) 2012-2013 Jan Breuer, * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,10 +28,10 @@ /** * @file scpi_ieee488.h * @date Thu Nov 15 10:58:45 UTC 2012 - * + * * @brief Implementation of IEEE488.2 commands and state model - * - * + * + * */ #ifndef SCPI_IEEE488_H diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/minimal.h b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/minimal.h index 77b2abdf..11a1a80c 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/minimal.h +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/minimal.h @@ -2,7 +2,7 @@ * Copyright (c) 2012-2013 Jan Breuer, * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,10 +28,10 @@ /** * @file scpi_minimal.h * @date Thu Nov 15 10:58:45 UTC 2012 - * + * * @brief SCPI minimal implementation - * - * + * + * */ #ifndef SCPI_MINIMAL_H diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/parser.h b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/parser.h index 002ef8cf..6674579c 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/parser.h +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/parser.h @@ -2,7 +2,7 @@ * Copyright (c) 2012-2013 Jan Breuer, * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,10 +28,10 @@ /** * @file scpi_parser.h * @date Thu Nov 15 10:58:45 UTC 2012 - * + * * @brief SCPI parser implementation - * - * + * + * */ #ifndef SCPI_PARSER_H @@ -59,7 +59,7 @@ extern "C" { scpi_bool_t SCPI_ParamInt(scpi_t * context, int32_t * value, scpi_bool_t mandatory); scpi_bool_t SCPI_ParamDouble(scpi_t * context, double * value, scpi_bool_t mandatory); scpi_bool_t SCPI_ParamString(scpi_t * context, const char ** value, size_t * len, scpi_bool_t mandatory); - scpi_bool_t SCPI_ParamText(scpi_t * context, const char ** value, size_t * len, scpi_bool_t mandatory); + scpi_bool_t SCPI_ParamText(scpi_t * context, const char ** value, size_t * len, scpi_bool_t mandatory); scpi_bool_t SCPI_ParamBool(scpi_t * context, scpi_bool_t * value, scpi_bool_t mandatory); scpi_bool_t SCPI_ParamChoice(scpi_t * context, const char * options[], int32_t * value, scpi_bool_t mandatory); diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/scpi.h b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/scpi.h index 7858488b..e6abc25a 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/scpi.h +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/scpi.h @@ -2,7 +2,7 @@ * Copyright (c) 2012-2013 Jan Breuer, * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,10 +28,10 @@ /** * @file scpi.h * @date Thu Nov 15 10:58:45 UTC 2012 - * + * * @brief SCPI library include file - * - * + * + * */ #ifndef SCPI_H diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/types.h b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/types.h index 78a5cd6f..5e08de15 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/types.h +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/types.h @@ -4,7 +4,7 @@ * Copyright (c) 2012 Jan Breuer * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -13,7 +13,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -30,10 +30,10 @@ /** * @file scpi_types.h * @date Thu Nov 15 10:58:45 UTC 2012 - * + * * @brief SCPI data types - * - * + * + * */ #ifndef SCPI_TYPES_H @@ -172,7 +172,7 @@ extern "C" { const char * name; scpi_special_number_t type; }; - #define SCPI_SPECIAL_NUMBERS_LIST_END {NULL, SCPI_NUM_NUMBER} + #define SCPI_SPECIAL_NUMBERS_LIST_END {NULL, SCPI_NUM_NUMBER} typedef struct _scpi_special_number_def_t scpi_special_number_def_t; struct _scpi_number_t { diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/units.h b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/units.h index e66e5214..ff49bb16 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/units.h +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/units.h @@ -2,7 +2,7 @@ * Copyright (c) 2012-2013 Jan Breuer, * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,10 +28,10 @@ /** * @file scpi_units.h * @date Thu Nov 15 10:58:45 UTC 2012 - * + * * @brief SCPI Units - * - * + * + * */ #ifndef SCPI_UNITS_H @@ -45,7 +45,7 @@ extern "C" { extern const scpi_unit_def_t scpi_units_def[]; extern const scpi_special_number_def_t scpi_special_numbers_def[]; - + scpi_bool_t SCPI_ParamNumber(scpi_t * context, scpi_number_t * value, scpi_bool_t mandatory); size_t SCPI_NumberToStr(scpi_t * context, scpi_number_t * value, char * str, size_t len); diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/utils_private.h b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/utils_private.h index 2c568194..76ac3e63 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/utils_private.h +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/inc/scpi/utils_private.h @@ -2,7 +2,7 @@ * Copyright (c) 2012-2013 Jan Breuer, * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,10 +28,10 @@ /** * @file scpi_utils.h * @date Thu Nov 15 10:58:45 UTC 2012 - * + * * @brief Conversion routines and string manipulation routines - * - * + * + * */ #ifndef SCPI_UTILS_H diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/minimal.c b/examples/AN00135_test_and_measurement_class/src/scpi_parser/minimal.c index da35210d..1f05badb 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/minimal.c +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/minimal.c @@ -2,7 +2,7 @@ * Copyright (c) 2012-2013 Jan Breuer, * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,10 +28,10 @@ /** * @file scpi_minimal.c * @date Thu Nov 15 10:58:45 UTC 2012 - * + * * @brief SCPI minimal implementation - * - * + * + * */ @@ -44,7 +44,7 @@ /** * Command stub function * @param context - * @return + * @return */ scpi_result_t SCPI_Stub(scpi_t * context) { (void) context; @@ -54,7 +54,7 @@ scpi_result_t SCPI_Stub(scpi_t * context) { /** * Query command stub function * @param context - * @return + * @return */ scpi_result_t SCPI_StubQ(scpi_t * context) { SCPI_ResultString(context, ""); @@ -64,7 +64,7 @@ scpi_result_t SCPI_StubQ(scpi_t * context) { /** * SYSTem:VERSion? * @param context - * @return + * @return */ scpi_result_t SCPI_SystemVersionQ(scpi_t * context) { SCPI_ResultString(context, SCPI_STD_VERSION_REVISION); @@ -74,7 +74,7 @@ scpi_result_t SCPI_SystemVersionQ(scpi_t * context) { /** * SYSTem:ERRor[:NEXT]? * @param context - * @return + * @return */ scpi_result_t SCPI_SystemErrorNextQ(scpi_t * context) { int16_t err = SCPI_ErrorPop(context); @@ -88,7 +88,7 @@ scpi_result_t SCPI_SystemErrorNextQ(scpi_t * context) { /** * SYSTem:ERRor:COUNt? * @param context - * @return + * @return */ scpi_result_t SCPI_SystemErrorCountQ(scpi_t * context) { SCPI_ResultInt(context, SCPI_ErrorCount(context)); @@ -99,7 +99,7 @@ scpi_result_t SCPI_SystemErrorCountQ(scpi_t * context) { /** * STATus:QUEStionable[:EVENt]? * @param context - * @return + * @return */ scpi_result_t SCPI_StatusQuestionableEventQ(scpi_t * context) { /* return value */ @@ -114,7 +114,7 @@ scpi_result_t SCPI_StatusQuestionableEventQ(scpi_t * context) { /** * STATus:QUEStionable:ENABle? * @param context - * @return + * @return */ scpi_result_t SCPI_StatusQuestionableEnableQ(scpi_t * context) { /* return value */ @@ -126,7 +126,7 @@ scpi_result_t SCPI_StatusQuestionableEnableQ(scpi_t * context) { /** * STATus:QUEStionable:ENABle * @param context - * @return + * @return */ scpi_result_t SCPI_StatusQuestionableEnable(scpi_t * context) { int32_t new_QUESE; @@ -139,7 +139,7 @@ scpi_result_t SCPI_StatusQuestionableEnable(scpi_t * context) { /** * STATus:PRESet * @param context - * @return + * @return */ scpi_result_t SCPI_StatusPreset(scpi_t * context) { /* clear STATUS:... */ diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/parser.c b/examples/AN00135_test_and_measurement_class/src/scpi_parser/parser.c index 36069446..ed007248 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/parser.c +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/parser.c @@ -2,7 +2,7 @@ * Copyright (c) 2012-2013 Jan Breuer, * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,10 +28,10 @@ /** * @file scpi_parser.c * @date Thu Nov 15 10:58:45 UTC 2012 - * + * * @brief SCPI parser implementation - * - * + * + * */ #include @@ -309,7 +309,7 @@ void SCPI_Init(scpi_t * context) { if (context->idn[3] == NULL) { context->idn[3] = SCPI_DEFAULT_4_REVISION; } - + context->buffer.position = 0; SCPI_ErrorInit(context); } @@ -318,11 +318,11 @@ void SCPI_Init(scpi_t * context) { * Interface to the application. Adds data to system buffer and try to search * command line termination. If the termination is found or if len=0, command * parser is called. - * + * * @param context * @param data - data to process * @param len - length of data - * @return + * @return */ int SCPI_Input(scpi_t * context, const char * data, size_t len) { int result = 0; @@ -349,7 +349,7 @@ int SCPI_Input(scpi_t * context, const char * data, size_t len) { result = SCPI_Parse(context, context->buffer.data + ws, curr_len - ws); memmove(context->buffer.data, cmd_term, context->buffer.position - curr_len); context->buffer.position -= curr_len; - + ws = skipWhitespace(context->buffer.data, context->buffer.position); cmd_term = cmdlineTerminator(context->buffer.data + ws, context->buffer.position - ws); } @@ -364,7 +364,7 @@ int SCPI_Input(scpi_t * context, const char * data, size_t len) { * Write raw string result to the output * @param context * @param data - * @return + * @return */ size_t SCPI_ResultString(scpi_t * context, const char * data) { size_t len = strlen(data); @@ -379,7 +379,7 @@ size_t SCPI_ResultString(scpi_t * context, const char * data) { * Write integer value to the result * @param context * @param val - * @return + * @return */ size_t SCPI_ResultInt(scpi_t * context, int32_t val) { char buffer[12]; @@ -395,7 +395,7 @@ size_t SCPI_ResultInt(scpi_t * context, int32_t val) { * Write boolean value to the result * @param context * @param val - * @return + * @return */ size_t SCPI_ResultBool(scpi_t * context, scpi_bool_t val) { return SCPI_ResultInt(context, val ? 1 : 0); @@ -405,7 +405,7 @@ size_t SCPI_ResultBool(scpi_t * context, scpi_bool_t val) { * Write double walue to the result * @param context * @param val - * @return + * @return */ size_t SCPI_ResultDouble(scpi_t * context, double val) { char buffer[32]; @@ -422,7 +422,7 @@ size_t SCPI_ResultDouble(scpi_t * context, double val) { * Write string withn " to the result * @param context * @param data - * @return + * @return */ size_t SCPI_ResultText(scpi_t * context, const char * data) { size_t result = 0; @@ -462,7 +462,7 @@ void paramSkipWhitespace(scpi_t * context) { * Find next parameter * @param context * @param mandatory - * @return + * @return */ scpi_bool_t paramNext(scpi_t * context, scpi_bool_t mandatory) { paramSkipWhitespace(context); @@ -490,7 +490,7 @@ scpi_bool_t paramNext(scpi_t * context, scpi_bool_t mandatory) { * @param context * @param value * @param mandatory - * @return + * @return */ scpi_bool_t SCPI_ParamInt(scpi_t * context, int32_t * value, scpi_bool_t mandatory) { const char * param; @@ -520,7 +520,7 @@ scpi_bool_t SCPI_ParamInt(scpi_t * context, int32_t * value, scpi_bool_t mandato * @param context * @param value * @param mandatory - * @return + * @return */ scpi_bool_t SCPI_ParamDouble(scpi_t * context, double * value, scpi_bool_t mandatory) { const char * param; @@ -551,7 +551,7 @@ scpi_bool_t SCPI_ParamDouble(scpi_t * context, double * value, scpi_bool_t manda * @param value Pointer to string buffer where pointer to non-null terminated string will be returned * @param len Length of returned non-null terminated string * @param mandatory - * @return + * @return */ scpi_bool_t SCPI_ParamString(scpi_t * context, const char ** value, size_t * len, scpi_bool_t mandatory) { size_t length; @@ -582,7 +582,7 @@ scpi_bool_t SCPI_ParamString(scpi_t * context, const char ** value, size_t * len * @param value Pointer to string buffer where pointer to non-null terminated string will be returned * @param len Length of returned non-null terminated string * @param mandatory - * @return + * @return */ scpi_bool_t SCPI_ParamText(scpi_t * context, const char ** value, size_t * len, scpi_bool_t mandatory) { size_t length; @@ -611,7 +611,7 @@ scpi_bool_t SCPI_ParamText(scpi_t * context, const char ** value, size_t * len, * @param context * @param value * @param mandatory - * @return + * @return */ scpi_bool_t SCPI_ParamBool(scpi_t * context, scpi_bool_t * value, scpi_bool_t mandatory) { const char * param; @@ -651,7 +651,7 @@ scpi_bool_t SCPI_ParamBool(scpi_t * context, scpi_bool_t * value, scpi_bool_t ma * @param options * @param value * @param mandatory - * @return + * @return */ scpi_bool_t SCPI_ParamChoice(scpi_t * context, const char * options[], int32_t * value, scpi_bool_t mandatory) { const char * param; diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/units.c b/examples/AN00135_test_and_measurement_class/src/scpi_parser/units.c index ac0a0bb8..d32eb11d 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/units.c +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/units.c @@ -2,7 +2,7 @@ * Copyright (c) 2012-2013 Jan Breuer, * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,10 +28,10 @@ /** * @file scpi_units.c * @date Thu Nov 15 10:58:45 UTC 2012 - * + * * @brief SCPI units - * - * + * + * */ #include @@ -155,7 +155,7 @@ static const char * translateSpecialNumberInverse(const scpi_special_number_def_ if (specs == NULL) { return NULL; } - + for (i = 0; specs[i].name != NULL; i++) { if (specs[i].type == type) { return specs[i].name; @@ -174,11 +174,11 @@ static const char * translateSpecialNumberInverse(const scpi_special_number_def_ */ static const scpi_unit_def_t * translateUnit(const scpi_unit_def_t * units, const char * unit, size_t len) { int i; - + if (units == NULL) { return NULL; } - + for (i = 0; units[i].name != NULL; i++) { if (compareStr(unit, len, units[i].name, strlen(units[i].name))) { return &units[i]; @@ -196,11 +196,11 @@ static const scpi_unit_def_t * translateUnit(const scpi_unit_def_t * units, cons */ static const char * translateUnitInverse(const scpi_unit_def_t * units, const scpi_unit_t unit) { int i; - + if (units == NULL) { return NULL; } - + for (i = 0; units[i].name != NULL; i++) { if ((units[i].unit == unit) && (units[i].mult == 1)) { return units[i].name; @@ -246,7 +246,7 @@ static scpi_bool_t transformNumber(scpi_t * context, const char * unit, size_t l * @param context * @param value return value * @param mandatory if the parameter is mandatory - * @return + * @return */ scpi_bool_t SCPI_ParamNumber(scpi_t * context, scpi_number_t * value, scpi_bool_t mandatory) { scpi_bool_t result; diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/utils.c b/examples/AN00135_test_and_measurement_class/src/scpi_parser/utils.c index 8c3cbd6d..30d37297 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/utils.c +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/utils.c @@ -4,7 +4,7 @@ * Copyright (c) 2012 Jan Breuer * * All Rights Reserved - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -13,7 +13,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -30,10 +30,10 @@ /** * @file scpi_utils.c * @date Thu Nov 15 10:58:45 UTC 2012 - * + * * @brief Conversion routines and string manipulation routines - * - * + * + * */ #include @@ -52,7 +52,7 @@ static size_t cmdSeparatorPos(const char * cmd, size_t len); * @param str * @param size * @param set - * @return + * @return */ const char * strnpbrk(const char *str, size_t size, const char *set) { const char *scanp; @@ -342,7 +342,7 @@ static scpi_bool_t locateStrAutomaton(locate_text_nfa * nfa, unsigned char c) { break; default: - break; + break; } /* if it is terminating state, break from for loop */ @@ -463,7 +463,7 @@ size_t cmdSeparatorPos(const char * cmd, size_t len) { * @param pattern_len * @param str * @param str_len - * @return + * @return */ scpi_bool_t matchPattern(const char * pattern, size_t pattern_len, const char * str, size_t str_len) { int pattern_sep_pos_short; @@ -618,28 +618,28 @@ scpi_bool_t matchCommand(const char * pattern, const char * cmd, size_t len) { /** * Compose command from previsou command anc current command - * + * * @param ptr_prev pointer to previous command * @param len_prev length of previous command * @param pptr pointer to pointer of current command * @param plen pointer to length of current command - * + * * ptr_prev and ptr should be in the same memory buffer - * + * * Function will add part of previous command prior to ptr_prev - * + * * char * cmd = "meas:volt:dc?;ac?" * char * ptr_prev = cmd; * size_t len_prev = 13; * char * ptr = cmd + 14; * size_t len = 3; - * + * * composeCompoundCommand(ptr_prev, len_prev, &ptr, &len); - * + * * after calling this - * - * - * + * + * + * */ scpi_bool_t composeCompoundCommand(char * ptr_prev, size_t len_prev, char ** pptr, size_t * plen) { @@ -654,33 +654,33 @@ scpi_bool_t composeCompoundCommand(char * ptr_prev, size_t len_prev, /* no previous command - nothing to do*/ if (ptr_prev == NULL || len_prev == 0) return TRUE; - + ptr = *pptr; len = *plen; - + /* No current command */ if (len == 0 || ptr == NULL) return FALSE; - + /* Common command or command root - nothing to do */ if (ptr[0] == '*' || ptr[0] == ':') return TRUE; - + /* Previsou command was common command - nothing to do */ if (ptr_prev[0] == '*') return TRUE; - + /* Find last occurence of ':' */ for (i = len_prev; i > 0; i--) { if (ptr_prev[i-1] == ':') { break; } } - + /* Previous command was simple command - nothing to do*/ if (i == 0) return TRUE; - + ptr -= i; len += i; memmove(ptr, ptr_prev, i); diff --git a/examples/AN00136_vendor_specific/src/main.xc b/examples/AN00136_vendor_specific/src/main.xc index 1d70c7dd..65f344b5 100644 --- a/examples/AN00136_vendor_specific/src/main.xc +++ b/examples/AN00136_vendor_specific/src/main.xc @@ -91,7 +91,7 @@ int main() par { on USB_TILE: XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, + null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); diff --git a/lib_xud/api/xud.h b/lib_xud/api/xud.h index a5ba5121..2388113c 100644 --- a/lib_xud/api/xud.h +++ b/lib_xud/api/xud.h @@ -411,7 +411,7 @@ inline XUD_Result_t XUD_SetReady_InPtr(XUD_ep ep, unsigned addr, int len) wordLength = wordLength - 1; tailLength = 32; } - + /* Get end off buffer address */ asm volatile("add %0, %1, %2":"=r"(tmp):"r"(addr),"r"(wordLength << 2)); @@ -490,7 +490,7 @@ typedef struct XUD_ep_info { unsigned int array_ptr; // 0 unsigned int xud_chanend; // 1 - unsigned int client_chanend; // 2 + unsigned int client_chanend; // 2 unsigned int buffer; // 3 Pointer to buffer unsigned int pid; // 4 Expected out PID unsigned int epType; // 5 Data diff --git a/lib_xud/src/core/XUD_CrcAddrCheck.S b/lib_xud/src/core/XUD_CrcAddrCheck.S index 47fc2129..dc6afdad 100644 --- a/lib_xud/src/core/XUD_CrcAddrCheck.S +++ b/lib_xud/src/core/XUD_CrcAddrCheck.S @@ -20,13 +20,13 @@ // R4 set to 0 in L code with in from valid tok port {eq r4, r4, r8; shr r10, r11, 7} // Extract EP number BRFT_ru6 r4, 5 - - ldw r11, sp[STACK_RXA_PORT] // Wait for RXA to gow low (i.e. end of packet) + + ldw r11, sp[STACK_RXA_PORT] // Wait for RXA to gow low (i.e. end of packet) in r10, res[r11] bt r10, waitforRXALow0 setc res[RXD], XS1_SETC_RUN_CLRBUF bu Loop_BadPid -#else +#else // __XS2A__ inpw r10, res[RXD], 8; // Read EP Number shr r10, r10, 24; // Shift off junk diff --git a/lib_xud/src/core/XUD_DeviceAttach.xc b/lib_xud/src/core/XUD_DeviceAttach.xc index c9da944e..ecf803dc 100755 --- a/lib_xud/src/core/XUD_DeviceAttach.xc +++ b/lib_xud/src/core/XUD_DeviceAttach.xc @@ -39,16 +39,16 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) unsigned int chirpCount = 0; clearbuf(p_usb_txd); - + /* On detecting the SE0 move into chirp mode */ XUD_HAL_EnterMode_PeripheralChirp(); /* output k-chirp for required time */ #if defined(XUD_SIM_RTL) || (XUD_SIM_XSIM) for (int i = 0; i < 800; i++) -#else +#else for (int i = 0; i < 16000; i++) // 16000 words @ 480 MBit = 1.066 ms -#endif +#endif { p_usb_txd <: 0; } @@ -61,9 +61,9 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) #endif t :> start_time; - while(1) + while(1) { - select + select { case t when timerafter(start_time + INVALID_DELAY) :> void: @@ -78,7 +78,7 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) unsigned dp, dm; flag0_port :> dm; flag1_port :> dp; - + if(dp || dm) { /* SE0 gone, return 0 to indicate FULL SPEED */ @@ -87,13 +87,13 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) #else flag2_port :> tmp; - if(!tmp) + if(!tmp) { /* SE0 gone, return 0 to indicate FULL SPEED */ - return 0; + return 0; } #endif - if(pwrConfig == XUD_PWR_SELF) + if(pwrConfig == XUD_PWR_SELF) { if(!XUD_HAL_GetVBusState()) { @@ -114,7 +114,7 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) #endif case detecting_k => k_port when pinseq(1):> void @ tx: // K Chirp k_port @ tx + T_FILT_ticks :> tmp; - if (tmp) + if (tmp) { detecting_k = 0; } @@ -122,13 +122,13 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) case !detecting_k => j_port when pinseq(1) :> void @ tx: // J Chirp j_port @ tx + T_FILT_ticks :> tmp; - if (tmp == 1) - { + if (tmp == 1) + { chirpCount++; // Seen an extra K-J pair detecting_k = 1; - - if (chirpCount == 3) - { + + if (chirpCount == 3) + { /* Three pairs of KJ received. Enter high-speed mode */ XUD_HAL_EnterMode_PeripheralHighSpeed(); @@ -138,10 +138,10 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) while (XUD_HAL_GetLineState() != XUD_LINESTATE_SE0); #else flag2_port when pinseq(1) :> tmp; -#endif - - /* Return 1 to indicate successful HS handshake*/ - return 1; +#endif + + /* Return 1 to indicate successful HS handshake*/ + return 1; } } diff --git a/lib_xud/src/core/XUD_HAL.h b/lib_xud/src/core/XUD_HAL.h index d6e38f28..78de3314 100644 --- a/lib_xud/src/core/XUD_HAL.h +++ b/lib_xud/src/core/XUD_HAL.h @@ -1,9 +1,9 @@ // Copyright 2019-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -/** - * @file XUD_HAL.h - * \brief USB HAL Layer +/** + * @file XUD_HAL.h + * \brief USB HAL Layer **/ #include "xud.h" @@ -21,11 +21,11 @@ unsigned XtlSelFromMhz(unsigned m); #include "xs2_su_registers.h" #endif -/** +/** * \enum XUD_LineState_t * \brief USB Line States */ -typedef enum XUD_LineState_t +typedef enum XUD_LineState_t { XUD_LINESTATE_SE0 = 0, /**< SE0 State */ XUD_LINESTATE_HS_J_FS_K = 1,/**< J/K State */ @@ -45,31 +45,31 @@ void XUD_HAL_EnterMode_PeripheralTestJTestK(); void XUD_HAL_EnterMode_TristateDrivers(); /** - * \brief Get current linestate status - * \return XUD_LineState_t representing current line status + * \brief Get current linestate status + * \return XUD_LineState_t representing current line status **/ XUD_LineState_t XUD_HAL_GetLineState(); /** * \brief Wait for a change in linestate and return, or timeout - * \param Reference to current linestate (updated with new linestate + * \param Reference to current linestate (updated with new linestate * \return 1 for timed out, otherwise 0 **/ unsigned XUD_HAL_WaitForLineStateChange(XUD_LineState_t ¤tLs, unsigned timeout); /** - * \brief HAL function to set xCORE into signalling mode + * \brief HAL function to set xCORE into signalling mode * (as opposed to "data transfer" mode) * - * TODO Should this be combined with EnterMode_PeripheralChirp()? + * TODO Should this be combined with EnterMode_PeripheralChirp()? **/ void XUD_HAL_Mode_Signalling(); /** - * \brief HAL function to set xCORE into data transfer mode + * \brief HAL function to set xCORE into data transfer mode * (as opposed to "signalling" mode ) * - * TODO Should this be combined with EnterMode_PeripheralHigh/FullSpeed()? + * TODO Should this be combined with EnterMode_PeripheralHigh/FullSpeed()? **/ void XUD_HAL_Mode_DataTransfer(); @@ -81,7 +81,7 @@ void XUD_HAL_Mode_DataTransfer(); void XUD_HAL_SetDeviceAddress(unsigned char address); /** - * \brief Enable USB funtionality in the device + * \brief Enable USB funtionality in the device **/ void XUD_HAL_EnableUsb(unsigned pwrConfig); diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index a6951466..121b9c67 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -69,21 +69,21 @@ void XUD_HAL_EnableUsb(unsigned pwrConfig) write_sswitch_reg(get_tile_id(USB_TILE_REF), XS1_SU_CFG_RST_MISC_NUM, (1 << XS1_SU_CFG_USB_CLK_EN_SHIFT) | (1< k; flag2_port :> se0; - if(j) + if(j) return XUD_LINESTATE_HS_J_FS_K; if(k) return XUD_LINESTATE_HS_K_FS_J; @@ -370,8 +370,8 @@ XUD_LineState_t XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/) unsigned XUD_HAL_WaitForLineStateChange(XUD_LineState_t ¤tLs, unsigned timeout) { unsigned time; - timer t; - + timer t; + if (timeout != null) t :> time; @@ -403,7 +403,7 @@ unsigned XUD_HAL_WaitForLineStateChange(XUD_LineState_t ¤tLs, unsigned tim {dp, dm} = LineStateToLines(currentLs); /* Wait for change */ - select + select { case dp_port when pinsneq(dp) :> dp: dm_port :> dm; //Both might have changed! @@ -433,12 +433,12 @@ void XUD_HAL_SetDeviceAddress(unsigned char address) /* Note, this is called from XUA_HAL.c (weak symbol) */ unsigned int XUD_HAL_GetVBusState_(void) { -#ifdef __XS2A__ +#ifdef __XS2A__ unsigned int x; read_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_OTG_FLAGS_NUM, x); return x & (1 << XS1_UIFM_OTG_FLAGS_SESSVLDB_SHIFT); #else - return 1u; + return 1u; #endif } diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index c071f26f..c5cc7193 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -118,7 +118,7 @@ ResetIntHandler: set sp, r10 ldc r0, 1 // Load non-zero (zero is kill) - bu Return + bu Return .cc_bottom ResetIntHandler.func @@ -176,7 +176,7 @@ XUD_LLD_IoLoop: stw r10, sp[7] PortsOnStack: // Put ports on stack (loads therefore short insts) stw r1, sp[STACK_RXA_PORT] - stw r3, sp[STACK_RXE_PORT] + stw r3, sp[STACK_RXE_PORT] SaveStackPointer: ldaw r11, sp[0] @@ -202,12 +202,12 @@ ConfigRxA: // Configure a event on RXA goin ConfigValidToken: #ifdef __XS2A__ - ldw r10, sp[STACK_VTOK_PORT] // ValidToken is used for timing timeout period when expecting an ack after tx + ldw r10, sp[STACK_VTOK_PORT] // ValidToken is used for timing timeout period when expecting an ack after tx #else ldw r10, dp[rx_rdy] // TODO use from stack #endif setc res[r10], XS1_SETC_COND_NONE - ldap r11, TxHandshakeTimeOut + ldap r11, TxHandshakeTimeOut setv res[r10], r11 #ifndef XUD_TEST_MODE_SUPPORT_DISABLED @@ -228,8 +228,8 @@ SetupUsbTestMode: setv res[r10], r11 eeu res[r10] #endif - -CrcRxResidualsOnStack: + +CrcRxResidualsOnStack: ldc r11, 0x7000 stw r11, sp[STACK_RXCRC_TAIL0] ldc r11, 0x80be @@ -239,12 +239,12 @@ CrcRxResidualsOnStack: ldc r11, 0x3ffe stw r11, sp[STACK_RXCRC_TAIL3] - ldc r11, 0xf335 // CRC16 init (in) + ldc r11, 0xf335 // CRC16 init (in) stw r11, sp[STACK_TXCRC_INIT] - - ldc r11, 0x3334 // CRC16 init (out) + + ldc r11, 0x3334 // CRC16 init (out) stw r11, sp[STACK_RXCRC_INIT] - + ldw r11, sp[STACK_EPCHANS] stw r11, dp[chanArray] @@ -264,7 +264,7 @@ ConfigSofJump_Done: ldaw r10, dp[PidJumpTable_RxData] stw r10, sp[STACK_PIDJUMPTABLE_RXDATA] - + ldaw r10, dp[crc5Table_Addr] stw r10, sp[STACK_CRC5TABLE_ADDR] @@ -324,7 +324,7 @@ NextTokenAfterPing: #include "XUD_TokenJmp.S" // Un-implemented PID list -Pid_Reserved: +Pid_Reserved: Pid_Ack: Pid_NYet: Pid_Nyet: @@ -359,7 +359,7 @@ Return: edu res[r11] setc res[r11], XS1_SETC_IE_MODE_EVENT - ldw r11, sp[STACK_RXA_PORT] + ldw r11, sp[STACK_RXA_PORT] edu res[r11] ldw r4, sp[1] // Register restore diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index f22f9bc6..110eee5e 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -59,8 +59,8 @@ in port rx_rdy = PORT_USB_RX_READY; on USB_TILE: clock tx_usb_clk = XS1_CLKBLK_4; on USB_TILE: clock rx_usb_clk = XS1_CLKBLK_5; -// We use a single array instrad of two here and append epAddr_Ready_setup on the end to save some instructions in the Setup -// token handling code. i.e. what we really want is the following, but's less efficient. +// We use a single array instrad of two here and append epAddr_Ready_setup on the end to save some instructions in the Setup +// token handling code. i.e. what we really want is the following, but's less efficient. // unsigned epAddr_Ready[USB_MAN_NUM_EP] // unsigned epAddr_Ready[USB_MAX_NUM_EP_OUT] unsigned epAddr[USB_MAX_NUM_EP]; // Used to store the addr of each EP in ep_info array @@ -153,7 +153,7 @@ static void SendSpeed(XUD_chan c[], XUD_EpType epTypeTableOut[], XUD_EpType epTy static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epAddr_Ready[], chanend ?c_sof, XUD_EpType epTypeTableOut[], XUD_EpType epTypeTableIn[], int noEpOut, int noEpIn, XUD_PwrConfig pwrConfig) { int reset = 1; /* Flag for if device is returning from a reset */ - + /* Make sure ports are on and reset port states */ set_port_use_on(p_usb_clk); set_port_use_on(p_usb_txd); @@ -166,7 +166,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epAddr_Ready[], chane #endif #if defined(__XS3A__) - + #ifndef XUD_CORE_CLOCK #error XUD_CORE_CLOCK not defined (in MHz) #endif @@ -206,7 +206,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epAddr_Ready[], chane #define TX_RISE_DELAY 5 #define TX_FALL_DELAY 1 #endif - + // Handshaken ports need USB clock configure_clock_src(tx_usb_clk, p_usb_clk); configure_clock_src(rx_usb_clk, p_usb_clk); @@ -232,7 +232,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epAddr_Ready[], chane #else set_pad_delay(flag1_port, 2); #endif - + start_clock(tx_usb_clk); start_clock(rx_usb_clk); @@ -247,10 +247,10 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epAddr_Ready[], chane while(noExit) { unsigned settings[] = {0}; - + /* Enable USB funcitonality in the device */ XUD_HAL_EnableUsb(pwrConfig); - + while(1) { { @@ -272,16 +272,16 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epAddr_Ready[], chane t when timerafter(time):> void; } } - + /* Go into full speed mode: XcvrSelect and Term Select (and suspend) high */ XUD_HAL_EnterMode_PeripheralFullSpeed(); - + /* Setup flags for power signalling - i.e. J/K/SE0 line state*/ XUD_HAL_Mode_Signalling(); - + if (one) { -#if defined(XUD_BYPASS_CONNECT) +#if defined(XUD_BYPASS_CONNECT) reset = 1; #else reset = XUD_Init(); @@ -327,7 +327,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epAddr_Ready[], chane SendResetToEps(epChans0, epAddr_Ready, epTypeTableOut, epTypeTableIn, noEpOut, noEpIn, USB_RESET_TOKEN); sentReset = 1; } - + /* Reset the OUT ep structures */ for(int i = 0; i< noEpOut; i++) { @@ -399,15 +399,15 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epAddr_Ready[], chane XUD_HAL_Mode_DataTransfer(); set_thread_fast_mode_on(); - + /* Run main IO loop */ /* flag0: Rx Error flag1: Rx Active flag2: Null / Valid Token */ noExit = XUD_LLD_IoLoop(p_usb_rxd, flag1_port, p_usb_txd, flag0_port, flag2_port, epTypeTableOut, epTypeTableIn, epAddr_Ready, noEpOut, c_sof); - + set_thread_fast_mode_off(); - + if(!noExit) break; } @@ -430,13 +430,13 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epAddr_Ready[], chane void _userTrapHandleRegister(void); #pragma unsafe arrays -static void drain(chanend chans[], int n, int op, XUD_EpType epTypeTable[]) +static void drain(chanend chans[], int n, int op, XUD_EpType epTypeTable[]) { - for(int i = 0; i < n; i++) + for(int i = 0; i < n; i++) { - if(epTypeTable[i] != XUD_EPTYPE_DIS) + if(epTypeTable[i] != XUD_EPTYPE_DIS) { - switch(op) + switch(op) { case 0: outct(chans[i], XS1_CT_END); @@ -480,7 +480,7 @@ void SetupEndpoints(chanend c_ep_out[], int noEpOut, chanend c_ep_in[], int noEp ep_info[USB_MAX_NUM_EP_OUT+i].epAddress = (i | 0x80); ep_info[USB_MAX_NUM_EP_OUT+i].resetting = 0; ep_info[USB_MAX_NUM_EP_OUT+i].halted = USB_PIDn_STALL; - + asm("ldaw %0, %1[%2]":"=r"(x):"r"(ep_info),"r"((USB_MAX_NUM_EP_OUT+i)*sizeof(XUD_ep_info)/sizeof(unsigned))); epAddr[USB_MAX_NUM_EP_OUT+i] = x; } @@ -546,7 +546,7 @@ void SetupEndpoints(chanend c_ep_out[], int noEpOut, chanend c_ep_in[], int noEp epTypeTableIn[i] = epTypeTableIn[i] & 0x7FFFFFFF; ep_info[USB_MAX_NUM_EP_OUT+i].epType = epTypeTableIn[i]; - + ep_info[USB_MAX_NUM_EP_OUT+i].halted = 0; // Mark EP as not halted asm("ldaw %0, %1[%2]":"=r"(x):"r"(ep_info),"r"((USB_MAX_NUM_EP_OUT+i)*sizeof(XUD_ep_info)/sizeof(unsigned))); @@ -574,7 +574,7 @@ int XUD_Main(chanend c_ep_out[], int noEpOut, g_desSpeed = speed; SetupEndpoints(c_ep_out, noEpOut, c_ep_in, noEpIn, epTypeTableOut, epTypeTableIn); - + #if 0 /* Check that if the required channel has a destination if the EP is marked as in use */ for( int i = 0; i < noEpOut + noEpIn; i++ ) diff --git a/lib_xud/src/core/XUD_Signalling.xc b/lib_xud/src/core/XUD_Signalling.xc index 37152b54..8b262d05 100755 --- a/lib_xud/src/core/XUD_Signalling.xc +++ b/lib_xud/src/core/XUD_Signalling.xc @@ -28,29 +28,29 @@ int XUD_Init() while (1) { XUD_LineState_t currentLs = XUD_HAL_GetLineState(); - + switch (currentLs) { /* SE0 State */ case XUD_LINESTATE_SE0: unsigned timedOut = XUD_HAL_WaitForLineStateChange(currentLs, T_WTRSTFS); - + /* If no change in LS then return 1 for reset */ - if(timedOut) - return 1; + if(timedOut) + return 1; /* Otherwise SE0 went away.. keep looking */ break; /* J State */ case XUD_LINESTATE_HS_K_FS_J: - + unsigned timedOut = XUD_HAL_WaitForLineStateChange(currentLs, STATE_START_TO); - + /* If no change in LS then return 0 for suspend */ - if(timedOut) - return 0; + if(timedOut) + return 0; /* Otherwise J went away.. keep looking */ break; @@ -74,7 +74,7 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) unsigned time; XUD_LineState_t currentLs = XUD_LINESTATE_HS_K_FS_J; - + while(1) { unsigned timeOutTime = 0; @@ -98,7 +98,7 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) continue; } } - + switch(currentLs) { /* Reset signalliung */ @@ -132,24 +132,24 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) while(1) { XUD_HAL_WaitForLineStateChange(currentLs, 0); - + switch(currentLs) { /* J, unexpected, return */ case XUD_LINESTATE_HS_K_FS_J: #ifdef __XS2A__ - /* For XS2 we have to complete the high-speed switch now, since we started it already.. + /* For XS2 we have to complete the high-speed switch now, since we started it already.. we then revert to full speed straight away - causes a blip on the bus, non-ideal */ if (g_curSpeed == XUD_SPEED_HS) { - unsafe + unsafe { XUD_HAL_EnterMode_PeripheralHighSpeed_Complete(); } } - + XUD_HAL_EnterMode_PeripheralFullSpeed(); -#endif +#endif return 0; /* SE0, end of resume */ @@ -162,7 +162,7 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) #else /* Move back into high-speed mode - Notes, writes to XS3A registers orders of magnitude faster than XS2A */ XUD_HAL_EnterMode_PeripheralHighSpeed(); -#endif +#endif } /* Return 0 for resumed */ return 0; @@ -177,7 +177,7 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) default: break; - } + } } } diff --git a/lib_xud/src/core/XUD_TestMode.xc b/lib_xud/src/core/XUD_TestMode.xc index 9d4a79aa..e4660c2c 100644 --- a/lib_xud/src/core/XUD_TestMode.xc +++ b/lib_xud/src/core/XUD_TestMode.xc @@ -35,9 +35,9 @@ int XUD_UsbTestModeHandler(unsigned cmd) switch(cmd) { case USB_WINDEX_TEST_J: - + XUD_HAL_EnterMode_PeripheralTestJTestK(); - + while(1) { p_usb_txd <: 0xffffffff; @@ -45,9 +45,9 @@ int XUD_UsbTestModeHandler(unsigned cmd) break; case USB_WINDEX_TEST_K: - + XUD_HAL_EnterMode_PeripheralTestJTestK(); - + while(1) { p_usb_txd <: 0; @@ -57,7 +57,7 @@ int XUD_UsbTestModeHandler(unsigned cmd) case USB_WINDEX_TEST_SE0_NAK: XUD_HAL_EnterMode_PeripheralHighSpeed(); - + /* Drop into asm to deal with this mode */ XUD_UsbTestSE0(); break; diff --git a/lib_xud/src/core/XUD_TimingDefines.h b/lib_xud/src/core/XUD_TimingDefines.h index cf84b828..d075368c 100755 --- a/lib_xud/src/core/XUD_TimingDefines.h +++ b/lib_xud/src/core/XUD_TimingDefines.h @@ -9,7 +9,7 @@ // Defines relating to USB/ULPI/UTMI/Phy specs #ifndef SUSPEND_TIMEOUT_us -#define SUSPEND_TIMEOUT_us (3000) +#define SUSPEND_TIMEOUT_us (3000) #endif #define SUSPEND_TIMEOUT_ticks (SUSPEND_TIMEOUT_us * REF_CLK_FREQ) diff --git a/lib_xud/src/core/XUD_TokenJmp.S b/lib_xud/src/core/XUD_TokenJmp.S index c04387bb..a286b79b 100644 --- a/lib_xud/src/core/XUD_TokenJmp.S +++ b/lib_xud/src/core/XUD_TokenJmp.S @@ -9,7 +9,7 @@ ldw r10, r10[r11] // Load relevant branch address bau r10 -#else //__XS3A__ +#else //__XS3A__ {ldw r10, sp[STACK_PIDJUMPTABLE] ldc r8, 16} diff --git a/lib_xud/src/core/XUD_USBTile_Support.S b/lib_xud/src/core/XUD_USBTile_Support.S index 8a762dbb..0ac08be4 100644 --- a/lib_xud/src/core/XUD_USBTile_Support.S +++ b/lib_xud/src/core/XUD_USBTile_Support.S @@ -25,7 +25,7 @@ XUD_EnableUsbPortMux: ldc r1, XS1_PS_XCORE_CTRL0 get r0, ps[r1] ldc r2, 2 - or r0, r0, r2 + or r0, r0, r2 set ps[r1], r0 //Sanity check, read back and check diff --git a/lib_xud/src/core/included/XUD_RxData.S b/lib_xud/src/core/included/XUD_RxData.S index 0101541e..615a2b48 100644 --- a/lib_xud/src/core/included/XUD_RxData.S +++ b/lib_xud/src/core/included/XUD_RxData.S @@ -6,8 +6,8 @@ #define LABEL(fun) fun // r0: RXD: Rx Data port -// r1: Buffer -// r2: Tx Port +// r1: Buffer +// r2: Tx Port // r3: Ep structure // r4: Zero (set in XUD_CrcAddCheck.S) then buffer index // r5: EP structures array @@ -31,7 +31,7 @@ Pid_Bad_RxData: doRXData: inpw r4, res[r0], 8 // Input PID - ldw r8, sp[STACK_RXA_PORT] + ldw r8, sp[STACK_RXA_PORT] #ifdef __XS2A__ // If pid != DATAx then jump and handle as a token. DATA0, DATA1, DATA2 & MDATA all of the form 0bxx11. // This is a fast alternative to a "timeout" @@ -56,33 +56,33 @@ GotRxPid: {eeu res[r8]; mkmsk r4, 32} // Enable events on RxA // Init buffer index to -1 -NextRxWord: // Partially un-rolled to assist with timing +NextRxWord: // Partially un-rolled to assist with timing in r11, res[r0] - crc32_inc r6, r11, r9, r4, 1 + crc32_inc r6, r11, r9, r4, 1 stw r11, r1[r4] in r11, res[r0] - crc32_inc r6, r11, r9, r4, 1 + crc32_inc r6, r11, r9, r4, 1 stw r11, r1[r4] in r11, res[r0] - crc32_inc r6, r11, r9, r4, 1 + crc32_inc r6, r11, r9, r4, 1 stw r11, r1[r4] in r11, res[r0] - crc32_inc r6, r11, r9, r4, 1 + crc32_inc r6, r11, r9, r4, 1 stw r11, r1[r4] in r11, res[r0] - crc32_inc r6, r11, r9, r4, 1 + crc32_inc r6, r11, r9, r4, 1 stw r11, r1[r4] in r11, res[r0] - crc32_inc r6, r11, r9, r4, 1 + crc32_inc r6, r11, r9, r4, 1 stw r11, r1[r4] in r11, res[r0] - crc32_inc r6, r11, r9, r4, 1 + crc32_inc r6, r11, r9, r4, 1 stw r11, r1[r4] in r11, res[r0] - crc32_inc r6, r11, r9, r4, 1 + crc32_inc r6, r11, r9, r4, 1 stw r11, r1[r4] in r11, res[r0] - crc32_inc r6, r11, r9, r4, 1 + crc32_inc r6, r11, r9, r4, 1 stw r11, r1[r4] bu NextRxWord @@ -90,11 +90,11 @@ NextRxWord: // Partially un-rolled to .align 32 .skip 16 RxALow: - stw r11, r1[r4] // Extra stw, if not enough MIPS STW in loop above may not have chance to run + stw r11, r1[r4] // Extra stw, if not enough MIPS STW in loop above may not have chance to run {in r8, res[r8]; add r4, r4, 1} // Clear event data on RXA endin r8, res[r0] LABEL(RxTail): - {in r11, res[r0]; bru r8} + {in r11, res[r0]; bru r8} // Word aligned data (0 byte tail) .align 32 diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 91839a77..6d6ffe2d 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -103,7 +103,7 @@ SetupTimeout: // Timeout done using another ldw r1, dp[rx_rdy] // TODO load from stack #endif eeu res[RXD] // Events on RXD always enabled - Can't be any more due to using events on channels - + in r11, res[r1] // Do input and get port time/timestamps getts r11, res[r1] ldw r9, dp[g_txHandshakeTimeout] @@ -125,7 +125,7 @@ TxHandshakeTimeOut: // Transmitted data, and got something back within the timeout. Check for valid handshake... .align FUNCTION_ALIGNMENT TxHandShakeReceived: - clre + clre in r11, res[RXD] // Input data from RXD port {clrpt res[r1]; // Clear port time on valid token port shr r11, r11, 24} // Shift off junk data to leave ACK @@ -187,7 +187,7 @@ TxTail2s: // Two tail byte crcn r7, r8, r9, r6 crc32 r7, r4, r9 // r4: 0 XUD_IN_TxPid_TailS2: - outpw res[TXD], r1, 8 // Output PID + outpw res[TXD], r1, 8 // Output PID outpw res[TXD], r8, 16 // Output data[0:1] not r7, r7 XUD_IN_TxCrc_TailS2: diff --git a/lib_xud/src/core/included/XUD_Token_Out_DI.S b/lib_xud/src/core/included/XUD_Token_Out_DI.S index 312722f8..e9d13091 100755 --- a/lib_xud/src/core/included/XUD_Token_Out_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Out_DI.S @@ -18,11 +18,11 @@ CheckEpTypeOut: OutReady: BLRF_u10 doRXData // Leaves r1: 0 - {clre; + {clre; ldw r11, r3[1]} // Load EP chanend InformEP_Iso: // Iso EP - no handshake - out res[r11], r4; // Output datalength (words) + out res[r11], r4; // Output datalength (words) stw r1, r5[r10] // Clear ready (r1: 0) {outt res[r11], r8; ldw r6, sp[STACK_RXCRC_INIT]} // CRC16 init (out) - Needs reseting after an out & Send tail length #ifndef __XS3A__ diff --git a/lib_xud/src/core/included/XUD_Token_Ping.S b/lib_xud/src/core/included/XUD_Token_Ping.S index 406a993c..28e8b36a 100755 --- a/lib_xud/src/core/included/XUD_Token_Ping.S +++ b/lib_xud/src/core/included/XUD_Token_Ping.S @@ -31,11 +31,11 @@ PrimaryBufferFull_PING: // Send NAK (or STALL) nop nop #endif - + ldaw r11, dp[epAddr] ldw r11, r11[r10] ldw r11, r11[10] - + outpw res[TXD], r11, 8 bu NextTokenAfterPing .scheduling default diff --git a/lib_xud/src/core/included/XUD_Token_Setup_DI.S b/lib_xud/src/core/included/XUD_Token_Setup_DI.S index 29400ebc..7102f63f 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Setup_DI.S @@ -25,11 +25,11 @@ XUD_Setup_ClearStall: // CRC OK // Have received a Setup so clear any STALL condition on IN/OUT endpoint. // Note, we can speed this up by assuming Setup only received on EP 0 ldaw r6, dp[epAddr] - + ldaw r11, r10[4] // R11 = R10 + 16 ldw r11, r6[r11] stw r1, r11[10] // r1: 0 - + ldw r11, r6[r10] ldc r6, USB_PIDn_NAK stw r6, r11[10] diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index c2e7bf1e..0a3c8be0 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -47,4 +47,4 @@ XUD_SetTestMode: .set XUD_SetTestMode.locnochandec, 1 .set XUD_SetTestMode.locnoglobalaccess, 1 .set XUD_SetTestMode.locnointerfaceaccess, 1 -.set XUD_SetTestMode.locnonotificationselect, 1 \ No newline at end of file +.set XUD_SetTestMode.locnonotificationselect, 1 diff --git a/lib_xud/src/user/client/XUD_EpFunctions.c b/lib_xud/src/user/client/XUD_EpFunctions.c index 1e77b7c7..9c328120 100644 --- a/lib_xud/src/user/client/XUD_EpFunctions.c +++ b/lib_xud/src/user/client/XUD_EpFunctions.c @@ -9,12 +9,12 @@ extern XUD_ep_info ep_info[USB_MAX_NUM_EP]; void XUD_ResetEpStateByAddr(unsigned epAddr) { unsigned pid = USB_PIDn_DATA0; - + #if defined(__XS2A__) /* Check IN bit of address */ if((epAddr & 0x80) == 0) { - pid = USB_PID_DATA0; + pid = USB_PID_DATA0; } #endif @@ -22,8 +22,8 @@ void XUD_ResetEpStateByAddr(unsigned epAddr) { epAddr &= 0x7F; epAddr += USB_MAX_NUM_EP_OUT; - } - + } + XUD_ep_info *ep = &ep_info[epAddr]; ep->pid = pid; } @@ -35,11 +35,11 @@ void XUD_SetStallByAddr(int epNum) epNum &= 0x7f; epNum += 16; } - + XUD_ep_info *ep = &ep_info[epNum]; unsigned *epReadyEntry = (unsigned *)ep->array_ptr; - + if(*epReadyEntry != 0) { /* Mark EP as not ready (and save that it was ready at Halting */ @@ -59,7 +59,7 @@ void XUD_SetStall(XUD_ep e) void XUD_ClearStallByAddr(int epNum) { unsigned handshake = USB_PIDn_NAK; - + /* Reset data PID */ XUD_ResetEpStateByAddr(epNum); @@ -69,7 +69,7 @@ void XUD_ClearStallByAddr(int epNum) epNum += USB_MAX_NUM_EP_OUT; handshake = 0; } - + XUD_ep_info *ep = &ep_info[epNum]; /* Re-mark as ready if was ready before halting */ @@ -118,7 +118,7 @@ static inline XUD_Result_t XUD_GetBuffer_Start(volatile XUD_ep_info *ep, unsigne XUD_Result_t XUD_GetBuffer_Finish(chanend c, XUD_ep e, unsigned *datalength) { // NOCOVER volatile XUD_ep_info * ep = (XUD_ep_info*) e; - + unsigned length; unsigned lengthTail; unsigned isReset; @@ -130,11 +130,11 @@ XUD_Result_t XUD_GetBuffer_Finish(chanend c, XUD_ep e, unsigned *datalength) { return XUD_RES_RST; } - + /* Input packet length (words) */ asm volatile("in %0, res[%1]" : "=r"(length) : "r"(c)); - - /* Input tail length (bytes) */ + + /* Input tail length (bytes) */ asm volatile("int %0, res[%1]" : "=r"(lengthTail) : "r"(c)); /* Bits to bytes */ @@ -148,9 +148,9 @@ XUD_Result_t XUD_GetBuffer_Finish(chanend c, XUD_ep e, unsigned *datalength) /* Load received PID */ unsigned receivedPid = ep->actualPid; - + /* Check received PID vs expected PID */ - if(receivedPid != ep->pid) + if(receivedPid != ep->pid) { *datalength = 0; /* Extra safety measure */ return XUD_RES_ERR; @@ -162,19 +162,19 @@ XUD_Result_t XUD_GetBuffer_Finish(chanend c, XUD_ep e, unsigned *datalength) #ifdef __XS2A__ ep->pid ^= 0x8; #else - ep->pid ^= 0x88; + ep->pid ^= 0x88; #endif } - + return XUD_RES_OKAY; } // NOCOVER XUD_Result_t XUD_GetBuffer(XUD_ep e, unsigned char buffer[], unsigned *datalength) { volatile XUD_ep_info * ep = (XUD_ep_info*) e; - + while(1) - { + { XUD_Result_t result = XUD_GetBuffer_Start(ep, buffer); if(result == XUD_RES_RST) @@ -183,8 +183,8 @@ XUD_Result_t XUD_GetBuffer(XUD_ep e, unsigned char buffer[], unsigned *datalengt } result = XUD_GetBuffer_Finish(ep->client_chanend, ep, datalength); - - /* If error (e.g. bad PID seq) try again */ + + /* If error (e.g. bad PID seq) try again */ if(result != XUD_RES_ERR) { return result; @@ -202,7 +202,7 @@ int XUD_SetReady_Out(XUD_ep e, unsigned char buffer[]) void XUD_GetData_Select(chanend c, XUD_ep e, unsigned *datalength, XUD_Result_t *result) { volatile XUD_ep_info * ep = (XUD_ep_info*) e; - + *result = XUD_GetBuffer_Finish(ep->client_chanend, ep, datalength); } @@ -212,7 +212,7 @@ XUD_Result_t XUD_GetSetupBuffer(XUD_ep e, unsigned char buffer[], unsigned *data unsigned isReset; unsigned length; unsigned lengthTail; - + /* Check if we missed a reset */ if(ep->resetting) { @@ -233,11 +233,11 @@ XUD_Result_t XUD_GetSetupBuffer(XUD_ep e, unsigned char buffer[], unsigned *data { return XUD_RES_RST; } - + /* Input packet length (words) */ asm volatile("in %0, res[%1]" : "=r"(length) : "r"(ep->client_chanend)); - - /* Input tail length (bytes) */ + + /* Input tail length (bytes) */ /* TODO Check CT vs T */ asm volatile("inct %0, res[%1]" : "=r"(lengthTail) : "r"(ep->client_chanend)); @@ -274,7 +274,7 @@ XUD_Result_t XUD_SetBuffer_Start(XUD_ep e, unsigned char buffer[], unsigned data if(ep->halted != USB_PIDn_STALL) { break; - } + } } int lengthWords = datalength >> 2; @@ -320,16 +320,16 @@ XUD_Result_t XUD_SetBuffer_Finish(chanend c, XUD_ep e) /* Don't do any PID toggling for Iso EP's */ if(ep->epType != XUD_EPTYPE_ISO) { - ep->pid ^= 0x88; + ep->pid ^= 0x88; } - + return XUD_RES_OKAY; } // NOCOVER XUD_Result_t XUD_SetBuffer(XUD_ep e, unsigned char buffer[], unsigned datalength) { volatile XUD_ep_info * ep = (XUD_ep_info*) e; - + XUD_Result_t result = XUD_SetBuffer_Start(e, buffer, datalength); if(result == XUD_RES_RST) @@ -343,7 +343,7 @@ XUD_Result_t XUD_SetBuffer(XUD_ep e, unsigned char buffer[], unsigned datalength void XUD_SetData_Select(chanend c, XUD_ep e, XUD_Result_t *result) { volatile XUD_ep_info * ep = (XUD_ep_info*) e; - + *result = XUD_SetBuffer_Finish(ep->client_chanend, e); } @@ -366,13 +366,13 @@ XUD_Result_t XUD_SetBuffer_EpMax(XUD_ep ep_in, unsigned char buffer[], unsigned { return result; } - + i += epMax; datalength -= epMax; while (1) { - unsigned char *bufferPtr = &buffer[i]; + unsigned char *bufferPtr = &buffer[i]; if (datalength > epMax) { diff --git a/lib_xud/src/user/control/xud_device.xc b/lib_xud/src/user/control/xud_device.xc index 379597cb..80c840a8 100644 --- a/lib_xud/src/user/control/xud_device.xc +++ b/lib_xud/src/user/control/xud_device.xc @@ -230,11 +230,11 @@ XUD_Result_t USB_StandardRequests(XUD_ep ep_out, XUD_ep ep_in, /* Pull self/bus powered bit from the config descriptor */ unsigned char self_powered = 0; - if((usbBusSpeed == XUD_SPEED_FS) && (cfgDescLength_fs != 0)) + if((usbBusSpeed == XUD_SPEED_FS) && (cfgDescLength_fs != 0)) { self_powered = (cfgDesc_fs[7] & 0x40) != 0; - } - else if(cfgDescLength_hs != 0) + } + else if(cfgDescLength_hs != 0) { self_powered = (cfgDesc_hs[7] & 0x40) != 0; } diff --git a/tests/shared/shared.h b/tests/shared/shared.h index 5f6bda46..83fa6f4a 100644 --- a/tests/shared/shared.h +++ b/tests/shared/shared.h @@ -14,7 +14,7 @@ void exit(int); #define FAIL_RX_DATAERROR 1 #define FAIL_RX_LENERROR 2 -#define FAIL_RX_EXPECTED_CTL 3 +#define FAIL_RX_EXPECTED_CTL 3 #define FAIL_RX_BAD_RETURN_CODE 4 #define FAIL_RX_FRAMENUMBER 5 @@ -26,7 +26,7 @@ void exit(int); #define PKT_LEN_END (21) #endif -#ifndef MAX_PKT_COUNT +#ifndef MAX_PKT_COUNT #define MAX_PKT_COUNT (50) #endif diff --git a/tests/shared/src/shared.xc b/tests/shared/src/shared.xc index 2cddd1ba..b42fc5fd 100644 --- a/tests/shared/src/shared.xc +++ b/tests/shared/src/shared.xc @@ -31,7 +31,7 @@ void TerminateFail(unsigned failReason) case FAIL_RX_EXPECTED_CTL: printstr("\nXCORE: ### FAIL ### : Expected a setup\n"); break; - + case FAIL_RX_BAD_RETURN_CODE: printstr("\nXCORE: ### FAIL ### : Unexpected return code\n"); break; @@ -52,7 +52,7 @@ void TerminatePass(unsigned x) void GenTxPacketBuffer(unsigned char buffer[], int length, int epNum) { for (int i = 0; i < length; i++) - unsafe + unsafe { buffer[i] = g_txDataCheck[epNum]++; } @@ -73,7 +73,7 @@ XUD_Result_t SendTxPacket(XUD_ep ep, int length, int epNum) int TestEp_Tx(chanend c_in, int epNum1, unsigned start, unsigned end, t_runMode runMode) { XUD_ep ep_in = XUD_InitEp(c_in); - + unsigned char buffer[MAX_PKT_COUNT][1024]; int counter = 0; @@ -100,7 +100,7 @@ int TestEp_Tx(chanend c_in, int epNum1, unsigned start, unsigned end, t_runMode /* Allow a little time for Tx data to make it's way of the port - important for FS tests */ { - timer t; + timer t; unsigned time; t :> time; t when timerafter(time + 500) :> int _; @@ -118,7 +118,7 @@ int RxDataCheck(unsigned char b[], int l, int epNum, unsigned expectedLength) if (l != expectedLength) { printstr("#### Unexpected length on EP: "); - printint(epNum); + printint(epNum); printstr(". Got: "); printint(l); printstr(" Expected: "); @@ -129,14 +129,14 @@ int RxDataCheck(unsigned char b[], int l, int epNum, unsigned expectedLength) for (int i = 0; i < l; i++) { unsigned char y; - + unsafe { if(b[i] != g_rxDataCheck[epNum]) { #ifdef XUD_SIM_XSIM printstr("#### Mismatch on EP: "); - printint(epNum); + printint(epNum); printstr(". Got:"); printhex(b[i]); printstr(" Expected:"); @@ -179,9 +179,9 @@ int TestEp_Rx(chanend c_out, int epNum, int start, int end) { unsigned expectedLength = start+i; unsigned fail = RxDataCheck(buffer[i], length[i], epNum, expectedLength); - if (fail) + if (fail) return fail; - + } } @@ -194,7 +194,7 @@ int TestEp_Loopback(chanend c_out1, chanend c_in1, t_runMode runMode) { unsigned int length; XUD_Result_t res; - + set_core_fast_mode_on(); XUD_ep ep_out1 = XUD_InitEp(c_out1); @@ -207,12 +207,12 @@ int TestEp_Loopback(chanend c_out1, chanend c_in1, t_runMode runMode) { XUD_GetBuffer(ep_out1, buffer, length); XUD_SetBuffer(ep_in1, buffer, length); - + /* Loop back once and return */ if(runMode == RUNMODE_DIE) break; - - /* Partial un-roll */ + + /* Partial un-roll */ XUD_GetBuffer(ep_out1, buffer, length); XUD_SetBuffer(ep_in1, buffer, length); } diff --git a/tests/shared/test_control_basic_get.xc b/tests/shared/test_control_basic_get.xc index f678557d..7bc55dcb 100644 --- a/tests/shared/test_control_basic_get.xc +++ b/tests/shared/test_control_basic_get.xc @@ -26,23 +26,23 @@ int TestEp_Control(XUD_ep ep0_out, XUD_ep ep0_in, int epNum) unsafe { GenTxPacketBuffer(buffer, i, epNum); - + /* Wait for Setup data */ sres = XUD_GetSetupBuffer(ep0_out, sbuffer, slength); res = XUD_DoGetRequest(ep0_out, ep0_in, buffer, i, i); - /* Do some checking */ + /* Do some checking */ if(slength != 8) { return FAIL_RX_DATAERROR; } - + if(res != XUD_RES_OKAY) { return FAIL_RX_BAD_RETURN_CODE; } - + if(sres != XUD_RES_OKAY) { return FAIL_RX_BAD_RETURN_CODE; diff --git a/tests/shared/test_main.xc b/tests/shared/test_main.xc index 938509fd..7b6899a3 100644 --- a/tests/shared/test_main.xc +++ b/tests/shared/test_main.xc @@ -18,12 +18,12 @@ int main() par { { - + #ifndef XUD_TEST_SPEED #error XUD_TEST_SPEED must be defined #endif const unsigned speed = XUD_TEST_SPEED; - + const int epCountOut = sizeof(epTypeTableOut)/sizeof(epTypeTableOut[0]); const int epCountIn = sizeof(epTypeTableIn)/sizeof(epTypeTableIn[0]); diff --git a/tests/suspend_resume_functional/test.xc b/tests/suspend_resume_functional/test.xc index 7ee25f27..e8ea844a 100644 --- a/tests/suspend_resume_functional/test.xc +++ b/tests/suspend_resume_functional/test.xc @@ -79,7 +79,7 @@ void write_periph_word_two_part_start(chanend tmpchan, tileref tile, unsigned pe event(PHY_WRITE_TWO_PART_START, data); } - + void write_periph_word_two_part_end(chanend tmpchan, unsigned data) { printf("W G part2\n"); diff --git a/tests/test_bulk_loopback/src/main.xc b/tests/test_bulk_loopback/src/main.xc index d7d008e4..a9028180 100644 --- a/tests/test_bulk_loopback/src/main.xc +++ b/tests/test_bulk_loopback/src/main.xc @@ -13,7 +13,7 @@ XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_E #define KILL_EP (TEST_EP_NUM + 1) -#if (KILL_EP >= EP_COUNT_OUT) || (KILL_EP >= EP_COUNT_IN) +#if (KILL_EP >= EP_COUNT_OUT) || (KILL_EP >= EP_COUNT_IN) #error KILL EP OUT OF RANGE #endif diff --git a/tests/test_bulk_notready/src/main.xc b/tests/test_bulk_notready/src/main.xc index 48e91ea4..3145e60a 100644 --- a/tests/test_bulk_notready/src/main.xc +++ b/tests/test_bulk_notready/src/main.xc @@ -11,7 +11,7 @@ XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, @@ -30,7 +30,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) /* Just give testbench some time to send some reqs that the DUT should NAK */ timer t; - unsigned time; + unsigned time; t :> time; t when timerafter(time + 10000) :> void; return 0; diff --git a/tests/test_bulk_rx_multiep/src/main.xc b/tests/test_bulk_rx_multiep/src/main.xc index 4e604acc..5e2036e0 100644 --- a/tests/test_bulk_rx_multiep/src/main.xc +++ b/tests/test_bulk_rx_multiep/src/main.xc @@ -28,7 +28,7 @@ XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_E unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { unsigned fail[4]; - + par { fail[0] = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PACKET_LEN_START, PACKET_LEN_END); diff --git a/tests/test_bulk_rx_multiep_select/src/main.xc b/tests/test_bulk_rx_multiep_select/src/main.xc index 4c6369af..d6810a57 100644 --- a/tests/test_bulk_rx_multiep_select/src/main.xc +++ b/tests/test_bulk_rx_multiep_select/src/main.xc @@ -46,10 +46,10 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) XUD_ep ep_out0 = XUD_InitEp(c_ep_out[TEST_EP_NUM]); XUD_SetReady_Out(ep_out0, buffer0[bufferIndex[0]++]); - + XUD_ep ep_out1 = XUD_InitEp(c_ep_out[TEST_EP_NUM+1]); XUD_SetReady_Out(ep_out1, buffer1[bufferIndex[1]++]); - + XUD_ep ep_out2 = XUD_InitEp(c_ep_out[TEST_EP_NUM+2]); XUD_SetReady_Out(ep_out2, buffer2[bufferIndex[2]++]); @@ -58,15 +58,15 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) select { case XUD_GetData_Select(c_ep_out[TEST_EP_NUM], ep_out0, length, result): - + if (length != pktLength[0]++) return 1; XUD_SetReady_Out(ep_out0, buffer0[bufferIndex[0]++]); break; - + case XUD_GetData_Select(c_ep_out[TEST_EP_NUM+1], ep_out1, length, result): - + if (length != pktLength[1]++) return 1; @@ -74,14 +74,14 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) break; case XUD_GetData_Select(c_ep_out[TEST_EP_NUM+2], ep_out2, length, result): - + if (length != pktLength[2]++) return 1; XUD_SetReady_Out(ep_out2, buffer2[bufferIndex[2]++]); break; } - + exit = 1; for (size_t i = 0; i < 3; i++) { @@ -111,7 +111,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) printstr("Mismatch:"); printhexln(buffer1[i][j]); return 1; - } + } if(buffer2[i][j] != counter) { printstr("Mismatch:"); diff --git a/tests/test_bulk_rx_multiep_select_c/src/test.c b/tests/test_bulk_rx_multiep_select_c/src/test.c index 807f9684..410aeb93 100644 --- a/tests/test_bulk_rx_multiep_select_c/src/test.c +++ b/tests/test_bulk_rx_multiep_select_c/src/test.c @@ -42,10 +42,10 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) XUD_ep ep_out0 = XUD_InitEp(c_ep_out[TEST_EP_NUM]); XUD_SetReady_Out(ep_out0, buffer0[bufferIndex[0]++]); - + XUD_ep ep_out1 = XUD_InitEp(c_ep_out[TEST_EP_NUM+1]); XUD_SetReady_Out(ep_out1, buffer1[bufferIndex[1]++]); - + XUD_ep ep_out2 = XUD_InitEp(c_ep_out[TEST_EP_NUM+2]); XUD_SetReady_Out(ep_out2, buffer2[bufferIndex[2]++]); @@ -57,18 +57,18 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) CASE_THEN(c_ep_out[TEST_EP_NUM+2], ep_c) ) { - ep_a: + ep_a: XUD_GetData_Select(c_ep_out[TEST_EP_NUM], ep_out0, &length, &result); - + if (length != pktLength[0]++) return 1; XUD_SetReady_Out(ep_out0, buffer0[bufferIndex[0]++]); break; - - ep_b: + + ep_b: XUD_GetData_Select(c_ep_out[TEST_EP_NUM+1], ep_out1, &length, &result); - + if (length != pktLength[1]++) return 1; @@ -76,16 +76,16 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) break; ep_c: - + XUD_GetData_Select(c_ep_out[TEST_EP_NUM+2], ep_out2, &length, &result); - + if (length != pktLength[2]++) return 1; XUD_SetReady_Out(ep_out2, buffer2[bufferIndex[2]++]); break; } - + exit = 1; for (size_t i = 0; i < 3; i++) { @@ -114,7 +114,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) printstr("Mismatch:"); printhexln(buffer1[i][j]); return 1; - } + } if(buffer2[i][j] != counter) { printstr("Mismatch:"); diff --git a/tests/test_bulk_rx_traffic/src/main.xc b/tests/test_bulk_rx_traffic/src/main.xc index 7dd2beac..6ed4a974 100644 --- a/tests/test_bulk_rx_traffic/src/main.xc +++ b/tests/test_bulk_rx_traffic/src/main.xc @@ -32,10 +32,10 @@ int main() #endif { chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; - + par { - { + { XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_TEST_SPEED, XUD_PWR_BUS); @@ -54,12 +54,12 @@ int main() XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); - + if(fail) TerminateFail(fail); else - TerminatePass(fail); - + TerminatePass(fail); + } } diff --git a/tests/test_bulk_tx_badack/src/main.xc b/tests/test_bulk_tx_badack/src/main.xc index 7c6c170f..70cc6dc8 100644 --- a/tests/test_bulk_tx_badack/src/main.xc +++ b/tests/test_bulk_tx_badack/src/main.xc @@ -8,7 +8,7 @@ #ifndef PKT_LENGTH_END #define PKT_LENGTH_END (13) #endif - + #define EP_COUNT_OUT (6) #define EP_COUNT_IN (6) @@ -20,7 +20,7 @@ XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, diff --git a/tests/test_bulk_tx_basic/src/main.xc b/tests/test_bulk_tx_basic/src/main.xc index e02b6a9a..675a24f5 100644 --- a/tests/test_bulk_tx_basic/src/main.xc +++ b/tests/test_bulk_tx_basic/src/main.xc @@ -20,7 +20,7 @@ XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, diff --git a/tests/test_bulk_tx_multiep/src/main.xc b/tests/test_bulk_tx_multiep/src/main.xc index 81d5c067..b29e9dbe 100644 --- a/tests/test_bulk_tx_multiep/src/main.xc +++ b/tests/test_bulk_tx_multiep/src/main.xc @@ -14,7 +14,7 @@ XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, diff --git a/tests/test_bulk_tx_multiep_select/src/main.xc b/tests/test_bulk_tx_multiep_select/src/main.xc index 4e1ce797..b9f2cc35 100644 --- a/tests/test_bulk_tx_multiep_select/src/main.xc +++ b/tests/test_bulk_tx_multiep_select/src/main.xc @@ -8,7 +8,7 @@ #define PACKET_LEN_START (10) #define PACKET_LEN_END (19) -#define PACKET_COUNT (PACKET_LEN_END - PACKET_LEN_START + 2) +#define PACKET_COUNT (PACKET_LEN_END - PACKET_LEN_START + 2) /* Check for clashes with TEST_EP and traffic EP */ #if TEST_EP_NUM == 4 @@ -34,7 +34,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) unsigned char buffer[PACKET_COUNT][512]; XUD_Result_t result; unsigned exit = 0; - + unsigned pktLength[TEST_EP_COUNT]; unsigned bufferIndex[TEST_EP_COUNT]; @@ -57,14 +57,14 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) buffer[i][j] = counter++; } length++; - } + } XUD_ep ep_in0 = XUD_InitEp(c_ep_in[TEST_EP_NUM]); XUD_SetReady_In(ep_in0, buffer[bufferIndex[0]++], pktLength[0]++); - + XUD_ep ep_in1 = XUD_InitEp(c_ep_in[TEST_EP_NUM+1]); XUD_SetReady_In(ep_in1, buffer[bufferIndex[1]++], pktLength[1]++); - + XUD_ep ep_in2 = XUD_InitEp(c_ep_in[TEST_EP_NUM+2]); XUD_SetReady_In(ep_in2, buffer[bufferIndex[2]++], pktLength[2]++); @@ -75,7 +75,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) case XUD_SetData_Select(c_ep_in[TEST_EP_NUM], ep_in0, result): XUD_SetReady_In(ep_in0, buffer[bufferIndex[0]++], pktLength[0]++); break; - + case XUD_SetData_Select(c_ep_in[TEST_EP_NUM+1], ep_in1, result): XUD_SetReady_In(ep_in1, buffer[bufferIndex[1]++], pktLength[1]++); break; @@ -84,7 +84,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) XUD_SetReady_In(ep_in2, buffer[bufferIndex[2]++], pktLength[2]++); break; } - + exit = 1; for (size_t i = 0; i < 3; i++) { diff --git a/tests/test_bulk_tx_multiep_select_c/src/test.c b/tests/test_bulk_tx_multiep_select_c/src/test.c index eae92513..b917ab43 100644 --- a/tests/test_bulk_tx_multiep_select_c/src/test.c +++ b/tests/test_bulk_tx_multiep_select_c/src/test.c @@ -7,7 +7,7 @@ #define PACKET_LEN_START (10) #define PACKET_LEN_END (19) -#define PACKET_COUNT (PACKET_LEN_END - PACKET_LEN_START + 2) +#define PACKET_COUNT (PACKET_LEN_END - PACKET_LEN_START + 2) /* Check for clashes with TEST_EP and traffic EP */ #if TEST_EP_NUM == 4 @@ -29,7 +29,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) unsigned char buffer[PACKET_COUNT][512]; XUD_Result_t result; unsigned exit = 0; - + unsigned pktLength[TEST_EP_COUNT]; unsigned bufferIndex[TEST_EP_COUNT]; @@ -50,7 +50,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) buffer[i][j] = counter++; } length++; - } + } XUD_ep ep_in0 = XUD_InitEp(c_ep_in[TEST_EP_NUM]); XUD_ep ep_in1 = XUD_InitEp(c_ep_in[TEST_EP_NUM+1]); @@ -59,30 +59,30 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) XUD_SetReady_In(ep_in0, buffer[bufferIndex[0]++], pktLength[0]++); XUD_SetReady_In(ep_in1, buffer[bufferIndex[1]++], pktLength[1]++); XUD_SetReady_In(ep_in2, buffer[bufferIndex[2]++], pktLength[2]++); - + while(!exit) { SELECT_RES( - CASE_THEN(c_ep_in[TEST_EP_NUM], ep_a), - CASE_THEN(c_ep_in[TEST_EP_NUM+1], ep_b), + CASE_THEN(c_ep_in[TEST_EP_NUM], ep_a), + CASE_THEN(c_ep_in[TEST_EP_NUM+1], ep_b), CASE_THEN(c_ep_in[TEST_EP_NUM+2], ep_c)) { - ep_a: + ep_a: XUD_SetData_Select(c_ep_in[TEST_EP_NUM], ep_in0, &result); XUD_SetReady_In(ep_in0, buffer[bufferIndex[0]++], pktLength[0]++); break; - ep_b: + ep_b: XUD_SetData_Select(c_ep_in[TEST_EP_NUM+1], ep_in1, &result); XUD_SetReady_In(ep_in1, buffer[bufferIndex[1]++], pktLength[1]++); break; - ep_c: + ep_c: XUD_SetData_Select(c_ep_in[TEST_EP_NUM+2], ep_in2, &result); XUD_SetReady_In(ep_in2, buffer[bufferIndex[2]++], pktLength[2]++); break; } - + exit = 1; for (size_t i = 0; i < TEST_EP_COUNT; i++) { @@ -92,7 +92,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) } } } - + // TODO do we need to do any checking? return 0; } diff --git a/tests/test_control_basic_set/src/main.xc b/tests/test_control_basic_set/src/main.xc index 6e021b02..e0747619 100644 --- a/tests/test_control_basic_set/src/main.xc +++ b/tests/test_control_basic_set/src/main.xc @@ -13,7 +13,7 @@ int TestEp_Control(XUD_ep c_ep0_out, XUD_ep c_ep0_in, int epNum) { unsigned int slength; unsigned int length; - + XUD_Result_t sres; XUD_Result_t res; @@ -45,7 +45,7 @@ int TestEp_Control(XUD_ep c_ep0_out, XUD_ep c_ep0_in, int epNum) { return 1; } - + if(RxDataCheck(buffer, length, epNum, 10)) { return 1; diff --git a/tests/test_device_attach/src/main.xc b/tests/test_device_attach/src/main.xc index 3733fbbe..89eff721 100644 --- a/tests/test_device_attach/src/main.xc +++ b/tests/test_device_attach/src/main.xc @@ -38,7 +38,7 @@ int main() #endif { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - + par { XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, @@ -47,15 +47,15 @@ int main() { unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); - + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); - + if(fail) TerminateFail(fail); else - TerminatePass(fail); - + TerminatePass(fail); + } } diff --git a/tests/test_disabled_ep/src/test.xc b/tests/test_disabled_ep/src/test.xc index b565c3cd..6b667f19 100644 --- a/tests/test_disabled_ep/src/test.xc +++ b/tests/test_disabled_ep/src/test.xc @@ -26,7 +26,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) uint8_t inBuffer0[128]; unsigned length; XUD_Result_t result; - + for(size_t i = 0; i < PKT_LENGTH_START; i++) { inBuffer0[i] = i; @@ -34,7 +34,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) XUD_ep ep_out = XUD_InitEp(c_ep_out[TEST_EP_NUM]); XUD_ep ep_in = XUD_InitEp(c_ep_in[TEST_EP_NUM]); - + result = XUD_GetBuffer(ep_out, outBuffer0, length); failed = (result != XUD_RES_OKAY); @@ -43,7 +43,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) result = XUD_GetBuffer(ep_out, outBuffer0, length); failed = (result != XUD_RES_OKAY); - + return failed; } diff --git a/tests/test_invalidtoken/src/main.xc b/tests/test_invalidtoken/src/main.xc index 072a718b..3fa8eb10 100644 --- a/tests/test_invalidtoken/src/main.xc +++ b/tests/test_invalidtoken/src/main.xc @@ -9,7 +9,7 @@ #define EP_COUNT_OUT (6) #define EP_COUNT_IN (6) -XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, +XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, @@ -36,7 +36,7 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) unsigned char buffer[1024]; for(int i = 10; i <= 14; i++) - { + { XUD_GetBuffer(ep_out, buffer, length); RxDataCheck(buffer, length, epNum, i); @@ -52,7 +52,7 @@ int main() par { - + XUD_Main( c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); diff --git a/tests/test_iso_loopback/src/main.xc b/tests/test_iso_loopback/src/main.xc index f2308822..b7124684 100644 --- a/tests/test_iso_loopback/src/main.xc +++ b/tests/test_iso_loopback/src/main.xc @@ -33,7 +33,7 @@ int TestEp_LoopbackForever(chanend c_out1, chanend c_in1) { XUD_GetBuffer(ep_out1, buffer, length); XUD_SetBuffer(ep_in1, buffer, length); - + XUD_GetBuffer(ep_out1, buffer, length); XUD_SetBuffer(ep_in1, buffer, length); } @@ -57,7 +57,7 @@ int TestEp_LoopbackOnce(chanend c_out, chanend c_in, chanend c_out_0) /* Allow a little time for Tx data to make it's way of the port - important for FS tests */ { - timer t; + timer t; unsigned time; t :> time; t when timerafter(time + 500) :> int _; diff --git a/tests/test_iso_rxtx_fastpacket/src/main.xc b/tests/test_iso_rxtx_fastpacket/src/main.xc index 9d638e8c..161d1ec2 100644 --- a/tests/test_iso_rxtx_fastpacket/src/main.xc +++ b/tests/test_iso_rxtx_fastpacket/src/main.xc @@ -23,19 +23,19 @@ int main() par { - + XUD_Main( c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); - + { TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); /* Allow a little time for Tx data to make it's way of the port - important for FS tests */ { - timer t; + timer t; unsigned time; t :> time; t when timerafter(time + 500) :> int _; diff --git a/tests/test_iso_tx_basic/src/main.xc b/tests/test_iso_tx_basic/src/main.xc index e44a8988..d8123349 100644 --- a/tests/test_iso_tx_basic/src/main.xc +++ b/tests/test_iso_tx_basic/src/main.xc @@ -25,7 +25,7 @@ XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO}; -XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, diff --git a/tests/test_ping_rx_basic/src/main.xc b/tests/test_ping_rx_basic/src/main.xc index ba05e7e4..fc3151cf 100644 --- a/tests/test_ping_rx_basic/src/main.xc +++ b/tests/test_ping_rx_basic/src/main.xc @@ -16,14 +16,14 @@ int TestEp_PingTest(XUD_ep ep_out1, XUD_ep ep_out2, int epNum1, int epNum2) unsigned char buffer[1024]; int i = 10; - + XUD_GetBuffer(ep_out1, buffer, length); if(RxDataCheck(buffer, length, epNum1, i)) { return FAIL_RX_DATAERROR; } - + XUD_GetBuffer(ep_out2, buffer, length); if(RxDataCheck(buffer, length, epNum2, i)) @@ -38,7 +38,7 @@ int TestEp_PingTest(XUD_ep ep_out1, XUD_ep ep_out2, int epNum1, int epNum2) { return FAIL_RX_DATAERROR; } - + return 0; } @@ -57,16 +57,16 @@ int main() { XUD_ep ep_out1 = XUD_InitEp(c_ep_out[CTRL_EP_NUM]); XUD_ep ep_out2 = XUD_InitEp(c_ep_out[TEST_EP_NUM]); - + unsigned fail = TestEp_PingTest(ep_out1, ep_out2, CTRL_EP_NUM, TEST_EP_NUM); - + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); - + if(fail) TerminateFail(fail); else - TerminatePass(fail); + TerminatePass(fail); } } diff --git a/tests/test_ping_stall/src/main.xc b/tests/test_ping_stall/src/main.xc index ba19cdb6..25b6b74f 100644 --- a/tests/test_ping_stall/src/main.xc +++ b/tests/test_ping_stall/src/main.xc @@ -8,7 +8,7 @@ #define PKT_LENGTH_START (10) #endif -#ifndef CTRL_EP_NUM +#ifndef CTRL_EP_NUM #define CTRL_EP_NUM (TEST_EP_NUM + 1) #endif @@ -23,28 +23,28 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) uint8_t outBuffer[128]; unsigned length; XUD_Result_t result; - + /* Stall test EP */ XUD_ep ep_out = XUD_InitEp(c_ep_out[TEST_EP_NUM]); XUD_SetStall(ep_out); - + XUD_ep ep_ctrl = XUD_InitEp(c_ep_out[CTRL_EP_NUM]); /* Valid transaction on another EP, clear STALL on the test EP's */ result = XUD_GetBuffer(ep_ctrl, outBuffer, length); failed = (result != XUD_RES_OKAY); - - /* Clear stall on the test EP's */ + + /* Clear stall on the test EP's */ XUD_ClearStall(ep_out); /* Ensure test EP's now operate as expected */ result = XUD_GetBuffer(ep_out, outBuffer, length); failed |= (result != XUD_RES_OKAY); - + result = XUD_GetBuffer(ep_out, outBuffer, length); failed |= (result != XUD_RES_OKAY); return failed; -} +} #include "test_main.xc" diff --git a/tests/test_shorttoken/src/main.xc b/tests/test_shorttoken/src/main.xc index 3b8c41c5..ab6cce55 100644 --- a/tests/test_shorttoken/src/main.xc +++ b/tests/test_shorttoken/src/main.xc @@ -29,7 +29,7 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) unsigned char buffer[1024]; for(int i = 10; i <= 11; i++) - { + { XUD_GetBuffer(ep_out, buffer, length); if(length != i) @@ -56,7 +56,7 @@ int main() par { - + XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); diff --git a/tests/test_sof_badcrc/src/main.xc b/tests/test_sof_badcrc/src/main.xc index f5030961..83f929db 100644 --- a/tests/test_sof_badcrc/src/main.xc +++ b/tests/test_sof_badcrc/src/main.xc @@ -44,8 +44,8 @@ int TestEp(chanend c_out, chanend c_in, int epNum, chanend c_sof) /* Receive SOFs */ /* Host sends 5 SOFs, but one has its CRC nobbled so we should only see 4. */ - for (int i = 0; i< 5; i++) - { + for (int i = 0; i< 5; i++) + { if(i == 3) continue; @@ -94,19 +94,19 @@ int main() par { - + XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, c_sof, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); { unsigned fail = TestEp(c_ep_out[1], c_ep_in[1], 1, c_sof); - + if(fail) TerminateFail(fail); else - TerminatePass(fail); - + TerminatePass(fail); + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); exit(0); diff --git a/tests/test_sof_basic/src/main.xc b/tests/test_sof_basic/src/main.xc index d2e65663..e02079e1 100644 --- a/tests/test_sof_basic/src/main.xc +++ b/tests/test_sof_basic/src/main.xc @@ -38,7 +38,7 @@ unsigned TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_sof) } /* Receive SOFs */ - for (int i = 0; i< 5; i++) + for (int i = 0; i< 5; i++) frames[i] = inuint(c_sof); XUD_GetBuffer(ep_out, buffer, length); @@ -77,21 +77,21 @@ int main() par { - + XUD_Main( c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, c_sof, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); { unsigned fail = TestEp_Bulk(c_ep_out[TEST_EP_NUM], c_ep_in[TEST_EP_NUM], TEST_EP_NUM, c_sof); - + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); if(fail) TerminateFail(fail); else - TerminatePass(fail); + TerminatePass(fail); } } diff --git a/tests/test_stall_basic/src/main.xc b/tests/test_stall_basic/src/main.xc index a59bd860..1b13d346 100644 --- a/tests/test_stall_basic/src/main.xc +++ b/tests/test_stall_basic/src/main.xc @@ -19,7 +19,7 @@ #error #endif -#ifndef CTRL_EP_NUM +#ifndef CTRL_EP_NUM #define CTRL_EP_NUM (TEST_EP_NUM + 1) #endif @@ -64,7 +64,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) uint8_t inBuffer2[128]; unsigned length; XUD_Result_t result; - + for(size_t i = 0; i < PKT_LENGTH_START; i++) { inBuffer0[i] = i; @@ -75,12 +75,12 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) XUD_ep ep_out = XUD_InitEp(c_ep_out[TEST_EP_NUM]); XUD_ep ep_in = XUD_InitEp(c_ep_in[TEST_EP_NUM]); XUD_ep ep_ctrl = XUD_InitEp(c_ep_out[CTRL_EP_NUM]); - + /* Valid transaction on test OUT EP */ /* This is somewhat important as this will toggle the expected PID - which should be reset on an un-stall */ result = XUD_GetBuffer(ep_out, outBuffer, length); failed = (result != XUD_RES_OKAY); - + checkPacket(length, outBuffer); result = XUD_SetBuffer(ep_in, inBuffer0, PKT_LENGTH_START); @@ -98,21 +98,21 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { printstr("ERROR: Bad packet length\n"); } - - /* Clear stall on the test EP's */ + + /* Clear stall on the test EP's */ XUD_ClearStall(ep_out); XUD_ClearStall(ep_in); /* Ensure test EP's now operate as expected */ result = XUD_GetBuffer(ep_out, outBuffer, length); failed |= (result != XUD_RES_OKAY); - + checkPacket(length, outBuffer); - + result = XUD_SetBuffer(ep_in, inBuffer1, PKT_LENGTH_START); failed |= (result != XUD_RES_OKAY); - /* Stall both EP's using Addr */ + /* Stall both EP's using Addr */ XUD_SetStallByAddr(TEST_EP_NUM); XUD_SetStallByAddr(TEST_EP_NUM | 0x80); @@ -127,14 +127,14 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) /* Ensure test EP's now operate as expected */ result = XUD_GetBuffer(ep_out, outBuffer, length); failed |= (result != XUD_RES_OKAY); - + checkPacket(length, outBuffer); result = XUD_SetBuffer(ep_in, inBuffer2, PKT_LENGTH_START); failed |= (result != XUD_RES_OKAY); return failed; -} +} #include "test_main.xc" diff --git a/tests/test_stall_control/src/main.xc b/tests/test_stall_control/src/main.xc index 266e58b8..8e323db2 100644 --- a/tests/test_stall_control/src/main.xc +++ b/tests/test_stall_control/src/main.xc @@ -13,7 +13,7 @@ int TestEp_Control(XUD_ep ep0_out, XUD_ep ep0_in, int epNum) { unsigned int slength; unsigned int length; - + XUD_Result_t sres; XUD_Result_t res; @@ -43,12 +43,12 @@ int TestEp_Control(XUD_ep ep0_out, XUD_ep ep0_in, int epNum) { return 1; } - + if(RxDataCheck(buffer, length, epNum, 10)) { return 1; } - + sres = XUD_GetSetupBuffer(ep0_out, sbuffer, slength); /* Stall the EP(s) as if the request was not recognised */ @@ -61,7 +61,7 @@ int TestEp_Control(XUD_ep ep0_out, XUD_ep ep0_in, int epNum) res = SendTxPacket(ep0_in, 10, epNum); res = XUD_GetBuffer(ep0_out, buffer, length); - + return 0; } @@ -73,7 +73,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) unsigned failed = TestEp_Control(ep0_out, ep0_in, 0); XUD_Kill(ep0_out); - + return failed; } #include "test_main.xc" diff --git a/tests/test_stall_control_epready/src/main.xc b/tests/test_stall_control_epready/src/main.xc index 5ac3f52e..c626fb2a 100644 --- a/tests/test_stall_control_epready/src/main.xc +++ b/tests/test_stall_control_epready/src/main.xc @@ -15,10 +15,10 @@ int TestEp_Control(XUD_ep ep0_out, XUD_ep ep0_in, int epNum) unsigned int slength1; unsigned char sbuffer0[128]; unsigned char sbuffer1[128]; - + unsigned int length; unsigned char buffer[128]; - + XUD_Result_t sres; XUD_Result_t res; @@ -29,7 +29,7 @@ int TestEp_Control(XUD_ep ep0_out, XUD_ep ep0_in, int epNum) XUD_SetStall(ep0_in); sres |= XUD_GetSetupBuffer(ep0_out, sbuffer1, slength1); - + /* Host will send an out here - which we expect to stall */ /* Issue #339 means it is acked */ @@ -63,7 +63,7 @@ int TestEp_Control(XUD_ep ep0_out, XUD_ep ep0_in, int epNum) { return 1; } - + return 0; } @@ -76,7 +76,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) unsigned failed = TestEp_Control(ep0_out, ep0_in, 0); XUD_Kill(ep0_out); - + return failed; } #include "test_main.xc" diff --git a/tests/test_stall_epready_in/src/main.xc b/tests/test_stall_epready_in/src/main.xc index 5136c936..34222015 100644 --- a/tests/test_stall_epready_in/src/main.xc +++ b/tests/test_stall_epready_in/src/main.xc @@ -13,7 +13,7 @@ #define TEST_EP_NUM (1) #endif -#ifndef CTRL_EP_NUM +#ifndef CTRL_EP_NUM #define CTRL_EP_NUM (TEST_EP_NUM + 1) #endif @@ -29,7 +29,7 @@ unsigned test_ctrl(chanend c_ctrl, chanend c) unsigned length; XUD_Result_t result; uint32_t failed = 0; - + XUD_ep ep_ctrl = XUD_InitEp(c_ctrl); c <: 1; @@ -43,12 +43,12 @@ unsigned test_ctrl(chanend c_ctrl, chanend c) XUD_GetBuffer(ep_ctrl, ctrlBuffer, length); failed |= (length != PKT_LENGTH_START); - + XUD_SetStallByAddr(TEST_EP_NUM | 0x80); - + XUD_GetBuffer(ep_ctrl, ctrlBuffer, length); failed |= (length != PKT_LENGTH_START); - + XUD_ClearStallByAddr(TEST_EP_NUM | 0x80); return failed; @@ -63,7 +63,7 @@ unsigned test_ep(chanend c_ep_out, chanend c_ep_in, chanend c) unsigned length = PKT_LENGTH_START; XUD_Result_t result; unsigned x = 0; - + for(size_t i = 0; i < 3; i++) { for(size_t j = 0; j < length; j++) @@ -72,7 +72,7 @@ unsigned test_ep(chanend c_ep_out, chanend c_ep_in, chanend c) } length++; } - + length = PKT_LENGTH_START; XUD_ep ep_in = XUD_InitEp(c_ep_in); @@ -80,18 +80,18 @@ unsigned test_ep(chanend c_ep_out, chanend c_ep_in, chanend c) c :> x; - /* First test marking EP ready whilst halted + /* First test marking EP ready whilst halted * Then subsequently marked un-halted - this should pause until un-halted */ XUD_SetBuffer(ep_in, inBuffer[0], length++); - + /* Additional normal IN transaction */ XUD_SetBuffer(ep_in, inBuffer[1], length++); - c :> x; + c :> x; /* Next test EP marked ready then subsequently marked as halted */ XUD_SetBuffer(ep_in, inBuffer[2], length); - + /* TODO not currently set */ return failed; } @@ -109,6 +109,6 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) } return failedCtrl | failedEp; -} +} #include "test_main.xc" diff --git a/tests/test_stall_epready_out/src/main.xc b/tests/test_stall_epready_out/src/main.xc index ba85e424..47cd450f 100644 --- a/tests/test_stall_epready_out/src/main.xc +++ b/tests/test_stall_epready_out/src/main.xc @@ -13,7 +13,7 @@ #define TEST_EP_NUM (1) #endif -#ifndef CTRL_EP_NUM +#ifndef CTRL_EP_NUM #define CTRL_EP_NUM (TEST_EP_NUM + 1) #endif @@ -29,7 +29,7 @@ unsigned test_ctrl(chanend c_ctrl, chanend c) unsigned length; XUD_Result_t result; uint32_t failed = 0; - + XUD_ep ep_ctrl = XUD_InitEp(c_ctrl); c <: 1; @@ -43,12 +43,12 @@ unsigned test_ctrl(chanend c_ctrl, chanend c) XUD_GetBuffer(ep_ctrl, ctrlBuffer, length); failed |= (length != PKT_LENGTH_START); - + XUD_SetStallByAddr(TEST_EP_NUM); - + XUD_GetBuffer(ep_ctrl, ctrlBuffer, length); failed |= (length != PKT_LENGTH_START); - + XUD_ClearStallByAddr(TEST_EP_NUM); return failed; @@ -61,24 +61,24 @@ unsigned test_ep(chanend c_ep_out, chanend c) unsigned length; XUD_Result_t result; unsigned x; - + XUD_ep ep_out = XUD_InitEp(c_ep_out); XUD_SetStall(ep_out); c :> x; - /* First test marking EP ready whilst halted + /* First test marking EP ready whilst halted Then subsequently marked un-halted - this should pause until un-halted */ XUD_GetBuffer(ep_out, outBuffer, length); - - /* Additional normal OUT transaction */ + + /* Additional normal OUT transaction */ XUD_GetBuffer(ep_out, outBuffer, length); - c :> x; + c :> x; /* Next test EP marked ready then subsequently marked as halted */ XUD_GetBuffer(ep_out, outBuffer, length); - + return failed; } @@ -96,6 +96,6 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) } return failedCtrl | failedEp; -} +} #include "test_main.xc" diff --git a/tests/test_suspend_resume/src/main.xc b/tests/test_suspend_resume/src/main.xc index 182e6266..7b8f412e 100644 --- a/tests/test_suspend_resume/src/main.xc +++ b/tests/test_suspend_resume/src/main.xc @@ -37,7 +37,7 @@ int main() #endif { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - + par { XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, @@ -45,15 +45,15 @@ int main() { unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); - + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); - + if(fail) TerminateFail(fail); else - TerminatePass(fail); - + TerminatePass(fail); + } } diff --git a/tests/test_suspend_resume_invalidls/src/main.xc b/tests/test_suspend_resume_invalidls/src/main.xc index 5b48661d..06d8c36b 100644 --- a/tests/test_suspend_resume_invalidls/src/main.xc +++ b/tests/test_suspend_resume_invalidls/src/main.xc @@ -37,7 +37,7 @@ int main() #endif { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - + par { XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, @@ -46,15 +46,15 @@ int main() { unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); - + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); - + if(fail) TerminateFail(fail); else - TerminatePass(fail); - + TerminatePass(fail); + } } diff --git a/tests/test_suspend_resume_mid_trans/src/main.xc b/tests/test_suspend_resume_mid_trans/src/main.xc index 01f02b6b..ac0d7c77 100644 --- a/tests/test_suspend_resume_mid_trans/src/main.xc +++ b/tests/test_suspend_resume_mid_trans/src/main.xc @@ -27,7 +27,7 @@ #endif /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT]; +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT]; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN]; #ifdef XUD_SIM_RTL @@ -37,16 +37,16 @@ int main() #endif { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - + assert((TEST_EP_NUM + 1) < XUD_EP_COUNT_OUT); assert((TEST_EP_NUM + 1) < XUD_EP_COUNT_IN); - + epTypeTableOut[0] = XUD_EPTYPE_CTL; epTypeTableIn[0] = XUD_EPTYPE_CTL; for(int i = 1; i < XUD_EP_COUNT_OUT; i++) epTypeTableOut[i] = XUD_EPTYPE_BUL; - + for(int i = 1; i < XUD_EP_COUNT_IN; i++) epTypeTableIn[i] = XUD_EPTYPE_BUL; @@ -61,14 +61,14 @@ int main() { unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); fail |= TestEp_Rx(c_ep_out[TEST_EP_NUM + 1], TEST_EP_NUM + 1, PKT_LENGTH_START, PKT_LENGTH_END); - + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); - + if(fail) TerminateFail(fail); else - TerminatePass(fail); + TerminatePass(fail); } } diff --git a/tests/test_unused_ep/src/test.xc b/tests/test_unused_ep/src/test.xc index 821e67f4..06b20d33 100644 --- a/tests/test_unused_ep/src/test.xc +++ b/tests/test_unused_ep/src/test.xc @@ -24,7 +24,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) uint8_t inBuffer0[128]; unsigned length; XUD_Result_t result; - + for(size_t i = 0; i < PKT_LENGTH_START; i++) { inBuffer0[i] = i; @@ -32,7 +32,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) XUD_ep ep_out = XUD_InitEp(c_ep_out[TEST_EP_NUM]); XUD_ep ep_in = XUD_InitEp(c_ep_in[TEST_EP_NUM]); - + result = XUD_GetBuffer(ep_out, outBuffer0, length); failed = (result != XUD_RES_OKAY); @@ -41,7 +41,7 @@ unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) result = XUD_GetBuffer(ep_out, outBuffer0, length); failed = (result != XUD_RES_OKAY); - + return failed; }