MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / CME_M7_control

Function CME_M7_control

bsp/CME_M7/drivers/uart.c:57–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57static rt_err_t CME_M7_control(struct rt_serial_device *serial, int cmd, void *arg)
58{
59 struct CME_M7_uart* uart;
60 NVIC_InitTypeDef NVIC_InitStructure;
61
62 RT_ASSERT(serial != RT_NULL);
63 uart = (struct CME_M7_uart *)serial->parent.user_data;
64
65 switch (cmd)
66 {
67 case RT_DEVICE_CTRL_CLR_INT:
68 /* disable rx irq */
69 NVIC_InitStructure.NVIC_IRQChannel = uart->irq;
70 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
71 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
72 NVIC_InitStructure.NVIC_IRQChannelCmd = FALSE;
73 NVIC_Init(&NVIC_InitStructure);
74
75 UART_EnableInt(uart->uart_device, UART_Int_RxNotEmpty, FALSE);
76 break;
77
78 case RT_DEVICE_CTRL_SET_INT:
79 /* enable rx irq */
80 NVIC_InitStructure.NVIC_IRQChannel = uart->irq;
81 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
82 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
83 NVIC_InitStructure.NVIC_IRQChannelCmd = TRUE;
84 NVIC_Init(&NVIC_InitStructure);
85
86 UART_ClearInt(uart->uart_device, UART_Int_RxNotEmpty);
87 UART_EnableInt(uart->uart_device, UART_Int_RxNotEmpty, TRUE);
88 break;
89 }
90
91 return RT_EOK;
92}
93
94static int CME_M7_putc(struct rt_serial_device *serial, char ch)
95{

Callers

nothing calls this directly

Calls 3

UART_EnableIntFunction · 0.85
UART_ClearIntFunction · 0.85
NVIC_InitFunction · 0.50

Tested by

no test coverage detected