
Go to the source code of this file.
Functions | |
| uns8 | usb_cdc_getc () |
| Retrieve a received character from the USB serial port. | |
| void | usb_cdc_handle_tx () |
| Transmit any buffered characters over ther USB virtual serial port. | |
| void | usb_cdc_print_int (uns16 i) |
| Print a 16 bit number to the USB virtual serial port. | |
| void | usb_cdc_print_str (char *str) |
| Print a string out to the USB virtual serial port. | |
| void | usb_cdc_putc (uns8 c) |
| Sends a single character to the USB serial port. | |
| uns8 | usb_cdc_rx_avail () |
| Check to see if a character is available in the receive buffer. | |
| void | usb_cdc_setup () |
| Set up data structures ready for USB CDC use. | |
| uns8 | usb_cdc_tx_empty () |
| Check to see if the transmit buffer is empty. | |
Ian Harris 2009 imharris [at] gmail.com
Released under the "do whatever you like with this but if it breaks, you get to keep both pieces" license.
Definition in file usb_cdc_class.h.
| uns8 usb_cdc_getc | ( | ) |
Receive a character from the USB serial port. If a character has not been received, this routine will wait indefinately.
Definition at line 242 of file usb_cdc_class.c.
References cdc_rx_buffer, cdc_rx_end, cdc_rx_start, end_crit_sec, start_crit_sec, and uns8.
| void usb_cdc_handle_tx | ( | ) |
Generally only used internally, this routine will attempt to place any characters in the transmit queue into the USB buffers. It will fail gracefully if the USB buffer is already owned by the SIE.
Definition at line 263 of file usb_cdc_class.c.
References buffer_descriptor::addr, BC8, BC9, BSTALL, cdc_tx_buffer, cdc_tx_end, cdc_tx_start, buffer_descriptor::count, DTS, DTSEN, end_crit_sec, ep_in_bd_location, ep_in_buffer_location, ep_in_buffer_size, INCDIS, KEN, serial_print_int(), serial_print_str(), serial_putc(), start_crit_sec, buffer_descriptor::stat, uns16, uns8, and UOWN.
Referenced by usb_ep_data_in_callback(), and usb_SOF_callback().


| void usb_cdc_print_int | ( | uns16 | i | ) |
Print a 16 bit unsigned number in decimal to the USB virtual serial port
| i | the 16 bit number to be printed |
Definition at line 361 of file usb_cdc_class.c.
References uns8, and usb_cdc_putc().

| void usb_cdc_print_str | ( | char * | str | ) |
Send a null terminated string out the virtual serial port
| str | the string to be sent |
Definition at line 328 of file usb_cdc_class.c.
References uns8, and usb_cdc_putc().

| void usb_cdc_putc | ( | uns8 | c | ) |
Deliver a single character out the virtual serial port. This routine will add the character to the transmit buffer. The actual buffer will be physically sent on the Start Of Frame (SOF) interrupt (each 1ms) or on the end point interrupt - ie, when the last character or chunk of characters was sent.
| c | The 8 bit byte to be transmitted. |
Definition at line 215 of file usb_cdc_class.c.
References cdc_tx_buffer, cdc_tx_end, cdc_tx_start, kill_interrupts, and uns8.
Referenced by usb_cdc_print_int(), and usb_cdc_print_str().

| uns8 usb_cdc_rx_avail | ( | ) |
If one or more bytes are available in the USB serial port receive buffer, this routine will return true. If there are no bytes available, it will return false.
Definition at line 325 of file usb_cdc_class.c.
References cdc_rx_end, and cdc_rx_start.
| void usb_cdc_setup | ( | ) |
Configures the default DTE rate, stop bits etc.
Definition at line 352 of file usb_cdc_class.c.
References long_union::as_long, class_data, line_coding::data_bits, line_coding::dte_rate, line_coding::parity, and line_coding::stop_bits.
| uns8 usb_cdc_tx_empty | ( | ) |
Sometimes it is useful to see if the transmit buffer is empty, since then you can be sure your data is well on its way. In the case of USB, this means that the data has been at least placed into the outbound USB buffer; it's not possible to tell until after the fact if the data has actually been squirted out the USB port.
Definition at line 326 of file usb_cdc_class.c.
References cdc_tx_end, and cdc_tx_start.
1.5.7.1