| Electronic Components Datasheet Search |
|
UM0290 Datasheet(PDF) 21 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
UM0290 Datasheet(HTML) 21 Page - STMicroelectronics |
|
21 / 76 page ![]() UM0290 STR7/STR9 USB firmware library 21/76 1.4 Implementing a USB application using the STR7/9 USB library 1.4.1 Implementing a no data class specific request All class-specific requests without a data transfer phase implement the field RESULT (*Class_NoData_Setup)(BYTE RequestNo) of the structure device property. The USBbRequest of the request is available in the parameter RequestNo and all other request fields are stored in the device info structure. The user has to implement the test of all request fields. If the request is compliant with the class to implement the function must return the USB_SUCCESS result. However if there is any problem in the request the function returns the status UNSUPPORT result and the library responds with a STALL handshake. 1.4.2 How to implement a data class specific request In the event of class requests requiring a data transfer phase, the user implementation reports to the USB library the length of the data to transfer and the data location in the internal memory (RAM in case of receiving the data from the host and RAM or Flash in case of sending data to the host). This type of request is managed in the function RESULT (*Class_NoData_Setup)(BYTE RequestNo) . The user has to create for each class data request a specific function with the format: u8* My_First_Data_Request (u16 Length) If this function is called with the parameter Length equal to zero, it sets the pInformation->Ctrl_Info.Usb_wLength field with the length of data to transfer and return a NULL pointer. In other cases it returns the address of the data to transfer. The following C code shows a simple example: u8* My_First_Data_Request (u16 Length) { if (Length == 0) { pInformation->Ctrl_Info.Usb_wLength = My_Data_Length; return NULL; } else return (&My_Data_Buffer); } The function RESULT (*Class_NoData_Setup)(BYTE RequestNo) manages all data requests as described in the following C code: RESULT Class_Data_Setup(u8 RequestNo) { u8 *(*CopyRoutine)(u16); CopyRoutine = NULL; if (My_First_Condition)// test the filds of the first request CopyRoutine = My_First_Data_Request; else if(My_Second_Condition) // test the filds of the second request CopyRoutine = My_Second_Data_Request; /* ... same implementation for each class data requests ... */ if (CopyRoutine == NULL) return USB_UNSUPPORT; |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |