Commit 513bc7e6 authored by julien.delange's avatar julien.delange
Browse files

continue device drivers implementation for rasta and linux



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@576 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 3ed8c8be
...@@ -124,7 +124,7 @@ __po_hi_uint8_t __po_hi_gqueue_store_in (__po_hi_task_id id, ...@@ -124,7 +124,7 @@ __po_hi_uint8_t __po_hi_gqueue_store_in (__po_hi_task_id id,
* request that will be stored in the queue. * request that will be stored in the queue.
*/ */
__po_hi_request_t* __po_hi_get_most_recent_value __po_hi_request_t* __po_hi_gqueue_get_most_recent_value
(const __po_hi_task_id task_id, (const __po_hi_task_id task_id,
const __po_hi_local_port_t local_port); const __po_hi_local_port_t local_port);
......
...@@ -14,8 +14,15 @@ ...@@ -14,8 +14,15 @@
#define __PO_HI_DRIVER_SERIAL_LINUX_BAUDRATE B19200 #define __PO_HI_DRIVER_SERIAL_LINUX_BAUDRATE B19200
#include <po_hi_debug.h> #include <po_hi_debug.h>
#include <po_hi_messages.h>
#include <po_hi_transport.h>
/* po-hi-c related files */ /* po-hi-c related files */
#include <activity.h>
#include <marshallers.h>
#include <deployment.h>
/* generated files */
#include <termios.h> #include <termios.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
...@@ -29,15 +36,19 @@ int po_hi_c_driver_serial_fd; ...@@ -29,15 +36,19 @@ 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)
{ {
char buf[1024]; __po_hi_msg_t msg;
__po_hi_request_t request;
int n; int n;
__DEBUGMSG ("Hello, i'm the serial linux poller !\n"); __DEBUGMSG ("Hello, i'm the serial linux poller !\n");
n = read (po_hi_c_driver_serial_fd, &buf, 6); n = read (po_hi_c_driver_serial_fd, &msg, __PO_HI_MESSAGES_MAX_SIZE);
__DEBUGMSG ("[LINUX SERIAL] read() returns %d\n", n); __DEBUGMSG ("[LINUX SERIAL] read() returns %d\n", n);
msg.length = n;
if (n > 0) if (n > 0)
{ {
buf[n] = '\0'; printf ("[LINUX SERIAL] Received: %s\n", msg.content);
printf ("[LINUX SERIAL] Received: %s\n", buf);
__po_hi_unmarshall_request (&request, &msg);
__po_hi_main_deliver (&request);
} }
} }
......
...@@ -11,7 +11,12 @@ ...@@ -11,7 +11,12 @@
#ifdef __PO_HI_NEED_DRIVER_SERIAL_RASTA #ifdef __PO_HI_NEED_DRIVER_SERIAL_RASTA
#include <marshallers.h>
#include <po_hi_debug.h> #include <po_hi_debug.h>
#include <po_hi_transport.h>
#include <po_hi_gqueue.h>
#include <po_hi_messages.h>
#include <drivers/rtems_utils.h> #include <drivers/rtems_utils.h>
#include <drivers/po_hi_driver_rasta_serial.h> #include <drivers/po_hi_driver_rasta_serial.h>
...@@ -24,7 +29,6 @@ ...@@ -24,7 +29,6 @@
#include <pci.h> #include <pci.h>
#include <rasta.h> #include <rasta.h>
#include <apbuart_rasta.h> #include <apbuart_rasta.h>
/* Rasta includes from GAISLER drivers */ /* Rasta includes from GAISLER drivers */
#define __PO_HI_DRIVER_SERIAL_RASTA_DEVICE "/dev/apburasta0" #define __PO_HI_DRIVER_SERIAL_RASTA_DEVICE "/dev/apburasta0"
...@@ -77,10 +81,24 @@ int __po_hi_c_driver_serial_rasta_sender (const __po_hi_task_id task_id, const _ ...@@ -77,10 +81,24 @@ int __po_hi_c_driver_serial_rasta_sender (const __po_hi_task_id task_id, const _
{ {
int n; int n;
__po_hi_local_port_t local_port; __po_hi_local_port_t local_port;
__po_hi_request_t* request;
__po_hi_msg_t msg;
__po_hi_port_t destination_port;
local_port = __po_hi_get_local_port_from_global_port (port);
request = __po_hi_gqueue_get_most_recent_value (task_id, local_port);
destination_port = __po_hi_gqueue_get_destination (task_id, local_port, 0);
__po_hi_msg_reallocate (&msg);
request->port = destination_port;
__po_hi_marshall_request (request, &msg);
n = write (po_hi_c_driver_rasta_serial_fd, &msg, __PO_HI_MESSAGES_MAX_SIZE);
local_port = __po_hi_port_global_to_local[(int)port];
request = &(__po_hi_gqueues_most_recent_values[id][local_port]);
n = write (po_hi_c_driver_rasta_serial_fd, "blabl\n", 6);
__DEBUGMSG ("RASTA write returns %d\n", n); __DEBUGMSG ("RASTA write returns %d\n", n);
return 1; return 1;
} }
......
...@@ -310,7 +310,7 @@ int __po_hi_gqueue_next_value (__po_hi_task_id id, __po_hi_local_port_t port) ...@@ -310,7 +310,7 @@ int __po_hi_gqueue_next_value (__po_hi_task_id id, __po_hi_local_port_t port)
return __PO_HI_SUCCESS; return __PO_HI_SUCCESS;
} }
__po_hi_request_t* __po_hi_get_most_recent_value (const __po_hi_task_id task_id, const __po_hi_local_port_t local_port) __po_hi_request_t* __po_hi_gqueue_get_most_recent_value (const __po_hi_task_id task_id, const __po_hi_local_port_t local_port)
{ {
return (&__po_hi_gqueues_most_recent_values[task_id][local_port]); return (&__po_hi_gqueues_most_recent_values[task_id][local_port]);
} }
......
...@@ -54,7 +54,7 @@ int __po_hi_transport_send_default (__po_hi_task_id id, __po_hi_port_t port) ...@@ -54,7 +54,7 @@ int __po_hi_transport_send_default (__po_hi_task_id id, __po_hi_port_t port)
#endif #endif
local_port = __po_hi_get_local_port_from_global_port (port); local_port = __po_hi_get_local_port_from_global_port (port);
request = __po_hi_get_most_recent_value (id, local_port); request = __po_hi_gqueue_get_most_recent_value (id, local_port);
if (request->port == -1) if (request->port == -1)
{ {
......
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