1 # ====================================================================
5 # eCos MCF52xx FlexCAN configuration data
7 # ====================================================================
8 #####ECOSGPLCOPYRIGHTBEGIN####
9 ## -------------------------------------------
10 ## This file is part of eCos, the Embedded Configurable Operating System.
11 ## Copyright (C) 2003, 2004 eCosCentric Limited
13 ## eCos is free software; you can redistribute it and/or modify it under
14 ## the terms of the GNU General Public License as published by the Free
15 ## Software Foundation; either version 2 or (at your option) any later version.
17 ## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18 ## WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 ## You should have received a copy of the GNU General Public License along
23 ## with eCos; if not, write to the Free Software Foundation, Inc.,
24 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26 ## As a special exception, if other files instantiate templates or use macros
27 ## or inline functions from this file, or you compile this file and link it
28 ## with other works to produce a work based on this file, this file does not
29 ## by itself cause the resulting work to be covered by the GNU General Public
30 ## License. However the source code for this file must still be made available
31 ## in accordance with section (3) of the GNU General Public License.
33 ## This exception does not invalidate any other reasons why a work based on
34 ## this file might be covered by the GNU General Public License.
35 ## -------------------------------------------
36 #####ECOSGPLCOPYRIGHTEND####
37 # ====================================================================
38 ######DESCRIPTIONBEGIN####
40 # Author(s): Uwe Kindler
44 #####DESCRIPTIONEND####
45 # ====================================================================
48 cdl_package CYGPKG_DEVS_CAN_MCF52xx_FLEXCAN {
49 display "CAN driver for FlexCAN module of coldfire mcf52xx family"
51 parent CYGPKG_IO_CAN_DEVICES
52 active_if CYGPKG_IO_CAN
53 active_if CYGPKG_HAL_M68K_MCF52xx
58 This package provides a generic CAN device driver for the on-chip
59 FlexCAN modules in MCF52xx ColdFire processors."
60 compile -library=libextras.a can_mcf52xx.c
62 puts $::cdl_system_header "/***** CAN driver proc output start *****/"
63 puts $::cdl_system_header "#define CYGDAT_IO_CAN_DEVICE_HEADER <pkgconf/devs_can_mcf52xx_flexcan.h>"
64 puts $::cdl_system_header "/***** CAN driver proc output end *****/"
68 # Support up to two on-chip FlexCAN modules. The number varies between
70 for { set ::flexcan 0 } { $::flexcan < 2 } { incr ::flexcan } {
72 cdl_interface CYGINT_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan] {
73 display "Platform provides FlexCAN [set ::flexcan]"
76 This interface will be implemented if the specific coldfire
77 processor being used has an on-chip FlexCAN[set ::flexcan], and if
78 that FlexCAN is accessible on the target hardware."
81 cdl_component CYGPKG_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan] {
82 display "Allow access to the on-chip FlexCAN[set ::flexcan] via a CAN driver"
84 active_if CYGINT_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]
86 implements CYGINT_IO_CAN_TIMESTAMP
87 implements CYGINT_IO_CAN_RUNTIME_MBOX_CFG
88 implements CYGINT_IO_CAN_REMOTE_BUF
89 implements CYGINT_IO_CAN_TX_EVENTS
92 If the application needs to access the on-chip FlexCAN[set ::flexcan]
93 via an eCos CAN driver then this option should be enabled."
95 cdl_option CYGDAT_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_NAME {
96 display "Device name for FlexCAN [set ::flexcan]"
98 default_value [format {"\"/dev/can%d\""} $::flexcan]
100 This option controls the name that an eCos application
101 should use to access this device via cyg_io_lookup(),
102 open(), or similar calls."
106 cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_KBAUD {
107 display "Default baud rate for FlexCAN [set ::flexcan]"
110 legal_values { 10 20 50 100 125 250 500 800 1000 }
111 description "This option determines the initial baud rate in KBaud for FlexCAN [set ::flexcan]"
114 cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_QUEUESIZE_TX {
115 display "Size of TX Queue for the FlexCAN [set ::flexcan] driver"
118 legal_values 16 to 1024
120 The CAN device driver will run in interrupt mode and will
121 perform buffering of outgoing data. This option controls the number
122 of CAN messages the TX queue can store."
125 cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_QUEUESIZE_RX {
126 display "Size of RX Queue for the FlexCAN [set ::flexcan] driver"
129 legal_values 16 to 1024
131 The CAN device driver will run in interrupt mode and will
132 perform buffering of incoming data. This option controls the number
133 of CAN events the RX queue can store."
136 cdl_option CYGNUM_DEVS_CAN_MCF52xx_ISR_PRIORITY_FLEXCAN[set ::flexcan]_WAKEINT {
137 display "Wake interrupt priority"
139 default_value is_loaded(CYGNUM_HAL_M68K_MCF52xx_ISR_DEFAULT_PRIORITY_FLEXCAN[set ::flexcan]_WAKEINT) ? \
140 CYGNUM_HAL_M68K_MCF52xx_ISR_DEFAULT_PRIORITY_FLEXCAN[set ::flexcan]_WAKEINT : \
141 CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MIN
142 legal_values CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MIN to CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MAX
144 Interrupt priority for wake interrupt."
147 cdl_option CYGNUM_DEVS_CAN_MCF52xx_ISR_PRIORITY_FLEXCAN[set ::flexcan]_ERRINT {
148 display "Error interrupt priority"
150 default_value is_loaded(CYGNUM_HAL_M68K_MCF52xx_ISR_DEFAULT_PRIORITY_FLEXCAN[set ::flexcan]_ERRINT) ? \
151 CYGNUM_HAL_M68K_MCF52xx_ISR_DEFAULT_PRIORITY_FLEXCAN[set ::flexcan]_ERRINT : \
152 CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MIN
153 legal_values CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MIN to CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MAX
155 Interrupt priority for error interrupt."
158 cdl_option CYGNUM_DEVS_CAN_MCF52xx_ISR_PRIORITY_FLEXCAN[set ::flexcan]_BOFFINT {
159 display "Bus off interrupt priority"
161 default_value is_loaded(CYGNUM_HAL_M68K_MCF52xx_ISR_DEFAULT_PRIORITY_FLEXCAN[set ::flexcan]_BOFFINT) ? \
162 CYGNUM_HAL_M68K_MCF52xx_ISR_DEFAULT_PRIORITY_FLEXCAN[set ::flexcan]_BOFFINT : \
163 CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MIN
164 legal_values CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MIN to CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MAX
166 Interrupt priority for bus off interrupt."
169 cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_DEFAULT_TX_MBOX {
170 display "Default TX buffer"
174 By default one message buffer will be used for message transmission.
175 This option selects one of the 16 FlexCAN message buffers for
179 cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_STD_MBOXES {
180 display "11 Bit standard ID msg. buffers"
182 requires CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_STD_MBOXES + CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_EXT_MBOXES < 16
183 implements CYGINT_IO_CAN_STD_CAN_ID
187 The FlexCAN module contains 16 message buffers. One message buffer
188 is reserved for message transmission. The remaining 15 buffers are
189 available for reception of messages. This configuration option
190 defines the number of message boxes for reception of CAN messages
191 with standard identifier. This configuration option does not matter
192 when you configure message filters at runtime. Only if the FlexCAN
193 modul is configured to receive all available standard CAN identifiers
194 (0 - 0x7FF), then this configuration option is important. If you get
195 RX overrun events, you should raise the number of message boxes or
196 lower the CAN baud rate."
199 cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_EXT_MBOXES {
200 display "29 Bit extended ID msg. buffers"
202 requires CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_STD_MBOXES + CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_EXT_MBOXES < 16
203 implements CYGINT_IO_CAN_EXT_CAN_ID
207 The FlexCAN module contain 16 message buffers. One message buffer
208 is reserved for message transmission. The remaining 15 buffers are
209 available for reception of messages. This configuration option
210 defines the number of message boxes for reception of CAN messages
211 with extended identifier. This configuration option does not matter
212 when you configure message filters at runtime. Only if the FlexCAN
213 modul is configured to receive all available standard CAN identifiers
214 (0 - 0x7FF), then this configuration option is important. If you get
215 RX overrun events, you should raise the number of message boxes or
216 lower the CAN baud rate."
219 cdl_component CYGPKG_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_MBOXCFG {
220 display "Message buffer configuration"
222 active_if CYGINT_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]
224 The FlexCAN module contains 16 flexible message buffers of 0-8 bytes
225 data length, each configurable as Rx or Tx, all supporting standard and
226 extended messages. At the moment a fixed configuration is used for
227 TX and RX message buffers but in future this may be configurable."
230 # Support all 16 message buffers.
231 for { set ::mbox 0 } { $::mbox < 16 } { incr ::mbox } {
233 cdl_option CYGNUM_DEVS_CAN_MCF52xx_ISR_PRIORITY_FLEXCAN[set ::flexcan]_MBOX[set ::mbox] {
234 display "Interrupt priority for message buffer [set ::mbox]"
236 default_value is_loaded(CYGNUM_HAL_M68K_MCF52xx_ISR_DEFAULT_PRIORITY_FLEXCAN[set ::flexcan]_MBOX[set ::mbox]) ? \
237 CYGNUM_HAL_M68K_MCF52xx_ISR_DEFAULT_PRIORITY_FLEXCAN[set ::flexcan]_MBOX[set ::mbox] : \
238 CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MIN
239 legal_values CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MIN to CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MAX
241 Interrupt priority for message buffer [set ::mbox]. Normally this should be
242 the default interrupt priority provided by HAL."
249 cdl_option CYGBLD_DEVS_CAN_MCF52xx_FLEXCAN_EXTRA_TESTS {
250 display "Build extra FlexCAN tests"
254 This option enables the building of some extra tests which
255 can be used when testing / debugging FlexCAN drivers. These
256 are not built by default since they do not use the dedicated
257 testing infrastructure. All tests require a properly configured
258 CAN network with a second CAN node that can send and receive
262 <PREFIX>/bin/flexcan_wake : <PACKAGE>/tests/flexcan_wake.c
263 @sh -c "mkdir -p tests $(dir $@)"
264 $(CC) -c $(INCLUDE_PATH) -Wp,-MD,deps.tmp -I$(dir $<) $(CFLAGS) -o tests/flexcan_wake.o $<
265 @echo $@ ": \\" > $(notdir $@).deps
266 @echo $(wildcard $(PREFIX)/lib/*) " \\" >> $(notdir $@).deps
267 @tail -n +2 deps.tmp >> $(notdir $@).deps
268 @echo >> $(notdir $@).deps
270 $(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ tests/flexcan_wake.o