Ignore:
Timestamp:
Mar 10, 2015, 3:14:52 PM (9 years ago)
Author:
alain
Message:

Introducing in the stdio.c / stdio.h files the system calls
related to the hardware coprocessors configuration and use.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_libs/stdio.c

    r501 r521  
    1 //////////////////////////////////////////////////////////////////////////////////
     1//////////////////////////////////////////////////////////////////////////////
    22// File     : stdio.c         
    33// Date     : 01/04/2010
    44// Author   : alain greiner & Joel Porquet
    55// Copyright (c) UPMC-LIP6
    6 ///////////////////////////////////////////////////////////////////////////////////
     6//////////////////////////////////////////////////////////////////////////////
    77
    88#include <stdarg.h>
     
    1010#include <giet_config.h>
    1111
    12 ////////////////////////////////////////////////////////////////////////////////////
    13 /////////////////////  MIPS32     related system calls /////////////////////////////
    14 ////////////////////////////////////////////////////////////////////////////////////
     12//////////////////////////////////////////////////////////////////////////////
     13/////////////////////  MIPS32     related system calls ///////////////////////
     14//////////////////////////////////////////////////////////////////////////////
    1515
    1616////////////////////////////////////////////
     
    4848}
    4949
    50 //////////////////////////////////////////////////////////////////////////////////
    51 ///////////////////// Task context  system calls /////////////////////////////////
    52 //////////////////////////////////////////////////////////////////////////////////
     50//////////////////////////////////////////////////////////////////////////////
     51///////////////////// Task context  system calls /////////////////////////////
     52//////////////////////////////////////////////////////////////////////////////
    5353
    5454////////////////////////////////
     
    7474
    7575
    76 ////////////////////////////////////////////////////////////////////////////////////
    77 /////////////////////  TTY device related system calls /////////////////////////////
    78 ////////////////////////////////////////////////////////////////////////////////////
     76//////////////////////////////////////////////////////////////////////////////
     77///////////////////// Coprocessors  system calls  ////////////////////////////
     78//////////////////////////////////////////////////////////////////////////////
     79
     80///////////////////////////////////////////////////
     81void giet_coproc_alloc( unsigned int   coproc_type,
     82                        unsigned int*  coproc_info,
     83                        unsigned int*  cluster_xy )
     84{
     85    if ( sys_call( SYSCALL_COPROC_ALLOC,
     86                   coproc_type,
     87                   (unsigned int)coproc_info,
     88                   (unsigned int)cluster_xy,
     89                   0 ) ) 
     90        giet_exit("error in giet_coproc_alloc()");
     91}
     92
     93///////////////////////////////////////////////////
     94void giet_coproc_release( unsigned int cluster_xy )
     95{
     96    if ( sys_call( SYSCALL_COPROC_RELEASE,
     97                   cluster_xy,
     98                   0, 0, 0 ) ) 
     99        giet_exit("error in giet_coproc_release()");
     100}
     101
     102//////////////////////////////////////////////////////////////////
     103void giet_coproc_channel_init( unsigned int            cluster_xy,
     104                               unsigned int            channel,
     105                               giet_coproc_channel_t*  desc )
     106{
     107    if ( sys_call( SYSCALL_COPROC_CHANNEL_INIT,
     108                   cluster_xy,
     109                   channel,
     110                   (unsigned int)desc,
     111                   0 ) )
     112        giet_exit("error in giet_coproc_channel_init");
     113}
     114
     115////////////////////////////////////////////////////////////
     116void giet_coproc_channel_start( unsigned int     cluster_xy,
     117                                unsigned int     channel )
     118{
     119    if ( sys_call( SYSCALL_COPROC_CHANNEL_START,
     120                   cluster_xy,
     121                   channel,
     122                   0, 0 ) )
     123        giet_exit("error in giet_coproc_channel_start");
     124}
     125
     126///////////////////////////////////////////////////////////
     127void giet_coproc_channel_stop( unsigned int     cluster_xy,
     128                               unsigned int     channel )
     129{
     130    if ( sys_call( SYSCALL_COPROC_CHANNEL_STOP,
     131                   cluster_xy,
     132                   channel,
     133                   0, 0 ) )
     134        giet_exit("error in giet_coproc_channel_stop");
     135}
     136
     137/////////////////////////////////////////////////////////
     138void giet_coproc_completed( unsigned int     cluster_xy )
     139{
     140    if ( sys_call( SYSCALL_COPROC_COMPLETED,
     141                   cluster_xy,
     142                   0, 0, 0 ) )
     143        giet_exit("error in giet_coproc_completed");
     144}
     145
     146///////////////////////////////////////////////////////////
     147void giet_coproc_register_set( unsigned int     cluster_xy,
     148                               unsigned int     index,
     149                               unsigned int     value )
     150{
     151    if ( sys_call( SYSCALL_COPROC_REGISTER_SET,
     152                   cluster_xy,
     153                   index,
     154                   value,
     155                   0 ) )
     156        giet_exit("error in giet_coproc_register_set");
     157}
     158
     159///////////////////////////////////////////////////////////
     160void giet_coproc_register_get( unsigned int     cluster_xy,
     161                               unsigned int     index,
     162                               unsigned int*    value )
     163{
     164    if ( sys_call( SYSCALL_COPROC_REGISTER_SET,
     165                   cluster_xy,
     166                   index,
     167                   (unsigned int)value,
     168                   0 ) )
     169        giet_exit("error in giet_coproc_register_get");
     170}
     171
     172
     173//////////////////////////////////////////////////////////////////////////////
     174/////////////////////  TTY device related system calls ///////////////////////
     175//////////////////////////////////////////////////////////////////////////////
    79176
    80177/////////////////////
    81178void giet_tty_alloc()
    82179{
    83     sys_call( SYSCALL_TTY_ALLOC, 0, 0 ,0 ,0 );
     180    if ( sys_call( SYSCALL_TTY_ALLOC,
     181                   0, 0, 0, 0 ) )  giet_exit("error in giet_tty_alloc()");
    84182}
    85183
Note: See TracChangeset for help on using the changeset viewer.