[libopenstm32-devel] USB device support
Status: Inactive
Brought to you by:
uh1763
From: Gareth M. <ga...@bl...> - 2010-10-18 00:15:58
|
Hi I've finally done some work on the USB device stack. The patch is attached, including an example of a CDC ACM device. The stack is functional but not complete. Some discussion is probably in order before committing. I've included the USB related files in a directory lib/usb and included this in the VPATH in the Makefile. I've used the cdc.h header from the Linux kernel and usb.h from libusb-0.1 for some structure definitions. The new files are: usb.h - public header file for application implementing a usb device. Symbols are prefixed with 'usbd_' usb_private.h - internal header for definitions used in the library, but not exported to the application. Symbols are prefixed with '_usbd_' usb.c - usb library initialisation function usb_f103.c - platform specific implementation for STM32F10[23] device hardware. usb_control.c - implementation of the default usb control endpoint. usb_standard.c - implementation of the standard usb requests. The stack should be portable, with only the file usb_f103.c needing to be changed for different platforms. I have the same code working on an AT91. I've kept using the C99 stdint.h types in the portable files. Minor modification have been made to other files to support the stack and example. I added functions to rcc.c to configure the usb prescaler and configure clocks for 48MHz from HSI. My example has the 1.5k D+ pull-up resistor connected to PA15 (JTDI). Change this to match your hardware, especially if you need the JTAG port for debugging. Any comments or discussion would be appreciated. Regards, Gareth -- *Black Sphere Technologies Ltd.* Web: www.blacksphere.co.nz Mobile: +64 27 777 2182 Tel: +64 9 478 8885 Skype: gareth.mcmullin LinkedIn: http://nz.linkedin.com/in/gsmcmullin |