puts $::cdl_system_header "/***** CAN driver proc output end *****/"
}
+
# Support up to two on-chip FlexCAN modules. The number varies between
# processor variants
for { set ::flexcan 0 } { $::flexcan < 2 } { incr ::flexcan } {
flavor bool
active_if CYGINT_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]
default_value 1
- implements CYGINT_IO_CAN_TIMESTAMP
+ implements CYGINT_IO_CAN_TIMESTAMP
+ implements CYGINT_IO_CAN_RUNTIME_MBOX_CFG
+ implements CYGINT_IO_CAN_REMOTE_BUF
+ implements CYGINT_IO_CAN_TX_EVENTS
description "
If the application needs to access the on-chip FlexCAN[set ::flexcan]
cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_QUEUESIZE_TX {
display "Size of TX Queue for the FlexCAN [set ::flexcan] driver"
flavor data
- default_value 32
- legal_values 16 to 512
+ default_value 64
+ legal_values 16 to 1024
description "
The CAN device driver will run in interrupt mode and will
perform buffering of outgoing data. This option controls the number
cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_QUEUESIZE_RX {
display "Size of RX Queue for the FlexCAN [set ::flexcan] driver"
flavor data
- default_value 32
- legal_values 16 to 512
+ default_value 128
+ legal_values 16 to 1024
description "
The CAN device driver will run in interrupt mode and will
perform buffering of incoming data. This option controls the number
of CAN events the RX queue can store."
}
- cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_RXMASK_GLOBAL {
- display "Receive mask for message buffers 0 - 13"
- flavor data
- default_value 0x1FFFFFFF
- description "
- The global RX-mask is composed of 4 bytes. The mask bits are
- applied to all Rx-Identifiers excluding Rx-buffers 14-15, that
- have their specific Rx-mask. (0 corresponding incoming ID bit is
- \"don\92t care\". 1 corresponding ID bit is checked against the incoming
- ID bit, to see if a match exists). By default the message buffers
- should only receive messages that exactly match the configured
- message buffer CAN identifier - that means alle bits are 1."
- }
-
- cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_RXMASK_14 {
- display "Receive mask for message buffer 14"
- flavor data
- default_value 0x0
- description "
- The RX-mask for message buffer 14 is composed of 4 bytes. The mask
- bits are applied to message buffer 14. (0 corresponding incoming ID
- bit is \"don\92t care\". 1 corresponding ID bit is checked against the
- incoming ID bit, to see if a match exists). Message buffer 14 is
- the receive message buffer and should receive all available CAN
- messages - all bits are 0."
- }
-
- cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_RXMASK_15 {
- display "Receive mask for message buffer 15"
- flavor data
- default_value 0x1FFFFFFF
- description "
- The RX-mask for message buffer 15 is composed of 4 bytes. The mask
- bits are applied to message buffer 15. (0 corresponding incoming ID
- bit is \"don\92t care\". 1 corresponding ID bit is checked against the
- incoming ID bit, to see if a match exists)."
- }
-
cdl_option CYGNUM_DEVS_CAN_MCF52xx_ISR_PRIORITY_FLEXCAN[set ::flexcan]_WAKEINT {
display "Wake interrupt priority"
flavor data
Interrupt priority for bus off interrupt."
}
- cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_DEFAULT_RX_MBOX {
- display "Default receive message buffer"
- flavor data
- calculated 14
- legal_values 0 to 15
- description "
- By default one message buffer will be used for reception of
- all CAN messages. This option selects one of the 16 message
- buffers for reception."
- }
-
cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_DEFAULT_TX_MBOX {
- display "Default transmit message buffer"
+ display "Default TX buffer"
flavor data
calculated 15
- legal_values 0 to 15
description "
By default one message buffer will be used for message transmission.
This option selects one of the 16 FlexCAN message buffers for
transmission."
}
+ cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_STD_MBOXES {
+ display "11 Bit standard ID msg. buffers"
+ flavor booldata
+ requires CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_STD_MBOXES + CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_EXT_MBOXES < 16
+ implements CYGINT_IO_CAN_STD_CAN_ID
+ default_value 7
+ legal_values 1 to 15
+ description "
+ The FlexCAN module contains 16 message buffers. One message buffer
+ is reserved for message transmission. The remaining 15 buffers are
+ available for reception of messages. This configuration option
+ defines the number of message boxes for reception of CAN messages
+ with standard identifier. This configuration option does not matter
+ when you configure message filters at runtime. Only if the FlexCAN
+ modul is configured to receive all available standard CAN identifiers
+ (0 - 0x7FF), then this configuration option is important. If you get
+ RX overrun events, you should raise the number of message boxes or
+ lower the CAN baud rate."
+ }
+
+ cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_EXT_MBOXES {
+ display "29 Bit extended ID msg. buffers"
+ flavor booldata
+ requires CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_STD_MBOXES + CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_EXT_MBOXES < 16
+ implements CYGINT_IO_CAN_EXT_CAN_ID
+ default_value 8
+ legal_values 1 to 15
+ description "
+ The FlexCAN module contain 16 message buffers. One message buffer
+ is reserved for message transmission. The remaining 15 buffers are
+ available for reception of messages. This configuration option
+ defines the number of message boxes for reception of CAN messages
+ with extended identifier. This configuration option does not matter
+ when you configure message filters at runtime. Only if the FlexCAN
+ modul is configured to receive all available standard CAN identifiers
+ (0 - 0x7FF), then this configuration option is important. If you get
+ RX overrun events, you should raise the number of message boxes or
+ lower the CAN baud rate."
+ }
+
cdl_component CYGPKG_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_MBOXCFG {
display "Message buffer configuration"
flavor none
data length, each configurable as Rx or Tx, all supporting standard and
extended messages. At the moment a fixed configuration is used for
TX and RX message buffers but in future this may be configurable."
-
- cdl_component CYGPKG_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_MBOX14_CFG {
- display "Message buffer 14 configuration"
- flavor none
- active_if CYGINT_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]
- description "
- Configuration of FlexCAN message buffer 14."
-
- cdl_option CYGNUM_DEVS_CAN_MCF52xx_ISR_PRIORITY_FLEXCAN[set ::flexcan]_MBOX14 {
- display "Interrupt priority."
- flavor data
- default_value is_loaded(CYGNUM_HAL_M68K_MCF52xx_ISR_DEFAULT_PRIORITY_FLEXCAN[set ::flexcan]_MBOX14) ? \
- CYGNUM_HAL_M68K_MCF52xx_ISR_DEFAULT_PRIORITY_FLEXCAN[set ::flexcan]_MBOX14 : \
- CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MIN
- legal_values CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MIN to CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MAX
- description "
- Interrupt priority for message buffer 14"
- }
- cdl_option CYGPKG_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_MBOX14_IS_TX {
- display "Use for transmit"
- flavor bool
- active_if CYGINT_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]
- calculated 0
- description "
- This option controls if this message buffer is used for sending
- or receiving messages. Currently this option is not configurable
- and message box 14 is used for reception of CAN messages."
-
- }
- }
-
- cdl_component CYGPKG_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_MBOX15_CFG {
- display "Message buffer 15 configuration"
- flavor none
- active_if CYGINT_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]
- description "
- Configuration of FlexCAN message buffer 15."
-
- cdl_option CYGNUM_DEVS_CAN_MCF52xx_ISR_PRIORITY_FLEXCAN[set ::flexcan]_MBOX15 {
- display "Interrupt priority."
+
+ # Support all 16 message buffers.
+ for { set ::mbox 0 } { $::mbox < 16 } { incr ::mbox } {
+
+ cdl_option CYGNUM_DEVS_CAN_MCF52xx_ISR_PRIORITY_FLEXCAN[set ::flexcan]_MBOX[set ::mbox] {
+ display "Interrupt priority for message buffer [set ::mbox]"
flavor data
- default_value is_loaded(CYGNUM_HAL_M68K_MCF52xx_ISR_DEFAULT_PRIORITY_FLEXCAN[set ::flexcan]_MBOX15) ? \
- CYGNUM_HAL_M68K_MCF52xx_ISR_DEFAULT_PRIORITY_FLEXCAN[set ::flexcan]_MBOX15 : \
+ default_value is_loaded(CYGNUM_HAL_M68K_MCF52xx_ISR_DEFAULT_PRIORITY_FLEXCAN[set ::flexcan]_MBOX[set ::mbox]) ? \
+ CYGNUM_HAL_M68K_MCF52xx_ISR_DEFAULT_PRIORITY_FLEXCAN[set ::flexcan]_MBOX[set ::mbox] : \
CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MIN
legal_values CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MIN to CYGNUM_HAL_M68K_MCF52xx_ISR_PRIORITY_MAX
description "
- Interrupt priority for message buffer 15"
+ Interrupt priority for message buffer [set ::mbox]. Normally this should be
+ the default interrupt priority provided by HAL."
}
-
- cdl_option CYGOPT_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_MBOX15_IS_TX {
- display "Use for transmit"
- flavor bool
- active_if CYGINT_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]
- calculated 1
- description "
- This option controls if this message buffer is used for sending
- or receiving messages. Currently this option is not configurable
- and message box 15 is used for transmission of CAN messages."
-
- }
- }
+ }
}
}
}
testing infrastructure. All tests require a properly configured
CAN network with a second CAN node that can send and receive
CAN messages."
-
- make -priority 320 {
- <PREFIX>/bin/flexcan_load : <PACKAGE>/tests/flexcan_load.c
- @sh -c "mkdir -p tests $(dir $@)"
- $(CC) -c $(INCLUDE_PATH) -Wp,-MD,deps.tmp -I$(dir $<) $(CFLAGS) -o tests/flexcan_load.o $<
- @echo $@ ": \\" > $(notdir $@).deps
- @echo $(wildcard $(PREFIX)/lib/*) " \\" >> $(notdir $@).deps
- @tail -n +2 deps.tmp >> $(notdir $@).deps
- @echo >> $(notdir $@).deps
- @rm deps.tmp
- $(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ tests/flexcan_load.o
- }
-
+
make -priority 320 {
- <PREFIX>/bin/flexcan_remote : <PACKAGE>/tests/flexcan_remote.c
+ <PREFIX>/bin/flexcan_wake : <PACKAGE>/tests/flexcan_wake.c
@sh -c "mkdir -p tests $(dir $@)"
- $(CC) -c $(INCLUDE_PATH) -Wp,-MD,deps.tmp -I$(dir $<) $(CFLAGS) -o tests/flexcan_remote.o $<
+ $(CC) -c $(INCLUDE_PATH) -Wp,-MD,deps.tmp -I$(dir $<) $(CFLAGS) -o tests/flexcan_wake.o $<
@echo $@ ": \\" > $(notdir $@).deps
@echo $(wildcard $(PREFIX)/lib/*) " \\" >> $(notdir $@).deps
@tail -n +2 deps.tmp >> $(notdir $@).deps
@echo >> $(notdir $@).deps
@rm deps.tmp
- $(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ tests/flexcan_remote.o
- }
- }
-
-
-
- cdl_component CYGPKG_DEVS_CAN_MCF52xx_FLEXCAN_OPTIONS {
- display "FlexCAN device driver build options"
- flavor none
- description "
- Package specific build options including control over
- compiler flags used only in building this package,
- and details of which tests are built."
-
- cdl_option CYGPKG_DEVS_CAN_MCF52xx_FLEXCAN_CFLAGS_ADD {
- display "Additional compiler flags"
- flavor data
- no_define
- default_value { "" }
- description "
- This option modifies the set of compiler flags for
- building these CAN device drivers. These flags are
- used in addition to the set of global flags."
- }
-
- cdl_option CYGPKG_DEVS_CAN_MCF52xx_FLEXCAN_CFLAGS_REMOVE {
- display "Suppressed compiler flags"
- flavor data
- no_define
- default_value { "" }
- description "
- This option modifies the set of compiler flags for
- building these CAN device drivers. These flags are
- removed from the set of global flags if present."
+ $(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ tests/flexcan_wake.o
}
}
}