Ignore:
Timestamp:
Jan 13, 2021, 12:36:17 AM (4 years ago)
Author:
alain
Message:

All modifications required to support the <tcp_chat> application
including error recovery in case of packet loss.A

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/kernel_init.c

    r669 r683  
    33 *
    44 * Authors :  Mohamed Lamine Karaoui (2015)
    5  *            Alain Greiner  (2016,2017,2018,2019,2020)
     5 *            Alain Greiner          (2016,2017,2018,2019,2020)
    66 *
    77 * Copyright (c) Sorbonne Universites
     
    4646#include <memcpy.h>
    4747#include <ppm.h>
     48#include <kcm.h>
    4849#include <page.h>
    4950#include <chdev.h>
     
    379380        if( func == DEV_FUNC_MMC ) 
    380381        {
    381 
    382             // check channels
    383             if( channels != 1 )
    384             {
    385                 printk("\n[PANIC] in %s : MMC device must be single channel\n",
    386                 __FUNCTION__ );
    387                 hal_core_sleep();
    388             }
    389 
    390382            // create chdev in local cluster
    391383            chdev_ptr = chdev_create( func,
     
    394386                                      false,      // direction
    395387                                      base );
    396 
    397             // check memory
    398388            if( chdev_ptr == NULL )
    399389            {
     
    403393            }
    404394           
     395#if (DEBUG_KERNEL_INIT & 0x1)
     396if( hal_time_stamp() > DEBUG_KERNEL_INIT )
     397printk("\n[%s] created chdev[%x,%x] for MMC\n",
     398__FUNCTION__ , local_cxy , chdev_ptr );
     399#endif
    405400            // make MMC specific initialisation
    406401            dev_mmc_init( chdev_ptr );
     
    423418#if( DEBUG_KERNEL_INIT & 0x1 )
    424419if( hal_time_stamp() > DEBUG_KERNEL_INIT )
    425 printk("\n[%s] : created MMC in cluster %x / chdev = %x\n",
     420printk("\n[%s] initialised chdev[%x,%x] for MMC\n",
    426421__FUNCTION__ , local_cxy , chdev_ptr );
    427422#endif
     
    439434                                          false,     // direction
    440435                                          base );
    441 
    442                 // check memory
    443436                if( chdev_ptr == NULL )
    444437                {
     
    448441                }
    449442           
     443#if (DEBUG_KERNEL_INIT & 0x1)
     444if( hal_time_stamp() > DEBUG_KERNEL_INIT )
     445printk("\n[%s] cxy %x : created chdev[%x,%x] for DMA[%d]\n",
     446__FUNCTION__ , local_cxy , chdev_ptr , channel );
     447#endif
    450448                // make DMA specific initialisation
    451449                dev_dma_init( chdev_ptr );     
     
    457455#if( DEBUG_KERNEL_INIT & 0x1 )
    458456if( hal_time_stamp() > DEBUG_KERNEL_INIT )
    459 printk("\n[%s] : created DMA[%d] in cluster %x / chdev = %x\n",
    460 __FUNCTION__ , channel , local_cxy , chdev_ptr );
     457printk("\n[%s] initialised chdev[%x,%x] for DMA[%d]\n",
     458__FUNCTION__ , local_cxy , chdev_ptr , channel );
    461459#endif
    462460            }
     
    471469// These chdev descriptors are distributed on all clusters, using a modulo on a global
    472470// index, identically computed in all clusters.
    473 // This function is executed in all clusters by the core[0] core, that computes a global index
    474 // for all external chdevs. Each core[0] core creates only the chdevs that must be placed in
    475 // the local cluster, because the global index matches the local index.
     471// This function is executed in all clusters by the core[0], that computes a global index
     472// for all external chdevs. Each core[0] core creates only the chdevs that must be placed
     473// in the local cluster, because the global index matches the local index.
    476474// The relevant entries in all copies of the devices directory are initialised.
    477475///////////////////////////////////////////////////////////////////////////////////////////
     
    499497    dev_tbl     = info->ext_dev;
    500498
    501     // initializes global index (PIC is already placed in cluster 0
     499    // initializes global index (PIC is already placed in cluster 0)
    502500    ext_chdev_gid = 1;
    503501
     
    529527
    530528        // check external device functionnal type
    531         if( (func != DEV_FUNC_IOB) && (func != DEV_FUNC_IOC) && (func != DEV_FUNC_TXT) &&
    532             (func != DEV_FUNC_NIC) && (func != DEV_FUNC_FBF) )
     529        if( (func != DEV_FUNC_IOB) &&
     530            (func != DEV_FUNC_IOC) &&
     531            (func != DEV_FUNC_TXT) &&
     532            (func != DEV_FUNC_NIC) &&
     533            (func != DEV_FUNC_FBF) )
    533534        {
    534535            printk("\n[PANIC] in %s : undefined peripheral type\n",
     
    537538        }
    538539
    539         // loops on channels
     540        // loop on channels
    540541        for( channel = 0 ; channel < channels ; channel++ )
    541542        {
     
    547548
    548549                // all kernel instances compute the target cluster for all chdevs,
    549                 // computing the global index ext_chdev_gid[func,channel,direction]
     550                // and the global index ext_chdev_gid[func,channel,direction]
    550551                cxy_t target_cxy;
    551552                while( 1 )
     
    568569                if( target_cxy == local_cxy )
    569570                {
    570 
    571 #if( DEBUG_KERNEL_INIT & 0x3 )
    572 if( hal_time_stamp() > DEBUG_KERNEL_INIT )
    573 printk("\n[%s] : found chdev %s / channel = %d / rx = %d / cluster %x\n",
    574 __FUNCTION__ , chdev_func_str( func ), channel , rx , local_cxy );
    575 #endif
    576571                    chdev = chdev_create( func,
    577572                                          impl,
     
    587582                    }
    588583
     584#if (DEBUG_KERNEL_INIT & 0x1)
     585if( hal_time_stamp() > DEBUG_KERNEL_INIT )
     586printk("\n[%s] created chdev[%x,%x] for %s[%d] / is_rx %d\n",
     587__FUNCTION__ , local_cxy , chdev , chdev_func_str(func) , channel , rx );
     588#endif
    589589                    // make device type specific initialisation
    590590                    if     ( func == DEV_FUNC_IOB ) dev_iob_init( chdev );
     
    621621                    }
    622622
    623 #if( DEBUG_KERNEL_INIT & 0x3 )
     623#if( DEBUG_KERNEL_INIT & 1 )
    624624if( hal_time_stamp() > DEBUG_KERNEL_INIT )
    625 printk("\n[%s] : created chdev %s / channel = %d / rx = %d / cluster %x / chdev = %x\n",
    626 __FUNCTION__ , chdev_func_str( func ), channel , rx , local_cxy , chdev );
    627 #endif
     625printk("\n[%s] initialised chdev[%x,%x] for %s\n",
     626__FUNCTION__ , local_cxy, chdev , chdev->name );
     627#endif
     628
    628629                }  // end if match
    629630
     
    637638
    638639///////////////////////////////////////////////////////////////////////////////////////////
    639 // This function is called by core[0] in cluster 0 to allocate memory and initialize the PIC
     640// This function is called by core[0][0] to allocate memory and initialize the PIC
    640641// device, namely the informations attached to the external IOPIC controller, that
    641642// must be replicated in all clusters (struct iopic_input).
     
    11021103    // and allocates memory for the corresponding chdev descriptors.
    11031104    if( core_lid == 0 ) internal_devices_init( info );
    1104        
    11051105
    11061106    // All core[0]s contribute to initialise external peripheral chdev descriptors.
     
    14941494                   " - core descriptor    : %d bytes\n"
    14951495                   " - scheduler          : %d bytes\n"
    1496                    " - socket             : %d bytes\n"
     1496                   " - socket descriptor  : %d bytes\n"
    14971497                   " - rpc fifo           : %d bytes\n"
    14981498                   " - page descriptor    : %d bytes\n"
     
    15011501                   " - ppm manager        : %d bytes\n"
    15021502                   " - kcm manager        : %d bytes\n"
    1503                    " - khm manager        : %d bytes\n"
    15041503                   " - vmm manager        : %d bytes\n"
    15051504                   " - vfs inode          : %d bytes\n"
     
    15291528                   sizeof( ppm_t              ),
    15301529                   sizeof( kcm_t              ),
    1531                    sizeof( khm_t              ),
    15321530                   sizeof( vmm_t              ),
    15331531                   sizeof( vfs_inode_t        ),
     
    15461544#endif
    15471545
     1546    // number of cycles per TICK (depends on the actual system clock frequency
     1547    uint32_t cycles_per_tick = cluster->sys_clk / CONFIG_SCHED_TICKS_PER_SECOND;
     1548
    15481549    // each core activates its private TICK IRQ
    1549     dev_pic_enable_timer( CONFIG_SCHED_TICK_MS_PERIOD );
     1550    dev_pic_enable_timer( cycles_per_tick );
    15501551
    15511552    /////////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.