Commit 820d55e0 authored by julien.delange's avatar julien.delange

use device identifier for initialisation

introduce new function to deduce device id from a port id



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@592 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 1dde9248
......@@ -15,7 +15,7 @@
void __po_hi_c_driver_serial_linux_poller (void);
void __po_hi_c_driver_serial_linux_init (char*, char*);
void __po_hi_c_driver_serial_linux_init (__po_hi_device_id id);
int __po_hi_c_driver_serial_linux_sender (__po_hi_task_id task, __po_hi_port_t port);
......
......@@ -15,7 +15,7 @@
void __po_hi_c_driver_serial_rasta_poller (void);
void __po_hi_c_driver_serial_rasta_init (char*, char*);
void __po_hi_c_driver_serial_rasta_init (__po_hi_device_id id);
int __po_hi_c_driver_serial_rasta_sender (const __po_hi_task_id task_id, const __po_hi_port_t port);
......
......@@ -27,7 +27,7 @@ typedef struct {
void __po_hi_c_driver_spacewire_rasta_poller (void);
void __po_hi_c_driver_spacewire_rasta_init (char*, char*);
void __po_hi_c_driver_spacewire_rasta_init (__po_hi_device_id id);
int __po_hi_c_driver_spacewire_rasta_sender (const __po_hi_task_id task_id, const __po_hi_port_t port);
......
......@@ -31,7 +31,7 @@ extern __po_hi_inetaddr_t node_addr[__PO_HI_NB_NODES];
* that receives data from a socket (receiver task)
*/
void __po_hi_sockets_initialize (char*, char*);
void __po_hi_sockets_initialize (__po_hi_device_id id);
/*
* Initialize sockets, create the receiver tasks
* and sender file descriptors
......
......@@ -50,5 +50,8 @@ __po_hi_local_port_t __po_hi_get_local_port_from_global_port (const __po_hi_port
__po_hi_uint8_t __po_hi_get_endianness (const __po_hi_node_t node);
__po_hi_device_id __po_hi_get_device_from_port (const __po_hi_port_t port);
char* __po_hi_get_naming (const __po_hi_port_t port);
#endif /* __PO_HI_TRANSPORT__ */
......@@ -76,7 +76,7 @@ void __po_hi_c_driver_serial_linux_poller (void)
}
void __po_hi_c_driver_serial_linux_init (char* name, char* location)
void __po_hi_c_driver_serial_linux_init (__po_hi_device_id id)
{
struct termios oldtio,newtio;
......
......@@ -50,7 +50,7 @@ void __po_hi_c_driver_serial_rasta_poller (void)
}
}
void __po_hi_c_driver_serial_rasta_init (char* name, char* location)
void __po_hi_c_driver_serial_rasta_init (__po_hi_device_id id)
{
__DEBUGMSG ("[RASTA SERIAL] Init\n");
init_pci();
......
......@@ -42,9 +42,9 @@ static __po_hi_c_driver_spacewire_pkt_hdr_t po_hi_c_driver_spacewire_txpkts[1];
int po_hi_c_driver_rasta_spacewire_fd;
void po_hi_c_driver_rasta_spacewire_init_pkt(__po_hi_c_driver_spacewire_pkt_hdr_t *p)
void po_hi_c_driver_rasta_spacewire_init_pkt(__po_hi_c_driver_spacewire_pkt_hdr_t *p, __po_hi_port_t destination_port)
{
p->addr = 10; /* FIXME ! Need to retrieve that from the AADL model ! */
p->addr = atoi (__po_hi_get_naming (destination_port));
p->protid = 50;
p->dummy = 0x01;
p->channel = 0x01;
......@@ -92,11 +92,11 @@ void __po_hi_c_driver_spacewire_rasta_poller (void)
}
}
void __po_hi_c_driver_spacewire_rasta_init (char* name, char* location)
void __po_hi_c_driver_spacewire_rasta_init (__po_hi_device_id id)
{
unsigned int node_addr;
node_addr = atoi (location);
node_addr = atoi (__po_hi_get_naming (id));
__DEBUGMSG ("[RASTA SPACEWIRE] Init\n");
......@@ -161,7 +161,7 @@ int __po_hi_c_driver_spacewire_rasta_sender (const __po_hi_task_id task_id, cons
for(i=0; i<1; i++)
{
po_hi_c_driver_rasta_spacewire_init_pkt(&po_hi_c_driver_spacewire_txpkts[i]);
po_hi_c_driver_rasta_spacewire_init_pkt (&po_hi_c_driver_spacewire_txpkts[i], destination_port);
}
memcpy (po_hi_c_driver_spacewire_txpkts[0].data, &msg, __PO_HI_MESSAGES_MAX_SIZE);
......
......@@ -86,7 +86,7 @@ typedef struct
__po_hi_inetnode_t nodes[__PO_HI_NB_NODES];
__po_hi_inetnode_t rnodes[__PO_HI_NB_NODES];
void __po_hi_driver_sockets_init (char* name, char* location)
void __po_hi_driver_sockets_init (__po_hi_device_id id)
{
int i;
int ret;
......
......@@ -38,6 +38,8 @@ extern __po_hi_request_t* __po_hi_gqueues_most_recent_values[__PO_HI_NB_TASK
extern char* __po_hi_port_global_model_names[__PO_HI_NB_PORTS];
extern char* __po_hi_port_global_names[__PO_HI_NB_PORTS];
extern __po_hi_uint8_t __po_hi_deployment_endiannesses[__PO_HI_NB_NODES];
extern __po_hi_device_id __po_hi_port_to_device[__PO_HI_NB_PORTS];
extern char* __po_hi_devices_naming[__PO_HI_NB_DEVICES];
int __po_hi_transport_send_default (__po_hi_task_id id, __po_hi_port_t port)
{
......@@ -143,3 +145,13 @@ __po_hi_uint8_t __po_hi_get_endianness (const __po_hi_node_t node)
{
return __po_hi_deployment_endiannesses[node];
}
char* __po_hi_get_naming (const __po_hi_port_t port)
{
return __po_hi_devices_naming[port];
}
__po_hi_device_id __po_hi_get_device_from_port (const __po_hi_port_t port)
{
return __po_hi_port_to_device[port];
}
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