Paparazzi UAS
v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
|
#include <string.h>
#include "std.h"
#include <stdbool.h>
#include "LPC21xx.h"
#include "armVIC.h"
#include "mcu_periph/usb_serial.h"
#include <BOARD_CONFIG>
#include "lpcusb/usbapi.h"
Go to the source code of this file.
Data Structures | |
struct | fifo_t |
struct | TLineCoding |
Macros | |
#define | USB_VIC_SLOT 10 |
#define | INT_IN_EP 0x81 |
#define | BULK_OUT_EP 0x05 |
#define | BULK_IN_EP 0x82 |
#define | MAX_PACKET_SIZE 64 |
#define | LE_WORD(x) ((x)&0xFF),((x)>>8) |
#define | CS_INTERFACE 0x24 |
#define | CS_ENDPOINT 0x25 |
#define | SET_LINE_CODING 0x20 |
#define | GET_LINE_CODING 0x21 |
#define | SET_CONTROL_LINE_STATE 0x22 |
#define | VCOM_FIFO_SIZE 128 |
#define | EOF (-1) |
#define | ASSERT(x) |
Functions | |
static void | USBIntHandler (void) |
Interrupt handler. More... | |
static void | BulkOut (U8 bEP, U8 bEPStatus) |
Local function to handle incoming bulk data. More... | |
void | fifo_init (fifo_t *fifo, U8 *buf) |
BOOL | fifo_put (fifo_t *fifo, U8 c) |
BOOL | fifo_get (fifo_t *fifo, U8 *pc) |
int | fifo_avail (fifo_t *fifo) |
int | fifo_free (fifo_t *fifo) |
int | VCOM_putchar (int c) |
Writes one character to VCOM port. More... | |
int | VCOM_getchar (void) |
Reads one character from VCOM port. More... | |
bool | VCOM_check_free_space (uint16_t len) |
Checks if buffer free in VCOM buffer. More... | |
int | VCOM_check_available (void) |
Checks if data available in VCOM buffer. More... | |
static void | BulkIn (U8 bEP, U8 bEPStatus) |
Local function to handle outgoing bulk data. More... | |
static BOOL | HandleClassRequest (TSetupPacket *pSetup, int *piLen, U8 **ppbData) |
Local function to handle the USB-CDC class requests. More... | |
static void | USBFrameHandler (U16 wFrame) |
static int | usb_serial_check_free_space (struct usb_serial_periph *p, long *fd, uint16_t len) |
static void | usb_serial_transmit (struct usb_serial_periph *p, long fd, uint8_t byte) |
static void | usb_serial_transmit_buffer (struct usb_serial_periph *p, long fd, uint8_t *data, uint16_t len) |
static void | usb_serial_send (struct usb_serial_periph *p, long fd) |
void | VCOM_event (void) |
void | VCOM_send_message (void) |
static int | usb_serial_char_available (struct usb_serial_periph *p) |
static uint8_t | usb_serial_getch (struct usb_serial_periph *p) |
void | VCOM_init (void) |
Variables | |
int | allow_line_coding = 0 |
static TLineCoding | LineCoding = {115200, 0, 0, 8} |
static uint8_t | abBulkBuf [64] |
static uint8_t | abClassReqData [8] |
static uint8_t | txdata [VCOM_FIFO_SIZE] |
static uint8_t | rxdata [VCOM_FIFO_SIZE] |
static fifo_t | txfifo |
static fifo_t | rxfifo |
static bool | BulkOut_is_blocked = false |
static const uint8_t | abDescriptors [] |
struct usb_serial_periph | usb_serial |
struct fifo_t |
Definition at line 90 of file usb_ser_hw.c.
Data Fields | ||
---|---|---|
uint8_t * | buf | |
int | head | |
int | tail |
struct TLineCoding |
#define ASSERT | ( | x | ) |
Definition at line 88 of file usb_ser_hw.c.
Referenced by BulkOut().
#define BULK_IN_EP 0x82 |
Definition at line 71 of file usb_ser_hw.c.
Referenced by VCOM_init().
#define BULK_OUT_EP 0x05 |
Definition at line 70 of file usb_ser_hw.c.
Referenced by VCOM_getchar(), and VCOM_init().
#define CS_ENDPOINT 0x25 |
Definition at line 79 of file usb_ser_hw.c.
#define CS_INTERFACE 0x24 |
Definition at line 78 of file usb_ser_hw.c.
#define EOF (-1) |
Definition at line 87 of file usb_ser_hw.c.
Referenced by load_texton_dictionary(), VCOM_getchar(), and VCOM_putchar().
#define GET_LINE_CODING 0x21 |
Definition at line 82 of file usb_ser_hw.c.
Referenced by HandleClassRequest().
#define INT_IN_EP 0x81 |
Definition at line 69 of file usb_ser_hw.c.
Referenced by VCOM_init().
#define LE_WORD | ( | x | ) | ((x)&0xFF),((x)>>8) |
Definition at line 75 of file usb_ser_hw.c.
#define MAX_PACKET_SIZE 64 |
Definition at line 73 of file usb_ser_hw.c.
Referenced by BulkIn(), BulkOut(), and VCOM_getchar().
#define SET_CONTROL_LINE_STATE 0x22 |
Definition at line 83 of file usb_ser_hw.c.
Referenced by HandleClassRequest().
#define SET_LINE_CODING 0x20 |
Definition at line 81 of file usb_ser_hw.c.
Referenced by HandleClassRequest().
#define USB_VIC_SLOT 10 |
Definition at line 66 of file usb_ser_hw.c.
Referenced by VCOM_init().
#define VCOM_FIFO_SIZE 128 |
Definition at line 85 of file usb_ser_hw.c.
Referenced by fifo_avail(), fifo_free(), fifo_get(), and fifo_put().
|
static |
Local function to handle outgoing bulk data.
[in] | bEP | |
[in] | bEPStatus |
Definition at line 461 of file usb_ser_hw.c.
References abBulkBuf, fifo_avail(), fifo_get(), and MAX_PACKET_SIZE.
Referenced by VCOM_init().
|
static |
Local function to handle incoming bulk data.
[in] | bEP | |
[in] | bEPStatus |
Definition at line 432 of file usb_ser_hw.c.
References abBulkBuf, ASSERT, BulkOut_is_blocked, FALSE, fifo_free(), fifo_put(), and MAX_PACKET_SIZE.
Referenced by VCOM_getchar(), and VCOM_init().
int fifo_avail | ( | fifo_t * | fifo | ) |
Definition at line 287 of file usb_ser_hw.c.
References fifo_t::head, fifo_t::tail, and VCOM_FIFO_SIZE.
Referenced by BulkIn(), fifo_free(), USBFrameHandler(), VCOM_check_available(), and VCOM_event().
int fifo_free | ( | fifo_t * | fifo | ) |
Definition at line 292 of file usb_ser_hw.c.
References fifo_avail(), and VCOM_FIFO_SIZE.
Referenced by BulkOut(), VCOM_check_free_space(), and VCOM_getchar().
BOOL fifo_get | ( | fifo_t * | fifo, |
U8 * | pc | ||
) |
Definition at line 270 of file usb_ser_hw.c.
References fifo_t::buf, FALSE, fifo_t::head, fifo_t::tail, TRUE, and VCOM_FIFO_SIZE.
Referenced by BulkIn(), VCOM_getchar(), and VCOM_send_message().
void fifo_init | ( | fifo_t * | fifo, |
U8 * | buf | ||
) |
Definition at line 246 of file usb_ser_hw.c.
References fifo_t::buf, fifo_t::head, and fifo_t::tail.
Referenced by VCOM_init().
BOOL fifo_put | ( | fifo_t * | fifo, |
U8 | c | ||
) |
Definition at line 253 of file usb_ser_hw.c.
References fifo_t::buf, FALSE, fifo_t::head, fifo_t::tail, TRUE, and VCOM_FIFO_SIZE.
Referenced by BulkOut(), cdcacm_data_rx_cb(), and VCOM_putchar().
|
static |
Local function to handle the USB-CDC class requests.
[in] | pSetup | |
[out] | piLen | |
[out] | ppbData |
Definition at line 493 of file usb_ser_hw.c.
References allow_line_coding, FALSE, GET_LINE_CODING, SET_CONTROL_LINE_STATE, SET_LINE_CODING, and TRUE.
Referenced by VCOM_init().
|
static |
Definition at line 576 of file usb_ser_hw.c.
References VCOM_check_available().
Referenced by VCOM_init().
|
static |
Definition at line 550 of file usb_ser_hw.c.
References VCOM_check_free_space().
Referenced by VCOM_init().
|
static |
Definition at line 581 of file usb_ser_hw.c.
References VCOM_getchar().
Referenced by VCOM_init().
|
static |
Definition at line 568 of file usb_ser_hw.c.
Referenced by VCOM_init().
|
static |
Definition at line 555 of file usb_ser_hw.c.
References VCOM_putchar().
Referenced by main_periodic_task(), and VCOM_init().
|
static |
Definition at line 560 of file usb_ser_hw.c.
References VCOM_putchar().
Referenced by VCOM_init().
|
static |
Definition at line 538 of file usb_ser_hw.c.
References fifo_avail().
Referenced by VCOM_init().
|
static |
Interrupt handler.
Simply calls the USB ISR, then signals end of interrupt to VIC
Definition at line 531 of file usb_ser_hw.c.
References VICVectAddr.
Referenced by VCOM_init().
int VCOM_check_available | ( | void | ) |
Checks if data available in VCOM buffer.
Definition at line 420 of file usb_ser_hw.c.
Referenced by event_usb_serial(), ReadUsbBuffer(), tunnel_event(), and usb_serial_char_available().
bool VCOM_check_free_space | ( | uint16_t | len | ) |
Checks if buffer free in VCOM buffer.
Definition at line 409 of file usb_ser_hw.c.
Referenced by tunnel_event(), usb_serial_check_free_space(), and VCOM_putchar().
void VCOM_event | ( | void | ) |
Definition at line 571 of file usb_ser_hw.c.
Referenced by event_usb_serial(), main(), and mcu_event().
int VCOM_getchar | ( | void | ) |
Reads one character from VCOM port.
Definition at line 386 of file usb_ser_hw.c.
Referenced by event_usb_serial(), ReadUsbBuffer(), tunnel_event(), and usb_serial_getch().
void VCOM_init | ( | void | ) |
Definition at line 586 of file usb_ser_hw.c.
Referenced by init_usb_serial(), main(), and mcu_init().
int VCOM_putchar | ( | int | c | ) |
Writes one character to VCOM port.
[in] | c | character to write |
Definition at line 376 of file usb_ser_hw.c.
Referenced by cmd_execute(), periodic_usb_serial(), tunnel_event(), usb_serial_parse_packet(), usb_serial_transmit(), and usb_serial_transmit_buffer().
void VCOM_send_message | ( | void | ) |
Definition at line 574 of file usb_ser_hw.c.
Referenced by cmd_execute(), usb_serial_parse_packet(), usb_serial_send(), VCOM_event(), and VCOM_putchar().
|
static |
Definition at line 107 of file usb_ser_hw.c.
|
static |
Definition at line 108 of file usb_ser_hw.c.
Referenced by VCOM_init().
|
static |
Definition at line 133 of file usb_ser_hw.c.
int allow_line_coding = 0 |
Definition at line 104 of file usb_ser_hw.c.
Referenced by HandleClassRequest().
|
static |
Definition at line 116 of file usb_ser_hw.c.
Referenced by BulkOut(), and VCOM_getchar().
|
static |
Definition at line 106 of file usb_ser_hw.c.
|
static |
Definition at line 111 of file usb_ser_hw.c.
Referenced by VCOM_init().
|
static |
Definition at line 114 of file usb_ser_hw.c.
|
static |
Definition at line 110 of file usb_ser_hw.c.
Referenced by VCOM_init().
|
static |
Definition at line 113 of file usb_ser_hw.c.
struct usb_serial_periph usb_serial |
Definition at line 547 of file usb_ser_hw.c.
Referenced by VCOM_init().