beautypg.com

Acrosser AIV-HM76V1FL User Manual

Page 53

background image

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 field of the CAN packet are examined with the filters.

There are two acceptance masks (mask0 and mask1)

and six acceptance filters (filter0 ~ filter5) in the CAN Bus

subsystem. Filter0 ~ filter1 are associated with mask0.

Filter2 ~ filter4 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 field ‘maskId’ to indicate the

mask they want and the API put the setting of the mask in

the ‘mask’ field.

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”);