Changeset 297 for soft/giet_vm/giet_drivers/tty_driver.c
- Timestamp:
- Mar 28, 2014, 10:48:51 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/tty_driver.c
r295 r297 170 170 171 171 /////////////////////////////////////////////////////////////////////////////////// 172 // This ISR handles the IRQ signaling that the RX buffer is full.172 // This ISR handles the IRQ signaling that the RX buffer is not empty. 173 173 // IT can be an HWI or an SWI. 174 // There is one single multi_tty component controling all channels.175 174 // There is one communication buffer _tty_rx_buf[i] and one synchronisation 176 175 // variable _tty_rx_full[i] per channel. 177 // A character is lost if the buffer is full when the ISR is executed. 176 // Does nothing if the TTY_RX buffer is empty, or if the kernel buffer is full 177 // when the ISR is called. 178 178 /////////////////////////////////////////////////////////////////////////////////// 179 179 void _tty_rx_isr( unsigned int irq_type, // HWI / WTI … … 183 183 unsigned int cluster_xy = _get_procid() / NB_PROCS_MAX; 184 184 185 if ( irq_type == IRQ_TYPE_WTI ) // reset SWI in XCU if required 185 // get TTY status 186 unsigned int status = _tty_get_register( channel, TTY_STATUS ); 187 188 // check both TTY status and kernel buffer status: 189 // does nothing if kernel buffer full or tty_buffer empty 190 if ( ((status & 0x1) == 0) || 191 (_tty_rx_full[channel] != 0) ) return; 192 193 // reset WTI in XCU if WTI type 194 if ( irq_type == IRQ_TYPE_WTI ) 186 195 { 187 196 unsigned int value; 188 197 _xcu_get_wti_value( cluster_xy, irq_id, &value ); 189 198 } 190 191 // get character and reset TTY IRQ 192 _tty_rx_buf[channel] = _tty_get_register( channel, TTY_READ ); 199 200 // transfer character to kernel buffer and acknowledge TTY IRQ 201 _tty_rx_buf[channel] = _tty_get_register( channel, TTY_READ ); 202 203 // set kernel buffer status 204 asm volatile( "sync" ); 205 _tty_rx_full[channel] = 1; 193 206 194 207 #if GIET_DEBUG_IRQS // we don't take the TTY lock to avoid deadlock … … 209 222 #endif 210 223 211 // signals character available212 _tty_rx_full[channel] = 1;213 224 } 214 225
Note: See TracChangeset
for help on using the changeset viewer.