Home
high integrity systems USB HOST - Wittenstein High Integrity Systems
Contents
1. UINT32 USBH_BulkTx USBH_EP pep void obuf UINT32 buf_len UINT32 timeout_ms INTERR perr Arguments pep A pointer to endpoint structure through which the bulk data is to be sent pbuf A pointer to the buffer into which the bulk data to transfer should be placed buf_len The size of the buffer Dmeout ms The timeout in milliseconds perr USBH_ERR_NONE if the transfer was successful Otherwise an Error Code as outlined in Appendix A Return Value The number of bytes sent to the device CONNECT USB Host WITTENSTEIN high integrity systems Page 78 6 4 2 Synchronous Receive USBH_BulkRx This function is used to receive bulk data from the device to host The endpoint must be of type USB_EP_TYPE_BULK and direction must be USB_EP_DIR_IN UINT32 USBH_BulkTx USBH_EP pep void obuf UINT32 buf_len UINT32 timeout_ms INTERR perr UR Argument pep A pointer to an endpoint structure pbuf A pointer to the buffer into which the received bulk data will be placed buf_len The size of the buffer Dmeout ms The timeout in milliseconds perr USBH_ERR_NONE if the transfer was successful otherwise an Error code as outlined in Appendix A Return Value The number of bytes received by the device CONNECT USB Host WITTENSTEIN high integrity systems Page 79 6 4 3 Asynchronous Transmit USBH_BulkTxAsync Issues a bulk send request to the device This function returns immediately and the async
2. USB_CONFIGURATION USB_CONFIGURATION USB_CONFIGURATION USB_CONFIGURATION USB_CONFIGURATION FIGURE 5 1 EXAMPLE USB DESCRIPTORS HIERARCHY CONNECT USB Host WITTENSTEIN high integrity systems Page 44 5 1 USB Device descriptor access API The functions listed in Table 5 1 are used to access the descriptors from a connected USB device to determine its capabilities TABLE 5 1 DEVICE CONFIGURATION FUNCTIONS Function Description USBH_NbrCfgsGet Returns the number of configurations supported by the CONNECT USB Host WITTENSTEIN high integrity systems Returns the specified configuration of a USB device Returns the specified extra descriptor present in the standard configuration descriptor Returns the number of interfaces in configuration the specified Returns the number of alternate settings supported by the specified interface Get the interface descriptor at specified alternate setting index Returns the specified extra descriptor present in the standard interface descriptor Returns the number of endpoints in the specified alternate setting Page 45 TABLE 5 2 DEVICE CONFIGURATION STRUCTURES Structure Represents USBH_DEV A USB device USBH_CFG A single configuration supported by the USB device USBH_IF A single interface USBH_EP A single endpoint 5 1 1 Get Number of Configurations USBH_NbrCfgsGet Th
3. USBH BulkInOpen o bulk dev gt DevPtr i owls Glew seers kp bulk dev gt BulkInEP USBH BulkOutOpen p_bulk dev gt DevPtr EE amp p bulk dev gt BulkOut p err USB_ERR NONE ceruan voie p bulk cev else p err USB ERR CLASS DRV_NOT FOUND return void 0 CONNECT USB Host WITTENSTEIN high integrity systems Page 38 Note 8 Get the interface descriptor Note 9 Check if the interface class code matches Bulk class code Note 10 Allocate the Bulk class device structure Note 11 Set the class device state to connected state Note 12 Open Bulk IN endpoint Note13 Open Bulk OUT endpoint Note 14 Return Bulk class device structure Note 15 Interface class code did not match Set the error code and return 0 The USBH_BULK_Disconn function is called by the application when the device is connected This function must be called before accessing the Bulk driver API static INTERR USBH BULK Disconn USBH BULK DEV p bulk dev OSL MutexLock amp p_ bulk _dev gt HMutex plbulkidev gt gt state USBH CLASS DEV Ss TATE DESCONN NOTE 16 OSL MutexUnlock e Jee Eltre return USB_ERR_NONE Note 16 The device is disconnected Set the class device state as disconnected CONNECT USB Host WITTENSTEIN high integrity systems Page 39 The USBH_BULK_Init function is called by the application when the device is connected This function must be ca
4. CONNECT USB Host WITTENSTEIN high integrity systems Invalid thread priority Page 209 CONNECT USB Host WITTENSTEIN high integrity systems Mbox put null pointer Message queue creation failed Message queue destroy ISR error Message queue destroy task waiting Message timeout queue get Message queue get locked Message queue get aborted Page 210 4049 USB_ERR_MSG_Q_ UNKNOWN Unknown message CONNECT USB Host WITTENSTEIN high integrity systems Page 211 CONNECT USB Host WITTENSTEIN high integrity systems P WITTENSTEIN highintegritysystems Americas 1 408 625 4712 ROTW 44 1275 395 600 Email sales highintegritysystems com Headquarters WITTENSTEIN high integrity systems Brown s Court Long Ashton Business Park Bristol BS41 9LB UK www highintegritysystems com Page 212
5. PDLInit Initializes PDL module PageOrientationSetCmdFr Frames the command to set the page orientation PageLeftMarginSetCmdFr Frames the command to set the page left margin PageRightMarginSetCmdFr Frames the command to set the page right margin PageTopMarginSetCmdFr Frames the command to set the page top margin PageMarginsClearCmdFr Frames the command to clear the margins PageLineSpacingSetCmdFr Frames the command to set the page line spacing PageNbrCopiesSetCmdFr Frames the command to set the number of copies of each page FontWeightSetCmdFr Frames the command to set the weight the font FontHeightSetCmdFr Frames the command to set the height of the font FontUnderlineSetCmdFr Frames the command to set the automatic font underlining FontUnderlineClearCmdFr Frames the command to clear the automatic font underlining FontReqTxCmdFr Frames the command to retrieve the available font list ImageRowHdrSetCmdFr Frames the command to set the row header of the image data PDLStatusParse Parses the status response obtained from the printer PDLId Page Description Language Identifier 9 5 Page Description Language Routines 9 5 1 Initialize PDL This function initializes the supported page description language CONNECT USB Host WITTENSTEIN high integrity systems Page 137
6. This function returns PCM format associated with the USB stream interface USBH_ AUDIO STREAM USBH AUDIO StreamFormatGet USBH AUDIO DEV p_audio_dev USBH_ AUDIO STREAM p stream X Arguments p_audio_dev Pointer to the audio device p_stream Pointer to USB stream interface Return Value Format of the audio stream CONNECT USB Host WITTENSTEIN high integrity systems Page 178 fe ak Start Stream USBH_AUDIO_StreamStart This function is used to start the audio data transfer INTERR USBH_AUDIO_ StreamStart USBH_AUDIO_DEV p_audio_dev USBH_AUDIO_STREAM p stream UINT32 sample_rate USBH_AUDIO_STREAM audio stream event Call _EVENT_CALLBACK back Void p_callback_data Arguments p audio dev Pointer to the audio device p stream Pointer to USB stream interface sample_rate Audio sample frequency audio_stream_event_callback Stream event callback function p callback_data Callback data Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 179 11 1413 Stop Stream USBH_AUDIO_StreamStop This function is used to stop the audio data transfer INTERR USBH_AUDIO_StreamStop USBH_AUDIO_DEV p_audio_dev USBH_AUDIO_ STREAM p_ stream Arguments p audio dev Pointer to the audio device p stream Pointer to previously started stream Re
7. USBH_HID_Uninit Uninitializes the human interface device USBH_HID_RefAdd Increments the application reference count to human interface devices USBH_HID_RefRel Decrements the application reference count to human interface devices USBH_HID_GetReportIDArray Gets Report ID structure array USBH_HID_GetAppCollArray Gets Application collection structure array USBH_HID_IsBootDev Checks the HID belongs to boot sub class or not USBH_HID_RxReport Receives the report from device USBH_HID_TxReport Transmits the report to device USBH_HID_RegRxCB Registers a callback function to receive reports asynchronously from device USBH_HID_UnregRxCB Unregisters the callback function for a report ID USBH_HID_ProtocolSet Sets the protocol to the device USBH_HID_ProtocolGet Gets the current protocol of the device USBH_HID_IdleSet Sets the Idle rate for given report ID of the device USBH_HID_IdleGet Gets the Idle rate for given report ID of the device CONNECT USB Host WITTENSTEIN high integrity systems Page 104 8 3 1 Initialize HID USBH_HID_Init The application can initialize the Human Interface Device by calling USBH_HID_Init function This function reads the report descriptors and prepares report ID list INTERR USBH_HID_Init USBH_HID_DEV p_hid_ dev _ Arguments p_ hid_dev Pointer t
8. CONNECT USB Host WITTENSTEIN high integrity systems Page 84 6 5 4 Asynchronous Receive USBH_ IntrRxAsync Issues an interrupt receive request to the device This function returns immediately and the asynchronous completion routine is called when I O is completed INTERR USBH_ IntrRxAsync USBH_EP p ep void o_buf UINT32 buf_len USBH_INTR_CMPL_FNCT _ p fnct Void p fnct_arg Argument p ep Pointer to the endpoint p buf Pointer to the data buffer buf_len Number of data bytes in buffer p_fnct Pointer to asynchronous function which will be invoked by the asynchronous I O task when the transfer is complete p fnct_arg Pointer to a variable that will be passed to asynchronous function Return Value USB ERR NONE If the request is submitted USB_ERR_INVALID_ARGS If p_ep is 0 USB_ERR_EP_CLOSED If the endpoint is closed USB_ERR_EP_INVALID If the endpoint type is not Interrupt or direction is not in Otherwise specific error code as define in appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 85 6 6 lsochronous Transfer 6 6 1 Synchronous Transmit USBH_lsocTx The USBH_IsocTx function is used to send isochronous transfer data from the host to the device The endpoint must be of type USB EP_TYPE_ISOC and direction must be USB_EP_DIR_OUT INTERR USBH_IsocTx USBH_EP pep void obuf UINT32 buf_len UINT32 start_frm UINT32 nbr_frms UINT16 p_frm_lens USB_ERR p errs UINT
9. On success returns 0 On failure returns specific error number as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 112 8 3 13 Get the protocol USBH_HID_ProtocolGet This function gets the current protocol boot report descriptor of the device INTERR USBH_HID_ProtocolGet USBH_HID_DEV p_hid_dev UINT OS p_protocol Arguments p_ hid_dev Pointer to USBH_HID_DEV structure p protocol Pointer to hold protocol flag Return Value On success returns 0 On failure returns specific error number as outlined in Appendix A 8 3 14 Set Idle rate USBH_HID_IdleSet This function sets the Idle rate for a given report ID INTERR USBH_HID_lIdleSet USBH_HID_DEV p_hid_dev UINTO8 report_id UINT32 dur Arguments p_hid_dev Pointer to USBH_HID_DEV structure report_id Report ID for which to set the Idle rate Dur Idle rate duration to be set Return Value On success returns 0 On failure returns specific error number as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 113 8 3 15 Get Idle rate USBH_HID_IdleGet This function gets the Idle rate for a given report ID INTERR USBH_HID_IdleGet USBH_HID_DEV p_hid_dev UINTO8 report_id UINT32 p dur Arguments p_hid_dev Pointer to USBH_HID_DEV structure report_id Report ID for which to get Idle rate p dur Pointer to hold Idle rate duration Return
10. CONNECT USB Host WITTENSTEIN high integrity systems Page 108 8 3 8 Receive Report USBH_HID_RxReport This function receives report from device INTERR USBH_HID_RxReport USBH_HID_DEV p_hid_dev UINT OS report jd void p but UINT OS buf_len UINT16 timeout_ms UINT OS pret Ien Arguments p_hid_dev Pointer to USBH_HID_DEV structure report_id Report ID from which you want to receive report p buf Pointer to hold report data received buf_len Number of bytes to receive timeout_ms Timeout period to receive report in milliseconds p_ret_len Pointer to hold number of bytes received Return Value On success returns 0 On failure returns specific error number as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 109 8 3 9 Transmit Report USBH_HID_TxReport This function receives report from device INTERR USBH_HID_TxReport USBH_HID_DEV p_hid_dev UINT OS report jd void o_ buf UINT0O8 buf_len UINT16 timeout_ms UINTO8 p_ret_len Arguments p_hid_dev Pointer to USBH_HID_DEV structure report_id Report ID to transmit report p buf Pointer which hold report data to be transmitted buf_len Number of bytes to transmit timeout_ms Timeout period to receive report in milliseconds p_ret_len Pointer to hold number of bytes transmitted successfully Return Value On success returns 0 On failure returns specific error number as outlined
11. INTERR PDLInit void Arguments void none Return Value USBH_ERR_NONE on successfully initializing the pdl module Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 138 9 5 2 Frame Set Page Orientation Command This function is used to configure the page orientation INTERR PageOrientationSetCmdFr UINTO8 pbuf UINTO8 buf len UINTO8 mode UINTO8 ocmd_len Arguments pbuf Pointer to variable which receives framed command burlen Length of the buffer pointed by pbuf variable mode Page orientation mode value pemd_len Pointer to a variable which receives actual command length Return Value USBH_ERR_NONE on successfully framing the command to set page orientation Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 139 9 5 38 Frame Set Page Left Margin Command This function manages the command to set page left margin INTERR PageLeftMarginSetCmdFr UINTO8 pbuf UINT OS buf_len UINT08 left_margin UINTO8 ocmd_len Arguments pbuf Pointer to variable which receives framed command nuren Length of the buffer pointed by pbuf variable left_margin the value of the page left margin pemd_len Pointer to a variable which receives actual command length Return Value USBH_ERR_NONE on successfully framing the command to set page left margin
12. Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 140 9 5 4 Frame Set Page Right Margin Command This function manages the command to set page right margin INTERR PageRightMarginSetCmdFr UINTO8 pbuf UINTO8 buf len UINTO8 right_margin UINTO8 pcmd_len Arguments pbuf Pointer to variable which receives framed command burlen Length of the buffer pointed by pbuf variable right_margin The value of the page right margin pemd_len Pointer to a variable which receives actual command length Return Value USBH_ERR_NONE on successfully framing the command to set page right margin Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 141 9 5 5 Frame Set Page Top Margin Command This function manages the command to set page top margin INTERR PageTopMarginSetCmdFr UINTO8 pbuf UINTO8 but len UINTOS top_margin UINTO8 pcmd_len IR Arguments pbuf Pointer to variable which receives framed command burlen Length of the buffer pointed by pbuf variable top_margin The value of the page top margin ocmd_len Pointer to a variable which receives actual command length Return Value USBH_ERR_NONE on successfully framing the command to set page top margin Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high i
13. WITTENSTEIN high integrity systems CONNECT Middleware User Manual USB HOST Version 4 4 March 25 2014 Disclaimer The content provided in this document is believed to be accurate but not guaranteed to be entirely free from errors The content of this document is also subject to change While the information herein is assumed to be accurate WITTENSTEIN high integrity systems accepts no liability whatsoever for errors and omissions and assumes that all users understand the risks involved Copyright notice None of the materials provided in this document may be used reproduced or transmitted in any form or by any means without written permission from WITTENSTEIN high integrity systems All rights reserved 2014 WITTENSTEIN aerospace amp simulation Ltd Trademarks Names mentioned in this manual may be trademarks of their respective companies Brand and product names are trademarks or registered trademarks of their respective companies Contact Address WITTENSTEIN high integrity systems www HighIntegritySystems com Brown s Court Yanley Lane sales HighintegritySystems com Long Ashton Business Park Long Ashton Americas 1 408 625 4712 Bristol ROTW 44 1275 395 600 BS41 9LB ENGLAND UK WITTENSTEIN high integrity systems is a trading name of WITTENSTEIN aerospace amp simulation Itd CONNECT USB Host WITTENSTEIN high integrity systems Page 2 About WITTENSTEIN high integrity systems WITTENST
14. define USBH CFG MAX HUB PORTS 4 The host stack can support more than one host controller simultaneously The maximum number of host controllers supported by the platform is defined by USBH_CFG_MAX_NBR_HC define USBH CFG MAX NBR_HC 1 USBH_CFG_MAX_OPENED_EPS defines the maximum number of endpoints that can be opened simultaneously define USBH CFG MAX OPENED EPS 5 USBH_CFG_MAX_DATA_XFER_LEN defines the maximum data length per transfer define SBH_CFG_MAX_DATA_XFER_LEN 2 1024 USBH_CFG_MAX_ISOC_EPS defines the maximum number of isochronous endpoints supported define USBH CFG _MAX_ISOC_EPS 2 USBH_CFG_MAX_ISOC_FRAMES_PER_XFER defines the maximum number of isochronous frames supported per transfer define USBH_CFG_MAX_ISOC_FRAMES PER_XFER 20 USBH_STD_REQ_TIMEOUT defines the standard request timeouts used for descriptors enumeration define USBH STD REQ TIMEOUT 5000 H_STD_REQ_RETRY defines the standard retry timeout used for descriptors enumeration define USBH_STD_REQ_ RETRY 3 CONNECT USB Host WITTENSTEIN high integrity systems Page 25 3 38 USB Host Stack Example The following example shows how to initialize the CONNECT USB Host Stack In this example a RTOS is not being used For more readability of this example error checking in function calls is omitted OSL API App OSL Api ISL Dese te ies Lee ISL DerCwlic
15. function is real ISR function that is registered in a interrupt vector This function is called when the host controller interrupt occurred void USBO_IRQHandler void ie hRCLSOO WSR L ieoeng Ves CPU IIR INC LPC1800 USB _ISRFnct LPC1800 USB_ISRArg NOTE 11 Note 11 Call EHCI driver ISR with its argument The BSP_USB_Host_Uninit function is called when the host stack is uninitialized void BSP_USB Host _Uninit UINTO8 NOTE 12 Note 12 There is nothing to be done for LPC1830 CONNECT USB Host WITTENSTEIN high integrity systems Page 193 13 OS Abstraction CONNECT USB Host assumes the presence of an RTOS The CONNECT USB Host contains an RTOS abstraction layer that provides RTOS services that allows it to be used with just about any commercial or open source OS All components including the applications and the stack use RTOS services from the RTOS abstraction layer It makes them portable across different OS environments Each abstracted class of RTOS objects is associated with a handle which is a data type such as HTHREAD HTIMER HSEM HMUTEX or HMSGQUEUE These are assigned and used only by the RTOS abst adapted to the RTOS in raction layer consequently the appropriate values for each may be use The HTHREAD for example can be assigned the priority of the thread if this is distinct for all threads in the RTOS Handles for other object may be assigned the location of the s
16. 11 1 11 Get Stream Format USBH_AUDIO_StreamFormatGet n 178 11 1 12 Start Stream USBH_AUDIO_StreamStart A 179 11 1 13 Stop Stream USBH_AUDIO_StreamStop A 180 11 1 14 Stream Read USBH_AUDIO_StreamRead A 181 11 1 15 Stream Write USBH_AUDIO_StreamWrite A 182 12 HostContr ller Re 183 12 1 Host Controller Driver Porting Funchons ss ssessessseeeseeeereeterrttrrttertrrrttrrrrrrrrrrrrrrrrent 184 12 1 1 Host Controller structure USPH HOST CNTRUR cece eeeeeeeeeeseeeeeereeeeeeeeee 185 12 1 2 Initialize Host Controller BSP BGbp USp Host In 188 12 1 3 On Reset Host Controller BSP_USB_Host_OnReset eesseeseeeeeerees 188 12 1 4 Register Host Controller ISR BSP_USB_Host_RegisterlISR eeeeeee 189 12 1 5 Unregister Host Controller ISR BSP_USB_Host_UnregisterlSR 5 190 12 1 6 Uninitialize Host Controller BSP_USB_ Host Union 190 12 2 Example EHCI Driver Porting to LPC1830 RENE 191 13 OS Abstracto eisai estas erent acta ee EE 194 Tat Thread Abstracto eienenn a r Oe ee 196 13 1 1 Create Thread OSL_ThreadCreate ccccceeeeeeesseeeceeeeeeeeenseeeeeeeeeenenneeseees 196 13 2 Semaphore Abstraction i eni ere ier o e oeedery dedelends 197 13 2 1 Create Semaphore OSL_SemCreate cccccceeessseecceeeeeeeeseseeeeeeeeeenneeseees 197 13 2 2 Wait on Semaphore OSL_SemWait E 197 CONNECT USB Host WITTENSTEIN high integrity systems Page 12 13 2 3 Post S
17. DEV ales 3 NOTE 6 OSL MutexCreate amp SUSBH BULK DevArr ix HMutex NOTE 7 Dien eerste EM POOL amp USBH BULK DevPool USBH BULK DevArr sizeof USBH BULK DevArr USBH CFG MAX BULK DEV sizeof USBH BULK DEV 0 D GOCESIES recel Ka amp err return err Note 6 Creates a mutex for each BULK class device Note 7 Creates amemory pool for BULK class devices CONNECT USB Host WITTENSTEIN high integrity systems Page 37 The USBH_BULK_ProbelF function is called by the host stack when a device is connected This function should check the interface class code and if the class code matches it returns the Bulk class device structure If the class code does not match it returns O with the erro code set as USB ERR CLAGG DRV_NOT_FOUND If the class driver is not found host stack will continue to probe all other class drivers Cat Wezel V SBH EBUN METODE THRUS BAMEDE js claw USBH IF E Ze INTERR E Snr USI IF Di p ir Cleese USBH_ BUL EN oe gilik dev USBH IFDescGet p if 0 amp p if desc NOTE 8 LE Ip 2k dese lolmeerrace Class USB CLASS CODE BULK NOTE 9 NOTE 10 p_bulk dev USBH BULK DEV Mem PoolBlkGet amp USBH BULK DEVPool sizeof USBH BULK DEV p_err _lIoviills clew gt Sicenee USBH CLASS DEV STATE CONN Poude DEVRE pden Preu Claw S T EPET B Lp
18. Driver framework The host stack provides a framework for managing the class drivers of the USB devices The USB host class drivers are developed as per USB class specifications or vendor specification By default the host stack supports standard classes such as Mass Storage HID CDC Printer and Audio New class drivers can be developed by using this framework USB devices may contain several configurations only one of which may be active at a given time Each of these configurations may contain one or more interfaces several of which may be active at a given time The class driver manages one or more of these interfaces For some devices a single Device Class Driver can manage all interfaces present in the device For others an Interface Class Driver is required for each interface class 4 1 Class Driver Structure The class driver structure contains the callback function pointers to the class driver functions The host stack core layer uses these callback functions to manage the class driver The class driver may provide API functions specific to the interface class it is managing TABLE 4 1 USB DEVICE CLASS DRIVER STRUCTURE USBH_CLASS H Structure Represents USBH_CLASS_DRV A USB device class driver CONNECT USB Host WITTENSTEIN high integrity systems Page 31 4 1 1 Class Driver structure USBH_CLASS_DRV The USBH_CLASS_DRV structure represents the framework needed by the class driver The class driver must
19. Leaves a critical section The CPU flags should be restored CONNECT USB Host WITTENSTEIN high integrity systems Page 195 13 1 Thread Abstraction 13 1 1 Create Thread OSL_ThreadCreate Creates a thread or task INTERR OSL_ThreadCreate UINTO8 pname UINT32 prio USB_THREAD_FNCT thread_fnct void odata UINT32 ostk UINT 37 stk_size OSL_HTHREAD ph_thread Arguments pname The name by which the thread will be identified prio The priority of the thread to be created thread_fnct A pointer to the function that will be executed in this thread odata A pointer to the data that is passed to the thread function pstk A pointer to the beginning of the stack used by the thread stk_size The size of the stack in bytes ph_thread Assigned the handle that will be used in managing the thread Return Value USBF_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 196 13 2 Semaphore Abstraction 13 2 1 Create Semaphore OSL_SemCreate This routine creates a semaphore with given count INTERR OSL _SemCreate OSL_HSEM pb sem UINT32 val IR Arguments ph_sem This will be assigned the handle used in managing the semaphore val This is the number of resources available when the semaphore is created Return Value USPE ERR NONE if the routine succeeds Otherwise an error code as outli
20. Page 6 6 5 1 Synchronous Transmit USBH_IntrTX cece eeeeeeeeeee eee eeeeeeeeeeeeeeeeeeeeenaaaeeeeeeeeeeeea 82 6 5 2 Synchronous Receive USBH_IntrRXx ccccceceeccccceeeceeeeeeeceeeeeeeeeeeeeeeeeeneeeeeees 83 6 5 3 Asynchronous Transmit USBH_ Totriv svnc 84 6 5 4 Asynchronous Receive USBH_ IntrRXASYNC A 85 6 6 JISOCHFONOUS Transfer Aide eet BEE e 86 6 6 1 Synchronous Transmit USBH_ISOCTX eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeenaaaeeeeeeeeeeeea 86 6 6 2 Synchronous Receive USBH_ISOCRX eeeesseeceeeeeeeeeeeeeeceeeeeeeeneeseeeeneeeeeeees 87 6 6 3 Asynchronous Transmit USBH_ USPH IeocTs svnc 87 6 6 4 Asynchronous Receive USBH_ USBH_lsocRxAsync 0 89 T MassStorage Class icity Sete isi oats Aenea wat ees Peas ens Keeton 90 7 1 INtrOGUCTION rea ia Hehe RR as tee ee et ee ed eee 90 Gee MSO Eet eessen gees 91 deht MSC Driver APLFUNCONS seenen ee ee eet 92 7 3 1 Initialize MSC Class UGPBH MSC Maxi UNGet ee eeeeeeeeeeeeeeeneeeeeeeeeees 93 7 3 2 Uninitialize MSC class USBH_MSC_Uninit 0 eee eeeeeee eee eeeeeeeeeeeeeeeeeeeeeaaaes 93 7 3 3 Reads capacity of device USBH_MSC_CapacityRd seenseeneeeneeeneerreneeereeneee 94 7 3 4 Application reference release UGPBH MSC Rettel 95 7 3 5 Reads inquiry data USB MSC Gidlnguirvt 95 7 3 6 Application reference add USBH_MSC_RefAdd eeeeeeeeeeeeeeeeeeeeteeeeeeeeees 96 Readiblocks USB MSC RaQ EE 97 7 3 7 Write blocks
21. Protocol code informs whether the device is a mouse or keyboard HID Report Protocol Reports contain data from one or more items Devices uses the Interrupt In pipe to send the reports to Host The Host may request the reports from device using Control pipe The Host will send the reports to device using Control pipe or an optional Interrupt Out pipe A report contains the state of all the items Input Output or Feature belonging to a particular Report ID CONNECT USB Host WITTENSTEIN high integrity systems Page 100 Set_Protocol control request is used to select the Boot Protocol or Report Protocol and similarly Get_Protocol request is used to get the device current operating protocol HID Idle Device uses the Interrupt In pipe to report the data to the host the frequency at which a device reports the data when no new events have occurred is called Idle Rate Most devices only report new events and therefore default to an idle rate of infinity Set_Idle control request is used to set the idle rate and similarly Get_Idle request is used to get the current idle rate at which device reporting the data 8 1 2 Collections A collection is a meaningful grouping of Input Output and Feature items For example a mouse could be described as a collection of two to four data items x y button 1 and button 2 The Collection and End Collection items are used to delineate collections 8 1 3 Usages Usages are part of the Report descriptor
22. UINTO8 USBH_PRN_FontSet USBH_PRN_DEV pprn_dev UINT OS pfont CONNECT USB Host WITTENSTEIN high integrity systems Page 131 Arguments pprn_dev Pointer to the printer device pfont Pointer to variable which contains font name to be selected Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully setting the given font Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 132 9 3 21 Print the Text Data This function prints the given text data with the default font characteristics supported by the printer INTERR USBH_PRN_TextPrint USBH_PRN_DEV pprn_dev UINT OS obuf UINT32 buf_len Arguments pprn_dev Pointer to the printer device pbuf Pointer to buffer containing the text data to be printed buf_len Length of the buffer pointed by pbuf variable Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully printing the given text data Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 133 9 3 22 Print the Image Data This function prints the given row of the image data INTERR USBH_PRN_ImagePrint USBH_PRN_DEV pprn_dev UINT OS prow UINT32 row_len Arguments pprn_dev Pointer to the printer device prow Pointer to row buffer
23. balance PCL commands are compact escape sequence codes that are embedded in the print job data stream This approach minimizes both data transmission and command decoding overhead HP PCL formatters and fonts are designed to quickly translate application output into high quality device specific raster print images PCL printer language commonality from HP printer to HP printer helps to minimize printer support problems and protect HP printer customer investment in applications and printer driver software The PCL module included initializes the Page Description Language structure variable as shown below CONNECT USB Host WITTENSTEIN high integrity systems Page 153 USB 1201 ra Ct aeee 2 Serge Init USBH PCL PageOrientationSetCmdFr USBH PCL PageLeftMarginSetCmdFr USBH PCL PageRightMarginSetCmdFr USBH PCL PageTopMarginSetCmdFr USBH PCL PageMarginsClearCmdFr USBH PCL PageLineSpacingSetCmdFr USBH PCL PageNbrCopiesSetCmdFr USB EE Che Homecare heoctCmalkna USP re Cle OmericenehiteocieGmcliea USiwel Wil LovaieUiaclere IL aioe Sic Cmn DSSEL DC Lovee UNGE EMEC EIEE USB PCh HontkeqlxCmelix USBH PCL ImageRowHdrSetCmdFr USBH PCL StatusRespParse USBH_PDL ID PCL FIGURE 9 3 INITIALIZED PAGE DESCRIPTION LANGUAGE STRUCTURE The prototypes of these functions are similar to that of Page Description Language routines mentioned in 9 5 section To completely understand these functions please go through P
24. en 61 gt SB EMO A AP EE 63 6 1 Endpoint Management Funchons AA 63 6 1 1 Open Bulk in endpoint USGSPBH BulklnCpent 64 6 1 2 Open Bulk out endpoint USPBH BuikCutOpen 65 6 1 3 Open Interrupt in endpoint USBH_IntrInOpen ccecccecceceeeeeeeeeeeeeeeeeeeeeeeees 66 6 1 4 Open Interrupt out endpoint USBH_lIntrOutOpen sssssseseesrrrerrrrrrrrrrerrrenrren 67 6 1 5 Open Isochronous in endpoint USBH_IsoclnOpen ccccccceeeeeeeeeeeeeeeeeeees 68 6 1 6 Open Isochronous out endpoint USBH_lsocOutOpen s ssssssssrerrrrrrrrrrrrrrrren 69 6 1 7 Reset endpoint USBH_EP_Reset 0 0ecceeeceeseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeneeeseeees 70 6 1 8 Clear Stalled endpoint UGPBH ER Grace 71 6 2 Endpoint Transfer Functions ssseeseesseesseeeteetttttttttttttttttttttttttttttttttEEEEEEEE EEEE EEEE EEEE E EE 72 6 3 Control Transfers E 74 6 3 1 Synchronous Transmit USBH_Ctr TXx i enee Etgen A 74 6 3 2 Synchronous Receive UGPBH Civil 76 GEN RE 78 6 4 1 Synchronous Transmit USB BulkTX scccuscigesstiecaccdeencsesaciorgemetvduedueceensiteetwenasds 78 6 4 2 Synchronous Receive USBH_BulIKRX eeeeeecnceceeeeeeeeeeeeeeeeeeeeseeeeeeenseeeeeeee 79 6 4 3 Asynchronous Transmit USBH_BulkTXASYNC cc eeeeeeeeeeeeeeeeeeeeeeeeeeeeeenneeeeeeers 80 6 4 4 Asynchronous Receive USBH Buikbs hevnci 81 6 5 Interrupt Transfer 82 CONNECT USB Host WITTENSTEIN high integrity systems
25. error code as outlined in Appendix B will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 164 10 4 6 Get Line Coding USBH_CDC_GetLineCoding This request allows the host to find out the currently configured line coding INTERR USBH_CDC_GetLineCoding USBH_CDC_DEV pcdc_dev UINT32 pbaud_rate UINTO8 pstop_bits UINT OS pparity_val UINT08 pdata_bits Arguments pcdc_dev Pointer to the CDC device pbaud_rate Pointer to the Baud rate pstop_bits Pointer to the Stop Bit value pparity_val Pointer to the Parity value pdata_bits Pointer to the Number of data bits Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 165 10 4 7 Set Control Line State USBH_CDC_SetLineState This request generates RS 232 V 24 style control signals INTERR USBH_CDC_SetLineState USBH_CDC_DEV pcdc_dev UINTO8 dtr_bit UINTO8 rts_bit Arguments ocdc_dev Pointer to the CDC device dtr_bit Indicates to DCE if DTE is present or not The following values can be used USBH_CDC_DTR_SET USBH_CDC_DTR_CLR rts_bit Carrier control for half duplex modems The following values can be used USBH_CDC_RTS_SET USBH_CDC_RTS_CLR Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned CONNECT US
26. implement series of memory buffers called endpoints that enable the software to read and write packets over the USB 1 4 USB Data Transfer Types The USB specification defines four types of transfers e Control Transfers e Bulk Transfer e Interrupt Transfers e Isochronous transfers Every USB device must support Control Transfers Control Transfers are generally used for command and status type of operations The Control Transfers are used in device enumeration process additionally some USB devices use Control Transfers for class specific requests Bulk Transfers are used to transfer large amounts of data but at a lower priority than other transfers Bulk Transfers have guaranteed data delivery but no guarantee on latency Only full and high speed devices support Bulk Transfers Interrupt Transfers are periodic The Interrupt Transfers have guaranteed latency CONNECT USB Host WITTENSTEIN high integrity systems Page 15 Isochronous Transfers are used when the data needs to be delivered periodically with bounded timing Isochronous Transfers don t have retry toggle CRC check or guarantee of delivery Isochronous Transfers are supported by full amp high speed devices only 1 5 USB Dual Role OTG USB On The Go OTG defines a dual role device which can act as either a host or peripheral and can connect to a PC or other portable devices through the same connector Portable devices such as handhelds cell phones and digital camer
27. implement the functions provided in the USBH_CLASS_DRvV structure below typedef usbh_class drv struct UINT08 Name USBH_CLASS_GLOBAL_INIT_FNCT Globallnit USBH_CLASS_PROBE_DEV_FNCT ProbeDev USBH_CLASS_PROBE_IFACE_FNCT Probelface USBH_CLASS_ SUSPEND_FNCT Suspend USBH_CLASS_ RESUME_FNCT Resume USBH_CLASS_DISCONN_FNCT Disconn USBH_CLASS_DRV TABLE 4 2 USB DEVICE CLASS DRIVER CALLBACKS Member Purpose Name This is the user supplied name of the class driver ein ne REESEN deer eg e e SEENEN device enue Called to determine if the class driver can manage a specific interface class Suspend Called when the USB host stack is suspended Resume Called when the USB host stack is resumed from suspended state Disconn Called when the device is removed CONNECT USB Host WITTENSTEIN high integrity systems Page 32 4 2 Class Driver Management The application can register a class driver for a specific interface class The Table 4 3 lists the functions for class driver management TABLE 4 3 USB DEVICE CLASS MANAGEMENT FUNCTIONS USBH_CLASS H Function Description USBH_ClassDrvReg Registers a class driver with the USB host stack USBH_ClassDrvUnreg Unregisters a class driver with the USB host stack 4 2 1 Register Class Driver USBH_ClassDrvReg This function registers the class drivers with the host stack After registration this function calls the Globallnit of that cla
28. in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 110 8 3 10 Register callback USBH_HID_RegRxCB This function registers callback functions to receive reports asynchronously INTERR USBH_HID_RegRxCB USBH_HID_DEV p_hid_dev UINT08 report_id USBH_HID_RXCB_FNCT _ fnet void p_arg Arguments p_hid_dev Pointer to USBH_HID_DEV structure report_id Report ID to where the callback function is registered Fnet Callback function p arg Pointer to context that will be passed to callback function Return Value On success returns 0 On failure returns specific error number as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 111 8 3 11 Unregister callback USBH_HID_UnregRxCB This function unregisters the assigned callback function INTERR USBH_HID_UnregRxCB USBH_HID DEV p_hid_dev UINTO8 report_id Arguments p hid _dev Pointer to USBH_HID_DEV structure report_id Report ID to unregister the callback function Return Value On success returns 0 On failure returns specific error number as outlined in Appendix A 8 3 12 Set the protocol USBH_HID_ProtocolSet This function sets the protocol boot report descriptor for the device INTERR USBH_HID ProtocolSet USBH HID DEV p_hid_dev UINTO8 protocol Arguments p_hid_dev Pointer to USBH_HID_DEV structure report_id Protocol to be set Return Value
29. integrity systems by the device Maximum controllers Endpoint allocation failed descriptor DMA buffer allocation failed Host controller I O hardware error Page 203 CONNECT USB Host WITTENSTEIN high integrity systems Host controller I O software error Host controllers reset failed port Invalid host controller s port number Endpoint descriptor not found No Host operation in host controller Host controller initialization failed Interrupt service routine registration failed Page 204 CONNECT USB Host WITTENSTEIN high integrity systems No configurations device Unsupported language Memory allocation for Hub device failed Maximum no of class drivers Maximum no of configurations per device Maximum no of interfaces per configuration Maximum no of endpoints Maximum data packet Page 205 2409 USB_ERR_CFG_MAX_NBR_HC Maximum no of host controllers 0 USB ERR MS CMD PASSED Mass storage command Se ee D passed 2600 USB_ERR_MS_CMD_FAILED Mass storage command failed 2601 USB_ERR_MS_CMD_PHASE_ERROR Error in command E H execution 2602 USB ERR MS IO ERROR I O operation error S SE Device reset failed 2604 USB ERR MS MAXLUN FAIL Failed to get maximum LUNs in device 2605 USB_ERR_CFG_MAX_NBR_LUN Maximum number of 2700 USB_ERR_HID_LONG_ITEM Long item found in sss oases cease
30. or DMA memory for data transfer If this is DEF_TRUE DMA memory from DMADataBuf shall be used This method is inefficient because the application buffer will be copied to DMA memory before USB transfer If this is DEF_FALSE System memory buffer passed by the application is used for DMA operation during USB transfer If EHCI interface is from Transdimension IP this value must be set to DEF_TRUE otherwise DEF_FALSE Page 187 12 1 2 Initialize Host Controller BSP BSP_USB_Host_lInit This function implements SoC specific initialization to enable USB Host controller It is called by the Host Controller Driver before issuing host controller hardware reset INTERR BSP_USB_Host_Init UINTO8 hc_nbr USBH_HOST_CNTRLR mp be Arguments hc_nbr The host controller index D he Pointer to Host controller structure Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned 12 1 3 On Reset Host Controller BSP_USB_Host_OnReset This function is called by the Host Controller Driver after issuing host controller hardware reset INTERR BSP_USB_Host_OnReset UINTO8 hc_nbr USBH_HOST_CNTRLR p he Arguments hc_nbr The host controller index p he Pointer to Host controller structure Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned CONNECT USB Host WITTENSTEIN high
31. represent all of the device s data CONNECT USB Host WITTENSTEIN high integrity systems Page 101 Input Output Feature FIGURE 8 2 REPORTS STRUCTURE If a device has multiple report structures all data transfers start with a 1 byte identifier prefix that indicates which report structure applies to the transfer This allows the class driver to distinguish incoming pointer data from keyboard data by examining the transfer prefix For example consider a simple mouse that reports its x y displacements and button events as in Table 8 1 TABLE 8 1 MOUSE REPORTS Byte Bits Description 0 Button 1 1 Button 2 0 2 Button 3 3 to 7 Reserved 1 0 to 7 X displacement 2 0 to 7 Y displacement CONNECT USB Host WITTENSTEIN high integrity systems Page 102 8 2 HID Class Architecture Asynchronous callbacks will be used in application USBH_Host_Init USBH_ClassDrvReg USBH_HID_ClassDrv USBH_HostCntrlrAdd USBH_HID_Init USBH_HID_RefAdd HID Class Driver FIGURE 8 3 CONNECT USB HID CLASS ARCHITECTURE CONNECT USB Host WITTENSTEIN high integrity systems Page 103 8 3 HID Class Driver API Functions The following Table 8 2 lists all the functions that the application requires to communicate with Human Interface Device TABLE 8 2 HID CLASS DRIVER API FUNCTIONS Function Description USBH_HID_Init Initializes the human interface device
32. specific error number as listed in appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 20 3 1 2 Add Host Controller USBH_HostCntrlrAdd This function is used to add the host controller to the USB host stack it configures the board specific hardware and initializes the host controller to enter operational mode INTERR USBH_HostCntrirAdd USBH_HOST p_host UINT08 hc_nbr Arguments p_host Pointer to the USBH_HOST structure hc_nbr Host controller number Return Value On success returns 0 On failure returns specific error number as listed in Appendix A 3 1 3 Start Host Controller USBH_HostCntrlrStart This function is used to restart the selected host controller operation INTERR USBH_HostCntrirStart USBH_ HOST p host UINTO8 hc_nbr Arguments p_host Pointer to the USBH_HOST structure hc_nbr Host controller number Return Value On success returns 0 On failure returns specific error number as listed in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 21 3 1 4 Stop Host Controller USBH_HostCntrlrStop This function is used to stop the selected host controller INTERR USBH_HostCntrirStop USBH HOST p host UINTO8 hce_nbr Arguments p_host Pointer to the USBH_HOST structure hce_nbr Host controller number Return Value On success returns 0 On failure returns specific error number as listed in Appendi
33. storage device TABLE 7 1 MSC DRIVER API FUNCTIONS Function Description USBH_MSC_Init Initializes the mass storage device USBH_MSC_Uninit Uninitializes the mass storage device USBH_MSC_CapacityRd Reads capacity of a LUN in mass storage device USBH_MSC_StdInquiry Reads inquiry data of a LUN in mass storage device USBH_MSC_RefAdd Increments the application reference count to mass storage devices USBH_MSC_RefRel Decrements the application reference count to mass storage devices USBH_MSC_Rd Reads specified number of blocks from a LUN USBH_MSC_Wr Writes specified number of blocks to a LUN CONNECT USB Host WITTENSTEIN high integrity systems Page 92 7 3 1 Initialize MSC Class USBH_MSC_MaxLUNGet Initialize the Mass Storage Class and get the maximum logical unit number LUN from the device INTERR USBH_MSC_Init USBH_MSC_DEV p_msc_dev UINTOS p max Jun Arguments p msc_dev Pointer to the USBH_MSC_DEV structure p max Jun Pointer to hold the maximum LUN in device Return Value On success returns 0 On failure returns a specific error number 7 3 2 Uninitialize MSC class USBH_MSC_U ninit The application can uninitialize the mass storage device by calling USBH_MSC_Uninit function void USBH_MSC_Uninit USBH_MSC_DEV p_msc_dev Arguments p msc_dev Pointer to the USBH_MSC_DEV struc
34. the USB stream interface USBH_AUDIO_StreamStart Used to start the audio data transfer USBH_AUDIO_StreamStop Used to stop the audio data transfer USBH_AUDIO_StreamRead Read the audio stream to buffer USBH_AUDIO_StreamWrite Writes data to the audio stream CONNECT USB Host WITTENSTEIN high integrity systems Page 172 11 1 1 Initialize Audio Device USBH_CDC_Init This function Initializes the Audio class device INTERR USBH_AUDIO_Init USBH_AUDIO_DEV p_audio dev 1 Arguments p audio dev Pointer to the audio device Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned 11 1 2 Uninitialize Audio Device USBH_CDC_Init This function uninitializes the Audio class device None USBH_AUDIO_Uninit USBH_AUDIO DEV p audio deu Arguments p audio dev Pointer to the audio device Return Value None CONNECT USB Host WITTENSTEIN high integrity systems Page 173 11 1 3 Application Reference Add USBH_AUDIO_RefAdd This function increments the application reference count to audio device INTERR USBH AUDIO RefAdd USBH AUDIO DEV p_ audio dev Arguments p audio dev Pointer to the audio device Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned 11 1 4 Application Reference Release USBH_AUD
35. to the device This function waits until the I O operation is completed Issues an isochronous send request to the device This function waits until the I O operation is completed Issues an isochronous receive request to the device This function waits until the I O operation is completed CONNECT USB Host WITTENSTEIN high integrity systems Page 72 TABLE 6 3 ASYNCHRONOUS TRANSFER FUNCTIONS Function Description USBH_BulkTxAsync Issues a bulk send request to the device This function returns immediately and the asynchronous completion routine is called when I O is completed USBH_BulkRxAsync Issues a bulk receive request to the device This function returns immediately and the asynchronous completion routine is called when I O is completed USBH_IntrTxAsync Issues an interrupt send request to the device This function returns immediately and the asynchronous completion routine is called when I O is completed USBH_lIntrRxAsync Issues an interrupt receive request to the device This function returns immediately and the asynchronous completion routine is called when I O is completed USBH_IsochTxAsync Issues an isochronous send request to the device This function returns immediately and the asynchronous completion routine is called when I O is completed USBH_IsochRxAsync Issues an isochronous receive request to the device This function returns immediately and the asynchronous completion routine
36. with the user defined functionality ass 2 2 USB Core Driver The USB Host Core manages the connected USB devices and provides a framework for the USB Class Drivers It contains the Hub Driver which monitoring the hub ports for device attach or detach events When a new USB device is attached the Hub Driver enumerates and invokes the appropriate USB Class Driver for the device and when the device is detached it performs necessary steps to remove it 2 3 USB Host Controller Driver HCD The USB Host Controller Driver HCD communicates with the Host Controller hardware to transfer data across the USB bus CONNECT USB provides Host Controller Drivers for full speed OHCI interface and high speed EHCI standard interface 2 4 RTOS Abstraction The CONNECT USB Host stack can be used with or without an RTOS If an RTOS is include the RTOS abstraction layer must be use The RTOS abstraction layer contains wrappers for the RTOS services such as semaphore and mutex etc CONNECT USB Host WITTENSTEIN high integrity systems Page 18 3 USB Host Stack API 3 1 Host Controller API Functions Table 3 1 lists all the functions that the application requires to launch the USB Host Stack TABLE 3 1 USB HOST STACK API FUNCTIONS Function Description USBH_Hostlnit Initializes the USB Host Stack USBH_HostContrlrAdd Adds a host controller to the host stack and starts operations USBH_HostCnitrirStart Resume the host control
37. 10 4 3 Application reference add USBH_CDC_RefAdd A 162 10 4 4 Application reference release USBH_CDC_RefRel A 162 10 4 5 Set callback structure USBH_CDC_CallbacksReg sssssssssrsnrrerrrenrrenrenrreens 163 Set Line Coding USGPBH CDC Gett neCodmg reena 164 10 4 6 Get Line Coding USB CDC Get neCodmg 165 10 4 7 Set Control Line State USBH_CDC_SetLineState A 166 10 4 8 Send Break USBH_CDC_SendBreak II 167 10 4 9 Serial Transmit data USBH_CDC_SerTxData cc ecceeeeeeeeeeeeenteteeeeeeeeeeeeee 168 10 4 10 Serial Receive data USPBH CDC Gerbxvtatai 169 10 4 11 Serial Event Callback USBH_CDC_SerEventNotify ccceeeeceseeeteteees 170 10 4 12 Error Reporting Macro 170 11 Le ge EE 171 Tiel Audio Class Driver EE 172 11 1 1 Initialize Audio Device UGPBH CDC Int 173 11 1 2 Uninitialize Audio Device USBH_CDC_ Int 173 11 1 3 Application Reference Add UGPBH AUDIO Berdi 174 11 1 4 Application Reference Release USB AUDIO Hert el 174 11 1 5 Input Terminal Count USBH_AUDIO_InTerminalsCount e 175 11 1 6 Output Terminal Count USBH_AUDIO_OutTerminalCount e 175 CONNECT USB Host WITTENSTEIN high integrity systems Page 11 11 1 7 Get I P Terminal Type USBH_AUDIO_InTerminalTypeGet e 176 11 1 8 Get O P Terminal Type USBH_AUDIO_OutTerminalTypeGet 177 11 1 9 Get USB I P Stream Interface USBH_AUDIO_InStreamGet e 177 11 1 10 Get O P Stream Interface USBH_AUDIO_OutStreamGet A 178
38. 12 1 USB HOST CONTROLLER BSP FUNCTIONS Function Description BSP_USB_Host_lInit Called by host controller driver to prepare chipset specific USB host initialization BSP_USB_Host_OnReset Called by host controller driver after the USB Host controller reset is issued BSP_USB_Host_RegisterlSR Called by host controller driver to register its Interrupt Service Routine ISR BSP_USB_Host_UnregisterlISR Called by host controller driver to disable Interrupt Service Routine ISR BSP_USB_Host_Uninit Called by host controller driver after host controller is uninitialized Table 12 2 provides the Host Controller function structure that is passed to BSP_USB_Host_Init TABLE 12 2 USB HOST CONTROLLER STRUCTURE Structure Represents USBH_HOST_CNTRLR CONNECT USB Host WITTENSTEIN high integrity systems A USB host controller structure Page 184 12 1 1 Host Controller structure USBH_HOST_CNTRLR The USBH_HOST_CNTRLR structure is passed to BSP_USB_Host_Init function to get host controller specific information CONNECT USB Host WITTENSTEIN high integrity systems Page 185 TABLE 12 3 USBH_HOST_CNTRLR STRUCTURE MEMBER INFORMATION Member Purpose HCDescBufLen DMADataBuf DMADataBufLen Host controller index Pointer to Host Controller Driver structure The BSP_USB_Host_Init function shall assign OHCI or EHCI or other driver stru
39. 2 buf_len UINT32 timeout_ms INTERR perr Arguments pep This is a pointer to pipe through which the interrupt data is to be received pbuf This is a pointer to the buffer into which the received interrupt data will be placed buf_len This is the size of the buffer timeout_ms This is the timeout in milliseconds perr USBH_ERR_NONE ifthe transfer was successful Otherwise error code as outlined in Appendix A Return Value The number of bytes received by the device CONNECT USB Host WITTENSTEIN high integrity systems Page 83 6 5 3 Asynchronous Transmit USBH_ IntrTxAsync Issues an interrupt send request to the device This function returns immediately and the asynchronous completion routine is called when I O is completed INTERR USBH_IntrTxAsync USBH_EP p ep void p_buf UINT32 buf_len USBH_INTR_CMPL_FNCT p_fnct Void p fnct_arg _ Argument p ep Pointer to the endpoint p buf Pointer to the data buffer buf_len Number of data bytes in buffer p_fnct Pointer to asynchronous function which will be invoked by the asynchronous I O task when the transfer is complete p fnct_arg Pointer to a variable that will be passed to asynchronous function Return Value USB ERR NONE If the request is submitted USB_ERR_INVALID_ARGS If p_ep is 0 USB _ERR_EP_CLOSED If the endpoint is closed USB_ERR_EP_INVALID If the endpoint type is not Interrupt or direction is not out Otherwise specific error code as define in appendix A
40. 32 timeout_ms Arguments pep This is a pointer to endpoint through which the isochronous data is to be sent pbuf This is a pointer to the buffer into which the isochronous data to transfer should be placed buf_len This is the size of the buffer start_frm Starting frame number nbr_frms Number of frames to transfer p fm Jens Pointer to array that contains frame lengths each entry per frame p errs Pointer to array that receives error codes each entry per frame timeout_ms This is the timeout in milliseconds Return Value The number of bytes sent to the device CONNECT USB Host WITTENSTEIN high integrity systems Page 86 6 6 2 Synchronous Receive USBH_IsocRx The USBH_IsocRx function is used to receive isochronous transfer data from device The endpoint must be of type USB_EP_TYPE_ISOC and direction must be USB_EP_DIR_IN INTERR USBH_IsocRx USBH_EP Dep void obuf UINT32 buf_len UINT32 start_frm UINT32 nbr_frms UINT16 p frm Jens USB_ERR p errs UINT32 timeout_ms Arguments pep This is a pointer to endpoint through which the isochronous data is to be sent pbuf This is a pointer to the buffer into which the isochronous data to transfer should be placed buf_len This is the size of the buffer start_frm Starting frame number nbr_frms Number of frames to transfer p frm_lens_ Pointer to array that contains frame lengths each entry per frame p errs Pointer to array that receives error codes each entr
41. B Host WITTENSTEIN high integrity systems Page 166 10 4 8 Send Break USBH_CDC_SendBreak This request sends special carrier modulation that generates an RS 232 style break INTERR USBH_CDC_SendBreak USBH_CDC_DEV pcdc_dev UINT16 break_time Arguments pcdc_dev Pointer to the CDC device break_time The length of time in milliseconds of the break signal Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 167 10 4 9 Serial Transmit data USBH_CDC_SerTxData This function is used to transmit data bytes to the device INTERR SBH_CDC_SerTx USBH_CDC_DEV pcdc_dev void p but UINT32 buf_len UINT32 time_out Arguments ocdc_dev Pointer to the CDC device p buf Pointer to the data buffer buf_len Length of data buffer time_out Timeout value in milliseconds Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 168 10 4 10 Serial Receive data USBH_CDC_SerRxData This function is used to receive data bytes from the device INTERR USBH_CDC_SerRx USBH_CDC_DEV p cdc_dev void p but UINT32 buf_len UINT32 time_out Arguments ocdc_dev Pointer to the CDC device p buf Pointer to the data buffer buf_len Length of d
42. CL technical reference manual available at the above given link The PCLFncts structure variable is exported to other modules so that the application can use this variable to pass as an argument to USBH_PRN_AddLanguage routine 9 7 Printer Job language Some of the contents and figures in this section of the document are extracted from HP Printer Job Language Technical Reference Manual which can be obtained at the location mentioned below http h20000 www2 hp com bc docs support SupportManual bpl13208 bpl13208 pdf Printer Job Language PJL is a method developed by Hewlett Packard for switching printer languages at the job level and for status readback between the printer and the host computer PJL adds job level controls such as printer language switching job separation environment status readback device attendance and file system commands While PJL was conceived as an extension to Printer Command Language it is now supported by most PostScript printers Many printer vendors have extended PJL to include commands proprietary to their products PJL resides above all the other printer languages and parses commands first The syntax mainly uses plain English words CONNECT USB Host WITTENSTEIN high integrity systems Page 154 Printer Job Language PCL Post Script and other Printing Languages PCL Printer FIGURE 9 4 PJL RESIDES ABOVE OTHER PRINTING LANGUAGES 9 8 Benefits of PUL Listed below are some of the benefi
43. CM device INTERR USBH_CDC_Init USBH CDC_DEV mp ode dev Arguments pcdc_dev Pointer to the CDC ACM device that is removed Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix B will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 162 10 4 5 Set callback structure USBH_CDC_CallbacksReg Decrement the reference count of aCDC ACM device INTERR USBH_CDC_Init USBH_CDC_DEV p_cdc_dev USBH_CDC_SERIAL pcdc_serial Arguments pcdc_dev Pointer to the CDC device pc serial Pointer to the USBH_CDC_SERIAL structure Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix B will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 163 Set Line Coding USBH_CDC_SetLineCoding This request allows the host to specify typical serial communication settings INTERR USBH_CDC_SetLineCoding USBH_CDC_DEV ocdc_dev UINT32 baud_rate UINT OS stop_bits UINTO8 parity_val UINTO8 data_bits Arguments pcdc_dev Pointer to the CDC device baud_rate Serial Communication Baud rate This value can be any of the following 9600 14400 19200 38400 57600 115200 128000 and 256000 bits per second stop_bits Number of stop bits parity_val Parity value data_bits Number of data bits Return Value USBH_ERR_NONE if the routine succeeds Otherwise an
44. Class Event break event Lel elass code e leng NOTE 8 NOTE 9 NOTE 10 Note 8 USB Host Stack internal event The App USB Host Task shall be executed Note 9 USB Class internal event The App USB Class Task shall be executed Note 10 USB Class connected disconnected event The App_USB_Class_Task shall be executed The App_USB_Host_Task function called by the host stack when there is pending event to be processed void Apo USS Hogt Pask Vore ii App USB Host _Eiveime DE PALSE return App_USB Host Event DEF FALSE USBH HostEventProcess amp App USB Host Note 11 If host event is not pending return CONNECT USB Host WITTENSTEIN high integrity systems NOTE 11 NOTE 12 Page 28 Note 12 Host event is pending Process Host event The App USB Class Task function called by the host stack when a pending event of USB class should be processed void App USB Class Task void USBH CLASS DEV p class dev i App USE Class Eweme DE TALS NOTE 13 return EE USE Class p Class dey do p_class dev USBH ClassDevFind amp App USB Host NOTE 14 Class clew 0 jo elass dey 0 break switch p class _dev gt Status case USBH CLASS DEVICE STATUS CONNECTED NOTE 15 App USE Class lowe eo Class deen break se
45. E 1284 4 compatible interface is also a bidirectional interface The 1284 4 interface additionally specifies how the data will be transmitted to and from the device using the 1284 4 protocol If multiple printer interfaces are supported they shall be implemented as alternate interfaces The Protocol field in the interface descriptor informs the host of the interface type 01 is the unidirectional interface 02 is the bi directional interface and 03 is the 1284 4 interface The USB Printer Class specification describes only transport layer functionality it does not specify the printer language supported by the printer Printers use page description languages PDL there are two PDLs used e Post Script Developed by Adobe and implemented by several printers e Printer Control Language or PCL Developed by HP and implemented by all HP printers and has become the de facto industry standard The Printer Language Driver layer described in the architecture supports a specific PDL The framework allows new language driver to be added to the stack The language supported by a CONNECT USB Host WITTENSTEIN high integrity systems Page 115 printer is described in the device ID string returned by the printer in response to GET_ DEVICE_ID class request 9 1 Prerequisites This printer class driver is intended only for USB printers that support the Printer Command Language The description of PCL is beyond the scope of this document Further inf
46. ECT USB Host WITTENSTEIN high integrity systems Page 41 The USBH_BULK_Write function is called by the application to write the data to the device ERR Dapp BULK Write USBH BULK D p bulk dev UINTO8 p buf STA T buf_len Scala WP E EE len TNTEBRR eric OSL MutexLock amp p_bulk_dev gt HMutex ime up ak Glew SSicece l US CLASS DEW _ SAT NOTE 22 OSL MutexUnlock amp p_ bulk _ dev gt HMutex return USB ERR DEV NOT READY DIE len USBH Ee er ovili Cev gt BtI kOuti NOTE 23 GE but Len 5000 terr e OSL MutexUnlock amp p_bulk_ dev gt HMutex return err Note 22 Return error code if the device is not in connected state Note 23 Write data to bulk out endpoint The USBH_BULK_Suspend function is called by the host stack when host is suspended static INTERR USBH BULK Suspend USBH BULK DEV p bulk dev OSL MutexLock amp p_bulk_dev gt HMutex p_bulk_dev gt State USBH CLASS DEV STATE ND NOTE 24 OSL MutexUnlock amp p_bulk_ dev gt HMutex return USB ERR NONI Note 24 Set the class device state as suspended CONNECT USB Host WITTENSTEIN high integrity systems Page 42 The USBH_BULK_Resume function is called by the host stack when the host is resumed from the suspend state static INTERR USBH BULK Resume USBH BULK DEV p bulk dev OSL MutexLock amp p_bulk_d
47. EIN high integrity systems WHIS is a safety systems company that produces and supplies real time operating systems RTOS and software components to the medical aerospace transportation and industrial sectors WHIS is part of the WITTENSTEIN Group a global technology company established in 1948 with a presence in over 45 countries Relationship with FreeRTOS WHIS leverage RTOS technology from the FreeRTOS project the market leading embedded real time operating system from Real Time Engineers download in excess of 100 000 times in 2013 WHIS have a unique relationship with the FreeRTOS project as Richard Barry the creator of FreeRTOS and the owner of Real Time Engineers Ltd is also the Innovation Leader for WHIS and was instrumental in setting up the division OPENRTOS OPENRTOS provides the only available commercial license for FreeRTOS the highly successful small efficient embedded real time operating system distributed under a modified GPL license OPENRTOS and FreeRTOS share the same code base however OPENRTOS truly transitions developers into the professional world with full commercial licensing and access to direct support backed up by tools training and consultancy services Developers can extend the functionality of OPENRTOS by selecting from a wide range of middleware components and Board Support Packages SAFERTOS SAFERTOS is a pre emptive pre certified real time operating system that delivers unprecedented levels o
48. Find Find class device matching the class code CONNECT USB Host WITTENSTEIN high integrity systems Page 34 4 3 1 Find Class Device USBH_ClassDevFind This function finds a class device matching the class code USBH_CLASS_ DEV USBH_ClassDevFind USBH_HOST p host USBH_CLASS_DEV p class dev UINT32 class_code Arguments p host Pointer to the host structure p class dev Pointer to the class driver structure If this argument is 0 the first matching class device will be returned otherwise the next class device is returned class_code The interface class code for finding the class device Return Value Pointer to the Class device if a matching class device is found otherwise 0 will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 35 4 4 Example Bulk Class Driver This section describes an example Bulk class driver The bulk class driver can be used with an USB device that has an custom interface class code for example OxEE The USB device interface class should contain one Bulk In and one Bulk Out endpoint The following code creates a Bulk class driver structure with callback function pointers USBH CLASS DRV USBH BULK ClassDrv UINTO8 2 EES eener USBH CLASS GLOBAL INIT FNCT USBH ChASS PROBE DEV ENCT USBH ChASS PROBE IF RENGER USBH ULK GlobalInit 0 USBH USBH USBH USBH EE LE Suspend USBH CLASS SUSPEND FNCT USBH CLASS RESU
49. H_ERR_NONE on successfully un initializing the printer class module Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 121 9 3 5 Add Printer Description Language This function adds the given printer description language to the list of supported languages The printer description language generally referred to as PDL can be one of printer control language PCL post script PS etc The project includes usage of PCL as PDL Other PDLs can be added without modifying the existing architecture For further details of PDL please refer to Section 0 Page Description Language INTERR USBH_PRN_AddLanguage USBH_PRN_DEV pprn_dev USBH_PDL_FNCTS ppdl_fncts Arguments pprn_dev Pointer to the printer device ppdl_fncts Pointer to the pdl structure variable containing initialized function pointers Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully adding given language to supported PDL list Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 122 9 3 6 Begin the Print Job This function begins the printing job INTERR USBH_PRN_JobBegin USBH_PRN_DEV pprn_dev Arguments pprn_dev Pointer to the printer device Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on s
50. ION OF THE DEVICE DESCRIPTOR STRUCTURE bNumConfigurations Member Purpose ee ell El eto cA eeh El EE SE bDeviceClass The class code assigned by the USBIF except when equal to 0x00 or OxFF If equal to zero each interface specifies its own class code If E e UBIO OIE Ae Clases vendo sperms E EE eg E EE bMaxPacketSize0 The maximum packet size for endpoint zero Valid sizes are 8 16 32 and 64 The number of possible configurations CONNECT USB Host WITTENSTEIN high integrity systems Page 57 5 1 16 Configuration Descriptor Structure USB_CFG_DESC The configuration descriptor describes the information about a specific device configuration A USB device has one or more configuration descriptors Each configuration has one or more interfaces CONNECT USB Host WITTENSTEIN high integrity systems Page 58 TABLE 5 4 MEMBER DEFINITION OF THE CONFIGURATION DESCRIPTOR STRUCTURE Member Purpose bmAttributes bMaxPower 0x02 i e the value for the Configuration descriptor type The total length of the configuration data interface descriptors and endpoint descriptors including Reserved set to 1 USB 1 0 bus powered Self powered Remote wakeup Reserved set to 0 The maximum power consumption in 2 mA units CONNECT USB Host WITTENSTEIN high integrity systems Page 59 5 1 17 Interface Descriptor Structure USB_IFACE_DESC This descriptor describ
51. IO_RefRel This function decrements the reference count of a audio device INTERR USBH_AUDIO_RefRel USBH AUDIO DEV p audio dev Arguments p audio dev Pointer to the audio device Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 174 11 1 5 Input Terminal Count USBH_AUDIO_InTerminalsCount This function returns input terminal count UINT32 USBH_AUDIO_InTerminalsCount USBH_AUDIO_ DEV p_ audio dev Arguments p audio dev Pointer to the audio device Return Value Number input terminals 11 1 6 Output Terminal Count USBH_AUDIO_OutTerminalCount This function returns output terminal count UINT32 USBH_AUDIO_InTerminalsCount USBH_AUDIO_ DEV p_ audio dev Arguments p audio dev Pointer to the audio device Return Value Number output terminals CONNECT USB Host WITTENSTEIN high integrity systems Page 175 11 1 7 Get I P Terminal Type USBH_AUDIO_InTerminalTypeGet Returns the type of the input terminal STR USBH_AUDIO_InTerminalTypeGet USBH _AUDIO_DEV mp audio dev UINT08 term_ix UINT16 p_term_type _ Arguments p audio dev Pointer to the audio device term_ix Index of terminal p_term_type The terminal type as defined in USB Audio Specifications Return Value A string describing the name of t
52. ME FNCT USBH CLASS DISCONN_FNCT LK Resume U U U U LK Disconn The following code defines a Bulk class device structure typedef struct usbh bulk dev NOTE 1 USBH_ CLASS DEV ClassDev NOTE 2 WSS EE BulkInEP USBH EP Bul kOutEP USBH DEV DEW Prep USBH IF A EREE OSL HMUTEX HMutex void Ave ENEE USBH_BULK_DEV define USB CLASS CODE BULK E NOTE 3 define USBH CFG MAX BULK DI NOTE 4 Stat IMM POOL USBH BULK DevPool NOTE 5 static USBH BULK DI USBH BULK DevArr USBH CFG MAX BULK DEV Note 1 Bulk class device structure Note 2 Generic class device structure that defines the base functionality CONNECT USB Host WITTENSTEIN high integrity systems Page 36 The Bulk and generic class devices is accessed with same pointer The USBH_CLASS_DEV variable must be declared as the first member of the structure Note 3 Bulk Interface class code OXEE Note 4 Maximum number of BULK devices the class driver can support Note 5 Memory pool for BULK class devices The USBH_BULK_Globallnit function initializes the Bulk class driver This function is called only once when the application registers a Bulk driver using USBH_ClassDrvReg function Staue IONWERR USBH BULK GlobalInit void SD EE SIA LE eege LECE INT32 EI were aie Of ax lt USB Cle MWA BULK
53. O8 font_height UINTO8 pcmd_len Arguments pbuf Pointer to variable which receives framed command burlen Length of the buffer pointed by pbuf variable font_height Height of the font pcmd_len Pointer to a variable which receives actual command length Return Value USBH_ERR_NONE on successfully framing the command to set the height of the font Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 147 9 5 11 Frame Set Font Underline Command This function frames the command to set automatic underlining of the font text INTERR FontUnderlineSetCmdFr UINTO8 pbuf UINTO8 buf len UINTO8 pcmd_len Arguments pbuf Pointer to variable which receives framed command buf_len Length of the buffer pointed by pbuf variable pocmd_len Pointer to a variable which receives actual command length Return Value USBH_ERR_NONE on successfully framing the command to set the automatic font underlining Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 148 9 5 12 Frame Clear Font Underline Command This function frames the command to clear automatic underlining of the font text INTERR FontUnderlineClearCmdFr UINTO8 pbuf UINTO8 buf len UINTO8 pcmd_len Arguments pbuf Pointer to variable which receives framed command buf_len Length of the buffe
54. RArg UINTO8 EHCI_DescBuf EHCI_DESC_RAM SIZE __attribute__ aligned 4096 INTERR BSP_USB_ Host Init UINTO8 he nr USBH_HOST CNTRLR ap bei e ege EICH Geer NOTE 1 penea Dew Pei BHCI Dev p_hc gt HCBaseAddr SIE WSs Io ieVASIs SS NOTE 2 p_he gt HCDescBuf EHCI DescBuf NOTE 3 p_hce gt HCDescBufLen HCI DESC RAM SIZE p_hc gt DMADataBuf p_hc gt DMADataBufLen D D 0 0 p_hc gt UseDMADataRegion DEF FALSE NOTE 4 DEF TRUE NOTE 5 NOTE 6 _ Ine sisi Damen siene E Chip SCU_PinMux 0x2 6 MD PUP MD EZI FUNC4 Chip SCU_PinMux 0x2 5 MD PLN MD EZI MD ZI FUNC2 Chip SCU PinMux 0x1 7 MD PUP MD EZI FUNC4 Chip GPIO WriteDirBit LPC_GPIO PORT 5 6 true line GIL WiricePoriewwic MPC CLO POS 5 EE Chip Clock EnablePLL CGU_USB PLL while 1 Chip Clock GetPliStatus CCU USE PLL amp CCU PLL Lock Chip Reo caer maior as Cio ea Ging sok DIS 0 Chip Clock Mineloileopics CA M USO true tiewe Li Chip CREG EnableUSBOPhy true return USB ERR NON CONNECT USB Host WITTENSTEIN high integrity systems Page 191 Note 1 Use EHCI driver and EHCI device structure for this host controller Note 2 The base address of EHCI registers Note 3 Assign a memory block for host controller descriptors Note 4 The USB host controller on LPC1830 can perform USB trans
55. Return Value A pointer to the USBH_IFACE structure representing the USB device interface 5 1 7 Get Number of Alternate Settings USBH_NbrAltsGet This function returns the number of alternate settings supported by the given USB Interface UINTO8 USBH_NbrAltsGet H_IFACE place _ Arguments piface This is a pointer to a USBH_IFACE interface structure Return Value The number of alternate settings in the interface CONNECT USB Host WITTENSTEIN high integrity systems Page 49 5 1 8 Get Interface descriptor USBH_IFDescGet Gets the interface descriptor at specified alternate setting index INTERR USBH_IFDescGet USBH_IFACE piface UINTO8 alt_ix USB_IFACE DESC poiface desc Arguments piface Pointer to the USB interface structure alt_ix Index of the alternate setting piface_desc Pointer to the alternate interface descriptor if the function succeeds Return Value USBH_ERR_NONLE if the interface descriptor found USBH_ERR_INVALID_ARGS if any arguments are invalid CONNECT USB Host WITTENSTEIN high integrity systems Page 50 5 1 9 Get Interface Extra Descriptor USBH_IFExDescGet A standard interface descriptor may contain one or more extra descriptors or fields which can be accessed by the following function USB_DESC_HDR USBH_IFDescGet USBH_IFACE piface UINT08 alt_ix INTERR perr ys Arguments piface Pointer to the interface structure of the device alt
56. S e USp BEO SET INTERFACE e USB_REQ_GET_DESCRIPT OR e USB BEO SNCH FRAME e USB REQ SET _DESCRIPT OR bm_request_typ Bit 7 specifies the direction of the data flow either USB_DEVICE_TO_HOST e or USB_HOST_TO_DEVICE CONNECT USB Host WITTENSTEIN high integrity systems Page 76 Bits 6 and 5 together specify the request type e USB _REQ_TYPE_STANDARD e USB REQ _TYPE_CLASS e USB _REQ_TYPE_VENDOR e USB_REQ_TYPE_OTHER Bits 4 through 0 together represent the recipient e USB _REQ_RECIPIENT DEVICE e USB_REQ_RECIPIENT_INTERFACE e USB _REQ_RECIPIENT_ENDPOINT e USB _REQ_RECIPIENT_OTHER w_value A two byte value that may be used to pass information to the device w_index A two byte value that may be used to pass information to the device pdata A pointer to the buffer where the response to the control request if any should be placed w_length The size of the buffer data timeout_ms The timeout in milliseconds perr USBH_ERR_NONE if the transfer was successful Error code as outlined in Appendix A Otherwise Return Value The number of bytes received by the device if the transfer was successful Otherwise a Error Code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 77 6 4 Bulk Transfers 6 4 1 Synchronous Transmit USBH_BulkTx This function is used to send bulk data from the host to the device The endpoint must be of type USB_EP_TYPE_BULK and the direction must be USB_EP_DIR_OUT
57. UGPBH Noesen 46 5 1 2 Get Configuration USBH_CfgGet cccccccccccccceccececeeeceeeeeeeeeeeeeeeeeeeeeeseeeneees 47 5 1 3 Get Configuration descriptor USBH_CfgDescGet cccccecceccccceeceeeeeeeeeeeees 47 5 1 4 Get Configuration Extra Descriptor UGPBH CiotviesctGen 48 5 1 5 Get Number of Interfaces UGPBH NbrltsGen 48 5 1 6 Get Interface USBH cIFR Get iiccsrccctenecuecceterccnceecadevarthiex oun ivi cots naeueta er nceuinand 49 5 1 7 Get Number of Alternate Settings USBH_NbrAltsGet seeen 49 5 1 8 Get Interface descriptor USBH_IFDescGet cece ceeecceeeeeeeeeneeeeeeeeeeeeeneneeeeeeeees 50 5 1 9 Get Interface Extra Descriptor UGDH IFExesctGen 51 5 1 10 Get the interface number USBH_NbrIFsGet eeeseseseeeneeeeeeeeeeeeeeeeeeeees 51 5 1 11 Get Number of Endpoints USBH_NbrEPsGet eee eeeeeeeeeeeeeeeeeeeeeeeeeeees 52 5 1 12 Get Endpoint USBH_EPGet coches ei ee oe eau ieee 53 5 1 13 Seta configuration USBH_ CfgSet A 54 5 1 14 Get Endpoint USBA IFS ett icc connate seheetide ct ebe eeh hee SeEkN 55 CONNECT USB Host WITTENSTEIN high integrity systems Page 5 5 1 15 Device Descriptor Structure USB D EN DES cccccccccccccecceeecceeeeeeeeeeeeeeeees 56 5 1 16 Configuration Descriptor Structure USB CEG DES 58 5 1 17 Interface Descriptor Structure USB_IFACE_ DESC cccccccccccccceeeeeeeeeeeeeeeees 60 5 1 18 Endpoint Descriptor Structure USp ER DES
58. USBH CLASS DEVICE STATUS DISCONNECTED NOTE 16 Np USE Class Dezem Class _clew 5 break while p Class cew l On Note 13 If class event is not pending return Note 14 Get the next class device Note 15 Class device status is connected Initialize class device Note 16 Class device status is disconnected Uninitialize class device CONNECT USB Host WITTENSTEIN high integrity systems Page 29 static INTBOOL App USB Class Init USBH CLASS DEV p class dev Swateh o elass Cleyv gt ClaesCoce case USB CLASS CODE BULK USBH_ BULK Init USBH_BULK_DEV p class dev NOTE 17 break return DEF OK Note 17 Initialize the BULK class device static void App USB Class Uninit USBH CLASS DEV p class dev Swatch o Class cev gt ClassCoce case USB CLASS CODE BULK USBH_BULK Uninit USBH BULK DEV zip class_dev NOTE 18 break Note 18 Uninitialize the BULK class device The App_USB_BULK_Example function is an example that transmit the word HELLO to the device static void App USB BULK Example USBH BULK DEV p bulk dev ULNEOS ap K Siam WW grer lemp Dwr O WEG Jaen Mian 6 Jee ae lowe Si Min es lowe 4 USBH BULK Write p bulk dev NOTE 19 5 exter eat 7 Note 19 Transmit the buffer on BULK endpoint CONNECT USB Host WITTENSTEIN high integrity systems Page 30 4 Class
59. USBH MSC NNELL Eed venus Deatamecan shee plone 98 8 Human interlace Device Class eege eege eege eau ieee 99 8 1 dulde ele EE 99 8 1 1 Report RE e TEE 99 CONNECT USB Host WITTENSTEIN high integrity systems Page 7 8 1 2 COIS CUIOMS sessed EE a cn dae a 101 8 1 3 Ee 101 8 1 4 Ee 101 8 2 HID Class Grelhtecture ed ice ceswlicke de SEENEN EES eters ees 103 8 3 HID Class Driver AP Functions Sege Ge lelteente d EE ee 104 8 3 1 Initialize HID USBH FID Jott keet reegt envev yes eeneseenedsusadtecimenaateues lvacteacsterts 105 8 3 2 Uninitialize HID USBH_HID_Uninit cece cece eect eter eee eeeeeeeeeeneaeeeeeees 105 8 3 3 Application reference add UGPBH HID Rer ddi 106 8 3 4 Application reference release UGPBH HID Reie 106 8 3 5 Get Report ID array USBH_HID_GetReportIDArray ccceeeeeeeees 107 8 3 6 Get Application collection array USBH_HID_GetAppCollArray 2 065 108 8 3 7 Check boot subclass USB HID Iebootiev 108 8 3 8 Receive Report USGPBH HID Rxvbeportt 109 8 3 9 Transmit Report USBH_HID_TxReport cccccccccccccccceeeceeeeeeeeeeeeeeeeeeeeeeeess 110 8 3 10 Register callback USBH_HID_RegRXxCB eeceeseeeeceeeeeeeeeeeeeeeeeeeeeeeeenaaaeees 111 8 3 11 Unregister callback UGpBH HID UnregohvCHi nenna 112 8 3 12 Set the protocol USPBH HID ProtocolGen neea 112 8 3 13 Get the protocol USPBH HID ProtocolGent nenna 113 8 3 14 Set Idle rate USBH RI tt nos
60. USBH_HID_DEV p_hid_dev USBH_HID_REPORT_ID mp report d UINTOS p nbr_report_id_ Arguments p_ hid_dev Pointer to USBH_HID_DEV structure p report jd Pointer to hold report ID structure array base p nbr report d Pointer to hold number of structures in array Return Value On success returns 0 On failure returns specific error number as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 107 8 3 6 Get Application collection array USBH_HID_GetAppcCollArray This function gets the application collection structure array address and number of structures INTERR USBH_HID_GetAppCollArray USBH_HID_DEV p_hid_dev USBH_HID_APP_COLL op app coll UINTO8 p nbr_app coll _ Arguments p_ hid_dev Pointer to USBH_HID_DEV structure papp coll Pointer to hold Application collection structure array base p nbr_app_coll Pointer to hold number of structures in array Return Value On success returns 0 On failure returns specific error number as outlined in Appendix A 8 3 7 Check boot subclass USBH_HID_IsBootDev This function checks whether the HID belongs to boot sub class or not INTERR USBH_HID_IsBootDev USBH_HID_DEV p_hid_dev INTBOOL pls boot Arguments p_ hid_dev Pointer to USBH_HID_DEV structure pls boot Pointer to hold boot flag Return Value On success returns 0 On failure returns specific error number as outlined in Appendix A
61. Value On success returns 0 On failure returns specific error number as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 114 9 Printer Class The USB Implementers Forum www usb org has defined the USB Device Class Definition for Printing Devices specification to interconnect printer devices to Host computers The specification defines the configuration interface and endpoint descriptors as well as the communications protocol used to communicate with a USB printer The USB Printer Class interface defines Bulk OUT endpoint to send data to the printer and Bulk IN endpoint for receiving status from the printer Printers support one or two endpoints In addition to the Default endpoint printers are required to support the Bulk OUT endpoint or both the Bulk OUT and the Bulk IN endpoints The Control Endpoint 0 is used for control transfers to and from the host The USB printer devices typically support the following interface protocols e Unidirectional interface e Bidirectional interface e IEEE 1284 4 compatible interface The unidirectional interface supports only the sending of data to the printer via a Bulk OUT endpoint The status from the printer is received via the class specific command GET_PORT_STATUS The bidirectional interface supports sending data to the printer via the Bulk OUT endpoint and receiving status and other information from the printer via the Bulk IN endpoint The IEE
62. Wr Writes specified number of blocks to a LUN in mass storage device UINT32 USBH_MSC_Wr USBH_MSC_DEV p_ msc_dev UINTO8 lun UINT32 blk_addr UINT16 nbr_blks UINT32 blk_size void p_arg INTERR p_err Arguments p msc_dev Pointer to the USBH_MSC_DEV structure lun Logical unit number of mass storage device where the data is written to blk_addr Starting block number nbr_blks Number of blocks to write to blk_size Block size p arg Pointer to the data to be written p err Pointer to hold error code if writing failed otherwise it is set to 0 Return Value Returns number of bytes successfully written CONNECT USB Host WITTENSTEIN high integrity systems Page 98 8 Human Interface Device Class 8 1 Introduction The USB human interface device class USB HID class describes human interface devices that are used by humans to control the operation of computer systems Typical examples of HID class devices include Keyboards and pointing devices for example standard mouse devices trackballs and joysticks Front panel controls for example knobs switches buttons and sliders Controls that might be found on devices such as telephones VCR remote controls games or simulation devices for example data gloves throttles steering wheels and rudder pedals Devices that may not require human interaction but provide data in a similar format to HID class devices for exampl
63. _ix Selected alternate setting index perr Pointer to the variable that holds error code USBH_ERR_NONE if extra descriptor present USBH_ERR_EXTRA_DESCRIPTOR_NOT_PRESENT if no extra descriptor present Return Value A pointer to the USB_DESC_HDR structure representing the header of the extra descriptor 5 1 10 Get the interface number USBH_NbrIFsGet This function returns the interface number contained in the interface descriptor UINTO8 USBH_NbrliFsGet USBH_IFACE piface 1 Arguments piface The pointer to interface structure Return Value The interface number CONNECT USB Host WITTENSTEIN high integrity systems Page 51 5 1 11 Get Number of Endpoints USBH_NbrEPsGet This function returns the number of endpoints supported by the given Alternate Setting UINTO8 USBH_NbrEPsGet USBH_IFACE piface UINT08 alt_ix Lt Arguments piface The pointer to the interface structure alt_ix The index of the selected alternate setting Return Value The number of endpoints present in the alternate setting CONNECT USB Host WITTENSTEIN high integrity systems Page 52 5 1 12 Get Endpoint USBH_EPGet This function returns the endpoint structure at the given index of the endpoint array INTERR USBH_EPGet USBH_IFACE piface UINTO8 alt_ix UINTO8 ep IN USBH_EP pep Arguments piface Pointer to a USBH_IFACE structure alt_ix Index of the selected alternate set
64. aneously This value must be less than 128 define USBH_CFG_MAX_NBR_DEVICES 1 USBH_CFG_MAX_NBR_CFGS defines the maximum number of configurations supported per USB device define USBH CFG MAX _NBR_CFGS 1 USBH_CFG_MAX_NBR_IFS defines the maximum number of interfaces supported per configuration define USBH_CFG_MAX_NBR_IFS 5 USBH_CFG_MAX_NBR_EPS defines the maximum number of endpoints supported per interface excluding the default control endpoint define USBH_CFG_MAX_NBR_EPS 2 USBH_CFG_MAX_CFG_DATA _LEN defines the maximum configuration data length define USBH CFG MAX CFG DATA LEN 512 USBH_CFG_MAX_STR_LEN defines the maximum string descriptor length define USBH_CFG_MAX_STR_LEN 256 USBH_CFG_MAX_NBR_CLASS_DRVS defines the maximum number of class drivers supported Note The hub driver must be supported for the host controller root hub to operate hence this value must be greater than one if other class drivers are to be supported define USBH_CFG_MAX_NBR_CLASS_DRVS 7 USBH_CFG_MAX_HUBS defines the maximum number of Hubs supported Note The root hub must be supported hence this value must be greater than one if external hubs are supported define H CFG MAX HUBS 2 CONNECT USB Host WITTENSTEIN high integrity systems Page 24 USBH_CFG_MAX_HUB PORTS defines the maximum number of Hub ports supported per Hub
65. as that today connect to the PC as a USB peripheral will also connect to other USB devices directly using USB OTG port CONNECT USB Host WITTENSTEIN high integrity systems Page 16 2 USB Host Stack Architecture The CONNECT USB Host Architecture design conforms to USB v1 1 and v2 0 specifications and is available tightly integrated with either FreeRTOS OPENRTOS or SAFERTOS Its modular design allows easy adaptation to different USB host controllers Figure 2 1 shows a block diagram of the different layers of the USB Host Stack OPENRTOS TT SAFERTOS USB Host Classes USB Host Core Hub Driver USB Host Controller Drivers Hardware FIGURE 2 1 USB HOST STACK ARCHITECTURE Software 2 1 USB Class Drivers The USB Specification defines several classes that characterize the USB device functionality CONNECT USB Host provides USB Class Drivers for different USB device classes listed in Table 2 1 More information on the CONNECT USB Host class drivers is provided in later sections of this document CONNECT USB Host WITTENSTEIN high integrity systems Page 17 TABLE 2 1 USB HOST CLASS DRIVERS USB Class Target Devices Mass Storage Flash drives Zip Drives MP3 Players Digital Cameras External Hard Drives etc HID Keyboard Mouse and Sensors CDC USB Modems and USB to Serial devices Printer USB Printers Audio USB Speakers and USB docking stations HUB USB External Hubs SEN Specific USB devices
66. ata buffer time_out Timeout value in milliseconds Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 169 10 4 11 Serial Event Callback USBH_CDC_SerEventNotify The application can implement this callback function to receive serial events The CDC driver calls these routines when it receives notification events from the device INTERR USBH_CDC_SerEventNotify UINT16 line_status Arguments Description line_status Status from the device Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix B will be returned 10 4 12 Error Reporting Macros To check what type of error has occurred in the device the following macros are avaliable USBH_CDC_SER_OVER_RUN RS 232 signal Buffer over Run Error USBH_CDC_SER_PARITY_ERR RS 232 signal Parity Error USBH_CDC_SER_FRAME_ERR_ RS 232 signal Frame Error USBH_CDC_SER_RING_INDC RS 232 signal Ring Indicator USBH_CDC_SER_BRK RS 232 signal Break CONNECT USB Host WITTENSTEIN high integrity systems Page 170 11 Audio Class USB Audio devices contain independent function blocks For ex MIC Speaker Mixer etc called Audio functions Audio functions are addressed through their audio interfaces Each audio function has a single AudioControl interface and can have several AudioStreaming i
67. c ene D descriptor 2701 USB_ERR_HID_UNKNOWN_ITEM Unknown item found in rr 2702 USB_ERR_HID_MISMATCH_COLL Mismatch in collections 2703 USB_ERR_HID_MISMATCH_PUSH_POP Mismatch in push and pop items CONNECT USB Host WITTENSTEIN high integrity systems Page 206 CONNECT USB Host WITTENSTEIN high integrity systems Usage page is out of Not an collection application No application collection exists Report not found descriptor failed Page 207 2726 USB_ERR_HID_MAX_RXCB Maximum receive call back functions 2727 USB_ERR_HID_MAX_REPORT_DESC_LEN Maximum report descriptor length 2728 USB_ERR_HID_MAX_NBR_REPORT_ID Maximum no of report IDs 2729 USB_ERR_HID_MAX_APP_COLL Maximum application collections 2730 USB_ERR_HID_MAX_REPORT_FMT Maximum report formats 2800 USB_ERR_CDC_CTRL_SIGNALS_NOT_SUPPORTED Control signals not E cc supported S E Een EE d ik Printer clasg FIONS 2900 USB_ERR_NO_ACTIVE_PDL No active page description laguage 2905 USB_ERR_CFG_MAX_NBR_PRN_DEV Maximum no of printer O Ea E EI S 23 TOR S EE 4002 USB_ERR_MUTEX_LOCK_ISR Mutex lock ISR error CONNECT USB Host WITTENSTEIN high integrity systems Page 208 Mutex task waiting destroy Semaphore creation failed Semaphore failed destroying Semaphore destroy task waiting wait ISR Semaphore Semaphore exceeded USB_ERR_THREAD_PRIO_INVALID
68. containing the data to be printed row_len Length of the row buffer pointed by prow variable Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully printing the given row of the image data Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 134 9 3 23 Register Callback Routine This function registers the application provided status callback function invoked when there is status response from the printer device INTERR USBH_PRN_CallbackReg USBH_PRN_DEV pprn_dev PRN_STAT_FNCT StatusPtr Arguments pprn_dev Pointer to the printer device StatusPtr Pointer to printer status callback function Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully registering the given application callback routine Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 135 9 4 Introduction to Page Description Language PDL The Page Description Language PDL is a language that describes the appearance of a printed page An overlapping term is the Printer Control Language but it should not be confused as referring solely to Hewlett Packard s PCL There is also PostScript one of the most noted Page Description Languages which is a fully fledged programming language but many PDLs are not comp
69. cture depending on the type of host controller hardware Pointer to Host Controller Device structure The BSP_USB_Host_Init function shall assign OHCI or EHCI or other device structure Host Controller Register Base address where OHCI or EHCI or other interface registers will start The BSP_USB_Host_Init function shall assign a base address to this member Memory buffer for host controller DMA descriptors If peripheral memory region is used for USB peripheral the buffer should point to a memory block in peripheral memory region The length of HCDescBuf in bytes For OHCI interface the macro OHCI_DESC_RAM_SIZE will determine the length required For EHCI interface the macro EHCI_DESC_RAM_SIZE will determine the length required If the USB transfers require peripheral memory for DMA transfers This variable should point to memory block from peripheral memory region The varaible UseDMADataRegion must be set to DEF_TRUE If the system memory can be used for USB transfers this parameter is set to 0 and is ignored The UseDMADataRegion must be set to DEF_FALSE The length of DMADataBut in bytes For OHCI interface the macro OHCI_DATA_RAM_SIZE will determine the length required CONNECT USB Host WITTENSTEIN high integrity systems Page 186 UseDMADataRegion CONNECT USB Host WITTENSTEIN high integrity systems Pointer to host controller structure This variable tells host stack to use System memory
70. data transfer or This request sends special carrier modulation that generates an RS 232 style break SEND ENCAPSULATED COMMAND GET ENCAPSULATED RESPONSE CONNECT USB Host WITTENSTEIN high integrity systems Page 158 10 8 Communication Interface Notification Events The notification events that are valid for a communication interface class with abstract control model as subclass are listed in the table below TABLE 10 2 COMMUNICATION INTERFACE NOTIFICATION EVENTS Request Description NETWORK CONNECTION Not supported SERIAL STATE Returns the current state of the carrier detect DSR break and ring signal CONNECT USB Host WITTENSTEIN high integrity systems Page 159 10 4 Communication Device Class CDC API TABLE 10 3 COMMUNICATION DEVICE CLASS CDC API Argument Description USBH_CDC_Init Initializes the CDC device USBH_CDC_Uninit Unitializes the CDC device USBH_CDC_RefAdd Application reference add USB_CDC_RefRel Application reference release USB_CDC_CallbacksReg Register application callback structure USBH_CDC_SetLineCoding Set serial communication baud rate This value can be any of the following 9600 14400 19200 38400 57600 115200 128000 and 256000 bits per second USBH_CDC_GetLineCoding Get serial communication Baud rate This value can be any of the following 9600 14400 19200 38400 57600 115200 128000 and 256000 bits p
71. e bar code readers thermometers or voltmeters 8 1 1 Report Descriptor HID class device contains a Report Descriptor that defines data protocol and the type of data that device will understand The Report descriptor is loaded and parsed by the HID class driver as soon as the device is detected CONNECT USB Host WITTENSTEIN high integrity systems Page 99 Application Collection Collection Report Main Item Report Report Report Size l Report Count Main Item Main Item Report Size Report Size Usage Usage Report Count Report Count Logical Minimum Logical Minimum Logical Maximum en ey usage usage usage FIGURE 8 1 HID CLASS DEVICE FROM PARSER S POINT OF VIEW Logical Maximum The HID class driver contains a parser used to analyze items found in the Report descriptor The parser extracts information from the descriptor in a linear fashion The parser collects the state of each known item as it walks through the descriptor and stores them in an item state table The item state table contains the state of individual items From the parser s point of view a HID class device looks like Figure 8 1 HID Boot Protocol The Report descriptor parser implementation requires significant amount of code that may not be fit in to the boot code BIOS Alternatively a subclass code is used to quickly identify whether the device supports predefined protocols or not For example the
72. e Clear Font Underline Command ccecceccencceeeeeeeeeseeeeeeeeeeeeenseeaaeeees 149 9 5 13 Frame Font Information Request sessserrrtrrtttrttrtttttttnr ttnn nnn nnna rnern rennene 150 9 5 14 Frame Image Row Header 151 9 5 15 Parse the Status RESPONSE 0 00 2 ccccccecccecceecececeeeceeeceeecceeececeeeeeeeeeeeeeeeeeeeseeeeeess 152 9 6 Printer Command Language PCL is scsi tiie bit iet teria reeereur noi biy iat od ede 153 9 7 Printer Job language saiia ea teeter a aa E E EE a Ee 154 9 8 Benefits EE 155 9 9 Status Readback Comiumans s escscacaceteactue ae bhcedyauardberdtaarnvacen nt ENEE 155 9 10 Printer Status Requirements sseseseeseeeeeeeeeeteeetttttttttttttttttttttttttttttttttttttttttttttEErtE Ent 156 9 11 Format of Status Readback HResponses 156 10 Communication Device Class CDCH cc ccccceeeeseeeeereeeeeeeeeeeneeeeeeeeeeeeeeeenaaeeeeeeeeeeneeed 157 10 1 CDC Class specific Requests ccccccccccssccceeceeeeeeceeeeaeeceeccecececceeceeceeeeeeeeeeeeeeeeteess 157 CONNECT USB Host WITTENSTEIN high integrity systems Page 10 10 2 Communication Interface Class Requests ccccccccccccceccceeceeeceeeeeeeeeeeeeeeeeseeeeteess 158 10 3 Communication Interface Notification Events 159 10 4 Communication Device Class CDO API ssessssesesereeseseerrirrttresesrrirrrresssrrererresssreet 160 10 4 1 Initialize CDC Device USBH_CDC_ In 161 10 4 2 Uninitialize CDC Device USBH_CDC_Uninit 0 161
73. eceeeeeeeeeeeseeseeeseeess 129 9 31 16 Set the Font Height ie eege deele sales aerial 130 9 3 17 Set Automatic Font Underlining cccccccccccccsccccecceeceeeeeeeeeeeeeeeeeeeeeeseeeeeeeeeess 130 9 3 18 Clear Automatic Font Under lining cccccccccccccccecceeceeeeceeeeeeeeeeeeeeeeeeeeeeeeseeess 130 9 3 19 Get the Supported Font Ust nenne ennnen 131 9 3 20 Setthe Tem ROMs ageet eer Ee Eer 131 9 3 21 Print the Text Data iere eiaeiiai tni decade EEE EEEE E EEA PEE a rede 133 9 39 22 Print the lmage Deet cesta ageing cave thd en es oats Ate eee 134 9 3 23 Register Callback ROUUNG isc 2000 spec nh ENEE EEN erected des sant sede cay eenleans deeds 135 9 4 Introduction to Page Description Language PID 136 CONNECT USB Host WITTENSTEIN high integrity systems Page 9 9 5 Page Description Language Routines cece eect eee e eter eee ee rete ete e tent eeeteeeeenees 137 9 5 1 te EE 137 9 5 2 Frame Set Page Orientation Commande 139 9 5 3 Frame Set Page Left Margin Commande 140 9 5 4 Frame Set Page Right Margin Commande 141 9 5 5 Frame Set Page Top Margin Commande 142 9 5 6 Frame Clear Page Margins Commande 143 9 5 7 Frame Set Line Spacing Command ccccccessseeeccceeeeeeeeeseeeeeeeeeeeeeneseeeeeees 144 9 5 8 Frame Set Number of Copies Commande 145 9 5 9 Frame Set Font Weight Commande 146 9 5 10 Frame Set Font Height Commande 147 9 5 11 Frame Set Font Underline Commande 148 9 5 12 Fram
74. emaphore OSL_SemPost vi ccccscecesiecctes ied ceedde ead clei veetincaseeeseeeee dene 198 13 2 4 Destroy Semaphore USB_OS_SemDestroy eeceeeeeeeeeeeeeeeeeetneeeeeeeeeeeeeee 198 13 3 Mutex Abstraction Routines AAA 199 13 3 1 Create Mutex OS MutexCreatel EEN 199 13 3 2 Lock Murex OSL_MutexLock Ac siie tt GG onal ace 199 13 3 3 Unlock Mutex OSL_MutexUnlock REENEN 200 13 3 4 Destroy Mutex OSL_MutexDestroy e 200 13 4 Delay ROULNGS get geesde deed a bate haat Geleet Eeer EI 201 13 4 1 Delay Task by Milliseconds OSL_DefDlyMS A 201 13 4 2 Delay Task by Microseconds OSL_DefDlyUS A 201 13 5 Critical SO Red 202 13 5 1 Critical Section Lock OSL_DefCriticalLOck eeeeceeeeeeeeeeeeeeeeeetneeeeeeeeeeenee 202 13 5 2 Critical Section Unlock OG DeiCr tcall ock 202 CONNECT USB Host WITTENSTEIN high integrity systems Page 13 1 Introduction The CONNECT USB Host component takes responsibility for detecting insertion and removal of USB devices providing power assigning a unique address to the attached devices and managing the control and data flow It enables developers to integrate USB host functionality easily into embedded products Features e Compact amp full featured embedded USB Host software component e Supports Mass Storage HID Printer CDC and Audio class drivers e Supports OHCI and EHCI controller standards e Supports all Transfer types Control Bulk Interrupt and Ilsochronous e Comp
75. endpoint is opened Otherwise a specific error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 64 6 1 2 Open Bulk out endpoint USBH_BulkOutOpen This function is used to open a bulk endpoint with direction OUT This endpoint is used to send any bulk data INTERR USBH_BulkOutOpen USBH_DEV pdev USBH_PIFACE piface USBH_EP pep Arguments pdev Pointer to the USB Device structure piface Pointer to the interface structure pep Pointer to the endpoint structure Return Value USBH_ERR_NONE if the Bulk OUT endpoint is opened Otherwise a specific error code as outlined in Appendix A otherwise CONNECT USB Host WITTENSTEIN high integrity systems Page 65 6 1 3 Open Interrupt in endpoint USBH_IntrinOpen This function is used to open an interrupt endpoint with direction IN This endpoint is used to receive any interrupt data INTERR USBH_IntrinOpen USBH_DEV pdev USBH_PIFACE piface USBH_EP pep Arguments pdev Pointer to the USB Device structure piface Pointer to the interface structure pep Pointer to the endpoint structure Return Value USBH_ERR_NONE if the Interrupt IN endpoint is opened Otherwise a specific error code as outlined in Appendix A otherwise CONNECT USB Host WITTENSTEIN high integrity systems Page 66 6 1 4 Open Interrupt out endpoint USBH_IntrOutOpen This function is used to open an interrupt endpoint wi
76. ep void mp but UINT32 buf_len USBH_INTR_CMPL_FNCT pp _fnet USBH_ISOC_DESC mp isoc_desc Void p_fnct_arg Argument p ep Pointer to the endpoint p buf Pointer to the data buffer buf_len Number of data bytes in buffer p_fnct Pointer to asynchronous function which will be invoked by the asynchronous I O task when the transfer is complete p_isoc_desc Pointer to the isochronous descriptor p fnct_arg Pointer to a variable that will be passed to asynchronous function Return Value USB ERR NONE If the request is submitted USB_ERR_INVALID_ARGS If p_ep is 0 USB_ERR_EP_CLOSED If the endpoint is closed USB ERR ER INVALID If the endpoint type is not lsochronous or direction is not in Otherwise specific error code as define in appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 89 7 Mass Storage Class 7 1 Introduction The Mass Storage Class MSC is a USB class protocol defined by USB Implementers Forum The standard defines an interface to read and write blocks of data into memory of USB mass storage devices Mass storage devices store data into non volatile memory such as NAND NOR SD MMC and Hard Drive etc A MSC device is composed of a default control endpoint 0 for enumeration and mass storage class specific requests a Bulk OUT end point to send the SCSI commands and data to device a Bulk IN endpoint to receive the SCSI response and data from the device and an optional Interrupt IN endpoint if CBI trans
77. er second USBH_CDC SetLineState USBH_CDC_SerRxData Set RTS CTS flow control state Transmit data bytes Receive data bytes CONNECT USB Host WITTENSTEIN high integrity systems Page 160 10 4 1 Initialize CDC Device USBH_CDC_Init This function Initializes the CDC Class device INTERR USBH_CDC_Init USBH_CDC_DEV pcdc_dev_ Arguments ocdc_dev Pointer to the CDC device Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix B will be returned 10 4 2 Uninitialize CDC Device USBH_CDC_Uhninit This function uninitializes the CDC Class device INTERR USBH_CDC_Init USBH_CDC_DEV pcdc_dev_ Arguments pcdc_dev Pointer to the CDC device that is unitialized Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix B will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 161 10 4 3 Application reference add USBH_CDC_RefAdd Increment the application reference count to the CDC ACM device INTERR USBH_CDC_Init USBH_CDC_DEV p_cde dev Arguments ocdc_dev Pointer to the CDC ACM device that is added Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix B will be returned 10 4 4 Application reference release USBH_CDC_RefRel Decrement the reference count of a CDC A
78. es a specific interface within a configuration Each interface has zero or more endpoints and may include alternate settings that allow the endpoints and their characteristics to be varied after the device has been configured EVOSCISE struct uso Lace Cese H NTO8 bLength bDescriptorType TOS z CO blater SLSIN UMS ie e bAlternateSetting bNumEndpoints I z CO H bInterfaceClass bInterfaceSubClass binterf aceProtocol i zl E CO ee E E E E amp E amp CH GL NT NT NT N N N NT NT 2 CO iInterface USB_IFACE_ TABLE 5 5 MEMBER DEFINITION OF THE INTERFACE DESCRIPTOR STRUCTURE Member Purpose Ee Ee KK DIME ACE NAME nei EE HE US EE EE EE EE Ge eg EE EE SBE iInterface The index of the string descriptor describing this interface CONNECT USB Host WITTENSTEIN high integrity systems Page 60 5 1 18 Endpoint Descriptor Structure USB_EP_DESC This descriptor contains the information required by the host to determine the bandwidth requirements of each endpoint It is always returned as a part of the configuration information No descriptor exists for endpoint zero EYDECSi cen melen Eo close Jeng DescriptorType mAttributes MaxPacketSize b b bEndpointAddress b w Jeu lt USB_EP DESC TABLE 5 6 MEMBER DEFINITION OF THE ENDPOINT DESCRIPTOR STRUCTURE Member Pur
79. es cosa aoe oocyte einledes 113 8 3 15 Get Idle rate USPBH HID Ideen eee ceeeeeeeece cee eeeseeeeeeeeeeeeeeeeeneeeeeeeees 114 9 Cie ee 115 9 1 Ed UU ET EE 116 9 2 Printer Class Archie EE 117 9 3 Printer Class AP Mr sts re hace seein beth ace deel ese ve dent eek et endian etme 118 CONNECT USB Host WITTENSTEIN high integrity systems Page 8 9 3 1 Add the Printer Device Reference Count cceeeeseeeeeeeeeeeeeeeneeeeeeeeeeeeeennaaaeees 119 9 3 2 Release the Printer Device Reference Count kee 120 9 3 3 Printer Class InitialiZzatlonise ees 120 9 3 4 Printer Class Un lnitialization s veer ECKE cenesteapcnceeidensdceevedents busts tveceeeeweasucens 121 9 3 5 Add Printer Description Language sssssseesereseseeeerstrrrrrrrrersrrrtrrrtrtrerrsrnrrerenne 122 9 3 6 Begin the Print JOD 22 ege Eege NEEN ER dE ee 123 9 3 7 End the Print JOD ich ccc ea pees a a E EA E EE 123 9 3 8 Set Page Orientation nera era a hens lel edd and 123 9 3 9 Set Page Left Margin ccc cccccccceccceecceeeceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeteeteeeseeeeees 125 9 3 10 Set Page Right Margin serc e a a Eaa 126 9 3 11 Set Page Top Ee Un EE 126 9 3 12 Glear Page Margins EE 127 9 3 13 Set Page Line Gpnacng enana EA AE a TE 127 9 3 14 Set Page Number of Copies ccccccccscccecccecccecceeccececeeceeeceeeeececeseeeseeeeeeeeeeess 127 9 3 15 Set the Font Weight ccccccccscccseccceccaeceeceeeceeeeceeccecececceecce
80. ev gt HMutex jo _lIopulls Clew SSiceneSs WSs Civ EIERE NOTE 25 OSL MutexUnlock amp p_ bulk _ dev gt HMutex return USB ERR NONI Note 25 Set the class device state as connected CONNECT USB Host WITTENSTEIN high integrity systems Page 43 5 USB Device Descriptors USB devices contain descriptors that describe to the host what type of device it is its capabilities and how to configure it The USB core maintains this information in the structures A particular device descriptor may contain arranged hierarchically as shown in Figure 5 1 several configurations only one of which may be active at a given time Each of these configurations may contain one or more interfaces several of which may be active at a given time Each interface contains one or more alternate settings and each alternate setting has a list of endpoints that will be used USB_DEVICE numConfiguration 2 USB_CONFIGURATION numinterfaces 2 USB_INTERFACE USB_ALT_SETTING numEndpoints 2 USB_INTERFACE USB_ALT_SETTING numEndpoints 2 USB_CONFIGURATION numInterfaces 2 USB_INTERFACE USB_ALT_SETTING numEndpoints 2 USB_INTERFACE USB_ALT_SETTING numEndpoints 2 USB_CONFIGURATION USB_CONFIGURATION USB_CONFIGURATION
81. evice Models types of CDC devices defined in the CDC specification each CDC device model is assigned a sub class code CONNECT USB Host stack currently supports CDC ACM Abstract Control Model CDC ACM devices provide serial communication interface like RS 232 over USB 10 1 CDC Class specific Requests The CDC specification defines two interface classes Communication Interface class and Data Interface class The Communication Interface class is used for device management device requests and notification events The Data Interface class is used for generic data transmission such as data transfer to and from the device The Communication Interface class uses default control endpoint for serial control and the Interrupt In endpoint for serial notification events The Data Interface class uses Bulk In and Bulk Out endpoints for data transfer CONNECT USB Host WITTENSTEIN high integrity systems Page 157 10 2 Communication Interface Class Requests The class specific requests that are valid for a communication interface class with abstract control model as subclass are listed in the table below TABLE 10 1 COMMUNICATION INTERFACE CLASS REQUESTS Request Description SET LINE CODING This request allows the host to specify serial port settings This request allows the host to find out the currently configured serial port settings This request signals the DCE device that DTE is present and specifies whether DTE is ready for
82. f determinism and robustness to embedded systems Based on the FreeRTOS function model but specifically re designed for the safety market by our own team of safety experts SAFERTOS is independently certified by TUV SUD to IEC 61508 SIL3 CONNECT Middleware CONNECT MIDDLEWARE components are feature rich and designed specifically for embedded platforms They are available with all WHIS RTOS products as one highly integrated fully optimized and verified package accompanied by a demonstration application CONNECT MIDDLEWARE supports USB Host amp Device Networking and File systems Table of Contents CONNECT USB Host WITTENSTEIN high integrity systems Page 3 1 lg eeler ON BEE i cee Rena ah ee et Mal Sad cel See cecal etree baa tS 14 1 1 Universal Serial Bus USB Overview 70 eEEEeeeEgeEEER deeg 15 Mie SUS BOGE egen 15 133 USB KE 15 1 4 USB Data Transfer Types ee avd aad Aut Ate a 15 15 USB Kane OG eelere ele 16 2 USB Host Stack EG eeedee ere eene EE 17 2 1 USB Class RE 17 2 27 USB Core DINER ie ee cca alain eee A aA en Gale aa eae 18 2 3 USB Host Controller Driver ACD sacccecs cence ecaadd ors cedars bastesbedetdcesaducetdenesnavcaeibeeriddorsees 18 24 RTOS ADSUACHON EE 18 3 JUS Ee ee deed ege EE 19 3 1 Host Controller API Functions 2 cccen sence cecal aeeelueeiedeleeespictend aunbi cohes preeks cheese hamid 19 3 1 1 Initialize USB Host USBr El etlptt ett Edert otrelavaneinl am aes 20 3 1 2 Add Host Controlle
83. f the mutex should be set to 1 which indicates the mutex is available INTERR OSL_MutexCreate OSL HSEM ph mutex Argument ph_mutex This will be assigned the handle that is used in managing the mutex Return Value USBF_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned 13 3 2 Lock Mutex OSL_MutexLock This routine makes a task to wait on the mutex The task waits until the mutex is available INTERR OSL_MutexLock OSL_HMUTEX h_ mutex Argument h_mutex This is the handle that is used in managing the mutex Return Value USBF_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 199 13 3 3 Unlock Mutex OSL_MutexUnlock This routine unlocks mutex so that any task waiting on the mutex can continue void OSL_MutexUnlock OSL_HMUTEX h_ mutex Argument h_mutex This is the handle that is used in managing the mutex Return Value None 13 3 4 Destroy Mutex OSL_MutexDestroy This routine destroys the mutex It destroys the mutex only when no tasks are pending on the mutex INTERR OSL MutexDestroy OSL HMUTEX h_ mutex Argument h_mutex This is the handle that is used in managing the mutex Return Value USBF_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be retu
84. fers from system memory So UseDMADataRegion is set to DEF_FALSE Note 5 The USB host controller on LPC1830 uses Transdimension IP so this is set to DEF_TRUE Note 6 These steps will make Pin selection enable PLL enable Phy etc specific to LPC 1830 SoC The BSP_USB_Host_OnReset function is called by host stack after the host controller is reset void BSP_USB Host OnReset UINTO8 ine E USBH_HOST_CNTRLR ep hc LPC_USBO gt USBMODE H 0x23 NOTE 7 Note 7 Select the USB host mode this can only be done after reset The BSP_USB_Host_RegisterlSR function is called by EHCI driver to register its ISR INTERR BSP USB Host RegisterISR UINTO8 In ino CEU EE EN Gat LS Zoe void Cp Ze Sal IECH MUS Bako rac ts ig nner NOTE 8 LPC1800 USB ISRArg o ier Eer NVIC_EnableIRQ USBO_TRQn NOTE 9 return USB ERR NONE Note 8 Save the EHCI ISR function pointer and EHCI ISR data argument We need to call EHCI ISR from the real host controller ISR function USBO_IRQHandler which is registered in the interrupt vector CONNECT USB Host WITTENSTEIN high integrity systems Page 192 Note 9 Enable USB Host controller IRQ The BSP_USB_Host_UnRegisterlSR function is called by EHCI driver when the host stack is unintitaized void BSP_USB Host UnregisterISR UINTO8 hc_nbr NVIC_DisableIRQ USBO_IRQn NOTE 10 Note 10 Disable USB Host controller IRQ The USBO_IRQHandler
85. figuration Extra Descriptor USBH_CfgExDescGet A standard configuration descriptor may contain one or more extra descriptors or fields which can be accessed by the following function USBH_DESC_HDR USBH_CfgExDescGet USBH_ CFG pcfg INTERR perr __ Arguments ocfg Pointer to the configuration structure of the device perr Pointer to the value that holds error code USBH_ERR_NONE if extra descriptor present USBH_ERR_EXTRA_DESCRIPTOR_NOT_PRESENT if no extra descriptor present Return Value A pointer to the USB_DESC_HDR structure representing the header of the extra descriptor i e the size in bytes and the type of the descriptor 5 1 5 Get Number of Interfaces USBH_NbrlFsGet This function returns the number of interfaces supported by the given USB configuration UINTO8 USBH_NbrliFsGet USBH CFG pcfg __ Arguments ocfg This is a pointer to a USBH_ CFG structure Return Value The number of interfaces supported by the configuration CONNECT USB Host WITTENSTEIN high integrity systems Page 48 5 1 6 Get Interface USBH_IFGet The USBH_CFG structure maintains an array of one or more USB interfaces This function returns the interface structure at the given index of the interface array USBH_IFACE USBH_IFGet USBH_CFG pcfg UINTOS iface_ix_ Arguments ocfg This is a pointer to a USBH_CFG structure iface_ix This is the index of the interface to be returned
86. he input terminal CONNECT USB Host WITTENSTEIN high integrity systems Page 176 11 1 8 Get O P Terminal Type USBH_AUDIO_OutTerminalTypeGet Returns the type of the output terminal STR USBH_AUDIO_OutTerminalTypeGet USBH_AUDIO_DEV mp audio dev UINT08 term_ix UINT16 p_term_type 1 Arguments p audio dev Pointer to the audio device term_ix Index of terminal p_term_type The terminal type as defined in USB Audio Specifications Return Value A string describing the name of the output terminal 11 1 9 Get USB I P Stream Interface USBH_AUDIO_InStreamGet Returns the USB streaming interface for the given input terminal USBH_AUDIO_ STREAM USBH_AUDIO_InStreamGet USBH_AUDIO DEV p audio dev UINTO8 term_ix Arguments p audio dev Pointer to the audio device term_ix Index of terminal Return Value Pointer to USB input streaming interface or 0 if no interface exists CONNECT USB Host WITTENSTEIN high integrity systems Page 177 11 1 10 Get O P Stream Interface USBH_AUDIO_OutStreamGet Returns the USB streaming interface for the given output terminal USBH_AUDIO_ STREAM USBH_AUDIO_OutStreamGet USBH_AUDIO_ DEV p_audio_dev UINTO8 term_ix Arguments p audio dev Pointer to the audio device term_ix Index of terminal Return Value Pointer to USB output streaming interface or 0 if no interface exists 11 1 11 Get Stream Format USBH_AUDIO_StreamFormatGet
87. hronous completion routine is called when I O is completed INTERR USBH_BulkTxAsync USBH_EP p_ep void p_buf UINT32 buf_len USBH_BULK_CMPL_FNCT p_fnct Void p_fnct_arg __ Argument p ep Pointer to the endpoint p buf Pointer to the data buffer buf_len Number of data bytes in buffer p_fnct Pointer to asynchronous function which will be invoked by the asynchronous I O task when the transfer is complete p fnct_arg Pointer to a variable that will be passed to asynchronous function Return Value USB ERR NONE If the request is submitted USB_ERR_INVALID_ARGS If p_ep is 0 USB_ERR_EP_CLOSED If the endpoint is closed USB_ERR_EP_INVALID If the endpoint type is not Bulk or direction is not out Otherwise specific error code as define in appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 80 6 4 4 Asynchronous Receive USBH_BulkRxAsync Issues a bulk receive request to the device This function returns immediately and the asynchronous completion routine is called when I O is completed INTERR USBH_BulkRxAsync USBH_EP p ep void p but UINT32 buf_len USBH_BULK_CMPL_FNCT p_fnct Void p_fnct_arg __ Argument p ep Pointer to the endpoint p buf Pointer to the data buffer buf_len Number of bytes in buffer p_fnct Pointer to asynchronous function which will be invoked by the asynchronous I O task when the transfer is complete p fnct_arg Pointer to a variable that will be passed to asynchron
88. i st ta Lee OSL DefD1yMS OSL DefDlyUS Osim Desk OSL DefMutexLock OSL DefMutexUnlock OSL DefMutexDestroy OSL DefSemCreate OSL DefSemDestroy OSL DefSemWait OSL Def SemPost OSL DefVirToBus OSL DefBusToVir 0 JI void main OSL Init amp App OSL Api Agp USB Host Tair l p while 1 EE H Eeer ee Mo WS Class Wesilc 5 Note 1 Initialize the RTOS layer with default wrapper functions for RTOS less configuration Note 2 Initialize USB Host Stack Note 3 Execute USB Host task Note 4 Execute USB Class task CONNECT USB Host WITTENSTEIN high integrity systems Page 26 The App_USB_Host_Init function initializes the USB host stack registers class drivers and start the host controller operations Note 5 Initialize USB Host Stack Note 6 Register BULK Class driver Note 7 Add host controller to host stack and start operations CONNECT USB Host WITTENSTEIN high integrity systems Page 27 The App_USB_Host_Callback function called by the host stack when there is pending event to be processed Starcie were App USB Host CallBack UINT32 DIER void Swale event acl case USBH EVENT INTERNAL REQUEST if class code 0 App_USB Host Event DEF else App_USB Class Event case USBH EVENT CLASS CONNECTE case USBH EVENT CLASS DISCONNE App_USB
89. id input arguments are provided USBH_ERR_NONE on successfully incrementing the printer device reference count Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 119 9 3 2 Release the Printer Device Reference Count This function decrements the printer device reference count INTERR USBH_PRN_RefRel USBH_PRN_DEV pprn_dev Arguments pprn_dev Pointer to the printer device Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully releasing the printer device reference count Otherwise appropriate error code as outlined in Appendix A 9 3 3 Printer Class Initialization This function initializes the printer class module INTERR USBH_PRN_Init USBH_PRN_DEV pprn_dev Arguments pprn_dev Pointer to the printer device Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully initializing the printer class module Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 120 9 3 4 Printer Class Un lnitialization This function un initializes the printer class module INTERR USBH_PRN_UnInit USBH_PRN_DEV pprn_dev Arguments pprn_dev Pointer to the printer device Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USB
90. integrity systems Page 188 12 1 4 Register Host Controller ISR BSP_USB_Host_RegisterlSR This function is called by the Host Controller Driver to register its ISR void BSP_USB_Host_RegisterlSR UINTO8 hc_nbr CPU_PTR_FNCT isr_fnct Void p_isr_arg Arguments hc_nbr The host controller index isr_fnct Pointer to host controller ISR function p_isr_arg Pointer to ISR data Return Value None CONNECT USB Host WITTENSTEIN high integrity systems Page 189 12 1 5 Unregister Host Controller ISR BSP_USB_Host_UnregisterlSR This function is called by the Host Controller Driver to unregister ISR void BSP_USB_Host_UnregisterISR UINTO8 hc_nbr Arguments hc_nbr The host controller index Return Value None 12 1 6 Uninitialize Host Controller BSP_USB_Host_Uninit This function is called by the Host Controller to perform uninitialization void BSP_USB_Host_Uninit UINTO8 hc_nbr Arguments hc_nbr The host controller index Return Value None CONNECT USB Host WITTENSTEIN high integrity systems Page 190 12 2 Example EHCI Driver Porting to LPC1830 This example illustrates porting EHCI driver to LPC1830 SoC which has EHCI compatible High speed USB Host controller The BSP_USB_Host_Init function is called by the Host Controller Driver before issuing host controller hardware reset EHCI DEV EHCI Dev CPU_PTR_FNCT LPC1800 USB _ISRFnct void LPC1800_ USB _IS
91. is called when I O is completed TABLE 6 4 URB USB REQUEST BLOCK FUNCTIONS Function Description USBH_EP_ Abort Aborts the pending transfers in End point CONNECT USB Host WITTENSTEIN high integrity systems Page 73 6 3 Control Transfers 6 3 1 Synchronous Transmit USBH_CtrlTx The USB core layer provides the following functions for a Control Transfer from host to device This function encapsulates setup data and status stages UINT16 USBH_CtrlTx USBH_DEV odev UINT OS bm_request UINT OS bm_request_type UINT16 w_value UINT16 w_index void odata UINT16 w_length UINT32 timeout_ms INTERR perr Arguments pdev This is a pointer to USBH_DEV structure bm_request This specifies the type of request and should be one of the following e USB_REQ_GET_STATUS e USB_REQ_GET_CONFIGURATI ON e USB_REQ_CLEAR_FEATUR E e USB_REQ_SET_CONFIGURATI ON e USB_REQ_SET_FEATURE e USB_REQ_GET_INTERFACE e USB_REQ_SET_ADDRESS e USB_REQ_SET_INTERFACE e USB_REQ_GET_DESCRIPT OR e USB_REQ_SYNCH_FRAME e USB_REQ_SET_DESCRIPT OR bm_request_typ Bit 7 specifies the direction of the data flow either USB_DEVICE_TO_HOST e or USB _HOST_TO_DEVICE CONNECT USB Host WITTENSTEIN high integrity systems Page 74 Bits 6 and 5 together specify the request type e USB _REQ_TYPE_STANDARD e USB REQ _TYPE_CLASS e USB _REQ_TYPE_VENDOR e USB_REQ_TYPE_OTHER Bits 4 through 0 together represent the
92. is function resets left and right margins to their default settings INTERR USBH_PRN_PageMarginsClear USBH_PRN_DEV pprn_dev Arguments pprn_dev Pointer to the printer device Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully resetting the page margins Otherwise appropriate error code as outlined in Appendix A 9 3 13 Set Page Line Spacing This function sets the number of lines to be printed per inch INTERR USBH_PRN_PageLineSpacingSet USBH_PRN_DEV pprn_dev UINT0O8 nbr_lines Ji Arguments pprn_dev Pointer to the printer device nbr_lines Number of lines per inch Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully setting the page line spacing Otherwise appropriate error code as outlined in Appendix A 9 3 14 Set Page Number of Copies This function sets the number of copies of each page to be printed CONNECT USB Host WITTENSTEIN high integrity systems Page 127 INTERR USBH_PRN_PageNbrCopiesSet USBH_PRN_DEV pprn_dev UINT16 nbr_copies Arguments pprn_dev Pointer to the printer device nbr_copies Number of copies of each page to be printed Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully setting the page number of copies Otherwise appropriate error code as outlined in Appendix A CONNECT USB Ho
93. is function returns the number of configurations supported by the given USB device UINTO8 USBH_NbrCfgsGet USBH_HOST pdev Arguments pdev This is a pointer to a USB Device structure Return Value The number of configurations present in the device CONNECT USB Host WITTENSTEIN high integrity systems Page 46 5 1 2 Get Configuration USBH_CfgGet The USBH_DEV structure maintains an array of one or more USB device configurations This function returns the configuration structure at the given index of the configuration array USBH_CFG USBH_NbrCfgsGet USBH_HOST pdev UINTOS cfg_ix IL Arguments pdev This is a pointer to the USBH_DEV structure which represents the USB device cfg_ix This is the index of the configuration which will be returned Return Value A pointer to the USBH_CFG structure representing the USB device configuration 5 1 3 Get Configuration descriptor USBH_CfgDescGet This function returns the configuration descriptor in a given configuration INTERR USBH_CfgDescGet USBH_CFG pcfg USB_CFG_DESC pcfg_desc Arguments ocfg This is a pointer to the USB configuration pcfg_desc Contains the pointer to the configuration descriptor if the function succeeds Return Value Returns USBH_ERR_NONE if successfully otherwise an Error code as outlined in Appendix A will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 47 5 1 4 Get Con
94. ler hardware that was previously stopped USBH_HostCntrirStop Stops host controller operations USBH_HostEventProcess Processes the USB Host Events USBH_HostSuspend Suspends the USB Host USBH_HostResume Resumes the USB Host CONNECT USB Host WITTENSTEIN high integrity systems Page 19 3 1 1 Initialize USB Host USBH_Hosilnit The application can initialize the host stack by calling USBH_Hostlnit function This function allocates and initializes the resources required by the USB Host stack INTERR USBH_Hostlinit USBH_ HOST p_host USBH_APP_EVENT_CALLBACK app callback UINT32 async_thread_prio UINT32 p_async_stk UINT32 async_stk_size UINT32 hub_thread_prio UINT32 p hub_stk UINT32 hub_stk_size Arguments p_host Pointer to the USBH_HOST structure app_callback Application call back function async_thread_prio Asynchronous thread priority if OS enabled otherwise 0 This task should be given higher priority relative to other tasks in the usb host stack p asyng sik Pointer to stack memory for asynchronous thread if OS enabled otherwise 0 async_stk_size Asynchronous thread stack size if OS enabled otherwise 0 hub_thread_prio Hub thread priority if OS enabled otherwise 0 p hub_stk Pointer to hub thread stack memory if OS enabled otherwise 0 hub_stk_size Hub thread stack size if OS enabled otherwise 0 Return Value On success returns 0 On failure returns
95. lete enough to be considered as a full programming language The printer class defines the PDL structure containing the function pointers of the corresponding PDL functions Each PDL that is added to the printer class must implement these functions and export the initialized structure variable to the application allowing the application to add this new language to the list of the supported PDLs Currently only PCL is supported The application need not know the internal detailed implementation of the supported PDL as the Printer class core driver handles the responsibility of invoking these functions EYDECEr struct Gabi t mers d PDL_INIT PIDIL Ee PDL PAGE MODE PageOrientationSetCmdFr PDL_PAGE LEFT MARGIN PageLeftMarginSetCmdFr PDL_PAGE RIGHT MARGIN PageRightMarginSetCmdFr PDL_PAGE TOP MARGIN PageTopMarginSetCmdFr PDL_MARGINS CLEAR PageMarginsClearCmdFr PDL_LINE_ SPACE PageLineSpacingSetCmdFr PDL_NBR_COPIES PageNbrCopiesSetCmdFr PDL_FONT WEIGHT FontWeightSetCmdFr PDL_FONT_ HEIGHT FontHeightSetCmdFr PDL_FONT_ UNDERLINE FontUnderlineSetCmdFr PDL_FONT UNDERLINE CLEAR FontUnderlineClearCmdFr PDL_FONT REQ TX FontReqlxCmdFr PDL_IMAGE ROW _HDR ImageRowHdrSetCmdFr PDL_STAT EIDEL Pele SS 5 UINTO8 2IDILIEC USBH PDL FNCTS FIGURE 9 2 PAGE DESCRIPTION LANGUAGE STRUCTURE CONNECT USB Host WITTENSTEIN high integrity systems Page 136 TABLE 9 2 PAGE DESCRIPTION LANGUAGE ROUTINES Function Description
96. liant with USB v1 1 and USB v2 0 e Low speed 1 5 Mb s full speed 12Mb s and high speed 480 Mb s e For use with FreeRTOS OPENRTOS and SAFERTOS or non RTOS systems e Delivers high levels of data throughput whilst utilizing minimum system resources e Full C source code supplied CONNECT USB Host WITTENSTEIN high integrity systems Page 14 1 1 Universal Serial Bus USB Overview Universal Serial Bus USB is a connectivity specification developed by Intel and other technology industry leaders There are two industry standards for USB the USB1 1 standard which supports bus speeds of 1 5 Mb s for low speed USB devices and 12 Mb s for full speed USB devices The USB2 0 standard supports 480Mb s for high speed devices and is fully backward compatible with USB1 1 1 2 USB Host A USB Host is a hardware software platform that interacts with the USB Devices through Host controller hardware The host is responsible for detecting insertion and removal of devices providing power assigning a unique address to the attached devices and managing control and data flow between the host and devices The data on the USB bus is transferred via endpoints that act as communication channels between the host and the USB device 1 3 USB Device A USB device or peripheral is a function such as a Pen Drive Printer Scanner or Modem A USB Device contains a transceiver and a controller which together handles the USB protocol at the bus level The hardware will
97. lled before accessing the Bulk driver API ERR USBH BULK Init USBH_ BULK DEV p bulk dev OSL MutexLock amp p_bulk_ dev gt HMutex LE p bulk clew SSiace l USE CLASS DEW SWATE CONN OSL MutexUnlock amp p_bulk_dev gt HMutex SE LUS JEE JD INOME IRUEVAIDI2 NOTE 17 p_ bulk dev gt ClassDev Status USBH CLASS DEVICE STATUS READY OSL MutexUnlock amp p_bulk_ dev gt HMutex return ERR_NON Note 17 Set the class device state to ready state The USBH_BULK_Uninit function is called by the application when the device is disconnected void USBH_BULK Uninit USBH_BULK_DEV p bulk dev INTERR err OSL_MutexLock amp p_ xyz _dev gt HMutex If p_bulk_dev gt State USBH_CLASS DEV STATE DISCONN OSL_MutexUnlock amp p_bulk dev gt HMutex return USBH_ClassDevRemove p bulk dev gt ClassDev HostPtr NOTE 18 p_bulk_ dev OSL_MutexUnlock amp p_bulk dev gt HMutex Mem PoolBlkFree amp USBH_ BULK DevPool NOTE 19 p_bulk dev amp err Note 18 Remove the bulk class device CONNECT USB Host WITTENSTEIN high integrity systems Page 40 Note 19 Free the memory allocated for bulk class device The USBH_BULK_Read function is called by the application to read the data from device Note 20 Return error code if the device is not in connected state Note 21 Read data from the bulk in endpoint CONN
98. ned in Appendix A will be returned 13 2 2 Wait on Semaphore OSL_SemWait This routine causes the task to wait on the semaphore until the semaphore is available INTERR OSL_SemWait OSL_HSEM h_sem UINT16 time_out Arguments h_sem This is the handle used in managing the semaphore time_out Timeout period in milliseconds Return Value USBF_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 197 13 2 3 Post Semaphore OSL_SemPost This routine posts a semaphore INTERR OLS _SemPost OSL HSEM h_sem Argument h_sem This is the handle used in managing the semaphore Return Value USBF_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned 13 2 4 Destroy Semaphore USB_OS_SemDestroy This routine destroys a semaphore The caller must use this function with care because other tasks could attempt to access the semaphore The function should be used only if no tasks are pending on the semaphore void USB_OS_SemDestroy OSL_HSEM bh eem IP Argument bh sem This is the handle used in managing the semaphore Return Value None CONNECT USB Host WITTENSTEIN high integrity systems Page 198 13 3 Mutex Abstraction Routines 13 3 1 Create Mutex OSL_MutexCreate This routine creates a mutex The initial value o
99. ntegrity systems Page 142 9 5 6 Frame Clear Page Margins Command This function manages the command to clear the page margins INTERR PageMarginsClearCmdFr UINTO8 pbuf UINTO8 buf len UINTO8 pcmd_len _ Arguments pbuf Pointer to variable which receives framed command puen Length of the buffer pointed by pbuf variable top_margin The value of the page top margin ocmd_len Pointer to a variable which receives actual command length Return Value USBH_ERR_NONE on successfully commanding the clearing the page margins Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 143 9 5 7 Frame Set Line Spacing Command This function manages the command to set the number of lines per inch INTERR PageMarginsClearCmdFr UINTO8 pbuf UINTO8 buf len UINTO8 nbr lines UINTO8 pcmd_len Arguments pbuf Pointer to variable which receives framed command burlen Length of the buffer pointed by pbuf variable nbr_lines Number of lines per inch pemd_len Pointer to a variable which receives actual command length Return Value USBH_ERR_NONE on successfully commanding the setting of the number of lines per inch Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 144 9 5 8 Frame Set Number of Copies Command This function manages the command to set the co
100. nterfaces The AudioControl AC interface is used to access the audio controls of the function whereas the AudioStreaming AS interfaces are used to transport audio streams into and out of the function The following diagram illustrates the application interaction with the Audio class driver Application Layer Audio API Audio_StreamOpen Audio_StreamClose USBH_CtrITx USBH_CtriRx FIGURE 11 1 AUDIO CLASS DRIVER CONNECT USB Host WITTENSTEIN high integrity systems Page 171 11 1 Audio Class Driver API The table below lists Audio class API functions TABLE 11 1 AUDIO CLASS API Function Description USBH_AUDIO_Init Initializes the audio hardware USpH AUDIO Uninit Un initializes the audio hardware USpH AUDIO RefAdd Increments the application reference count to audio device USBH_AUDIO_RefRel Decrements the reference count of an audio device USBH_AUDIO_InTerminalsCount Returns input terminal count USBH_AUDIO_OutTerminalsCount Returns the output terminal count USBH_AUDIO_InTerminalTypeGet Returns input terminal name USBH_AUDIO_OutTerminalTypeGet Returns output terminal name USBH_AUDIO_InStreamGet Returns the USB streaming interface for the given input terminal USBH_AUDIO_OutStreamGet Returns the USB streaming interface for the given output terminal USBH_AUDIO_StreamFormatGet Returns PCM format associated with
101. nts pprn_dev Pointer to the printer device left_margin The value of the page left margin Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully setting the page left margin Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 125 9 3 10 Set Page Right Margin This function sets the left margin to the right edge of the specified column INTERR USBH_PRN_PageRightMarginSet USBH_PRN_DEV pprn_dev UINT32 right_margin 1 Arguments pprn_dev Pointer to the printer device right_margin The value of the page right margin Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully setting the page right margin Otherwise appropriate error code as outlined in Appendix A 9 3 11 Set Page Top Margin This function designates number of lines between top of page to top of text area INTERR USBH_PRN_PageTopMarginSet USBH_PRN_DEV pprn_dev UINT32 top_margin Arguments pprn_dev Pointer to the printer device top_margin The value of the page top margin Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully setting the page top margin Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 126 9 3 12 Clear Page Margins Th
102. o USBH_HID_DEV structure Return Value On success returns 0 On failure returns the specific error number as outlined in Appendix A 8 3 2 Uninitialize HID USBH_HID_Uninit The application can uninitialize the Human Interface Device by calling USBH_HID_Uninit function void USBH_HID_Init USBH_HID_DEV p_hid_dev Arguments p hid _dev Pointer to USBH_HID_DEV structure Return Value None CONNECT USB Host WITTENSTEIN high integrity systems Page 105 8 3 3 Application reference add USBH_HID_RefAdd Increment the application reference count to the human interface device INTERR USBH_HID_RefAdd USBH_HID DEV p_hid_dev_ Arguments p_hid_dev Pointer to USBH_HID_DEV structure Return Value On success returns 0 On failure returns specific error number as outlined in Appendix A 8 3 4 Application reference release USBH_HID_RefRel Decrements the application reference count to Human Interface Device INTERR USBH_HID_RefRel USBH_HID_DEV p_hid_dev Arguments p_hid_dev Pointer to USBH_HID_DEV structure Return Value On success returns 0 On failure returns specific error number as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 106 8 3 5 Get Report ID array USBH_HID_GetReportIDArray This function gets the Report ID structure array address and number of structures INTERR USBH_HID_GetReportIDArray
103. ormation regarding HP PCL can be obtained at http en wikipedia org wiki Printer_Command_Language CONNECT USB Host WITTENSTEIN high integrity systems Page 116 9 2 Printer Class Architecture The following diagram illustrates the application of CONNECT USB Host with the Printer class driver FIGURE 9 1 PRINTER CLASS DRIVER ARCHITECTURE CONNECT USB Host WITTENSTEIN high integrity systems Page 117 9 3 Printer Class API Table 9 1 lists CONNECT USB Host Printer class functions TABLE 9 1 CONNECT USB HOST PRINTER CLASS FUNCTIONS Function Description USBH_PRN_RefAdd Increments the reference count to printer device USBH_PRN_RefRel Decrements the reference count of a printer device USBH_PRN_Init Initializes the USB Host Printer class module USBH_PRN_UnInit Un initializes the USB Host Printer class module USBH_PRN_AddLanguage Adds the given language to the list of supported pdls USBH_PRN_JobBegin Begins the printing job USBH_PRN_JobEnd Ends the printing job USBH_PRN_PageOrientationSet Sets the printing page orientation to desired portrait or landscape mode USBH_PRN_PageLeftMarginSet Sets the left margin to the left edge of the specified column USBH_PRN_PageRightMarginSet Sets the right margin at the right edge of the specified column USBH_PRN_PageTopMarginSet Designates number of lines between top of page to to
104. ous function Return Value USB ERR NONE If the request is submitted USB_ERR_INVALID_ARGS If p_ep is 0 USB _ERR_EP_CLOSED If the endpoint is closed USB ERR ER INVALID If the endpoint type is not Bulk or direction is not in Otherwise specific error code as define in appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 81 6 5 Interrupt Transfer 6 5 1 Synchronous Transmit USBH_IntrTx The USBH_IntrTx function is used to send interrupt data from the host to the device The endpoint must be of type USB_EP_TYPE_INTR and direction must be USB_EP_DIR_OUT UINT32 USBH_IntrTx USBH_EP pep void obuf UINT32 buf_len UINT32 timeout_ms INTERR perr IR Arguments pep This is a pointer to pipe through which the interrupt data is to be sent pbuf This is a pointer to the buffer into which the interrupt data to transfer should be placed buf_len This is the size of the buffer timeout ms This is the timeout in milliseconds perr USBH_ERR_NONLE if the transfer was successful Otherwise error code as outlined in Appendix A Return Value The number of bytes sent to the device CONNECT USB Host WITTENSTEIN high integrity systems Page 82 6 5 2 Synchronous Receive USBH_IntrRx The USBH_IntrRx function is used to receive the interrupt status from the device The endpoint must be of type USB_EP_TYPE_INTR and direction must be USB_EP_DIR_IN UINT32 USBH_IntrRx USBH_EP pep void obuf UINT3
105. p of text area USBH_PRN_PageMarginsClear Resets left and right margins to their default settings USBH_PRN_PageLineSpacingSet Sets the number of lines to be printed per inch USBH_PRN_PageNbrCopiesSet Sets the number of copies of each page to be printed USBH_PRN_FontWeightSet Designates the weight of the font in points USBH_PRN_FontHeightSet Designates the height of the font in points USBH_PRN_FontUnderlineSet Sets automatic underlining of the text font CONNECT USB Host WITTENSTEIN high integrity systems Page 118 USBH_PRN_FontUnderlineClear Removes automatic underlining of the text font USBH_PRN_FontFirstGet Retrieves the first font name supported by the printer USBH_PRN_FontNextGet Retrieves the next font name supported by the printer USBH_PRN_FontSet Sets the printing font text USBH_PRN_TextPrint Prints the given text data with the default font characteristics supported by the printer USBH_PRN_ImagePrint Prints the given row of image data USBH_PRN_CallbackReg Registers the callback function for providing status 9 3 1 Add the Printer Device Reference Count This function increments the printer device reference count INTERR USBH_PRN_RefAdd USBH_PRN_DEV pprn_dev_ Arguments pprn_dev Pointer to the printer device Return Value USBH_ERR_INVALID_ARGS if inval
106. pies of each page INTERR PageNbrCopiesSetCmdFr UINTO8 pbuf UINTO8 buf len UINTO8 nbr_copies UINTO8 pcmd_len Arguments pbuf Pointer to variable which receives framed command burlen Length of the buffer pointed by pbuf variable nbr_copies Number of copies of each page to be printed pemd_len Pointer to a variable which receives actual command length Return Value USBH_ERR_NONE on successfully framing the command to set number of copies of each page Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 145 9 5 9 Frame Set Font Weight Command This function frames the command to set the weight of the font INTERR FontWeightSetCmdFr UINTO8 pbuf UINTO8 buf len UINTO8 font weight UINTO8 pcmd_len _ Arguments pbuf Pointer to variable which receives framed command pulen Length of the buffer pointed by pbuf variable font_weight Weight of the font pemd_len Pointer to a variable which receives actual command length Return Value USBH_ERR_NONE on successfully framing the command to set the weight of the font Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 146 9 5 10 Frame Set Font Height Command This function frames the command to set the height of the font INTERR FontWeightSetCmdFr UINTO8 pbuf UINTO8 buf len UINT
107. port is used The Mass Storage Class MSC standard defines two transport protocols to exchange command data and status information between the host and device These two types of transport protocols are 1 Bulk Only Transport BOT and 2 Control Bulk Interrupt CBI Transport CONNECT USB Host WITTENSTEIN high integrity systems Page 90 7 2 MSC Architecture r Tasks USBH_Host_lnit USBH ClassDrvReq Mass Storage Class MSC USB Host Core USB Host Controller Driver USB Host Controller Hardware FIGURE 7 1 CONNECT USB HOST MASS STORAGE CLASS ARCHITECTURE Most devices like USB Flash drives and USB Hard disks support BOT CBI transport is only implemented in legacy USB Floppy Disks Bulk Only Transport BOT protocol involves transfer of command data and status via bulk endpoints The default endpoint is used to issue class specific requests that request for example the maximum Logical Unit Number LUN or clear a STALL condition on the bulk endpoint CONNECT USB Host implements MSC driver with the Bulk Only Transport BOT protocol The MSC driver provides a API for reading and writing data sectors onto the USB mass storage devices Generally MSC is used in conjunction with WITTENSTEIN s FAT File System CONNECT USB Host WITTENSTEIN high integrity systems Page 91 7 3 MSC Driver API Functions The following Table 7 1 lists all the functions that an application needs to communicate with mass
108. pose length J The size of the endpoint descriptor in bytes bDescriptorType The value forthe Endpoint descriptor type bEndpointAddress The endpoint address Bits 0 3 The endpoint number Bits 4 6 Reserved Set to zero bmAttributes Bits 0 1 The transfer type 00 Control 01 Isochronous 10 Bulk 11 Interrupt Bits 2 3 For an isochrounous endpoint synchronization type CONNECT USB Host WITTENSTEIN high integrity systems Page 61 00 No synchronization 01 Asynchronous 10 Adaptive 11 Synchronous Bits 4 5 For an isochronous endpoint usage type 00 Data endpoint 01 Feedback endpoint 10 Explicit feedback data endpoint 11 Reserved wMaxPacketSize The maximum packet size this endpoint is capable of sending or receiving bInterval The interval for polling endpoint data transfers in number of frame counts This field is ignored for bulk and control endpoints it much be equal to 1 for isochronous endpoints and may range betwene 1 and 255 for interrupt endpoints CONNECT USB Host WITTENSTEIN high integrity systems Page 62 6 USB Endpoint API The USB pipe represents the logical association between device endpoint and host software A special group of endpoints called default endpoints are actually owned by the USB core All other endpoints called client endpoints are owned by class drivers The host stack supports four types of USB endpoints corresponding to
109. priate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 151 9 5 15 Parse the Status Response This function parses the status response obtained from the printer device INTERR StatusRespParse UINTO8 obuf UINT08 buf_len Arguments pbuf Pointer to variable which receives framed command buf_len Length of the buffer pointed by pbuf variable Return Value USBH_ERR_NONE always CONNECT USB Host WITTENSTEIN high integrity systems Page 152 9 6 Printer Command Language PCL Some of the contents in this section of the document is an extract from HP Printer Language Technical Reference Manual which can be obtained at the location mentioned below http h20000 www2 hp com bc docs support SupportManual bpl13210 bpl13210 pdf Printer Command Language more commonly referred to as PCL is a Page description language PDL developed by HP as a printer protocol and has become a de facto industry standard Originally developed for early inkjet printers in 1984 PCL has been released in varying levels for thermal matrix printer and page printers Hewlett Packard created the PCL printer language simply referred to as PCL to provide an economical and efficient way for application programs to control a range of printer features across a number of printing devices HP has evolved both the definition and implementations of PCL to provide the optimal price and performance
110. quiry information of a LUN lun Logical unit number of mass storage device from which the inquiry data is read from Return Value On success returns 0 On failure returns specific error number CONNECT USB Host WITTENSTEIN high integrity systems Page 95 7 3 6 Application reference add USBH_MSC_RefAdd Increment the application reference count to mass storage device INTERR USBH_MSC_RefAdd USBH_MSC_DEV p_msc_dev Arguments p msc_dev Pointer to the USBH_MSC_DEV structure Return Value On success returns 0 On failure returns a specific error number CONNECT USB Host WITTENSTEIN high integrity systems Page 96 Read blocks USBH_MSC_Rd Reads the specified number of blocks from a LUN within the selected mass storage device UINT32 USBH_MSC_Rd USBH_MSC_DEV p_msc_dev UINTO8 lun UINT32 blk_addr UINT16 nbr_blks UINT32 blk_size void p_arg INTERR p_err Arguments p msc_dev Pointer to the USBH_MSC_DEV structure lun Logical unit number of mass storage device from which you want to read data blk_addr Starting block number nbr_blks Number of blocks you want to read blk_size Block size p arg Pointer to hold data p err Pointer to hold error code if reading failed Otherwise it is zero Return Value Returns number of bytes successfully read CONNECT USB Host WITTENSTEIN high integrity systems Page 97 7 3 7 Write blocks USBH_MSC_
111. r USPH Host nid 21 3 1 3 Start Host Controller USBH_HostCnitrirStart eee eee eeeseeeeeeeeeeeeeeeeeeeeeeeees 21 3 1 4 Stop Host Controller USGBH HostCntrtlrGiopn 22 3 1 5 Process USB Host Events USBH_HostEventProcess s es 22 3 1 6 Suspend USB Host USBH_HostSuspend cceceeceeeeeeeeeeneeeeeeeeeeeeessneeeeeeeees 23 3 1 7 Resume USB Host USBH_HostResume ccseeeeenecceeeeeeseeeeeeeeeeeeeeenseeeeeees 23 3 2 USB Host Stack Configuration ed secece ces ee NEE Dee E ees 23 3 2 1 Supported device Configuration EEEE renn renn 24 3 3 USB Host Stack Example icc cece diese Eed 26 4 Class Driver framework cert che SSES EN CONNECT USB Host WITTENSTEIN high integrity systems Page 4 4 1 EST le CN 31 4 1 1 Class Driver structure USBH_CLASS_ DRM 32 4 2 Class Driver Management 33 4 2 1 Register Class Driver USGPBH ClasstDnvbeot 33 4 2 2 Unregister Class Driver USBH_ClassDrvUnreg 00eeeeeeeeeeeeeteeeteeees 34 4 3 Accessing Class Devices ccc ceesseccceeceeeeeeeaeeaaeeaaeeaaeeaeeeaeeeaeeaaecaecececeaeseaeceeeeeeeeaes 34 4 3 1 Find Class Device USBH_ClassDevFind eeeeseeeseeeeseerreerrresserrrrrirressrrrrrnr 35 4 4 Example Bulk Class Driver 36 USB Device Descriptors seseeeeeeetteettnettstttet ttet tte tater trer AEEA Er EEEErAEEEAEEEAEEEE EEEE EEEE EEEE E EEEE 44 5 1 USB Device descriptor access AP 45 5 1 1 Get Number of Configurations
112. r pointed by pbuf variable pocmd_len Pointer to a variable which receives actual command length Return Value USBH_ERR_NONE on successfully framing the command to clear the automatic font underlining Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 149 9 5 13 Frame Font Information Request This function frames the command to send available font information INTERR FontReqlxCmdFr UINTO8 pbuf UINTO8 buf len UINTO8 ocmd_len Arguments pbuf Pointer to variable which receives framed command buf_len Length of the buffer pointed by pbuf variable pocmd_len Pointer to a variable which receives actual command length Return Value USBH_ERR_NONE on successfully framing the command to font request Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 150 9 5 14 Frame Image Row Header This function frames the command to image row header data INTERR ImageRowHdrSetCmdFr UINTO8 pbuf UINTO8 buf len UINT32 row_len UINTO8 ocmd_len Arguments pbuf Pointer to variable which receives framed command nuren Length of the buffer pointed by pbuf variable row_len The length of the image row pemd_len Pointer to a variable which receives actual command length Return Value USBH_ERR_NONE on successfully framing the command to font request Otherwise appro
113. rd interfaces for host controller hardware e Open Host Controller Interface OHCI e Universal Host Controller Interface UHCI e Enhanced Host Controller Interface EHCI The OHCI and UHCI interface standards support Full Low speed devices and the EHCI standard supports High Speed devices In general the SoC architectures supporting Full Low speed devices will implement USB host controller with OHCI interface SoC architectures supporting High speed host controllers will implement modified EHCI standard this is IP from Chipidea formerly known as Trans Dimension The modified EHCI standard will support High Full Low speed modes UHCI interface standard generally not used in SoCs but used in Personal Computers only There are also non standard proprietary host controller interfaces implemented by SoC architectures The host stack provides host controller drivers for the standard interfaces EHCI and OHCI Using these drivers is easy and simplifies the host stack porting process to SoC architectures However there is small amount of SoC specific host controller initialization like pin selection clock selection interrupt handling needs to implemented in host controller BSP CONNECT USB Host WITTENSTEIN high integrity systems Page 183 12 1 Host Controller Driver Porting Functions The following functions should be implemented to use the existing host controller driver with an SoC The host controller driver will call these functions TABLE
114. recipient e USB _REQ_RECIPIENT DEVICE e USB_REQ_RECIPIENT_INTERFACE e USB _REQ_RECIPIENT_ENDPOINT e USB _REQ_RECIPIENT_OTHER w_value A two byte value that may be used to pass information to the device w_index A two byte value that may be used to pass information to the device pdata A pointer to the buffer where the control data to be sent if any should be placed w_length The size of the buffer data timeout_ms The timeout in milliseconds perr USBH_ERR_NONE if the transfer was successful Error code as outlined in Appendix A Otherwise Return Value The number of bytes sent to the device if the transfer was successful Otherwise a Error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 75 6 3 2 Synchronous Receive USBH_CtrlRx The core layer provides the following function for control transfer from a device to host This function encapsulates setup data and status stage UINT16 USBH_CtrlRx USBH_DEV pdev UINT OS bm_request UINTO8 bm_request_type UINT16 w_value UINT16 w_index void odata UINT16 w_length UINT32 timeout_ms INTERR perr Argument pdev This is a pointer to USBH_DEV structure bm_request This specifies the type of request and should be one of the following e USB_REQ_GET_STATUS e USB _REQ_GET_CONFIGURATI ON e USB_REQ_CLEAR_FEATUR E e USB_REQ_SET_CONFIGURATI ON e USB_REQ_SET_ FEATURE e USB BEO GET INTERFACE e USp BEO SET ADDRES
115. rned CONNECT USB Host WITTENSTEIN high integrity systems Page 200 13 4 Delay Routines 13 4 1 Delay Task by Milliseconds OSL_DefDlyMS Delays the current task by specified delay Void OSL_DefDlyMS UINT32 Dly X Argument dly Delay in milliseconds Return Value None 13 4 2 Delay Task by Microseconds OSL_DefDlyUS Delays the current task by specified delay Void OSL_DefDlyUS UINT32 Dly Argument dly Delay in microseconds Return Value None CONNECT USB Host WITTENSTEIN high integrity systems Page 201 13 5 Critical Section Routines 13 5 1 Critical Section Lock OSL_DefCriticalLock Disable interrupts and task switching REG FLAGS OSL_DefCriticalLock _ Return Value CPU specific flags capturing the current state 13 5 2 Critical Section Unlock OSL_DefCriticalLock Disable interrupts and task switiching void OSL_DefCriticalUnlock REG_FLAGS flags 5 Argument flags CPU specific flags saved from previous lock operaton Return Value Nene CONNECT USB Host WITTENSTEIN high integrity systems Page 202 Appendix A Number Error Code Description S GE S EE echt A EE EE EE eeh K GE a E a a e k Sl R AAT cee 5 USB_ERR_POOL_CREATE_FAIL Memory pool creation MN Oe cee P Oe ERE MOT IMAT MENE eaa O OT EE 7 USB_ERR_NOT_SUPPORTED Operation not supported CONNECT USB Host WITTENSTEIN high
116. ructure piface Pointer to the interface structure pep Pointer to the endpoint structure Return Value USBH_ERR_NONLE if the Isochronous OUT endpoint is opened Otherwise a specific error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 69 6 1 7 Reset endpoint USBH_EP_Reset This function performs a reset on the given endpoint and the brings it to active condition It issues an abort command to all transfers in progress on the endpoint and waits till the abort command has completed Thne host controller halt state is cleared and finally the endpoint condition is set to active The condition of the endpoint on the device is not affected by this function The endpoint status on the device must be cleared explicitly by USBH_EP_StallClr void USBH_EP Reset USBH_DEV odev USBH_EP pen Arguments pdev Pointer to the USB Device structure pep Pointer to the endpoint structure Return Value None CONNECT USB Host WITTENSTEIN high integrity systems Page 70 6 1 8 Clear Stalled endpoint USBH_EP_StallClr Sometimes the device may return a stalled stutus USBH_ERR_IO_STALL during data transfer and the endpoint will be in the halt condition where it cannot accept further data transfers from host The host software can clear the halt condition of the endpoint with the USBH_EP_StallClr function INTERR USBH_EP_StallCir USBH_DEV pdev USBH_EP pep Arg
117. ss driver so that all the class device structures are initialized INTERR USBH_ClassDrvReg USBH_HOST p_host UINT32 class_code USBH_CLASS_DRV pclass_drv_ Arguments p host Pointer to the host structure class_code Class code supported by the class driver pclass_drv Pointer to the class driver structure Return Value Returns USBH_ERR_NONE if class driver is registered successfully otherwise an Error code as outlined in Appendix A will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 33 4 2 2 Unregister Class Driver USBH_ClassDrvUnreg This function un registers the class driver that was previously registered with the host stack INTERR USBH_ClassDrvUnreg USBH_HOST p host USBH_CLASS DRV pclass_drv Arguments p host Pointer to the host structure oclass_drv Pointer to the class driver structure Return Value Returns USBH_ERR_NONE if the class driver is registered successfully otherwise an Error code as outlined in Appendix A will be returned 4 3 Accessing Class Devices Class drivers provide API functions specific to the interface class and the device A class driver API function requires the class device as one of the input arguments The application should get the class device structure for a specific interface class using the following function listed in the Table 4 4 TABLE 4 4 USB CLASS DEVICE FUNCTION Function Description USBH_ClassDev
118. st WITTENSTEIN high integrity systems Page 128 9 3 15 Set the Font Weight This function designates the weight of the font in points INTERR USBH_PRN_FontWeightSet USBH_PRN_DEV pprn_dev INTO8 font_weight 1 Arguments pprn_dev Pointer to the printer device font_weight Value for the weight of the font stroke e 7 Ultra thin e 6 Extra thin e 5 Thin e 4 Extra Light e 3 Light e 2 Demi Light e 1 Semi Light Medium Semi Bold Demi Bold Bold Extra Bold Black Extra Black Ultra Black D NO oO fF W M O 1 1 1 default font weight is O for medium Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully setting the font weight Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 129 9 3 16 Set the Font Height This function designates the height of the font in points INTERR USBH_PRN_FontHeightSet USBH_PRN_DEV pprn_dev INTO8 font_height 5 Arguments pprn_dev Pointer to the printer device nbr_copies Value for the height of the font stroke Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully setting the font height Otherwise appropriate error code as outlined in Appendix A 9 3 17 Set Automatic Font Underlining This function sets automatic
119. th direction OUT This endpoint is used to send interrupt transfer data INTERR USBH_IntrOutOpen USBH DEV pdev USBH_PIFACE piface USBH_EP pen Arguments pdev Pointer to the USB Device structure piface Pointer to the interface structure pep Pointer to the endpoint structure Return Value USBH_ERR_NONE if the Interrupt OUT endpoint is opened Otherwise a specific error code as outlined in Appendix A otherwise CONNECT USB Host WITTENSTEIN high integrity systems Page 67 6 1 5 Open lsochronous in endpoint USBH_lIsoclnOpen This function is used to open an isochronous endpoint with direction IN This endpoint is used to receive any isochronous transfer data INTERR USBH_IntrOutOpen USBH_DEV pdev USBH_PIFACE piface USBH_EP pen Arguments pdev Pointer to the USB Device structure piface Pointer to the interface structure pep Pointer to the endpoint structure Return Value USBH_ERR_NONE if the Isochronous IN endpoint is opened Otherwise a specific error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 68 6 1 6 Open lsochronous out endpoint USBH_lsocOutOpen This function is used to open an isochronous endpoint with direction OUT This endpoint is used to send any isochronous transfer data INTERR USBH_lIsocOutOpen USBH_DEV odev USBH_PIFACE piface USBH_EP pep Arguments pdev Pointer to the USB Device st
120. that supplies an application developer with information about what a control is actually measuring For example a mouse pointer device transmits three 8 bit fields a Usage tag defines what should be done with the data i e two fields represent x and y coordinates and one field represents button status This feature allows a vendor to ensure that the user sees consistent function assignments to controls across applications For example the mouse application collection Usage Page is Generic Desktop and its Usage ID is Mouse 8 1 4 Reports A transfer is one or more transactions creating a set of data that is meaningful to the device for example Input Output and Feature reports A transfer is synonymous with a report Most devices generate reports or transfers by returning a structure in which each data field is sequentially represented However some devices may have multiple report structures on a single endpoint each representing only a few data fields For example a keyboard with an integrated pointing device could independently report key press data and pointing data over the same endpoint Report ID items are used to indicate which data fields are represented in each report structure A Report ID item tag assigns a 1 byte identification prefix to each report transfer If no Report ID item tags are present in the Report descriptor it can be assumed that only one Input Output and Feature report structure exists and together they
121. the four types of USB transfers e Control Endpoints e Bulk Endpoints e Interrupt Endpoints and e Isochronous Endpoints 6 1 Endpoint Management Functions The USB Host stack offers API functions for general management of USB endpoints which are used to open a new endpoint The functions are listed in Table 6 1 After an endpoint has been opened data may be sent through the endpoint using the synchronous transfer functions in Table 6 2 or the asynchronous transfer functions in Table 6 3 TABLE 6 1 ENDPOINT MANAGEMENT FUNCTIONS Function Description E A TOPE ea E Bulk I EO A A ECEE ne E D 7 pebh_BulncuOpent _ Opel Bulk GU MADONE see te DUKA p PEN ININ OPENO l OPEN EUDE A AARONI ees S peer ee ee pe EE ech E FN aaa EN eeu M ENAREN T O ECEE UE ea Jala K EE EE USBH_EP_Reset Resets an open endpoint This function does not affect the status of Kee O USBH_EP_StallClr Clears the stall condition on the given endpoint CONNECT USB Host WITTENSTEIN high integrity systems Page 63 6 1 1 Open Bulk in endpoint USBH_BulklnOpen This function is used to open a bulk endpoint with direction IN This endpoint is used to receive any bulk data INTERR USBH_BulkInOpen USBH_DEV pdev USBH_PIFACE piface USBH_EP pen Arguments pdev Pointer to the USB Device structure piface Pointer to the interface structure pep Pointer to the endpoint structure Return Value USBH_ERR_NONE if the Bulk IN
122. ting ep IN Endpoint number for which the endpoint descriptor is required USBH_EP Pointer to the endpoint structure Return Value USBH_ERR_NONE on success otherwise an Error Code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 53 5 1 13 Set a configuration USBH_ CfgSet This function selects a configuration in the device INTERR USBH_CfgSet USBH_DEV pdev UINT08 cfg_nbr Arguments pdev This is the pointer to USB device cfg_nbr This is the configuration number to select Return Value USBH_ERR_NONE on success otherwise an Error Code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 54 5 1 14 Get Endpoint USBH_IFSet This function selects the specified alternate setting in an interface INTERR USBH_IFSet USBH_IFACE piface UINTO8 alt nbr Arguments piface Pointer to a USBH_IFACE structure alt_nbr The alternate setting to select Return Value USBH_ERR_NONE if the specified alternate setting is selected USBH_ERR_INVALID_ARGS if any input arguments are not valid CONNECT USB Host WITTENSTEIN high integrity systems Page 55 5 1 15 Device Descriptor Structure USB_DEV_DESC The device descriptor describes the general information about a USB device A USB device can have only one device descriptor CONNECT USB Host WITTENSTEIN high integrity systems Page 56 TABLE 5 3 ITEM DEFINIT
123. tructure in the RTOS that provides that functionality TABLE 13 1 THREAD ABSTRACTION ROUTINES Function Description OSL_ThreadCreate Creates a thread TABLE 13 2 SEMAPHORE ABSTRACTION ROUTINES Function Description OSL_SemCreate Creates a semaphore OSL_SemDestroy Destroys the semaphore The semaphore is only destroyed if no tasks are pending on the semaphore OSL_SemWait Makes the calling task wait on the semaphore until the semaphore is available OSL_SemPost Posts the semaphore so that any task waiting on the semaphore can continue CONNECT USB Host WITTENSTEIN high integrity systems Page 194 TABLE 15 3 MUTEX ABSTRACTION ROUTINES Function Description Destroys the mutex The mutex is only destroyed if no tasks are pending on the mutex OSL_MutexLock Makes the calling task wait on the mutex The task waits until the pe E mutex is available OSL_MutexUnlock Unlocks the mutex so that any task waiting on the mutex can continue TABLE 13 3 DELAY ROUTINES Function Description OSL_DIyMS Delays the calling task for the specified number of milliseconds OSL_DIyUS Delays the calling task for the specified number of microseconds TABLE 13 4 CRITICAL SECTION ROUTINES Function Description OSL_CriticalLock Enters a critical section Interrupts should be disabled and the CPU OSL_CriticalUnlock
124. ts PJL provides e Programmatic printer language switching PJL provides fully reliable switching between printer languages such as PCL Epson IBM ProPrinter and PostScript directly from within applications e Printer status readback Printer model information configuration printer feature settings and other printer status information can be obtained using PJL e Ease of use All PJL commands except the Universal Exit Language UEL command consist of printable characters and plain English words or abbreviated words 9 9 Status Readback Commands PJL allows applications to request configuration and status information from the printer The printer also can be programmed to send unsolicited status information to the application when printer events occur For example the printer can send status information indicating the printer door is open toner is low online offline status and other pertinent information PJL status readback is especially useful during application development Status readback enables you to determine that your application successfully changed feature settings to your specifications The status readback commands are classified into e INQUIRE requests the current value PJL Current Environment for a specified environment variable CONNECT USB Host WITTENSTEIN high integrity systems Page 155 9 10 DINQUIRE requests the default value User Default Environment for a specified environment variable ECHO re
125. ture Return Value None CONNECT USB Host WITTENSTEIN high integrity systems Page 93 7 3 3 Reads capacity of device USBH_MSC_CapacityRd Reads the capacity of a LUN within the selected mass storage device as the number of blocks and the block size INTERR USBH_MSC_CapacityRd USBH_MSC_DEV p_msc_dev UINT08 Lun UINT32 p_nbr_blks UINT32 p_blk_size Arguments p msc_dev Pointer to the USBH_MSC_DEV structure Lun Logical Unit Number of the mass storage device from the capacity is read from p nbr_blks_ Pointer to hold the total number of blocks in a LUN p blk_size Pointer to hold block size of a LUN Return Value On success returns 0 On failure returns specific error number CONNECT USB Host WITTENSTEIN high integrity systems Page 94 7 3 4 Application reference release USBH_MSC_RefRel Decrement the application reference count to mass storage device INTERR USBH_MSC_RefRel USBH_MSC_DEV p_msc_dev Arguments p_msc_dev Pointer to the USBH_MSC_DEV structure Return Value On success returns 0 On failure returns specific error number 7 3 5 Reads inquiry data USBH_MSC_Stdlnquiry Reads the inquiry data of a LUN in mass storage device INTERR USBH_MSC_StdInquiry USBH_MSC_DEV p_msc_dev USBH_MSC_INQUIRY_INFO p_msc_inquiry_info UINT08 lun Arguments p msc_dev Pointer to the USBH_MSC_DEV structure p msc_inquiry_info Pointer to hold in
126. turn Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 180 11 1 14 Stream Read USBH_AUDIO_StreamRead This function reads the audio stream INTERR USBH_AUDIO_StreamRead USBH_AUDIO DEV p_audio_dev USBH_AUDIO_STREAM p_stream USBH_AUDIO_DATA p data UR Arguments p audio dev Pointer to the audio device p_stream Pointer to stream p_data audio sample data Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 181 11 1 15 Stream Write USBH_AUDIO_StreamWrite This function writes a data buffer to the audio device INTERR USBH_AUDIO StreamWrite USBH_AUDIO_DEV p_audio_dev USBH_AUDIO_STREAM p_stream USBH_AUDIO_DATA p_data Arguments p audio dev Pointer to the audio device p stream Pointer to stream p data Audio sample data to be written Return Value USBH_ERR_NONE if the routine succeeds Otherwise an error code as outlined in Appendix A will be returned CONNECT USB Host WITTENSTEIN high integrity systems Page 182 12 Host Controller Driver The Host Controller Driver HCD communicates with the Host Controller hardware for low level data transfers and control operations USB specifications define three standa
127. turns a comment to the host computer to synchronize status information INFO requests a specified category of printer information USTATUS allows the printer to send unsolicited status messages including device job page and timed status USTATUSOFF turns off all unsolicited status Printer Status Requirements To receive status information from the printer the application must have program code that handles the status information sent from the printer 9 11 Format of Status Readback Responses When PJL sends printer status information to the host the response is in a readable ASCII format that always begins with the PUL prefix and ends with a lt FF gt character For example the readback response for the INQUIRE command is PJL INQUIRE variable lt CR gt lt LF gt value lt CR gt lt LF gt lt FF gt The application should be able to read all the data between the PJL header and the lt FF gt control code Lines within the PJL status response begin with a specific keyword and end with the lt CR gt lt LF gt control codes Future printers may support new keywords in the PJL status response The application should ignore those lines which it does not understand CONNECT USB Host WITTENSTEIN high integrity systems Page 156 10 Communication Device Class CDC USB Communication Device Class CDC specification defines standard for USB communication devices like modems and network controllers There are several D
128. uccessfully starting the print job Otherwise appropriate error code as outlined in Appendix A 9 3 7 End the Print Job This function completes the printing job INTERR USBH_PRN_JobEnd USBH_PRN_DEV pprn_dev Arguments pprn_dev Pointer to the printer device Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully completing the print job Otherwise appropriate error code as outlined in Appendix A 9 3 8 Set Page Orientation This function sets the printing page orientation to desired mode The mode can be any of the following CONNECT USB Host WITTENSTEIN high integrity systems Page 123 e 0 portrait mode e 1 landscape mode e 2 reverse portrait mode e 3 reverse landscape mode INTERR USBH_PRN_PageOrientationSet USBH_PRN_DEV pprn_dev UINT0O8 mode Arguments pprn_dev Pointer to the printer device mode Page orientation mode value Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully setting the page given page orientation Otherwise appropriate error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 124 9 3 9 Set Page Left Margin This function sets the left margin to the left edge of the specified column INTERR USBH_PRN_PageLeftMarginSet USBH_PRN_DEV pprn_dev UINT32 left_margin Argume
129. uments pdev Pointer to the USB Device structure pep Pointer to the endpoint structure with the stalled condition to be cleared Return Value USBH_ERR_NONE if the endpoint halt condition is cleared Otherwise a specific error code as outlined in Appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 71 6 2 Endpoint Transfer Functions The USB specification defines four types of transfers e Control transfers e Bulk transfers e Interrupt transfers and After an endpoint i Isochronous transfers s opened using the functions covered in section 6 1 data may be sent to the endpoint using the synchronous transfer functions detailed in Table 6 2 or the asynchronous transfer functions detailed in Table 6 3 This chapter contains four subsections one devoted to each of the four transfer types Each of these chapters contains subsections dedicated to each of the transfer functions for that transfer type TABLE 6 2 SYNCHRONOUS TRANSFER FUNCTIONS Function Description USBH_CtrlTx USBH_lIsochRx Issues a control request to send data to the device Issues a bulk send request to the device This function waits until the I O operation is completed Issues a bulk receive request to the device This function waits until the I O operation is completed Issues an interrupt send request to the device This function waits until the I O operation is completed Issues an interrupt receive request
130. underlining of the text font INTERR USBH_PRN_FontUnderlineSet USBH_PRN_DEV pprn_dev Arguments pprn_dev Pointer to the printer device Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully setting automatic underlining property Otherwise appropriate error code as outlined in Appendix A 9 3 18 Clear Automatic Font Underlining This function removes the automatic underlining of the text font CONNECT USB Host WITTENSTEIN high integrity systems Page 130 INTERR USBH_PRN_FontUnderlineSet USBH_PRN_DEV pprn_dev Arguments pprn_dev Pointer to the printer device Return Value USBH_ERR_INVALID_ARGS if invalid input arguments are provided USBH_ERR_NONE on successfully removing automatic underlining property Otherwise appropriate error code as outlined in Appendix A 9 3 19 Get the Supported Font List This function retrieves the printer supported font list UINTO8 USBH_PRN_FontListGet USBH_PRN_DEV pprn_dev UINT 37 pfont_num INTERR perr Arguments pprn_dev Pointer to the printer device pfont_num A pointer to variable which receives number of available fonts per A pointer to variable which receives actual error code Return Value Valid list on successfully retrieving the printer supported font list otherwise 0 9 3 20 Set the Text Font This function sets the given font as the printing font text
131. x A 3 1 5 Process USB Host Events USBH_HostEventProcess This function is used to process the USB Host Events from Root hub This function must be used only if the RTOS is disabled void USBH_HostEventProcess void _ Arguments void None Return Value None CONNECT USB Host WITTENSTEIN high integrity systems Page 22 3 1 6 Suspend USB Host USBH_HostSuspend This function is used to suspend the selected USB Host Stack and all associated class drivers and host controllers INTERR USBH_HostSuspend USBH_ HOST p host Arguments p_host Pointer to the USBH_HOST structure Return Value On success returns 0 On failure returns specific error number as listed in Appendix A 3 1 7 Resume USB Host USBH_HostResume This function is used to resume USB Host Stack and all associated class driver and host controllers from suspended state INTERR USBH_HostResume USBH_HOST p host Arguments p_host Pointer to the USBH_HOST structure Return Value On success returns 0 On failure returns specific error number as listed in Appendix A 3 2 USB Host Stack Configuration The USB Host stack is configured using the configuration settings contained within the file usbh_cfg h CONNECT USB Host WITTENSTEIN high integrity systems Page 23 3 2 1 Supported device configuration USBH_CFG_MAX_NBR_DEVICES defines the maximum number of USB devices that can be connected simult
132. y per frame timeout ms This is the timeout in milliseconds Return Value The number of bytes received 6 6 3 Asynchronous Transmit USBH_USBH_IsocTxAsync Issues an isochronous send request to the device This function returns immediately and the asynchronous completion routine is called when I O is completed CONNECT USB Host WITTENSTEIN high integrity systems Page 87 INTERR USBH_IsocTxAsync USBH_EP p ep void p but UINT32 buf_len USBH_INTR_CMPL_FNCT pp _fnct USBH_ISOC_DESC p_isoc_desc Void p_fnct_arg X Argument p_ep Pointer to the endpoint p_buf Pointer to the data buffer buf_len Number of data bytes in buffer p_fnct Pointer to asynchronous function which will be invoked by the asynchronous I O task when the transfer is complete p_isoc_desc Pointer to the isochronous descriptor p fnct_arg Pointer to a variable that will be passed to asynchronous function Return Value USB_ERR_NONE If the request is submitted USB_ERR_INVALID_ARGS If p_ep is 0 USB_ERR_EP_CLOSED If the endpoint is closed USB_ERR_EP_INVALID If the endpoint type is not lsochronous or direction is not out Otherwise specific error code as define in appendix A CONNECT USB Host WITTENSTEIN high integrity systems Page 88 6 6 4 Asynchronous Receive USBH_ USBH_IsocRxAsync Issues an isochronous receive request to the device This function waits until the I O operation is completed INTERR USBH_IsocRxAsync USBH_EP p
Download Pdf Manuals
Related Search
Related Contents
pour une approche sémantique de l`enseignement User`s manual 8-Lite Plus – Operators Manual 24 - 取扱説明書ダウンロード Philips YS502 Viewsonic VNB101BAGG-E 10Zoll Mini Notebook 1GB RAM 160G SATA HDD XP h MSPCHSMSS INSTALLATION INSTRUCTIONS ユーザーマニュアル Version 1.9 Copyright © All rights reserved.
Failed to retrieve file