]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/devs/can/m68k/mcf52xx/v2_0/cdl/can_mcf52xx.cdl
unified MX27, MX25, MX37 trees
[karo-tx-redboot.git] / packages / devs / can / m68k / mcf52xx / v2_0 / cdl / can_mcf52xx.cdl
1 # ====================================================================
2 #
3 #      can_mcf52xx.cdl
4 #
5 #      eCos MCF52xx FlexCAN configuration data
6 #
7 # ====================================================================
8 #####ECOSGPLCOPYRIGHTBEGIN####
9 ## -------------------------------------------
10 ## This file is part of eCos, the Embedded Configurable Operating System.
11 ## Copyright (C) 2003, 2004 eCosCentric Limited
12 ##
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.
16 ##
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
20 ## for more details.
21 ##
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.
25 ##
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.
32 ##
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####
39 #
40 # Author(s):      Uwe Kindler
41 # Contributors:
42 # Date:           2005-05-17
43 #
44 #####DESCRIPTIONEND####
45 # ====================================================================
46
47
48 cdl_package CYGPKG_DEVS_CAN_MCF52xx_FLEXCAN {
49     display       "CAN driver for FlexCAN module of coldfire mcf52xx family"
50
51     parent        CYGPKG_IO_CAN_DEVICES
52     active_if     CYGPKG_IO_CAN
53     active_if     CYGPKG_HAL_M68K_MCF52xx
54
55     requires      CYGPKG_ERROR
56
57     description   "
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
61     define_proc {
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  *****/"
65     }
66     
67
68     # Support up to two on-chip FlexCAN modules. The number varies between
69     # processor variants
70     for { set ::flexcan 0 } { $::flexcan < 2 } { incr ::flexcan } {
71     
72         cdl_interface CYGINT_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan] {
73             display     "Platform provides FlexCAN [set ::flexcan]"
74             flavor      bool
75             description "
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."
79         }
80     
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"
83             flavor      bool
84             active_if       CYGINT_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]
85             default_value   1
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
90             
91             description "
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."
94
95             cdl_option CYGDAT_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_NAME {
96                 display     "Device name for FlexCAN [set ::flexcan]"
97                 flavor      data
98                 default_value   [format {"\"/dev/can%d\""} $::flexcan]
99                 description "
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."
103             }
104
105         
106             cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_KBAUD {
107                 display     "Default baud rate for FlexCAN [set ::flexcan]"
108                 flavor      data
109                 default_value   100
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]"
112             }
113
114             cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_QUEUESIZE_TX {
115                 display     "Size of TX Queue for the FlexCAN [set ::flexcan] driver"
116                 flavor      data
117                 default_value   64
118                 legal_values    16 to 1024
119                 description "
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."
123             }
124             
125             cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_QUEUESIZE_RX {
126                 display     "Size of RX Queue for the FlexCAN [set ::flexcan] driver"
127                 flavor      data
128                 default_value   128
129                 legal_values    16 to 1024
130                 description "
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."
134             }
135             
136             cdl_option CYGNUM_DEVS_CAN_MCF52xx_ISR_PRIORITY_FLEXCAN[set ::flexcan]_WAKEINT {
137                 display     "Wake interrupt priority"
138                 flavor      data
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
143                 description "
144                     Interrupt priority for wake interrupt."
145             }
146             
147             cdl_option CYGNUM_DEVS_CAN_MCF52xx_ISR_PRIORITY_FLEXCAN[set ::flexcan]_ERRINT {
148                 display     "Error interrupt priority"
149                 flavor      data
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
154                 description "
155                     Interrupt priority for error interrupt."
156             }
157             
158             cdl_option CYGNUM_DEVS_CAN_MCF52xx_ISR_PRIORITY_FLEXCAN[set ::flexcan]_BOFFINT {
159                 display     "Bus off interrupt priority"
160                 flavor      data
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
165                 description "
166                     Interrupt priority for bus off interrupt."
167             }
168             
169             cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_DEFAULT_TX_MBOX {
170                 display "Default TX buffer"
171                 flavor  data
172                 calculated    15
173                 description "
174                     By default one message buffer will be used for message transmission.
175                     This option selects one of the 16 FlexCAN message buffers for
176                     transmission."
177             }
178             
179             cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_STD_MBOXES {
180                 display "11 Bit standard ID msg. buffers"
181                 flavor  booldata
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
184                 default_value 7
185                 legal_values  1 to 15
186                 description "
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."
197             }
198
199             cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_EXT_MBOXES {
200                 display "29 Bit extended ID msg. buffers"
201                 flavor  booldata
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
204                 default_value 8
205                 legal_values  1 to 15
206                 description "
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."
217             }
218             
219             cdl_component CYGPKG_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_MBOXCFG {
220                 display     "Message buffer configuration"
221                 flavor       none
222                 active_if       CYGINT_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]
223                 description "
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."
228                     
229                     
230                 # Support all 16 message buffers. 
231                 for { set ::mbox 0 } { $::mbox < 16 } { incr ::mbox } {
232                                   
233                     cdl_option CYGNUM_DEVS_CAN_MCF52xx_ISR_PRIORITY_FLEXCAN[set ::flexcan]_MBOX[set ::mbox] {
234                         display     "Interrupt priority for message buffer [set ::mbox]"
235                         flavor      data
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
240                         description "
241                             Interrupt priority for message buffer [set ::mbox]. Normally this should be
242                             the default interrupt priority provided by HAL."
243                     }
244                 }             
245             } 
246         }    
247     }
248     
249     cdl_option CYGBLD_DEVS_CAN_MCF52xx_FLEXCAN_EXTRA_TESTS {
250         display "Build extra FlexCAN tests"
251         default_value 0
252         no_define
253         description "
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
259             CAN messages."
260        
261         make -priority 320 {
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
269             @rm deps.tmp
270             $(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ tests/flexcan_wake.o
271         }
272     }
273 }