
Embedded Drivers 133
We now discuss the functions in the my_uart_ops structure. The functions
request_port() and release_port() are typically used to request IO and
memory regions used by the port. Start-up and shutdown functions
my_uart_startup() and my_uart_shutdown() do the interrupt setup and
teardown, respectively.
static int my_uart_startup(struct uart_port *port)
{
return(request_irq(MY_UART_IRQ, my_uart_irq_handler, 0,
“my uart”, port));
}
static void my_uart_shutdown(struct uart_port *port)
{
free_irq(MY_UART_IRQ, port);
}
Listing 5.2 MY_UART Data Structures
static struct uart_ops my_uart_ops= {
.tx_empty = my_uart_tx_empty,
.get_mctrl = my_uart_get_mctrl, ...