Commit 1ee6130e authored by jdelange's avatar jdelange

* src/drivers/configuration

   include/drivers/configuration
   - Update configuration to include the use-router parameter
     for SpaceWire.
 * src/drivers/po_hi_driver_rasta_spacewire.c
   - Use the use-router of SpaceWire to transmit the destination
     of SpaceWire packets.



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@3577 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 785b6fe2
......@@ -2,8 +2,8 @@
#define _INC_1553_H
/*
Code automatically generated by asn1scc tool
Date was: 10/07/2011
Time was: 11:19:21
Date was: 12/21/2011
Time was: 19:16:31
*/
#include "asn1crt.h"
......@@ -20,6 +20,7 @@ typedef asn1SccSint __po_hi_c_Node_Addr_T;
#define __po_hi_c_Node_Addr_T_REQUIRED_BITS_FOR_ENCODING 5
#define __po_hi_c_Node_Addr_T_REQUIRED_BYTES_FOR_ACN_ENCODING 1
#define __po_hi_c_Node_Addr_T_REQUIRED_BITS_FOR_ACN_ENCODING 5
#define __po_hi_c_Node_Addr_T_REQUIRED_BYTES_FOR_XER_ENCODING 47
#ifndef ERR___po_hi_c_Node_Addr_T
#define ERR___po_hi_c_Node_Addr_T 1000 /* (0..31) */
......@@ -38,6 +39,7 @@ typedef enum {
#define __po_hi_c_Standard_T_REQUIRED_BITS_FOR_ENCODING 1
#define __po_hi_c_Standard_T_REQUIRED_BYTES_FOR_ACN_ENCODING 1
#define __po_hi_c_Standard_T_REQUIRED_BITS_FOR_ACN_ENCODING 1
#define __po_hi_c_Standard_T_REQUIRED_BYTES_FOR_XER_ENCODING 44
#ifndef ERR___po_hi_c_Standard_T_unknown_enumeration_value
#define ERR___po_hi_c_Standard_T_unknown_enumeration_value 1001 /* invalid enumeration value */
......@@ -57,6 +59,7 @@ typedef enum {
#define __po_hi_c_Mode_T_REQUIRED_BITS_FOR_ENCODING 2
#define __po_hi_c_Mode_T_REQUIRED_BYTES_FOR_ACN_ENCODING 1
#define __po_hi_c_Mode_T_REQUIRED_BITS_FOR_ACN_ENCODING 2
#define __po_hi_c_Mode_T_REQUIRED_BYTES_FOR_XER_ENCODING 40
#ifndef ERR___po_hi_c_Mode_T_unknown_enumeration_value
#define ERR___po_hi_c_Mode_T_unknown_enumeration_value 1002 /* invalid enumeration value */
......@@ -77,6 +80,7 @@ typedef enum {
#define __po_hi_c_Bus_T_REQUIRED_BITS_FOR_ENCODING 2
#define __po_hi_c_Bus_T_REQUIRED_BYTES_FOR_ACN_ENCODING 1
#define __po_hi_c_Bus_T_REQUIRED_BITS_FOR_ACN_ENCODING 2
#define __po_hi_c_Bus_T_REQUIRED_BYTES_FOR_XER_ENCODING 28
#ifndef ERR___po_hi_c_Bus_T_unknown_enumeration_value
#define ERR___po_hi_c_Bus_T_unknown_enumeration_value 1003 /* invalid enumeration value */
......@@ -105,6 +109,7 @@ typedef struct {
#define __po_hi_c_mil_1553_conf_t_REQUIRED_BITS_FOR_ENCODING 160
#define __po_hi_c_mil_1553_conf_t_REQUIRED_BYTES_FOR_ACN_ENCODING 23
#define __po_hi_c_mil_1553_conf_t_REQUIRED_BITS_FOR_ACN_ENCODING 180
#define __po_hi_c_mil_1553_conf_t_REQUIRED_BYTES_FOR_XER_ENCODING 315
#ifndef ERR___po_hi_c_mil_1553_conf_t_devname
#define ERR___po_hi_c_mil_1553_conf_t_devname 1004 /* (SIZE (1..20)) */
......
......@@ -10,17 +10,21 @@ extern "C" {
#define NULL 0
#endif
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef WORD_SIZE
#define WORD_SIZE 8
#endif
typedef long asn1SccSint32;
typedef unsigned long asn1SccUint32;
typedef int asn1SccSint32;
typedef unsigned int asn1SccUint32;
typedef unsigned char byte;
......@@ -53,6 +57,7 @@ typedef struct {
byte* buf;
long count;
long currentByte;
flag EncodeWhiteSpace;
} ByteStream;
typedef struct {
......@@ -266,6 +271,7 @@ flag Xer_DecodeComplexElementEnd(ByteStream* pByteStrm, const char* elementTag,
flag Xer_NextEndElementIs(ByteStream* pByteStrm, const char* elementTag);
flag Xer_NextStartElementIs(ByteStream* pByteStrm, const char* elementTag);
flag Xer_LA_NextElementTag(ByteStream* pByteStrm, char* elementTag);
flag LoadXmlFile(const char* fileName, ByteStream* pStrm, int* nBytesLoaded);
......
......@@ -2,8 +2,8 @@
#define _INC_IP_H
/*
Code automatically generated by asn1scc tool
Date was: 10/07/2011
Time was: 11:19:21
Date was: 12/21/2011
Time was: 19:16:31
*/
#include "asn1crt.h"
......@@ -20,6 +20,7 @@ typedef asn1SccSint __po_hi_c_Port_T;
#define __po_hi_c_Port_T_REQUIRED_BITS_FOR_ENCODING 15
#define __po_hi_c_Port_T_REQUIRED_BYTES_FOR_ACN_ENCODING 2
#define __po_hi_c_Port_T_REQUIRED_BITS_FOR_ACN_ENCODING 15
#define __po_hi_c_Port_T_REQUIRED_BYTES_FOR_XER_ENCODING 37
#ifndef ERR___po_hi_c_Port_T
#define ERR___po_hi_c_Port_T 1000 /* (0..16535) */
......@@ -38,6 +39,7 @@ typedef enum {
#define __po_hi_c_Version_T_REQUIRED_BITS_FOR_ENCODING 1
#define __po_hi_c_Version_T_REQUIRED_BYTES_FOR_ACN_ENCODING 1
#define __po_hi_c_Version_T_REQUIRED_BITS_FOR_ACN_ENCODING 1
#define __po_hi_c_Version_T_REQUIRED_BYTES_FOR_XER_ENCODING 34
#ifndef ERR___po_hi_c_Version_T_unknown_enumeration_value
#define ERR___po_hi_c_Version_T_unknown_enumeration_value 1001 /* invalid enumeration value */
......@@ -69,6 +71,7 @@ typedef struct {
#define __po_hi_c_ip_conf_t_REQUIRED_BITS_FOR_ENCODING 1596
#define __po_hi_c_ip_conf_t_REQUIRED_BYTES_FOR_ACN_ENCODING 227
#define __po_hi_c_ip_conf_t_REQUIRED_BITS_FOR_ACN_ENCODING 1816
#define __po_hi_c_ip_conf_t_REQUIRED_BYTES_FOR_XER_ENCODING 416
#ifndef ERR___po_hi_c_ip_conf_t_devname
#define ERR___po_hi_c_ip_conf_t_devname 1002 /* (SIZE (1..20)) */
......
......@@ -2,8 +2,8 @@
#define _INC_SERIAL_H
/*
Code automatically generated by asn1scc tool
Date was: 10/07/2011
Time was: 11:19:22
Date was: 12/21/2011
Time was: 19:16:32
*/
#include "asn1crt.h"
......@@ -27,6 +27,7 @@ typedef enum {
#define __po_hi_c_Baudrate_T_REQUIRED_BITS_FOR_ENCODING 3
#define __po_hi_c_Baudrate_T_REQUIRED_BYTES_FOR_ACN_ENCODING 1
#define __po_hi_c_Baudrate_T_REQUIRED_BITS_FOR_ACN_ENCODING 3
#define __po_hi_c_Baudrate_T_REQUIRED_BYTES_FOR_XER_ENCODING 42
#ifndef ERR___po_hi_c_Baudrate_T_unknown_enumeration_value
#define ERR___po_hi_c_Baudrate_T_unknown_enumeration_value 1000 /* invalid enumeration value */
......@@ -45,6 +46,7 @@ typedef enum {
#define __po_hi_c_Parity_T_REQUIRED_BITS_FOR_ENCODING 1
#define __po_hi_c_Parity_T_REQUIRED_BYTES_FOR_ACN_ENCODING 1
#define __po_hi_c_Parity_T_REQUIRED_BITS_FOR_ACN_ENCODING 1
#define __po_hi_c_Parity_T_REQUIRED_BYTES_FOR_XER_ENCODING 32
#ifndef ERR___po_hi_c_Parity_T_unknown_enumeration_value
#define ERR___po_hi_c_Parity_T_unknown_enumeration_value 1001 /* invalid enumeration value */
......@@ -74,6 +76,7 @@ typedef struct {
#define __po_hi_c_serial_conf_t_REQUIRED_BITS_FOR_ENCODING 180
#define __po_hi_c_serial_conf_t_REQUIRED_BYTES_FOR_ACN_ENCODING 25
#define __po_hi_c_serial_conf_t_REQUIRED_BITS_FOR_ACN_ENCODING 200
#define __po_hi_c_serial_conf_t_REQUIRED_BYTES_FOR_XER_ENCODING 256
#ifndef ERR___po_hi_c_serial_conf_t_devname
#define ERR___po_hi_c_serial_conf_t_devname 1002 /* (SIZE (1..20)) */
......
......@@ -2,8 +2,8 @@
#define _INC_SPACEWIRE_H
/*
Code automatically generated by asn1scc tool
Date was: 10/07/2011
Time was: 11:19:23
Date was: 12/21/2011
Time was: 19:16:32
*/
#include "asn1crt.h"
......@@ -20,6 +20,7 @@ typedef asn1SccSint __po_hi_c_Core_Frequence_T;
#define __po_hi_c_Core_Frequence_T_REQUIRED_BITS_FOR_ENCODING 32
#define __po_hi_c_Core_Frequence_T_REQUIRED_BYTES_FOR_ACN_ENCODING 4
#define __po_hi_c_Core_Frequence_T_REQUIRED_BITS_FOR_ACN_ENCODING 32
#define __po_hi_c_Core_Frequence_T_REQUIRED_BYTES_FOR_XER_ENCODING 57
#ifndef ERR___po_hi_c_Core_Frequence_T
#define ERR___po_hi_c_Core_Frequence_T 1000 /* (0..4294967295) */
......@@ -35,6 +36,7 @@ typedef asn1SccSint __po_hi_c_Node_Addr_T;
#define __po_hi_c_Node_Addr_T_REQUIRED_BITS_FOR_ENCODING 8
#define __po_hi_c_Node_Addr_T_REQUIRED_BYTES_FOR_ACN_ENCODING 1
#define __po_hi_c_Node_Addr_T_REQUIRED_BITS_FOR_ACN_ENCODING 8
#define __po_hi_c_Node_Addr_T_REQUIRED_BYTES_FOR_XER_ENCODING 47
#ifndef ERR___po_hi_c_Node_Addr_T
#define ERR___po_hi_c_Node_Addr_T 1001 /* (0..255) */
......@@ -50,6 +52,7 @@ typedef asn1SccSint __po_hi_c_Clock_Division_T;
#define __po_hi_c_Clock_Division_T_REQUIRED_BITS_FOR_ENCODING 8
#define __po_hi_c_Clock_Division_T_REQUIRED_BYTES_FOR_ACN_ENCODING 1
#define __po_hi_c_Clock_Division_T_REQUIRED_BITS_FOR_ACN_ENCODING 8
#define __po_hi_c_Clock_Division_T_REQUIRED_BYTES_FOR_XER_ENCODING 57
#ifndef ERR___po_hi_c_Clock_Division_T
#define ERR___po_hi_c_Clock_Division_T 1002 /* (0..255) */
......@@ -64,12 +67,14 @@ typedef struct {
__po_hi_c_Node_Addr_T nodeaddr;
__po_hi_c_Core_Frequence_T corefreq;
__po_hi_c_Clock_Division_T clockdiv;
flag use_router;
flag remove_prot_id;
flag rxblock;
flag txblock;
struct {
unsigned int corefreq:1;
unsigned int clockdiv:1;
unsigned int use_router:1;
unsigned int remove_prot_id:1;
unsigned int rxblock:1;
unsigned int txblock:1;
......@@ -77,9 +82,10 @@ typedef struct {
} __po_hi_c_spacewire_conf_t;
#define __po_hi_c_spacewire_conf_t_REQUIRED_BYTES_FOR_ENCODING 26
#define __po_hi_c_spacewire_conf_t_REQUIRED_BITS_FOR_ENCODING 201
#define __po_hi_c_spacewire_conf_t_REQUIRED_BITS_FOR_ENCODING 203
#define __po_hi_c_spacewire_conf_t_REQUIRED_BYTES_FOR_ACN_ENCODING 28
#define __po_hi_c_spacewire_conf_t_REQUIRED_BITS_FOR_ACN_ENCODING 221
#define __po_hi_c_spacewire_conf_t_REQUIRED_BITS_FOR_ACN_ENCODING 223
#define __po_hi_c_spacewire_conf_t_REQUIRED_BYTES_FOR_XER_ENCODING 347
#ifndef ERR___po_hi_c_spacewire_conf_t_devname
#define ERR___po_hi_c_spacewire_conf_t_devname 1003 /* (SIZE (1..20)) */
......
#if (defined (__PO_HI_NEED_DRIVER_1553_RASTA))\n
/*
Code automatically generated by asn1scc tool
Date was: 10/07/2011
Time was: 11:19:21
Date was: 12/21/2011
Time was: 19:16:31
*/
#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: 10/07/2011
Time was: 11:19:22
Date was: 12/21/2011
Time was: 19:16:31
*/
#include <string.h>
#include <math.h>
......
#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: 10/07/2011
Time was: 11:19:23
Date was: 12/21/2011
Time was: 19:16:32
*/
#include <string.h>
#include <math.h>
......
......@@ -11,6 +11,7 @@ Spacewire-Conf-T ::= SEQUENCE {
nodeaddr Node-Addr-T,
corefreq Core-Frequence-T OPTIONAL,
clockdiv Clock-Division-T OPTIONAL,
use-router BOOLEAN DEFAULT FALSE,
remove-prot-id BOOLEAN OPTIONAL,
rxblock BOOLEAN OPTIONAL,
txblock BOOLEAN OPTIONAL
......
#if (defined (__PO_HI_NEED_DRIVER_SPACEWIRE_RASTA))\n
/*
Code automatically generated by asn1scc tool
Date was: 10/07/2011
Time was: 11:19:23
Date was: 12/21/2011
Time was: 19:16:33
*/
#include <string.h>
#include <math.h>
......@@ -86,6 +86,7 @@ void __po_hi_c_spacewire_conf_t_Initialize(__po_hi_c_spacewire_conf_t* pVal)
pVal->nodeaddr = 0;
pVal->corefreq = 0;
pVal->clockdiv = 0;
pVal->use_router = FALSE;
pVal->remove_prot_id = FALSE;
pVal->rxblock = FALSE;
pVal->txblock = FALSE;
......@@ -110,6 +111,8 @@ flag __po_hi_c_spacewire_conf_t_IsConstraintValid(const __po_hi_c_spacewire_conf
if ( !__po_hi_c_Clock_Division_T_IsConstraintValid(&pVal->clockdiv, pErrCode))
return FALSE;
}
if (pVal->exist.use_router) {
}
if (pVal->exist.remove_prot_id) {
}
......
......@@ -48,6 +48,7 @@
__po_hi_request_t __po_hi_c_driver_spacewire_rasta_request;
__po_hi_msg_t __po_hi_c_driver_spacewire_rasta_poller_msg;
int po_hi_c_driver_rasta_spacewire_fd[__PO_HI_NB_DEVICES];
char __po_hi_c_driver_rasta_spacewire_sndbuf[__PO_HI_MESSAGES_MAX_SIZE + 1];
void __po_hi_c_driver_spacewire_rasta_poller (const __po_hi_device_id dev_id)
{
......@@ -145,8 +146,6 @@ void __po_hi_c_driver_spacewire_rasta_init (__po_hi_device_id id)
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_spacewire_fd[id],SPACEWIRE_IOCTRL_START,2000);
perror ("spw start");
}
......@@ -156,6 +155,10 @@ int __po_hi_c_driver_spacewire_rasta_sender (const __po_hi_task_id task_id, cons
{
int len = -1;
int i;
__po_hi_c_spacewire_conf_t* sender_conf;
__po_hi_c_spacewire_conf_t* receiver_conf;
__po_hi_local_port_t local_port;
__po_hi_request_t* request;
__po_hi_port_t destination_port;
......@@ -186,10 +189,23 @@ int __po_hi_c_driver_spacewire_rasta_sender (const __po_hi_task_id task_id, cons
request->port = destination_port;
__po_hi_marshall_request (request, &__po_hi_c_driver_spacewire_rasta_sender_msg);
sender_conf = (__po_hi_c_spacewire_conf_t*) __po_hi_get_device_configuration (dev_id);
receiver_conf = (__po_hi_c_spacewire_conf_t*) __po_hi_get_device_configuration (__po_hi_get_device_from_port (destination_port));
len = write (po_hi_c_driver_rasta_spacewire_fd[dev_id], __po_hi_c_driver_spacewire_rasta_sender_msg.content, __PO_HI_MESSAGES_MAX_SIZE);
__po_hi_marshall_request (request, &__po_hi_c_driver_spacewire_rasta_sender_msg);
len = -1;
if (sender_conf->use_router == TRUE)
{
__po_hi_c_driver_rasta_spacewire_sndbuf[0] = receiver_conf->nodeaddr;
memcpy (&__po_hi_c_driver_rasta_spacewire_sndbuf[1], __po_hi_c_driver_spacewire_rasta_sender_msg.content , __PO_HI_MESSAGES_MAX_SIZE);
len = write (po_hi_c_driver_rasta_spacewire_fd[dev_id], __po_hi_c_driver_rasta_spacewire_sndbuf, __PO_HI_MESSAGES_MAX_SIZE + 1);
}
else
{
len = write (po_hi_c_driver_rasta_spacewire_fd[dev_id], __po_hi_c_driver_spacewire_rasta_sender_msg.content, __PO_HI_MESSAGES_MAX_SIZE);
}
if (len < 0)
{
__PO_HI_DEBUG_DEBUG (" failed !\n");
......
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