Ignore:
Timestamp:
Oct 5, 2018, 12:08:35 AM (6 years ago)
Author:
alain
Message:

Introduction of the soclib_mty driver for the TSAR-LETI architecture.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/tsar_mips32/drivers/soclib_tty.h

    r457 r570  
    11/*
    2  * soclib_tty.c - soclib tty driver definition.
     2 * soclib_tty.c - soclib_tty driver definition (used in the TSAR_IOB architecture).
    33 *
    44 * Author  Alain Greiner (2016,2017,2018)
     
    2424#include <dev_txt.h>
    2525#include <chdev.h>
    26 #include <spinlock.h>
    2726
    2827
    2928/****************************************************************************************
    3029 * 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:
    3239 * - 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 *
    3442 * It handles asynchronous control characters (^C / ^Z), that are translated to signals
    3543 * 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).
    3649 ***************************************************************************************/
    3750
     
    5669
    5770/****************************************************************************************
    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.
    5972 ***************************************************************************************/
    6073
    6174#define TTY_FIFO_DEPTH  128
    6275
    63 typedef struct tty_fifo_s     // 32 bytes
     76typedef struct tty_fifo_s
    6477{
    6578    char          data[TTY_FIFO_DEPTH];   // one char per slot
     
    6780    unsigned int  ptw;                    // next full slot index
    6881    unsigned int  sts;                    // number of full slots
    69 } tty_fifo_t;
    70  
     82}
     83tty_fifo_t;
    7184
    7285/****************************************************************************************
     
    8396 * different chdevs (and consequently two diffeerent server threads) for the RX and TX
    8497 * 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.
    88104 * ****************************************************************************************
    89105 * @ thread_xp : extended pointer on client thread descriptor.
Note: See TracChangeset for help on using the changeset viewer.