Changeset 570 for trunk/hal/tsar_mips32/drivers/soclib_tty.h
- Timestamp:
- Oct 5, 2018, 12:08:35 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/drivers/soclib_tty.h
r457 r570 1 1 /* 2 * soclib_tty.c - soclib tty driver definition.2 * soclib_tty.c - soclib_tty driver definition (used in the TSAR_IOB architecture). 3 3 * 4 4 * Author Alain Greiner (2016,2017,2018) … … 24 24 #include <dev_txt.h> 25 25 #include <chdev.h> 26 #include <spinlock.h>27 26 28 27 29 28 /**************************************************************************************** 30 29 * This driver supports the vci_tty_tsar component. 31 * Regarding read/write request, it implements the generic TXT device API: 30 * 31 * 1) This hardware component handles several hardware channels, supporting directly 32 * several kernel TXT channels. 33 * 2) For received characters, the hardware support one RX_IRQ, and one bit 34 * in the STATUS register to signal that the READ register is full. 35 * 3) For transmitted characters, the hardware supports one RX_IRQ, and one bit 36 * in STATUS register to signal that the WRITE register is empty. 37 * 38 * It implements the generic TXT device API: 32 39 * - transfer one single character from TTY to command "buffer" if to_mem is non-zero. 33 * - transfer "count" characters from command "buffer" to TTY if "to_mem is zero. 40 * - transfer "count" characters from command "buffer" to TTY if to_mem is zero. 41 * 34 42 * It handles asynchronous control characters (^C / ^Z), that are translated to signals 35 43 * transmited to the TXT owner process (foreground process). 44 * 45 * This driver implements one TX_FIFO for the transmited characters, writen by the "cmd" 46 * function, and read by the "isr" function). 47 * This driver implements one RX_FIFO for the received characters, writen by the "isr" 48 * function, and read by the "cmd" function). 36 49 ***************************************************************************************/ 37 50 … … 56 69 57 70 /**************************************************************************************** 58 * This Rstructure is used by the soclib_tty_isr for the RX channel.71 * This structure is used for both the RX_FIFO and the TX_FIFO. 59 72 ***************************************************************************************/ 60 73 61 74 #define TTY_FIFO_DEPTH 128 62 75 63 typedef struct tty_fifo_s // 32 bytes76 typedef struct tty_fifo_s 64 77 { 65 78 char data[TTY_FIFO_DEPTH]; // one char per slot … … 67 80 unsigned int ptw; // next full slot index 68 81 unsigned int sts; // number of full slots 69 } tty_fifo_t;70 82 } 83 tty_fifo_t; 71 84 72 85 /**************************************************************************************** … … 83 96 * different chdevs (and consequently two diffeerent server threads) for the RX and TX 84 97 * directions. The client thread is identified by the <thread_xp> argument. 85 * Depending on the command type, it unmasks the relevant TTY_RX / TTY_TX IRQ, 86 * and blocks the TXT device server thread on the THREAD_BLOCKED_DEV_ISR, as the data 87 * transfer is done by the ISR. 98 * These functions are supposed to be called by the server thread associated at a 99 * given TXT channel for a given direction (TX or RX). 100 * Depending on the command type, it access the TX_FIFO or RX_FIFO, and blocks the TXT 101 * device server thread on the THREAD_BLOCKED_DEV_ISR, if the RX_FIFO is empty (for a 102 * READ), or if the TX_FIFO is full for a WRITE). 103 * The actual transfer between the FIFOs and the TTY device registers is done by the ISR. 88 104 * **************************************************************************************** 89 105 * @ thread_xp : extended pointer on client thread descriptor.
Note: See TracChangeset
for help on using the changeset viewer.