usb_drv_cdc_class

USB Communication Device Class driver

Author Albert Faber, Copyright © 2008..2021, all rights reserved.
Adapted-by Matthew Schinkel, Rob Jansen
Compiler 2.5r5

Description

USB Communication Device Class (CDC) code
This USB library files contains the low level implementation to perform serial
communication over a USB interface. The usage of this library requires detailed
knowledge of the USB interface and requires that several configuration parameters
are defined correctly. In order to make USB serial communication more accessible
for the end user, I would highly recommend to use the usb_serial library




Sources

http://www.usb.org for USB specifications


Dependencies

No dependency found



Summary

Global variables/contants

Procedures

Functions


API details

Global variables/contants

Procedures

  • usb_handle_class_request_callback()

    Handle the class request from the host.
    

  • usb_handle_class_ctrl_read_callback()

    Handle the class read request from the Host. The only request handled is
    getting the line coding but we already sent that in usb_handle_class_request_callback()
    

  • usb_ep_data_out_callback(byte in end_point, word in buffer_addr, byte in byte_count)

    This function is called when data can be received via the bulk interface
    Data in means that the Host is sending data to the device.
    
    

  • usb_cdc_putc(byte in c)

    This usb_cdc_putc will transmit the specified character. Under normal conditions
    the character to be transmitted is placed into the fifo, so the call will be non
    blocking. This implies that buffer overruns can occur when the transmit FIFO is full.
    Therefore it is adviced to check the transmit FIFO state before calling this procedure
    to avoid buffer overruns. These buffer overrun issues have been addressed in the
    usb_serial library, therefore it is highly recommended to use this library instead
    of calling this low level procedure
    
    

  • usb_cdc_handle_tx()

    This procedure will handle the transmission of the (bulk) data. The procedure check
    if there are pending characters in the tranmit FIFO. These character(s) are send in
    chunk(s), the chunk size is dependent on the configuration of the bulk interface
    endpoint determined by USB_CDC_BULK_IN_EP_SIZE.
    
    

  • usb_ep_data_in_callback(byte in end_point, word in buffer_addr, byte in byte_count)

    This function is called when data can be transmitted via the bulk interface
    Data IN means that the device is sending data to the Host.
    Note: Only the parameter end_point is used.
    
    

  • usb_handle_class_ctrl_write_callback()

    Handle the class write request from the Host. The only request handled is
    setting the line coding.
    

  • usb_sof_callback()

    This procedure is called when the Start Of Frame interrupt flag is set. It starts the
    tranmission of any pending data (if present).
    
    

  • usb_cdc_setup()

    This procedure will intialize the line status of the communicatin device class
    
    

Functions

  • usb_cdc_rx_avail() return bit

    This function returns there has been a character received, function will return true
    if there is at least one pending receive character, false otherwise
    
    

  • usb_cdc_line_status() return byte

    This function returns the line status. If on the host side the COM port has not been
    opened, the return status will be 0x00, otherwise it will be != 0
    
    

  • usb_cdc_getc() return byte

    This usb_cdc_getc function wait (blocking) until a character has been received.
    The byte value of the received character is returned by this function
    
    

  • usb_cdc_tx_empty() return byte

    This function returns the empty status of the transmit FIFO, it will return true if
    transmit FIFO is empty, false otherwise
    
    


Related samples

No sample found