Changeset 534


Ignore:
Timestamp:
Sep 21, 2018, 10:20:35 PM (6 years ago)
Author:
nicolas.van.phan@…
Message:

Add mtty driver.

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/boot/tsar_mips32/boot.c

    r530 r534  
    123123 * This function returns the printable string for each device type
    124124 ********************************************************************************/
    125 static const char * device_type_str( uint32_t dev_type )
    126 {
    127     if     ( dev_type == DEV_TYPE_RAM_SCL ) return "RAM_SCL";
    128     else if( dev_type == DEV_TYPE_ROM_SCL ) return "ROM_SCL";
    129     else if( dev_type == DEV_TYPE_FBF_SCL ) return "FBF_SCL";
    130     else if( dev_type == DEV_TYPE_IOB_TSR ) return "IOB_TSR";
    131     else if( dev_type == DEV_TYPE_IOC_BDV ) return "IOC_BDV";
    132     else if( dev_type == DEV_TYPE_IOC_HBA ) return "IOC_HBA";
    133     else if( dev_type == DEV_TYPE_IOC_SDC ) return "IOC_SDC";
    134     else if( dev_type == DEV_TYPE_IOC_SPI ) return "IOC_SPI";
    135     else if( dev_type == DEV_TYPE_IOC_RDK ) return "IOC_RDK";
    136     else if( dev_type == DEV_TYPE_MMC_TSR ) return "MMC_TSR";
    137     else if( dev_type == DEV_TYPE_DMA_SCL ) return "DMA_SCL";
    138     else if( dev_type == DEV_TYPE_NIC_CBF ) return "NIC_CBF";
    139     else if( dev_type == DEV_TYPE_TIM_SCL ) return "TIM_SCL";
    140     else if( dev_type == DEV_TYPE_TXT_TTY ) return "TXT_TTY";
    141     else if( dev_type == DEV_TYPE_ICU_XCU ) return "ICU_XCU";
    142     else if( dev_type == DEV_TYPE_PIC_TSR ) return "PIC_TSR";
    143     else                                    return "undefined";
     125static const char * device_type_str( boot_device_types_t dev_type ) {
     126    switch (dev_type) {
     127        case DEV_TYPE_RAM_SCL: return "RAM_SCL";
     128        case DEV_TYPE_ROM_SCL: return "ROM_SCL";
     129        case DEV_TYPE_FBF_SCL: return "FBF_SCL";
     130        case DEV_TYPE_IOB_TSR: return "IOB_TSR";
     131        case DEV_TYPE_IOC_BDV: return "IOC_BDV";
     132        case DEV_TYPE_IOC_HBA: return "IOC_HBA";
     133        case DEV_TYPE_IOC_SDC: return "IOC_SDC";
     134        case DEV_TYPE_IOC_SPI: return "IOC_SPI";
     135        case DEV_TYPE_IOC_RDK: return "IOC_RDK";
     136        case DEV_TYPE_MMC_TSR: return "MMC_TSR";
     137        case DEV_TYPE_DMA_SCL: return "DMA_SCL";
     138        case DEV_TYPE_NIC_CBF: return "NIC_CBF";
     139        case DEV_TYPE_TIM_SCL: return "TIM_SCL";
     140        case DEV_TYPE_TXT_TTY: return "TXT_TTY";
     141        case DEV_TYPE_ICU_XCU: return "ICU_XCU";
     142        case DEV_TYPE_PIC_TSR: return "PIC_TSR";
     143        default:               return "undefined";
     144    }
    144145}
    145146
     
    554555            (device->type == DEV_TYPE_ICU_XCU) ||
    555556            (device->type == DEV_TYPE_MMC_TSR) ||
    556             (device->type == DEV_TYPE_DMA_SCL) )
     557            (device->type == DEV_TYPE_DMA_SCL) ||
     558            (device->type == DEV_TYPE_TXT_MTY) )
    557559        {
    558560            if (device->type == DEV_TYPE_RAM_SCL)   // RAM
     
    565567#endif
    566568            }
    567             else                                    // ICU / MMC / DMA
     569            else                                    // ICU / MMC / DMA / MTY
    568570            {
    569571                if( device_id >= CONFIG_MAX_INT_DEV )
  • trunk/hal/tsar_mips32/Makefile

    r457 r534  
    1717
    1818DRIVERS_OBJS = $(HAL_ARCH)/build/drivers/soclib_tty.o  \
     19               $(HAL_ARCH)/build/drivers/soclib_mtty.o  \
    1920               $(HAL_ARCH)/build/drivers/soclib_bdv.o  \
    2021               $(HAL_ARCH)/build/drivers/soclib_hba.o  \
  • trunk/hal/tsar_mips32/core/hal_drivers.c

    r492 r534  
    2626
    2727#include <soclib_tty.h>
     28#include <soclib_mtty.h>
    2829#include <soclib_pic.h>
    2930#include <soclib_iob.h>
     
    4950                           uint32_t   impl )
    5051{
    51         assert( (impl == IMPL_TXT_TTY), "bad implementation" );
    52 
    53         soclib_tty_init( txt );
     52    switch (impl) {
     53    case IMPL_TXT_TTY : {
     54        soclib_tty_init( txt );
     55        break;
     56    }
     57    case IMPL_TXT_MTY : {
     58        soclib_mtty_init( txt );
     59        break;
     60    }
     61    default : {
     62        assert( false, "bad implementation" );
     63    }
     64    }
    5465}
    5566
  • trunk/hal/tsar_mips32/drivers/soclib_mtty.c

    r533 r534  
    5353
    5454__attribute__((section(".kdata")))
    55 tty_fifo_t  tty_rx_fifo[CONFIG_MAX_TXT_CHANNELS];
     55mtty_fifo_t  mtty_rx_fifo[CONFIG_MAX_TXT_CHANNELS];
    5656
    5757__attribute__((section(".kdata")))
    58 tty_fifo_t  tty_tx_fifo[CONFIG_MAX_TXT_CHANNELS];
     58mtty_fifo_t  mtty_tx_fifo[CONFIG_MAX_TXT_CHANNELS];
    5959
    6060///////////////////////////////////////
     
    8484    if( is_rx )
    8585    {
    86         tty_rx_fifo[channel].sts = 0;
    87         tty_rx_fifo[channel].ptr = 0;
    88         tty_rx_fifo[channel].ptw = 0;
     86        mtty_rx_fifo[channel].sts = 0;
     87        mtty_rx_fifo[channel].ptr = 0;
     88        mtty_rx_fifo[channel].ptw = 0;
    8989    }
    9090    else
    9191    {
    92         tty_tx_fifo[channel].sts = 0;
    93         tty_tx_fifo[channel].ptr = 0;
    94         tty_tx_fifo[channel].ptw = 0;
     92        mtty_tx_fifo[channel].sts = 0;
     93        mtty_tx_fifo[channel].ptr = 0;
     94        mtty_tx_fifo[channel].ptw = 0;
    9595    }
    9696}  // end soclib_mtty_init()
     
    9999void __attribute__ ((noinline)) soclib_mtty_cmd( xptr_t th_xp )
    100100{
    101     tty_fifo_t * fifo;     // MTTY_RX or MTTY_TX FIFO
     101    mtty_fifo_t * fifo;     // MTTY_RX or MTTY_TX FIFO
    102102    char         byte;     // byte value
    103103    uint32_t     done;     // number of bytes moved
     
    138138    if( type == TXT_WRITE )         // write bytes to MTTY_TX FIFO
    139139    {
    140         fifo = &tty_tx_fifo[channel];
     140        fifo = &mtty_tx_fifo[channel];
    141141
    142142        done = 0;
     
    190190    else if( type == TXT_READ )       // read bytes from MTTY_RX FIFO   
    191191    {
    192         fifo = &tty_rx_fifo[channel];
     192        fifo = &mtty_rx_fifo[channel];
    193193
    194194        done = 0;
     
    257257    process_t  * owner_ptr;         // local pointer on TXT owner process
    258258    pid_t        owner_pid;         // TXT owner process identifier
    259     tty_fifo_t * fifo;              // pointer on MTTY_TX or MTTY_RX FIFO
     259    mtty_fifo_t * fifo;              // pointer on MTTY_TX or MTTY_RX FIFO
    260260    cxy_t        tty_cxy;           // soclib_mtty cluster
    261261    uint32_t   * tty_ptr;           // soclib_mtty segment base address
     
    308308    if( is_rx )
    309309    {
    310         fifo = &tty_rx_fifo[channel];
     310        fifo = &mtty_rx_fifo[channel];
    311311
    312312        // try to move bytes until MTTY_READ register empty
     
    469469    else
    470470    {
    471         fifo = &tty_tx_fifo[channel];
     471        fifo = &mtty_tx_fifo[channel];
    472472
    473473        // try to move bytes until TX_FIFO empty
  • trunk/hal/tsar_mips32/drivers/soclib_mtty.h

    r533 r534  
    6565#define MTTY_FIFO_DEPTH  128
    6666
    67 typedef struct tty_fifo_s     // 32 bytes
     67typedef struct mtty_fifo_s     // 32 bytes
    6868{
    6969    char          data[MTTY_FIFO_DEPTH];   // one char per slot
     
    7171    unsigned int  ptw;                    // next full slot index
    7272    unsigned int  sts;                    // number of full slots
    73 } tty_fifo_t;
     73} mtty_fifo_t;
    7474 
    7575
  • trunk/hal/tsar_mips32/drivers/soclib_pic.c

    r492 r534  
    367367    // get the source chdev functionnal type, channel, and direction
    368368    uint32_t func    = src_chdev->func;
     369    uint32_t impl    = src_chdev->impl;
    369370    uint32_t channel = src_chdev->channel;
    370371    bool_t   is_rx   = src_chdev->is_rx;
    371372
    372373    if( (func == DEV_FUNC_IOC) || (func == DEV_FUNC_NIC) ||
    373         (func == DEV_FUNC_TXT) || (func == DEV_FUNC_IOB) )          // external IRQ => WTI
     374        (func == DEV_FUNC_TXT && impl == IMPL_TXT_TTY) || (func == DEV_FUNC_IOB) )          // external IRQ => WTI
    374375    {
    375376        // get external IRQ index
     
    415416
    416417    }
    417     else if( (func == DEV_FUNC_DMA) || (func == DEV_FUNC_MMC) )   // internal IRQ => HWI
     418    else if( (func == DEV_FUNC_DMA) || (func == DEV_FUNC_MMC) ||
     419             (func == DEV_FUNC_TXT && impl == IMPL_TXT_MTY) )   // internal IRQ => HWI
    418420    {
    419421        // get internal IRQ index
    420422        uint32_t hwi_id;
    421423        if( func == DEV_FUNC_DMA ) hwi_id = lapic_input.dma[channel];
     424        else if (func == DEV_FUNC_TXT ) hwi_id = lapic_input.mtty;
    422425        else                       hwi_id = lapic_input.mmc;
    423426
  • trunk/kernel/Makefile

    r473 r534  
    1212
    1313  DRIVERS_OBJS = $(HAL_ARCH)/build/drivers/soclib_tty.o  \
     14                 $(HAL_ARCH)/build/drivers/soclib_mtty.o \
    1415                 $(HAL_ARCH)/build/drivers/soclib_bdv.o  \
    1516                 $(HAL_ARCH)/build/drivers/soclib_hba.o  \
  • trunk/kernel/devices/dev_pic.h

    r503 r534  
    141141    uint32_t   dma[CONFIG_MAX_DMA_CHANNELS];
    142142    uint32_t   mmc;                             // MMC is single channel
     143    uint32_t   mtty;                            // Multi Tty (backup tty in cluster 0)
    143144}
    144145lapic_input_t;
  • trunk/kernel/devices/dev_txt.h

    r527 r534  
    7171    IMPL_TXT_TTY =   0,
    7272    IMPL_TXT_RS2 =   1,
     73    IMPL_TXT_MTY =   2,
    7374}
    7475txt_impl_t;
  • trunk/kernel/kern/kernel_init.c

    r532 r534  
    695695                if     ( func == DEV_FUNC_MMC ) lapic_input.mmc = id;
    696696                else if( func == DEV_FUNC_DMA ) lapic_input.dma[channel] = id;
     697                else if( func == DEV_FUNC_TXT ) lapic_input.mtty = id;
    697698                else assert( false , "illegal source device for LAPIC input" );
    698699            }
  • trunk/tools/arch_info/arch_classes.py

    r6 r534  
    5959    'TIM_SCL',         # 8.0
    6060    'TXT_TTY',         # 9.0
     61    'TXT_RS2',         # 9.1
     62    'TXT_MTY',         # 9.2
    6163    'ICU_XCU',         # A.0
    6264    'PIC_TSR',         # B.0
     
    7880    0x00080000,        # 8.0
    7981    0x00090000,        # 9.0
     82    0x00090001,        # 9.1
     83    0x00090002,        # 9.2
    8084    0x000A0000,        # A.0
    8185    0x000B0000,        # B.0
  • trunk/tools/arch_info/arch_info.h

    r457 r534  
    6666 ***************************************************************************************/
    6767
    68 enum deviceTypes
     68typedef enum deviceTypes_s
    6969{
    7070    DEV_TYPE_RAM_SCL   = 0x00000000,
     
    8282    DEV_TYPE_TIM_SCL   = 0x00080000,
    8383    DEV_TYPE_TXT_TTY   = 0x00090000,
     84    DEV_TYPE_TXT_RS2   = 0x00090001,
     85    DEV_TYPE_TXT_MTY   = 0x00090002,
    8486    DEV_TYPE_ICU_XCU   = 0x000A0000,
    8587    DEV_TYPE_PIC_TSR   = 0x000B0000,
    86 };
     88} boot_device_types_t;
    8789
    8890/****************************************************************************************
Note: See TracChangeset for help on using the changeset viewer.