1 | /*-----------------------------------------------------------------------------
|
---|
2 | afil.h -- Acceptance filtering of CAN messages
|
---|
3 |
|
---|
4 | Copyright (c) 1994 JANZ Computer AG
|
---|
5 | All Rights Reserved
|
---|
6 |
|
---|
7 | Created 94/10/11 by Soenke Hansen
|
---|
8 | Version 1.7 of 99/12/07
|
---|
9 |
|
---|
10 | Based on their Id's received CAN messages are accepted or rejected.
|
---|
11 | CAN frames for which the filter is open will always be accepted.
|
---|
12 | A close request to the filter may not honored as it is possible
|
---|
13 | that the filter is not implemented.
|
---|
14 |
|
---|
15 | -----------------------------------------------------------------------------*/
|
---|
16 |
|
---|
17 | #ifndef afil_DEFINED
|
---|
18 | #define afil_DEFINED
|
---|
19 |
|
---|
20 | #ifdef __cplusplus
|
---|
21 | extern "C" {
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include "defs.h"
|
---|
25 | #include "msg.h"
|
---|
26 | #include "icanconf.h"
|
---|
27 |
|
---|
28 |
|
---|
29 | /*-------- Acceptance Filtering of CAN Ids ---------------------------------*/
|
---|
30 |
|
---|
31 | #if ICAN_FILTER == 1
|
---|
32 |
|
---|
33 | /* */
|
---|
34 | extern BYTE_t id_filter[];
|
---|
35 |
|
---|
36 | /* Initialize the acceptance filter for CAN identifiers */
|
---|
37 | extern void init_afil(void);
|
---|
38 |
|
---|
39 | /* Return true if CAN message with given Id is accepted */
|
---|
40 | extern int accept_afil(WORD_t);
|
---|
41 |
|
---|
42 | /* Open the acceptance filter for a given id, so messages received
|
---|
43 | with this id will pass the acceptance test */
|
---|
44 | extern void open_afil(WORD_t);
|
---|
45 |
|
---|
46 | /* Close the acceptance filter for a given id, so messages received
|
---|
47 | with this id will not pass the acceptance test */
|
---|
48 | extern void close_afil(WORD_t);
|
---|
49 |
|
---|
50 | /* Open the acceptance filter for a given range of ids, so messages received
|
---|
51 | with ids in that range will pass the acceptance test */
|
---|
52 | extern void ropen_afil(WORD_t, WORD_t);
|
---|
53 |
|
---|
54 | /* Close the acceptance filter for a given range of ids, so messages received
|
---|
55 | with ids in that range will not pass the acceptance test */
|
---|
56 | extern void rclose_afil(WORD_t, WORD_t);
|
---|
57 |
|
---|
58 | /* Get the current state of the filter mask for a given id. */
|
---|
59 | extern int get_afil_mask(WORD_t);
|
---|
60 |
|
---|
61 | /* Set the filter mask for a given id. */
|
---|
62 | extern void set_afil_mask(WORD_t, WORD_t);
|
---|
63 |
|
---|
64 | /* Set the acceptance filter mask for a given range of ids.
|
---|
65 | You may set the mask to a value in the range 0..(2^BITS_PER_ID)-1. */
|
---|
66 | void rset_afil_mask(WORD_t, WORD_t, WORD_t);
|
---|
67 |
|
---|
68 | /* Open the sniff acceptance filter for a given range of ids, so messages received
|
---|
69 | with ids in that range will pass the acceptance test */
|
---|
70 | extern void ropen_sniff_fil(BYTE_t, WORD_t, WORD_t);
|
---|
71 |
|
---|
72 | /* Close the sniff acceptance filter for a given range of ids, so messages received
|
---|
73 | with ids in that range will not pass the acceptance test */
|
---|
74 | extern void rclose_sniff_fil(BYTE_t, WORD_t, WORD_t);
|
---|
75 |
|
---|
76 | #endif /* ICAN_FILTER == 1 */
|
---|
77 |
|
---|
78 | #if ICAN_FILTER == 0 /* filtering not implemented; dummies */
|
---|
79 | #define init_afil()
|
---|
80 | #define accept_afil(id) 1 /* accept everything */
|
---|
81 | #define open_afil(id)
|
---|
82 | #define close_afil(id)
|
---|
83 | #define ropen_afil(idl, idh)
|
---|
84 | #define rclose_afil(idl, idh)
|
---|
85 | #endif /* ICAN_FILTER == 0 */
|
---|
86 |
|
---|
87 |
|
---|
88 |
|
---|
89 | #define CAN_2_0_A 1
|
---|
90 | #define CAN_2_0_B 2
|
---|
91 |
|
---|
92 | extern void initSniffFil(void);
|
---|
93 | extern void rangeSetSniffFil(BYTE_t canSpec, WORD_t idl, WORD_t idh, BYTE_t value);
|
---|
94 | extern int getSniffFil(BYTE_t canSpec, LWORD_t id);
|
---|
95 |
|
---|
96 | #ifdef __cplusplus
|
---|
97 | }
|
---|
98 | #endif
|
---|
99 |
|
---|
100 | #endif /* !afil_DEFINED */
|
---|