Ignore:
Timestamp:
Oct 1, 2015, 4:20:46 PM (9 years ago)
Author:
alain
Message:

Major release: Change the task model to implement the POSIX threads API.

  • The shell "exec" and "kill" commands can be used to activate/de-activate the applications.
  • The "pause", "resume", and "context" commands can be used to stop, restart, a single thtead or to display the thread context.

This version has been tested on the following multi-threaded applications,
that have been modified to use the POSIX threads:

  • classif
  • convol
  • transpose
  • gameoflife
  • raycast
File:
1 edited

Legend:

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

    r689 r709  
    1414
    1515#include "giet_fat32/fat32_shared.h"
     16#include "giet_common/mips32_registers.h"
    1617
    1718// These define must be synchronised with
     
    2021#define SYSCALL_PROC_XYP             0x00
    2122#define SYSCALL_PROC_TIME            0x01
    22 #define SYSCALL_TTY_WRITE            0x02
    23 #define SYSCALL_TTY_READ             0x03
    24 #define SYSCALL_TTY_ALLOC            0x04
    25 #define SYSCALL_TASKS_STATUS         0x05
     23#define SYSCALL_PROCS_NUMBER         0x02
     24#define SYSCALL_GET_XY               0x03
     25//                                   0x04
     26//                                   0x05
    2627//                                   0x06
    2728#define SYSCALL_HEAP_INFO            0x07
    28 #define SYSCALL_LOCAL_TASK_ID        0x08
    29 #define SYSCALL_GLOBAL_TASK_ID       0x09
     29#define SYSCALL_VOBJ_GET_VBASE       0x08
     30#define SYSCALL_VOBJ_GET_LENGTH      0x09
    3031#define SYSCALL_FBF_CMA_ALLOC        0x0A
    3132#define SYSCALL_FBF_CMA_INIT_BUF     0x0B
     
    3334#define SYSCALL_FBF_CMA_DISPLAY      0x0D
    3435#define SYSCALL_FBF_CMA_STOP         0x0E
    35 #define SYSCALL_EXIT                 0x0F
    36 
    37 #define SYSCALL_PROCS_NUMBER         0x10
     36//                                   0x0F
     37
     38#define SYSCALL_APPS_STATUS          0x10
    3839#define SYSCALL_FBF_SYNC_WRITE       0x11
    3940#define SYSCALL_FBF_SYNC_READ        0x12
    40 #define SYSCALL_THREAD_ID            0x13
     41//                                   0x13
    4142#define SYSCALL_TIM_ALLOC            0x14
    4243#define SYSCALL_TIM_START            0x15
     
    4445#define SYSCALL_KILL_APP             0x17
    4546#define SYSCALL_EXEC_APP             0x18
    46 #define SYSCALL_CTX_SWITCH           0x19
    47 #define SYSCALL_VOBJ_GET_VBASE       0x1A
    48 #define SYSCALL_VOBJ_GET_LENGTH      0x1B
    49 #define SYSCALL_GET_XY               0x1C
    50 //                                   0x1D
    51 //                                   0x1E
    52 //                                   0x1F
     47//                                   0x19
     48#define SYSCALL_PTHREAD_CONTROL      0x1A
     49#define SYSCALL_PTHREAD_YIELD        0x1B
     50#define SYSCALL_PTHREAD_KILL         0x1C
     51#define SYSCALL_PTHREAD_CREATE       0x1D
     52#define SYSCALL_PTHREAD_JOIN         0x1E
     53#define SYSCALL_PTHREAD_EXIT         0x1F
    5354
    5455#define SYSCALL_FAT_OPEN             0x20
     
    7576#define SYSCALL_NIC_STATS            0x34
    7677#define SYSCALL_NIC_CLEAR            0x35
    77 //                                   0x36
    78 //                                   0x37
    79 //                                   0x38
     78#define SYSCALL_TTY_WRITE            0x36
     79#define SYSCALL_TTY_READ             0x37
     80#define SYSCALL_TTY_ALLOC            0x38
    8081//                                   0x39
    8182//                                   0x3A
     
    152153
    153154//////////////////////////////////////////////////////////////////////////
    154 //              Task related system calls
    155 //////////////////////////////////////////////////////////////////////////
    156 
    157 extern unsigned int giet_proc_task_id();
    158 
    159 extern unsigned int giet_global_task_id();
    160 
    161 extern unsigned int giet_thread_id();
    162 
    163 extern void giet_exit( char* string );
    164 
    165 extern void giet_assert( unsigned int condition,
    166                          char*        string );
    167 
    168 extern void giet_context_switch();
    169 
    170 extern void giet_tasks_status();
     155//              Threads related system calls
     156//////////////////////////////////////////////////////////////////////////
     157
     158typedef unsigned int pthread_t;
     159
     160typedef unsigned int pthread_attr_t;
     161
     162extern int giet_pthread_create( pthread_t*       trdid,
     163                                pthread_attr_t*  attr,
     164                                void*            function,
     165                                void*            ptr );
     166
     167extern void giet_pthread_exit( void* string );
     168
     169extern int giet_pthread_join( pthread_t  trdid,
     170                              void**     ptr );
     171
     172extern int giet_pthread_kill( pthread_t thread_id,
     173                              int       signal );
     174
     175extern void giet_pthread_yield();
     176
     177extern void giet_pthread_assert( unsigned int condition,
     178                                 char*        string );
     179
     180extern int giet_pthread_pause( char*      vspace,
     181                               char*      thread );
     182
     183extern int giet_pthread_resume( char*      vspace,
     184                                char*      thread );
     185
     186extern int giet_pthread_context( char*      vspace,
     187                                 char*      thread );
    171188
    172189//////////////////////////////////////////////////////////////////////////
     
    177194
    178195extern int giet_exec_application( char* name );
     196
     197extern void giet_applications_status();
    179198
    180199//////////////////////////////////////////////////////////////////////////
     
    258277//////////////////////////////////////////////////////////////////////////
    259278
    260 extern unsigned int giet_nic_rx_alloc( unsigned int xmax, unsigned int ymax );
    261 
    262 extern unsigned int giet_nic_tx_alloc( unsigned int xmax, unsigned int ymax );
    263 
    264 extern void giet_nic_rx_start( unsigned int channel );
    265 
    266 extern void giet_nic_tx_start( unsigned int channel );
    267 
    268 extern void giet_nic_rx_move( unsigned int channel, void* buffer );
    269 
    270 extern void giet_nic_tx_move( unsigned int channel, void* buffer );
    271 
    272 extern void giet_nic_rx_stop( unsigned int channel );
    273 
    274 extern void giet_nic_tx_stop( unsigned int channel );
    275 
    276 extern void giet_nic_rx_stats( unsigned int channel );
    277 
    278 extern void giet_nic_tx_stats( unsigned int channel );
    279 
    280 extern void giet_nic_rx_clear( unsigned int channel );
    281 
    282 extern void giet_nic_tx_clear( unsigned int channel );
     279extern void giet_nic_rx_alloc( unsigned int xmax, unsigned int ymax );
     280
     281extern void giet_nic_tx_alloc( unsigned int xmax, unsigned int ymax );
     282
     283extern void giet_nic_rx_start();
     284
     285extern void giet_nic_tx_start();
     286
     287extern void giet_nic_rx_move( void* buffer );
     288
     289extern void giet_nic_tx_move( void* buffer );
     290
     291extern void giet_nic_rx_stop();
     292
     293extern void giet_nic_tx_stop();
     294
     295extern void giet_nic_rx_stats();
     296
     297extern void giet_nic_tx_stats();
     298
     299extern void giet_nic_rx_clear();
     300
     301extern void giet_nic_tx_clear();
    283302
    284303//////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.