usb_drv

USB driver library

Author Albert Faber, Copyright © 2008..2009, all rights reserved.
Adapted-by -
Compiler >=2.4j

Description

This file contains the lowl level USB driver routines. It constrols
the USB serial interface engine, by managing the input and output transfers,
and calling the defined callback function when required


Sources

http://www.usb.org ; for USB specifications
         http://www.lvr.com/usbc.htm ; a lot of information about USB
         http://www.beyondlogic.org/ ; also a nice with with useful information


Dependencies

No dependency found



Summary

Global variables/contants

Procedures

Private

Functions


API details

Global variables/contants

Procedures

  • usb_enable_module()

    Procedure to turn on the USB device
    
    

  • usb_handle_stall()

    Procedure can be called when the USB device has to be stalled
    
    

  • usb_setup()

    Procedure to intialize the USB device, it will only do the setup, to enable
    the USB device, use the usb_enable() procedure
    
    

  • usb_handle_isr()

    This is the heard of the USB library, all pending IO transfers are handled by
    this main (interrupt) service routine. For the PIC USB device it does not make much 
    sense to use real interrupts since all real time aspects are handle by the SIE. 
    Therefore this usb_handle_isr() must be polled on a regular base, in order to 
    to keep the input and output transfers flowing
    
    

Private
  • _usb_handle_standard_request()

    Internal procedure to handle standard USB requests
    it will take care of the overall state of the device
    performing USB buffer management
    controlling the SIE
    and call the callback function if required
    
    

  • _usb_ints_on()

    Internal procedure to set the correct interrupt flags, note that for PIC USB device
    it does not make much sense to use real interrupts since all real time aspects
    are handle by the SIE. However, the library does use the interrupt flags, this
    procedure will setup to proper interrupt flags
    
    

  • _usb_handle_transaction()

    Internal procedure to handle the USB transactions
    it will take care of the overall state of the device
    performing USB buffer management
    controlling the SIE
    and call the callback function if required
    
    

  • _usb_handle_reset()

    Internal procedure to reset the USB device
    
    


Functions

  • usb_is_configured() return bit

    Function returns true if the usb device has been completely configured, otherwise
    return value will be false
    
    

  • usb_get_state() return byte

    Get the state of the USB device
    USB_STATE_POWERED -> USB device is powered up, ready to start negotiating
    USB_STATE_DEFAULT -> USB device is now negotiating
    USB_STATE_ADDRESS -> USB device now has an address
    USB_STATE_CONFIGURED -> USB device is completely configured and ready to rock and roll 
    
    


Related samples

Here are the list of samples which use this library:

18f14k5018f14k50_usb_bootloader.jal
18f14k5018f14k50_usb_hid_mouse.jal
18f14k5018f14k50_usb_hid_generic.jal
18f14k5018f14k50_usb_bootloader_autostart.jal
18f245018f2450_usb_bootloader.jal
18f245018f2450_usb_bootloader_autostart.jal
18f245018f2450_usb_hid_generic.jal
18f245018f2450_usb_hid_mouse.jal
18f255018f2550_usb_bootloader_autostart.jal
18f255018f2550_usb_hid_mouse.jal
18f255018f2550_usb_hid_generic.jal
18f455018f4550_usb_bootloader_autostart.jal
18f455018f4550_usb_hid_generic.jal
18f455018f4550_usb_bootloader.jal
18f455018f4550_usb_hid_mouse.jal
18f67j5018f67j50_usb_hid_mouse.jal
18f67j5018f67j50_usb_bootloader_autostart.jal
18f67j5018f67j50_usb_hid_generic.jal