Compare commits
4 Commits
cb19c9d24b
...
8675d64fb5
| Author | SHA1 | Date |
|---|---|---|
|
|
8675d64fb5 | |
|
|
7939678070 | |
|
|
88a0417a6b | |
|
|
65e715d56d |
|
|
@ -72,6 +72,9 @@
|
||||||
#ifndef SO_TIMESTAMPING
|
#ifndef SO_TIMESTAMPING
|
||||||
#define SO_TIMESTAMPING 37
|
#define SO_TIMESTAMPING 37
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef SCM_TIMESTAMPING
|
||||||
|
#define SCM_TIMESTAMPING SO_TIMESTAMPING
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TIMESTAMPSZ 50 /* string 'absolute with date' requires max 49 bytes */
|
#define TIMESTAMPSZ 50 /* string 'absolute with date' requires max 49 bytes */
|
||||||
|
|
||||||
|
|
@ -807,13 +810,13 @@ int main(int argc, char **argv)
|
||||||
for (cmsg = CMSG_FIRSTHDR(&msg);
|
for (cmsg = CMSG_FIRSTHDR(&msg);
|
||||||
cmsg && (cmsg->cmsg_level == SOL_SOCKET);
|
cmsg && (cmsg->cmsg_level == SOL_SOCKET);
|
||||||
cmsg = CMSG_NXTHDR(&msg,cmsg)) {
|
cmsg = CMSG_NXTHDR(&msg,cmsg)) {
|
||||||
if (cmsg->cmsg_type == SO_TIMESTAMP) {
|
if (cmsg->cmsg_type == SCM_TIMESTAMP) {
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
memcpy(&tv, CMSG_DATA(cmsg), sizeof(tv));
|
memcpy(&tv, CMSG_DATA(cmsg), sizeof(tv));
|
||||||
ts.tv_sec = tv.tv_sec;
|
ts.tv_sec = tv.tv_sec;
|
||||||
ts.tv_nsec = tv.tv_usec;
|
ts.tv_nsec = tv.tv_usec;
|
||||||
ts.tv_nsec *= 1000;
|
ts.tv_nsec *= 1000;
|
||||||
} else if (cmsg->cmsg_type == SO_TIMESTAMPING) {
|
} else if (cmsg->cmsg_type == SCM_TIMESTAMPING) {
|
||||||
struct timespec *stamp = (struct timespec *)CMSG_DATA(cmsg);
|
struct timespec *stamp = (struct timespec *)CMSG_DATA(cmsg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
12
j1939acd.c
12
j1939acd.c
|
|
@ -112,10 +112,10 @@ static struct {
|
||||||
int sig_alrm;
|
int sig_alrm;
|
||||||
int sig_usr1;
|
int sig_usr1;
|
||||||
int state;
|
int state;
|
||||||
#define STATE_INITIAL 0
|
#define STATE_INITIAL 0
|
||||||
#define STATE_REQ_SENT 1
|
#define STATE_REQ_SENT 1
|
||||||
#define STATE_REQ_PENDING 2 /* wait 1250 msec for first claim */
|
#define STATE_REQ_PENDING 2 /* wait 1250 msec for first claim */
|
||||||
#define STATE_OPERATIONAL 3
|
#define STATE_OPERATIONAL 3
|
||||||
} s = {
|
} s = {
|
||||||
.intf = default_intf,
|
.intf = default_intf,
|
||||||
.ranges = default_range,
|
.ranges = default_range,
|
||||||
|
|
@ -126,8 +126,8 @@ static struct {
|
||||||
struct {
|
struct {
|
||||||
uint64_t name;
|
uint64_t name;
|
||||||
int flags;
|
int flags;
|
||||||
#define F_USE 0x01
|
#define F_USE 0x01
|
||||||
#define F_SEEN 0x02
|
#define F_SEEN 0x02
|
||||||
} addr[J1939_IDLE_ADDR /* =254 */];
|
} addr[J1939_IDLE_ADDR /* =254 */];
|
||||||
|
|
||||||
/* lookup by name */
|
/* lookup by name */
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,9 @@ static struct {
|
||||||
int pkt_len;
|
int pkt_len;
|
||||||
int priority;
|
int priority;
|
||||||
int defined;
|
int defined;
|
||||||
#define DEF_SRC 1
|
#define DEF_SRC 1
|
||||||
#define DEF_DST 2
|
#define DEF_DST 2
|
||||||
#define DEF_PRIO 4
|
#define DEF_PRIO 4
|
||||||
struct sockaddr_can src, dst;
|
struct sockaddr_can src, dst;
|
||||||
} s = {
|
} s = {
|
||||||
.priority = 6,
|
.priority = 6,
|
||||||
|
|
|
||||||
7
lib.c
7
lib.c
|
|
@ -83,8 +83,8 @@ static inline void _put_id(char *buf, int end_offset, canid_t id)
|
||||||
|
|
||||||
/* CAN DLC to real data length conversion helpers */
|
/* CAN DLC to real data length conversion helpers */
|
||||||
|
|
||||||
static const unsigned char dlc2len[] = {0, 1, 2, 3, 4, 5, 6, 7,
|
static const unsigned char dlc2len[] = {
|
||||||
8, 12, 16, 20, 24, 32, 48, 64};
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 20, 24, 32, 48, 64};
|
||||||
|
|
||||||
/* get data length from raw data length code (DLC) */
|
/* get data length from raw data length code (DLC) */
|
||||||
unsigned char can_fd_dlc2len(unsigned char dlc)
|
unsigned char can_fd_dlc2len(unsigned char dlc)
|
||||||
|
|
@ -92,7 +92,8 @@ unsigned char can_fd_dlc2len(unsigned char dlc)
|
||||||
return dlc2len[dlc & 0x0F];
|
return dlc2len[dlc & 0x0F];
|
||||||
}
|
}
|
||||||
|
|
||||||
static const unsigned char len2dlc[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, /* 0 - 8 */
|
static const unsigned char len2dlc[] = {
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7, 8, /* 0 - 8 */
|
||||||
9, 9, 9, 9, /* 9 - 12 */
|
9, 9, 9, 9, /* 9 - 12 */
|
||||||
10, 10, 10, 10, /* 13 - 16 */
|
10, 10, 10, 10, /* 13 - 16 */
|
||||||
11, 11, 11, 11, /* 17 - 20 */
|
11, 11, 11, 11, /* 17 - 20 */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue