Commit a32e5810 authored by julien.delange's avatar julien.delange
Browse files

* continue the linux driver implementation

* add information relevant for debug mode



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@563 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 9227d35f
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#ifndef __PO_HI_DEBUG_H__ #ifndef __PO_HI_DEBUG_H__
#include <po_hi_config.h>
#ifdef __PO_HI_DEBUG #ifdef __PO_HI_DEBUG
#include <stdio.h> #include <stdio.h>
#define __DEBUGMSG(s, args...) fprintf(stderr, s, ##args) #define __DEBUGMSG(s, args...) fprintf(stderr, s, ##args)
......
...@@ -28,14 +28,16 @@ int po_hi_c_driver_serial_fd; ...@@ -28,14 +28,16 @@ int po_hi_c_driver_serial_fd;
void __po_hi_c_driver_serial_linux_poller (void) void __po_hi_c_driver_serial_linux_poller (void)
{ {
__DEBUGMSG ("Hello, i'm the serial linux poller !\n"); __DEBUGMSG ("Hello, i'm the serial linux poller !\n");
} }
void __po_hi_c_driver_serial_linux_init (void) void __po_hi_c_driver_serial_linux_init (void)
{ {
__DEBUGMSG ("[LINUX SERIAL] Init\n"); struct termios oldtio,newtio;
struct termios oldtio,newtio;
__DEBUGMSG ("[LINUX SERIAL] Init\n");
po_hi_c_driver_serial_fd = open(__PO_HI_DRIVER_SERIAL_LINUX_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK); po_hi_c_driver_serial_fd = open(__PO_HI_DRIVER_SERIAL_LINUX_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
if (po_hi_c_driver_serial_fd < 0) if (po_hi_c_driver_serial_fd < 0)
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <po_hi_config.h> #include <po_hi_config.h>
#include <po_hi_returns.h> #include <po_hi_returns.h>
#include <po_hi_task.h> #include <po_hi_task.h>
#include <po_hi_debug.h>
#include <po_hi_protected.h> #include <po_hi_protected.h>
/* included files from PolyORB-HI-C */ /* included files from PolyORB-HI-C */
...@@ -28,6 +29,7 @@ int nb_tasks_to_init; ...@@ -28,6 +29,7 @@ int nb_tasks_to_init;
void __po_hi_initialize_add_task () void __po_hi_initialize_add_task ()
{ {
__DEBUGMSG ("[MAIN] Add a task to initialize\n");
nb_tasks_to_init++; nb_tasks_to_init++;
} }
...@@ -43,13 +45,14 @@ int __po_hi_initialize () ...@@ -43,13 +45,14 @@ int __po_hi_initialize ()
*/ */
nb_tasks_to_init = __PO_HI_NB_TASKS + 1; nb_tasks_to_init = __PO_HI_NB_TASKS + 1;
__DEBUGMSG ("[MAIN] Have %d tasks to init\n", nb_tasks_to_init);
initialized_tasks = 0; initialized_tasks = 0;
if (pthread_cond_init (&cond_init, if (pthread_cond_init (&cond_init, NULL) != 0)
NULL) != 0) {
{ return (__PO_HI_ERROR_PTHREAD_COND);
return (__PO_HI_ERROR_PTHREAD_COND); }
}
__po_hi_initialize_tasking (); __po_hi_initialize_tasking ();
...@@ -64,9 +67,14 @@ int __po_hi_initialize () ...@@ -64,9 +67,14 @@ int __po_hi_initialize ()
int __po_hi_wait_initialization () int __po_hi_wait_initialization ()
{ {
if (pthread_mutex_lock (&mutex_init) != 0) if (pthread_mutex_lock (&mutex_init) != 0)
{
return (__PO_HI_ERROR_PTHREAD_MUTEX); return (__PO_HI_ERROR_PTHREAD_MUTEX);
}
initialized_tasks++; initialized_tasks++;
__DEBUGMSG ("[MAIN] %d task(s) initialized\n", initialized_tasks);
while (initialized_tasks < nb_tasks_to_init) while (initialized_tasks < nb_tasks_to_init)
{ {
pthread_cond_wait (&cond_init, &mutex_init); pthread_cond_wait (&cond_init, &mutex_init);
......
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