Changeset 713 for soft


Ignore:
Timestamp:
Oct 7, 2015, 11:58:24 AM (9 years ago)
Author:
alain
Message:

Introduce the giet_fbf_size() and giet_fbf_alloc() system calls.

Location:
soft/giet_vm/giet_libs
Files:
2 edited

Legend:

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

    r709 r713  
    111111}
    112112
    113 //////////////////////////////////////////////
    114 int giet_pthread_pause( char*     vspace_name,
    115                         char*     thread_name )
    116 {
    117     return sys_call( SYSCALL_PTHREAD_CONTROL,
    118                      THREAD_CMD_PAUSE,
    119                      (unsigned int) vspace_name,
    120                      (unsigned int) thread_name,
    121                      0 );
    122 }
    123 
    124 ///////////////////////////////////////////////
    125 int giet_pthread_resume( char*     vspace_name,
    126                          char*     thread_name )
    127 {
    128     return sys_call( SYSCALL_PTHREAD_CONTROL,
    129                      THREAD_CMD_RESUME,
    130                      (unsigned int) vspace_name,
    131                      (unsigned int) thread_name,
    132                      0 );
    133 }
    134 
    135 ///////////////////////////////////////////////
    136 int giet_pthread_context( char*     vspace_name,
    137                           char*     thread_name )
    138 {
    139     return sys_call( SYSCALL_PTHREAD_CONTROL,
    140                      THREAD_CMD_CONTEXT,
    141                      (unsigned int) vspace_name,
    142                      (unsigned int) thread_name,
    143                      0 );
     113////////////////////////////////////////////////
     114void giet_pthread_control( unsigned int command, 
     115                           char*        vspace_name,
     116                           char*        thread_name )
     117{
     118    int ret = sys_call( SYSCALL_PTHREAD_CONTROL,
     119                        command,
     120                        (unsigned int) vspace_name,
     121                        (unsigned int) thread_name,
     122                        0 );
     123
     124    if ( ret == SYSCALL_VSPACE_NOT_FOUND )
     125    {
     126        giet_tty_printf("  ERROR in PTHREAD_CONTROL : "
     127                        "vspace %s not found\n", vspace_name );
     128    }
     129    if ( ret == SYSCALL_THREAD_NOT_FOUND )
     130    {
     131        giet_tty_printf("  ERROR in PTHREAD_CONTROL : "
     132                        "thread %s not found\n", thread_name );
     133    }
     134    if ( ret == SYSCALL_UNCOHERENT_THREAD_CONTEXT )
     135    {
     136        giet_tty_printf("  ERROR in PTHREAD_CONTROL : "
     137                        "uncoherent context for thread %s\n", thread_name );
     138    }
     139    if ( ret == SYSCALL_ILLEGAL_THREAD_COMMAND_TYPE )
     140    {
     141        giet_tty_printf("  ERROR in PTHREAD_CONTROL : "
     142                        "illegal command type %d\n", command );
     143    }
    144144}
    145145
     
    165165}
    166166
    167 ///////////////////////////////
    168 void giet_applications_status()
     167///////////////////////////////////////////
     168void giet_applications_status( char* name )
    169169{
    170170    sys_call( SYSCALL_APPS_STATUS,
    171               0, 0, 0, 0 );
     171              (unsigned int)name,
     172              0, 0, 0 );
    172173}
    173174
     
    776777{
    777778    if ( sys_call( SYSCALL_TIM_ALLOC,
    778                    0, 0, 0, 0 ) ) giet_pthread_exit("error in giet_timer_alloc()");
     779                   0, 0, 0, 0 ) ) giet_pthread_exit("ERROR in TIMER_ALLOC");
    779780}
    780781
     
    784785    if ( sys_call( SYSCALL_TIM_START,
    785786                   period,
    786                    0, 0, 0 ) ) giet_pthread_exit("error in giet_timer_start()");
     787                   0, 0, 0 ) ) giet_pthread_exit("ERROR in TIMER_START");
    787788}
    788789
     
    791792{
    792793    if ( sys_call( SYSCALL_TIM_STOP,
    793                    0, 0, 0, 0 ) ) giet_pthread_exit("error in giet_timer_stop()");
     794                   0, 0, 0, 0 ) ) giet_pthread_exit("ERROR in TIMER_STOP");
    794795}
    795796
     
    799800//////////////////////////////////////////////////////////////////////////////////
    800801
     802////////////////////////////////////////
     803void giet_fbf_size( unsigned int* width,
     804                    unsigned int* height )
     805{
     806    sys_call( SYSCALL_FBF_SIZE,
     807              (unsigned int)width,
     808              (unsigned int)height,
     809              0, 0 );
     810}
     811                   
     812/////////////////////
     813void giet_fbf_alloc()
     814{
     815    if ( sys_call( SYSCALL_FBF_ALLOC,
     816                   0, 0, 0, 0 ) )    giet_pthread_exit("ERROR in FBF_ALLOC");
     817}
     818
    801819/////////////////////////
    802820void giet_fbf_cma_alloc()
    803821{
    804822    if ( sys_call( SYSCALL_FBF_CMA_ALLOC,
    805                    0, 0, 0, 0 ) )    giet_pthread_exit("error in giet_fbf_cma_alloc()");
     823                   0, 0, 0, 0 ) )    giet_pthread_exit("ERROR in FBF_CMA_ALLOC");
    806824}
    807825
     
    816834                   (unsigned int)buf1_vbase,
    817835                   (unsigned int)sts0_vaddr,
    818                    (unsigned int)sts1_vaddr ) )   giet_pthread_exit("error in giet_fbf_cma_init_buf()");
     836                   (unsigned int)sts1_vaddr ) ) giet_pthread_exit("ERROR in FBF_CMA_INIT_BUF");
    819837}
    820838
     
    824842    if ( sys_call( SYSCALL_FBF_CMA_START,
    825843                   length,
    826                    0, 0, 0 ) )   giet_pthread_exit("error in giet_fbf_cma_start()");
     844                   0, 0, 0 ) )   giet_pthread_exit("ERROR in FBF_CMA_START");
    827845}
    828846
     
    832850    if ( sys_call( SYSCALL_FBF_CMA_DISPLAY,
    833851                   buffer,
    834                    0, 0, 0 ) )   giet_pthread_exit("error in giet_fbf_cma_display()");
     852                   0, 0, 0 ) )   giet_pthread_exit("ERROR in FBF_CMA_DISPLAY");
    835853}
    836854
     
    839857{
    840858    if ( sys_call( SYSCALL_FBF_CMA_STOP,
    841                    0, 0, 0, 0 ) )    giet_pthread_exit("error in giet_fbf_cma_stop()");
     859                   0, 0, 0, 0 ) )    giet_pthread_exit("ERROR in FBF_CMA_STOP");
    842860}
    843861
     
    851869                   (unsigned int)buffer,
    852870                   length,
    853                    0 ) )  giet_pthread_exit("error in giet_fbf_sync_write()");
     871                   0 ) )  giet_pthread_exit("ERROR in FBF_SYNC_WRITE");
    854872}
    855873
     
    863881                   (unsigned int)buffer,
    864882                   length,
    865                    0 ) )   giet_pthread_exit("error in giet_fbf_sync_read()");
     883                   0 ) )   giet_pthread_exit("ERROR in FBF_SYNC_READ");
    866884}
    867885
  • soft/giet_vm/giet_libs/stdio.h

    r709 r713  
    2424#define SYSCALL_GET_XY               0x03
    2525//                                   0x04
    26 //                                   0x05
    27 //                                   0x06
     26#define SYSCALL_VOBJ_GET_VBASE       0x05
     27#define SYSCALL_VOBJ_GET_LENGTH      0x06
    2828#define SYSCALL_HEAP_INFO            0x07
    29 #define SYSCALL_VOBJ_GET_VBASE       0x08
    30 #define SYSCALL_VOBJ_GET_LENGTH      0x09
     29#define SYSCALL_FBF_SIZE             0x08
     30#define SYSCALL_FBF_ALLOC            0x09
    3131#define SYSCALL_FBF_CMA_ALLOC        0x0A
    3232#define SYSCALL_FBF_CMA_INIT_BUF     0x0B
     
    8686#define SYSCALL_COPROC_RUN           0x3E
    8787#define SYSCALL_COPROC_RELEASE       0x3F
     88
     89////////////////////////////////////////////////////////////////////////////
     90// Define the error codes for the syscall handlers
     91// These define must be synchronized with values in the sys_handler.h file
     92////////////////////////////////////////////////////////////////////////////
     93
     94#define SYSCALL_OK                               ( 0 )
     95#define SYSCALL_VSPACE_NOT_FOUND                 (-1 )
     96#define SYSCALL_THREAD_NOT_FOUND                 (-2 )
     97#define SYSCALL_NOT_IN_SAME_VSPACE               (-3 )
     98#define SYSCALL_UNCOHERENT_THREAD_CONTEXT        (-4 )
     99#define SYSCALL_ILLEGAL_THREAD_COMMAND_TYPE      (-5 )
     100#define SYSCALL_CANNOT_LOAD_DATA_SEGMENT         (-6 )
     101#define SYSCALL_THREAD_ALREADY_ACTIVE            (-7 )
     102#define SYSCALL_MAIN_NOT_FOUND                   (-8 )
     103#define SYSCALL_APPLI_CANNOT_BE_KILLED           (-9 )
     104#define SYSCALL_PTHREAD_ARGUMENT_NOT_SUPPORTED   (-10)
     105#define SYSCALL_ILLEGAL_CLUSTER_COORDINATES      (-11)
     106#define SYSCALL_VSEG_NOT_FOUND                   (-12)
     107#define SYSCALL_UNDEFINED_SYSTEM_CALL            (-13)
     108#define SYSCALL_COPROCESSOR_NOT_FOUND            (-14)
     109#define SYSCALL_COPROCESSOR_ILLEGAL_MODE         (-15)
     110#define SYSCALL_COPROCESSOR_NON_ALLOCATED        (-16)
     111#define SYSCALL_CHANNEL_ALREADY_ALLOCATED        (-17)
     112#define SYSCALL_NO_CHANNEL_AVAILABLE             (-18)
     113#define SYSCALL_CHANNEL_NON_ALLOCATED            (-19)
     114#define SYSCALL_ILLEGAL_XY_ARGUMENTS             (-20)
     115#define SYSCALL_OUT_OF_KERNEL_HEAP_MEMORY        (-21)
     116#define SYSCALL_ADDRESS_NON_ALIGNED              (-22)
     117#define SYSCALL_ADDRESS_NON_USER_ACCESSIBLE      (-23)
     118#define SYSCALL_MISSING_INITIALISATION           (-24)
     119#define SYSCALL_SHARED_PERIPHERAL_BUSY           (-25)
     120
     121////////////////////////////////////////////////////////////////////////////
     122// Command values for the giet_pthread_control() syscall
     123// These define must be synchronized with values in the sys_handler.h file
     124////////////////////////////////////////////////////////////////////////////
     125
     126#define THREAD_CMD_PAUSE        0
     127#define THREAD_CMD_RESUME       1
     128#define THREAD_CMD_CONTEXT      2
    88129
    89130////////////////////////////////////////////////////////////////////////////
     
    178219                                 char*        string );
    179220
    180 extern int giet_pthread_pause( char*      vspace,
    181                                char*      thread );
    182 
    183 extern int giet_pthread_resume( char*      vspace,
    184                                 char*      thread );
    185 
    186 extern int giet_pthread_context( char*      vspace,
    187                                  char*      thread );
     221extern void giet_pthread_control( unsigned int command,
     222                                  char*        vspace_name,
     223                                  char*        thread_name );
    188224
    189225//////////////////////////////////////////////////////////////////////////
     
    195231extern int giet_exec_application( char* name );
    196232
    197 extern void giet_applications_status();
     233extern void giet_applications_status( char* name );
    198234
    199235//////////////////////////////////////////////////////////////////////////
     
    252288//////////////////////////////////////////////////////////////////////////
    253289
     290extern void giet_fbf_size();
     291
     292extern void giet_fbf_alloc();
     293
    254294extern void giet_fbf_cma_alloc();
    255295
Note: See TracChangeset for help on using the changeset viewer.