Paparazzi UAS  v6.0_unstable-94-gda5b527-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
usb_serial.h File Reference

arch independent USB API More...

#include <inttypes.h>
#include "std.h"
#include "pprzlink/pprzlink_device.h"
+ Include dependency graph for usb_serial.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  usb_serial_periph
 

Functions

void VCOM_init (void)
 
int VCOM_putchar (int c)
 Writes one character to VCOM port fifo. More...
 
int VCOM_getchar (void)
 Reads one character from VCOM port. More...
 
int VCOM_peekchar (int ofs)
 Reads one character from VCOM port without removing it from the queue. 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...
 
void VCOM_set_linecoding (uint8_t mode)
 
void VCOM_allow_linecoding (uint8_t mode)
 
void VCOM_send_message (void)
 Send data from fifo right now. More...
 
void VCOM_event (void)
 Poll usb (required by libopencm3). More...
 

Variables

struct usb_serial_periph usb_serial
 

Detailed Description

arch independent USB API

Definition in file usb_serial.h.


Data Structure Documentation

struct usb_serial_periph

Definition at line 35 of file usb_serial.h.

+ Collaboration diagram for usb_serial_periph:
Data Fields
struct link_device device Generic device interface.

Function Documentation

void VCOM_allow_linecoding ( uint8_t  mode)

Referenced by main().

+ Here is the caller graph for this function:

int VCOM_check_available ( void  )

Checks if data available in VCOM buffer.

Returns
nonzero if char is available in the queue, zero otherwise

Definition at line 459 of file usb_ser_hw.c.

References fifo_avail().

Referenced by dfu_command_event(), event_usb_serial(), ReadUsbBuffer(), tunnel_event(), and usb_serial_char_available().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool VCOM_check_free_space ( uint16_t  len)

Checks if buffer free in VCOM buffer.

Returns
TRUE if len bytes are free

Definition at line 450 of file usb_ser_hw.c.

References FALSE, fifo_free(), and TRUE.

Referenced by dfu_command_event(), tunnel_event(), usb_serial_check_free_space(), and VCOM_putchar().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void VCOM_event ( void  )

Poll usb (required by libopencm3).

VCOM_event() should be called from main/module event function

Definition at line 468 of file usb_ser_hw.c.

References fifo_avail(), my_usbd_dev, tx_timeout, and VCOM_send_message().

Referenced by event_usb_serial(), main(), and mcu_event().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int VCOM_getchar ( void  )

Reads one character from VCOM port.

Returns
character read, or -1 if character could not be read

Definition at line 425 of file usb_ser_hw.c.

References fifo_get().

Referenced by dfu_command_event(), event_usb_serial(), ReadUsbBuffer(), tunnel_event(), and usb_serial_getch().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void VCOM_init ( void  )
int VCOM_peekchar ( int  ofs)

Reads one character from VCOM port without removing it from the queue.

Parameters
ofsposition to read
Returns
character read, or -1 if character could not be read

Definition at line 438 of file usb_ser_hw.c.

References fifo_peek().

Referenced by dfu_command_event().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int VCOM_putchar ( int  c)

Writes one character to VCOM port fifo.

Since we don't really have an instant feeedback from USB driver if the character was written, we always return c if we are connected.

Parameters
[in]ccharacter to write
Returns
character to be written, -1 if not usb is not connected

Definition at line 397 of file usb_ser_hw.c.

References fifo_put(), sys_time_usleep(), tx_timeout, TX_TIMEOUT_CNT, VCOM_check_free_space(), and VCOM_send_message().

Referenced by cmd_execute(), periodic_usb_serial(), tunnel_event(), usb_serial_parse_packet(), usb_serial_transmit(), and usb_serial_transmit_buffer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void VCOM_send_message ( void  )

Send data from fifo right now.

Only if usb is connected.

Definition at line 487 of file usb_ser_hw.c.

References fifo_get(), MAX_PACKET_SIZE, and my_usbd_dev.

Referenced by cmd_execute(), usb_serial_parse_packet(), usb_serial_send(), VCOM_event(), and VCOM_putchar().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void VCOM_set_linecoding ( uint8_t  mode)

Variable Documentation

struct usb_serial_periph usb_serial

Definition at line 523 of file usb_ser_hw.c.

Referenced by VCOM_init().