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

* define sender function for device drivers



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@559 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 77b4cec8
...@@ -17,6 +17,8 @@ void __po_hi_c_driver_serial_linux_poller (void); ...@@ -17,6 +17,8 @@ void __po_hi_c_driver_serial_linux_poller (void);
void __po_hi_c_driver_serial_linux_init (void); void __po_hi_c_driver_serial_linux_init (void);
int __po_hi_c_driver_serial_linux_sender (__po_hi_task_id task, __po_hi_port_t port);
#endif #endif
#endif #endif
......
...@@ -17,6 +17,8 @@ void __po_hi_c_driver_serial_rasta_poller (void); ...@@ -17,6 +17,8 @@ void __po_hi_c_driver_serial_rasta_poller (void);
void __po_hi_c_driver_serial_rasta_init (void); void __po_hi_c_driver_serial_rasta_init (void);
int __po_hi_c_driver_serial_rasta_sender (const __po_hi_task_id task_id, const __po_hi_port_t port);
#endif #endif
#endif #endif
......
...@@ -167,6 +167,7 @@ endif ...@@ -167,6 +167,7 @@ endif
clean: target-clean clean: target-clean
@-rm -f *~ *.o *.al temp.* *.metrix $(BINARY) $(BINARY).bin $(BINARY).bt $(BINARY).num $(BINARY).nxe @-rm -f *~ *.o *.al temp.* *.metrix $(BINARY) $(BINARY).bin $(BINARY).bt $(BINARY).num $(BINARY).nxe
@-rm -rf drivers
if test ! "$(CLEANDIRS)" = ""; then \ if test ! "$(CLEANDIRS)" = ""; then \
rm -rf $(CLEANDIRS); \ rm -rf $(CLEANDIRS); \
fi fi
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <drivers/po_hi_driver_linux_serial.h> #include <drivers/po_hi_driver_linux_serial.h>
#ifdef __PO_HI_NEED_SERIAL_LINUX #ifdef __PO_HI_NEED_DRIVER_SERIAL_LINUX
#include <stdio.h> #include <stdio.h>
...@@ -20,7 +20,12 @@ void __po_hi_c_driver_serial_linux_poller (void) ...@@ -20,7 +20,12 @@ void __po_hi_c_driver_serial_linux_poller (void)
void __po_hi_c_driver_serial_linux_init (void) void __po_hi_c_driver_serial_linux_init (void)
{ {
printf ("Hello, i'm the serial driver, i'm initializing the whole thing\n"); printf ("Hello, i'm the serial driver, i'm initializing the whole thing\n");
}
int __po_hi_c_driver_serial_linux_sender (__po_hi_task_id task, __po_hi_port_t port)
{
return 1;
} }
#endif #endif
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <drivers/po_hi_driver_rasta_serial.h> #include <drivers/po_hi_driver_rasta_serial.h>
#ifdef __PO_HI_NEED_SERIAL_RASTA #ifdef __PO_HI_NEED_DRIVER_SERIAL_RASTA
void __po_hi_c_driver_serial_rasta_poller (void) void __po_hi_c_driver_serial_rasta_poller (void)
{ {
...@@ -18,5 +18,10 @@ void __po_hi_c_driver_serial_rasta_init (void) ...@@ -18,5 +18,10 @@ void __po_hi_c_driver_serial_rasta_init (void)
{ {
} }
int __po_hi_c_driver_serial_rasta_sender (const __po_hi_task_id task_id, const __po_hi_port_t port)
{
return 1;
}
#endif #endif
...@@ -256,7 +256,7 @@ int __po_hi_driver_sockets_send (__po_hi_entity_t from, ...@@ -256,7 +256,7 @@ int __po_hi_driver_sockets_send (__po_hi_entity_t from,
if (nodes[node].socket == -1 ) if (nodes[node].socket == -1 )
{ {
#ifdef __PO_HI_DEBUG #ifdef __PO_HI_DEBUG
__DEBUGMSG ("... failure ...\n"); __DEBUGMSG (" [... failure ...]\n");
#endif #endif
return __PO_HI_ERROR_TRANSPORT_SEND; return __PO_HI_ERROR_TRANSPORT_SEND;
} }
...@@ -274,7 +274,7 @@ int __po_hi_driver_sockets_send (__po_hi_entity_t from, ...@@ -274,7 +274,7 @@ int __po_hi_driver_sockets_send (__po_hi_entity_t from,
if (getsockopt (nodes[node].socket, SOL_SOCKET, SO_ERROR, &optval, &optlen) == -1) if (getsockopt (nodes[node].socket, SOL_SOCKET, SO_ERROR, &optval, &optlen) == -1)
{ {
__DEBUGMSG ("Error %s, %d\n", __FILE__, __LINE__); __DEBUGMSG (" [error getsockopt() in file %s, line%d ]\n", __FILE__, __LINE__);
close (nodes[node].socket); close (nodes[node].socket);
nodes[node].socket = -1; nodes[node].socket = -1;
return __PO_HI_ERROR_TRANSPORT_SEND; return __PO_HI_ERROR_TRANSPORT_SEND;
...@@ -282,7 +282,7 @@ int __po_hi_driver_sockets_send (__po_hi_entity_t from, ...@@ -282,7 +282,7 @@ int __po_hi_driver_sockets_send (__po_hi_entity_t from,
if (optval != 0) if (optval != 0)
{ {
__DEBUGMSG ("Error %s, %d", __FILE__, __LINE__); __DEBUGMSG (" [error getsockopt() return code in file %s, line%d ]\n", __FILE__, __LINE__);
close (nodes[node].socket); close (nodes[node].socket);
nodes[node].socket = -1; nodes[node].socket = -1;
return __PO_HI_ERROR_TRANSPORT_SEND; return __PO_HI_ERROR_TRANSPORT_SEND;
...@@ -292,7 +292,7 @@ int __po_hi_driver_sockets_send (__po_hi_entity_t from, ...@@ -292,7 +292,7 @@ int __po_hi_driver_sockets_send (__po_hi_entity_t from,
if (signal (SIGPIPE, SIG_IGN) == SIG_ERR) if (signal (SIGPIPE, SIG_IGN) == SIG_ERR)
{ {
__DEBUGMSG ("Error %s, %d", __FILE__, __LINE__); __DEBUGMSG (" [error signal() return code in file %s, line%d ]\n", __FILE__, __LINE__);
close (nodes[node].socket); close (nodes[node].socket);
nodes[node].socket = -1; nodes[node].socket = -1;
return __PO_HI_ERROR_TRANSPORT_SEND; return __PO_HI_ERROR_TRANSPORT_SEND;
...@@ -306,13 +306,13 @@ int __po_hi_driver_sockets_send (__po_hi_entity_t from, ...@@ -306,13 +306,13 @@ int __po_hi_driver_sockets_send (__po_hi_entity_t from,
if (len != size_to_write) if (len != size_to_write)
{ {
__DEBUGMSG ("Error %s, %d", __FILE__, __LINE__); __DEBUGMSG (" [error write() length in file %s, line%d ]\n", __FILE__, __LINE__);
close (nodes[node].socket); close (nodes[node].socket);
nodes[node].socket = -1; nodes[node].socket = -1;
return __PO_HI_ERROR_TRANSPORT_SEND; return __PO_HI_ERROR_TRANSPORT_SEND;
} }
__DEBUGMSG (" ... success ... \n"); __DEBUGMSG (" [SUCCESS]\n");
return __PO_HI_SUCCESS; return __PO_HI_SUCCESS;
} }
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <deployment.h> #include <deployment.h>
#include <activity.h> #include <activity.h>
#include <request.h> #include <request.h>
#include <marshallers.h>
/* Headers from the generated code */ /* Headers from the generated code */
#include <string.h> #include <string.h>
......
...@@ -47,7 +47,7 @@ int __po_hi_transport_send_default (__po_hi_task_id id, __po_hi_port_t port) ...@@ -47,7 +47,7 @@ int __po_hi_transport_send_default (__po_hi_task_id id, __po_hi_port_t port)
__po_hi_uint8_t i; __po_hi_uint8_t i;
__po_hi_local_port_t local_port; __po_hi_local_port_t local_port;
#if __PO_HI_NB_NODES > 1 #if defined (__PO_HI_NEED_DRIVER_SOCKETS) && (__PO_HI_NB_NODES > 1)
int error; int error;
#endif #endif
...@@ -72,7 +72,7 @@ int __po_hi_transport_send_default (__po_hi_task_id id, __po_hi_port_t port) ...@@ -72,7 +72,7 @@ int __po_hi_transport_send_default (__po_hi_task_id id, __po_hi_port_t port)
for (i=0;i<ndest;i++) for (i=0;i<ndest;i++)
{ {
#ifdef __PO_HI_DEBUG #ifdef __PO_HI_DEBUG
__DEBUGMSG ("\t%d (entity=%d)\n", __DEBUGMSG ("\t%d (entity=%d)",
destinations[i], destinations[i],
__po_hi_port_global_to_entity[destinations[i]]); __po_hi_port_global_to_entity[destinations[i]]);
#endif #endif
...@@ -83,13 +83,13 @@ int __po_hi_transport_send_default (__po_hi_task_id id, __po_hi_port_t port) ...@@ -83,13 +83,13 @@ int __po_hi_transport_send_default (__po_hi_task_id id, __po_hi_port_t port)
if (__po_hi_transport_get_node_from_entity (__po_hi_get_entity_from_global_port (port)) == if (__po_hi_transport_get_node_from_entity (__po_hi_get_entity_from_global_port (port)) ==
__po_hi_transport_get_node_from_entity (__po_hi_get_entity_from_global_port (destinations[i]))) __po_hi_transport_get_node_from_entity (__po_hi_get_entity_from_global_port (destinations[i])))
{ {
__DEBUGMSG ("[deliver locally]"); __DEBUGMSG (" [deliver locally]\n");
__po_hi_main_deliver (request); __po_hi_main_deliver (request);
} }
#if defined (__PO_HI_NEED_DRIVER_SOCKETS) && (__PO_HI_NB_NODES > 1) #if defined (__PO_HI_NEED_DRIVER_SOCKETS) && (__PO_HI_NB_NODES > 1)
else else
{ {
__DEBUGMSG ("[deliver using network sockets]"); __DEBUGMSG (" [deliver using network sockets]");
__po_hi_marshall_request (request, &msg); __po_hi_marshall_request (request, &msg);
error =__po_hi_driver_sockets_send (__po_hi_port_global_to_entity[port], error =__po_hi_driver_sockets_send (__po_hi_port_global_to_entity[port],
......
Supports Markdown
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