Commit ca3195bd authored by jdelange's avatar jdelange

* po-hi-c/include/drivers/configuration/1553.h

   po-hi-c/include/drivers/configuration/serial.h
   po-hi-c/include/drivers/configuration/spacewire.h
   po-hi-c/include/drivers/configuration/ip.h

 * po-hi-c/src/drivers/configuration/serial.asn

 * po-hi-c/src/drivers/configuration/serial.c
   po-hi-c/src/drivers/configuration/spacewire.c
   po-hi-c/src/drivers/configuration/ip.c
   po-hi-c/src/drivers/configuration/1553.c

   - Update driver types, introduce sending waiting time

 * po-hi-c/src/po_hi_gqueue.c
   - Add more debug output 

 * po-hi-c/src/drivers/po_hi_driver_leon_serial.c
   - Fix several issues, try to be make it working

 * po-hi-c/src/drivers/po_hi_driver_linux_serial.c
   - Fix the serial driver for linux, use the sending
     waiting time parameter when specified in the associated
     configuration type.




git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@2695 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 0ae7059e
......@@ -2,8 +2,8 @@
#define _INC_1553_H
/*
Code automatically generated by asn1scc tool
Date was: 6/5/2011
Time was: 14:44:03
Date was: 6/21/2011
Time was: 18:14:46
*/
#include "asn1crt.h"
......
......@@ -2,8 +2,8 @@
#define _INC_IP_H
/*
Code automatically generated by asn1scc tool
Date was: 6/5/2011
Time was: 14:44:05
Date was: 6/21/2011
Time was: 18:14:47
*/
#include "asn1crt.h"
......
......@@ -2,8 +2,8 @@
#define _INC_SERIAL_H
/*
Code automatically generated by asn1scc tool
Date was: 6/5/2011
Time was: 14:44:06
Date was: 6/21/2011
Time was: 18:14:47
*/
#include "asn1crt.h"
......@@ -59,19 +59,21 @@ typedef struct {
__po_hi_c_Baudrate_T speed;
__po_hi_c_Parity_T parity;
asn1SccSint bits;
asn1SccSint sending_wait;
flag use_paritybit;
struct {
unsigned int speed:1;
unsigned int parity:1;
unsigned int bits:1;
unsigned int sending_wait:1;
unsigned int use_paritybit:1;
} exist;
} __po_hi_c_serial_conf_t;
#define __po_hi_c_serial_conf_t_REQUIRED_BYTES_FOR_ENCODING 20
#define __po_hi_c_serial_conf_t_REQUIRED_BITS_FOR_ENCODING 155
#define __po_hi_c_serial_conf_t_REQUIRED_BYTES_FOR_ACN_ENCODING 22
#define __po_hi_c_serial_conf_t_REQUIRED_BITS_FOR_ACN_ENCODING 175
#define __po_hi_c_serial_conf_t_REQUIRED_BYTES_FOR_ENCODING 21
#define __po_hi_c_serial_conf_t_REQUIRED_BITS_FOR_ENCODING 166
#define __po_hi_c_serial_conf_t_REQUIRED_BYTES_FOR_ACN_ENCODING 24
#define __po_hi_c_serial_conf_t_REQUIRED_BITS_FOR_ACN_ENCODING 186
#ifndef ERR___po_hi_c_serial_conf_t_devname
#define ERR___po_hi_c_serial_conf_t_devname 1002 /* (SIZE (1..20)) */
......@@ -79,6 +81,9 @@ typedef struct {
#ifndef ERR___po_hi_c_serial_conf_t_bits
#define ERR___po_hi_c_serial_conf_t_bits 1003 /* (7..8) */
#endif
#ifndef ERR___po_hi_c_serial_conf_t_sending_wait
#define ERR___po_hi_c_serial_conf_t_sending_wait 1004 /* (0..1000) */
#endif
void __po_hi_c_serial_conf_t_Initialize(__po_hi_c_serial_conf_t* pVal);
flag __po_hi_c_serial_conf_t_IsConstraintValid(const __po_hi_c_serial_conf_t* val, int* pErrCode);
......
......@@ -2,8 +2,8 @@
#define _INC_SPACEWIRE_H
/*
Code automatically generated by asn1scc tool
Date was: 6/5/2011
Time was: 14:44:07
Date was: 6/21/2011
Time was: 18:14:48
*/
#include "asn1crt.h"
......
#if (defined (__PO_HI_NEED_DRIVER_1553_RASTA))\n
/*
Code automatically generated by asn1scc tool
Date was: 6/5/2011
Time was: 14:44:04
Date was: 6/21/2011
Time was: 18:14:46
*/
#include <string.h>
#include <math.h>
......
#if (defined (__PO_HI_NEED_DRIVER_SOCKETS) || defined (__PO_HI_NEED_DRIVER_RTEMS_NE2000_SOCKETS))\n
/*
Code automatically generated by asn1scc tool
Date was: 6/5/2011
Time was: 14:44:05
Date was: 6/21/2011
Time was: 18:14:47
*/
#include <string.h>
#include <math.h>
......
......@@ -15,6 +15,7 @@ Serial-Conf-T ::= SEQUENCE {
speed Baudrate-T OPTIONAL,
parity Parity-T OPTIONAL,
bits INTEGER (7 .. 8) OPTIONAL,
sending-wait INTEGER (0 .. 100000) OPTIONAL,
use-paritybit BOOLEAN OPTIONAL
}
......
#if (defined (__PO_HI_NEED_DRIVER_SERIAL_LINUX) || defined (__PO_HI_NEED_DRIVER_SERIAL_LINUX_RECEIVER) || defined (__PO_HI_NEED_DRIVER_SERIAL_LINUX_SENDER) || defined (__PO_HI_NEED_DRIVER_SERIAL_RASTA) || defined (__PO_HI_NEED_DRIVER_SERIAL_LEON) || defined (__PO_HI_NEED_DRIVER_SERIAL_LEON_SENDER) || defined (__PO_HI_NEED_DRIVER_SERIAL_LEON_RECEIVER))\n
/*
Code automatically generated by asn1scc tool
Date was: 6/5/2011
Time was: 14:44:06
Date was: 6/21/2011
Time was: 18:14:47
*/
#include <string.h>
#include <math.h>
......@@ -64,6 +64,7 @@ void __po_hi_c_serial_conf_t_Initialize(__po_hi_c_serial_conf_t* pVal)
__po_hi_c_Baudrate_T_Initialize(&pVal->speed);
__po_hi_c_Parity_T_Initialize(&pVal->parity);
pVal->bits = 7;
pVal->sending_wait = 0;
pVal->use_paritybit = FALSE;
}
......@@ -90,6 +91,12 @@ flag __po_hi_c_serial_conf_t_IsConstraintValid(const __po_hi_c_serial_conf_t* pV
return FALSE;
}
}
if (pVal->exist.sending_wait) {
if ( !(((pVal->sending_wait>=0) && (pVal->sending_wait<=1000))) ) {
*pErrCode = ERR___po_hi_c_serial_conf_t_sending_wait;
return FALSE;
}
}
if (pVal->exist.use_paritybit) {
}
(void)pVal; /*Dummy statement, just to hide potential warning*/
......
#if (defined (__PO_HI_NEED_DRIVER_SPACEWIRE_RASTA))\n
/*
Code automatically generated by asn1scc tool
Date was: 6/5/2011
Time was: 14:44:07
Date was: 6/21/2011
Time was: 18:14:48
*/
#include <string.h>
#include <math.h>
......
This diff is collapsed.
......@@ -37,8 +37,9 @@
#include <string.h>
/* Linux-specific files */
int po_hi_c_driver_serial_fd_read;
int po_hi_c_driver_serial_fd_write;
int po_hi_c_driver_serial_fd_read;
int po_hi_c_driver_serial_fd_write;
uint32_t po_hi_c_driver_serial_sending_wait;
#if defined (__PO_HI_NEED_DRIVER_SERIAL_LINUX) || \
defined (__PO_HI_NEED_DRIVER_SERIAL_LINUX_RECEIVER)
......@@ -124,6 +125,8 @@ void __po_hi_c_driver_serial_linux_init_sender (__po_hi_device_id id)
struct termios oldtio,newtio;
__po_hi_c_serial_conf_t* serialconf;
po_hi_c_driver_serial_sending_wait = 0;
__PO_HI_DEBUG_INFO ("[LINUX SERIAL] Init sender\n");
serialconf = (__po_hi_c_serial_conf_t*)__po_hi_get_device_configuration (id);
......@@ -134,6 +137,12 @@ void __po_hi_c_driver_serial_linux_init_sender (__po_hi_device_id id)
return;
}
if (serialconf->exist.sending_wait == 1)
{
po_hi_c_driver_serial_sending_wait = (uint32_t) serialconf->sending_wait;
__PO_HI_DEBUG_INFO ("[LINUX SERIAL] Set sending delay to %u!\n",po_hi_c_driver_serial_sending_wait);
}
po_hi_c_driver_serial_fd_write = open (serialconf->devname, O_WRONLY | O_NOCTTY | O_NDELAY);
if (po_hi_c_driver_serial_fd_write < 0)
......@@ -229,8 +238,8 @@ void __po_hi_c_driver_serial_linux_init_receiver (__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 */
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;
......@@ -330,7 +339,19 @@ int __po_hi_c_driver_serial_linux_sender (__po_hi_task_id task_id, __po_hi_port
swap_value = *swap_pointer;
*swap_pointer = __po_hi_swap_byte (swap_value);
n = write (po_hi_c_driver_serial_fd_write, &msg, __PO_HI_MESSAGES_MAX_SIZE);
if (po_hi_c_driver_serial_sending_wait != 0)
{
for (n = 0 ; n < __PO_HI_MESSAGES_MAX_SIZE ; n++)
{
write (po_hi_c_driver_serial_fd_write, &(msg.content[n]), 1);
usleep (po_hi_c_driver_serial_sending_wait);
}
}
else
{
n = write (po_hi_c_driver_serial_fd_write, &msg, __PO_HI_MESSAGES_MAX_SIZE);
}
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] write() returns %d, message sent: 0x", n);
......
......@@ -209,7 +209,7 @@ void __po_hi_gqueue_store_out (__po_hi_task_id id,
request->port = __PO_HI_GQUEUE_OUT_PORT;
ptr = &__po_hi_gqueues_most_recent_values[id][port];
memcpy (ptr, request, sizeof (*request));
memcpy (ptr, request, sizeof (__po_hi_request_t));
__PO_HI_DEBUG_DEBUG ("__po_hi_gqueue_store_out() from task %d on port %d\n", id, port);
}
......@@ -278,11 +278,13 @@ rtems_id __po_hi_gqueues_barriers[__PO_HI_NB_TASKS];
__PO_HI_DEBUG_CRITICAL ("[GQUEUE] QUEUE FULL, task-id=%d, port=%d", id, port);
return __PO_HI_ERROR_QUEUE_FULL;
}
tmp = (__po_hi_request_t*) &__po_hi_gqueues[id][port];
size = __po_hi_gqueues_woffsets[id][port] + __po_hi_gqueues_first[id][port];
tmp = tmp + size * (sizeof (*request));
memcpy (tmp , request, sizeof (*request));
memcpy (tmp , request, sizeof (__po_hi_request_t));
__po_hi_gqueues_woffsets[id][port] = (__po_hi_gqueues_woffsets[id][port] + 1 ) % __po_hi_gqueues_sizes[id][port];
__po_hi_gqueues_used_size[id][port]++;
......@@ -397,9 +399,9 @@ int __po_hi_gqueue_get_count( __po_hi_task_id id, __po_hi_local_port_t port)
}
}
int __po_hi_gqueue_get_value( __po_hi_task_id id,
__po_hi_local_port_t port,
__po_hi_request_t* request)
int __po_hi_gqueue_get_value (__po_hi_task_id id,
__po_hi_local_port_t port,
__po_hi_request_t* request)
{
__po_hi_request_t* ptr;
#ifdef RTEMS_PURE
......@@ -452,9 +454,8 @@ rtems_id __po_hi_gqueues_barriers[__PO_HI_NB_TASKS];
}
else
{
memcpy (request,
((__po_hi_request_t *) &__po_hi_gqueues[id][port]) + ( __po_hi_gqueues_first[id][port] + __po_hi_gqueues_offsets[id][port] )* sizeof (__po_hi_request_t),
sizeof (__po_hi_request_t));
ptr = ((__po_hi_request_t *) &__po_hi_gqueues[id][port]) + __po_hi_gqueues_first[id][port] + __po_hi_gqueues_offsets[id][port];
memcpy (request, ptr, sizeof (__po_hi_request_t));
}
......
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