Ignore:
Timestamp:
Apr 5, 2015, 12:09:09 AM (9 years ago)
Author:
alain
Message:

Move the peripheral initialisation from the boot.c to the kernel_init.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_kernel/kernel_init.c

    r536 r547  
    1818#include <fat32.h>
    1919#include <xcu_driver.h>
     20#include <nic_driver.h>
     21#include <hba_driver.h>
    2022#include <mmc_driver.h>
    2123#include <ctx_handler.h>
     
    144146    unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);
    145147    unsigned int p          = gpid & ((1<<P_WIDTH)-1);
    146 
    147     ////////////////////////////////////////////////////////////////////////////
    148     // Step 0 : P[0,0,0] initialises various global vaiables
    149     ////////////////////////////////////////////////////////////////////////////
     148    unsigned int unused;
     149   
     150    ////////////////////////////////////////////////////////////////////////////
     151    // Step 0 : P[0,0,0] initialises global variables and peripherals
     152   ////////////////////////////////////////////////////////////////////////////
    150153
    151154    if ( gpid == 0 )
    152155    {
    153         // distributed kernel heap initialisation
     156        ////// distributed kernel heap initialisation
    154157        _heap_init();
    155158       
    156159#if GIET_DEBUG_INIT
    157 _nolock_printf("\n[DEBUG KERNEL_INIT] P[%d,%d,%d] completes kernel HEAP init\n",
    158                x, y, p );
    159 #endif
    160         // distributed lock for TTY0
     160_nolock_printf("\n[DEBUG KINIT] P[%d,%d,%d] completes kernel heap init\n", x, y, p );
     161#endif
     162        //////  distributed lock for TTY0
    161163        _sqt_lock_init( &_tty0_sqt_lock );
    162164
    163165#if GIET_DEBUG_INIT
    164 _nolock_printf("\n[DEBUG KERNEL_INIT] P[%d,%d,%d] completes TTY0 lock init\n",
    165                x , y , p );
    166 #endif
    167         // distributed kernel barrier between all processors
     166_nolock_printf("\n[DEBUG KINIT] P[%d,%d,%d] completes TTY0 lock init\n", x , y , p );
     167#endif
     168        //////  distributed kernel barrier between all processors
    168169        _sqt_barrier_init( &_all_procs_barrier );
    169170
    170171#if GIET_DEBUG_INIT
    171 _nolock_printf("\n[DEBUG KERNEL_INIT] P[%d,%d,%d] completes barrier init\n",
    172                x , y , p );
    173 #endif
    174 
    175 #if USE_PIC
    176 
    177         // _ext_irq_index[isr][channel] initialisation
    178         _ext_irq_init();
    179 
    180         // routing HBA IRQ to proc[0,0,0] EXT_IRQ_ONE
    181         unsigned int unused = 0;
    182         if ( USE_IOC_HBA ) _ext_irq_alloc( ISR_HBA , 0 , &unused );
    183 
    184 #if GIET_DEBUG_INIT
    185 _nolock_printf("\n[DEBUG KERNEL_INIT] P[%d,%d,%d] completes ext_irq init\n",
    186                x , y , p );
    187 #endif
    188 
    189 #endif // USE_PIC
    190 
    191         // release other processors
     172_nolock_printf("\n[DEBUG KINIT] P[%d,%d,%d] completes barrier init\n", x , y , p );
     173#endif
     174
     175        ////// _ext_irq_index[isr][channel] initialisation
     176        if ( USE_PIC ) _ext_irq_init();
     177
     178#if GIET_DEBUG_INIT
     179_nolock_printf("\n[DEBUG KINIT] P[%d,%d,%d] completes ext_irq init\n", x , y , p );
     180#endif
     181
     182        //////  NIC peripheral initialization
     183        if ( USE_NIC ) _nic_global_init( 1,      // broadcast accepted
     184                                         1,      // bypass activated
     185                                         0,      // tdm non activated
     186                                         0 );    // tdm period
     187#if GIET_DEBUG_INIT
     188_nolock_printf("\n[DEBUG KINIT] P[%d,%d,%d] completes NIC init\n", x , y , p );
     189#endif
     190
     191        //////  HBA peripheral initialisation
     192        if ( USE_IOC_HBA )
     193        {
     194            _hba_init();
     195
     196            // routing HBA IRQ to proc[0,0,0]
     197            _ext_irq_alloc( ISR_HBA , 0 , &unused );
     198        }
     199
     200#if GIET_DEBUG_INIT
     201_nolock_printf("\n[DEBUG KINIT] P[%d,%d,%d] completes HBA init\n", x , y , p );
     202#endif
     203
     204        //////  release other processors
    192205        _kernel_init_done = 1;
    193206    }
     
    209222
    210223#if GIET_DEBUG_INIT
    211 _printf("\n[DEBUG KERNEL_INIT] P[%d,%d,%d] initialises SCHED array\n"
     224_printf("\n[DEBUG KINIT] P[%d,%d,%d] initialises SCHED array\n"
    212225        " - scheduler vbase = %x\n"
    213226        " - tasks           = %d\n",
     
    255268
    256269#if GIET_DEBUG_INIT
    257 _printf("\n[DEBUG KERNEL_INIT] P[%d,%d,%d] initialises PTABS arrays"
     270_printf("\n[DEBUG KINIT] P[%d,%d,%d] initialises PTABS arrays"
    258271        " and context for task %d \n"
    259272        " - ptabs_vaddr[%d][%d][%d] = %x\n"
     
    297310
    298311#if GIET_DEBUG_INIT
    299 _printf("\n[DEBUG KERNEL_INIT] P[%d,%d,%d] initializes idle_task and starts TICK\n", 
     312_printf("\n[DEBUG KINIT] P[%d,%d,%d] initializes idle_task and starts TICK\n", 
    300313        x, y, p );
    301314#endif
     
    306319
    307320#if GIET_DEBUG_INIT
    308 _printf("\n[DEBUG KERNEL_INIT] P[%d,%d,%d] completes kernel FAT init\n",
     321_printf("\n[DEBUG KINIT] P[%d,%d,%d] completes kernel FAT init\n",
    309322        x, y, p );
    310323#endif
     
    334347
    335348#if GIET_DEBUG_INIT
    336 _printf("\n[DEBUG KERNEL_INIT] P[%d,%d,%d] jumps to user code at cycle %d\n"
     349_printf("\n[DEBUG KINIT] P[%d,%d,%d] jumps to user code at cycle %d\n"
    337350        " ltid = %d / sp = %x / sr = %x / ptpr = %x / epc = %x\n",
    338351        x , y , p , _get_proctime() ,
Note: See TracChangeset for help on using the changeset viewer.