Apollo
10.0
自动驾驶开放平台
bcan_lib.h
浏览该文件的文档.
1
/******************************************************************************
2
* Copyright 2017 The Apollo Authors. All Rights Reserved.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*****************************************************************************/
16
17
#pragma once
18
19
#include <sys/ioctl.h>
20
#include <sys/types.h>
21
#include <cstdint>
22
#include <cstdlib>
23
24
#include "linux/zynq_api.h"
25
26
#ifdef DEBUG
27
#define BLOG_DBG0(s...) syslog(LOG_DEBUG, s);
28
#else
29
#define BLOG_DBG0(s...) \
30
do { \
31
} while (0);
32
#endif
33
#define BLOG_ERR(s...) syslog(LOG_ERR, s);
34
35
typedef
uint64_t
bcan_hdl_t
;
36
37
#define BCAN_MAX_TX_MSG 256
38
#define BCAN_MAX_RX_MSG 256
39
40
typedef
struct
bcan_ihdl
{
41
int
dev_index
;
42
int
dev_state
;
43
int
fd
;
44
uint32_t
baudrate
;
45
uint32_t
tx_to
;
46
uint32_t
rx_to
;
47
}
bcan_ihdl_t
;
48
49
// Channel states
50
#define BCAN_DEV_UNINIT -1
51
#define BCAN_DEV_OPEN (1 << 0)
52
#define BCAN_DEV_CLOSE (1 << 1)
53
#define BCAN_DEV_BAUD_SET (1 << 2)
54
#define BCAN_DEV_NORMAL (1 << 3)
55
#define BCAN_DEV_LOOPBACK (1 << 4)
56
#define BCAN_DEV_CONFIG (1 << 5)
57
#define BCAN_DEV_START (1 << 6)
58
#define BCAN_DEV_STOP (1 << 7)
59
#define BCAN_DEV_ACTIVE (1 << 8)
60
#define BCAN_DEV_RECVD (1 << 9)
bcan_ihdl_t
struct bcan_ihdl bcan_ihdl_t
bcan_hdl_t
uint64_t bcan_hdl_t
Definition
bcan_lib.h:35
bcan_ihdl
Definition
bcan_lib.h:40
bcan_ihdl::dev_index
int dev_index
Definition
bcan_lib.h:41
bcan_ihdl::baudrate
uint32_t baudrate
Definition
bcan_lib.h:44
bcan_ihdl::fd
int fd
Definition
bcan_lib.h:43
bcan_ihdl::tx_to
uint32_t tx_to
Definition
bcan_lib.h:45
bcan_ihdl::rx_to
uint32_t rx_to
Definition
bcan_lib.h:46
bcan_ihdl::dev_state
int dev_state
Definition
bcan_lib.h:42
modules
drivers
canbus
can_client
hermes_can
bcan_lib.h