Changeset 407 for trunk/kernel/devices


Ignore:
Timestamp:
Nov 7, 2017, 3:08:12 PM (6 years ago)
Author:
alain
Message:

First implementation of fork/exec.

Location:
trunk/kernel/devices
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/devices/dev_dma.c

    r406 r407  
    8888    thread_t * this = CURRENT_THREAD;
    8989
    90     dma_dmsg("\n[DMSG] %s : enters for thread %x / dst = %l /src = %l / size = %x\n",
     90    dma_dmsg("\n[DBG] %s : enters for thread %x / dst = %l /src = %l / size = %x\n",
    9191              __FUNCTION__ , this->trdid , dst_xp , src_xp , size );
    9292
     
    108108    // block client thread on THREAD_BLOCKED_IO and deschedule.
    109109    // it is re-activated by the ISR signaling IO operation completion.
    110     chdev_register_command( dev_xp , this );
     110    chdev_register_command( dev_xp );
    111111
    112     dma_dmsg("\n[DMSG] %s : completes for thread %x / error = %d\n",
     112    dma_dmsg("\n[DBG] %s : completes for thread %x / error = %d\n",
    113113             __FUNCTION__ ,  this->trdid , this->dma_cmd.error );
    114114
  • trunk/kernel/devices/dev_fbf.c

    r406 r407  
    143143    }
    144144
    145     fbf_dmsg("\n[DMSG] %s : thread %x in process %x / vaddr = %p / paddr = %l\n",
     145    fbf_dmsg("\n[DBG] %s : thread %x in process %x / vaddr = %p / paddr = %l\n",
    146146             __FUNCTION__ , this->trdid , this->process->pid , buffer , buf_paddr );
    147147
  • trunk/kernel/devices/dev_ioc.c

    r406 r407  
    5151
    5252    // set chdev name
    53     snprintf( ioc->name , 16 , "ioc_%d" , channel );
     53    snprintf( ioc->name , 16 , "ioc%d" , channel );
    5454
    5555    // call driver init function
     
    9090// It builds and registers the command in the calling thread descriptor.
    9191// Then, it registers the calling thead in chdev waiting queue.
    92 // Finally it blocks on the THREAD_BLOCKED_DEV condition and deschedule.
     92// Finally it blocks on the THREAD_BLOCKED_IO condition and deschedule.
    9393////////////////////////////////////i/////////////////////////////////////////////
    9494static error_t dev_ioc_access( uint32_t   cmd_type,
     
    9999    thread_t * this = CURRENT_THREAD;              // pointer on client thread
    100100
    101     ioc_dmsg("\n[DMSG] %s : thread %x in process %x"
     101    ioc_dmsg("\n[DBG] %s : thread %x in process %x"
    102102             " for lba = %x / buffer = %x / at cycle %d\n",
    103103             __FUNCTION__ , this->trdid , this->process->pid ,
     
    126126    // block client thread on THREAD_BLOCKED_IO and deschedule.
    127127    // it is re-activated by the ISR signaling IO operation completion.
    128     chdev_register_command( dev_xp , this );
    129 
    130     ioc_dmsg("\n[DMSG] in %s : thread %x in process %x"
     128    chdev_register_command( dev_xp );
     129
     130    ioc_dmsg("\n[DBG] in %s : thread %x in process %x"
    131131             " completes / error = %d / at cycle %d\n",
    132132             __FUNCTION__ , this->trdid , this->process->pid ,
     
    162162    thread_t * this = CURRENT_THREAD;
    163163
    164     ioc_dmsg("\n[DMSG] %s : core[%x,%d] enter for %d blocks / lba = %x / cycle %d\n",
     164    ioc_dmsg("\n[DBG] %s : core[%x,%d] enter for %d blocks / lba = %x / cycle %d\n",
    165165    __FUNCTION__ , local_cxy , this->core->lid , count , lba , hal_time_stamp() );
    166166
     
    199199    dev_pic_enable_irq( lid , ioc_xp );
    200200
    201     ioc_dmsg("\n[DMSG] %s : core[%x,%d] exit / error = %d / cycle %d\n",
     201    ioc_dmsg("\n[DBG] %s : core[%x,%d] exit / error = %d / cycle %d\n",
    202202    __FUNCTION__ , local_cxy , this->core->lid , this->ioc_cmd.error , hal_time_stamp() );
    203203
  • trunk/kernel/devices/dev_mmc.c

    r406 r407  
    9999    thread_t * this = CURRENT_THREAD;
    100100
    101     mmc_dmsg("\n[DMSG] %s enters for thread %x in process %x / buf_xp = %l\n",
     101    mmc_dmsg("\n[DBG] %s enters for thread %x in process %x / buf_xp = %l\n",
    102102                 __FUNCTION__ , this->trdid , this->process->pid , buf_xp );
    103103
     
    124124    error = dev_mmc_access( this );
    125125
    126     mmc_dmsg("\n[DMSG] %s completes for thread %x in process %x / error = %d\n",
     126    mmc_dmsg("\n[DBG] %s completes for thread %x in process %x / error = %d\n",
    127127             __FUNCTION__ , this->trdid , this->process->pid , error );
    128128
     
    139139    thread_t * this = CURRENT_THREAD;
    140140
    141     mmc_dmsg("\n[DMSG] %s enters for thread %x in process %x / buf_xp = %l\n",
     141    mmc_dmsg("\n[DBG] %s enters for thread %x in process %x / buf_xp = %l\n",
    142142                 __FUNCTION__ , this->trdid , this->process->pid , buf_xp );
    143143
     
    164164    error = dev_mmc_access( this );
    165165
    166     mmc_dmsg("\n[DMSG] %s completes for thread %x in process %x / error = %d\n",
     166    mmc_dmsg("\n[DBG] %s completes for thread %x in process %x / error = %d\n",
    167167                 __FUNCTION__ , this->trdid , this->process->pid , error );
    168168
  • trunk/kernel/devices/dev_nic.c

    r406 r407  
    5151
    5252    // set chdev name
    53     if( is_rx ) snprintf( nic->name , 16 , "nic_rx_%d" , channel );
    54     else        snprintf( nic->name , 16 , "nic_tx_%d" , channel );
     53    if( is_rx ) snprintf( nic->name , 16 , "nic%d_rx" , channel );
     54    else        snprintf( nic->name , 16 , "nic%d_tx" , channel );
    5555
    5656    // call driver init function
     
    9797    core_t * core = thread_ptr->core;
    9898
    99     nic_dmsg("\n[DMSG] %s enters for NIC-RX thread on core %d in cluster %x\n",
     99    nic_dmsg("\n[DBG] %s enters for NIC-RX thread on core %d in cluster %x\n",
    100100                 __FUNCTION__ , core->lid , local_cxy );
    101101
     
    129129        // block on THREAD_BLOCKED_IO condition and deschedule
    130130        thread_block( thread_ptr , THREAD_BLOCKED_IO );
    131         sched_yield( NULL );
     131        sched_yield();
    132132
    133133        // disable NIC-RX IRQ
     
    147147    pkd->length = thread_ptr->nic_cmd.length;
    148148
    149     nic_dmsg("\n[DMSG] %s exit for NIC-RX thread on core %d in cluster %x\n",
     149    nic_dmsg("\n[DBG] %s exit for NIC-RX thread on core %d in cluster %x\n",
    150150             __FUNCTION__ , core->lid , local_cxy );
    151151
     
    167167    core_t * core = thread_ptr->core;
    168168
    169     nic_dmsg("\n[DMSG] %s enters for NIC-RX thread on core %d in cluster %x\n",
     169    nic_dmsg("\n[DBG] %s enters for NIC-RX thread on core %d in cluster %x\n",
    170170                 __FUNCTION__ , core->lid , local_cxy );
    171171
     
    199199        // block on THREAD_BLOCKED I/O condition and deschedule
    200200        thread_block( thread_ptr , THREAD_BLOCKED_IO );
    201         sched_yield( NULL );
     201        sched_yield();
    202202
    203203        // disable NIC-TX IRQ
     
    215215    if( error ) return error;
    216216
    217     nic_dmsg("\n[DMSG] %s exit for NIC-TX thread on core %d in cluster %x\n",
     217    nic_dmsg("\n[DBG] %s exit for NIC-TX thread on core %d in cluster %x\n",
    218218             __FUNCTION__ , core->lid , local_cxy );
    219219
  • trunk/kernel/devices/dev_nic.h

    r14 r407  
    107107enum nic_impl_e
    108108{
    109     IMPL_NIC_SOC =   0,     
     109    IMPL_NIC_CBF =   0,     
    110110    IMPL_NIC_I86 =   1,
    111111}
  • trunk/kernel/devices/dev_pic.c

    r406 r407  
    3636
    3737extern chdev_directory_t  chdev_dir;         // allocated in kernel_init.c
     38extern iopic_input_t      iopic_input;       // allocated in kernel_init.c
    3839
    3940///////////////////////////////////
     
    8384                         xptr_t  src_chdev_xp )
    8485{
    85     irq_dmsg("\n[DMSG] %s : core = [%x,%d] / src_chdev_cxy = %x / src_chdev_ptr = %x\n",
    86     __FUNCTION__ , local_cxy , lid , GET_CXY(src_chdev_xp) , GET_PTR(src_chdev_xp) );
     86
     87irq_dmsg("\n[DBG] %s : core = [%x,%d] / src_chdev_cxy = %x / src_chdev_ptr = %x\n",
     88__FUNCTION__ , local_cxy , lid , GET_CXY(src_chdev_xp) , GET_PTR(src_chdev_xp) );
    8789
    8890    // get pointer on PIC chdev
     
    101103                          xptr_t  src_chdev_xp )
    102104{
    103     irq_dmsg("\n[DMSG] %s : core = [%x,%d] / src_chdev_cxy = %x / src_chdev_ptr = %x\n",
    104     __FUNCTION__ , local_cxy , lid , GET_CXY(src_chdev_xp) , GET_PTR(src_chdev_xp) );
     105
     106irq_dmsg("\n[DBG] %s : core = [%x,%d] / src_chdev_cxy = %x / src_chdev_ptr = %x\n",
     107__FUNCTION__ , local_cxy , lid , GET_CXY(src_chdev_xp) , GET_PTR(src_chdev_xp) );
    105108
    106109    // get pointer on PIC chdev
     
    118121void dev_pic_enable_timer( uint32_t period )
    119122{
    120     irq_dmsg("\n[DMSG] %s : core = [%x,%d] / period = %d\n",
    121     __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , period );
     123
     124irq_dmsg("\n[DBG] %s : core = [%x,%d] / period = %d\n",
     125__FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , period );
    122126
    123127    // get pointer on PIC chdev
     
    135139void dev_pic_enable_ipi()
    136140{
    137     irq_dmsg("\n[DMSG] %s : core = [%x,%d]\n",
    138     __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid );
     141
     142irq_dmsg("\n[DBG] %s : core = [%x,%d] / cycle %d\n",
     143__FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , hal_time_stamp() );
    139144
    140145    // get pointer on PIC chdev
     
    153158                       lid_t  lid )
    154159{
    155     irq_dmsg("\n[DMSG] %s : enter / src_core = [%x,%d] / dst_core = [%x,%d] / cycle %d\n",
    156     __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, cxy, lid, hal_time_stamp() );
     160
     161irq_dmsg("\n[DBG] %s : src_core = [%x,%d] / dst_core = [%x,%d] / cycle %d\n",
     162__FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, cxy, lid, hal_time_stamp() );
    157163
    158164    // get pointer on PIC chdev
     
    165171    // call relevant driver function
    166172    f( cxy , lid );
    167 
    168     irq_dmsg("\n[DMSG] %s : exit / src_core = [%x,%d] / dst_core = [%x,%d] / cycle %d\n",
    169     __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, cxy, lid, hal_time_stamp() );
    170 }
    171 
     173}
     174
     175//////////////////////
     176void dev_pic_ack_ipi()
     177{
     178
     179irq_dmsg("\n[DBG] %s : core = [%x,%d] / cycle %d\n",
     180__FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, hal_time_stamp() );
     181
     182    // get pointer on PIC chdev
     183    chdev_t * pic_ptr = (chdev_t *)GET_PTR( chdev_dir.pic );
     184    cxy_t     pic_cxy = GET_CXY( chdev_dir.pic );
     185
     186    // get pointer on ack_ipi function
     187    ack_ipi_t * f = hal_remote_lpt( XPTR( pic_cxy , &pic_ptr->ext.pic.ack_ipi ) );
     188
     189    // call relevant driver function
     190    f();
     191}
     192
     193/////////////////////////////
     194void dev_pic_inputs_display()
     195{
     196    uint32_t k;
     197    uint32_t save_sr;
     198
     199    // get pointers on TXT0 chdev
     200    xptr_t    txt0_xp  = chdev_dir.txt_tx[0];
     201    cxy_t     txt0_cxy = GET_CXY( txt0_xp );
     202    chdev_t * txt0_ptr = GET_PTR( txt0_xp );
     203
     204    // get extended pointer on remote TXT0 chdev lock
     205    xptr_t  lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock );
     206
     207    // get TXT0 lock in busy waiting mode
     208    remote_spinlock_lock_busy( lock_xp , &save_sr );
     209
     210    nolock_printk("\n***** iopic_inputs\n");
     211
     212    for( k = 0 ; k < CONFIG_MAX_IOC_CHANNELS ; k++ )
     213    {
     214        nolock_printk(" - IOC[%d]    hwi_id = %d\n", k , iopic_input.ioc[k] );
     215    }
     216
     217    for( k = 0 ; k < CONFIG_MAX_TXT_CHANNELS ; k++ )
     218    {
     219        nolock_printk(" - TXT_TX[%d] hwi_id = %d\n", k , iopic_input.txt_tx[k] );
     220        nolock_printk(" - TXT_RX[%d] hwi_id = %d\n", k , iopic_input.txt_rx[k] );
     221    }
     222
     223    for( k = 0 ; k < CONFIG_MAX_NIC_CHANNELS ; k++ )
     224    {
     225        nolock_printk(" - NIC_TX[%d] hwi_id = %d\n", k , iopic_input.nic_tx[k] );
     226        nolock_printk(" - NIC_RX[%d] hwi_id = %d\n", k , iopic_input.nic_rx[k] );
     227    }
     228
     229    // release TXT0 lock
     230    remote_spinlock_unlock_busy( lock_xp , save_sr );
     231}
     232
     233
  • trunk/kernel/devices/dev_pic.h

    r406 r407  
    8080/*****************************************************************************************
    8181 * This defines the specific extension for the PIC chdev descriptor.
    82  * It contains four function pointers on the four PIC command types,
    83  * that must be implemented by all drivers.
     82 * It contains the function pointers for all functions that mus be implemented
     83 * by all implementation specific drivers.
    8484 ****************************************************************************************/
    8585
     
    9090typedef void   (enable_ipi_t)   ( );   
    9191typedef void   (send_ipi_t)     ( cxy_t cxy , lid_t lid );
     92typedef void   (ack_ipi_t)      ( );   
    9293typedef void   (extend_init_t)  ( uint32_t * lapic_base );
    9394 
     
    9899    disable_irq_t   * disable_irq;   /*! pointer on the driver "disable_irq" function   */
    99100    enable_timer_t  * enable_timer;  /*! pointer on the driver "enable_timer" function  */
    100     enable_timer_t  * enable_ipi;    /*! pointer on the driver "enable_ipi" function    */
     101    enable_ipi_t    * enable_ipi;    /*! pointer on the driver "enable_ipi" function    */
    101102    send_ipi_t      * send_ipi;      /*! pointer on the driver "send_ipi" function      */
     103    ack_ipi_t       * ack_ipi;       /*! pointer on the driver "ack_ipi" function       */
    102104    extend_init_t   * extend_init;   /*! pointer on the driver "init_extend" function   */
    103105}
     
    109111 * It describes the hardware wiring of IRQs between external peripherals and the IOPIC,
    110112 * as each entry contains the input IRQ index in IOPIC.
    111  * For a multi-channels peripheral, there is one chdev and one IRQ per channel.
     113 * For a multi-channels/multi_IRQ peripheral, there is one chdev per IRQ.
    112114 * This structure is replicated in each cluster. It is allocated as a global variable
    113115 * in the kernel_init.c file.
     
    116118typedef struct iopic_input_s
    117119{
    118     uint32_t   txt[CONFIG_MAX_TXT_CHANNELS];
    119120    uint32_t   ioc[CONFIG_MAX_IOC_CHANNELS];
     121    uint32_t   txt_rx[CONFIG_MAX_TXT_CHANNELS];
     122    uint32_t   txt_tx[CONFIG_MAX_TXT_CHANNELS];
    120123    uint32_t   nic_rx[CONFIG_MAX_NIC_CHANNELS];
    121124    uint32_t   nic_tx[CONFIG_MAX_NIC_CHANNELS];
     
    180183 * This is a static binding, defined during kernel init: IRQ can be enabled/disabled,
    181184 * but the binding cannot be released. It can be used for both internal & external IRQs.
     185 * The configuration is actually done by the - implementation specific - driver,
     186 * and this function just call the relevant driver.
    182187 * WARNING : the IRQ must be explicitely enabled by the dev_pic_enable_irq() function.
    183188 *****************************************************************************************
     
    234239                       lid_t  lid );
    235240
     241/*****************************************************************************************
     242 * This function acknowledges the IPI identified by the calling core local index,
     243 * in the local LAPIC component.
     244 ****************************************************************************************/
     245void dev_pic_ack_ipi();
     246
     247/*****************************************************************************************
     248 * This debug function displays the content of the iopic_input structure,
     249 * that register the input IRQS for the external IOPIC controller.
     250 ****************************************************************************************/
     251void dev_pic_inputs_display();
    236252
    237253#endif  /* _DEV_PIC_H_ */
  • trunk/kernel/devices/dev_txt.c

    r406 r407  
    2727#include <hal_drivers.h>
    2828#include <thread.h>
     29#include <chdev.h>
    2930#include <rpc.h>
    3031#include <printk.h>
     
    3637
    3738extern chdev_directory_t  chdev_dir;         // allocated in kernel_init.c
     39
     40#if CONFIG_READ_DEBUG
     41extern uint32_t enter_txt_read;
     42extern uint32_t exit_txt_read;
     43#endif
    3844
    3945//////////////////////////////////
     
    4753    uint32_t  channel = txt->channel;
    4854    uint32_t  impl    = txt->impl;
     55    bool_t    is_rx   = txt->is_rx;
    4956
    5057    assert( (pic_xp != XPTR_NULL) || (channel == 0) , __FUNCTION__ ,
     
    5259
    5360    // set chdev name
    54     snprintf( txt->name , 16 , "txt_%d" , channel );
     61    if( is_rx ) snprintf( txt->name , 16 , "txt%d_rx" , channel );
     62    else        snprintf( txt->name , 16 , "txt%d_tx" , channel );
    5563
    5664    // call driver init function
     
    6169    if( channel != 0 && impl != IMPL_TXT_RS2 )
    6270    {
    63         // select a core to execute the TXT server thread
     71        // select a core to execute the server thread
    6472        lid_t lid = cluster_select_local_core();
    6573
    66         // bind TXT IRQ to the selected core
     74        // bind IRQ to the selected core
    6775        dev_pic_bind_irq( lid , txt );
    6876
    69         // enable TXT IRQ
     77        // enable IRQ
    7078        dev_pic_enable_irq( lid , XPTR( local_cxy , txt ) );
    7179
     
    99107                               uint32_t   count )
    100108{
     109    xptr_t     dev_xp;
    101110    thread_t * this = CURRENT_THREAD;
    102111
    103     txt_dmsg("\n[DMSG] in %s : thread %x in process %x enters\n",
    104                  __FUNCTION__ , this->trdid , this->process->pid );
     112txt_dmsg("\n[DBG] %s : core[%x,%d] (thread %s) enters / cycle %d\n",
     113__FUNCTION__, local_cxy, this->core->lid, thread_type_str(this->type), hal_time_stamp() );
    105114
    106115    // check channel argument
     
    108117
    109118    // get extended pointer on remote TXT chdev descriptor
    110     xptr_t  dev_xp = chdev_dir.txt[channel];
     119    if( type == TXT_WRITE )  dev_xp = chdev_dir.txt_tx[channel];
     120    else                     dev_xp = chdev_dir.txt_rx[channel];
    111121
    112122    assert( (dev_xp != XPTR_NULL) , __FUNCTION__ , "undefined TXT chdev descriptor" );
     
    121131    // block client thread on THREAD_BLOCKED_IO and deschedule.
    122132    // it is re-activated by the ISR signaling IO operation completion.
    123     chdev_register_command( dev_xp , this );
     133    chdev_register_command( dev_xp );
    124134
    125     txt_dmsg("\n[DMSG] in %s : thread %x in process %x completes / error = %d\n",
    126              __FUNCTION__ , this->trdid , this->process->pid , this->txt_cmd.error );
     135txt_dmsg("\n[DBG] %s : core[%x,%d] (thread %s) exit / cycle %d\n",
     136__FUNCTION__, local_cxy, this->core->lid, thread_type_str(this->type), hal_time_stamp() );
    127137
    128138    // return I/O operation status from calling thread descriptor
     
    135145                       uint32_t   count )
    136146{
    137     return dev_txt_access( TXT_WRITE , channel , buffer , count );
     147    error_t error = dev_txt_access( TXT_WRITE , channel , buffer , count );
     148    return error;
    138149}
    139150
     
    142153                      char     * buffer )
    143154{
    144     return dev_txt_access( TXT_READ , channel , buffer , 1 );
     155
     156#if CONFIG_READ_DEBUG
     157enter_txt_read = hal_time_stamp();
     158#endif
     159
     160    error_t error = dev_txt_access( TXT_READ , channel , buffer , 1 );
     161
     162#if CONFIG_READ_DEBUG
     163exit_txt_read = hal_time_stamp();
     164#endif
     165
     166    return error;
     167
    145168}
    146169
    147 ///////////////////////////////////////////////
    148 error_t dev_txt_sync_write( uint32_t   channel,
    149                             char     * buffer,
     170//////////////////////////////////////////////
     171error_t dev_txt_sync_write( char     * buffer,
    150172                            uint32_t   count )
    151173{
    152     // get pointer on calling thread
    153     thread_t * this = CURRENT_THREAD;
     174    // get extended pointer on TXT[0] chdev
     175    xptr_t  dev_xp = chdev_dir.txt_tx[0];
    154176
    155     // get extended pointer on TXT[0] chdev
    156     xptr_t  dev_xp = chdev_dir.txt[channel];
     177    assert( (dev_xp != XPTR_NULL) , __FUNCTION__ ,
     178    "undefined TXT0 chdev descriptor" );
    157179
    158     assert( (dev_xp != XPTR_NULL) , __FUNCTION__ , "undefined TXT0 chdev descriptor" );
    159 
    160     // register command in calling thread descriptor
    161     this->txt_cmd.dev_xp  = dev_xp;
    162     this->txt_cmd.type    = TXT_SYNC_WRITE;
    163     this->txt_cmd.buf_xp  = XPTR( local_cxy , buffer );
    164     this->txt_cmd.count   = count;
     180    // get TXTO chdev cluster and local pointer
     181    cxy_t    dev_cxy  = GET_CXY( dev_xp );
     182    chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
    165183
    166184    // get driver command function
    167     cxy_t       dev_cxy = GET_CXY( dev_xp );
    168     chdev_t   * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
    169     dev_cmd_t * cmd = (dev_cmd_t *)hal_remote_lpt( XPTR( dev_cxy , &dev_ptr->cmd ) );
     185    dev_aux_t * aux = (dev_aux_t *)hal_remote_lpt( XPTR( dev_cxy , &dev_ptr->aux ) );
     186
     187    // build arguments structure
     188    txt_aux_t  args;
     189    args.dev_xp = dev_xp;
     190    args.buffer = buffer;
     191    args.count  = count;
    170192
    171193    // call driver function
    172     cmd( XPTR( local_cxy , this ) );
     194    aux( &args );
    173195
    174     // return I/O operation status from calling thread descriptor
    175     return this->txt_cmd.error;
     196    return 0;
    176197}
    177198
  • trunk/kernel/devices/dev_txt.h

    r254 r407  
    3636 *
    3737 * This multi-channels generic TXT device provides access to a text terminal.
    38  * It supports three operation types :
     38 *
     39 * It supports two operations that must be implemented by the driver cmd() function:
    3940 * - TXT_READ : read a single character from the text terminal identified by its channel
    4041 *   index, using a descheduling strategy for the calling thread.
    4142 * - TXT_WRITE : write a character string to the text terminal identified by its channel
    4243 *   index, using a descheduling strategy for the calling thread.
    43  * - TXT_SYNC_WRITE : write a character string to the terminal identified by its channel
    44  *   index, using a busy waiting strategy for the calling thread.
     44 *
     45 * It supports one operation, that must be implemented by the driver aux() function 
     46 * - TXT_SYNC_WRITE write a character string to the TXT0 kernel terminal, using a busy
     47 *   waiting strategy for the calling thread.
    4548 *****************************************************************************************/
    4649
     
    5861
    5962/******************************************************************************************
    60  * This defines the (implementation independent) command passed to the driver.
     63 * This defines the arguments passed to the driver CMD function.
    6164 *****************************************************************************************/
    6265
     
    6568    TXT_READ       = 0,
    6669    TXT_WRITE      = 1,
    67     TXT_SYNC_WRITE = 2,
    6870};
    6971
     
    7779}
    7880txt_command_t;
     81
     82/******************************************************************************************
     83 * This defines the arguments passed to the driver AUX function.
     84 * This function implement the TXT_SYNC_WRITE operation.
     85 *****************************************************************************************/
     86
     87typedef struct txt_aux_s
     88{
     89    xptr_t      dev_xp;    /*! extended pointer on the TXT0 device descriptor            */
     90    char      * buffer;    /*! local pointer on characters array                         */
     91    uint32_t    count;     /*! number of characters in buffer                            */
     92}
     93txt_aux_t;
    7994
    8095/******************************************************************************************
     
    122137
    123138/***************************************************************************************
    124  * This low-level blocking function is used by the kernel to display one string on a
    125  * given TXT channel without descheduling the calling thread, without registering it
    126  * in the TXT device waiting queue, and without using the TXT irq.
     139 * This blocking function is used by the kernel to display a string on the TXT0
     140 * terminal, without descheduling the calling thread, without registering it
     141 * in the TXT0 device waiting queue, without using the TXT0 irq, and without
     142 * interfering with another possible TXT access to another terminal.
     143 * As it is used for debug, the command arguments <buffer> and <count> are registerd
     144 * in a specific "dbg_cmd" field of the calling thread.
     145 * other TXT accesses.
    127146 ****************************************************************************************
    128  * @ channel   : TXT channel index.
    129147 * @ buffer    : local pointer on source buffer containing the string.
    130148 * @ count     : number of characters.
    131149 * @ returns 0 if success / returns EINVAL if error.
    132150 ***************************************************************************************/
    133 error_t dev_txt_sync_write( uint32_t   channel,
    134                             char     * buffer,
     151error_t dev_txt_sync_write( char     * buffer,
    135152                            uint32_t   count );
    136153
Note: See TracChangeset for help on using the changeset viewer.