Index: ChangeLog =================================================================== RCS file: /cvs/ecos/ecos/packages/devs/can/arm/lpc2xxx/current/ChangeLog,v retrieving revision 1.5 diff -u -r1.5 ChangeLog --- ChangeLog 17 Aug 2007 08:48:57 -0000 1.5 +++ ChangeLog 17 Aug 2007 15:25:04 -0000 @@ -1,3 +1,8 @@ +2007-08-17 Hans Rosenfeld + + * cdl/can_lpc2xxx.cdl, src/can_lpc2xxx.src: add options to set the + interrupt priorities + 2007-08-17 Hans Rosenfeld * src/can_lpc2xxx.c: The definition of "info" is missing when only Index: cdl/can_lpc2xxx.cdl =================================================================== RCS file: /cvs/ecos/ecos/packages/devs/can/arm/lpc2xxx/current/cdl/can_lpc2xxx.cdl,v retrieving revision 1.2 diff -u -r1.2 can_lpc2xxx.cdl --- cdl/can_lpc2xxx.cdl 31 Jul 2007 07:53:36 -0000 1.2 +++ cdl/can_lpc2xxx.cdl 17 Aug 2007 15:25:04 -0000 @@ -143,7 +143,19 @@ Check this box to turn ON debug options for LPC2XXXX CAN device driver." } - + + cdl_option CYGNUM_DEVS_CAN_LPC2XXX_PRIO { + display "Interrupt priority for CAN and Acceptance Filter" + parent CYGHWR_HAL_ARM_LPC2XXX_VIC + active_if CYGHWR_HAL_ARM_LPC2XXX_VIC + flavor data + default_value 7 + legal_values 0 to 16 + description "The interrupt priority corresponds to the vector + number in the Vectored Interrupt Controller. Lower + numbers designate higher priorities." + } + # Support up to 4 on-chip CAN modules. The number may vary between # processor variants so it is easy to update this here for { set ::channel 0 } { $::channel < 4 } { incr ::channel } { @@ -229,6 +241,32 @@ identifier." } + cdl_option CYGNUM_DEVS_CAN_LPC2XXX_CAN[set ::channel]_TX_PRIO { + display "TX interrupt priority for CAN module [set ::channel]" + parent CYGHWR_HAL_ARM_LPC2XXX_VIC + active_if CYGHWR_HAL_ARM_LPC2XXX_VIC + active_if CYGINT_DEVS_CAN_LPC2XXX_CAN[set ::channel] + flavor data + default_value [set ::channel] * 2 + 8 + legal_values 0 to 16 + description "The interrupt priority corresponds to the vector + number in the Vectored Interrupt Controller. Lower + numbers designate higher priorities." + } + + cdl_option CYGNUM_DEVS_CAN_LPC2XXX_CAN[set ::channel]_RX_PRIO { + display "RX interrupt priority for CAN module [set ::channel]" + parent CYGHWR_HAL_ARM_LPC2XXX_VIC + active_if CYGHWR_HAL_ARM_LPC2XXX_VIC + active_if CYGINT_DEVS_CAN_LPC2XXX_CAN[set ::channel] + flavor data + default_value [set ::channel] * 2 + 9 + legal_values 0 to 16 + description "The interrupt priority corresponds to the vector + number in the Vectored Interrupt Controller. Lower + numbers designate higher priorities." + } + } } Index: src/can_lpc2xxx.c =================================================================== RCS file: /cvs/ecos/ecos/packages/devs/can/arm/lpc2xxx/current/src/can_lpc2xxx.c,v retrieving revision 1.4 diff -u -r1.4 can_lpc2xxx.c --- src/can_lpc2xxx.c 17 Aug 2007 08:48:57 -0000 1.4 +++ src/can_lpc2xxx.c 17 Aug 2007 15:25:05 -0000 @@ -348,11 +348,15 @@ #if CYGINT_IO_CAN_CHANNELS == 1 #define CAN_CTRL_BASE(_extra_) CAN_CTRL_SINGLETON_BASE #define CAN_ISRVEC(_extra_) CAN_SINGLETON_ISRVEC +#define CAN_TXPRIO(_extra_) CAN_SINGLETON_TXPRIO +#define CAN_RXPRIO(_extra_) CAN_SINGLETON_RXPRIO #define CAN_DECLARE_INFO(_chan_) #define CAN_DECLARE_CHAN(_data_) #else #define CAN_CTRL_BASE(_extra_) ((_extra_)->base) #define CAN_ISRVEC(_extra_) ((_extra_)->isrvec) +#define CAN_TXPRIO(_extra_) ((_extra_)->txprio) +#define CAN_RXPRIO(_extra_) ((_extra_)->rxprio) #define CAN_DECLARE_INFO(_chan_) lpc2xxx_can_info_t *info = (lpc2xxx_can_info_t *)chan->dev_priv; #define CAN_DECLARE_CHAN(_data_) can_channel *chan = (can_channel *)data; #endif // CYGINT_IO_CAN_CHANNELS == 1 @@ -425,6 +429,8 @@ #if CYGINT_IO_CAN_CHANNELS > 1 cyg_uint32 base; // Per-bus h/w details cyg_uint8 isrvec; // ISR vector (peripheral id) + cyg_uint8 txprio; // TX ISR priority + cyg_uint8 rxprio; // RX ISR priority #endif } lpc2xxx_can_info_t; @@ -438,11 +444,13 @@ // #define LPC2XXX_CTRL_NOT_INITIALIZED 0xFF #if CYGINT_IO_CAN_CHANNELS > 1 -#define LPC2XXX_CAN_INFO(_l, _base, _isrvec, _flags) \ +#define LPC2XXX_CAN_INFO(_l, _base, _isrvec, _txprio, _rxprio, _flags) \ lpc2xxx_can_info_t _l = { \ state : LPC2XXX_CTRL_NOT_INITIALIZED, \ base : (_base), \ isrvec : (_isrvec), \ + txprio : (_txprio), \ + rxprio : (_rxprio), \ flags : (_flags), \ icr : 0, \ LPC2XXX_CAN_INFO_LAST_TX_ID_INIT \ @@ -517,6 +525,8 @@ LPC2XXX_CAN_INFO(lpc2xxx_can0_info, CAN_CTRL_1_REG_BASE, CYGNUM_HAL_INTERRUPT_CAN1_TX, + CYGNUM_DEVS_CAN_LPC2XXX_CAN0_TX_PRIO, + CYGNUM_DEVS_CAN_LPC2XXX_CAN0_RX_PRIO, CAN0_FLAG_STARTUP_ACCFILT_SETUP); #endif @@ -524,6 +534,8 @@ LPC2XXX_CAN_INFO(lpc2xxx_can1_info, CAN_CTRL_2_REG_BASE, CYGNUM_HAL_INTERRUPT_CAN2_TX, + CYGNUM_DEVS_CAN_LPC2XXX_CAN1_TX_PRIO, + CYGNUM_DEVS_CAN_LPC2XXX_CAN1_RX_PRIO, CAN1_FLAG_STARTUP_ACCFILT_SETUP); #endif @@ -531,6 +543,8 @@ LPC2XXX_CAN_INFO(lpc2xxx_can2_info, CAN_CTRL_3_REG_BASE, CYGNUM_HAL_INTERRUPT_CAN3_TX, + CYGNUM_DEVS_CAN_LPC2XXX_CAN2_TX_PRIO, + CYGNUM_DEVS_CAN_LPC2XXX_CAN2_RX_PRIO, CAN2_FLAG_STARTUP_ACCFILT_SETUP); #endif @@ -538,6 +552,8 @@ LPC2XXX_CAN_INFO(lpc2xxx_can3_info, CAN_CTRL_4_REG_BASE, CYGNUM_HAL_INTERRUPT_CAN4_TX, + CYGNUM_DEVS_CAN_LPC2XXX_CAN3_TX_PRIO, + CYGNUM_DEVS_CAN_LPC2XXX_CAN3_RX_PRIO, CAN3_FLAG_STARTUP_ACCFILT_SETUP); #endif #else // CYGINT_IO_CAN_CHANNELS == 1 @@ -545,24 +561,32 @@ LPC2XXX_CAN_INFO(lpc2xxx_can0_info, CAN0_FLAG_STARTUP_ACCFILT_SETUP); #define CAN_CTRL_SINGLETON_BASE CAN_CTRL_1_REG_BASE #define CAN_SINGLETON_ISRVEC CYGNUM_HAL_INTERRUPT_CAN1_TX +#define CAN_SINGLETON_TXPRIO CYGNUM_DEVS_CAN_LPC2XXX_CAN0_TX_PRIO +#define CAN_SINGLETON_RXPRIO CYGNUM_DEVS_CAN_LPC2XXX_CAN0_RX_PRIO #endif #ifdef CYGINT_DEVS_CAN_LPC2XXX_CAN1 LPC2XXX_CAN_INFO(lpc2xxx_can1_info, CAN1_FLAG_STARTUP_ACCFILT_SETUP); #define CAN_CTRL_SINGLETON_BASE CAN_CTRL_2_REG_BASE #define CAN_SINGLETON_ISRVEC CYGNUM_HAL_INTERRUPT_CAN2_TX +#define CAN_SINGLETON_TXPRIO CYGNUM_DEVS_CAN_LPC2XXX_CAN1_TX_PRIO +#define CAN_SINGLETON_RXPRIO CYGNUM_DEVS_CAN_LPC2XXX_CAN1_RX_PRIO #endif #ifdef CYGINT_DEVS_CAN_LPC2XXX_CAN2 LPC2XXX_CAN_INFO(lpc2xxx_can2_info, CAN2_FLAG_STARTUP_ACCFILT_SETUP); #define CAN_CTRL_SINGLETON_BASE CAN_CTRL_3_REG_BASE #define CAN_SINGLETON_ISRVEC CYGNUM_HAL_INTERRUPT_CAN3_TX +#define CAN_SINGLETON_TXPRIO CYGNUM_DEVS_CAN_LPC2XXX_CAN2_TX_PRIO +#define CAN_SINGLETON_RXPRIO CYGNUM_DEVS_CAN_LPC2XXX_CAN2_RX_PRIO #endif #ifdef CYGINT_DEVS_CAN_LPC2XXX_CAN3 LPC2XXX_CAN_INFO(lpc2xxx_can3_info, CAN3_FLAG_STARTUP_ACCFILT_SETUP); #define CAN_CTRL_SINGLETON_BASE CAN_CTRL_4_REG_BASE #define CAN_SINGLETON_ISRVEC CYGNUM_HAL_INTERRUPT_CAN4_TX +#define CAN_SINGLETON_TXPRIO CYGNUM_DEVS_CAN_LPC2XXX_CAN3_TX_PRIO +#define CAN_SINGLETON_RXPRIO CYGNUM_DEVS_CAN_LPC2XXX_CAN3_RX_PRIO #endif #endif // #if CYGINT_IO_CAN_CHANNELS > 1 @@ -767,7 +791,7 @@ // Create TX interrupt // cyg_drv_interrupt_create(CAN_ISRVEC(info), - 0, // Priority does not matter LPC2xxx + CAN_TXPRIO(info), (cyg_addrword_t)chan, // Data item passed to interrupt handler lpc2xxx_can_tx_ISR, lpc2xxx_can_tx_DSR, @@ -780,7 +804,7 @@ // Create RX interrupt // cyg_drv_interrupt_create(CAN_ISRVEC(info) + 6, - 0, // Priority does not matter for LPC2xxx + CAN_RXPRIO(info), (cyg_addrword_t)chan, // Data item passed to interrupt handler lpc2xxx_can_rx_ISR, lpc2xxx_can_rx_DSR, @@ -800,7 +824,7 @@ // Create err interrupt // cyg_drv_interrupt_create(CYGNUM_HAL_INTERRUPT_CAN, - 0, // Priority does not matter for LPX2xxx + CYGNUM_DEVS_CAN_LPC2XXX_PRIO, 0, // Data item passed to interrupt handler lpc2xxx_can_err_ISR, lpc2xxx_can_err_DSR,