source: trunk/Cosy/incl/afil.h@ 19985

Last change on this file since 19985 was 731, checked in by tbretz, 24 years ago
*** empty log message ***
File size: 2.9 KB
Line 
1/*-----------------------------------------------------------------------------
2afil.h -- Acceptance filtering of CAN messages
3
4Copyright (c) 1994 JANZ Computer AG
5All Rights Reserved
6
7Created 94/10/11 by Soenke Hansen
8Version 1.7 of 99/12/07
9
10Based on their Id's received CAN messages are accepted or rejected.
11CAN frames for which the filter is open will always be accepted.
12A close request to the filter may not honored as it is possible
13that the filter is not implemented.
14
15-----------------------------------------------------------------------------*/
16
17#ifndef afil_DEFINED
18#define afil_DEFINED
19
20#ifdef __cplusplus
21extern "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/* */
34extern BYTE_t id_filter[];
35
36/* Initialize the acceptance filter for CAN identifiers */
37extern void init_afil(void);
38
39/* Return true if CAN message with given Id is accepted */
40extern 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 */
44extern 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 */
48extern 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 */
52extern 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 */
56extern void rclose_afil(WORD_t, WORD_t);
57
58/* Get the current state of the filter mask for a given id. */
59extern int get_afil_mask(WORD_t);
60
61/* Set the filter mask for a given id. */
62extern 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. */
66void 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 */
70extern 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 */
74extern 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
92extern void initSniffFil(void);
93extern void rangeSetSniffFil(BYTE_t canSpec, WORD_t idl, WORD_t idh, BYTE_t value);
94extern int getSniffFil(BYTE_t canSpec, LWORD_t id);
95
96#ifdef __cplusplus
97}
98#endif
99
100#endif /* !afil_DEFINED */
Note: See TracBrowser for help on using the repository browser.