User guide

AIV-HM76V1FL Series User Manual
53
www.acrosser.com
Syntax: i32 getCanMask(struct CanMask *mask)
Description:
This function gets the current setting of the acceptance
masks. Masks are used to determine which bits in the
ID eld of the CAN packet are examined with the lters.
There are two acceptance masks (mask0 and mask1)
and six acceptance lters (lter0 ~ lter5) in the CAN Bus
subsystem. Filter0 ~ lter1 are associated with mask0.
Filter2 ~ lter4 are associated with mask1.
Here is the Mask/Filter truth table:
Mask bit n Filter bit n Message ID
bit n
Accept or
reject bit n
0 x x Accept
1 0 0 Accept
1 0 1 Reject
1 1 0 Reject
1 1 1 Accept
Note: x = don’t care
Parameters:
This parameter ‘mask’ is a pointer to a variable of type
‘CanMask’. Users use the eld ‘maskId’ to indicate the
mask they want and the API put the setting of the mask in
the ‘mask’ eld.
struct CanMask {
u8 maskId; // 0 or 1
u32 mask;
}
Return Value:
If this function receives the mask setting successfully, it
returns 0, any other returned value stands for error.
For example:
struct CanMask a_mask;
a_mask.maskId = 0; // indicate the mask0
i32 result;
result = getCanMask(&a_mask); // The setting of the
mask is put at
// a_mask.mask
if( result != 0)
printf(“Fail to get mask!\n”);