|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
57 #include "lpcusb/usbapi.h"
61 #error PCLK needs to be higher than 18MHz for USB to work properly
66 #define USB_VIC_SLOT 10
69 #define INT_IN_EP 0x81
70 #define BULK_OUT_EP 0x05
71 #define BULK_IN_EP 0x82
73 #define MAX_PACKET_SIZE 64
75 #define LE_WORD(x) ((x)&0xFF),((x)>>8)
78 #define CS_INTERFACE 0x24
79 #define CS_ENDPOINT 0x25
81 #define SET_LINE_CODING 0x20
82 #define GET_LINE_CODING 0x21
83 #define SET_CONTROL_LINE_STATE 0x22
85 #define VCOM_FIFO_SIZE 128
119 static void USBIntHandler(
void) __attribute__((interrupt(
"IRQ")));
121 static void BulkOut(U8 bEP, U8 bEPStatus);
123 #ifdef USE_USB_LINE_CODING
231 'L', 0,
'P', 0,
'C', 0,
'U', 0,
'S', 0,
'B', 0,
235 'U', 0,
'S', 0,
'B', 0,
'S', 0,
'e', 0,
'r', 0,
'i', 0,
'a', 0,
'l', 0,
239 '1', 0,
'2', 0,
'3', 0,
'4', 0,
'5', 0,
'6', 0,
'7', 0,
'8', 0,
259 if (next == fifo->
tail) {
297 #ifdef USE_USB_LINE_CODING
363 #ifdef USE_USB_LINE_CODING
432 static void BulkOut(U8 bEP, U8 bEPStatus __attribute__((unused)))
444 for (i = 0; i < iLen; i++) {
461 static void BulkIn(U8 bEP, U8 bEPStatus __attribute__((unused)))
467 USBHwNakIntEnable(0);
495 switch (pSetup->bRequest) {
501 #ifdef USE_USB_LINE_CODING
542 USBHwNakIntEnable(INACK_BI);
563 for (i = 0; i < len; i++) {
590 #ifdef USE_USB_LINE_CODING
602 USBHwRegisterEPIntHandler(
INT_IN_EP, NULL);
610 USBHwNakIntEnable(INACK_BI);
static uint8_t abBulkBuf[64]
int VCOM_check_available(void)
Checks if data available in VCOM buffer.
VIC slots used for the LPC2148 define name e g gps UART1_VIC_SLOT e g modem SPI1_VIC_SLOT SPI1 in mcu_periph spi_arch c or spi_slave_hs_arch c(and some others not using the SPI peripheral yet..) I2C0_VIC_SLOT 8 mcu_periph/i2c_arch.c I2C1_VIC_SLOT 9 mcu_periph/i2c_arch.c USB_VIC_SLOT 10 usb
unsigned disableIRQ(void)
static uint8_t usb_serial_getch(struct usb_serial_periph *p)
static uint8_t abClassReqData[8]
int fifo_free(fifo_t *fifo)
static int usb_serial_check_free_space(struct usb_serial_periph *p, long *fd, uint16_t len)
void VCOM_send_message(void)
static void BulkOut(U8 bEP, U8 bEPStatus)
Local function to handle incoming bulk data.
struct usb_serial_periph usb_serial
static int usb_serial_char_available(struct usb_serial_periph *p)
static void usb_serial_send(struct usb_serial_periph *p, long fd)
static void usb_serial_transmit_buffer(struct usb_serial_periph *p, long fd, uint8_t *data, uint16_t len)
static TLineCoding LineCoding
struct link_device device
Generic device interface.
static void BulkIn(U8 bEP, U8 bEPStatus)
Local function to handle outgoing bulk data.
bool VCOM_check_free_space(uint16_t len)
Checks if buffer free in VCOM buffer.
void fifo_init(fifo_t *fifo, U8 *buf)
int VCOM_getchar(void)
Reads one character from VCOM port.
int fifo_avail(fifo_t *fifo)
static BOOL HandleClassRequest(TSetupPacket *pSetup, int *piLen, U8 **ppbData)
Local function to handle the USB-CDC class requests.
static void usb_serial_transmit(struct usb_serial_periph *p, long fd, uint8_t byte)
static uint8_t rxdata[VCOM_FIFO_SIZE]
void VCOM_allow_linecoding(uint8_t mode)
#define SET_CONTROL_LINE_STATE
BOOL fifo_put(fifo_t *fifo, U8 c)
int VCOM_putchar(int c)
Writes one character to VCOM port.
static bool BulkOut_is_blocked
static void USBIntHandler(void)
Interrupt handler.
static uint8_t mode
mode holds the current sonar mode mode = 0 used at high altitude, uses 16 wave patterns mode = 1 used...
static const uint8_t abDescriptors[]
static void USBFrameHandler(U16 wFrame)
BOOL fifo_get(fifo_t *fifo, U8 *pc)
static uint8_t txdata[VCOM_FIFO_SIZE]