Ignore:
Timestamp:
Jul 4, 2012, 2:51:18 PM (12 years ago)
Author:
alain
Message:

Introducing various modifications in kernel initialisation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/apps/router/main.c

    r160 r165  
    11#include "stdio.h"
    2 #include "srl.h"
     2#include "mwmr_channel.h"
    33
    44#define NMAX 200
     
    1010    unsigned int        n;
    1111    unsigned int        buf;
    12     srl_mwmr_t      mwmr;
     12    mwmr_channel_t*     mwmr;
    1313
    14     srl_log_printf( TRACE, "*** Starting task producer on processor %d", procid() );
    15     srl_log_printf( TRACE, " at cycle %d ***\n\n", proctime() );
     14    giet_tty_printf( "*** Starting task producer on processor %d", giet_procid() );
     15    giet_tty_printf( " at cycle %d ***\n\n", giet_proctime() );
    1616
    17     if( vobj_get_vbase( "router" , "mwmr_in", MWMR, (unsigned int*)&mwmr ) )
     17    if( giet_vobj_get_vbase( "router" ,
     18                             "mwmr_in",
     19                             VOBJ_TYPE_MWMR,
     20                             (void*)&mwmr ) )
    1821    {
    19         srl_log_printf( NONE, "\n[ERROR] in producer task :\n");
    20         srl_log_printf( NONE, "          undefined <mwmr_in> channel: %d\n", mwmr);
    21         srl_log_printf( TRACE, "*** &mwmr_in = %x\n\n", (unsigned int)mwmr );
    22         exit();
    23     }
    24     else
    25     {
    26         srl_log_printf( TRACE, "*** &mwmr_in = %x\n\n", (unsigned int)mwmr );
     22        giet_tty_printf( "\n[ERROR] in producer task :\n");
     23        giet_tty_printf( "          undefined <mwmr_in> channel: %d\n", mwmr);
     24        giet_tty_printf( "*** &mwmr_in = %x\n\n", (unsigned int)mwmr );
     25        giet_exit();
    2726    }
    2827
     
    3130    {
    3231        buf = n;
    33         srl_mwmr_write( mwmr, &buf , 1 );
    34         srl_log_printf( TRACE, "transmitted value : %d\n", buf);
     32        mwmr_write( mwmr, &buf , 1 );
     33        giet_tty_printf( "transmitted value : %d\n", buf);
    3534    }
    3635
    37     srl_log_printf( TRACE, "\n*** Completing producer task at cycle %d ***\n", proctime());
    38     exit();
     36    giet_tty_printf( "\n*** Completing producer task at cycle %d ***\n", giet_proctime());
     37    giet_exit();
    3938
    4039} // end producer()
     
    4544    unsigned int        n;
    4645    unsigned int        buf[5];
    47     srl_mwmr_t  mwmr;
     46    mwmr_channel_t*     mwmr;
    4847
    49     srl_log_printf( TRACE, "*** Starting task consumer on processor %d", procid() );
    50     srl_log_printf( TRACE, " at cycle %d ***\n\n", proctime() );
     48    giet_tty_printf( "*** Starting task consumer on processor %d", giet_procid() );
     49    giet_tty_printf( " at cycle %d ***\n\n", giet_proctime() );
    5150
    52     if ( vobj_get_vbase( "router" , "mwmr_out", MWMR, (unsigned int*)&mwmr ) )
     51    if ( giet_vobj_get_vbase( "router" ,
     52                              "mwmr_out",
     53                              VOBJ_TYPE_MWMR,
     54                              (void*)&mwmr ) )
    5355    {
    54         srl_log_printf( NONE, "\n[ERROR] in consumer task :\n");
    55         srl_log_printf( NONE, "          undefined <mwmr_out> channel\n");
    56         exit();
    57     }
    58     else
    59     {
    60         srl_log_printf( TRACE, "*** &mwmr_out = %x\n\n", (unsigned int)mwmr );
     56        giet_tty_printf( "\n[ERROR] in consumer task :\n");
     57        giet_tty_printf( "          undefined <mwmr_out> channel\n");
     58        giet_exit();
    6159    }
    6260
     
    6462    for(n = 0 ; n < NMAX ; n = n+5 )
    6563    {
    66         srl_mwmr_read( mwmr, buf , 5 );
    67         srl_log_printf( TRACE, "received token %d / value = %d\n", n  , buf[0]);
    68         srl_log_printf( TRACE, "received token %d / value = %d\n", n+1, buf[1]);
    69         srl_log_printf( TRACE, "received token %d / value = %d\n", n+2, buf[2]);
    70         srl_log_printf( TRACE, "received token %d / value = %d\n", n+3, buf[3]);
    71         srl_log_printf( TRACE, "received token %d / value = %d\n", n+4, buf[4]);
     64        mwmr_read( mwmr, buf , 5 );
     65        giet_tty_printf( "received token %d / value = %d\n", n  , buf[0]);
     66        giet_tty_printf( "received token %d / value = %d\n", n+1, buf[1]);
     67        giet_tty_printf( "received token %d / value = %d\n", n+2, buf[2]);
     68        giet_tty_printf( "received token %d / value = %d\n", n+3, buf[3]);
     69        giet_tty_printf( "received token %d / value = %d\n", n+4, buf[4]);
    7270    }
    7371
    74     srl_log_printf( TRACE, "\n*** Completing consumer task at cycle %d ***\n", proctime());
    75     exit();
     72    giet_tty_printf( "\n*** Completing consumer task at cycle %d ***\n", giet_proctime());
     73    giet_exit();
    7674
    7775} // end consumer()
     
    8381    unsigned int        x;
    8482    unsigned int        tempo;
    85     srl_mwmr_t          mwmr_in ;
    86     srl_mwmr_t      mwmr_out ;
     83    mwmr_channel_t*     mwmr_in ;
     84    mwmr_channel_t* mwmr_out ;
    8785
    8886   
    89     srl_log_printf( TRACE, "*** Starting task router on processor %d at cycle %d ***\n\n",
    90                 procid(), proctime() );
     87    giet_tty_printf( "*** Starting task router on processor %d", giet_procid() );
     88    giet_tty_printf( " at cycle %d ***\n\n", giet_proctime() );
    9189
    92     if ( vobj_get_vbase( "router" , "mwmr_out", MWMR, (unsigned int*)&mwmr_out ) )
     90    if ( giet_vobj_get_vbase( "router" ,
     91                              "mwmr_out",
     92                              VOBJ_TYPE_MWMR,
     93                              (void*)&mwmr_out ) )
    9394    {
    94         srl_log( NONE, "\n[ERROR] in router task :\n");
    95         srl_log( NONE, "          undefined <mwmr_in> channel\n");
    96         exit();
    97     }
    98     else
    99     {
    100         srl_log_printf( TRACE, "*** &mwmr_out = %x\n\n", (unsigned int)mwmr_out );
     95        giet_tty_printf( "\n[ERROR] in router task :\n");
     96        giet_tty_printf( "          undefined <mwmr_in> channel\n");
     97        giet_exit();
    10198    }
    10299
    103     if (  vobj_get_vbase( "router" , "mwmr_in", MWMR, (unsigned int*)&mwmr_in ) )
     100    if (  giet_vobj_get_vbase( "router" ,
     101                               "mwmr_in",
     102                               VOBJ_TYPE_MWMR,
     103                               (void*)&mwmr_in ) )
    104104    {
    105         srl_log( NONE, "\n[ERROR] in router task :\n");
    106         srl_log( NONE, "          undefined <mwmr_out> channel\n");
    107         exit();
    108     }
    109     else
    110     {
    111         srl_log_printf( TRACE, "*** &mwmr_in = %x\n\n", (unsigned int)mwmr_out );
     105        giet_tty_printf( "\n[ERROR] in router task :\n");
     106        giet_tty_printf( "          undefined <mwmr_out> channel\n");
     107        giet_exit();
    112108    }
    113109
     
    115111    while(1)
    116112    {
    117         srl_mwmr_read( mwmr_in , buf , 2 );
    118         tempo = rand() >> 6;
     113        mwmr_read( mwmr_in , buf , 2 );
     114        tempo = giet_rand() >> 6;
    119115        for ( x = 0 ; x < tempo ; x++ ) asm volatile ("");
    120         srl_log_printf( TRACE, "token value : %d / temporisation = %d\n", buf[0], tempo);
    121         srl_log_printf( TRACE, "token value : %d / temporisation = %d\n", buf[1], tempo);
    122         srl_mwmr_write( mwmr_out, buf , 2 );
     116        giet_tty_printf( "token value : %d / temporisation = %d\n", buf[0], tempo);
     117        giet_tty_printf( "token value : %d / temporisation = %d\n", buf[1], tempo);
     118        mwmr_write( mwmr_out, buf , 2 );
    123119    }
    124120}
Note: See TracChangeset for help on using the changeset viewer.