*** empty log message ***

This commit is contained in:
Antoine Drouin
2009-03-23 19:07:36 +00:00
parent 4f80e883e0
commit 6c70b98aec
4 changed files with 33 additions and 13 deletions
+13 -5
View File
@@ -140,17 +140,25 @@ test_usb.ARCH = arm7tdmi
test_usb.TARGET = test_usb
test_usb.TARGETDIR = test_usb
test_usb.CFLAGS += -DCONFIG=$(BOARD_CFG) $(BOOZ_CFLAGS)
test_usb.CFLAGS += -DCONFIG=\"booz2_board_usb.h\" $(BOOZ_CFLAGS)
test_usb.srcs += $(SRC_BOOZ_TEST)/booz2_test_usb.c
test_usb.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./512.))' -DTIME_LED=1
test_usb.CFLAGS += -DLED
test_usb.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c
test_usb.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600
test_usb.srcs += $(SRC_ARCH)/uart_hw.c
#test_usb.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600
#test_usb.srcs += $(SRC_ARCH)/uart_hw.c
#test_usb.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart1
#test_usb.srcs += downlink.c pprz_transport.c
test_usb.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DUSE_USB_SERIAL
test_usb.CFLAGS += -DDOWNLINK_DEVICE=UsbS -DPPRZ_UART=UsbS -DDATALINK=PPRZ
test_usb.srcs += downlink.c $(SRC_ARCH)/uart_hw.c $(SRC_ARCH)/usb_ser_hw.c pprz_transport.c
# datalink.c
test_usb.srcs += $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbcontrol.c
test_usb.srcs += $(SRC_ARCH)/lpcusb/usbstdreq.c $(SRC_ARCH)/lpcusb/usbinit.c
test_usb.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart1
test_usb.srcs += downlink.c pprz_transport.c
+1 -1
View File
@@ -1,5 +1,5 @@
CFLAGS = -Wall `pkg-config --cflags glib-2.0`
CFLAGS = -Wall `pkg-config --cflags glib-2.0` -g
LDFLAGS = `pkg-config --libs glib-2.0`
fms: fms_main.c fms_ap_link.c fms_serial_port.c fms_gs_link.c fms_network.c
+2 -2
View File
@@ -11,7 +11,7 @@ struct FmsApLink* ap_link_new(const char* device) {
struct FmsApLink* me = malloc(sizeof(struct FmsApLink));
me->sp = serial_port_new();
if (!serial_port_open(me->sp, device, configure_term)) {
if (serial_port_open(me->sp, device, configure_term)) {
ap_link_free(me);
return NULL;
}
@@ -33,7 +33,7 @@ void ap_link_free(struct FmsApLink* me) {
void ap_link_parse(struct FmsApLink* me, int nb_bytes) {
printf("got %d bytes\n", nb_bytes);
}
+17 -5
View File
@@ -1,7 +1,9 @@
#include <glib.h>
#define AP_DEVICE "/dev/ttyUSB0"
#include <stdio.h>
#define AP_DEVICE "/dev/ttyACM0"
#define GS_IP "192.168.1.8"
#define GS_PORT 2442
@@ -25,6 +27,12 @@ static gboolean on_ap_link_data_received(GIOChannel *source,
gsize bytes_read;
GError* _err = NULL;
GIOStatus st = g_io_channel_read_chars(source, ap_link->buf, AP_LINK_BUF_SIZE, &bytes_read, &_err);
printf("in on_ap_link_data_received %d %d\n", st, _err);
if (_err != NULL) {
fprintf (stderr, "error reading serial: %s\n", _err->message);
g_error_free (_err);
}
if (st == G_IO_STATUS_NORMAL) {
ap_link_parse(ap_link, bytes_read);
}
@@ -42,14 +50,18 @@ int main(int argc, char** argv) {
struct FmsApLink* ap_link;
struct FmsGsLink* gs_link;
ap_link = ap_link_new(AP_DEVICE);
if (!ap_link) {
printf("error opening serial port %s\n", AP_DEVICE);
return -1;
}
GIOChannel* ioc1 = g_io_channel_unix_new(ap_link->sp->fd);
g_io_channel_set_encoding(ioc1, NULL, NULL);
g_io_add_watch (ioc1, G_IO_IN, on_ap_link_data_received, ap_link);
gs_link = gs_link_new(GS_IP, GS_PORT);
GIOChannel* ioc2 = g_io_channel_unix_new(gs_link->network->fd);
g_io_add_watch (ioc2, G_IO_IN, on_gs_link_data_received, ap_link);
// gs_link = gs_link_new(GS_IP, GS_PORT);
// GIOChannel* ioc2 = g_io_channel_unix_new(gs_link->network->fd);
// g_io_add_watch (ioc2, G_IO_IN, on_gs_link_data_received, ap_link);
GMainLoop* ml = g_main_loop_new(NULL, FALSE);
g_main_loop_run(ml);