Friday, 05 December 2008
 
  Home arrow PIC arrow USB arrow Understanding the Microchip USB Firmware  
Main Menu
Home
Car PC
PIC
Electronics
Brewing
Links
Contact Me
FAQs
Forums
eXtplorer
PayPal Donation

Enter Amount:

Understanding the Microchip USB Firmware PDF Print E-mail
Written by Evan   
Saturday, 23 September 2006
Article Index
Understanding the Microchip USB Firmware
Page 2 - Descriptors and Endpoints
 

If you want to add or modify endpoints on the device, you need to know of several places to make changes.  First, there are a couple of good sections of comments in the code; check out the comments in usbmmap.c, and usbdsc.c.  In each case, the existing endpoints and descriptors should be enough of a guide as to what exactly to add or change.  The changes you need to make are as follows:

usbdsc.c

This is where the descriptor information is, which is reported to the PC.  The important parts here are setting the number of endpoints in the interface descriptor, and adding or modifying the endpoint descriptors.

usbdsc.h

Here you need to add or modify the endpoint descriptor(s) in the configuration descriptor.

usbmmap.c

This file maps the memory space used by the endpoints.  Here you need to add or modify the buffer space declared for each endpoint you plan to have.  

usbmmap.h

Here, you have to declare those buffers as externs. 

usbcfg.h

Here you will find a number of #define statements mapping intelligible names to to certain endpoint parameters.  These will generally contain the name of the device class; for example, the #define's for the 'generic' device class start with 'USBGEN_'.  These #define's are referenced in several places throughout the firmware.

usbgen.c

This is where the functions important to your user-controlled endpoints lie.  Technically, this file contains the functions for the 'generic' class, and thus you should probably keep your own functions in a separate file (especially if you're ditching the 'generic' class entirely) but for simple experimentation it's probably easiest to just add or modify functions here.  The functions here are for initializing the endpoint(s), reading, and writing.  For any endpoints you add, you'd need to put some initialization code in the first function, modeling what's already in there.  And for each IN or OUT endpoint, you need a corresponding read or write function.  The existing 'generic' class functions should be a good enough guide for a basic case.



Last Updated ( Tuesday, 30 January 2007 )
 
< Prev   Next >
Partner Site
Visit my friends over at Dream-Technology, producing radio controlled and switch adapted toys for children with physical disabilities.
Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License.
For usage outside the terms of this license, contact me by email to discuss.

© 2008 eegeek.net
Joomla! is Free Software released under the GNU/GPL License.

Get The Best Free Joomla Templates at www.joomla-templates.com