Changeset 1cdb412 in mainline
- Timestamp:
- 2012-03-31T06:27:28Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d01b9a1
- Parents:
- 64f6cba8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/drivers/amdm37x_uart/amdm37x_uart.c
r64f6cba8 r1cdb412 72 72 { 73 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)) { 74 while (!(uart->regs->isr2 & AMDM37x_UART_ISR2_RX_FIFO_EMPTY_FLAG)) { 76 75 const uint8_t val = uart->regs->rhr; 77 76 if (uart->indev && val) { 78 77 indev_push_character(uart->indev, val); 79 78 } 80 //}79 } 81 80 } 82 81 … … 93 92 /* Soft reset the port */ 94 93 uart->regs->sysc = AMDM37x_UART_SYSC_SOFTRESET_FLAG; 95 while (uart->regs->syss & AMDM37x_UART_SYSS_RESETDONE_FLAG) ; 94 while (!(uart->regs->syss & AMDM37x_UART_SYSS_RESETDONE_FLAG)) ; 95 #endif 96 96 97 97 /* Enable access to EFR register */ … … 106 106 /* Set default (val 0) triggers, disable DMA enable FIFOs */ 107 107 const bool tcl_tlr = uart->regs->mcr & AMDM37x_UART_MCR_TCR_TLR_FLAG; 108 /* Enable access to tcr and tlr registers */ 109 uart->regs->mcr |= AMDM37x_UART_MCR_TCR_TLR_FLAG; 110 111 /* Enable FIFOs */ 108 112 uart->regs->fcr = AMDM37x_UART_FCR_FIFO_EN_FLAG; 109 113 110 /* Enable fine granularity for rx trigger */ 114 /* Eneble fine granularity for RX FIFO and set trigger level to 1, 115 * TX FIFO, trigger level is irelevant*/ 111 116 uart->regs->lcr = 0xbf; /* Sets config mode B */ 112 117 uart->regs->scr = AMDM37x_UART_SCR_RX_TRIG_GRANU1_FLAG; 118 uart->regs->tlr = 1 << AMDM37x_UART_TLR_RX_FIFO_TRIG_SHIFT; 113 119 114 120 /* Restore enhanced */ … … 117 123 118 124 uart->regs->lcr = 0x80; /* Config mode A */ 119 /* Restore tcl_lcr */125 /* Restore tcl_lcr access flag*/ 120 126 if (!tcl_tlr) 121 127 uart->regs->mcr &= ~AMDM37x_UART_MCR_TCR_TLR_FLAG; 122 128 123 /* Restore tcl_lcr */129 /* Restore lcr */ 124 130 uart->regs->lcr = lcr; 125 131 126 132 /* Disable interrupts */ 127 133 uart->regs->ier = 0; 128 #endif 134 129 135 /* Setup outdev */ 130 136 outdev_initialize("amdm37x_uart_dev", &uart->outdev, &amdm37x_uart_ops); … … 138 144 uart->irq.handler = amdm37x_uart_handler; 139 145 uart->irq.instance = uart; 140 irq_register(&uart->irq);141 146 142 147 return true; … … 148 153 /* Set indev */ 149 154 uart->indev = indev; 155 /* Register interrupt. */ 156 irq_register(&uart->irq); 150 157 /* Enable interrupt on receive */ 151 158 uart->regs->ier |= AMDM37x_UART_IER_RHR_IRQ_FLAG; 152 153 // TODO set rx fifo154 // TODO set rx fifo threshold to 1155 159 } 156 160
Note:
See TracChangeset
for help on using the changeset viewer.