Mercurial > nand-ecoscentric
annotate packages/devs/can/arm/lpc2xxx/current/include/can_lpc2xxx_baudrates.h @ 2417:05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
baudrate table entries (they aren't intended to be interpreted as
octal)
* tests/can_baudrates.c
tests/can_busload.c
tests/can_rx_tx.c: removed #include pkgconf/devs_can_loop.h
| author | asl |
|---|---|
| date | Fri, 17 Aug 2007 08:10:44 +0000 |
| parents | e8eaf852a606 |
| children | a52d470bc691 |
| rev | line source |
|---|---|
| 2409 | 1 #ifndef CYGONCE_CAN_LPC2XXX_BAUDRATES_H |
| 2 #define CYGONCE_CAN_LPC2XXX_BAUDRATES_H | |
| 3 //========================================================================== | |
| 4 // | |
| 5 // devs/can/arm/lpc2xxx/current/include/can_lpc2xxx_baudrates.h | |
| 6 // | |
| 7 // Precalculated values for bit timing register | |
| 8 // | |
| 9 //========================================================================== | |
| 10 //####ECOSGPLCOPYRIGHTBEGIN#### | |
| 11 // ------------------------------------------- | |
| 12 // This file is part of eCos, the Embedded Configurable Operating System. | |
| 13 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. | |
| 14 // Copyright (C) 2003 Gary Thomas | |
| 15 // | |
| 16 // eCos is free software; you can redistribute it and/or modify it under | |
| 17 // the terms of the GNU General Public License as published by the Free | |
| 18 // Software Foundation; either version 2 or (at your option) any later version. | |
| 19 // | |
| 20 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY | |
| 21 // WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 22 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 23 // for more details. | |
| 24 // | |
| 25 // You should have received a copy of the GNU General Public License along | |
| 26 // with eCos; if not, write to the Free Software Foundation, Inc., | |
| 27 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
| 28 // | |
| 29 // As a special exception, if other files instantiate templates or use macros | |
| 30 // or inline functions from this file, or you compile this file and link it | |
| 31 // with other works to produce a work based on this file, this file does not | |
| 32 // by itself cause the resulting work to be covered by the GNU General Public | |
| 33 // License. However the source code for this file must still be made available | |
| 34 // in accordance with section (3) of the GNU General Public License. | |
| 35 // | |
| 36 // This exception does not invalidate any other reasons why a work based on | |
| 37 // this file might be covered by the GNU General Public License. | |
| 38 // | |
| 39 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. | |
| 40 // at http://sources.redhat.com/ecos/ecos-license/ | |
| 41 // ------------------------------------------- | |
| 42 //####ECOSGPLCOPYRIGHTEND#### | |
| 43 //========================================================================== | |
| 44 //#####DESCRIPTIONBEGIN#### | |
| 45 // | |
| 46 // Author(s): Uwe Kindler | |
| 47 // Contributors: Uwe Kindler | |
| 48 // Date: 2007-07-01 | |
| 49 // Purpose: Precalculated bit timing values for various baudrates | |
| 50 // Description: | |
| 51 // | |
| 52 //####DESCRIPTIONEND#### | |
| 53 // | |
| 54 //========================================================================== | |
| 55 | |
| 56 | |
| 57 // | |
| 58 // Peripheral clock speed | |
| 59 // | |
| 60 #define CYGNUM_CAN_LPC2XXX_VPB_CLK (CYGNUM_HAL_ARM_LPC2XXX_CLOCK_SPEED / CYGNUM_HAL_ARM_LPC2XXX_VPBDIV) | |
| 61 | |
| 62 // | |
| 63 // Macro for creation of CAN_BR value for baudrate tbl | |
| 64 // | |
| 65 #define CAN_BR_TBL_ENTRY(_brp_, _tseg1_, _tseg2_, _sjw_, _sam_) \ | |
| 66 ((_sam_ << 23) | (_tseg2_ << 20) | (_tseg1_ << 16) | (_sjw_ << 14) | (_brp_)) | |
| 67 | |
| 68 | |
| 69 //========================================================================== | |
| 70 // BAUDRATES | |
| 71 //========================================================================== | |
| 72 #if CYGNUM_CAN_LPC2XXX_VPB_CLK == 60000000 | |
| 73 // | |
| 74 // Table with register values for baudrates at peripheral clock of 60 MHz | |
| 75 // | |
| 76 static const cyg_uint32 lpc2xxx_br_tbl[] = | |
| 77 { | |
|
2417
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
78 CAN_BR_TBL_ENTRY(300, 15, 2, 0, 1), // 10 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
79 CAN_BR_TBL_ENTRY(150, 15, 2, 0, 1), // 20 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
80 CAN_BR_TBL_ENTRY(59, 15, 2, 0, 1), // 50 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
81 CAN_BR_TBL_ENTRY(39, 11, 1, 0, 1), // 100 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
82 CAN_BR_TBL_ENTRY(29, 12, 1, 0, 1), // 125 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
83 CAN_BR_TBL_ENTRY(14, 12, 1, 0, 1), // 250 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
84 CAN_BR_TBL_ENTRY( 7, 11, 1, 0, 0), // 500 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
85 CAN_BR_TBL_ENTRY( 4, 11, 1, 0, 0), // 800 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
86 CAN_BR_TBL_ENTRY( 3, 11, 1, 0, 0), // 1000 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
87 CAN_BR_TBL_ENTRY( 0, 0, 0, 0, 0), // Autobaud - not supported |
| 2409 | 88 }; |
| 89 #define HAL_LPC2XXX_BAUD_TBL_DEFINED 1 | |
| 90 #endif // CYGNUM_CAN_LPC2XXX_VPB_CLK == 60000000 | |
| 91 | |
| 92 #if CYGNUM_CAN_LPC2XXX_VPB_CLK == 30000000 | |
| 93 // | |
| 94 // Table with register values for baudrates at peripheral clock of 30 MHz | |
| 95 // | |
| 96 static const cyg_uint32 lpc2xxx_br_tbl[] = | |
| 97 { | |
|
2417
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
98 CAN_BR_TBL_ENTRY( 0, 0, 0, 0, 0), // 10 kbaud - not supported |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
99 CAN_BR_TBL_ENTRY( 0, 0, 0, 0, 0), // 20 kbaud - not supported |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
100 CAN_BR_TBL_ENTRY(59, 15, 2, 0, 1), // 50 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
101 CAN_BR_TBL_ENTRY(39, 11, 1, 0, 1), // 100 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
102 CAN_BR_TBL_ENTRY(29, 12, 1, 0, 1), // 125 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
103 CAN_BR_TBL_ENTRY(14, 12, 1, 0, 1), // 250 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
104 CAN_BR_TBL_ENTRY( 7, 11, 1, 0, 0), // 500 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
105 CAN_BR_TBL_ENTRY( 4, 11, 1, 0, 0), // 800 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
106 CAN_BR_TBL_ENTRY( 3, 11, 1, 0, 0), // 1000 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
107 CAN_BR_TBL_ENTRY( 0, 0, 0, 0, 0), // Autobaud - not supported |
| 2409 | 108 }; |
| 109 #define HAL_LPC2XXX_BAUD_TBL_DEFINED 1 | |
| 110 #endif // CYGNUM_CAN_LPC2XXX_VPB_CLK == 30000000 | |
| 111 | |
| 112 #if CYGNUM_CAN_LPC2XXX_VPB_CLK == 15000000 | |
| 113 // | |
| 114 // Table with register values for baudrates at peripheral clock of 15 MHz | |
| 115 // | |
| 116 static const cyg_uint32 lpc2xxx_br_tbl[] = | |
| 117 { | |
|
2417
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
118 CAN_BR_TBL_ENTRY(59, 15, 7, 0, 1), // 10 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
119 CAN_BR_TBL_ENTRY(49, 11, 1, 0, 1), // 20 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
120 CAN_BR_TBL_ENTRY(19, 11, 1, 0, 1), // 50 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
121 CAN_BR_TBL_ENTRY( 9, 11, 1, 0, 1), // 100 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
122 CAN_BR_TBL_ENTRY( 7, 11, 1, 0, 1), // 125 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
123 CAN_BR_TBL_ENTRY( 3, 11, 1, 0, 1), // 250 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
124 CAN_BR_TBL_ENTRY( 1, 11, 1, 0, 0), // 500 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
125 CAN_BR_TBL_ENTRY( 0, 0, 0, 0, 0), // 800 kbaud - not supported |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
126 CAN_BR_TBL_ENTRY( 0, 11, 1, 0, 0), // 1000 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
127 CAN_BR_TBL_ENTRY( 0, 0, 0, 0, 0), // Autobaud - not supported |
| 2409 | 128 }; |
| 129 #define HAL_LPC2XXX_BAUD_TBL_DEFINED 1 | |
| 130 #endif // CYGNUM_CAN_LPC2XXX_VPB_CLK == 15000000 | |
| 131 | |
| 132 #if CYGNUM_CAN_LPC2XXX_VPB_CLK == 48000000 | |
| 133 // | |
| 134 // Table with register values for baudrates at peripheral clock of 48 MHz | |
| 135 // | |
| 136 static const cyg_uint32 lpc2xxx_br_tbl[] = | |
| 137 { | |
|
2417
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
138 CAN_BR_TBL_ENTRY( 0, 0, 0, 0, 0), // 10 kbaud - not supported |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
139 CAN_BR_TBL_ENTRY( 0, 0, 0, 0, 0), // 20 kbaud - not supported |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
140 CAN_BR_TBL_ENTRY(59, 12, 1, 0, 1), // 50 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
141 CAN_BR_TBL_ENTRY(29, 12, 1, 0, 1), // 100 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
142 CAN_BR_TBL_ENTRY(23, 12, 1, 0, 1), // 125 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
143 CAN_BR_TBL_ENTRY(11, 12, 1, 0, 1), // 250 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
144 CAN_BR_TBL_ENTRY( 5, 12, 1, 0, 0), // 500 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
145 CAN_BR_TBL_ENTRY( 3, 11, 1, 0, 0), // 800 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
146 CAN_BR_TBL_ENTRY( 2, 12, 1, 0, 0), // 1000 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
147 CAN_BR_TBL_ENTRY( 0, 0, 0, 0, 0), // Autobaud - not supported |
| 2409 | 148 }; |
| 149 #define HAL_LPC2XXX_BAUD_TBL_DEFINED 1 | |
| 150 #endif // CYGNUM_CAN_LPC2XXX_VPB_CLK == 48000000 | |
| 151 | |
| 152 #if CYGNUM_CAN_LPC2XXX_VPB_CLK == 24000000 | |
| 153 // | |
| 154 // Table with register values for baudrates at peripheral clock of 24 MHz | |
| 155 // | |
| 156 static const cyg_uint32 lpc2xxx_br_tbl[] = | |
| 157 { | |
|
2417
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
158 CAN_BR_TBL_ENTRY( 0, 0, 0, 0, 0), // 10 kbaud - not supported |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
159 CAN_BR_TBL_ENTRY(59, 15, 2, 0, 1), // 20 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
160 CAN_BR_TBL_ENTRY(29, 12, 1, 0, 1), // 50 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
161 CAN_BR_TBL_ENTRY(14, 12, 1, 0, 1), // 100 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
162 CAN_BR_TBL_ENTRY(11, 12, 1, 0, 1), // 125 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
163 CAN_BR_TBL_ENTRY( 5, 12, 1, 0, 1), // 250 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
164 CAN_BR_TBL_ENTRY( 2, 12, 1, 0, 0), // 500 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
165 CAN_BR_TBL_ENTRY( 1, 11, 1, 0, 0), // 800 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
166 CAN_BR_TBL_ENTRY( 1, 5, 0, 0, 0), // 1000 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
167 CAN_BR_TBL_ENTRY( 0, 0, 0, 0, 0), // Autobaud - not supported |
| 2409 | 168 }; |
| 169 #define HAL_LPC2XXX_BAUD_TBL_DEFINED 1 | |
| 170 #endif // CYGNUM_CAN_LPC2XXX_VPB_CLK == 24000000 | |
| 171 | |
| 172 #if CYGNUM_CAN_LPC2XXX_VPB_CLK == 12000000 | |
| 173 // | |
| 174 // Table with register values for baudrates at peripheral clock of 12 MHz | |
| 175 // | |
| 176 static const cyg_uint32 lpc2xxx_br_tbl[] = | |
| 177 { | |
|
2417
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
178 CAN_BR_TBL_ENTRY(59, 15, 2, 0, 1), // 10 kbaud - not supported |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
179 CAN_BR_TBL_ENTRY(39, 11, 1, 0, 1), // 20 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
180 CAN_BR_TBL_ENTRY(14, 12, 1, 0, 1), // 50 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
181 CAN_BR_TBL_ENTRY( 7, 11, 1, 0, 1), // 100 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
182 CAN_BR_TBL_ENTRY( 5, 12, 1, 0, 1), // 125 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
183 CAN_BR_TBL_ENTRY( 2, 12, 1, 0, 1), // 250 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
184 CAN_BR_TBL_ENTRY( 2, 05, 0, 0, 0), // 500 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
185 CAN_BR_TBL_ENTRY( 0, 11, 1, 0, 0), // 800 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
186 CAN_BR_TBL_ENTRY( 0, 9, 0, 0, 0), // 1000 kbaud |
|
05280737f180
* include/can_lpc2xxx_baudrates.h: Removed all prefixed zeros from
asl
parents:
2409
diff
changeset
|
187 CAN_BR_TBL_ENTRY( 0, 0, 0, 0, 0), // Autobaud - not supported |
| 2409 | 188 }; |
| 189 #define HAL_LPC2XXX_BAUD_TBL_DEFINED 1 | |
| 190 #endif // CYGNUM_CAN_LPC2XXX_VPB_CLK == 12000000 | |
| 191 | |
| 192 | |
| 193 //========================================================================== | |
| 194 // BIT TIMING MACRO | |
| 195 //========================================================================== | |
| 196 // | |
| 197 // Macro fills baudrate register value depending on selected baudrate | |
| 198 // For several LPC2XXX peripheral clock speeds we provide a pre calculated | |
| 199 // baudrate table. If the board uses another clock speed, then the platform | |
| 200 // HAL needs to provide an own HAL_LPC2XXX_GET_CAN_BR() macro that returns | |
| 201 // valid baudrate register values or it needs to patch this file with | |
| 202 // an additional table for the desired clock speed | |
| 203 // | |
| 204 // | |
| 205 // If a certain baudrate is not supported, then this macro shall return | |
| 206 // 0 as the baudrate register value | |
| 207 // | |
| 208 #ifdef HAL_LPC2XXX_BAUD_TBL_DEFINED | |
| 209 #define HAL_LPC2XXX_GET_CAN_BR(_baudrate_, _br_) \ | |
| 210 CYG_MACRO_START \ | |
| 211 _br_ = lpc2xxx_br_tbl[(_baudrate_) - CYGNUM_CAN_KBAUD_10]; \ | |
| 212 CYG_MACRO_END | |
| 213 #endif // HAL_LPC2XXX_BAUD_TBL_DEFINED | |
| 214 | |
| 215 //------------------------------------------------------------------------- | |
| 216 #endif // #ifndef CYGONCE_CAN_LPC2XXX_BAUDRATES_H |
