MCPcopy Create free account
hub / github.com/SmingHub/Sming / uartConsoleNotify

Function uartConsoleNotify

Sming/Arch/Host/Components/driver/uart_server.cpp:107–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107void uartConsoleNotify(smg_uart_t* uart, smg_uart_notify_code_t code)
108{
109 switch(code) {
110 case UART_NOTIFY_AFTER_WRITE: {
111 size_t avail;
112 void* data;
113 while((avail = uart->tx_buffer->getReadData(data)) != 0) {
114 host_nputs(static_cast<const char*>(data), avail);
115 uart->tx_buffer->skipRead(avail);
116 }
117 break;
118 }
119
120 case UART_NOTIFY_AFTER_OPEN:
121 if(smg_uart_rx_enabled(uart)) {
122 assert(keyboardThread == nullptr);
123 keyboardThread = new KeyboardThread;
124 keyboardThread->execute();
125 }
126 break;
127
128 case UART_NOTIFY_BEFORE_CLOSE:
129 destroyKeyboardThread();
130 break;
131
132 default:; // ignore
133 }
134}
135
136} // namespace
137

Callers

nothing calls this directly

Calls 6

host_nputsFunction · 0.85
smg_uart_rx_enabledFunction · 0.85
destroyKeyboardThreadFunction · 0.85
getReadDataMethod · 0.80
skipReadMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected