Commit 88f18654 authored by jhugues's avatar jhugues
Browse files

* Update example to use ASN.1 configuration variables



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-ada@2553 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent ff8f22a3
pragma Style_Checks (Off); -- turn off style checks
WITH Interfaces;
USE Interfaces;
WITH Unchecked_Conversion;
PACKAGE AdaAsn1RTL IS
TYPE BIT IS mod 2**1;
TYPE BitArray IS ARRAY (Natural RANGE <>) OF BIT;
for BitArray'Component_Size use 1;
pragma Pack(BitArray);
TYPE OctetBuffer IS ARRAY (Natural RANGE <>) OF Unsigned_8;
TYPE OctetBuffer_Ptr IS ACCESS ALL OctetBuffer;
SUBTYPE Asn1Int IS Long_Long_Integer;
SUBTYPE Asn1UInt IS Unsigned_64;
MSBIT_ONE : CONSTANT Asn1UInt := 2**(Asn1UInt'SIZE - 1);
MSBYTE_FF : CONSTANT Asn1UInt := Shift_Left(Asn1UInt(16#FF#), Asn1UInt'Size-8);
TYPE Asn1SccSint IS NEW Asn1Int;
SUBTYPE Octet IS BitArray(1..8);
SUBTYPE Asn1Real IS LONG_Float;
MantissaFactor : Asn1Real:=Asn1Real(Unsigned_64(2)**Asn1Real'Machine_Mantissa);
TYPE OctetArray4 IS NEW OctetBuffer(1..4);
TYPE OctetArray8 IS NEW OctetBuffer(1..8);
TYPE Asn1Boolean IS NEW Boolean;
FOR Asn1Boolean'SIZE USE 32;
SUBTYPE Flag IS Asn1Boolean;
TYPE Asn1NullType IS NEW Character range Character'Val(0)..Character'Val(0);
ERR_INSUFFICIENT_DATA : CONSTANT INTEGER := 101;
ERR_INCORRECT_PER_STREAM : CONSTANT INTEGER := 102;
ERR_INVALID_CHOICE_ALTERNATIVE : CONSTANT INTEGER := 103;
ERR_INCORRECT_STREAM : CONSTANT INTEGER := 104;
ERR_INVALID_BER_FILE : CONSTANT INTEGER := 201;
ERR_BER_LENGTH_MISMATCH : CONSTANT INTEGER := 202;
ERR_BER_TAG_MISMATCH : CONSTANT INTEGER := 203;
GENERIC
MAX : POSITIVE;
PACKAGE BIT_STRING_PACKAGE IS
TYPE BIT_STRING IS
RECORD
Length : Integer;
Data : BitArray (1 .. MAX);
END RECORD;
TYPE FIXED_BIT_STRING IS
RECORD
Data : BitArray (1 .. MAX);
END RECORD;
END BIT_STRING_PACKAGE;
TYPE ASN1_RESULT IS
RECORD
Success : Boolean;
ErrorCode : INTEGER := 0;
END RECORD;
TYPE BitStream
(N : Integer) IS
RECORD
CurrentBit : Natural :=1;
Data : BitArray (1 .. N) := (1..N=>0);
END RECORD;
-- nBits 1 .. 7
GENERIC
MAX : POSITIVE;
TYPE ELEMENT IS PRIVATE;
PACKAGE SEQUENCE_OF_PACKAGE IS
TYPE LIST IS ARRAY (Positive RANGE 1 .. MAX) OF ELEMENT;
TYPE SEQUENCE_OF IS
RECORD
Length : Integer;
Data : LIST;
END RECORD;
TYPE FIXED_SEQUENCE_OF IS
RECORD
Data : LIST;
END RECORD;
END SEQUENCE_OF_PACKAGE;
END AdaAsn1RTL;
-- Code automatically generated by asn1scc tool
-- Date was: 04/12/2011
-- Time was: 18:51:28
WITH Ada.Strings.Fixed;
USE ADA.Strings.Fixed;
WITH Interfaces;
USE Interfaces;
WITH Ada.Characters.latin_1;
WITH AdaAsn1RTL;
USE AdaAsn1RTL;
with POHICDRIVER_UART;
use POHICDRIVER_UART;
package DeviceConfig_serialleon_obj179 is
pohidrv_serialleon_obj179_cv:aliased Serial_Conf_T:=(devname => "/dev/apburasta0" & 5*Character'Val(0) & Character'Val(0),
speed => b38400,
parity => even,
bits => 7,
use_paritybit => FALSE,
exist => (speed => 1, parity => 0, bits => 0, use_paritybit => 0));
--END;
end DeviceConfig_serialleon_obj179;
pragma Style_Checks (Off); -- turn off style checks
-- Code automatically generated by asn1scc tool
-- Date was: 04/28/2011
-- Time was: 13:55:57
WITH Ada.Strings.Fixed;
USE ADA.Strings.Fixed;
WITH Interfaces;
USE Interfaces;
WITH Ada.Characters.latin_1;
WITH AdaAsn1RTL;
USE AdaAsn1RTL;
with POHICDRIVER_UART;
use POHICDRIVER_UART;
package DeviceConfig_serialleon_obj223 is
pohidrv_serialleon_obj223_cv:aliased Serial_Conf_T:=(devname => "/dev/apburasta0" & 5*Character'Val(0) & Character'Val(0),
speed => b38400,
parity => even,
bits => 7,
use_paritybit => FALSE,
exist => (speed => 1, parity => 0, bits => 0, use_paritybit => 0));
--END;
end DeviceConfig_serialleon_obj223;
pragma Style_Checks (Off); -- turn off style checks
-- Code automatically generated by asn1scc tool
-- Date was: 04/28/2011
-- Time was: 13:55:57
WITH Ada.Strings.Fixed;
USE ADA.Strings.Fixed;
WITH Interfaces;
USE Interfaces;
WITH Ada.Characters.latin_1;
WITH AdaAsn1RTL;
USE AdaAsn1RTL;
package POHICDRIVER_SPACEWIRE is
SUBTYPE Core_Frequence_T IS Asn1Int;
Core_Frequence_T_REQUIRED_BYTES_FOR_ENCODING:CONSTANT INTEGER := 4;
Core_Frequence_T_REQUIRED_BITS_FOR_ENCODING:CONSTANT INTEGER := 32;
Core_Frequence_T_REQUIRED_BYTES_FOR_ACN_ENCODING:CONSTANT INTEGER := 4;
Core_Frequence_T_REQUIRED_BITS_FOR_ACN_ENCODING:CONSTANT INTEGER := 32;
ERR_Core_Frequence_T:CONSTANT INTEGER := 1000; -- (0..4294967295)
SUBTYPE Node_Addr_T IS Asn1Int;
Node_Addr_T_REQUIRED_BYTES_FOR_ENCODING:CONSTANT INTEGER := 1;
Node_Addr_T_REQUIRED_BITS_FOR_ENCODING:CONSTANT INTEGER := 8;
Node_Addr_T_REQUIRED_BYTES_FOR_ACN_ENCODING:CONSTANT INTEGER := 1;
Node_Addr_T_REQUIRED_BITS_FOR_ACN_ENCODING:CONSTANT INTEGER := 8;
ERR_Node_Addr_T:CONSTANT INTEGER := 1001; -- (0..255)
SUBTYPE Clock_Division_T IS Asn1Int;
Clock_Division_T_REQUIRED_BYTES_FOR_ENCODING:CONSTANT INTEGER := 1;
Clock_Division_T_REQUIRED_BITS_FOR_ENCODING:CONSTANT INTEGER := 8;
Clock_Division_T_REQUIRED_BYTES_FOR_ACN_ENCODING:CONSTANT INTEGER := 1;
Clock_Division_T_REQUIRED_BITS_FOR_ACN_ENCODING:CONSTANT INTEGER := 8;
ERR_Clock_Division_T:CONSTANT INTEGER := 1002; -- (0..255)
TYPE Spacewire_Conf_T_EXIST IS RECORD
corefreq:BIT;
clockdiv:BIT;
remove_prot_id:BIT;
rxblock:BIT;
txblock:BIT;
END RECORD;
TYPE Spacewire_Conf_T IS RECORD
devname : String(1..21);
nodeaddr : Node_Addr_T:=0;
corefreq : Core_Frequence_T:=0;
clockdiv : Clock_Division_T:=0;
remove_prot_id : Asn1Boolean;
rxblock : Asn1Boolean;
txblock : Asn1Boolean;
Exist : Spacewire_Conf_T_EXIST;
END RECORD;
Spacewire_Conf_T_REQUIRED_BYTES_FOR_ENCODING:CONSTANT INTEGER := 26;
Spacewire_Conf_T_REQUIRED_BITS_FOR_ENCODING:CONSTANT INTEGER := 201;
Spacewire_Conf_T_REQUIRED_BYTES_FOR_ACN_ENCODING:CONSTANT INTEGER := 28;
Spacewire_Conf_T_REQUIRED_BITS_FOR_ACN_ENCODING:CONSTANT INTEGER := 221;
ERR_Spacewire_Conf_T_devname:CONSTANT INTEGER := 1003; -- (SIZE (1..20))
--END;
end POHICDRIVER_SPACEWIRE;
pragma Style_Checks (Off); -- turn off style checks
-- Code automatically generated by asn1scc tool
-- Date was: 04/28/2011
-- Time was: 13:55:57
WITH Ada.Strings.Fixed;
USE ADA.Strings.Fixed;
WITH Interfaces;
USE Interfaces;
WITH Ada.Characters.latin_1;
WITH AdaAsn1RTL;
USE AdaAsn1RTL;
package POHICDRIVER_UART is
TYPE Baudrate_T IS (b9600, b19200, b38400, b57600, b115200, b230400);
for Baudrate_T use
(b9600 => 0, b19200 => 1, b38400 => 2, b57600 => 3, b115200 => 4, b230400 => 5);
for Baudrate_T'Size use 32;
Baudrate_T_REQUIRED_BYTES_FOR_ENCODING:CONSTANT INTEGER := 1;
Baudrate_T_REQUIRED_BITS_FOR_ENCODING:CONSTANT INTEGER := 3;
Baudrate_T_REQUIRED_BYTES_FOR_ACN_ENCODING:CONSTANT INTEGER := 1;
Baudrate_T_REQUIRED_BITS_FOR_ACN_ENCODING:CONSTANT INTEGER := 3;
ERR_Baudrate_T_unknown_enumeration_value:CONSTANT INTEGER := 1000; -- invalid enumeration value
TYPE Parity_T IS (even, odd);
for Parity_T use
(even => 0, odd => 1);
for Parity_T'Size use 32;
Parity_T_REQUIRED_BYTES_FOR_ENCODING:CONSTANT INTEGER := 1;
Parity_T_REQUIRED_BITS_FOR_ENCODING:CONSTANT INTEGER := 1;
Parity_T_REQUIRED_BYTES_FOR_ACN_ENCODING:CONSTANT INTEGER := 1;
Parity_T_REQUIRED_BITS_FOR_ACN_ENCODING:CONSTANT INTEGER := 1;
ERR_Parity_T_unknown_enumeration_value:CONSTANT INTEGER := 1001; -- invalid enumeration value
TYPE Serial_Conf_T_EXIST IS RECORD
speed:BIT;
parity:BIT;
bits:BIT;
use_paritybit:BIT;
END RECORD;
TYPE Serial_Conf_T IS RECORD
devname : String(1..21);
speed : Baudrate_T;
parity : Parity_T;
bits : Asn1Int:=7;
use_paritybit : Asn1Boolean;
Exist : Serial_Conf_T_EXIST;
END RECORD;
Serial_Conf_T_REQUIRED_BYTES_FOR_ENCODING:CONSTANT INTEGER := 20;
Serial_Conf_T_REQUIRED_BITS_FOR_ENCODING:CONSTANT INTEGER := 155;
Serial_Conf_T_REQUIRED_BYTES_FOR_ACN_ENCODING:CONSTANT INTEGER := 22;
Serial_Conf_T_REQUIRED_BITS_FOR_ACN_ENCODING:CONSTANT INTEGER := 175;
ERR_Serial_Conf_T_devname:CONSTANT INTEGER := 1002; -- (SIZE (1..20))
ERR_Serial_Conf_T_bits:CONSTANT INTEGER := 1003; -- (7..8)
--END;
end POHICDRIVER_UART;
......@@ -97,6 +97,8 @@ public
Memory_1 : memory GR_CPCI_X4CV::Memory_Segment.impl;
GRSPW_Cnx_1 : device GRSPW::GRSPW_Device.impl
{ Deployment::Location => "spacewire 1 2";
Type_Source_Name => "DeviceConfig_spw_obj234.pohidrv_spw_obj234_cv";
-- Configure SpaceWire core #1 to send, #2 to receive
};
GRUART_Cnx_1 : device GRUART::GRUART_Device.impl
......@@ -148,7 +150,7 @@ Type_Source_Name => "DeviceConfig_serialleon_obj179.pohidrv_serialleon_obj179_cv
Memory_1 : memory GR_CPCI_X4CV::Memory_Segment.impl;
GRSPW_Cnx_1 : device GRSPW::GRSPW_Device.impl
{ Deployment::Location => "spacewire 1 2";
-- Configure SpaceWire core #1 to send, #2 to receive
Type_Source_Name => "DeviceConfig_spw_obj234.pohidrv_spw_obj234_cv"; -- Configure SpaceWire core #1 to send, #2 to receive
};
-- Node #1 software components
......
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