| /* |
| * CAmkES component for UART driver. |
| * |
| * Copyright 2021, Google LLC |
| * Apache License 2.0 |
| */ |
| |
| import <LoggerInterface.camkes>; |
| import <UARTDriverInterface.camkes>; |
| |
| component UARTDriver { |
| dataport Buf mmio_region; |
| |
| dataport Buf tx_dataport; |
| provides uart_write_inf write; |
| |
| dataport Buf rx_dataport; |
| provides uart_read_inf read; |
| has semaphore rx_nonempty; |
| has semaphore rx_empty; |
| |
| maybe uses LoggerInterface logger; |
| |
| // Enable CantripOS CAmkES support. |
| attribute int cantripos = true; |
| |
| // rx_watermark irq is handled in its own thread because it may block. |
| consumes Interrupt rx_watermark; |
| |
| // Pseudo interface used to process IRQ's other than rx_watermark. |
| // The assembly connects tx_watermark and tx_empty interrupts |
| // and we disable the interface thread and take over the control |
| // thread to process interrupt events (to save memory). |
| consumes Interrupt irq; |
| attribute int irq_has_thread = false; |
| } |