@@ -97,7 +97,7 @@ static struct nu_can nu_can_arr[] =
97
97
},
98
98
#endif
99
99
{0 }
100
- }; /* usart nu_usart */
100
+ }; /* struct nu_can */
101
101
102
102
/* Public functions ------------------------------------------------------------*/
103
103
@@ -112,7 +112,7 @@ static const struct rt_can_ops nu_can_ops =
112
112
113
113
static const struct can_configure nu_can_default_config = NU_CAN_CONFIG_DEFAULT ;
114
114
115
- /* Interrupt Handle Funtion ----------------------------------------------------*/
115
+ /* Interrupt Handle Function ----------------------------------------------------*/
116
116
#if defined(BSP_USING_CAN0 )
117
117
/* CAN0 interrupt entry */
118
118
void CAN0_IRQHandler (void )
@@ -238,7 +238,7 @@ static rt_err_t nu_can_configure(struct rt_can_device *can, struct can_configure
238
238
RT_ASSERT (can != RT_NULL );
239
239
RT_ASSERT (cfg != RT_NULL );
240
240
241
- /* Get base address of uart register */
241
+ /* Get base address of CAN register */
242
242
CAN_T * can_base = ((nu_can_t )can )-> can_base ;
243
243
244
244
RT_ASSERT (can_base != RT_NULL );
@@ -312,7 +312,7 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
312
312
#ifdef RT_CAN_USING_HDR
313
313
struct rt_can_filter_config * filter_cfg ;
314
314
#endif
315
- /* Get base address of uart register */
315
+ /* Get base address of CAN register */
316
316
CAN_T * can_base = ((nu_can_t )can )-> can_base ;
317
317
318
318
RT_ASSERT (can_base != RT_NULL );
@@ -346,7 +346,6 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
346
346
{
347
347
/* Enable Status Change Interrupt */
348
348
CAN_EnableInt (can_base , CAN_CON_IE_Msk | CAN_CON_SIE_Msk );
349
- NVIC_SetPriority (((nu_can_t )can )-> can_irq_n , (1 << __NVIC_PRIO_BITS ) - 2 );
350
349
/* Enable NVIC interrupt. */
351
350
NVIC_EnableIRQ (((nu_can_t )can )-> can_irq_n );
352
351
@@ -355,7 +354,6 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
355
354
{
356
355
/* Enable Error Status and Status Change Interrupt */
357
356
CAN_EnableInt (can_base , CAN_CON_IE_Msk | CAN_CON_SIE_Msk | CAN_CON_EIE_Msk );
358
- NVIC_SetPriority (((nu_can_t )can )-> can_irq_n , (1 << __NVIC_PRIO_BITS ) - 2 );
359
357
/* Enable NVIC interrupt. */
360
358
NVIC_EnableIRQ (((nu_can_t )can )-> can_irq_n );
361
359
}
@@ -440,6 +438,9 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
440
438
rt_memcpy (arg , & can -> status , sizeof (can -> status ));
441
439
}
442
440
break ;
441
+ default :
442
+ return - (RT_EINVAL );
443
+
443
444
}
444
445
445
446
return RT_EOK ;
@@ -449,7 +450,7 @@ static int nu_can_sendmsg(struct rt_can_device *can, const void *buf, rt_uint32_
449
450
{
450
451
STR_CANMSG_T tMsg ;
451
452
struct rt_can_msg * pmsg = (struct rt_can_msg * ) buf ;
452
- /* Get base address of uart register */
453
+ /* Get base address of CAN register */
453
454
CAN_T * can_base = ((nu_can_t )can )-> can_base ;
454
455
455
456
RT_ASSERT (can_base != RT_NULL );
@@ -495,7 +496,7 @@ static int nu_can_recvmsg(struct rt_can_device *can, void *buf, rt_uint32_t boxn
495
496
{
496
497
STR_CANMSG_T tMsg ;
497
498
struct rt_can_msg * pmsg = (struct rt_can_msg * ) buf ;
498
- /* Get base address of uart register */
499
+ /* Get base address of CAN register */
499
500
CAN_T * can_base = ((nu_can_t )can )-> can_base ;
500
501
501
502
RT_ASSERT (can_base != RT_NULL );
@@ -558,7 +559,7 @@ static int rt_hw_can_init(void)
558
559
RT_ASSERT (ret == RT_EOK );
559
560
}
560
561
561
- return ret ;
562
+ return ( int ) ret ;
562
563
}
563
564
INIT_DEVICE_EXPORT (rt_hw_can_init );
564
565
#endif //#if defined(BSP_USING_CAN)
0 commit comments