Skip to content

Commit 3b3cb5d

Browse files
authored
Merge pull request #4 from xiangtaoyou/master
Remove binary files and re-organize source files of Baidu software
2 parents cda7a99 + c369ed7 commit 3b3cb5d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+182
-885
lines changed

baidu/.version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0.0.1

baidu/Makefile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# Makefile for Baidu softwares
3+
#
4+
5+
LIBADV_TRIGGER=src/lib/adv_trigger
6+
LIBADV_BCAN=src/lib/bcan
7+
ADV_TRIGGER=src/tools/adv_trigger
8+
BASA=src/kernel/drivers/baidu/basa
9+
MODULES=$(LIBADV_TRIGGER) $(LIBADV_BCAN) $(ADV_TRIGGER) $(BASA)
10+
MODINSTALL=$(addsuffix .install,$(MODULES))
11+
MODCLEAN=$(addsuffix .clean,$(MODULES))
12+
13+
.PHONY:all $(MODULES)
14+
all: $(MODULES)
15+
$(MODULES):
16+
$(MAKE) -C $@
17+
18+
.PHONY:install $(MODINSTALL)
19+
install: $(MODINSTALL)
20+
$(MODINSTALL): %.install:
21+
$(MAKE) install -C $*
22+
23+
.PHONY:clean $(MODCLEAN)
24+
clean: $(MODCLEAN)
25+
$(MODCLEAN): %.clean:
26+
$(MAKE) clean -C $*

baidu/README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
This repository contains code/binary contributed by Baidu to the Apollo Autonomous Driving Project that can't or is not suitable to be distributed under Apache license.
1+
This repository contains code contributed by Baidu to the Apollo Autonomous Driving Project that can't or is not suitable to be distributed under Apache license.
22

33
Directory structure:
44

5-
- bin/: binary programs
65
- docs/: documentations
7-
- drivers/: driver source code
8-
- include/: header files for user space library/application development
9-
- include/baidu/: library headers
10-
- uapi/: header files for writing user space program against kernel driver(s)
11-
- lib/: binary library files (.a, .so)
12-
- linux/: binary release of kernel driver(s)
13-
- linux/drivers: binary drivers organized by kernel version
14-
- linux/include: header files for writing user space program against the binary driver
6+
- src/: source code
7+
- lib/adv_trigger: source code of the adv_trigger library
8+
- lib/bcan: source code of the bcan library
9+
- tools/adv_trigger: source code of the adv_trigger user tool
10+
- kernel/include/uapi/linux: header files for writing user programs against the basa driver
11+
- kernel/drivers/baidu/basa: source code of the baidu sensor aggregation (basa) driver

baidu/bin/README.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

baidu/bin/adv_trigger

-898 KB
Binary file not shown.

baidu/build.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
VERSION=$(cat .version | xargs)
4+
DRV_HDR=src/kernel/drivers/baidu/basa/basa_regs.h
5+
DRV_VER=$(grep ZYNQ_MOD_VER ${DRV_HDR} | cut -d'"' -f2)
6+
7+
make clean
8+
make install
9+
make clean
10+
11+
cd output
12+
ldconfig -n lib
13+
zip -y -r plat-sw-${VERSION}.zip bin include lib
14+
zip -y -r basa-${DRV_VER}.zip kernel
15+
rm -r bin include lib kernel

baidu/docs/Baidu_CAN_APIs.txt

Lines changed: 39 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
version 1.2:
1+
version 3.0.0.1:
22

33
The APIs below are meant to be generic and are not tied to any specific CAN
44
hardware. However some of the APIs are specific to Baidu CAN
55
(specifically noted below) and are exposed to advanced users.
66

7+
======================================================
78
1. CAN CHANNEL ACCESS:
8-
---------------------
9+
======================================================
910
1.1)
10-
int
11-
bcan_open(uint32_t dev_index, uint32_t flags, uint64_t tx_timeout, uint64_t
11+
int bcan_open(uint32_t dev_index, uint32_t flags, uint64_t tx_timeout, uint64_t
1212
rx_timeout, bcan_hdl_t *hdl)
1313

1414
This call will return a logical handle 'hdl' to a physical CAN interface. The
@@ -22,15 +22,14 @@ completely transparent to user).
2222
Return value: 0 on success, error code (see Section 5) on failure.
2323

2424
1.2)
25-
int
26-
bcan_close(bcan_hdl_t hdl)
25+
int bcan_close(bcan_hdl_t hdl)
2726

