Ignore:
Timestamp:
Jan 13, 2014, 3:20:29 PM (11 years ago)
Author:
cfuguet
Message:
  • Adding new task context information: THREAD INDEX.

This value can be accessed by USER applications to get the
thread index of the current task. This thread index
corresponds to the index in a vspace.

The value of this index can be forced in the vspace part
of the XML description file using the trdid field in the
task description. When this value is missing, for each
task, a value from 0 to N-1 will be assigned, where N is
the number of task in the vspace.

The user application access this value through the
giet_thread_id() function defined in the stdio library
which uses the SYSCALL_THREAD_ID to access the task
context information.

  • Supporting mono TTY platforms

When the GIET_MONO_TTY constant defined in the giet_config
file, contains a value different than 0, all tasks will
share the TTY[0]. If this is the case, in the stdio
library, the giet_tty_printf() function will take the TTY
hardware lock before writing

Location:
soft/giet_vm/giet_kernel
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_kernel/ctx_handler.c

    r258 r267  
    4141// - LTID   : Task local index (in scheduler)
    4242// - VSID   : Virtual space index
    43 // - RUN    : Task state (0 => sleeping / 1 => runable )
     43// - RUN    : Task state (0 => sleeping / 1 => runnable )
     44// - TRDID  : Thread ID index (in vspace)
    4445//
    4546// ctx[0]<- ***|ctx[8] <- $8 |ctx[16]<- $16|ctx[24]<- $24|ctx[32]<- EPC  |ctx[40]<- TTY
     
    5152// ctx[6]<- $6 |ctx[14]<- $14|ctx[22]<- $22|ctx[30]<- $30|ctx[38]<- VSID |ctx[46]<- GTID
    5253// ctx[7]<- $7 |ctx[15]<- $15|ctx[23]<- $23|ctx[31]<- RA |ctx[39]<- PTPR |ctx[47]<- RUN
     54//
     55// ctx[48]<- TRDID
    5356//////////////////////////////////////////////////////////////////////////////////////////
    5457
     
    164167                : "$3" );
    165168
     169#if GIET_IDLE_TASK_VERBOSITY == 1
    166170        _tty_get_lock( 0 );
    167171        _puts("\n[GIET WARNING] Processor ");
     
    171175        _puts("\n");
    172176        _tty_release_lock( 0 );
     177#endif
    173178
    174179         count = GIET_IDLE_TASK_PERIOD;
  • soft/giet_vm/giet_kernel/ctx_handler.h

    r258 r267  
    4848#define CTX_GTID_ID      46  // Global Task Index
    4949#define CTX_RUN_ID       47  // Boolean: task runable
     50#define CTX_TRDID_ID     48  // Thread Index in vspace
    5051
    5152//////////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/giet_kernel/giet.s

    r258 r267  
    99* - the _cause_vector[16] array defines the 16 causes to enter the GIET
    1010*   it is initialized in th exc_handler.c file
    11 * - the _syscall_vector[32] array defines the 32 system calls entry points
     11* - the _syscall_vector[64] array defines the 64 system calls entry points
    1212*   it is initialised in the sys_handler.c file
    1313***********************************************************************************/
  • soft/giet_vm/giet_kernel/sys_handler.c

    r263 r267  
    4848    &_fb_sync_write,       /* 0x10 */
    4949    &_fb_sync_read,        /* 0x11 */
    50     &_sys_ukn,             /* 0x12 */
    51     &_sys_ukn,             /* 0x13 */
     50    &_thread_id,           /* 0x12 */
     51    &_tty_get_release_lock,/* 0x13 */
    5252    &_sys_ukn,             /* 0x14 */
    5353    &_sys_ukn,             /* 0x15 */
     
    180180{
    181181    return _get_context_slot(CTX_GTID_ID);
     182}
     183
     184/////////////////////////////////////////////////////////////////////////////
     185// _thread_id()
     186// Returns current thread index.
     187/////////////////////////////////////////////////////////////////////////////
     188unsigned int _thread_id()
     189{
     190    return _get_context_slot(CTX_TRDID_ID);
     191}
     192
     193/////////////////////////////////////////////////////////////////////////////
     194// _tty_get_release_lock(int val)
     195// Get or release the hardware TTY lock depending on val (0: get,1: release)
     196/////////////////////////////////////////////////////////////////////////////
     197int _tty_get_release_lock(unsigned int val)
     198{
     199    unsigned int channel = _get_context_slot(CTX_TTY_ID);
     200
     201    if      ( val == 0 ) _tty_get_lock(channel);
     202    else if ( val == 1 ) _tty_release_lock(channel);
     203    else return -1; // Wrong action
     204
     205    return 0;
    182206}
    183207
  • soft/giet_vm/giet_kernel/sys_handler.h

    r258 r267  
    2424unsigned int _local_task_id();
    2525unsigned int _global_task_id();
     26unsigned int _thread_id();
     27
     28int          _tty_get_release_lock(unsigned int val);
    2629
    2730unsigned int _procs_number( unsigned int  cluster_id,
Note: See TracChangeset for help on using the changeset viewer.