Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eclipse Projects
Eclipse Titan
titan.TestPorts.SocketCANasp
Commits
ec61fa68
Commit
ec61fa68
authored
Oct 11, 2017
by
Elemer Lelik
Browse files
Update in demo
parent
cf4eabae
Changes
12
Hide whitespace changes
Inline
Side-by-side
demo/
My_canfd_matrix
.ttcn
→
demo/
CANFD_matrix_messages
.ttcn
View file @
ec61fa68
module
My_canfd_matrix
{
module
CANFD_matrix_messages
{
import
from
General_Types
all
// for OCT1, OCT2, ..., INT1, ..
import
from
Can
all
// for CAN_id
import
from
CAN_matrix_
general_type
s
all
import
from
CAN_matrix_
signal
s
all
//The following section is used for the automatic message encding / decoding
type
record
CANFD_MESSAGE_TESTFRAME0
type
record
CANFD_MESSAGE_TESTFRAME0
_msg_type
{
BIT11_
MSB
test_sig_11_bit_bitstring_lsb_coded
,
BIT5_
MSB
test_sig_5_bit_bitstring_lsb_coded
BIT11_
signal_type
test_sig_11_bit_bitstring_lsb_coded
,
BIT5_
signal_type
test_sig_5_bit_bitstring_lsb_coded
}
with
{
variant
"FIELDORDER(msb)"
variant
(
test_sig_11_bit_bitstring_lsb_coded
)
"BITORDERINFIELD(lsb)"
variant
(
test_sig_5_bit_bitstring_lsb_coded
)
"BITORDERINFIELD(lsb)"
}
type
record
CANFD_MESSAGE_TESTFRAME1
type
record
CANFD_MESSAGE_TESTFRAME1
_msg_type
{
BIT11_
MSB
test_sig_11_bit_bitstring_msb_coded
,
BIT5_
MSB
test_sig_5_bit_bitstring_msb_coded
BIT11_
signal_type
test_sig_11_bit_bitstring_msb_coded
,
BIT5_
signal_type
test_sig_5_bit_bitstring_msb_coded
}
with
{
variant
"FIELDORDER(msb)"
variant
(
test_sig_11_bit_bitstring_msb_coded
)
"BITORDERINFIELD(msb)"
variant
(
test_sig_5_bit_bitstring_msb_coded
)
"BITORDERINFIELD(msb)"
}
type
record
CANFD_MESSAGE_TESTFRAME2
type
record
CANFD_MESSAGE_TESTFRAME2
_msg_type
{
INT_BIT11_
MSB
test_sig_11_bit_integer_msb_coded
,
INT_BIT5_
MSB
test_sig_5_bit_integer_msb_coded
INT_BIT11_
signal_type
test_sig_11_bit_integer_msb_coded
,
INT_BIT5_
signal_type
test_sig_5_bit_integer_msb_coded
}
with
{
variant
"FIELDORDER(msb)"
variant
(
test_sig_11_bit_integer_msb_coded
)
"BITORDERINFIELD(msb)"
variant
(
test_sig_5_bit_integer_msb_coded
)
"BITORDERINFIELD(msb)"
}
type
record
CANFD_MESSAGE_TESTFRAME3
type
record
CANFD_MESSAGE_TESTFRAME3
_msg_type
{
OCT1
test_sig_1_byte_octetstring_msb_coded
,
OCT2
test_sig_2_byte_octetstring_msb_coded
OCT1
_signal_type
test_sig_1_byte_octetstring_msb_coded
,
OCT2
_signal_type
test_sig_2_byte_octetstring_msb_coded
}
with
{
variant
""
}
type
record
CANFD_MESSAGE_EXTENDEDFRAME1
type
record
CANFD_MESSAGE_EXTENDEDFRAME1
_msg_type
{
// CAN_id can_id ('80000001'O),
// according to SocketCAN Extended frames have the bit 31 set,
OCT2
test_sig_2_byte_octetstring_msb_coded
OCT2
_signal_type
test_sig_2_byte_octetstring_msb_coded
}
with
{
variant
""
}
type
union
CANFD_MatrixPayloadUnion
{
CANFD_MESSAGE_TESTFRAME0
message_MyTestframe0
,
CANFD_MESSAGE_TESTFRAME1
message_MyTestframe1
,
CANFD_MESSAGE_TESTFRAME2
message_MyTestframe2
,
CANFD_MESSAGE_TESTFRAME3
message_MyTestframe3
,
CANFD_MESSAGE_EXTENDEDFRAME1
message_extendedFrame1
CANFD_MESSAGE_TESTFRAME0
_msg_type
message_MyTestframe0
,
CANFD_MESSAGE_TESTFRAME1
_msg_type
message_MyTestframe1
,
CANFD_MESSAGE_TESTFRAME2
_msg_type
message_MyTestframe2
,
CANFD_MESSAGE_TESTFRAME3
_msg_type
message_MyTestframe3
,
CANFD_MESSAGE_EXTENDEDFRAME1
_msg_type
message_extendedFrame1
}
with
{
variant
""
}
...
...
demo/CAN_matrix.ttcn
View file @
ec61fa68
...
...
@@ -3,8 +3,8 @@ import from General_Types all // for OCT1, OCT2, ..., INT1, ..
import
from
Can
all
// for CAN_id
import
from
SocketCAN_Types
all
// for SocketCAN_CAN_or_CAN_FD_frame
import
from
CAN_matrix_general_types
all
import
from
My_can
_matrix
all
import
from
My_canfd_matrix
all
import
from
CAN
_matrix
_messages
all
import
from
CANFD_matrix_messages
all
external
function
f_encode_can_matrix
(
in
CAN_MatrixUnion
pdu
)
return
octetstring
with
{
extension
"prototype(convert) encode(RAW)"
}
...
...
demo/CAN_matrix_messages.ttcn
0 → 100644
View file @
ec61fa68
module
CAN_matrix_messages
{
import
from
Can
all
// for CAN_id
import
from
CAN_matrix_signals
all
//The following section is used for the automatic message encding / decoding
//For each message type:
/* type record <message name>_msg_type
{
<signal name1>_signal_type <signal name1>,
<signal name2>_signal_type <signal name2>,
...
<signal nameN>_signal_type <signal nameK>
} with {variant "FIELDORDER(msb)"
variant (<signal name1>) "BITORDERINFIELD(lsb)" // lsb for little endian, msb for big endian
variant (<signal name2>) "BITORDERINFIELD(lsb)" // lsb for little endian, msb for big endian
...
variant (<signal nameK>) "BITORDERINFIELD(lsb)" // lsb for little endian, msb for big endian
}
*/
type
record
CAN_MESSAGE_TESTFRAME0_msg_type
{
BIT11_signal_type
test_sig_11_bit_bitstring_little_endian_coded
,
BIT5_signal_type
test_sig_5_bit_bitstring_little_endian_coded
}
with
{
variant
"FIELDORDER(msb)"
variant
(
test_sig_11_bit_bitstring_little_endian_coded
)
"BITORDERINFIELD(lsb)"
variant
(
test_sig_5_bit_bitstring_little_endian_coded
)
"BITORDERINFIELD(lsb)"
}
type
record
CAN_MESSAGE_TESTFRAME1_msg_type
{
BIT11_signal_type
test_sig_11_bit_bitstring_big_endian_coded
,
BIT5_signal_type
test_sig_5_bit_bitstring_big_endian_coded
}
with
{
variant
"FIELDORDER(msb)"
variant
(
test_sig_11_bit_bitstring_big_endian_coded
)
"BITORDERINFIELD(msb)"
variant
(
test_sig_5_bit_bitstring_big_endian_coded
)
"BITORDERINFIELD(msb)"
}
type
record
CAN_MESSAGE_TESTFRAME2_msg_type
{
INT_BIT11_signal_type
test_sig_11_bit_integer_big_endian_coded
,
INT_BIT5_signal_type
test_sig_5_bit_integer_big_endian_coded
}
with
{
variant
"FIELDORDER(msb)"
variant
(
test_sig_11_bit_integer_big_endian_coded
)
"BITORDERINFIELD(msb)"
variant
(
test_sig_5_bit_integer_big_endian_coded
)
"BITORDERINFIELD(msb)"
}
type
record
CAN_MESSAGE_TESTFRAME3_msg_type
{
OCT1_signal_type
test_sig_1_byte_octetstring_big_endian_coded
,
OCT2_signal_type
test_sig_2_byte_octetstring_big_endian_coded
}
with
{
variant
"FIELDORDER(msb)"
variant
(
test_sig_1_byte_octetstring_big_endian_coded
)
"BITORDERINFIELD(msb)"
variant
(
test_sig_2_byte_octetstring_big_endian_coded
)
"BITORDERINFIELD(msb)"
}
type
record
CAN_MESSAGE_TESTFRAME4_msg_type
{
INT_BIT9_PADDED_2_signal_type
test_unsig_9_bit_2_padded_integer_big_endian_coded
,
INT_BIT5_signal_type
test_sig_5_bit_integer_big_endian_coded
}
with
{
variant
"FIELDORDER(msb)"
variant
(
test_unsig_9_bit_2_padded_integer_big_endian_coded
)
"BITORDERINFIELD(msb)"
variant
(
test_sig_5_bit_integer_big_endian_coded
)
"BITORDERINFIELD(msb)"
}
type
record
CAN_MESSAGE_TESTFRAME5_msg_type
{
INT_BIT9_PADDED_2_signal_type
test_unsig_9_bit_2_padded_integer_big_endian_coded
,
INT_BIT5_signal_type
test_sig_5_bit_integer_big_endian_coded
}
with
{
variant
"FIELDORDER(msb)"
variant
(
test_unsig_9_bit_2_padded_integer_big_endian_coded
)
"BITORDERINFIELD(lsb)"
variant
(
test_sig_5_bit_integer_big_endian_coded
)
"BITORDERINFIELD(lsb)"
}
type
record
CAN_MESSAGE_EXTENDEDFRAME1_msg_type
{
// CAN_id can_id ('80000001'O),
// according to SocketCAN Extended frames have the bit 31 set,
OCT2_signal_type
test_sig_2_byte_octetstring_msb_coded
}
with
{
variant
"FIELDORDER(msb)"
variant
(
test_sig_2_byte_octetstring_msb_coded
)
"BITORDERINFIELD(lsb)"
}
/* For code generation from can matrix:
type union CAN_MatrixPayloadUnion
{
<message name1>_msg_type <message name1>_frame,
<message name2>_msg_type <message name2>_frame,
....
<message nameK>_msg_type <message nameK>_frame
} with {variant "" }
type record CAN_MatrixUnion {
CAN_id can_id,
CAN_MatrixPayloadUnion can_pdu
} with {variant (can_pdu) "CROSSTAG(
<message name1>_frame, can_id = '<CAN-ID of message 1 in Hex padded with 0s>'O;
<message name2>_frame, can_id = '<CAN-ID of message 2 in Hex padded with 0s>'O;
...
<message nameK>_frame, can_id = '<CAN-ID of message K in Hex padded with 0s>'O;
// note for extended CAN-Frames CAN-ID is ored with '80000000'O
)"
}
*/
type
union
CAN_MatrixPayloadUnion
{
CAN_MESSAGE_TESTFRAME0_msg_type
message_MyTestframe0
,
CAN_MESSAGE_TESTFRAME1_msg_type
message_MyTestframe1
,
CAN_MESSAGE_TESTFRAME2_msg_type
message_MyTestframe2
,
CAN_MESSAGE_TESTFRAME3_msg_type
message_MyTestframe3
,
CAN_MESSAGE_TESTFRAME4_msg_type
message_MyTestframe4
,
CAN_MESSAGE_TESTFRAME5_msg_type
message_MyTestframe5
,
CAN_MESSAGE_EXTENDEDFRAME1_msg_type
message_extendedFrame1
}
with
{
variant
""
}
type
record
CAN_MatrixUnion
{
CAN_id
can_id
,
CAN_MatrixPayloadUnion
can_pdu
}
with
{
variant
(
can_pdu
)
"CROSSTAG(
message_MyTestframe0, can_id = '00000122'O;
message_MyTestframe1, can_id = '00000123'O;
message_MyTestframe2, can_id = '00000124'O;
message_MyTestframe3, can_id = '00000125'O;
message_MyTestframe4, can_id = '00000126'O;
message_MyTestframe5, can_id = '00000127'O;
message_extendedFrame1, can_id = '80000001'O;
)"
}
//The above section is used for the automatic message encding / decoding
}
with
{
encode
"RAW"
}
demo/CAN_matrix_signals.ttcn
0 → 100644
View file @
ec61fa68
module
CAN_matrix_signals
{
// header
import
from
General_Types
all
// header
import
from
CAN_matrix_general_types
all
// header
// instead of distinguishing between padding and no padding code generation,
// always tghe padded soulution could be used.
// for Bit types without padding
// type BIT<bitssize>_MSB <signal_name>_signal_type with { variant "BITORDER(msb)" };
type
BIT11_MSB
BIT11_signal_type
with
{
variant
"BITORDER(msb)"
};
type
BIT5_MSB
BIT5_signal_type
with
{
variant
"BITORDER(msb)"
};
// for n-Bit types with k-Bit padding
//type INT_BIT<n>_MSB <signal_name>_signal_type with
//{ variant "ALIGN(right)"
// variant "FIELDLENGTH(<(n+k)>)" // 9 (used) +2 (padding) = 11
// variant "BITORDER(msb)"
//};
type
INT_BIT9_MSB
BIT_BIT9_PADDED_2_signal_type
with
{
variant
"ALIGN(right)"
variant
"FIELDLENGTH(11)"
// 9 (used) +2 (padding) = 11
variant
"BITORDER(msb)"
};
// for integer types without padding
// type INT_BIT<bitssize>_MSB <signal_name>_signal_type with { variant "BITORDER(msb)" };
type
INT_BIT11_MSB
INT_BIT11_signal_type
with
{
variant
"BITORDER(msb)"
};
type
INT_BIT5_MSB
INT_BIT5_signal_type
with
{
variant
"BITORDER(msb)"
};
// for n-Bit integer types with k-Bit padding
//type INT_BIT<n>_MSB <signal_name>_signal_type with
//{ variant "ALIGN(right)"
// variant "FIELDLENGTH(<n>+<k>)" // n (used) +k (padding) = 11
// variant "BITORDER(msb)"
//};
type
INT_BIT9_MSB
INT_BIT9_PADDED_2_signal_type
with
{
variant
"ALIGN(right)"
variant
"FIELDLENGTH(11)"
// 9 (used) +2 (padding) = 11
variant
"BITORDER(msb)"
};
// for Byte types without padding
// type OCT<bytesize> <signal_name>_signal_type with { variant "BITORDER(msb)" };
type
OCT1
OCT1_signal_type
with
{
variant
"BITORDER(msb)"
};
type
OCT2
OCT2_signal_type
with
{
variant
"BITORDER(msb)"
};
}
with
{
encode
"RAW"
}
//footer
demo/CAN_matrix_templates.ttcn
0 → 100644
View file @
ec61fa68
module
CAN_matrix_templates
{
import
from
CAN_matrix
all
import
from
CAN_matrix_signals
all
import
from
CAN_matrix_general_types
all
import
from
CAN_matrix_messages
all
// for code generation for each defined message
//template CAN_MatrixUnion t_<message_name>(<signal_type_parameter1> <signal_name_parameter1>,
// <signal_type_parameter2> <signal_name_parameter2>,
// ...
// <signal_type_parameterN> <signal_name_parameterN>) := {
// can_id := '<CAN-ID of message in HEX with padded 0s>'O, // '...'O as this is an octetstring
// can_pdu := { <message name>_frame := {
// <signal_type_parameter1> := <signal_name_parameter1>,
// <signal_type_parameter2> := <signal_name_parameter2>
// } }
// }
template
CAN_MatrixUnion
t_message_Frame5_2_parm
(
integer
parameter1
,
INT_BIT5_signal_type
parameter2
)
:=
{
can_id
:=
'00000127'O
,
// '...'O as this is an octetstring
can_pdu
:=
{
message_MyTestframe5
:=
{
test_unsig_9_bit_2_padded_integer_big_endian_coded
:=
parameter1
,
test_sig_5_bit_integer_big_endian_coded
:=
parameter2
}
}
}
}
demo/CAN_matrix_test.ttcn
View file @
ec61fa68
...
...
@@ -7,10 +7,13 @@ import from CanError all
import
from
Can
all
// for CAN_id
import
from
SocketCAN_Types
all
// for SocketCAN_CAN_or_CAN_FD_frame
import
from
CAN_matrix
all
import
from
My_can
_matrix
all
import
from
My_canfd_matrix
all
import
from
CAN
_matrix
_messages
all
import
from
CANFD_matrix_messages
all
import
from
SocketCANtest
all
import
from
CAN_matrix_general_types
all
import
from
CAN_matrix_templates
all
//component declarations
type
component
MTC_CT
{
...
...
@@ -29,8 +32,8 @@ testcase tc_encdec() runs on MTC_CT
my_can_message
:=
{
can_id
:=
'00000124'O
,
can_pdu
:=
{
message_MyTestframe2
:=
{
test_sig_11_bit_integer_
msb
_coded
:=
2047
,
// as this is a integer
test_sig_5_bit_integer_
msb
_coded
:=
2
// as this is a integer
test_sig_11_bit_integer_
big_endian
_coded
:=
2047
,
// as this is a integer
test_sig_5_bit_integer_
big_endian
_coded
:=
2
// as this is a integer
}}}
log
(
my_can_message
)
...
...
@@ -42,8 +45,8 @@ testcase tc_encdec() runs on MTC_CT
// please note that if it is an extended can address, it would be '0x80000122' as usual in socketCAN
can_id
:=
'00000122'O
,
// '...'O as this is anm octetstring
can_pdu
:=
{
message_MyTestframe0
:=
{
test_sig_11_bit_bitstring_l
sb
_coded
:=
'01010101011'B
,
// '...'B as this is a bitstring
test_sig_5_bit_bitstring_l
sb
_coded
:=
'11111'B
// '...'B as this is a bitstring
test_sig_11_bit_bitstring_l
ittle_endian
_coded
:=
'01010101011'B
,
// '...'B as this is a bitstring
test_sig_5_bit_bitstring_l
ittle_endian
_coded
:=
'11111'B
// '...'B as this is a bitstring
}
}
}
...
...
@@ -58,8 +61,8 @@ testcase tc_encdec() runs on MTC_CT
// please note that if it is an extended can address, it would be '0x80000123' as usual in socketCAN
can_id
:=
'00000123'O
,
// '...'O as this is anm octetstring
can_pdu
:=
{
message_MyTestframe1
:=
{
test_sig_11_bit_bitstring_
msb
_coded
:=
'01010101011'B
,
// '...'B as this is a bitstring
test_sig_5_bit_bitstring_
msb
_coded
:=
'11111'B
// '...'B as this is a bitstring
test_sig_11_bit_bitstring_
big_endian
_coded
:=
'01010101011'B
,
// '...'B as this is a bitstring
test_sig_5_bit_bitstring_
big_endian
_coded
:=
'11111'B
// '...'B as this is a bitstring
}
}
}
...
...
@@ -75,8 +78,8 @@ testcase tc_encdec() runs on MTC_CT
can_id
:=
'00000124'O
,
// '...'O as this is anm octetstring
can_pdu
:=
{
message_MyTestframe2
:=
{
test_sig_11_bit_integer_
msb
_coded
:=
2047
,
// as this is a integer
test_sig_5_bit_integer_
msb
_coded
:=
2
// as this is a integer
test_sig_11_bit_integer_
big_endian
_coded
:=
2047
,
// as this is a integer
test_sig_5_bit_integer_
big_endian
_coded
:=
2
// as this is a integer
}
}
}
...
...
@@ -93,8 +96,8 @@ testcase tc_encdec() runs on MTC_CT
can_id
:=
'00000125'O
,
// '...'O as this is anm octetstring
can_pdu
:=
{
message_MyTestframe3
:=
{
test_sig_1_byte_octetstring_
msb
_coded
:=
'
FF
'
O
,
// as this is a 1 Byte octetstring
test_sig_2_byte_octetstring_
msb
_coded
:=
'
123
F
'
O
// as this is a 2 Byte octetstring
test_sig_1_byte_octetstring_
big_endian
_coded
:=
'
FF
'
O
,
// as this is a 1 Byte octetstring
test_sig_2_byte_octetstring_
big_endian
_coded
:=
'
123
F
'
O
// as this is a 2 Byte octetstring
}
}
}
...
...
@@ -121,18 +124,18 @@ testcase tc_encdec() runs on MTC_CT
log
(
f_decode_can_matrix
(
f_encode_can_matrix
(
valueof
(
t_message_extendedFrame1_1
))))
log
(
"--------------------------------------------"
)
var
CAN_MESSAGE_TESTFRAME1
v_message_Frame1_2
var
CAN_MESSAGE_TESTFRAME2
v_message_Frame2_2
var
CAN_MESSAGE_TESTFRAME3
v_message_Frame3_2
var
CAN_MESSAGE_TESTFRAME4
v_message_Frame4_2
var
CAN_MESSAGE_TESTFRAME5
v_message_Frame5_2
var
CAN_MESSAGE_EXTENDEDFRAME1
v_message_extendedFrame1_2
var
CAN_MESSAGE_TESTFRAME1
_msg_type
v_message_Frame1_2
var
CAN_MESSAGE_TESTFRAME2
_msg_type
v_message_Frame2_2
var
CAN_MESSAGE_TESTFRAME3
_msg_type
v_message_Frame3_2
var
CAN_MESSAGE_TESTFRAME4
_msg_type
v_message_Frame4_2
var
CAN_MESSAGE_TESTFRAME5
_msg_type
v_message_Frame5_2
var
CAN_MESSAGE_EXTENDEDFRAME1
_msg_type
v_message_extendedFrame1_2
v_message_Frame1_2
:=
{
// please note that if it is an extended can address, it would be '0x80000123' as usual in socketCAN
test_sig_11_bit_bitstring_
msb
_coded
:=
'01010101011'B
,
// '...'B as this is a bitstring
test_sig_5_bit_bitstring_
msb
_coded
:=
'11111'B
// '...'B as this is a bitstring
test_sig_11_bit_bitstring_
big_endian
_coded
:=
'01010101011'B
,
// '...'B as this is a bitstring
test_sig_5_bit_bitstring_
big_endian
_coded
:=
'11111'B
// '...'B as this is a bitstring
}
template
CAN_MatrixUnion
t_message_Frame1_2
:=
{
...
...
@@ -149,8 +152,8 @@ testcase tc_encdec() runs on MTC_CT
v_message_Frame2_2
:=
{
// please note that if it is an extended can address, it would be '0x80000124' as usual in socketCAN
test_sig_11_bit_integer_
msb
_coded
:=
2047
,
// as this is a integer
test_sig_5_bit_integer_
msb
_coded
:=
2
// as this is a integer
test_sig_11_bit_integer_
big_endian
_coded
:=
2047
,
// as this is a integer
test_sig_5_bit_integer_
big_endian
_coded
:=
2
// as this is a integer
}
template
CAN_MatrixUnion
t_message_Frame2_2
:=
{
...
...
@@ -168,8 +171,8 @@ testcase tc_encdec() runs on MTC_CT
v_message_Frame3_2
:=
{
// please note that if it is an extended can address, it would be '0x80000125' as usual in socketCAN
test_sig_1_byte_octetstring_
msb
_coded
:=
'
FF
'
O
,
// as this is a 1 Byte octetstring
test_sig_2_byte_octetstring_
msb
_coded
:=
'
123
F
'
O
// as this is a 2 Byte octetstring
test_sig_1_byte_octetstring_
big_endian
_coded
:=
'
FF
'
O
,
// as this is a 1 Byte octetstring
test_sig_2_byte_octetstring_
big_endian
_coded
:=
'
123
F
'
O
// as this is a 2 Byte octetstring
}
template
CAN_MatrixUnion
t_message_Frame3_2
:=
{
...
...
@@ -185,8 +188,8 @@ testcase tc_encdec() runs on MTC_CT
v_message_Frame4_2
:=
{
test_unsig_9_bit_2_padded_integer_
msb
_coded
:=
511
,
// as this is a 9 Bit bitstring
test_sig_5_bit_integer_
msb
_coded
:=
8
// as this is a 5 bit integer
test_unsig_9_bit_2_padded_integer_
big_endian
_coded
:=
511
,
// as this is a 9 Bit bitstring
test_sig_5_bit_integer_
big_endian
_coded
:=
8
// as this is a 5 bit integer
}
template
CAN_MatrixUnion
t_message_Frame4_2
:=
{
...
...
@@ -202,8 +205,8 @@ testcase tc_encdec() runs on MTC_CT
v_message_Frame5_2
:=
{
test_unsig_9_bit_2_padded_integer_
msb
_coded
:=
127
,
// as this is a 9 Bit bitstring
test_sig_5_bit_integer_
msb
_coded
:=
16
// as this is a 5 bit integer
test_unsig_9_bit_2_padded_integer_
big_endian
_coded
:=
127
,
// as this is a 9 Bit bitstring
test_sig_5_bit_integer_
big_endian
_coded
:=
16
// as this is a 5 bit integer
}
template
CAN_MatrixUnion
t_message_Frame5_2
:=
{
...
...
@@ -217,8 +220,15 @@ testcase tc_encdec() runs on MTC_CT
log
(
f_decode_can_matrix
(
f_encode_can_matrix
(
valueof
(
t_message_Frame5_2
))))
log
(
"--------------------------------------------"
)
log
(
"********************************************"
)
log
(
f_encode_can_matrix
(
valueof
(
t_message_Frame5_2_parm
(
7
,
1
))))
log
(
"--------------------------------------------"
)
log
(
f_decode_can_matrix
(
f_encode_can_matrix
(
valueof
(
t_message_Frame5_2_parm
(
7
,
1
)))))
log
(
"--------------------------------------------"
)
log
(
"********************************************"
)
v_message_extendedFrame1_2
:=
{
// please note that if it is an extended can address, it would be '0x80000125' as usual in socketCAN
...
...
@@ -272,13 +282,13 @@ testcase tc_can_raw_send_and_receive_can_frame() runs on MTC {
connect
(
mtc
:
pt_sync
,
v_ptc_rawFrameReceiver
:
pt_sync
)
var
CAN_MESSAGE_TESTFRAME1
v_message_Frame1_3
var
CAN_MESSAGE_TESTFRAME1
_msg_type
v_message_Frame1_3
v_message_Frame1_3
:=
{
// please note that if it is an extended can address, it would be '0x80000123' as usual in socketCAN
test_sig_11_bit_bitstring_
msb
_coded
:=
'01010101011'B
,
// '...'B as this is a bitstring
test_sig_5_bit_bitstring_
msb
_coded
:=
'11111'B
// '...'B as this is a bitstring
test_sig_11_bit_bitstring_
big_endian
_coded
:=
'01010101011'B
,
// '...'B as this is a bitstring
test_sig_5_bit_bitstring_
big_endian
_coded
:=
'11111'B
// '...'B as this is a bitstring
}
template
CAN_MatrixUnion
t_message_Frame1_3
:=
{
...
...
@@ -328,7 +338,7 @@ testcase tc_can_raw_send_and_receive_canfd_frame() runs on MTC {
can_pdu
:=
'
0123456789
ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF
'
O
}
}
var
CANFD_MESSAGE_TESTFRAME1
v_message_Frame1_4
var
CANFD_MESSAGE_TESTFRAME1
_msg_type
v_message_Frame1_4
v_message_Frame1_4
:=
{
...
...
demo/Isobus.cfg
0 → 100644
View file @
ec61fa68
##############################################################################
# Copyright (c) 2010, 2016 Ericsson AB
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Michael Josenhans
##############################################################################
[LOGGING]
FileMask := LOG_ALL | DEBUG | MATCHING
ConsoleMask := LOG_ALL | DEBUG | MATCHING
LogSourceInfo := Yes
SourceInfoFormat:= Single // Single or Stack
LogEntityName:= Yes
LogEventTypes:= Yes
[TESTPORT_PARAMETERS]
// Syntax:
// <component_name>.<port_name>.<parameter_name> := <parameter_value>
*.pt_socketCAN.SocketCAN_can_interface_name := "vcan0"
*.pt_socketCAN.SocketCAN_debugging := "YES"
[EXECUTE]
Isobustest.tc_encdec
Isobustest.tc_encdec_vt2ecu_vtStatusReq
Isobustest.tc_encdec_ecu2vt_getMemoryReq
Isobustest.tc_encdec_ecu2vt_getMemoryReq_with_templateI
Isobustest.tc_encdec_ecu2vt_getMemoryReq_with_template_II
Isobustest.tc_encdec_networkMessage_N_SP_Response_pdu_with_template
Isobustest.tc_encdec_networkMessage_N_SP_Response_with_template
Isobustest.tc_encdec_N_SP_Response_with_template
Isobustest.tc_encdec_ecu2vt_workingSetMaintenanceReq
Isobustest.tc_dec_requestForAddressClaimed
Isobustest.tc_dec_largemessage
//Isobustest.tc_Example001
//Isobustest.tc_Example002
demo/IsobusNMMessageTypes.ttcn
View file @
ec61fa68
...
...
@@ -269,7 +269,7 @@ type union RequestedParametric
type
record
N_GP_Response
{
Function
msgFunction
(
129
),
octetstring
requestedParametrics
[
6
..
255
]
record
length
(
6
..
255
)
of
OCT1
requestedParametrics
// Note: If total length below 8 bytes shall be padded to 8 bytes with reserved ('FF'O) within RequestedParametrics
// this is the easiest way to handle it
}
with
{
...
...
@@ -296,12 +296,12 @@ type record N_SP_Request
// this is the easiest way to handle it
}
with
{
variant
""
}
type
record
N_SP_Response
{
Function
msgFunction
(
132
),
PortPair
portPair
,
octetstring
requestedParametrics
[
5
..
255
]
record
length
(
5
..
255
)
of
OCT1
requestedParametrics
// Note: If total length below 8 bytes shall be padded to 8 bytes with reserved ('FF'O) within RequestedParametrics
// this is the easiest way to handle it
}
with
{
...
...
demo/Isobus_Templates.ttcn
View file @
ec61fa68
...
...
@@ -2,9 +2,34 @@ module Isobus_Templates {
import
from
IsobusMessageTypes
all
import
from
IsobusVTMessageTypes
all
import
from
IsobusCMMessageTypes
all
import
from
IsobusNMMessageTypes
all
import
from
Isobus
all
import
from
General_Types
all
template
CAN_frame_j1939
t_message
(
Isobus
.
Priority
prio_param
,
BIT1
res_param
,
BIT1
dp_param
,
OCT1
pf_param
,
OCT1
ps_param
,
SourceAddress
sa_param
,
template
AnyIsoBusPdu
t_can_pdu
)
:=
{
can_j1939
:=
{
prio
:=
prio_param
,
res
:=
res_param
,
dp
:=
dp_param
,
pf
:=
pf_param
,
ps
:=
ps_param
,
sa
:=
sa_param
},
can_pdu
:=
t_can_pdu
}
template
CAN_frame_j1939
t_network_message
(
Isobus
.
Priority
prio_param
,
BIT1
res_param
,
BIT1
dp_param
,
OCT1
pf_param
,
OCT1
ps_param
,
SourceAddress
sa_param
,
template
IsobusNMMessageTypes
.
NetworkMessage
t_networkMessage
)
:=
{
can_j1939
:=
{
prio
:=
prio_param
,
res
:=
res_param
,
dp
:=
dp_param
,
pf
:=
pf_param
,
ps
:=
ps_param
,
sa
:=
sa_param
},
can_pdu
:=
{
networkMessage
:=
t_networkMessage
}
}
template
ECU2VT
t_GetMemoryReqX
(
INT3
p_memoryRequired
)
:=
{
getMemoryReq
:=
{
...
...
@@ -89,5 +114,20 @@ template WorkingSetMaintenanceReq t_WorkingSetMaintenanceReq(
reserved8
:=
'
FF
'
O
}
template
N_SP_Response
t_N_SP_Response
(
template
e_PortNumber
t_fromPort
,
template
e_PortNumber
t_toPort
,
template
N_SP_Response
.
requestedParametrics
requestedParametrics_param
)
:=
{
msgFunction
:=
132
,
portPair
:=
{
fromPort
:=
t_fromPort
,
toPort
:=
t_toPort
},
requestedParametrics
:=
requestedParametrics_param
}
template
AnyIsoBusPdu
t_N_SP_Response_pdu
(
template
e_PortNumber
t_fromPort
,