Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 323d2a8

Browse files
committed
Added test DBC CAN matrix and generation scripts.
1 parent 45209db commit 323d2a8

18 files changed

+1692
-0
lines changed

run-test-gen.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
start "coder" "build/Release/coderdbc.exe" -dbc test\testdb.dbc -out -out test\gencode -drvname testdb -nodeutils -rw
2+
pause

run-test-gen.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./build/coderdbc -dbc test/testdb.dbc -out test/gencode -drvname testdb -nodeutils -rw

test/gencode/butl/BCM_testdb.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include "BCM_testdb.h"
2+
3+
#ifdef __DEF_TESTDB__
4+
5+
testdb_rx_t testdb_rx;
6+
7+
testdb_tx_t testdb_tx;
8+
9+
#endif // __DEF_TESTDB__
10+
11+
uint32_t testdb_Receive(testdb_rx_t* _m, const uint8_t* _d, uint32_t _id, uint8_t dlc_)
12+
{
13+
uint32_t recid = 0;
14+
if (_id == 0x360U) {
15+
recid = Unpack_FLT_TEST_1_testdb(&(_m->FLT_TEST_1), _d, dlc_);
16+
} else {
17+
if (_id == 0x777U) {
18+
recid = Unpack_SIG_TEST_1_testdb(&(_m->SIG_TEST_1), _d, dlc_);
19+
} else if (_id == 0x1FFFFFF6U) {
20+
recid = Unpack_EMPTY_EXT_ID_testdb(&(_m->EMPTY_EXT_ID), _d, dlc_);
21+
}
22+
}
23+
24+
return recid;
25+
}
26+

test/gencode/butl/BCM_testdb.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#pragma once
2+
3+
#ifdef __cplusplus
4+
extern "C" {
5+
#endif
6+
7+
#include "dbccodeconf.h"
8+
9+
#include "testdb.h"
10+
11+
// This version definition comes from main driver version and
12+
// can be compared in user code space for strict compatibility test
13+
#define VER_TESTDB_MAJ (1U)
14+
#define VER_TESTDB_MIN (10U)
15+
16+
typedef struct
17+
{
18+
FLT_TEST_1_t FLT_TEST_1;
19+
SIG_TEST_1_t SIG_TEST_1;
20+
EMPTY_EXT_ID_t EMPTY_EXT_ID;
21+
} testdb_rx_t;
22+
23+
typedef struct
24+
{
25+
UTEST_2_t UTEST_2;
26+
EMPTY_0_t EMPTY_0;
27+
UTEST_3_t UTEST_3;
28+
EMPTY_EXT_ID_t EMPTY_EXT_ID;
29+
} testdb_tx_t;
30+
31+
uint32_t testdb_Receive(testdb_rx_t* m, const uint8_t* d, uint32_t msgid, uint8_t dlc);
32+
33+
#ifdef __DEF_TESTDB__
34+
35+
extern testdb_rx_t testdb_rx;
36+
37+
extern testdb_tx_t testdb_tx;
38+
39+
#endif // __DEF_TESTDB__
40+
41+
#ifdef __cplusplus
42+
}
43+
#endif

test/gencode/butl/BMS_testdb.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include "BMS_testdb.h"
2+
3+
#ifdef __DEF_TESTDB__
4+
5+
testdb_rx_t testdb_rx;
6+
7+
testdb_tx_t testdb_tx;
8+
9+
#endif // __DEF_TESTDB__
10+
11+
uint32_t testdb_Receive(testdb_rx_t* _m, const uint8_t* _d, uint32_t _id, uint8_t dlc_)
12+
{
13+
uint32_t recid = 0;
14+
if ((_id >= 0x14DU) && (_id < 0x22BU)) {
15+
if (_id == 0x14DU) {
16+
recid = Unpack_UTEST_2_testdb(&(_m->UTEST_2), _d, dlc_);
17+
} else if (_id == 0x160U) {
18+
recid = Unpack_EMPTY_0_testdb(&(_m->EMPTY_0), _d, dlc_);
19+
}
20+
} else {
21+
if (_id == 0x22BU) {
22+
recid = Unpack_UTEST_3_testdb(&(_m->UTEST_3), _d, dlc_);
23+
} else if (_id == 0x1FFFFFF6U) {
24+
recid = Unpack_EMPTY_EXT_ID_testdb(&(_m->EMPTY_EXT_ID), _d, dlc_);
25+
}
26+
}
27+
28+
return recid;
29+
}
30+

