Commits (25)
# This script is adapted from https://github.com/AdaCore/Ada_Drivers_Library
################################################################################
# Ocarina travis-ci configuration file.
# This script compiles and test Ocarina for Linux and OS X targets
#
# Note: this travis-ci script is adapted from
# https://github.com/AdaCore/Ada_Drivers_Library
#
# Thanks to AdaCore for providing it
# We are using Python 2.7 to run the testsuite
language: python
python:
- "2.7"
################################################################################
# Note: we are using 'generic' as a language. We need GNAT to compile
# Ocarina, and Python to run Ocarina testsuite. We install a specific
# GNAT GPL release to compile and run everything.
language: generic
osx_image: xcode8.3
# Global variables
env:
global:
- TOOLS_DIR=$HOME/build_tools
- GNAT_TAR_PATH=$TOOLS_DIR/gnat-gpl-2016-x86_64-linux-bin.tar.gz
- INSTALL_DIR=$HOME/tools
################################################################################
# Host to run the various tests
os:
- linux
- osx
################################################################################
# Install the build environment, derived from travis default installation
# 1/ Cache directory that allows us to not download GNAT GPL every time,
# speeding up the process.
# Cache directory that allows us to not download GNAT GPL every time, speeding
# up the process.
cache:
directories:
- $HOME/build_tools
- $HOME/tools
install:
# Check if the GNAT package is already available in the cache directory. If
# not, download it.
- test -f $GNAT_TAR_PATH ||( mkdir -p $TOOLS_DIR && wget http://mirrors.cdn.adacore.com/art/5739cefdc7a447658e0b016b -O $GNAT_TAR_PATH)
# 2/ Check Python installation
before_install:
- which python
# Extract GNAT from its package
- tar -xf $GNAT_TAR_PATH
# 3/ Install GNAT
# Add GNAT to $PATH
- export PATH=$PWD/gnat-gpl-2016-x86_64-linux-bin/bin/:$PATH
install:
- git clone https://github.com/OpenAADL/ocarina-build.git ; ( cd ocarina-build ; ./build_ocarina.sh --install-gnat-ce ; cd $HOME)
- export PATH=$HOME/tools/bin:$PATH
- echo $PATH
################################################################################
# Main processing starts here
script:
# Show GNAT version for the record
......@@ -37,5 +59,29 @@ script:
- gnatls -v
# Just build
#- ./support/reconfig && ./configure && make
- git clone https://github.com/OpenAADL/ocarina-build.git ; ( cd ocarina-build ; ./build_ocarina.sh --scenario=travis-ci )
\ No newline at end of file
- ( cd ocarina-build ; ./build_ocarina.sh --scenario=travis-ci )
# Codecov.io
after_success:
- bash <(curl -s https://codecov.io/bash)
################################################################################
#
before_deploy:
- export OCARINA_SRC=$(find . -name "*tar.gz")
- echo $OCARINA_SRC
- export OCARINA_BIN=$(find . -name "*tgz")
- echo $OCARINA_BIN
deploy:
provider: releases
api_key:
secure: JIs5VZq+T0m42jasHpuDHXjJwgmQNGDaNJos9xHG01b5tvrG9NRIPjB4AFh1RiJBQ8LYFRpcRkrEzbAHs9H4jh7zLrdaAGRo6v0G/h5aowWNGoTiT6sMy5ATX6cuMO/treCEWWEUpUsDy5GSebsRkGhbMjH3d2kZ3933SJIg+kI=
skip_cleanup: true
file:
- "${OCARINA_SRC}"
- "${OCARINA_BIN}"
on:
tags: true
all_branches: true
......@@ -13,8 +13,6 @@ extern "C" {
typedef asn1SccUint __po_hi_c_Node_Addr_T;
flag __po_hi_c_Node_Addr_T_Equal(const __po_hi_c_Node_Addr_T* pVal1, const __po_hi_c_Node_Addr_T* pVal2);
void __po_hi_c_Node_Addr_T_Initialize(__po_hi_c_Node_Addr_T* pVal);
#define ERR_NODE_ADDR_T 1 /**/
......@@ -24,7 +22,9 @@ typedef enum {
__po_hi_c_mil1553b = 1
} __po_hi_c_Standard_T;
flag __po_hi_c_Standard_T_Equal(const __po_hi_c_Standard_T* pVal1, const __po_hi_c_Standard_T* pVal2);
// please use the following macros to avoid breaking code.
#define __po_hi_c_Standard_T_mil1553a __po_hi_c_mil1553a
#define __po_hi_c_Standard_T_mil1553b __po_hi_c_mil1553b
void __po_hi_c_Standard_T_Initialize(__po_hi_c_Standard_T* pVal);
......@@ -36,7 +36,10 @@ typedef enum {
__po_hi_c_monitor = 2
} __po_hi_c_Mode_T;
flag __po_hi_c_Mode_T_Equal(const __po_hi_c_Mode_T* pVal1, const __po_hi_c_Mode_T* pVal2);
// please use the following macros to avoid breaking code.
#define __po_hi_c_Mode_T_controller __po_hi_c_controller
#define __po_hi_c_Mode_T_terminal __po_hi_c_terminal
#define __po_hi_c_Mode_T_monitor __po_hi_c_monitor
void __po_hi_c_Mode_T_Initialize(__po_hi_c_Mode_T* pVal);
......@@ -49,7 +52,11 @@ typedef enum {
__po_hi_c_both = 3
} __po_hi_c_Bus_T;
flag __po_hi_c_Bus_T_Equal(const __po_hi_c_Bus_T* pVal1, const __po_hi_c_Bus_T* pVal2);
// please use the following macros to avoid breaking code.
#define __po_hi_c_Bus_T_none __po_hi_c_none
#define __po_hi_c_Bus_T_bus_a __po_hi_c_bus_a
#define __po_hi_c_Bus_T_bus_b __po_hi_c_bus_b
#define __po_hi_c_Bus_T_both __po_hi_c_both
void __po_hi_c_Bus_T_Initialize(__po_hi_c_Bus_T* pVal);
......@@ -57,7 +64,6 @@ void __po_hi_c_Bus_T_Initialize(__po_hi_c_Bus_T* pVal);
flag __po_hi_c_Bus_T_IsConstraintValid(const __po_hi_c_Bus_T* pVal, int* pErrCode);
/*-- __po_hi_c_mil_1553_conf_t --------------------------------------------*/
typedef char __po_hi_c_mil_1553_conf_t_devname[21];
typedef struct {
__po_hi_c_mil_1553_conf_t_devname devname;
__po_hi_c_Standard_T standard;
......@@ -75,21 +81,18 @@ typedef struct {
} __po_hi_c_mil_1553_conf_t;
flag __po_hi_c_mil_1553_conf_t_devname_Equal(const __po_hi_c_mil_1553_conf_t_devname val1, const __po_hi_c_mil_1553_conf_t_devname val2);
flag __po_hi_c_mil_1553_conf_t_Equal(const __po_hi_c_mil_1553_conf_t* pVal1, const __po_hi_c_mil_1553_conf_t* pVal2);
void __po_hi_c_mil_1553_conf_t_devname_Initialize(__po_hi_c_mil_1553_conf_t_devname val);
void __po_hi_c_mil_1553_conf_t_Initialize(__po_hi_c_mil_1553_conf_t* pVal);
#define ERR_MIL_1553_CONF_T 105 /**/
#define ERR_MIL_1553_CONF_T_DEVNAME 29 /**/
#define ERR_MIL_1553_CONF_T_STANDARD 36 /**/
#define ERR_MIL_1553_CONF_T_MODE 47 /**/
#define ERR_MIL_1553_CONF_T_BUS 58 /**/
#define ERR_MIL_1553_CONF_T_TERMADDR 69 /**/
#define ERR_MIL_1553_CONF_T_BROADCAST 80 /**/
#define ERR_MIL_1553_CONF_T_RXBLOCK 87 /**/
#define ERR_MIL_1553_CONF_T_TXBLOCK 94 /**/
#define ERR_MIL_1553_CONF_T_STANDARD_2 43 /**/
#define ERR_MIL_1553_CONF_T_MODE_2 55 /**/
#define ERR_MIL_1553_CONF_T_BUS_2 67 /**/
#define ERR_MIL_1553_CONF_T_TERMADDR_2 79 /**/
#define ERR_MIL_1553_CONF_T_BROADCAST 84 /**/
#define ERR_MIL_1553_CONF_T_RXBLOCK 91 /**/
#define ERR_MIL_1553_CONF_T_TXBLOCK 98 /**/
flag __po_hi_c_mil_1553_conf_t_IsConstraintValid(const __po_hi_c_mil_1553_conf_t* pVal, int* pErrCode);
......@@ -107,4 +110,4 @@ flag __po_hi_c_mil_1553_conf_t_IsConstraintValid(const __po_hi_c_mil_1553_conf_t
#endif
#endif
\ No newline at end of file
#endif
This diff is collapsed.
......@@ -16,7 +16,10 @@ typedef enum {
__po_hi_c_d2M = 2
} __po_hi_c_Datarate_T;
flag __po_hi_c_Datarate_T_Equal(const __po_hi_c_Datarate_T* pVal1, const __po_hi_c_Datarate_T* pVal2);
// please use the following macros to avoid breaking code.
#define __po_hi_c_Datarate_T_d250K __po_hi_c_d250K
#define __po_hi_c_Datarate_T_d1M __po_hi_c_d1M
#define __po_hi_c_Datarate_T_d2M __po_hi_c_d2M
void __po_hi_c_Datarate_T_Initialize(__po_hi_c_Datarate_T* pVal);
......@@ -28,13 +31,13 @@ typedef struct {
} __po_hi_c_Address_T;
flag __po_hi_c_Address_T_Equal(const __po_hi_c_Address_T* pVal1, const __po_hi_c_Address_T* pVal2);
void __po_hi_c_Address_T_Initialize(__po_hi_c_Address_T* pVal);
#define ERR_ADDRESS_T 8 /**/
flag __po_hi_c_Address_T_IsConstraintValid(const __po_hi_c_Address_T* pVal, int* pErrCode);
/*-- __po_hi_c_bluetooth_conf_t --------------------------------------------*/
typedef asn1SccUint __po_hi_c_bluetooth_conf_t_channel;
typedef struct {
__po_hi_c_bluetooth_conf_t_channel channel;
__po_hi_c_Datarate_T datarate;
......@@ -47,15 +50,13 @@ typedef struct {
} __po_hi_c_bluetooth_conf_t;
flag __po_hi_c_bluetooth_conf_t_channel_Equal(const __po_hi_c_bluetooth_conf_t_channel* pVal1, const __po_hi_c_bluetooth_conf_t_channel* pVal2);
flag __po_hi_c_bluetooth_conf_t_Equal(const __po_hi_c_bluetooth_conf_t* pVal1, const __po_hi_c_bluetooth_conf_t* pVal2);
void __po_hi_c_bluetooth_conf_t_channel_Initialize(__po_hi_c_bluetooth_conf_t_channel* pVal);
void __po_hi_c_bluetooth_conf_t_Initialize(__po_hi_c_bluetooth_conf_t* pVal);
#define ERR_BLUETOOTH_CONF_T_CHANNEL 14 /**/
#define ERR_BLUETOOTH_CONF_T_DATARATE 21 /**/
#define ERR_BLUETOOTH_CONF_T 46 /**/
#define ERR_BLUETOOTH_CONF_T_CHANNEL 15 /**/
#define ERR_BLUETOOTH_CONF_T_DATARATE_2 29 /**/
#define ERR_BLUETOOTH_CONF_T_ADDRESS_2 41 /**/
flag __po_hi_c_bluetooth_conf_t_IsConstraintValid(const __po_hi_c_bluetooth_conf_t* pVal, int* pErrCode);
extern const __po_hi_c_bluetooth_conf_t crazyflie_default;
......@@ -73,4 +74,4 @@ extern const __po_hi_c_bluetooth_conf_t crazyflie_default;
#endif
#endif
\ No newline at end of file
#endif
......@@ -13,8 +13,6 @@ extern "C" {
typedef asn1SccUint __po_hi_c_Port_T;
flag __po_hi_c_Port_T_Equal(const __po_hi_c_Port_T* pVal1, const __po_hi_c_Port_T* pVal2);
void __po_hi_c_Port_T_Initialize(__po_hi_c_Port_T* pVal);
#define ERR_PORT_T 1 /**/
......@@ -24,7 +22,9 @@ typedef enum {
__po_hi_c_ipv6 = 1
} __po_hi_c_Version_T;
flag __po_hi_c_Version_T_Equal(const __po_hi_c_Version_T* pVal1, const __po_hi_c_Version_T* pVal2);
// please use the following macros to avoid breaking code.
#define __po_hi_c_Version_T_ipv4 __po_hi_c_ipv4
#define __po_hi_c_Version_T_ipv6 __po_hi_c_ipv6
void __po_hi_c_Version_T_Initialize(__po_hi_c_Version_T* pVal);
......@@ -37,7 +37,6 @@ typedef char __po_hi_c_ip_conf_t_broadcast[41];
typedef char __po_hi_c_ip_conf_t_netmask[41];
typedef char __po_hi_c_ip_conf_t_gateway[41];
typedef char __po_hi_c_ip_conf_t_dns[41];
typedef struct {
__po_hi_c_ip_conf_t_devname devname;
__po_hi_c_ip_conf_t_address address;
......@@ -58,20 +57,6 @@ typedef struct {
} __po_hi_c_ip_conf_t;
flag __po_hi_c_ip_conf_t_devname_Equal(const __po_hi_c_ip_conf_t_devname val1, const __po_hi_c_ip_conf_t_devname val2);
flag __po_hi_c_ip_conf_t_address_Equal(const __po_hi_c_ip_conf_t_address val1, const __po_hi_c_ip_conf_t_address val2);
flag __po_hi_c_ip_conf_t_broadcast_Equal(const __po_hi_c_ip_conf_t_broadcast val1, const __po_hi_c_ip_conf_t_broadcast val2);
flag __po_hi_c_ip_conf_t_netmask_Equal(const __po_hi_c_ip_conf_t_netmask val1, const __po_hi_c_ip_conf_t_netmask val2);
flag __po_hi_c_ip_conf_t_gateway_Equal(const __po_hi_c_ip_conf_t_gateway val1, const __po_hi_c_ip_conf_t_gateway val2);
flag __po_hi_c_ip_conf_t_dns_Equal(const __po_hi_c_ip_conf_t_dns val1, const __po_hi_c_ip_conf_t_dns val2);
flag __po_hi_c_ip_conf_t_Equal(const __po_hi_c_ip_conf_t* pVal1, const __po_hi_c_ip_conf_t* pVal2);
void __po_hi_c_ip_conf_t_devname_Initialize(__po_hi_c_ip_conf_t_devname val);
void __po_hi_c_ip_conf_t_address_Initialize(__po_hi_c_ip_conf_t_address val);
void __po_hi_c_ip_conf_t_broadcast_Initialize(__po_hi_c_ip_conf_t_broadcast val);
......@@ -80,14 +65,15 @@ void __po_hi_c_ip_conf_t_gateway_Initialize(__po_hi_c_ip_conf_t_gateway val);
void __po_hi_c_ip_conf_t_dns_Initialize(__po_hi_c_ip_conf_t_dns val);
void __po_hi_c_ip_conf_t_Initialize(__po_hi_c_ip_conf_t* pVal);
#define ERR_IP_CONF_T 81 /**/
#define ERR_IP_CONF_T_DEVNAME 15 /**/
#define ERR_IP_CONF_T_ADDRESS 22 /**/
#define ERR_IP_CONF_T_BROADCAST 29 /**/
#define ERR_IP_CONF_T_NETMASK 36 /**/
#define ERR_IP_CONF_T_GATEWAY 43 /**/
#define ERR_IP_CONF_T_DNS 50 /**/
#define ERR_IP_CONF_T_VERSION 57 /**/
#define ERR_IP_CONF_T_PORT 68 /**/
#define ERR_IP_CONF_T_VERSION_2 64 /**/
#define ERR_IP_CONF_T_PORT_2 76 /**/
flag __po_hi_c_ip_conf_t_IsConstraintValid(const __po_hi_c_ip_conf_t* pVal, int* pErrCode);
extern const __po_hi_c_ip_conf_t localhost1;
......@@ -106,4 +92,4 @@ extern const __po_hi_c_ip_conf_t localhost2;
#endif
#endif
\ No newline at end of file
#endif
......@@ -19,7 +19,13 @@ typedef enum {
__po_hi_c_b230400 = 5
} __po_hi_c_Baudrate_T;
flag __po_hi_c_Baudrate_T_Equal(const __po_hi_c_Baudrate_T* pVal1, const __po_hi_c_Baudrate_T* pVal2);
// please use the following macros to avoid breaking code.
#define __po_hi_c_Baudrate_T_b9600 __po_hi_c_b9600
#define __po_hi_c_Baudrate_T_b19200 __po_hi_c_b19200
#define __po_hi_c_Baudrate_T_b38400 __po_hi_c_b38400
#define __po_hi_c_Baudrate_T_b57600 __po_hi_c_b57600
#define __po_hi_c_Baudrate_T_b115200 __po_hi_c_b115200
#define __po_hi_c_Baudrate_T_b230400 __po_hi_c_b230400
void __po_hi_c_Baudrate_T_Initialize(__po_hi_c_Baudrate_T* pVal);
......@@ -30,7 +36,9 @@ typedef enum {
__po_hi_c_odd = 1
} __po_hi_c_Parity_T;
flag __po_hi_c_Parity_T_Equal(const __po_hi_c_Parity_T* pVal1, const __po_hi_c_Parity_T* pVal2);
// please use the following macros to avoid breaking code.
#define __po_hi_c_Parity_T_even __po_hi_c_even
#define __po_hi_c_Parity_T_odd __po_hi_c_odd
void __po_hi_c_Parity_T_Initialize(__po_hi_c_Parity_T* pVal);
......@@ -42,7 +50,6 @@ typedef asn1SccUint __po_hi_c_serial_conf_t_bits;
typedef asn1SccUint __po_hi_c_serial_conf_t_sending_wait;
typedef struct {
__po_hi_c_serial_conf_t_devname devname;
__po_hi_c_Baudrate_T speed;
......@@ -61,25 +68,18 @@ typedef struct {
} __po_hi_c_serial_conf_t;
flag __po_hi_c_serial_conf_t_devname_Equal(const __po_hi_c_serial_conf_t_devname val1, const __po_hi_c_serial_conf_t_devname val2);
flag __po_hi_c_serial_conf_t_bits_Equal(const __po_hi_c_serial_conf_t_bits* pVal1, const __po_hi_c_serial_conf_t_bits* pVal2);
flag __po_hi_c_serial_conf_t_sending_wait_Equal(const __po_hi_c_serial_conf_t_sending_wait* pVal1, const __po_hi_c_serial_conf_t_sending_wait* pVal2);
flag __po_hi_c_serial_conf_t_Equal(const __po_hi_c_serial_conf_t* pVal1, const __po_hi_c_serial_conf_t* pVal2);
void __po_hi_c_serial_conf_t_devname_Initialize(__po_hi_c_serial_conf_t_devname val);
void __po_hi_c_serial_conf_t_bits_Initialize(__po_hi_c_serial_conf_t_bits* pVal);
void __po_hi_c_serial_conf_t_sending_wait_Initialize(__po_hi_c_serial_conf_t_sending_wait* pVal);
void __po_hi_c_serial_conf_t_Initialize(__po_hi_c_serial_conf_t* pVal);
#define ERR_SERIAL_CONF_T 67 /**/
#define ERR_SERIAL_CONF_T_DEVNAME 15 /**/
#define ERR_SERIAL_CONF_T_SPEED 22 /**/
#define ERR_SERIAL_CONF_T_PARITY 33 /**/
#define ERR_SERIAL_CONF_T_BITS 44 /**/
#define ERR_SERIAL_CONF_T_SENDING_WAIT 51 /**/
#define ERR_SERIAL_CONF_T_USE_PARITYBIT 58 /**/
#define ERR_SERIAL_CONF_T_SPEED_2 29 /**/
#define ERR_SERIAL_CONF_T_PARITY_2 41 /**/
#define ERR_SERIAL_CONF_T_BITS 46 /**/
#define ERR_SERIAL_CONF_T_SENDING_WAIT 53 /**/
#define ERR_SERIAL_CONF_T_USE_PARITYBIT 60 /**/
flag __po_hi_c_serial_conf_t_IsConstraintValid(const __po_hi_c_serial_conf_t* pVal, int* pErrCode);
extern const __po_hi_c_serial_conf_t linux_ttyS0;
......@@ -102,4 +102,4 @@ extern const __po_hi_c_serial_conf_t leon_rasta_apburasta1;
#endif
#endif
\ No newline at end of file
#endif
......@@ -13,8 +13,6 @@ extern "C" {
typedef asn1SccUint __po_hi_c_Core_Frequence_T;
flag __po_hi_c_Core_Frequence_T_Equal(const __po_hi_c_Core_Frequence_T* pVal1, const __po_hi_c_Core_Frequence_T* pVal2);
void __po_hi_c_Core_Frequence_T_Initialize(__po_hi_c_Core_Frequence_T* pVal);
#define ERR_CORE_FREQUENCE_T 1 /**/
......@@ -22,8 +20,6 @@ flag __po_hi_c_Core_Frequence_T_IsConstraintValid(const __po_hi_c_Core_Frequence
typedef asn1SccUint __po_hi_c_Node_Addr_T;
flag __po_hi_c_Node_Addr_T_Equal(const __po_hi_c_Node_Addr_T* pVal1, const __po_hi_c_Node_Addr_T* pVal2);
void __po_hi_c_Node_Addr_T_Initialize(__po_hi_c_Node_Addr_T* pVal);
#define ERR_NODE_ADDR_T 8 /**/
......@@ -31,15 +27,12 @@ flag __po_hi_c_Node_Addr_T_IsConstraintValid(const __po_hi_c_Node_Addr_T* pVal,
typedef asn1SccUint __po_hi_c_Clock_Division_T;
flag __po_hi_c_Clock_Division_T_Equal(const __po_hi_c_Clock_Division_T* pVal1, const __po_hi_c_Clock_Division_T* pVal2);
void __po_hi_c_Clock_Division_T_Initialize(__po_hi_c_Clock_Division_T* pVal);
#define ERR_CLOCK_DIVISION_T 15 /**/
flag __po_hi_c_Clock_Division_T_IsConstraintValid(const __po_hi_c_Clock_Division_T* pVal, int* pErrCode);
/*-- __po_hi_c_spacewire_conf_t --------------------------------------------*/
typedef char __po_hi_c_spacewire_conf_t_devname[21];
typedef struct {
__po_hi_c_spacewire_conf_t_devname devname;
__po_hi_c_Node_Addr_T nodeaddr;
......@@ -61,21 +54,18 @@ typedef struct {
} __po_hi_c_spacewire_conf_t;
flag __po_hi_c_spacewire_conf_t_devname_Equal(const __po_hi_c_spacewire_conf_t_devname val1, const __po_hi_c_spacewire_conf_t_devname val2);
flag __po_hi_c_spacewire_conf_t_Equal(const __po_hi_c_spacewire_conf_t* pVal1, const __po_hi_c_spacewire_conf_t* pVal2);
void __po_hi_c_spacewire_conf_t_devname_Initialize(__po_hi_c_spacewire_conf_t_devname val);
void __po_hi_c_spacewire_conf_t_Initialize(__po_hi_c_spacewire_conf_t* pVal);
#define ERR_SPACEWIRE_CONF_T 93 /**/
#define ERR_SPACEWIRE_CONF_T_DEVNAME 22 /**/
#define ERR_SPACEWIRE_CONF_T_NODEADDR 29 /**/
#define ERR_SPACEWIRE_CONF_T_COREFREQ 40 /**/
#define ERR_SPACEWIRE_CONF_T_CLOCKDIV 51 /**/
#define ERR_SPACEWIRE_CONF_T_USE_ROUTER 62 /**/
#define ERR_SPACEWIRE_CONF_T_REMOVE_PROT_ID 69 /**/
#define ERR_SPACEWIRE_CONF_T_RXBLOCK 76 /**/
#define ERR_SPACEWIRE_CONF_T_TXBLOCK 83 /**/
#define ERR_SPACEWIRE_CONF_T_NODEADDR_2 36 /**/
#define ERR_SPACEWIRE_CONF_T_COREFREQ_2 48 /**/
#define ERR_SPACEWIRE_CONF_T_CLOCKDIV_2 60 /**/
#define ERR_SPACEWIRE_CONF_T_USE_ROUTER 65 /**/
#define ERR_SPACEWIRE_CONF_T_REMOVE_PROT_ID 72 /**/
#define ERR_SPACEWIRE_CONF_T_RXBLOCK 79 /**/
#define ERR_SPACEWIRE_CONF_T_TXBLOCK 86 /**/
flag __po_hi_c_spacewire_conf_t_IsConstraintValid(const __po_hi_c_spacewire_conf_t* pVal, int* pErrCode);
extern const __po_hi_c_spacewire_conf_t leon_rasta_spw_sender;
......@@ -94,4 +84,4 @@ extern const __po_hi_c_spacewire_conf_t leon_rasta_spw_receiver;
#endif
#endif
\ No newline at end of file
#endif
......@@ -5,7 +5,7 @@
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2007-2009 Telecom ParisTech, 2010-2018 ESA & ISAE.
* Copyright (C) 2007-2009 Telecom ParisTech, 2010-2020 ESA & ISAE.
*/
#ifndef __PO_HI_COMMON_H__
......
......@@ -130,6 +130,42 @@ int __po_hi_gqueue_next_value(__po_hi_task_id id,
int __po_hi_gqueue_get_count(__po_hi_task_id id,
__po_hi_local_port_t port);
/**
* \brief Compute dispatch condition :
* return 1 when the condition of one of the transitions that stemmed from the next
* complete state is verified (i.e. all its dispatch triggers received events on
* their corresponding ports) else return 0.
* It also sets the index of the transition to execute according to the condition that is
* verified.
*
* \param id thread identifier in the local process.
* \param next_complete_state the struct that contains arrays informations about
* transitions and dispatch triggers of the next complete state.
* \param initial_sizes_of_dispatch_triggers_of_all_transitions array that contains the number of
* events that are pending each dispatch ports of all transitions.
* \param index_transition_to_execute the index of transition to execute,
* this parameter will be set according to the transition whose condition is verified.
*/
__po_hi_bool_t __po_hi_gqueue_compute_index_transition_to_execute (__po_hi_task_id id,
__po_hi_ba_automata_state_t* next_complete_state,
int* initial_sizes_of_dispatch_triggers_of_all_transitions,
__po_hi_int32_t* index_transition_to_execute);
/**
* \brief Wait until all the specified dispatch events (according to the next complete state)
* are received on the corresponding ports for a given thread.
*
* \param id thread identifier in the local process.
* \param next_complete_state the struct that contains arrays informations about
* transitions and dispatch triggers of the next complete state.
* \param index_transition_to_execute the index of transition to execute,
* this parameter will be set according to the transition whose condition is verified.
*/
void __po_hi_gqueue_wait_for_specific_incoming_events (__po_hi_task_id id,
__po_hi_ba_automata_state_t* next_complete_state,
__po_hi_int32_t* index_transition_to_execute);
/**
* \brief Wait until an event is received on any port for a given thread.
*
......
......@@ -104,6 +104,41 @@ typedef enum
__PO_HI_INVALID_PORT_KIND = 50
}__po_hi_port_kind_t;
typedef enum
{
__po_hi_initial,
__po_hi_initial_complete,
__po_hi_initial_complete_final,
__po_hi_initial_final,
__po_hi_complete,
__po_hi_complete_final,
__po_hi_final,
__po_hi_execution
} __po_hi_state_kind_t;
typedef struct
{
__po_hi_int32_t nb_transitions;
__po_hi_int32_t* nb_dispatch_triggers_of_each_transition;
__po_hi_int32_t* dispatch_triggers_of_all_transitions;
__po_hi_int32_t nb_of_all_dispatch_events;
} __po_hi_ba_automata_state_t;
/* __po_hi_vcd_event_kind_t : this type enumerates the different
* kinds of events caught in the vcd trace */
typedef enum
{
__po_hi_task_wait_dispatch,
__po_hi_task_dispatched,
__po_hi_store_in_port_queue,
__po_hi_next_value_port_queue,
} __po_hi_vcd_event_kind_t;
void __po_hi_copy_array (void* dst, void* src, __po_hi_uint32_t size);
#endif /* __PO_HI_TYPES_H_ */
......@@ -25,6 +25,66 @@ unsigned long __po_hi_swap_byte (unsigned long value);
#include <pthread.h>
#include <string.h>
#include <deployment.h>
/* Types used to store the vcd trace */
typedef struct
{
__po_hi_vcd_event_kind_t vcd_event_kind;
uint64_t __po_hi_vcd_trace_timestamp;
__po_hi_task_id task_id;
__po_hi_local_port_t port_id;
__po_hi_port_id_t port_queue_used_size;
} __po_hi_vcd_trace_element_t;
/* __po_hi_vcd_trace_max_nb_events used to reallocate the array
* of the vcd trace */
__po_hi_int32_t __po_hi_vcd_trace_max_nb_events;
/* __po_hi_vcd_trace_array an array containing the vcd trace
* as elements with type __po_hi_vcd_trace_element_t */
__po_hi_vcd_trace_element_t* __po_hi_vcd_trace_array;
/* __po_hi_vcd_trace_array_index is the index of __po_hi_vcd_trace_array
* it should be protected as it is shared between tasks used to
* save a new element in the array*/
__po_hi_int32_t __po_hi_vcd_trace_array_index;
/* mutex used to protect the index __po_hi_vcd_trace_array_index */
pthread_mutex_t __po_hi_vcd_trace_mutex;
/* __po_hi_get_larger_array_for_vcd_trace allows to reallocate a larger
* array to save the vcd trace */
void __po_hi_get_larger_array_for_vcd_trace (void);
/* __po_hi_save_event_in_vcd_trace allows to save an element in
* __po_hi_vcd_trace_array */
void __po_hi_save_event_in_vcd_trace (uint64_t timestamp, __po_hi_vcd_event_kind_t event_kind, __po_hi_task_id task, __po_hi_local_port_t port, __po_hi_port_id_t queue_size);
/* __po_hi_compute_timestamp : returns the actual instant
* based on the __po_hi_vcd_start_t instant. The returned
* value is in (ms) */
uint64_t __po_hi_compute_timestamp (void);
/* __po_hi_vcd_start_t is the start time and it is
* set in the procedure __po_hi_initialize_vcd_trace */
__po_hi_time_t __po_hi_vcd_start_t;
/* __po_hi_signalHandler is a SIGINT signal handler : it is invoked when
* Ctrl-c is pressed in the keyboard to interrupt the execution
* of the application. This handler allows a normal exit
* of the program which enables the invocation
* of the atexit function */
void __po_hi_signalHandler(int signo);
/* __po_hi_signalHandler create the vcd file and fill it
* with the vcd trace saved in __po_hi_vcd_trace_array */
void __po_hi_create_vcd_file(void);
/* __po_hi_initialize_vcd_trace initializes some variables and catches
* the SIGINT signal*/
void __po_hi_initialize_vcd_trace (void);
/* Variable keeping track of whether VCD tracing is enabled or not */
enum tagVCD {
......@@ -35,45 +95,9 @@ enum tagVCD {
void __po_hi_instrumentation_vcd_init (void);
#define __PO_HI_INSTRUMENTATION_VCD_INIT __po_hi_instrumentation_vcd_init ();
#define __PO_HI_INSTRUMENTATION_VCD_WRITE(s, args...) \
{ \
extern enum tagVCD VCD_state; \
if (VCD_state == VCD_ENABLED) { \
extern int __po_hi_vcd_file; \
extern __po_hi_time_t __po_hi_vcd_start_time; \
extern pthread_mutex_t __po_hi_vcd_mutex; \
__po_hi_time_t __po_hi_vcd_current_time; \
char buf[1024]; \
int size_to_write = 0; \
uint64_t st,ct,et = 0; \
\
pthread_mutex_lock (&__po_hi_vcd_mutex); \
\
if (__po_hi_get_time(&__po_hi_vcd_current_time) != __PO_HI_SUCCESS) \
{ \
__DEBUGMSG("[POHIC-INSTRUMENTATION] Could not retrieve time\n"); \
} \
else \
{ \
st = __PO_HI_TIME_TO_US(__po_hi_vcd_start_time); \
ct = __PO_HI_TIME_TO_US(__po_hi_vcd_current_time); \
et = ct - st ; \
memset (buf, '\0', 1024); \
size_to_write = sprintf (buf, "#%llu\n", et); \
write (__po_hi_vcd_file, buf, size_to_write); \
\
memset (buf, '\0', 1024); \
size_to_write = sprintf (buf, s, ##args); \
write (__po_hi_vcd_file, buf, size_to_write); \
} \
pthread_mutex_unlock (&__po_hi_vcd_mutex); \
} \
}
#define __PO_HI_INITIALIZE_VCD_TRACE __po_hi_initialize_vcd_trace ();
#else
#define __PO_HI_INSTRUMENTATION_VCD_WRITE(s, args...)
#define __PO_HI_INSTRUMENTATION_VCD_INIT
#define __PO_HI_INITIALIZE_VCD_TRACE
#endif
#endif /* __PO_HI_UTILS_H__ */
......@@ -10,7 +10,7 @@ MANAGERS = all
LIBS = -lrtemsall -lc
# PolyORb-HI/C specific flags
POHI_CFLAGS = -DRTEMS_POSIX -DLEON_RTEMS $(GCC_GENERIC_FLAGS)
POHI_CFLAGS = -DRTEMS_POSIX -DLEON_RTEMS $(GCC_GENERIC_FLAGS) -Wl,--wrap=printf -Wl,--wrap=puts -Wl,--wrap=putchar
# RTEMS/AIR specific flags
POHI_CFLAGS += -DAIR_HYPERVISOR -I$(AIR_ROOT)/pmk/core/include \
......@@ -23,9 +23,9 @@ $(AIR_LIBS)/libair/libair.a $(AIR_LIBS)/imaspex/imaspex.a
LINK_LIBS += $(AIR_LIBS)/libprintf/libprintf.a \
$(AIR_LIBS)/libair/libair.a $(AIR_LIBS)/imaspex/imaspex.a
-include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
-include $(RTEMS_CUSTOM)
-include $(PROJECT_ROOT)/make/leaf.cfg
include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
include $(RTEMS_CUSTOM)
include $(PROJECT_ROOT)/make/leaf.cfg
CPPFLAGS += -DAIR_HYPERVISOR./ -I./ -B./ -I../common/ -B../common/ -B$(AIR_LIBS)/libprintf/ -B$(AIR_LIBS)/libair/
......@@ -97,14 +97,11 @@ EXTERNAL_OBJECTS+=po_hi_gprof_rtems_leon.o
TARGET_INCLUDE+=-I$(RTEMS_MAKEFILE_PATH)/lib/include/
target-objects:
$(CC) $(INCLUDE) $(TARGET_INCLUDE) -D__PO_HI_USE_GPROF -Wall -c -o po_hi_gprof_rtems_leon.o $(RUNTIME_PATH)/src/po_hi_gprof_rtems_leon.c
$(CC) $(INCLUDE) $(TARGET_INCLUDE) -D__PO_HI_USE_GPROF -Wall -c -o po_hi_gprof_rtems_leon.o $(RUNTIME_PATH)/src/po_hi_gprof_rtems_leon.c
else
target-objects:
endif
LINK_LIBS+=-lm
emulate-qemu: $(BINARY)
qemu-system-sparc -M at697 -nographic -kernel $(BINARY).exe
target-clean:
/*
* This is a part of PolyORB-HI-C distribution, a minimal
* middleware written for generated code from AADL models.
* You should use it with the Ocarina toolsuite.
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2020 ESA & ISAE.
*/
/* Note, this file is from RCC1.3rc4 sample directory.
*
* Any modification there should be carefully weighted.
......
/*
* This is a part of PolyORB-HI-C distribution, a minimal
* middleware written for generated code from AADL models.
* You should use it with the Ocarina toolsuite.
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2020 ESA & ISAE.
*/
/* Note, this file is from RCC1.3rc4 sample directory.
*
* Any modification there should be carefully weighted.
......
/*
* This is a part of PolyORB-HI-C distribution, a minimal
* middleware written for generated code from AADL models.
* You should use it with the Ocarina toolsuite.
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2020 ESA & ISAE.
*/
#include <bsp/gr_leon4_n2x.h>
// Things are always moving around in RTEMS - adapt.
......
......@@ -5,19 +5,16 @@ Code automatically generated by asn1scc tool
#include <limits.h>
#include <string.h>
#include <math.h>
#include "1553.h"
#include "1553.h"
flag __po_hi_c_Node_Addr_T_Equal(const __po_hi_c_Node_Addr_T* pVal1, const __po_hi_c_Node_Addr_T* pVal2)
{
return (*(pVal1)) == (*(pVal2));
}
void __po_hi_c_Node_Addr_T_Initialize(__po_hi_c_Node_Addr_T* pVal)
{
(void)pVal;
(*(pVal)) = 0;
}
......@@ -25,23 +22,20 @@ void __po_hi_c_Node_Addr_T_Initialize(__po_hi_c_Node_Addr_T* pVal)
flag __po_hi_c_Node_Addr_T_IsConstraintValid(const __po_hi_c_Node_Addr_T* pVal, int* pErrCode)
{
flag ret = TRUE;
(void)pVal;
ret = ((*(pVal)) <= 31UL);
*pErrCode = ret ? 0 : ERR_NODE_ADDR_T;
*pErrCode = ret ? 0 : ERR_NODE_ADDR_T;
return ret;
}
flag __po_hi_c_Standard_T_Equal(const __po_hi_c_Standard_T* pVal1, const __po_hi_c_Standard_T* pVal2)
{
return (*(pVal1)) == (*(pVal2));
}
void __po_hi_c_Standard_T_Initialize(__po_hi_c_Standard_T* pVal)
{
(void)pVal;
(*(pVal)) = __po_hi_c_mil1553a;
}
......@@ -49,23 +43,20 @@ void __po_hi_c_Standard_T_Initialize(__po_hi_c_Standard_T* pVal)
flag __po_hi_c_Standard_T_IsConstraintValid(const __po_hi_c_Standard_T* pVal, int* pErrCode)
{
flag ret = TRUE;
(void)pVal;
ret = ((((*(pVal)) == __po_hi_c_mil1553a)) || (((*(pVal)) == __po_hi_c_mil1553b)));
*pErrCode = ret ? 0 : ERR_STANDARD_T;
*pErrCode = ret ? 0 : ERR_STANDARD_T;
return ret;
}
flag __po_hi_c_Mode_T_Equal(const __po_hi_c_Mode_T* pVal1, const __po_hi_c_Mode_T* pVal2)
{
return (*(pVal1)) == (*(pVal2));
}
void __po_hi_c_Mode_T_Initialize(__po_hi_c_Mode_T* pVal)
{
(void)pVal;
(*(pVal)) = __po_hi_c_controller;
}
......@@ -73,23 +64,20 @@ void __po_hi_c_Mode_T_Initialize(__po_hi_c_Mode_T* pVal)
flag __po_hi_c_Mode_T_IsConstraintValid(const __po_hi_c_Mode_T* pVal, int* pErrCode)
{
flag ret = TRUE;
(void)pVal;
ret = ((((((*(pVal)) == __po_hi_c_controller)) || (((*(pVal)) == __po_hi_c_terminal)))) || (((*(pVal)) == __po_hi_c_monitor)));
*pErrCode = ret ? 0 : ERR_MODE_T;
*pErrCode = ret ? 0 : ERR_MODE_T;
return ret;
}
flag __po_hi_c_Bus_T_Equal(const __po_hi_c_Bus_T* pVal1, const __po_hi_c_Bus_T* pVal2)
{
return (*(pVal1)) == (*(pVal2));
}
void __po_hi_c_Bus_T_Initialize(__po_hi_c_Bus_T* pVal)
{
(void)pVal;
(*(pVal)) = __po_hi_c_none;
}
......@@ -97,73 +85,28 @@ void __po_hi_c_Bus_T_Initialize(__po_hi_c_Bus_T* pVal)
flag __po_hi_c_Bus_T_IsConstraintValid(const __po_hi_c_Bus_T* pVal, int* pErrCode)
{
flag ret = TRUE;
(void)pVal;
ret = ((((((((*(pVal)) == __po_hi_c_none)) || (((*(pVal)) == __po_hi_c_bus_a)))) || (((*(pVal)) == __po_hi_c_bus_b)))) || (((*(pVal)) == __po_hi_c_both)));
*pErrCode = ret ? 0 : ERR_BUS_T;
*pErrCode = ret ? 0 : ERR_BUS_T;
return ret;
}
flag __po_hi_c_mil_1553_conf_t_devname_Equal(const __po_hi_c_mil_1553_conf_t_devname val1, const __po_hi_c_mil_1553_conf_t_devname val2)
{
return strcmp(val1, val2) == 0;
}
flag __po_hi_c_mil_1553_conf_t_Equal(const __po_hi_c_mil_1553_conf_t* pVal1, const __po_hi_c_mil_1553_conf_t* pVal2)
{
flag ret=TRUE;
ret = __po_hi_c_mil_1553_conf_t_devname_Equal(pVal1->devname, pVal2->devname);
if (ret) {
ret = (pVal1->standard == pVal2->standard);
if (ret) {
ret = (pVal1->mode == pVal2->mode);
if (ret) {
ret = (pVal1->bus == pVal2->bus);
if (ret) {
ret = (pVal1->termaddr == pVal2->termaddr);
if (ret) {
ret = (pVal1->broadcast == pVal2->broadcast);
if (ret) {
ret = (pVal1->exist.rxblock == pVal2->exist.rxblock);
if (ret && pVal1->exist.rxblock) {
ret = (pVal1->rxblock == pVal2->rxblock);
}
if (ret) {
ret = (pVal1->exist.txblock == pVal2->exist.txblock);
if (ret && pVal1->exist.txblock) {
ret = (pVal1->txblock == pVal2->txblock);
}
}
}
}
}
}
}
}
return ret;
}
void __po_hi_c_mil_1553_conf_t_devname_Initialize(__po_hi_c_mil_1553_conf_t_devname val)
{
(void)val;
memset(val, 0x0, 21);
}
void __po_hi_c_mil_1553_conf_t_Initialize(__po_hi_c_mil_1553_conf_t* pVal)
{
(void)pVal;
/*set devname */
......@@ -186,40 +129,21 @@ void __po_hi_c_mil_1553_conf_t_Initialize(__po_hi_c_mil_1553_conf_t* pVal)
pVal->txblock = FALSE;
}
flag __po_hi_c_mil_1553_conf_t_IsConstraintValid(const __po_hi_c_mil_1553_conf_t *pVal, int* pErrCode)
flag __po_hi_c_mil_1553_conf_t_IsConstraintValid(const __po_hi_c_mil_1553_conf_t* pVal, int* pErrCode)
{
flag ret = TRUE;
(void)pVal;
ret = ((1 <= strlen(pVal->devname)) && (strlen(pVal->devname) <= 20));
*pErrCode = ret ? 0 : ERR_MIL_1553_CONF_T_DEVNAME;
*pErrCode = ret ? 0 : ERR_MIL_1553_CONF_T_DEVNAME;
if (ret) {
ret = (((pVal->standard == __po_hi_c_mil1553a)) || ((pVal->standard == __po_hi_c_mil1553b)));
*pErrCode = ret ? 0 : ERR_MIL_1553_CONF_T_STANDARD;
ret = __po_hi_c_Standard_T_IsConstraintValid((&(pVal->standard)), pErrCode);
if (ret) {
ret = (((((pVal->mode == __po_hi_c_controller)) || ((pVal->mode == __po_hi_c_terminal)))) || ((pVal->mode == __po_hi_c_monitor)));
*pErrCode = ret ? 0 : ERR_MIL_1553_CONF_T_MODE;
ret = __po_hi_c_Mode_T_IsConstraintValid((&(pVal->mode)), pErrCode);
if (ret) {
ret = (((((((pVal->bus == __po_hi_c_none)) || ((pVal->bus == __po_hi_c_bus_a)))) || ((pVal->bus == __po_hi_c_bus_b)))) || ((pVal->bus == __po_hi_c_both)));
*pErrCode = ret ? 0 : ERR_MIL_1553_CONF_T_BUS;
ret = __po_hi_c_Bus_T_IsConstraintValid((&(pVal->bus)), pErrCode);
if (ret) {
ret = (pVal->termaddr <= 31UL);
*pErrCode = ret ? 0 : ERR_MIL_1553_CONF_T_TERMADDR;
if (ret) {
ret = TRUE;
*pErrCode = ret ? 0 : ERR_MIL_1553_CONF_T_BROADCAST;
if (ret) {
if (pVal->exist.rxblock) {
ret = TRUE;
*pErrCode = ret ? 0 : ERR_MIL_1553_CONF_T_RXBLOCK;
}
if (ret) {
if (pVal->exist.txblock) {
ret = TRUE;
*pErrCode = ret ? 0 : ERR_MIL_1553_CONF_T_TXBLOCK;
}
}
}
}
ret = __po_hi_c_Node_Addr_T_IsConstraintValid((&(pVal->termaddr)), pErrCode);
}
}
}
......
AUTOMAKE_OPTIONS = no-dependencies
C_FILES = $(srcdir)/1553.c \
$(srcdir)/ip.c \
$(srcdir)/serial.c \
$(srcdir)/spacewire.c \
$(srcdir)/bluetooth.c
ASN_FILES = $(srcdir)/1553.asn \
$(srcdir)/ip.asn \
$(srcdir)/serial.asn \
$(srcdir)/spacewire.asn \
$(srcdir)/bluetooth.asn
C_FILES = $(srcdir)/1553.c $(srcdir)/ip.c $(srcdir)/serial.c \
$(srcdir)/spacewire.c $(srcdir)/bluetooth.c
ASN_FILES = $(srcdir)/1553.asn $(srcdir)/ip.asn $(srcdir)/serial.asn \
$(srcdir)/spacewire.asn $(srcdir)/bluetooth.asn
csrc = ${shell $(CYGPATH_U) '$(OCARINA_RUNTIME)/polyorb-hi-c/src/drivers/configuration'}
$(srcdir)/1553.c:
mono $$(which asn1.exe) -c -typePrefix __po_hi_c_ 1553.asn
mono $(shell which asn1.exe) -c -typePrefix __po_hi_c_ 1553.asn
sed -e 's/Mil\_1553\_Conf\_T/mil\_1553\_conf\_t/g' 1553.h > 1553new.h
mv 1553new.h 1553.h
echo "#if (defined (__PO_HI_NEED_DRIVER_1553_RASTA))\n" > 1553new.c
......@@ -27,7 +20,7 @@ $(srcdir)/1553.c:
mv asn1crt.h ../../../include/drivers/configuration/
$(srcdir)/spacewire.c:
mono $$(which asn1.exe) -c -typePrefix __po_hi_c_ spacewire.asn
mono $(shell which asn1.exe) -c -typePrefix __po_hi_c_ spacewire.asn
sed -e 's/Spacewire\_Conf\_T/spacewire\_conf\_t/g' spacewire.h > spacewirenew.h
mv spacewirenew.h spacewire.h
echo "#if (defined (__PO_HI_NEED_DRIVER_SPACEWIRE_RASTA))\n" > spacewirenew.c
......@@ -38,7 +31,7 @@ $(srcdir)/spacewire.c:
mv asn1crt.h ../../../include/drivers/configuration/
$(srcdir)/ip.c:
mono $$(which asn1.exe) -c -typePrefix __po_hi_c_ ip.asn
mono $(shell which asn1.exe) -c -typePrefix __po_hi_c_ ip.asn
mv asn1crt.h ../../../include/drivers/configuration/
sed -e 's/IP\_Conf\_T/ip\_conf\_t/g' ip.h > ipnew.h
mv ipnew.h ip.h
......@@ -49,7 +42,7 @@ $(srcdir)/ip.c:
mv ip.h ../../../include/drivers/configuration/
$(srcdir)/serial.c:
mono $$(which asn1.exe) -c -typePrefix __po_hi_c_ serial.asn
mono $(shell which asn1.exe) -c -typePrefix __po_hi_c_ serial.asn
sed -e 's/Serial\_Conf\_T/serial\_conf\_t/g' serial.h > serialnew.h
mv serialnew.h serial.h
echo "#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" > serialnew.c
......
#include <string.h>
#include <assert.h>
#include <math.h>
#include <float.h>
#include "asn1crt.h"
#if WORD_SIZE==8
const asn1SccUint64 ber_aux[] = {
0xFF,
0xFF00,
0xFF0000,
0xFF000000,
0xFF00000000ULL,
0xFF0000000000ULL,
0xFF000000000000ULL,
0xFF00000000000000ULL };
#else
const asn1SccUint32 ber_aux[] = {
0xFF,
0xFF00,
0xFF0000,
0xFF000000 };
#endif
asn1SccUint int2uint(asn1SccSint v) {
asn1SccUint ret = 0;
if (v < 0) {
ret = (asn1SccUint)(-v - 1);
ret = ~ret;
}
else {
ret = (asn1SccUint)v;
};
return ret;
}
asn1SccSint uint2int(asn1SccUint v, int uintSizeInBytes) {
int i;
asn1SccUint tmp = 0x80;
flag bIsNegative = (v & (tmp << ((uintSizeInBytes - 1) * 8)))>0;
if (!bIsNegative)
return (asn1SccSint)v;
for (i = WORD_SIZE - 1; i >= uintSizeInBytes; i--)
v |= ber_aux[i];
return -(asn1SccSint)(~v) - 1;
}
int GetCharIndex(char ch, byte Set[], int setLen)
{
int i=0;
for(i=0; i<setLen; i++)
if (ch == Set[i])
return i;
return 0;
}
/*
####### ###
# # ##### # ###### #### ##### # ##### ###### # # ##### # ###### # ###### #####
# # # # # # # # # # # # # ## # # # # # # # #
# # ##### # ##### # # # # # ##### # # # # # ##### # ##### # #
# # # # # # # # # # # # # # # # # # # # #####
# # # # # # # # # # # # # # # ## # # # # # # #
####### ##### #### ###### #### # ### ##### ###### # # # # # # ###### # #
Object Identifier
*/
void ObjectIdentifier_Init(Asn1ObjectIdentifier *pVal) {
int i;
for (i = 0; i < OBJECT_IDENTIFIER_MAX_LENGTH; i++) {
pVal->values[i] = 0;
}
pVal->nCount = 0;
}
flag ObjectIdentifier_isValid(const Asn1ObjectIdentifier *pVal) {
return (pVal->nCount >= 2) && (pVal->values[0] <= 2) && (pVal->values[1] <= 39);
}
flag RelativeOID_isValid(const Asn1ObjectIdentifier *pVal) {
return pVal->nCount > 0;
}
flag ObjectIdentifier_equal(const Asn1ObjectIdentifier *pVal1, const Asn1ObjectIdentifier *pVal2) {
int i;
if ((pVal1 != NULL) && (pVal2 != NULL) && pVal1->nCount == pVal2->nCount && pVal1->nCount <= OBJECT_IDENTIFIER_MAX_LENGTH) {
flag ret = true;
for (i = 0; i < pVal1->nCount && ret; i++)
{
ret = (pVal1->values[i] == pVal2->values[i]);
}
return ret;
}
else {
return FALSE;
}
}
......@@ -5,9 +5,10 @@ Code automatically generated by asn1scc tool
#include <limits.h>
#include <string.h>
#include <math.h>
#include "bluetooth.h"
#include "bluetooth.h"
const __po_hi_c_bluetooth_conf_t crazyflie_default = {
.channel = 80,
.datarate = __po_hi_c_d2M,
......@@ -27,14 +28,10 @@ const __po_hi_c_bluetooth_conf_t crazyflie_default = {
};
flag __po_hi_c_Datarate_T_Equal(const __po_hi_c_Datarate_T* pVal1, const __po_hi_c_Datarate_T* pVal2)
{
return (*(pVal1)) == (*(pVal2));
}
void __po_hi_c_Datarate_T_Initialize(__po_hi_c_Datarate_T* pVal)
{
(void)pVal;
(*(pVal)) = __po_hi_c_d250K;
}
......@@ -42,67 +39,50 @@ void __po_hi_c_Datarate_T_Initialize(__po_hi_c_Datarate_T* pVal)
flag __po_hi_c_Datarate_T_IsConstraintValid(const __po_hi_c_Datarate_T* pVal, int* pErrCode)
{
flag ret = TRUE;
(void)pVal;
ret = ((((((*(pVal)) == __po_hi_c_d250K)) || (((*(pVal)) == __po_hi_c_d1M)))) || (((*(pVal)) == __po_hi_c_d2M)));
*pErrCode = ret ? 0 : ERR_DATARATE_T;
*pErrCode = ret ? 0 : ERR_DATARATE_T;
return ret;
}
flag __po_hi_c_Address_T_Equal(const __po_hi_c_Address_T* pVal1, const __po_hi_c_Address_T* pVal2)
{
return memcmp(pVal1->arr, pVal2->arr, 5) ==0 ;
}
void __po_hi_c_Address_T_Initialize(__po_hi_c_Address_T* pVal)
{
memset(pVal->arr, 0x0, 5);
}
(void)pVal;
memset(pVal->arr, 0x0, 5);
flag __po_hi_c_bluetooth_conf_t_channel_Equal(const __po_hi_c_bluetooth_conf_t_channel* pVal1, const __po_hi_c_bluetooth_conf_t_channel* pVal2)
{
return (*(pVal1)) == (*(pVal2));
}
flag __po_hi_c_bluetooth_conf_t_Equal(const __po_hi_c_bluetooth_conf_t* pVal1, const __po_hi_c_bluetooth_conf_t* pVal2)
flag __po_hi_c_Address_T_IsConstraintValid(const __po_hi_c_Address_T* pVal, int* pErrCode)
{
flag ret=TRUE;
ret = __po_hi_c_bluetooth_conf_t_channel_Equal((&(pVal1->channel)), (&(pVal2->channel)));
if (ret) {
ret = (pVal1->exist.datarate == pVal2->exist.datarate);
if (ret && pVal1->exist.datarate) {
ret = (pVal1->datarate == pVal2->datarate);
}
if (ret) {
ret = (pVal1->exist.address == pVal2->exist.address);
if (ret && pVal1->exist.address) {
ret = __po_hi_c_Address_T_Equal((&(pVal1->address)), (&(pVal2->address)));
}
flag ret = TRUE;
(void)pVal;
ret = TRUE;
*pErrCode = 0;
}
}
return ret;
}
void __po_hi_c_bluetooth_conf_t_channel_Initialize(__po_hi_c_bluetooth_conf_t_channel* pVal)
{
(void)pVal;
(*(pVal)) = 0;
}
void __po_hi_c_bluetooth_conf_t_Initialize(__po_hi_c_bluetooth_conf_t* pVal)
{
(void)pVal;
/*set channel */
......@@ -119,16 +99,21 @@ void __po_hi_c_bluetooth_conf_t_Initialize(__po_hi_c_bluetooth_conf_t* pVal)
pVal->address.arr[4] = 0xe7;
}
flag __po_hi_c_bluetooth_conf_t_IsConstraintValid(const __po_hi_c_bluetooth_conf_t *pVal, int* pErrCode)
flag __po_hi_c_bluetooth_conf_t_IsConstraintValid(const __po_hi_c_bluetooth_conf_t* pVal, int* pErrCode)
{
flag ret = TRUE;
(void)pVal;
ret = (pVal->channel <= 125UL);
*pErrCode = ret ? 0 : ERR_BLUETOOTH_CONF_T_CHANNEL;
*pErrCode = ret ? 0 : ERR_BLUETOOTH_CONF_T_CHANNEL;
if (ret) {
if (pVal->exist.datarate) {
ret = (((((pVal->datarate == __po_hi_c_d250K)) || ((pVal->datarate == __po_hi_c_d1M)))) || ((pVal->datarate == __po_hi_c_d2M)));
*pErrCode = ret ? 0 : ERR_BLUETOOTH_CONF_T_DATARATE;
ret = __po_hi_c_Datarate_T_IsConstraintValid((&(pVal->datarate)), pErrCode);
}
if (ret) {
if (pVal->exist.address) {
ret = __po_hi_c_Address_T_IsConstraintValid((&(pVal->address)), pErrCode);
}
}
}
......
......@@ -5,9 +5,10 @@ Code automatically generated by asn1scc tool
#include <limits.h>
#include <string.h>
#include <math.h>
#include "ip.h"
#include "ip.h"
const __po_hi_c_ip_conf_t localhost1 = {
.devname = "eth0",
.address = "127.0.0.1",
......@@ -36,14 +37,10 @@ const __po_hi_c_ip_conf_t localhost2 = {
};
flag __po_hi_c_Port_T_Equal(const __po_hi_c_Port_T* pVal1, const __po_hi_c_Port_T* pVal2)
{
return (*(pVal1)) == (*(pVal2));
}
void __po_hi_c_Port_T_Initialize(__po_hi_c_Port_T* pVal)
{
(void)pVal;
(*(pVal)) = 0;
}
......@@ -51,23 +48,20 @@ void __po_hi_c_Port_T_Initialize(__po_hi_c_Port_T* pVal)
flag __po_hi_c_Port_T_IsConstraintValid(const __po_hi_c_Port_T* pVal, int* pErrCode)
{
flag ret = TRUE;
(void)pVal;
ret = ((*(pVal)) <= 16535UL);
*pErrCode = ret ? 0 : ERR_PORT_T;
*pErrCode = ret ? 0 : ERR_PORT_T;
return ret;
}
flag __po_hi_c_Version_T_Equal(const __po_hi_c_Version_T* pVal1, const __po_hi_c_Version_T* pVal2)
{
return (*(pVal1)) == (*(pVal2));
}
void __po_hi_c_Version_T_Initialize(__po_hi_c_Version_T* pVal)
{
(void)pVal;
(*(pVal)) = __po_hi_c_ipv4;
}
......@@ -75,142 +69,68 @@ void __po_hi_c_Version_T_Initialize(__po_hi_c_Version_T* pVal)
flag __po_hi_c_Version_T_IsConstraintValid(const __po_hi_c_Version_T* pVal, int* pErrCode)
{
flag ret = TRUE;
(void)pVal;
ret = ((((*(pVal)) == __po_hi_c_ipv4)) || (((*(pVal)) == __po_hi_c_ipv6)));
*pErrCode = ret ? 0 : ERR_VERSION_T;
*pErrCode = ret ? 0 : ERR_VERSION_T;
return ret;
}
flag __po_hi_c_ip_conf_t_devname_Equal(const __po_hi_c_ip_conf_t_devname val1, const __po_hi_c_ip_conf_t_devname val2)
{
return strcmp(val1, val2) == 0;
}
flag __po_hi_c_ip_conf_t_address_Equal(const __po_hi_c_ip_conf_t_address val1, const __po_hi_c_ip_conf_t_address val2)
{
return strcmp(val1, val2) == 0;
}
flag __po_hi_c_ip_conf_t_broadcast_Equal(const __po_hi_c_ip_conf_t_broadcast val1, const __po_hi_c_ip_conf_t_broadcast val2)
{
return strcmp(val1, val2) == 0;
}
flag __po_hi_c_ip_conf_t_netmask_Equal(const __po_hi_c_ip_conf_t_netmask val1, const __po_hi_c_ip_conf_t_netmask val2)
{
return strcmp(val1, val2) == 0;
}
flag __po_hi_c_ip_conf_t_gateway_Equal(const __po_hi_c_ip_conf_t_gateway val1, const __po_hi_c_ip_conf_t_gateway val2)
{
return strcmp(val1, val2) == 0;
}
flag __po_hi_c_ip_conf_t_dns_Equal(const __po_hi_c_ip_conf_t_dns val1, const __po_hi_c_ip_conf_t_dns val2)
{
return strcmp(val1, val2) == 0;
}
flag __po_hi_c_ip_conf_t_Equal(const __po_hi_c_ip_conf_t* pVal1, const __po_hi_c_ip_conf_t* pVal2)
{
flag ret=TRUE;
ret = __po_hi_c_ip_conf_t_devname_Equal(pVal1->devname, pVal2->devname);
if (ret) {
ret = __po_hi_c_ip_conf_t_address_Equal(pVal1->address, pVal2->address);
if (ret) {
ret = (pVal1->exist.broadcast == pVal2->exist.broadcast);
if (ret && pVal1->exist.broadcast) {
ret = __po_hi_c_ip_conf_t_broadcast_Equal(pVal1->broadcast, pVal2->broadcast);
}
if (ret) {
ret = (pVal1->exist.netmask == pVal2->exist.netmask);
if (ret && pVal1->exist.netmask) {
ret = __po_hi_c_ip_conf_t_netmask_Equal(pVal1->netmask, pVal2->netmask);
}
if (ret) {
ret = (pVal1->exist.gateway == pVal2->exist.gateway);
if (ret && pVal1->exist.gateway) {
ret = __po_hi_c_ip_conf_t_gateway_Equal(pVal1->gateway, pVal2->gateway);
}
if (ret) {
ret = (pVal1->exist.dns == pVal2->exist.dns);
if (ret && pVal1->exist.dns) {
ret = __po_hi_c_ip_conf_t_dns_Equal(pVal1->dns, pVal2->dns);
}
if (ret) {
ret = (pVal1->exist.version == pVal2->exist.version);
if (ret && pVal1->exist.version) {
ret = (pVal1->version == pVal2->version);
}
if (ret) {
ret = (pVal1->port == pVal2->port);
}
}
}
}
}
}
}
return ret;
}
void __po_hi_c_ip_conf_t_devname_Initialize(__po_hi_c_ip_conf_t_devname val)
{
(void)val;
memset(val, 0x0, 21);
}
void __po_hi_c_ip_conf_t_address_Initialize(__po_hi_c_ip_conf_t_address val)
{
(void)val;
memset(val, 0x0, 41);
}
void __po_hi_c_ip_conf_t_broadcast_Initialize(__po_hi_c_ip_conf_t_broadcast val)
{