[omap] rename/move FmsSerialPort to SerialPort in arch/omap

This commit is contained in:
Felix Ruess
2013-08-22 13:38:10 +02:00
parent 0d57fea8c2
commit a2d33c7cab
6 changed files with 33 additions and 44 deletions
+3 -14
View File
@@ -108,6 +108,9 @@ ap.srcs += $(SRC_ARCH)/subsystems/settings_arch.c
ap.srcs += mcu_periph/uart.c
ap.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
ifeq ($(ARCH), omap)
ap.srcs += $(SRC_ARCH)/serial_port.c
endif
# I2C is needed for speed controllers and barometers on lisa
ifeq ($(TARGET), ap)
@@ -291,17 +294,3 @@ ap.srcs += $(SRC_FIRMWARE)/guidance/guidance_v_adapt.c
ap.srcs += $(SRC_FIRMWARE)/navigation.c
ap.srcs += subsystems/navigation/common_flight_plan.c
#
# FMS choice
#
# include booz2_fms_test_signal.makefile
# or
# include booz2_fms_datalink.makefile
# or
# nothing
#
ifeq ($(ARCH), omap)
SRC_FMS=fms
ap.CFLAGS += -I. -I$(SRC_FMS)
ap.srcs += $(SRC_FMS)/fms_serial_port.c
endif
+5 -5
View File
@@ -34,7 +34,7 @@
// FIXME: fms_serial_port includes termios.h that with omap defines B9600 as 12
// Include termios.h AFTER uart.h. This OVERWRITES (without warning) the paparazzi uart.h B9600
#include "fms/fms_serial_port.h"
#include "serial_port.h"
// #define TRACE(fmt,args...) fprintf(stderr, fmt, args)
#define TRACE(fmt,args...)
@@ -59,10 +59,10 @@ speed_t baudconvert_drone(uint32_t baud)
void uart_periph_set_baudrate(struct uart_periph* p, uint32_t baud) {
struct FmsSerialPort* fmssp;
struct SerialPort* fmssp;
// close serial port if already open
if (p->reg_addr != NULL) {
fmssp = (struct FmsSerialPort*)(p->reg_addr);
fmssp = (struct SerialPort*)(p->reg_addr);
serial_port_close(fmssp);
serial_port_free(fmssp);
}
@@ -94,7 +94,7 @@ void uart_transmit(struct uart_periph* p, uint8_t data ) {
}
else { // no, set running flag and write to output register
p->tx_running = TRUE;
struct FmsSerialPort* fmssp = (struct FmsSerialPort*)(p->reg_addr);
struct SerialPort* fmssp = (struct SerialPort*)(p->reg_addr);
int ret = write((int)(fmssp->fd),&data,1);
if (ret < 1)
{
@@ -110,7 +110,7 @@ static inline void uart_handler(struct uart_periph* p) {
if (p->reg_addr == NULL) return; // device not initialized ?
struct FmsSerialPort* fmssp = (struct FmsSerialPort*)(p->reg_addr);
struct SerialPort* fmssp = (struct SerialPort*)(p->reg_addr);
int fd = fmssp->fd;
// check if more data to send
@@ -1,4 +1,4 @@
#include "fms_serial_port.h"
#include "serial_port.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -13,17 +13,17 @@
#define TRACE(type,fmt,args...)
#define TRACE_ERROR 1
struct FmsSerialPort* serial_port_new(void) {
struct FmsSerialPort* me = malloc(sizeof(struct FmsSerialPort));
struct SerialPort* serial_port_new(void) {
struct SerialPort* me = malloc(sizeof(struct SerialPort));
return me;
}
void serial_port_free(struct FmsSerialPort* me) {
void serial_port_free(struct SerialPort* me) {
free(me);
}
void serial_port_flush(struct FmsSerialPort* me) {
void serial_port_flush(struct SerialPort* me) {
/*
* flush any input that might be on the port so we start fresh.
*/
@@ -33,7 +33,7 @@ void serial_port_flush(struct FmsSerialPort* me) {
}
}
void serial_port_flush_output(struct FmsSerialPort* me) {
void serial_port_flush_output(struct SerialPort* me) {
/*
* flush any input that might be on the port so we start fresh.
*/
@@ -43,7 +43,7 @@ void serial_port_flush_output(struct FmsSerialPort* me) {
}
}
int serial_port_open_raw(struct FmsSerialPort* me, const char* device, speed_t speed) {
int serial_port_open_raw(struct SerialPort* me, const char* device, speed_t speed) {
if ((me->fd = open(device, O_RDWR | O_NONBLOCK | O_NOCTTY)) < 0) {
TRACE(TRACE_ERROR,"%s, open failed: %s (%d)\n", device, strerror(errno), errno);
return -1;
@@ -78,7 +78,7 @@ int serial_port_open_raw(struct FmsSerialPort* me, const char* device, speed_t
return 0;
}
int serial_port_open(struct FmsSerialPort* me, const char* device,
int serial_port_open(struct SerialPort* me, const char* device,
void(*term_conf_callback)(struct termios*, speed_t*)) {
speed_t speed;
@@ -108,7 +108,7 @@ int serial_port_open(struct FmsSerialPort* me, const char* device,
}
void serial_port_close(struct FmsSerialPort* me) {
void serial_port_close(struct SerialPort* me) {
/* if null pointer or file descriptor indicates error just bail */
if (!me || me->fd < 0)
@@ -20,24 +20,24 @@
*
*/
#ifndef FMS_SERIAL_PORT_H
#define FMS_SERIAL_PORT_H
#ifndef SERIAL_PORT_H
#define SERIAL_PORT_H
#include <termios.h>
struct FmsSerialPort {
struct SerialPort {
int fd; /* serial device fd */
struct termios orig_termios; /* saved tty state structure */
struct termios cur_termios; /* tty state structure */
};
extern struct FmsSerialPort* serial_port_new(void);
extern void serial_port_free(struct FmsSerialPort* me);
extern void serial_port_flush(struct FmsSerialPort* me);
extern void serial_port_flush_output(struct FmsSerialPort* me);
extern int serial_port_open_raw(struct FmsSerialPort* me, const char* device, speed_t speed);
extern int serial_port_open(struct FmsSerialPort* me, const char* device,
extern struct SerialPort* serial_port_new(void);
extern void serial_port_free(struct SerialPort* me);
extern void serial_port_flush(struct SerialPort* me);
extern void serial_port_flush_output(struct SerialPort* me);
extern int serial_port_open_raw(struct SerialPort* me, const char* device, speed_t speed);
extern int serial_port_open(struct SerialPort* me, const char* device,
void(*term_conf_callback)(struct termios*, speed_t*));
extern void serial_port_close(struct FmsSerialPort* me);
extern void serial_port_close(struct SerialPort* me);
#endif /* FMS_SERIAL_PORT_H */
#endif /* SERIAL_PORT_H */
+2 -2
View File
@@ -37,7 +37,7 @@
#include "fms_periodic.h"
#include "fms_debug.h"
#include "fms_serial_port.h"
#include "serial_port.h"
#include "overo_gcs_com.h"
#include "uart_hw.h"
@@ -57,7 +57,7 @@ void check_gps(void);
uint8_t nav_utm_zone0 = 31;
static uint16_t foo = 0;
//struct FmsSerialPort* fmssp;
//struct SerialPort* fmssp;
//int spfd;
uint8_t portnum;
#ifdef GPS_CONFIGURE
+3 -3
View File
@@ -27,7 +27,7 @@
#include <stdlib.h>
#include <string.h>
#include "fms_serial_port.h"
#include "serial_port.h"
#ifdef USE_UART0
@@ -39,7 +39,7 @@ volatile uint16_t uart0_tx_insert_idx, uart0_tx_extract_idx;
volatile bool_t uart0_tx_running;
uint8_t uart0_tx_buffer[UART0_TX_BUFFER_SIZE];
struct FmsSerialPort* fmssp0;
struct SerialPort* fmssp0;
int uart0_fd;
extern uint8_t portnum;
@@ -165,7 +165,7 @@ volatile uint16_t uart1_tx_insert_idx, uart1_tx_extract_idx;
volatile bool_t uart1_tx_running;
uint8_t uart1_tx_buffer[UART1_TX_BUFFER_SIZE];
struct FmsSerialPort* fmssp1;
struct SerialPort* fmssp1;
int uart1_fd;
void uart1_init( void ) {