Paparazzi UAS
v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
|
linux UDP handling More...
#include "mcu_periph/udp.h"
#include "udp_socket.h"
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <pthread.h>
#include <sys/select.h>
#include "rt_priority.h"
Go to the source code of this file.
Macros | |
#define | UDP_THREAD_PRIO 10 |
Functions | |
static void * | udp_thread (void *data) |
check for new udp packets to receive or send. More... | |
void | udp_arch_init (void) |
void | udp_arch_periph_init (struct udp_periph *p, char *host, int port_out, int port_in, bool_t broadcast) |
Initialize the UDP peripheral. More... | |
uint16_t | udp_char_available (struct udp_periph *p) |
Get number of bytes available in receive buffer. More... | |
uint8_t | udp_getch (struct udp_periph *p) |
Get the last character from the receive buffer. More... | |
void | udp_receive (struct udp_periph *p) |
Read bytes from UDP. More... | |
void | udp_send_message (struct udp_periph *p) |
Send a message. More... | |
void | udp_send_raw (struct udp_periph *p, uint8_t *buffer, uint16_t size) |
Send a packet from another buffer. More... | |
Variables | |
static pthread_mutex_t | udp_mutex = PTHREAD_MUTEX_INITIALIZER |
linux UDP handling
Definition in file udp_arch.c.
#define UDP_THREAD_PRIO 10 |
Definition at line 38 of file udp_arch.c.
Referenced by udp_thread().
void udp_arch_init | ( | void | ) |
Definition at line 44 of file udp_arch.c.
Referenced by mcu_init().
void udp_arch_periph_init | ( | struct udp_periph * | p, |
char * | host, | ||
int | port_out, | ||
int | port_in, | ||
bool_t | broadcast | ||
) |
Initialize the UDP peripheral.
Allocate UdpSocket struct and create and bind the UDP socket.
Definition at line 69 of file udp_arch.c.
Referenced by udp_periph_init().
uint16_t udp_char_available | ( | struct udp_periph * | p | ) |
Get number of bytes available in receive buffer.
p | pointer to UDP peripheral |
Definition at line 81 of file udp_arch.c.
Referenced by udp_periph_init(), and udp_receive().
uint8_t udp_getch | ( | struct udp_periph * | p | ) |
Get the last character from the receive buffer.
p | pointer to UDP peripheral |
Definition at line 97 of file udp_arch.c.
Referenced by udp_periph_init().
void udp_receive | ( | struct udp_periph * | p | ) |
Read bytes from UDP.
Definition at line 109 of file udp_arch.c.
Referenced by udp_thread().
void udp_send_message | ( | struct udp_periph * | p | ) |
Send a message.
Definition at line 142 of file udp_arch.c.
Referenced by udp_periph_init().
void udp_send_raw | ( | struct udp_periph * | p, |
uint8_t * | buffer, | ||
uint16_t | size | ||
) |
Send a packet from another buffer.
Definition at line 168 of file udp_arch.c.
|
static |
check for new udp packets to receive or send.
Definition at line 181 of file udp_arch.c.
References fd, get_rt_prio(), udp_receive(), and UDP_THREAD_PRIO.
Referenced by udp_arch_init().
|
static |
Definition at line 42 of file udp_arch.c.