Commit 35e0fc44 authored by julien.delange's avatar julien.delange
Browse files

* po-hi-c/include/drivers/po_hi_driver_linux_serial.h

   po-hi-c/src/drivers/po_hi_driver_linux_serial.c
   - Produce different init output for sender/receiver

 * po-hi-c/src/drivers/po_hi_driver_leon_serial.c
   - Continue debugging

 * po-hi-c/share/make/Makefile.common
   - Adress compilation error



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@2012 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 41cc58ab
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
* middleware written for generated code from AADL models. * middleware written for generated code from AADL models.
* You should use it with the Ocarina toolsuite. * You should use it with the Ocarina toolsuite.
* *
* Copyright (C) 2010, European Space Agency * For more informations, please visit http://ocarina.enst.fr
*
* Copyright (C) 2010-2011, European Space Agency (ESA).
*/ */
#include <deployment.h> #include <deployment.h>
...@@ -22,4 +24,3 @@ int __po_hi_c_driver_serial_linux_sender (__po_hi_task_id task, __po_hi_port_t ...@@ -22,4 +24,3 @@ int __po_hi_c_driver_serial_linux_sender (__po_hi_task_id task, __po_hi_port_t
#endif #endif
#endif #endif
/* #
* This is a part of PolyORB-HI-C distribution, a minimal # This is a part of PolyORB-HI-C distribution, a minimal
* middleware written for generated code from AADL models. # middleware written for generated code from AADL models.
* You should use it with the Ocarina toolsuite. # You should use it with the Ocarina toolsuite.
* #
* For more informations, please visit http://ocarina.enst.fr # For more informations, please visit http://ocarina.enst.fr
* #
* Copyright (C) 2011, European Space Agency (ESA). # Copyright (C) 2010-2011, European Space Agency (ESA).
*/ #
all-with-tweak: all: build-node
$(MAKE) all ENABLE_DYNAMIC_CONFIGURATION=1
include $(RUNTIME_PATH)/make/Makefile.$(TARGET) include $(RUNTIME_PATH)/make/Makefile.$(TARGET)
-include ../../userdefined.mk -include ../../userdefined.mk
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
* Copyright (C) 2011, European Space Agency (ESA). * Copyright (C) 2011, European Space Agency (ESA).
*/ */
#include <deployment.h>
#if defined (__PO_HI_NEED_DRIVER_SERIAL_LEON) || \ #if defined (__PO_HI_NEED_DRIVER_SERIAL_LEON) || \
defined (__PO_HI_NEED_DRIVER_SERIAL_LEON_SENDER) || \ defined (__PO_HI_NEED_DRIVER_SERIAL_LEON_SENDER) || \
...@@ -121,13 +122,13 @@ void __po_hi_c_driver_serial_leon_poller (void) ...@@ -121,13 +122,13 @@ void __po_hi_c_driver_serial_leon_poller (void)
#if defined (__PO_HI_NEED_DRIVER_SERIAL_LEON) || \ #if defined (__PO_HI_NEED_DRIVER_SERIAL_LEON) || \
defined (__PO_HI_NEED_DRIVER_SERIAL_LON_SENDER) defined (__PO_HI_NEED_DRIVER_SERIAL_LEON_SENDER)
void __po_hi_c_driver_serial_leon_init_sender (__po_hi_device_id id) void __po_hi_c_driver_serial_leon_init_sender (__po_hi_device_id id)
{ {
struct termios oldtio,newtio; struct termios oldtio,newtio;
__PO_HI_DEBUG_INFO ("[LEON SERIAL] Init\n"); __PO_HI_DEBUG_INFO ("[LEON SERIAL] Init sender\n");
po_hi_c_driver_leon_serial_fd_write = open( __po_hi_get_device_naming (id), O_RDWR | O_NOCTTY | O_NONBLOCK); po_hi_c_driver_leon_serial_fd_write = open( __po_hi_get_device_naming (id), O_RDWR | O_NOCTTY | O_NONBLOCK);
...@@ -137,7 +138,7 @@ void __po_hi_c_driver_serial_leon_init_sender (__po_hi_device_id id) ...@@ -137,7 +138,7 @@ void __po_hi_c_driver_serial_leon_init_sender (__po_hi_device_id id)
} }
else else
{ {
__PO_HI_DEBUG_DEBUG ("[LEON SERIAL] Device successfully opened, fd=%d\n", po_hi_c_driver_leon_serial_fd_write); __PO_HI_DEBUG_DEBUG ("[LEON SERIAL] Device %s successfully opened, fd=%d\n", __po_hi_get_device_naming (id), po_hi_c_driver_leon_serial_fd_write);
} }
tcgetattr (po_hi_c_driver_leon_serial_fd_write, &oldtio); /* save current serial port settings */ tcgetattr (po_hi_c_driver_leon_serial_fd_write, &oldtio); /* save current serial port settings */
...@@ -152,15 +153,15 @@ void __po_hi_c_driver_serial_leon_init_sender (__po_hi_device_id id) ...@@ -152,15 +153,15 @@ void __po_hi_c_driver_serial_leon_init_sender (__po_hi_device_id id)
* CREAD : enable receiving characters * CREAD : enable receiving characters
*/ */
newtio.c_cflag = __PO_HI_DRIVER_SERIAL_LEON_BAUDRATE | CRTSCTS | CS8 | CLOCAL | CREAD; newtio.c_cflag = __PO_HI_DRIVER_SERIAL_LEON_BAUDRATE;
/*| CRTSCTS | CS8 | CLOCAL;
/*
* IGNPAR : ignore bytes with parity errors * IGNPAR : ignore bytes with parity errors
* ICRNL : map CR to NL (otherwise a CR input on the other computer * ICRNL : map CR to NL (otherwise a CR input on the other computer
* will not terminate input) otherwise make device raw * will not terminate input) otherwise make device raw
* (no other input processing) * (no other input processing)
*/
newtio.c_iflag = IGNPAR | ICRNL; newtio.c_iflag = IGNPAR | ICRNL;
*/
/* /*
* Raw output. * Raw output.
...@@ -170,31 +171,13 @@ void __po_hi_c_driver_serial_leon_init_sender (__po_hi_device_id id) ...@@ -170,31 +171,13 @@ void __po_hi_c_driver_serial_leon_init_sender (__po_hi_device_id id)
/* /*
* ICANON : enable canonical input * ICANON : enable canonical input
* disable all echo functionality, and don't send signals to calling program * disable all echo functionality, and don't send signals to calling program
*/
newtio.c_lflag = ICANON; newtio.c_lflag = ICANON;
/*
* Initialize all control characters
* default values can be found in /usr/include/termios.h, and are given
* in the comments, but we don't need them here.
*/ */
newtio.c_cc[VINTR] = 0; /* Ctrl-c */
newtio.c_cc[VQUIT] = 0; /* Ctrl-\ */ if (tcsetattr (po_hi_c_driver_leon_serial_fd_write, TCSANOW, &newtio) == -1)
newtio.c_cc[VERASE] = 0; /* del */ {
newtio.c_cc[VKILL] = 0; /* @ */ __PO_HI_DEBUG_CRITICAL ("[LEON SERIAL] Error in tcsetattr()\n");
newtio.c_cc[VEOF] = 4; /* Ctrl-d */ }
newtio.c_cc[VTIME] = 0; /* inter-character timer unused */
newtio.c_cc[VMIN] = 1; /* blocking read until 1 character arrives */
newtio.c_cc[VSWTC] = 0; /* '\0' */
newtio.c_cc[VSTART] = 0; /* Ctrl-q */
newtio.c_cc[VSTOP] = 0; /* Ctrl-s */
newtio.c_cc[VSUSP] = 0; /* Ctrl-z */
newtio.c_cc[VEOL] = 0; /* '\0' */
newtio.c_cc[VREPRINT] = 0; /* Ctrl-r */
newtio.c_cc[VDISCARD] = 0; /* Ctrl-u */
newtio.c_cc[VWERASE] = 0; /* Ctrl-w */
newtio.c_cc[VLNEXT] = 0; /* Ctrl-v */
newtio.c_cc[VEOL2] = 0; /* '\0' */
/* /*
* clean the serial line and activate the settings for the port * clean the serial line and activate the settings for the port
...@@ -204,10 +187,6 @@ void __po_hi_c_driver_serial_leon_init_sender (__po_hi_device_id id) ...@@ -204,10 +187,6 @@ void __po_hi_c_driver_serial_leon_init_sender (__po_hi_device_id id)
__PO_HI_DEBUG_CRITICAL ("[LEON SERIAL] Error in tcflush()\n"); __PO_HI_DEBUG_CRITICAL ("[LEON SERIAL] Error in tcflush()\n");
} }
if (tcsetattr (po_hi_c_driver_leon_serial_fd_write, TCSANOW, &newtio) == -1)
{
__PO_HI_DEBUG_CRITICAL ("[LEON SERIAL] Error in tcsetattr()\n");
}
__PO_HI_DEBUG_INFO ("[LEON SERIAL] End of init\n"); __PO_HI_DEBUG_INFO ("[LEON SERIAL] End of init\n");
} }
...@@ -220,7 +199,7 @@ void __po_hi_c_driver_serial_leon_init_receiver (__po_hi_device_id id) ...@@ -220,7 +199,7 @@ void __po_hi_c_driver_serial_leon_init_receiver (__po_hi_device_id id)
{ {
struct termios oldtio,newtio; struct termios oldtio,newtio;
__PO_HI_DEBUG_INFO ("[LEON SERIAL] Init\n"); __PO_HI_DEBUG_INFO ("[LEON SERIAL] Init receiver\n");
po_hi_c_driver_leon_serial_fd_read = open( __po_hi_get_device_naming (id), O_RDONLY | O_NOCTTY); po_hi_c_driver_leon_serial_fd_read = open( __po_hi_get_device_naming (id), O_RDONLY | O_NOCTTY);
...@@ -296,7 +275,7 @@ void __po_hi_c_driver_serial_leon_init (__po_hi_device_id id) ...@@ -296,7 +275,7 @@ void __po_hi_c_driver_serial_leon_init (__po_hi_device_id id)
{ {
struct termios oldtio,newtio; struct termios oldtio,newtio;
__PO_HI_DEBUG_INFO ("[LEON SERIAL] Init\n"); __PO_HI_DEBUG_INFO ("[LEON SERIAL] Init both sender and receiver\n");
po_hi_c_driver_leon_serial_fd_read = po_hi_c_driver_leon_serial_fd_write = open( __po_hi_get_device_naming (id), O_RDWR | O_NOCTTY | O_NONBLOCK); po_hi_c_driver_leon_serial_fd_read = po_hi_c_driver_leon_serial_fd_write = open( __po_hi_get_device_naming (id), O_RDWR | O_NOCTTY | O_NONBLOCK);
......
...@@ -125,7 +125,7 @@ void __po_hi_c_driver_serial_linux_init_sender (__po_hi_device_id id) ...@@ -125,7 +125,7 @@ void __po_hi_c_driver_serial_linux_init_sender (__po_hi_device_id id)
{ {
struct termios oldtio,newtio; struct termios oldtio,newtio;
__PO_HI_DEBUG_INFO ("[LINUX SERIAL] Init\n"); __PO_HI_DEBUG_INFO ("[LINUX SERIAL] Init sender\n");
po_hi_c_driver_serial_fd_write = open( __po_hi_get_device_naming (id), O_RDWR | O_NOCTTY | O_NONBLOCK); po_hi_c_driver_serial_fd_write = open( __po_hi_get_device_naming (id), O_RDWR | O_NOCTTY | O_NONBLOCK);
...@@ -218,7 +218,7 @@ void __po_hi_c_driver_serial_linux_init_receiver (__po_hi_device_id id) ...@@ -218,7 +218,7 @@ void __po_hi_c_driver_serial_linux_init_receiver (__po_hi_device_id id)
{ {
struct termios oldtio,newtio; struct termios oldtio,newtio;
__PO_HI_DEBUG_INFO ("[LINUX SERIAL] Init\n"); __PO_HI_DEBUG_INFO ("[LINUX SERIAL] Init receiver\n");
po_hi_c_driver_serial_fd_read = open( __po_hi_get_device_naming (id), O_RDONLY | O_NOCTTY); po_hi_c_driver_serial_fd_read = open( __po_hi_get_device_naming (id), O_RDONLY | O_NOCTTY);
...@@ -294,7 +294,7 @@ void __po_hi_c_driver_serial_linux_init (__po_hi_device_id id) ...@@ -294,7 +294,7 @@ void __po_hi_c_driver_serial_linux_init (__po_hi_device_id id)
{ {
struct termios oldtio,newtio; struct termios oldtio,newtio;
__PO_HI_DEBUG_INFO ("[LINUX SERIAL] Init\n"); __PO_HI_DEBUG_INFO ("[LINUX SERIAL] Init both sender and receiver\n");
po_hi_c_driver_serial_fd_read = po_hi_c_driver_serial_fd_write = open( __po_hi_get_device_naming (id), O_RDWR | O_NOCTTY | O_NONBLOCK); po_hi_c_driver_serial_fd_read = po_hi_c_driver_serial_fd_write = open( __po_hi_get_device_naming (id), O_RDWR | O_NOCTTY | O_NONBLOCK);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment