Changeset c91fe327 in mainline
- Timestamp:
- 2012-03-11T03:54:57Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 60a025d
- Parents:
- 13be128d
- Location:
- kernel/genarch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/include/drivers/amdm37x_uart/amdm37x_uart.h
r13be128d rc91fe327 39 39 #include <typedefs.h> 40 40 #include <console/chardev.h> 41 #include <ddi/irq.h> 41 42 42 43 /* AMDM37x TRM p. 2950 */ … … 431 432 /** RX/TX empty status */ 432 433 ioport32_t isr2; 433 #define AMDM37x_UART_I ER2_RX_FIFO_EMPTY_FLAG (1 << 0)434 #define AMDM37x_UART_I ER2_TX_FIFO_EMPTY_FLAG (1 << 1)434 #define AMDM37x_UART_ISR2_RX_FIFO_EMPTY_FLAG (1 << 0) 435 #define AMDM37x_UART_ISR2_TX_FIFO_EMPTY_FLAG (1 << 1) 435 436 436 437 uint32_t padd2_[3]; … … 445 446 indev_t *indev; 446 447 outdev_t outdev; 448 irq_t irq; 447 449 } amdm37x_uart_t; 448 450 -
kernel/genarch/src/drivers/amdm37x_uart/amdm37x_uart.c
r13be128d rc91fe327 35 35 36 36 #include <genarch/drivers/amdm37x_uart/amdm37x_uart.h> 37 #include <ddi/device.h> 37 38 #include <str.h> 38 39 #include <mm/km.h> … … 63 64 }; 64 65 66 static irq_ownership_t amdm37x_uart_claim(irq_t *irq) 67 { 68 return IRQ_ACCEPT; 69 } 70 71 static void amdm37x_uart_handler(irq_t *irq) 72 { 73 amdm37x_uart_t *uart = irq->instance; 74 //TODO enable while checking when RX FIFO is used instead of single char. 75 // while (!(uart->regs->isr2 & AMDM37x_UART_ISR2_RX_FIFO_EMPTY_FLAG)) { 76 const uint8_t val = uart->regs->rhr; 77 if (uart->indev) 78 indev_push_character(uart->indev, val); 79 // } 80 } 81 65 82 bool amdm37x_uart_init( 66 83 amdm37x_uart_t *uart, inr_t interrupt, uintptr_t addr, size_t size) … … 69 86 uart->regs = (void *)km_map(addr, size, PAGE_NOT_CACHEABLE); 70 87 88 ASSERT(uart->regs); 89 71 90 /* See TI OMAP35X TRM ch 17.5.1.1 p. 2732 for startup routine */ 72 91 #if 0 73 92 /* Soft reset the port */ 74 93 uart->regs->sysc = AMDM37x_UART_SYSC_SOFTRESET_FLAG; … … 106 125 /* Disable interrupts */ 107 126 uart->regs->ier = 0; 108 127 #endif 109 128 /* Setup outdev */ 110 129 outdev_initialize("amdm37x_uart_dev", &uart->outdev, &amdm37x_uart_ops); 111 130 uart->outdev.data = uart; 131 132 /* Initialize IRQ */ 133 irq_initialize(&uart->irq); 134 uart->irq.devno = device_assign_devno(); 135 uart->irq.inr = interrupt; 136 uart->irq.claim = amdm37x_uart_claim; 137 uart->irq.handler = amdm37x_uart_handler; 138 uart->irq.instance = uart; 139 irq_register(&uart->irq); 112 140 113 141 return true; … … 116 144 void amdm37x_uart_input_wire(amdm37x_uart_t *uart, indev_t *indev) 117 145 { 118 // TODO implement 119 // register interrupt 120 // set rx fifo 121 // set rx fifo threshold to 1 146 ASSERT(uart); 147 /* Set indev */ 148 uart->indev = indev; 149 /* Enable interrupt on receive */ 150 uart->regs->ier |= AMDM37x_UART_IER_RHR_IRQ_FLAG; 151 152 // TODO set rx fifo 153 // TODO set rx fifo threshold to 1 122 154 } 123 155
Note:
See TracChangeset
for help on using the changeset viewer.