2827
This call will close the logical handle 'hdl'.
2928

3029
Return value: 0 on success, error code (see Section 5) on failure.
3130

3231
1.3)
33-
bcan_start(bcan_hdl_t hdl)
32+
int bcan_start(bcan_hdl_t hdl)
3433

3534
This call will initialize the channel and put it in a state ready for transmitting
3635
and receiving CAN frames.
@@ -39,7 +38,7 @@ For Baidu CAN: This will put the card in 'NORMAL' mode.
3938
Return value: 0 on success, error code (see Section 5) on failure.
4039

4140
1.4)
42-
bcan_stop(bcan_hdl_t hdl)
41+
int bcan_stop(bcan_hdl_t hdl)
4342

4443
This call will stop any data from being received or transmitted on this channel.
4544
Error counter and status registers will be reset.
@@ -57,35 +56,9 @@ This call return current libbcan version as a string.
5756

5857
======================================================
5958
2. CHANNEL CONFIGURATION
60-
------------------------
61-
Below bcan_id_*() APIs are a filter to receive messages from only desired CAN
62-
IDs. These APIs are optional. By default all CAN messages will be accepted. All
63-
bcan_id_*() call return 0 on success, error code (see Section 5) on failure.
59+
======================================================
6460
2.1)
65-
bcan_id_add(bcan_hdl_t hdl, uint32_t id_start, uint32_t id_end)
66-
67-
All ids from 'id_start' to 'id_end' will be added to the receive acceptance
68-
filter.
69-
70-
2.2)
71-
bcan_id_add_all(bcan_hdl_t hdl)
72-
73-
All CAN messages will be accepted.
74-
75-
2.3)
76-
bcan_id_remove(bcan_hdl_t hdl, uint32_t id_start, uint32_t id_end)
77-
78-
All ids from 'id_start' to 'id_end' will be removed from the receive acceptance
79-
filter.
80-
81-
2.4)
82-
bcan_id_remove_all(bcan_hdl_t hdl)
83-
84-
No CAN messages will be received.
85-
86-
2.5)
87-
int
88-
bcan_set_baudrate(bcan_hdl_t hdl, uint32_t rate)
61+
int bcan_set_baudrate(bcan_hdl_t hdl, uint32_t rate)
8962

9063
Specify 'rate' using one of the below supported values (defined in bcan.h). For
9164
e.g. BCAN_BAUDRATE_500K means 500Kbps.
@@ -97,34 +70,31 @@ BCAN_BAUDRATE_1M
9770

9871
Return value: 0 on success, error code (see Section 5) on failure.
9972

100-
2.6)
101-
int
102-
bcan_get_baudrate(bcan_hdl_t hdl, uint32_t *rate)
73+
2.2)
74+
int bcan_get_baudrate(bcan_hdl_t hdl, uint32_t *rate)
10375

10476
This call will return the current baudrate in Kbps via 'rate'.
10577
Return value: 0 on success, error code (see Section 5) on failure.
10678

107-
2.7)
108-
int
109-
bcan_set_loopback(bcan_hdl_t hdl)
79+
2.3)
80+
int bcan_set_loopback(bcan_hdl_t hdl)
11081

11182
This API will cause all messages sent on Tx to be received on Rx. This is
11283
effectively a self-test mode. Note all CAN devices may not support this mode.
11384

11485
Return value: 0 on success, error code (see Section 5) on failure.
11586

116-
2.8)
117-
int
118-
bcan_unset_loopback(bcan_hdl_t hdl)
87+
2.4)
88+
int bcan_unset_loopback(bcan_hdl_t hdl)
11989

12090
This call will stop the loopback mode and will return the channel to normal
12191
operational mode.
12292

12393
Return value: 0 on success, error code (see Section 5) on failure.
12494

125-
==================================
95+
======================================================
12696
3. DATA PATH
127-
------------
97+
======================================================
12898
typedef struct bcan_msg {
12999
uint32_t bcan_msg_id; // source CAN node id
130100
uint8_t bcan_msg_rsv[3]; // reserved for future
@@ -134,8 +104,7 @@ typedef struct bcan_msg {
134104
} bcan_msg_t;
135105

136106
3.1)
137-
int
138-
bcan_recv(bcan_hdl_t hdl, bcan_msg_t *buf, uint32_t num_msg)
107+
int bcan_recv(bcan_hdl_t hdl, bcan_msg_t *buf, uint32_t num_msg)
139108

