00001 /* ---------------------------------------------------------------------------- 00002 * SAM Software Package License 00003 * ---------------------------------------------------------------------------- 00004 * Copyright (c) 2011, Atmel Corporation 00005 * 00006 * All rights reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions are met: 00010 * 00011 * - Redistributions of source code must retain the above copyright notice, 00012 * this list of conditions and the disclaimer below. 00013 * 00014 * Atmel's name may not be used to endorse or promote products derived from 00015 * this software without specific prior written permission. 00016 * 00017 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR 00018 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00019 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00020 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, 00021 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00022 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 00023 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00024 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00025 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00026 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 * ---------------------------------------------------------------------------- 00028 */ 00029 00030 /** 00031 * \file 00032 * 00033 * \section Purpose 00034 * 00035 * Interface for configuring and using Timer Counter (TC) peripherals. 00036 * 00037 * \section Usage 00038 * -# Optionally, use TC_FindMckDivisor() to let the program find the best 00039 * TCCLKS field value automatically. 00040 * -# Configure a Timer Counter in the desired mode using TC_Configure(). 00041 * -# Start or stop the timer clock using TC_Start() and TC_Stop(). 00042 */ 00043 00044 #ifndef _MCAN_CONFIG_ 00045 #define _MCAN_CONFIG_ 00046 00047 /*------------------------------------------------------------------------------ 00048 * Headers 00049 *------------------------------------------------------------------------------*/ 00050 00051 00052 /*------------------------------------------------------------------------------ 00053 * Global functions 00054 *------------------------------------------------------------------------------*/ 00055 00056 #ifdef __cplusplus 00057 extern "C" { 00058 #endif 00059 00060 /* Programmable Clock Source for Baud Rate is Common To Both MCAN Controllers */ 00061 #define MCAN_PROG_CLK_PRESCALER 1 /* /1 to /256 */ 00062 // select one of the following for the programmable clock source 00063 //#define MCAN_PROG_CLK_SELECT PMC_PCK_CSS_SLOW_CLK 00064 //#define MCAN_PROG_CLK_SELECT PMC_PCK_CSS_MAIN_CLK 00065 //#define MCAN_PROG_CLK_SELECT PMC_PCK_CSS_PLLA_CLK 00066 //#define MCAN_PROG_CLK_SELECT PMC_PCK_CSS_UPLL_CLK 00067 #define MCAN_PROG_CLK_SELECT PMC_PCK_CSS_MCK 00068 #define MCAN_PROG_CLK_FREQ_HZ \ 00069 ( (float) 150000000 / (float) MCAN_PROG_CLK_PRESCALER ) 00070 00071 #define MCAN0_BIT_RATE_BPS 500000 00072 #define MCAN0_PROP_SEG 2 00073 #define MCAN0_PHASE_SEG1 11 00074 #define MCAN0_PHASE_SEG2 11 00075 #define MCAN0_SYNC_JUMP 4 00076 00077 #define MCAN0_FAST_BIT_RATE_BPS 2000000 00078 #define MCAN0_FAST_PROP_SEG 2 00079 #define MCAN0_FAST_PHASE_SEG1 4 00080 #define MCAN0_FAST_PHASE_SEG2 4 00081 #define MCAN0_FAST_SYNC_JUMP 2 00082 00083 #define MCAN0_NMBR_STD_FLTS 8 /* 128 max filters */ 00084 #define MCAN0_NMBR_EXT_FLTS 8 /* 64 max filters */ 00085 #define MCAN0_NMBR_RX_FIFO0_ELMTS 0 /* # of elements, 64 elements max */ 00086 #define MCAN0_NMBR_RX_FIFO1_ELMTS 0 /* # of elements, 64 elements max */ 00087 #define MCAN0_NMBR_RX_DED_BUF_ELMTS 16 /* # of elements, 64 elements max */ 00088 #define MCAN0_NMBR_TX_EVT_FIFO_ELMTS 0 /* # of elements, 32 elements max */ 00089 #define MCAN0_NMBR_TX_DED_BUF_ELMTS 4 /* # of elements, 32 elements max */ 00090 #define MCAN0_NMBR_TX_FIFO_Q_ELMTS 0 /* # of elements, 32 elements max */ 00091 #define MCAN0_RX_FIFO0_ELMT_SZ 8 /* 8, 12, 16, 20, 24, 32, 48, 64 bytes */ 00092 #define MCAN0_RX_FIFO1_ELMT_SZ 8 /* 8, 12, 16, 20, 24, 32, 48, 64 bytes */ 00093 #define MCAN0_RX_BUF_ELMT_SZ 8 /* 8, 12, 16, 20, 24, 32, 48, 64 bytes */ 00094 #define MCAN0_TX_BUF_ELMT_SZ 8 /* 8, 12, 16, 20, 24, 32, 48, 64 bytes */ 00095 00096 #define MCAN1_BIT_RATE_BPS 500000 00097 #define MCAN1_PROP_SEG 2 00098 #define MCAN1_PHASE_SEG1 11 00099 #define MCAN1_PHASE_SEG2 11 00100 #define MCAN1_SYNC_JUMP 4 00101 00102 #define MCAN1_FAST_BIT_RATE_BPS 2000000 00103 #define MCAN1_FAST_PROP_SEG 2 00104 #define MCAN1_FAST_PHASE_SEG1 4 00105 #define MCAN1_FAST_PHASE_SEG2 4 00106 #define MCAN1_FAST_SYNC_JUMP 2 00107 00108 #define MCAN1_NMBR_STD_FLTS 8 /* 128 max filters */ 00109 #define MCAN1_NMBR_EXT_FLTS 8 /* 64 max filters */ 00110 #define MCAN1_NMBR_RX_FIFO0_ELMTS 12 /* # of elements, 64 elements max */ 00111 #define MCAN1_NMBR_RX_FIFO1_ELMTS 0 /* # of elements, 64 elements max */ 00112 #define MCAN1_NMBR_RX_DED_BUF_ELMTS 4 /* # of elements, 64 elements max */ 00113 #define MCAN1_NMBR_TX_EVT_FIFO_ELMTS 0 /* # of elements, 32 elements max */ 00114 #define MCAN1_NMBR_TX_DED_BUF_ELMTS 4 /* # of elements, 32 elements max */ 00115 #define MCAN1_NMBR_TX_FIFO_Q_ELMTS 4 /* # of elements, 32 elements max */ 00116 #define MCAN1_RX_FIFO0_ELMT_SZ 8 /* 8, 12, 16, 20, 24, 32, 48, 64 bytes */ 00117 #define MCAN1_RX_FIFO1_ELMT_SZ 8 /* 8, 12, 16, 20, 24, 32, 48, 64 bytes */ 00118 #define MCAN1_RX_BUF_ELMT_SZ 64 /* 8, 12, 16, 20, 24, 32, 48, 64 bytes */ 00119 #define MCAN1_TX_BUF_ELMT_SZ 32 /* 8, 12, 16, 20, 24, 32, 48, 64 bytes */ 00120 00121 #ifdef __cplusplus 00122 } 00123 #endif 00124 00125 #endif /* #ifndef _MCAN_CONFIG_ */ 00126