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.h

    r501 r521  
    1 //////////////////////////////////////////////////////////////////////////////////
     1/////////////////////////////////////////////////////////////////////////////
    22// File     : stdio.h         
    33// Date     : 01/04/2010
    44// Author   : alain greiner & Joel Porquet
    55// Copyright (c) UPMC-LIP6
    6 ///////////////////////////////////////////////////////////////////////////////////
     6/////////////////////////////////////////////////////////////////////////////
    77// The stdio.c and stdio.h files are part of the GIET_VM nano-kernel.
    88// This library contains all user-level functions that contain a system call
    99// to access protected or shared ressources.
    10 ///////////////////////////////////////////////////////////////////////////////////
     10/////////////////////////////////////////////////////////////////////////////
    1111
    1212#ifndef _STDIO_H
     
    1616// the _syscall_vector defined in file sys_handler.c
    1717
    18 #define SYSCALL_PROC_XYP          0x00
    19 #define SYSCALL_PROC_TIME         0x01
    20 #define SYSCALL_TTY_WRITE         0x02
    21 #define SYSCALL_TTY_READ          0x03
    22 #define SYSCALL_TTY_ALLOC         0x04
    23 #define SYSCALL_TTY_GET_LOCK      0x05
    24 #define SYSCALL_TTY_RELEASE_LOCK  0x06
    25 #define SYSCALL_HEAP_INFO         0x07
    26 #define SYSCALL_LOCAL_TASK_ID     0x08
    27 #define SYSCALL_GLOBAL_TASK_ID    0x09
    28 #define SYSCALL_FBF_CMA_ALLOC     0x0A
    29 #define SYSCALL_FBF_CMA_START     0x0B
    30 #define SYSCALL_FBF_CMA_DISPLAY   0x0C
    31 #define SYSCALL_FBF_CMA_STOP      0x0D
    32 #define SYSCALL_EXIT              0x0E
    33 #define SYSCALL_PROCS_NUMBER      0x0F
    34 
    35 #define SYSCALL_FBF_SYNC_WRITE    0x10
    36 #define SYSCALL_FBF_SYNC_READ     0x11
    37 #define SYSCALL_THREAD_ID         0x12
    38 //                                0x13
    39 #define SYSCALL_TIM_ALLOC         0x14
    40 #define SYSCALL_TIM_START         0x15
    41 #define SYSCALL_TIM_STOP          0x16
    42 //                                0x17
    43 //                                0x18
    44 #define SYSCALL_CTX_SWITCH        0x19
    45 #define SYSCALL_VOBJ_GET_VBASE    0x1A
    46 #define SYSCALL_VOBJ_GET_LENGTH   0x1B
    47 #define SYSCALL_GET_XY            0x1C
    48 //                                0x1D
    49 //                                0x1E
    50 //                                0x1F
    51 
    52 #define SYSCALL_FAT_OPEN          0x20
    53 #define SYSCALL_FAT_READ          0x21
    54 #define SYSCALL_FAT_WRITE         0x22
    55 #define SYSCALL_FAT_LSEEK         0x23
    56 #define SYSCALL_FAT_FSTAT         0x24
    57 #define SYSCALL_FAT_CLOSE         0x25
    58 //                                0x26
    59 //                                0x27
    60 //                                0x28
    61 //                                0x29
    62 //                                0x2A
    63 //                                0x2B
    64 //                                0x2C
    65 //                                0x2D
    66 //                                0x2E
    67 //                                0x2F
    68 
    69 #define SYSCALL_NIC_ALLOC         0x30
    70 #define SYSCALL_NIC_START         0x31
    71 #define SYSCALL_NIC_MOVE          0x32
    72 #define SYSCALL_NIC_STOP          0x33
    73 #define SYSCALL_NIC_STATS         0x34
    74 #define SYSCALL_NIC_CLEAR         0x35
    75 //                                0x36
    76 //                                0x37
    77 //                                0x38
    78 //                                0x39
    79 //                                0x3A
    80 //                                0x3B
    81 //                                0x3C
    82 //                                0x3D
    83 //                                0x3E
    84 //                                0x3F
    85 
    86 //////////////////////////////////////////////////////////////////////////////////
     18#define SYSCALL_PROC_XYP             0x00
     19#define SYSCALL_PROC_TIME            0x01
     20#define SYSCALL_TTY_WRITE            0x02
     21#define SYSCALL_TTY_READ             0x03
     22#define SYSCALL_TTY_ALLOC            0x04
     23#define SYSCALL_TTY_GET_LOCK         0x05
     24#define SYSCALL_TTY_RELEASE_LOCK     0x06
     25#define SYSCALL_HEAP_INFO            0x07
     26#define SYSCALL_LOCAL_TASK_ID        0x08
     27#define SYSCALL_GLOBAL_TASK_ID       0x09
     28#define SYSCALL_FBF_CMA_ALLOC        0x0A
     29#define SYSCALL_FBF_CMA_START        0x0B
     30#define SYSCALL_FBF_CMA_DISPLAY      0x0C
     31#define SYSCALL_FBF_CMA_STOP         0x0D
     32#define SYSCALL_EXIT                 0x0E
     33#define SYSCALL_PROCS_NUMBER         0x0F
     34
     35#define SYSCALL_FBF_SYNC_WRITE       0x10
     36#define SYSCALL_FBF_SYNC_READ        0x11
     37#define SYSCALL_THREAD_ID            0x12
     38//                                   0x13
     39#define SYSCALL_TIM_ALLOC            0x14
     40#define SYSCALL_TIM_START            0x15
     41#define SYSCALL_TIM_STOP             0x16
     42//                                   0x17
     43//                                   0x18
     44#define SYSCALL_CTX_SWITCH           0x19
     45#define SYSCALL_VOBJ_GET_VBASE       0x1A
     46#define SYSCALL_VOBJ_GET_LENGTH      0x1B
     47#define SYSCALL_GET_XY               0x1C
     48//                                   0x1D
     49//                                   0x1E
     50//                                   0x1F
     51
     52#define SYSCALL_FAT_OPEN             0x20
     53#define SYSCALL_FAT_READ             0x21
     54#define SYSCALL_FAT_WRITE            0x22
     55#define SYSCALL_FAT_LSEEK            0x23
     56#define SYSCALL_FAT_FSTAT            0x24
     57#define SYSCALL_FAT_CLOSE            0x25
     58//                                   0x26
     59//                                   0x27
     60//                                   0x28
     61//                                   0x29
     62//                                   0x2A
     63//                                   0x2B
     64//                                   0x2C
     65//                                   0x2D
     66//                                   0x2E
     67//                                   0x2F
     68
     69#define SYSCALL_NIC_ALLOC            0x30
     70#define SYSCALL_NIC_START            0x31
     71#define SYSCALL_NIC_MOVE             0x32
     72#define SYSCALL_NIC_STOP             0x33
     73#define SYSCALL_NIC_STATS            0x34
     74#define SYSCALL_NIC_CLEAR            0x35
     75//                                   0x36
     76//                                   0x37
     77#define SYSCALL_COPROC_REGISTER_GET  0x38
     78#define SYSCALL_COPROC_REGISTER_SET  0x39
     79#define SYSCALL_COPROC_RELEASE       0x3A
     80#define SYSCALL_COPROC_COMPLETED     0x3B
     81#define SYSCALL_COPROC_ALLOC         0x3C
     82#define SYSCALL_COPROC_CHANNEL_INIT  0x3D
     83#define SYSCALL_COPROC_CHANNEL_START 0x3E
     84#define SYSCALL_COPROC_CHANNEL_STOP  0x3F
     85
     86////////////////////////////////////////////////////////////////////////////
    8787// NULL pointer definition
    88 //////////////////////////////////////////////////////////////////////////////////
     88////////////////////////////////////////////////////////////////////////////
    8989
    9090#define NULL (void *)0
    9191
    92 //////////////////////////////////////////////////////////////////////////////////
     92////////////////////////////////////////////////////////////////////////////
    9393// This generic C function is used to implement all system calls.
    9494// It writes the system call arguments in the proper registers,
    9595// and tells GCC what has been modified by system call execution.
    9696// Returns -1 to signal an error.
    97 //////////////////////////////////////////////////////////////////////////////////
     97////////////////////////////////////////////////////////////////////////////
    9898static inline int sys_call( int call_no,
    9999                            int arg_0,
     
    141141//////////////////////////////////////////////////////////////////////////
    142142
    143 //////////////////////////////////////////////////////////////////////////
    144143extern void giet_proc_xyp( unsigned int* cluster_x,
    145144                           unsigned int* cluster_y,
     
    159158
    160159extern unsigned int giet_thread_id();
     160
     161//////////////////////////////////////////////////////////////////////////
     162//             Coprocessors related system calls
     163//////////////////////////////////////////////////////////////////////////
     164
     165// this structure is used by the giet_coproc_channel_init()
     166// system call to specify the communication channel parameters.
     167typedef struct giet_coproc_channel
     168{
     169    unsigned int  channel_mode;    // MWMR / DMA_IRQ / DMA_NO_IRQ
     170    unsigned int  buffer_size;     // memory buffer size
     171    unsigned int  buffer_vaddr;    // memory buffer virtual address
     172    unsigned int  mwmr_vaddr;      // MWMR descriptor virtual address
     173    unsigned int  lock_vaddr;      // lock for MWMR virtual address
     174} giet_coproc_channel_t;
     175
     176extern void giet_coproc_alloc( unsigned int   coproc_type,
     177                               unsigned int*  coproc_info,
     178                               unsigned int*  cluster_xy );
     179
     180extern void giet_coproc_release( unsigned int cluster_xy );
     181
     182extern void giet_coproc_channel_init( unsigned int            cluster_xy,
     183                                      unsigned int            channel,
     184                                      giet_coproc_channel_t*  desc );
     185
     186extern void giet_coproc_channel_start( unsigned int    cluster_xy,
     187                                       unsigned int    channel );
     188
     189extern void giet_coproc_channel_stop ( unsigned int    cluster_xy,
     190                                       unsigned int    channel );
     191
     192extern void giet_coproc_completed( unsigned int cluster_xy );
     193
     194extern void giet_coproc_register_set( unsigned int     cluster_xy,
     195                                      unsigned int     reg_index,
     196                                      unsigned int     value );
     197
     198extern void giet_coproc_register_get( unsigned int     cluster_xy,
     199                                      unsigned int     reg_index,
     200                                      unsigned int*    buffer );
    161201
    162202//////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.