test/gencode/butl/BMS_testdb.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#pragma once
2+
3+
#ifdef __cplusplus
4+
extern "C" {
5+
#endif
6+
7+
#include "dbccodeconf.h"
8+
9+
#include "testdb.h"
10+
11+
// This version definition comes from main driver version and
12+
// can be compared in user code space for strict compatibility test
13+
#define VER_TESTDB_MAJ (1U)
14+
#define VER_TESTDB_MIN (10U)
15+
16+
typedef struct
17+
{
18+
UTEST_2_t UTEST_2;
19+
EMPTY_0_t EMPTY_0;
20+
UTEST_3_t UTEST_3;
21+
EMPTY_EXT_ID_t EMPTY_EXT_ID;
22+
} testdb_rx_t;
23+
24+
typedef struct
25+
{
26+
EMPTY_0_t EMPTY_0;
27+
FLT_TEST_1_t FLT_TEST_1;
28+
} testdb_tx_t;
29+
30+
uint32_t testdb_Receive(testdb_rx_t* m, const uint8_t* d, uint32_t msgid, uint8_t dlc);
31+
32+
#ifdef __DEF_TESTDB__
33+
34+
extern testdb_rx_t testdb_rx;
35+
36+
extern testdb_tx_t testdb_tx;
37+
38+
#endif // __DEF_TESTDB__
39+
40+
#ifdef __cplusplus
41+
}
42+
#endif

test/gencode/butl/EPS_testdb.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include "EPS_testdb.h"
2+
3+
#ifdef __DEF_TESTDB__
4+
5+
testdb_tx_t testdb_tx;
6+
7+
#endif // __DEF_TESTDB__
8+

test/gencode/butl/EPS_testdb.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#pragma once
2+
3+
#ifdef __cplusplus
4+
extern "C" {
5+
#endif
6+
7+
#include "dbccodeconf.h"
8+
9+
#include "testdb.h"
10+
11+
// This version definition comes from main driver version and
12+
// can be compared in user code space for strict compatibility test
13+
#define VER_TESTDB_MAJ (1U)
14+
#define VER_TESTDB_MIN (10U)
15+
16+
// There is no any RX mapped massage.
17+
18+
typedef struct
19+
{
20+
SIG_TEST_1_t SIG_TEST_1;
21+
} testdb_tx_t;
22+
23+
#ifdef __DEF_TESTDB__
24+
25+
extern testdb_tx_t testdb_tx;
26+
27+
#endif // __DEF_TESTDB__
28+
29+
#ifdef __cplusplus
30+
}
31+
#endif

test/gencode/butl/ESP_testdb.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include "ESP_testdb.h"
2+
3+
#ifdef __DEF_TESTDB__
4+
5+
testdb_rx_t testdb_rx;
6+
7+
testdb_tx_t testdb_tx;
8+
9+
#endif // __DEF_TESTDB__
10+
11+
uint32_t testdb_Receive(testdb_rx_t* _m, const uint8_t* _d, uint32_t _id, uint8_t dlc_)
12+
{
13+
uint32_t recid = 0;
14+
if (_id == 0x14DU) {
15+
recid = Unpack_UTEST_2_testdb(&(_m->UTEST_2), _d, dlc_);
16+
} else if (_id == 0x1FFFFFF6U) {
17+
recid = Unpack_EMPTY_EXT_ID_testdb(&(_m->EMPTY_EXT_ID), _d, dlc_);
18+
}
19+
20+
return recid;
21+
}
22+

test/gencode/butl/ESP_testdb.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#pragma once
2+
3+
#ifdef __cplusplus
4+
extern "C" {
5+
#endif
6+
7+
#include "dbccodeconf.h"
8+
9+
#include "testdb.h"
10+
11+
// This version definition comes from main driver version and
12+
// can be compared in user code space for strict compatibility test
13+
#define VER_TESTDB_MAJ (1U)
14+
#define VER_TESTDB_MIN (10U)
15+
16+
typedef struct
17+
{
18+
UTEST_2_t UTEST_2;
19+
EMPTY_EXT_ID_t EMPTY_EXT_ID;
20+
} testdb_rx_t;
21+
22+
typedef struct
23+
{
24+
EMPTY_0_t EMPTY_0;
25+
} testdb_tx_t;
26+
27+
uint32_t testdb_Receive(testdb_rx_t* m, const uint8_t* d, uint32_t msgid, uint8_t dlc);
28+
29+
#ifdef __DEF_TESTDB__
30+
31+
extern testdb_rx_t testdb_rx;
32+
33+
extern testdb_tx_t testdb_tx;
34+
35+
#endif // __DEF_TESTDB__
36+
37+
#ifdef __cplusplus
38+
}
39+
#endif

0 commit comments

Comments
 (0)