System Management code

Dependencies:   CANBuffer mbed SystemManagement mbed-rtos

Dependents:   SystemManagement

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CAN_Filter_LUT.h Source File

CAN_Filter_LUT.h

00001 /*
00002 Code by Parth Patel, Penn Electric Racing 2014, 9/23/2014
00003  
00004 This library provides an easy to use, buffered, hardware-filtered CAN interface for
00005 high performance CAN applications.  Provides automatic reception of messages via CAN RX interrupt
00006 into a rx ring buffer.  Provides automatic transmission of messages via CAN TX interrupt.
00007  
00008 @File CAN_Filter_LUT.h: Contains the formatted lookup tables to program the onboard CAN acceptance filters
00009  
00010 */
00011 #ifndef _FILE_CAN_FILTER_LUT_H
00012 #define _FILE_CAN_FILTER_LUT_H
00013  
00014 #define STDMASK 0x7FF
00015 #define EXTMASK 0x1FFFFFFF
00016  
00017 // These arrays defines the CAN Controller Acceptance Filter Lookup Table.
00018 // Follow notes below or else the chip's behaviour will be undefined
00019 // MAX SIZE PERMITTED = 512 32bit ints total across all tables
00020 // Note that AF_LUT_SEI is 16bit, divide #entries by 2 for this one
00021 // Note that AF_LUT_EIR is 64bit, multipy #entries by 2 for this one
00022  
00023 const uint16_t AF_LUT_SEI[] = {
00024 // !! ID's MUST BE IN ASCENDING ORDER (starting at 0x00) !!
00025  
00026 // STANDARD EXPLICIT IDs - CAN CONTROLLER 1
00027 //( 0xID                              & STDMASK),
00028  
00029 // STANDARD EXPLICIT IDs - CAN CONTROLLER 2
00030 //( 0xID                              & STDMASK) | 1<<13,
00031 };
00032  
00033 const uint32_t AF_LUT_SIR[] = {
00034 // !! ID's MUST BE IN ASCENDING ORDER (starting at 0x00), NO OVERLAPPING RANGES !!
00035  
00036 // STANDARD ID RANGES - CAN CONTROLLER 1
00037 //( 0xLOWERBOUND & STDMASK) << 16         | ( 0xUPPERBOUND & STDMASK),          lower/upperbounds are inclusive
00038  
00039 // STANDARD ID RANGES - CAN CONTROLLER 2
00040 //( 0xLOWERBOUND & STDMASK | 1<<13) << 16 | ( 0xUPPERBOUND & STDMASK | 1<<13),  lower/upperbounds are inclusive
00041   ( 0x400        & STDMASK | 1<<13) << 16 | ( 0x4FF        & STDMASK | 1<<13),  // Index1
00042 };
00043  
00044 const uint32_t AF_LUT_EEI[] = {
00045 // !! ID's MUST BE IN ASCENDING ORDER (starting at 0x00) !!
00046  
00047 // EXTENDED EXPLICIT IDs - CAN CONTROLLER 1
00048 //( 0xID                              & EXTMASK),
00049  
00050 // EXTENDED EXPLICIT IDs - CAN CONTROLLER 2
00051 //( 0xID                              & EXTMASK) | 1<<29,
00052 };
00053  
00054 const uint64_t AF_LUT_EIR[] = {
00055 // !! ID's MUST BE IN ASCENDING ORDER (starting at 0x00), NO OVERLAPPING RANGES !!
00056  
00057 // EXTENDED ID RANGES - CAN CONTROLLER 1
00058 //( 0xLOWERBOUND & EXTMASK) << 32         | ( 0xUPPERBOUND & EXTMASK), lower/upperbounds are inclusive
00059  
00060 // EXTENDED ID RANGES - CAN CONTROLLER 2
00061 //( 0xLOWERBOUND & EXTMASK | 1<<29) << 32 | ( 0xUPPERBOUND & EXTMASK | 1<<29), lower/upperbounds are inclusive
00062  
00063 };
00064  
00065 #endif