Commit e6147b38 authored by yoogx's avatar yoogx

* Add missing include for po_hi_protectd.h

parent e4c361e9
......@@ -21,6 +21,8 @@
#include <po_hi_messages.h>
#include <po_hi_transport.h>
#include <po_hi_gqueue.h>
#include <po_hi_protected.h>
#include <drivers/po_hi_driver_serial_common.h>
/* po-hi-c related files */
......@@ -58,7 +60,7 @@ void __po_hi_c_driver_serial_linux_poller (const __po_hi_device_id dev_id)
unsigned long swap_value;
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Hello, i'm the serial poller , must read %d bytes!\n",
__PO_HI_MESSAGES_MAX_SIZE);
__PO_HI_MESSAGES_MAX_SIZE);
__po_hi_msg_reallocate (&__po_hi_c_driver_serial_linux_poller_msg);
......@@ -67,12 +69,12 @@ void __po_hi_c_driver_serial_linux_poller (const __po_hi_device_id dev_id)
while (n < __PO_HI_MESSAGES_MAX_SIZE)
{
if (read (po_hi_c_driver_serial_fd_read, &(__po_hi_c_driver_serial_linux_poller_msg.content[n]), 1) != 1)
{
__PO_HI_DEBUG_CRITICAL ("[LINUX SERIAL] Cannot read !\n");
return;
}
{
__PO_HI_DEBUG_CRITICAL ("[LINUX SERIAL] Cannot read !\n");
return;
}
n++;
n++;
}
......@@ -106,7 +108,7 @@ void __po_hi_c_driver_serial_linux_poller (const __po_hi_device_id dev_id)
if (__po_hi_c_driver_serial_linux_request.port > __PO_HI_NB_PORTS)
{
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Invalid port number %d !\n",
__po_hi_c_driver_serial_linux_request.port);
__po_hi_c_driver_serial_linux_request.port);
return;
}
......@@ -158,7 +160,7 @@ void __po_hi_c_driver_serial_linux_init_sender (__po_hi_device_id id)
tcgetattr (po_hi_c_driver_serial_fd_write, &oldtio); /* save current serial port settings */
tcgetattr (po_hi_c_driver_serial_fd_write, &newtio); /* save current serial port settings */
newtio.c_cflag |= CREAD ;
newtio.c_iflag = IGNPAR | IGNBRK;
newtio.c_lflag |= ICANON;
......@@ -193,7 +195,7 @@ void __po_hi_c_driver_serial_linux_init_sender (__po_hi_device_id id)
break;
}
/*
/*
* clean the serial line and activate the settings for the port
*/
if (tcflush (po_hi_c_driver_serial_fd_write, TCIOFLUSH) == -1)
......@@ -242,7 +244,7 @@ void __po_hi_c_driver_serial_linux_init_receiver (__po_hi_device_id id)
tcgetattr (po_hi_c_driver_serial_fd_read, &oldtio); /* save current serial port settings */
tcgetattr (po_hi_c_driver_serial_fd_read, &newtio); /* save current serial port settings */
newtio.c_cflag |= CREAD ;
newtio.c_iflag = IGNPAR | IGNBRK;
newtio.c_lflag |= ICANON;
......@@ -352,9 +354,9 @@ int __po_hi_c_driver_serial_linux_sender (__po_hi_task_id task_id, __po_hi_port
fsync(po_hi_c_driver_serial_fd_write);
if (n <= 0)
{
__PO_HI_DEBUG_DEBUG (" [LINUX SERIAL] failed to write !\n");
}
{
__PO_HI_DEBUG_DEBUG (" [LINUX SERIAL] failed to write !\n");
}
}
}
......@@ -365,17 +367,17 @@ int __po_hi_c_driver_serial_linux_sender (__po_hi_task_id task_id, __po_hi_port
fsync(po_hi_c_driver_serial_fd_write);
if (n < 0)
{
__PO_HI_DEBUG_CRITICAL (" [LINUX SERIAL] failed !\n");
}
{
__PO_HI_DEBUG_CRITICAL (" [LINUX SERIAL] failed !\n");
}
else if((0 <= n)&(n < __PO_HI_MESSAGES_MAX_SIZE))
{
__PO_HI_DEBUG_CRITICAL (" [LINUX SERIAL] Unable write !\n");
}
{
__PO_HI_DEBUG_CRITICAL (" [LINUX SERIAL] Unable write !\n");
}
else
{
__PO_HI_DEBUG_DEBUG (" [LINUX SERIAL] OK !\n");
}
{
__PO_HI_DEBUG_DEBUG (" [LINUX SERIAL] OK !\n");
}
}
......
......@@ -18,7 +18,9 @@
#include <po_hi_transport.h>
#include <po_hi_gqueue.h>
#include <po_hi_messages.h>
#include <po_hi_protected.h>
#include <po_hi_returns.h>
#include <po_hi_utils.h>
#include <drivers/po_hi_rtems_utils.h>
......@@ -66,10 +68,10 @@ void __po_hi_c_driver_rtems_drvmgr_serial_poller (const __po_hi_device_id dev_id
while (ts > 0) {
__PO_HI_DEBUG_DEBUG
("[DRVMGR SERIAL] Poller waits for incoming message (%d bytes are required)!\n", ts);
n = read (po_hi_c_driver_rtems_drvmgr_serial_fd_read[dev_id], ptr, ts);
n = read (po_hi_c_driver_rtems_drvmgr_serial_fd_read[dev_id], ptr, ts);
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] read() %d returns %d!\n",
po_hi_c_driver_rtems_drvmgr_serial_fd_read[dev_id], n);
po_hi_c_driver_rtems_drvmgr_serial_fd_read[dev_id], n);
if (n == -1) {
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] Cannot read on socket !\n");
return;
......@@ -80,13 +82,13 @@ void __po_hi_c_driver_rtems_drvmgr_serial_poller (const __po_hi_device_id dev_id
}
__po_hi_c_driver_rtems_drvmgr_serial_poller_msg.length = __PO_HI_MESSAGES_MAX_SIZE;
__po_hi_unmarshall_request (&__po_hi_c_driver_rtems_drvmgr_serial_request,
&__po_hi_c_driver_rtems_drvmgr_serial_poller_msg);
if (__po_hi_c_driver_rtems_drvmgr_serial_request.port > __PO_HI_NB_PORTS) {
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] Invalid port number (%d), will not deliver",
__po_hi_c_driver_rtems_drvmgr_serial_request.port);
__po_hi_c_driver_rtems_drvmgr_serial_request.port);
}
__po_hi_main_deliver (&__po_hi_c_driver_rtems_drvmgr_serial_request);
}
......@@ -98,7 +100,7 @@ __po_hi_msg_t __po_hi_c_driver_rtems_drvmgr_serial_sender_msg;
* \brief Function related to the RTEMS DRVMGR SERIAL serial driver - sender function.
*
* This function implements the sender function to send bytes through the serial line using
* the RTEMS DRVMGR SERIAL device.
* the RTEMS DRVMGR SERIAL device.
* There are the description of the arguments used by the function:
* - task_id: task that actually sends the data (emitter/producer task)
* - port : (global) port that contains the data
......@@ -124,14 +126,14 @@ int __po_hi_c_driver_rtems_drvmgr_serial_sender (const __po_hi_task_id task_id,
}
local_port = __po_hi_get_local_port_from_global_port (port);
request = __po_hi_gqueue_get_most_recent_value (task_id, local_port);
if (request->port == -1)
{
__PO_HI_DEBUG_DEBUG
("[DRVMGR SERIAL] Send output task %d, port %d (local_port=%d): no value to send\n",
task_id, port, local_port);
("[DRVMGR SERIAL] Send output task %d, port %d (local_port=%d): no value to send\n",
task_id, port, local_port);
return __PO_HI_SUCCESS;
}
......@@ -146,12 +148,12 @@ int __po_hi_c_driver_rtems_drvmgr_serial_sender (const __po_hi_task_id task_id,
("[DRVMGR SERIAL] Destination port= %d, msg size %d send through device %d (fd=%d)\n",
destination_port,
__po_hi_c_driver_rtems_drvmgr_serial_sender_msg.length,
dev_id, po_hi_c_driver_rtems_drvmgr_serial_fd_write[dev_id]);
dev_id, po_hi_c_driver_rtems_drvmgr_serial_fd_write[dev_id]);
n = write (po_hi_c_driver_rtems_drvmgr_serial_fd_write[dev_id],
&__po_hi_c_driver_rtems_drvmgr_serial_sender_msg,
__PO_HI_MESSAGES_MAX_SIZE);
&__po_hi_c_driver_rtems_drvmgr_serial_sender_msg,
__PO_HI_MESSAGES_MAX_SIZE);
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] write() returns %d\n", n);
__po_hi_mutex_unlock (&__po_hi_c_rtems_serial_send_mutex);
request->port = __PO_HI_GQUEUE_INVALID_PORT;
......@@ -165,7 +167,7 @@ int __po_hi_c_driver_rtems_drvmgr_serial_sender (const __po_hi_task_id task_id,
*
* This function is used to initialize the device driver connected to the
* serial interface to a RTEMS DRVMGR SERIAL board. It uses the configuration properties
* from its associated configuration parameters (using the
* from its associated configuration parameters (using the
* __po_hi_get_device_configuration function).
*/
......@@ -179,7 +181,7 @@ void __po_hi_c_driver_rtems_drvmgr_serial_init (__po_hi_device_id id)
/* Initializes drvmgr subsystem */
__po_hi_c_driver_drvmgr_init ();
serialconf = (__po_hi_c_serial_conf_t*)__po_hi_get_device_configuration (id);
if (serialconf == NULL) {
......@@ -188,33 +190,33 @@ void __po_hi_c_driver_rtems_drvmgr_serial_init (__po_hi_device_id id)
}
__po_hi_mutex_init (&__po_hi_c_rtems_serial_send_mutex,__PO_HI_MUTEX_REGULAR, 0);
__po_hi_transport_set_sending_func (id, __po_hi_c_driver_rtems_drvmgr_serial_sender);
/* provide the spacewire driver with AMBA Plug&Play
* info so that it can find the GRSPW cores.
*/
__PO_HI_DEBUG_INFO ("[DRVMGR SERIAL] Initialization starts !\n");
po_hi_c_driver_rtems_drvmgr_serial_fd_write[id] =
po_hi_c_driver_rtems_drvmgr_serial_fd_write[id] =
po_hi_c_driver_rtems_drvmgr_serial_fd_read[id] = open (serialconf->devname, O_RDWR);
if (po_hi_c_driver_rtems_drvmgr_serial_fd_read[id] < 0) {
__PO_HI_DEBUG_CRITICAL ("[DRVMGR SERIAL] Error while opening device %s for reading\n",
serialconf->devname);
serialconf->devname);
}
if (po_hi_c_driver_rtems_drvmgr_serial_fd_write[id] < 0) {
__PO_HI_DEBUG_CRITICAL ("[DRVMGR SERIAL] Error while opening device %s for writing\n",
serialconf->devname);
serialconf->devname);
}
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] Device opened for read (%s), fd=%d\n",
serialconf->devname , po_hi_c_driver_rtems_drvmgr_serial_fd_read[id]);
serialconf->devname , po_hi_c_driver_rtems_drvmgr_serial_fd_read[id]);
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] Device opened for write (%s), fd=%d\n",
serialconf->devname , po_hi_c_driver_rtems_drvmgr_serial_fd_write[id]);
serialconf->devname , po_hi_c_driver_rtems_drvmgr_serial_fd_write[id]);
tcgetattr (po_hi_c_driver_rtems_drvmgr_serial_fd_read[id], &oldtio); /* save current serial port settings */
tcgetattr (po_hi_c_driver_rtems_drvmgr_serial_fd_read[id], &newtio); /* save current serial port settings */
newtio.c_cflag |= CREAD ;
newtio.c_iflag = IGNPAR | IGNBRK;
newtio.c_lflag |= ICANON;
......@@ -228,27 +230,27 @@ void __po_hi_c_driver_rtems_drvmgr_serial_init (__po_hi_device_id id)
newtio.c_cflag |= B19200;
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Set speed to 19200\n");
break;
case __PO_HI_DRIVER_SERIAL_COMMON_SPEED_38400:
newtio.c_cflag |= B38400;
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Set speed to 38400\n");
break;
case __PO_HI_DRIVER_SERIAL_COMMON_SPEED_57600:
newtio.c_cflag |= B57600;
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Set speed to 57600\n");
break;
case __PO_HI_DRIVER_SERIAL_COMMON_SPEED_115200:
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Set speed to 115200\n");
newtio.c_cflag |= B115200;
break;
case __PO_HI_DRIVER_SERIAL_COMMON_SPEED_UNKNWON:
__PO_HI_DEBUG_INFO ("[LINUX SERIAL] Unknwon speed for the serial line\n");
break;
__PO_HI_DEBUG_INFO ("[LINUX SERIAL] Unknwon speed for the serial line\n");
break;
}
max_size = 1024;
#ifdef __PO_HI_MESSAGES_MAX_SIZE
max_size = 4 * __PO_HI_MESSAGES_MAX_SIZE;
......@@ -257,10 +259,10 @@ void __po_hi_c_driver_rtems_drvmgr_serial_init (__po_hi_device_id id)
if (tcflush (po_hi_c_driver_rtems_drvmgr_serial_fd_read[id], TCIOFLUSH) != 0) {
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] Error when trying to flush read part\n");
}
if (tcflush (po_hi_c_driver_rtems_drvmgr_serial_fd_write[id], TCIOFLUSH) != 0) {
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] Error when trying to flush write part\n");
}
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] Initialization complete !\n");
}
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