140109
This call will return with either the requested number of messages 'num_msg' or
141110
the number of available messages in the RX FIFO, which ever is smaller. If Rx
@@ -148,8 +117,7 @@ On success this call will return the number of messages received. A error code
148117
(see Section 5) is returned on failure.
149118

150119
3.2)
151-
int
152-
bcan_send(bcan_hdl_t hdl, bcan_msg_t *buf, uint32_t num_msg)
120+
int bcan_send(bcan_hdl_t hdl, bcan_msg_t *buf, uint32_t num_msg)
153121

154122
'num_msg' is the number of CAN messages to be sent. 'num_msg' should not exceed
155123
BCAN_MAX_TX_MSG. The 'tx_timeout' specified in bcan_open() will be enforced by
@@ -161,22 +129,21 @@ has been enqueued in the Tx FIFO. A error code (see Section 5) is returned on
161129
failure.
162130

163131
3.3)
164-
int
165-
bcan_send_hi_pri(bcan_hdl_t hdl, bcan_msg_t *buf);
166-
Baidu CAN CAN specific. Only 1 high priority message can be sent at a time.
132+
int bcan_send_hi_pri(bcan_hdl_t hdl, bcan_msg_t *buf);
133+
Baidu CAN specific. Only 1 high priority message can be sent at a time.
167134
'tx_timeout' specified in bcan_open() does not apply to this call. Instead this
168135
call will return immediately with either success or failure.
169136

170137
Return value: On success this call will return the number of messages transmitted
171138
which is 1. A error code (see Section 5) is returned on failure.
172139

173-
=====================================
140+
======================================================
174141
4. DIAGNOSTIC:
175-
-------------
176-
Baidu CAN CAN specific
142+
======================================================
143+
Baidu CAN specific.
144+
177145
4.1)
178-
int
179-
bcan_get_status(bcan_hdl_t hdl)
146+
int bcan_get_status(bcan_hdl_t hdl)
180147

181148
This call will return the overall status of the channel hardware. A error code
182149
(defined in section 5) is returned on error.
@@ -187,48 +154,38 @@ register, 'value' is the return value from bcan_get_status().
187154
BCAN_GET_FIFO_STATUS(value) -> returns Acceptance filter status, Tx FIFO and
188155
High Priority Buffer status.
189156

190-
BCAN_GET_ERR_STATUS(value) -> returns error active, error passive or bus off
191-
state.
157+
BCAN_GET_ERR_STATUS(value) -> returns error active, error passive or bus off state.
192158

193159
BCAN_GET_BUS_STATUS(value) -> returns Busy or Idle
194160

195161
BCAN_GET_MODE_STATUS(value) -> returns Normal, Sleep, Loopback, Configuration
196162

197-
198163
4.2)
199-
int
200-
bcan_get_err_counter(bcan_hdl_t hdl, uint8_t *rx_err_counter, uint8_t *tx_err_counter)
164+
int bcan_get_err_counter(bcan_hdl_t hdl, uint8_t *rx_err_counter, uint8_t *tx_err_counter)
201165

202166
After this call 'rx_err_counter' and 'tx_err_counter' will contain the
203167
respective values from the Error Count register. These values are a indicator
204168
of the health of the CAN controller and bus.
205169

206170
Return value: 0 on success, error code (see Section 5) on failure.
207171

208-
209-
================================================
172+
======================================================
210173
5. Version & Build Info
174+
======================================================
175+
5.1)
176+
const char *bcan_get_libversion(void)
211177

212-
New in 1.2. See tools/bcan/can_app.c for usage examples.
213-
214-
- Returns bcan library version; e.g., "1.2".
215-
const char *bcan_get_libversion(void)
216-
217-
- Returns detailed bcan library build info.
218-
const char *bcan_bld_info(void);
219-
220-
- Returns brief bcan library build info.
221-
const char *bcan_bld_info_short(void);
222-
178+
Return bcan library version; e.g., "3.0.0.1".
223179

224-
================================================
180+
======================================================
225181
6. Error codes
182+
======================================================
183+
6.1)
184+
const char *bcan_get_err_msg(int err_code);
226185

227-
API (new in 1.2):
228-
229-
- Returns error message corresponding to the given error code.
230-
const char *bcan_get_err_msg(int err_code);
186+
Return error message corresponding to the given error code.
231187

188+
6.2)
232189
List of error code; all values below are negative.
233190

234191
- BCAN_HDL_INVALID

baidu/include/README.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

baidu/include/baidu/adv_trigger_ctl.h

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)