Changeset 165 for soft/giet_vm/libs


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

Introducing various modifications in kernel initialisation

Location:
soft/giet_vm/libs
Files:
2 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/libs/barrier.c

    r160 r165  
    1111// The barrier itself must have been allocated in a shared data segment.
    1212///////////////////////////////////////////////////////////////////////////////////
     13
     14#include "barrier.h"
    1315
    1416///////////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/libs/barrier.h

    r158 r165  
    1515typedef struct giet_barrier_s {
    1616    char                name[32];       // barrier name
    17     unsigned int        init;           // total number of participants
    18     unsigned int        count;          // number of not yet arrived tasks
    19 } giet_barrier_t
     17    unsigned int        init;   // total number of participants
     18    unsigned int        count;  // number of not yet arrived tasks
     19} giet_barrier_t;
    2020
    2121//////////////////////////////////////////////////////////////////////////////
    22 //  MWMR access functions
     22//  access functions
    2323//////////////////////////////////////////////////////////////////////////////
    2424
  • soft/giet_vm/libs/mwmr_channel.c

    r159 r165  
    1212// The mwmr_read() and mwmr_write() functions do not require a system call.
    1313// The channel itself must have been allocated in a non cacheable segment,
    14 // if the platform does not provide hardwate cache coherence.
     14// if the platform does not provide hardware cache coherence.
    1515//
    1616// ALL MWMR channels must be defined in the mapping_info data structure,
     
    3737//  mwmr_lock_aquire()
    3838// This blocking function returns only when the lock has been taken.
    39 // If the lock is already taken a random delay is introduced before retry.
    40 //////////////////////////////////////////////////////////////////////////////
    41 void mwmr_lock_acquire(unsigned int* plock)
     39// If the lock is already taken a fixed delay is introduced before retry.
     40//////////////////////////////////////////////////////////////////////////////
     41void mwmr_lock_acquire(unsigned int* lock_address)
    4242{
     43    register unsigned int*      plock = lock_address;
     44    register unsigned int       delay = 100;
    4345    asm volatile (
    4446            "mwmr_lock_try:                                     \n"
    4547            "ll   $2,    0(%0)                          \n" /* $2 <= lock current value */
    46             "bnez $2,    mwmr_lock_delay        \n" /* retry if lock already taken */
     48            "bnez $2,    mwmr_lock_delay        \n" /* retry after delay if lock busy */
    4749            "li   $3,    1                                      \n" /* $3 <= argument for sc */
    4850            "sc   $3,    0(%0)                          \n" /* try to get lock */
    4951            "bnez $3,    mwmr_lock_ok           \n" /* exit if atomic */
    50 
    5152            "mwmr_lock_delay:                           \n"
    52             "jal  rand                                  \n" /* rand() system call */
    53             "nop                                                        \n"
    54             "andi $4,   $2,     0xFF                    \n"     /* $4 <= random delay < 256 cycles */
    55 
    56             "mwmr_lock_loop:                            \n"
     53            "move $4,    %1                 \n" /* $4 <= delay */
     54            "mwmr_lock_loop:                \n"
     55            "beqz $4,    mwmr_lock_loop         \n" /* test end delay */
    5756            "addi $4,    $4,  -1                        \n" /* $4 <= $4 - 1 */
    58             "beqz $4,    mwmr_lock_loop         \n" /* test end delay */
    59             "nop                                                        \n"
    60             "j           mwmr_lock_try          \n" /* retry */
     57            "j           mwmr_lock_try          \n" /* retry ll */
    6158            "nop                                                        \n"
    6259            "mwmr_lock_ok:                                      \n"
    6360            :
    64             :"r"(plock)
     61            :"r"(plock), "r"(delay)
    6562            :"$2", "$3", "$4");
    6663}
     
    117114        {
    118115            mwmr->lock = 0;
    119             for ( x = rand()>>8 ; x > 0 ; x-- ) asm volatile ( "nop" );
     116            for ( x = giet_rand()>>8 ; x > 0 ; x-- ) asm volatile ( "nop" );
    120117        }
    121118        else    // write as many items as possible, release lock and retry after delay
     
    135132        }
    136133        // random delay before retry
    137         for ( x = rand()>>6 ; x > 0 ; x-- ) asm volatile ( "nop" );
     134        for ( x = giet_rand()>>6 ; x > 0 ; x-- ) asm volatile ( "nop" );
    138135    }
    139136}
     
    188185        {
    189186            mwmr->lock = 0;
    190             for ( x = rand()>>8 ; x > 0 ; x-- ) asm volatile ( "nop" );
     187            for ( x = giet_rand()>>8 ; x > 0 ; x-- ) asm volatile ( "nop" );
    191188        }
    192189        else    // read as many items as possible, release lock and retry after delay
     
    206203        }
    207204        // random delay before retry
    208         for ( x = rand()>>6 ; x > 0 ; x-- ) asm volatile ( "nop" );
     205        for ( x = giet_rand()>>6 ; x > 0 ; x-- ) asm volatile ( "nop" );
    209206    }
    210207}
  • soft/giet_vm/libs/spin_lock.c

    r159 r165  
    2828// If the lock is already taken a random delay is introduced before retry.
    2929///////////////////////////////////////////////////////////////////////////////////
    30 void lock_acquire( giet_lock_t* lock)
     30void lock_acquire( giet_lock_t* lock )
    3131{
    32     unsigned in*t       plock = &lock->value;
     32    unsigned int*       plock = &lock->value;
    3333 
    3434    asm volatile (
     
    4141
    4242            "giet_lock_delay:                           \n"
    43             "jal  rand                                  \n" /* rand() system call */
     43            "jal  giet_rand                                 \n" /* giet_rand() system call */
    4444            "nop                                                        \n"
    45             "andi $4,   $2,     0xFF                    \n"     /* $4 <= random delay < 256 cycles */
     45            "andi $4,   $2,     0xFF                    \n"     /* $4 <= delay < 256 cycles */
    4646
    4747            "giet_lock_loop:                            \n"
  • soft/giet_vm/libs/spin_lock.h

    r159 r165  
    2323//////////////////////////////////////////////////////////////////////////////
    2424
    25 unsigned int lock_acquire( giet_lock_t* lock );
     25void lock_acquire( giet_lock_t* lock );
    2626
    2727void lock_release( giet_lock_t* lock );
  • soft/giet_vm/libs/stdio.c

    r160 r165  
    1717#define SYSCALL_TTY_WRITE       0x02
    1818#define SYSCALL_TTY_READ        0x03
    19 #define SYSCALL_TIMER_WRITE     0x04
    20 #define SYSCALL_TIMER_READ      0x05
    2119#define SYSCALL_GCD_WRITE       0x06
    2220#define SYSCALL_GCD_READ        0x07
     
    3735
    3836//////////////////////////////////////////////////////////////////////////////////
    39 //      sys_call()
     37// sys_call()
    4038// This generic C function is used to implement all system calls.
     39// It writes the system call arguments in the proper registers,
     40// and tells GCC what has been modified by system call execution.
    4141//////////////////////////////////////////////////////////////////////////////////
    4242static inline unsigned int sys_call( unsigned int call_no,
     
    8383
    8484////////////////////////////////////////////////////////////////////////////////////
    85 //      procid()
     85// giet_procid()
     86////////////////////////////////////////////////////////////////////////////////////
    8687// This function returns the processor identifier.
    8788////////////////////////////////////////////////////////////////////////////////////
    88 unsigned int procid()
     89unsigned int giet_procid()
    8990{
    9091    return sys_call(SYSCALL_PROCID,
     
    9293}
    9394////////////////////////////////////////////////////////////////////////////////////
    94 //      proctime()
     95// giet_proctime()
     96////////////////////////////////////////////////////////////////////////////////////
    9597// This function returns the local processor time (clock cycles since boot)
    9698////////////////////////////////////////////////////////////////////////////////////
    97 unsigned int proctime()
     99unsigned int giet_proctime()
    98100{
    99101    return sys_call(SYSCALL_PROCTIME,
     
    104106
    105107////////////////////////////////////////////////////////////////////////////////////
    106 //      tty_putc()
     108// giet_tty_putc()
     109////////////////////////////////////////////////////////////////////////////////////
    107110// This function displays a single ascii character on a terminal.
    108111// The terminal index must be defined in the task context in the boot phase.
     
    110113// - Returns 1 if the character has been written, 0 otherwise.
    111114////////////////////////////////////////////////////////////////////////////////////
    112 unsigned int tty_putc(char byte)
     115unsigned int giet_tty_putc(char byte)
    113116{
    114117    return sys_call(SYSCALL_TTY_WRITE,
     
    118121}
    119122////////////////////////////////////////////////////////////////////////////////////
    120 //       tty_puts()
     123// giet_tty_puts()
     124////////////////////////////////////////////////////////////////////////////////////
    121125// This function displays a string on a terminal.
    122126// The terminal index must be defined in the task context in the boot phase.
     
    125129// - Returns the number of written characters.
    126130////////////////////////////////////////////////////////////////////////////////////
    127 unsigned int tty_puts(char *buf)
     131unsigned int giet_tty_puts(char *buf)
    128132{
    129133    unsigned int length = 0;
     
    138142}
    139143////////////////////////////////////////////////////////////////////////////////////
    140 //      tty_putw()
     144// giet_tty_putw()
     145////////////////////////////////////////////////////////////////////////////////////
    141146// This function displays the value of a 32-bit word with decimal characters.
    142147// The terminal index must be defined in the task context in the boot phase.
     
    144149// Returns the number of written characters (should be equal to ten).
    145150////////////////////////////////////////////////////////////////////////////////////
    146 unsigned int tty_putw(unsigned int val)
     151unsigned int giet_tty_putw(unsigned int val)
    147152{
    148153    char buf[10];
     
    160165
    161166////////////////////////////////////////////////////////////////////////////////////
    162 // tty_getc()
     167// giet_tty_getc_no_irq()
     168////////////////////////////////////////////////////////////////////////////////////
    163169// This blocking function fetches a single ascii character from a terminal.
    164170// The terminal index must be defined in the task context in the boot phase.
     
    166172// - Returns necessarily 0 when completed.
    167173////////////////////////////////////////////////////////////////////////////////////
    168 unsigned int tty_getc(char *byte)
     174unsigned int giet_tty_getc_no_irq(char *byte)
    169175{
    170176    unsigned int ret = 0;
     
    179185}
    180186////////////////////////////////////////////////////////////////////////////////////
    181 //       tty_getc_irq()
     187// giet_tty_getc()
     188////////////////////////////////////////////////////////////////////////////////////
    182189// This blocking function fetches a single ascii character from a terminal.
    183190// The terminal index must be defined in the task context in the boot phase.
     
    185192// - Returns 0 when completed.
    186193////////////////////////////////////////////////////////////////////////////////////
    187 unsigned int tty_getc_irq(char *byte)
     194unsigned int giet_tty_getc(char *byte)
    188195{
    189196    unsigned int ret = 0;
     
    198205}
    199206////////////////////////////////////////////////////////////////////////////////////
    200 //      tty_gets_irq()
     207// giet_tty_gets()
     208////////////////////////////////////////////////////////////////////////////////////
    201209// This blocking function fetches a string from a terminal to a fixed length buffer.
    202210// The terminal index must be defined in the task context in the boot phase.
     
    211219//   removed from the target buffer.
    212220////////////////////////////////////////////////////////////////////////////////////
    213 unsigned int tty_gets_irq(char *buf, unsigned int bufsize)
     221unsigned int giet_tty_gets( char*                       buf,
     222                            unsigned int        bufsize )
    214223{
    215224    unsigned int ret;
     
    240249}
    241250////////////////////////////////////////////////////////////////////////////////////
    242 //      tty_getw_irq()
     251// giet_tty_getw()
     252////////////////////////////////////////////////////////////////////////////////////
    243253// This blocking function fetches a string of decimal characters (most
    244254// significant digit first) to build a 32-bit unsigned integer.
     
    256266//   bits range, the zero value is returned.
    257267////////////////////////////////////////////////////////////////////////////////////
    258 unsigned int tty_getw_irq(unsigned int *val)
     268unsigned int giet_tty_getw(unsigned int *val)
    259269{
    260270    unsigned char buf[32];
     
    281291            buf[max] = byte;
    282292            max++;
    283             tty_putc(byte);
     293            giet_tty_putc(byte);
    284294        }
    285295        else if ((byte == 0x0A) || (byte == 0x0D)) /* LF or CR character */
     
    292302            {
    293303                max--; /* cancel the character */
    294                 tty_putc(0x08);
    295                 tty_putc(0x20);
    296                 tty_putc(0x08);
     304                giet_tty_putc(0x08);
     305                giet_tty_putc(0x20);
     306                giet_tty_putc(0x08);
    297307            }
    298308        }
     
    301311            for (i = 0; i < max; i++) /* cancel the string */
    302312            {
    303                 tty_putc(0x08);
    304                 tty_putc(0x20);
    305                 tty_putc(0x08);
     313                giet_tty_putc(0x08);
     314                giet_tty_putc(0x20);
     315                giet_tty_putc(0x08);
    306316            }
    307             tty_putc(0x30);
     317            giet_tty_putc(0x30);
    308318            *val = 0; /* return 0 value */
    309319            return 0;
     
    329339        for (i = 0; i < max; i++) /* cancel the string */
    330340        {
    331             tty_putc(0x08);
    332             tty_putc(0x20);
    333             tty_putc(0x08);
    334         }
    335         tty_putc(0x30);
     341            giet_tty_putc(0x08);
     342            giet_tty_putc(0x20);
     343            giet_tty_putc(0x08);
     344        }
     345        giet_tty_putc(0x30);
    336346        *val = 0; /* return 0 value */
    337347    }
     
    339349}
    340350////////////////////////////////////////////////////////////////////////////////////
    341 // tty_printf()
     351// giet_tty_printf()
     352////////////////////////////////////////////////////////////////////////////////////
    342353// This function is a simplified version of the mutek_printf() function.
    343354// The terminal index must be defined in the calling task context.
     
    351362// - Returns 0 if success, > 0 if error.
    352363////////////////////////////////////////////////////////////////////////////////////
    353 unsigned int tty_printf(char *format, ...)
     364unsigned int giet_tty_printf(char *format, ...)
    354365{
    355366    va_list ap;
     
    450461}
    451462
    452 /////  Timer device related system calls /////
    453 
    454 #define TIMER_VALUE     0
    455 #define TIMER_MODE      1
    456 #define TIMER_PERIOD    2
    457 #define TIMER_RESETIRQ  3
    458 
    459 /*
    460  * timer_set_mode()
    461  *
    462  * This function defines the operation mode of a timer. The possible values for
    463  * this mode are:
    464  * - 0x0 : Timer not activated
    465  * - 0x1 : Timer activated, but no interrupt is generated
    466  * - 0x3 : Timer activarted and periodic interrupts generated
    467  *
    468  * - Returns 0 if success, > 0 if error.
    469  */
    470 unsigned int timer_set_mode(unsigned int val)
    471 {
    472     return sys_call(SYSCALL_TIMER_WRITE,
    473             TIMER_MODE,
    474             val,
    475             0, 0);
    476 }
    477 
    478 /*
    479  * timer_set_period()
    480  *
    481  * This function defines the period value of a timer to enable a periodic
    482  * interrupt.
    483  * - Returns 0 if success, > 0 if error.
    484  */
    485 unsigned int timer_set_period(unsigned int val)
    486 {
    487     return sys_call(SYSCALL_TIMER_WRITE,
    488             TIMER_PERIOD,
    489             val,
    490             0, 0);
    491 }
    492 
    493 /*
    494  * timer_reset_irq()
    495  *
    496  * This function resets the interrupt signal issued by a timer.
    497  * - Returns 0 if success, > 0 if error.
    498  */
    499 unsigned int timer_reset_irq()
    500 {
    501     return sys_call(SYSCALL_TIMER_WRITE,
    502             TIMER_RESETIRQ,
    503             0, 0, 0);
    504 }
    505 
    506 /*
    507  * timer_get_time()
    508  *
    509  * This function returns the current timing value of a timer.
    510  * - Returns 0 if success, > 0 if error.
    511  */
    512 unsigned int timer_get_time(unsigned int *time)
    513 {
    514     return sys_call(SYSCALL_TIMER_READ,
    515             TIMER_VALUE,
    516             (unsigned int)time,
    517             0, 0);
    518 }
    519 
    520 /////  GCD (Greatest Common Divider) device related system calls
     463/////  GCD (Greatest Common Divider) related system calls
    521464
    522465#define GCD_OPA     0
     
    526469
    527470//////////////////////////////////////////////////////////////////////////////////
    528 //      gcd_set_opa()
     471// giet_gcd_set_opa()
     472//////////////////////////////////////////////////////////////////////////////////
    529473// This function sets the operand A in the GCD coprocessor.
    530474// - Returns 0 if success, > 0 if error.
    531475//////////////////////////////////////////////////////////////////////////////////
    532 unsigned int gcd_set_opa(unsigned int val)
     476unsigned int giet_gcd_set_opa(unsigned int val)
    533477{
    534478    return sys_call(SYSCALL_GCD_WRITE,
     
    538482}
    539483//////////////////////////////////////////////////////////////////////////////////
    540 //      gcd_set_opb()
     484//      giet_gcd_set_opb()
     485//////////////////////////////////////////////////////////////////////////////////
    541486// This function sets operand B in the GCD coprocessor.
    542487// - Returns 0 if success, > 0 if error.
    543488//////////////////////////////////////////////////////////////////////////////////
    544 unsigned int gcd_set_opb(unsigned int val)
     489unsigned int giet_gcd_set_opb(unsigned int val)
    545490{
    546491    return sys_call(SYSCALL_GCD_WRITE,
     
    550495}
    551496//////////////////////////////////////////////////////////////////////////////////
    552 //      gcd_start()
     497//      giet_gcd_start()
     498//////////////////////////////////////////////////////////////////////////////////
    553499// This function starts the computation in the GCD coprocessor.
    554500// - Returns 0 if success, > 0 if error.
    555501//////////////////////////////////////////////////////////////////////////////////
    556 unsigned int gcd_start()
     502unsigned int giet_gcd_start()
    557503{
    558504    return sys_call(SYSCALL_GCD_WRITE,
     
    561507}
    562508//////////////////////////////////////////////////////////////////////////////////
    563 //      gcd_get_status()
     509//      giet_gcd_get_status()
     510//////////////////////////////////////////////////////////////////////////////////
    564511// This function gets the status fromn the GCD coprocessor.
    565512// - The value is 0 when the coprocessor is idle (computation completed).
    566513//////////////////////////////////////////////////////////////////////////////////
    567 unsigned int gcd_get_status(unsigned int *val)
     514unsigned int giet_gcd_get_status(unsigned int *val)
    568515{
    569516    return sys_call(SYSCALL_GCD_READ,
     
    573520}
    574521//////////////////////////////////////////////////////////////////////////////////
    575 //      gcd_get_result()
     522//      giet_gcd_get_result()
     523//////////////////////////////////////////////////////////////////////////////////
    576524// This function gets the result of the computation from the GCD coprocessor.
    577525//////////////////////////////////////////////////////////////////////////////////
    578 unsigned int gcd_get_result(unsigned int *val)
     526unsigned int giet_gcd_get_result(unsigned int *val)
    579527{
    580528    return sys_call(SYSCALL_GCD_READ,
     
    587535
    588536//////////////////////////////////////////////////////////////////////////////////
    589 //      ioc_write()
     537//      giet_ioc_write()
     538//////////////////////////////////////////////////////////////////////////////////
    590539// Transfer data from a memory buffer to a file on the block_device.
    591540//     lba    : Logical Block Address (first block index)
     
    594543// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    595544//////////////////////////////////////////////////////////////////////////////////
    596 unsigned int ioc_write(unsigned int lba, void *buffer, unsigned int count)
     545unsigned int giet_ioc_write( unsigned int       lba,
     546                             void*                      buffer,
     547                             unsigned int       count)
    597548{
    598549    return sys_call(SYSCALL_IOC_WRITE,
     
    603554}
    604555//////////////////////////////////////////////////////////////////////////////////
    605 //      ioc_read()
     556// giet_ioc_read()
     557//////////////////////////////////////////////////////////////////////////////////
    606558// Transfer data from a file on the block_device to a memory buffer.
    607559//     lba    : Logical Block Address (first block index)
     
    610562// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    611563//////////////////////////////////////////////////////////////////////////////////
    612 unsigned int ioc_read(unsigned int lba, void *buffer, unsigned int count)
     564unsigned int giet_ioc_read( unsigned int                lba,
     565                            void*                               buffer,
     566                            unsigned int                count )
    613567{
    614568    return sys_call(SYSCALL_IOC_READ,
     
    619573}
    620574//////////////////////////////////////////////////////////////////////////////////
    621 //      ioc_completed()
     575// giet_ioc_completed()
     576//////////////////////////////////////////////////////////////////////////////////
    622577// This blocking function returns 0 when the I/O transfer is
    623578// successfully completed, and returns 1 if an address error has been detected.
    624579//////////////////////////////////////////////////////////////////////////////////
    625 unsigned int ioc_completed()
     580unsigned int giet_ioc_completed()
    626581{
    627582    return sys_call(SYSCALL_IOC_COMPLETED,
     
    632587
    633588//////////////////////////////////////////////////////////////////////////////////
    634 //      fb_sync_write()
     589// giet_fb_sync_write()
     590//////////////////////////////////////////////////////////////////////////////////
    635591// This blocking function use a memory copy strategy to transfer data from a
    636592// user buffer to the frame buffer device in kernel space.
     
    640596// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    641597//////////////////////////////////////////////////////////////////////////////////
    642 unsigned int fb_sync_write(unsigned int offset, void *buffer, unsigned int length)
     598unsigned int giet_fb_sync_write( unsigned int   offset,
     599                                 void*                  buffer,
     600                                 unsigned int   length )
    643601{
    644602    return sys_call(SYSCALL_FB_SYNC_WRITE,
     
    649607}
    650608//////////////////////////////////////////////////////////////////////////////////
    651 //      fb_sync_read()
     609// giet_fb_sync_read()
     610//////////////////////////////////////////////////////////////////////////////////
    652611// This blocking function use a memory copy strategy to transfer data from the
    653612// frame buffer device in kernel space to an user buffer.
     
    657616// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    658617//////////////////////////////////////////////////////////////////////////////////
    659 unsigned int fb_sync_read(unsigned int offset, void *buffer, unsigned int length)
     618unsigned int giet_fb_sync_read( unsigned int    offset,
     619                                void*                   buffer,
     620                                unsigned int    length )
    660621{
    661622    return sys_call(SYSCALL_FB_SYNC_READ,
     
    666627}
    667628//////////////////////////////////////////////////////////////////////////////////
    668 //      fb_write()
     629// giet_fb_write()
     630//////////////////////////////////////////////////////////////////////////////////
    669631// This non-blocking function use the DMA coprocessor to transfer data from a
    670632// user buffer to the frame buffer device in kernel space.
     
    676638// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    677639//////////////////////////////////////////////////////////////////////////////////
    678 unsigned int fb_write(unsigned int offset, void *buffer, unsigned int length)
     640unsigned int giet_fb_write( unsigned int        offset,
     641                            void*                       buffer,
     642                            unsigned int        length )
    679643{
    680644    return sys_call(SYSCALL_FB_WRITE,
     
    685649}
    686650//////////////////////////////////////////////////////////////////////////////////
    687 //       fb_read()
     651// giet_fb_read()
     652//////////////////////////////////////////////////////////////////////////////////
    688653// This non-blocking function use the DMA coprocessor to transfer data from the
    689654// frame buffer device in kernel space to an user buffer.
     
    695660// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    696661//////////////////////////////////////////////////////////////////////////////////
    697 unsigned int fb_read( unsigned int offset,
    698                       void *buffer,
    699                       unsigned int length )
     662unsigned int giet_fb_read( unsigned int         offset,
     663                           void*                        buffer,
     664                           unsigned int         length )
    700665{
    701666    return sys_call(SYSCALL_FB_READ,
     
    706671}
    707672//////////////////////////////////////////////////////////////////////////////////
    708 //      fb_completed()
     673// giet_fb_completed()
     674//////////////////////////////////////////////////////////////////////////////////
    709675// This blocking function returns when the transfer is completed.
    710676// - Returns 0 if success, > 0 if error.
    711677//////////////////////////////////////////////////////////////////////////////////
    712 unsigned int fb_completed()
     678unsigned int giet_fb_completed()
    713679{
    714680    return sys_call(SYSCALL_FB_COMPLETED,
     
    716682}
    717683
    718 ///// Platform or mapping related system calls /////
    719 
    720 //////////////////////////////////////////////////////////////////////////////////
    721 //      mwmr_base()
    722 //      TODO!
    723 // This function returns in argument buffer the virtual base address
    724 // of a MWMR communication channel, identified by the two arguments
    725 // vspace_name and channel_name.
    726 // As the GIET does not support dynamic allocation, the MWMR channel
    727 // must be declared in the mapping_info data structure to be initialised
    728 // in the boot phase.
    729 // - Returns the address if success,  0 if error ( channel not defined )
    730 //////////////////////////////////////////////////////////////////////////////////
    731 unsigned int vobj_get_vbase( char* vspace_name, char* vobj_name,
    732                         unsigned int vobj_type, unsigned int* vobj_buffer)
     684///// Miscellaneous related system calls /////
     685
     686//////////////////////////////////////////////////////////////////////////////////
     687// giet_vobj_get_vbase()
     688//////////////////////////////////////////////////////////////////////////////////
     689// This function writes in argument (vobj_vaddr) the virtual base address
     690// of a vobj (defined in the mapping_info data structure), identified by
     691// the two arguments (vspace_name and vobj_name).
     692// The (vobj_type) argument is redundant, and used for coherence checking.
     693// - Returns the address if success,  0 if error ( not defined or wrong type )
     694//////////////////////////////////////////////////////////////////////////////////
     695unsigned int giet_vobj_get_vbase( char*                 vspace_name,
     696                                  char*                 vobj_name,
     697                                  unsigned int  vobj_type,
     698                                  unsigned int* vobj_vaddr )
    733699{
    734700    return sys_call(SYSCALL_VOBJ_GET_VBASE,
     
    736702                    (unsigned int)vobj_name,
    737703                    (unsigned int)vobj_type,
    738                     (unsigned int)vobj_buffer);
    739 }
    740 ////////////////////////////////////////////////////////////////////////////////////
    741 //      proc_number()
     704                    (unsigned int)vobj_vaddr);
     705}
     706
     707////////////////////////////////////////////////////////////////////////////////////
     708// giet_proc_number()
     709////////////////////////////////////////////////////////////////////////////////////
    742710// This function returns in the buffer argument the number of processors
    743711// in the cluster specified by the cluster_id argument.
    744712// - Returns 0 if success, > 0 if error ( cluster index too large )
    745713////////////////////////////////////////////////////////////////////////////////////
    746 unsigned int proc_number( unsigned int cluster_id,
    747                           unsigned int* buffer )
     714unsigned int giet_proc_number( unsigned int             cluster_id,
     715                               unsigned int*    buffer )
    748716{
    749717    return sys_call(SYSCALL_PROC_NUMBER,
     
    756724
    757725//////////////////////////////////////////////////////////////////////////////////
    758 // exit()
     726// giet_task_exit()
     727//////////////////////////////////////////////////////////////////////////////////
    759728// This function stops execution of the calling task with a TTY message,
    760729// and enter an infinite loop.
    761730// The task is blocked, but it still consume processor cycles ...
    762731//////////////////////////////////////////////////////////////////////////////////
    763 void exit()
    764 {
    765     unsigned int proc_index = procid();
     732void giet_exit()
     733{
    766734    sys_call(SYSCALL_EXIT,
    767              proc_index,
    768              0, 0, 0);
     735             0, 0, 0, 0);
    769736}
    770737///////////////////////////////////////////////////////////////////////////////////
    771 //      rand()
     738// giet_rand()
    772739// This function returns a pseudo-random value derived from the processor cycle
    773740// count. This value is comprised between 0 & 65535.
    774741///////////////////////////////////////////////////////////////////////////////////
    775 unsigned int rand()
     742unsigned int giet_rand()
    776743{
    777744    unsigned int x = sys_call(SYSCALL_PROCTIME,
     
    783750}
    784751//////////////////////////////////////////////////////////////////////////////////
    785 //      ctx_switch()
     752// giet_ctx_switch()
    786753// The user task calling this function is descheduled and
    787754// the processor is allocated to another task.
    788755//////////////////////////////////////////////////////////////////////////////////
    789 unsigned int ctx_switch()
     756unsigned int giet_ctx_switch()
    790757{
    791758    return sys_call(SYSCALL_CTX_SWITCH,
  • soft/giet_vm/libs/stdio.h

    r160 r165  
    1212
    1313/* MIPS32 related functions */
    14 unsigned int procid();
    15 unsigned int proctime();
    16 unsigned int procnumber();
     14unsigned int giet_procid();
     15unsigned int giet_proctime();
    1716
    1817/* TTY device related functions */
    19 unsigned int tty_putc(char byte);
    20 unsigned int tty_puts(char *buf);
    21 unsigned int tty_putw(unsigned int val);
    22 unsigned int tty_getc(char *byte);
    23 unsigned int tty_getc_irq(char *byte);
    24 unsigned int tty_gets_irq(char *buf, unsigned int bufsize);
    25 unsigned int tty_getw_irq(unsigned int *val);
    26 unsigned int tty_printf(char *format,...);
    27 
    28 /* Timer device related functions */
    29 unsigned int timer_set_mode(unsigned int mode);
    30 unsigned int timer_set_period(unsigned int period);
    31 unsigned int timer_reset_irq();
    32 unsigned int timer_get_time(unsigned int *time);
     18unsigned int giet_tty_putc(char byte);
     19unsigned int giet_tty_puts(char *buf);
     20unsigned int giet_tty_putw(unsigned int val);
     21unsigned int giet_tty_getc_no_irq(char *byte);
     22unsigned int giet_tty_getc(char *byte);
     23unsigned int giet_tty_gets(char *buf, unsigned int bufsize);
     24unsigned int giet_tty_getw(unsigned int *val);
     25unsigned int giet_tty_printf(char *format,...);
    3326
    3427/* GCD coprocessor related functions */
    35 unsigned int gcd_set_opa(unsigned int val);
    36 unsigned int gcd_set_opb(unsigned int val);
    37 unsigned int gcd_start();
    38 unsigned int gcd_get_result(unsigned int *val);
    39 unsigned int gcd_get_status(unsigned int *val);
     28unsigned int giet_gcd_set_opa(unsigned int val);
     29unsigned int giet_gcd_set_opb(unsigned int val);
     30unsigned int giet_gcd_start();
     31unsigned int giet_gcd_get_result(unsigned int *val);
     32unsigned int giet_gcd_get_status(unsigned int *val);
    4033
    4134/* Block device related functions */
    42 unsigned int ioc_read(unsigned int lba, void *buffer, unsigned int count);
    43 unsigned int ioc_write(unsigned int lba, void *buffer, unsigned int count);
    44 unsigned int ioc_completed();
     35unsigned int giet_ioc_read( unsigned int        lba,
     36                            void*                       buffer,
     37                            unsigned int        count);
     38unsigned int giet_ioc_write(unsigned int        lba,
     39                            void*                       buffer,
     40                            unsigned int        count);
     41unsigned int giet_ioc_completed();
    4542
    4643/* Frame buffer device related functions */
    47 unsigned int fb_sync_read(unsigned int offset, void *buffer, unsigned int length);
    48 unsigned int fb_sync_write(unsigned int offset, void *buffer, unsigned int length);
    49 unsigned int fb_read(unsigned int offset, void *buffer, unsigned int length);
    50 unsigned int fb_write(unsigned int offset, void *buffer, unsigned int length);
    51 unsigned int fb_completed();
    52 
    53 /* Software barrier related functions */
    54 unsigned int barrier_init(unsigned int index, unsigned int count);
    55 unsigned int barrier_wait(unsigned int index);
     44unsigned int giet_fb_sync_read( unsigned int    offset,
     45                                void*                   buffer,
     46                                unsigned int    length );
     47unsigned int giet_fb_sync_write(unsigned int    offset,
     48                                void*                   buffer,
     49                                unsigned int    length );
     50unsigned int giet_fb_read(      unsigned int    offset,
     51                                void*                   buffer,
     52                                unsigned int    length );
     53unsigned int giet_fb_write(     unsigned int    offset,
     54                                void*                   buffer,
     55                                unsigned int    length );
     56unsigned int giet_fb_completed();
    5657
    5758/* Misc */
    58 void exit();
    59 unsigned int rand();
     59unsigned int giet_vobj_get_vbase( char* vspace_name,
     60                                  char* vobj_name,
     61                                  unsigned int vobj_type,
     62                                  unsigned int* vobj_vaddr );
     63void         giet_exit();
     64unsigned int giet_rand();
    6065unsigned int ctx_switch();
    61 unsigned int vobj_get_vbase( char* vspace_name, char* vobj_name,
    62                         unsigned int vobj_type, unsigned int* vobj_buffer);
     66unsigned int giet_procnumber();
    6367
    6468/*
    6569 * memcpy function
    66  *
    67  * This function is likely not to be called directly but GCC can automatically
    68  * issue call to it during compilation so we must provide it. 'static inline'
    69  * so the function's code is directly included when used.
    70  *
     70 * This function is required because it can be gnerated by GCC
     71 * during compilation so we must provide it.
    7172 * Code taken from MutekH.
    7273 */
Note: See TracChangeset for help on using the changeset viewer.