System Management code

Dependencies:   mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP

Fork of SystemManagement by Martin Deng

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 #include "CAN_RxIDs.h"
00014 
00015 #define STDMASK 0x7FF
00016 #define EXTMASK 0x1FFFFFFF
00017  
00018 // These arrays defines the CAN Controller Acceptance Filter Lookup Table.
00019 // Follow notes below or else the chip's behaviour will be undefined
00020 // MAX SIZE PERMITTED = 512 32bit ints total across all tables
00021 // Note that AF_LUT_SEI is 16bit, divide #entries by 2 for this one
00022 // Note that AF_LUT_EIR is 64bit, multipy #entries by 2 for this one
00023  
00024 const uint16_t AF_LUT_SEI[] = {
00025 // !! ID's MUST BE IN ASCENDING ORDER (starting at 0x00) !!
00026  
00027 // STANDARD EXPLICIT IDs - CAN CONTROLLER 1
00028 //( 0xID                              & STDMASK),
00029  
00030 // STANDARD EXPLICIT IDs - CAN CONTROLLER 2
00031 //( 0xID                              & STDMASK) | 1<<13,
00032 };
00033  
00034 const uint32_t AF_LUT_SIR[] = {
00035 // !! ID's MUST BE IN ASCENDING ORDER (starting at 0x00), NO OVERLAPPING RANGES !!
00036  
00037 // STANDARD ID RANGES - CAN CONTROLLER 1
00038 //( 0xLOWERBOUND & STDMASK) << 16         | ( 0xUPPERBOUND & STDMASK),          lower/upperbounds are inclusive
00039  
00040 // STANDARD ID RANGES - CAN CONTROLLER 2
00041 //( 0xLOWERBOUND & STDMASK | 1<<13) << 16 | ( 0xUPPERBOUND & STDMASK | 1<<13),  lower/upperbounds are inclusive
00042 ( 0x200 & STDMASK | 1<<13) << 16 | ( 0x7FF & STDMASK | 1<<13),  //lower/upperbounds are inclusive, 0x200 to 0x7FF includes everything except motor controller messages
00043 
00044 };
00045  
00046 const uint32_t AF_LUT_EEI[] = {
00047 // !! ID's MUST BE IN ASCENDING ORDER (starting at 0x00) !!
00048  
00049 // EXTENDED EXPLICIT IDs - CAN CONTROLLER 1
00050 //( 0xID                              & EXTMASK),
00051  
00052 // EXTENDED EXPLICIT IDs - CAN CONTROLLER 2
00053 //( 0xID                              & EXTMASK) | 1<<29,
00054 };
00055  
00056 const uint64_t AF_LUT_EIR[] = {
00057 // !! ID's MUST BE IN ASCENDING ORDER (starting at 0x00), NO OVERLAPPING RANGES !!
00058  
00059 // EXTENDED ID RANGES - CAN CONTROLLER 1
00060 //( 0xLOWERBOUND & EXTMASK) << 32         | ( 0xUPPERBOUND & EXTMASK), lower/upperbounds are inclusive
00061  
00062 // EXTENDED ID RANGES - CAN CONTROLLER 2
00063 //( 0xLOWERBOUND & EXTMASK | 1<<29) << 32 | ( 0xUPPERBOUND & EXTMASK | 1<<29), lower/upperbounds are inclusive
00064  
00065 };
00066  
00067 #endif