Changeset 267 for soft/giet_vm/giet_libs


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_libs
Files:
2 edited

Legend:

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

    r260 r267  
    1212#include <stdarg.h>
    1313#include <stdio.h>
     14#include <giet_config.h>
    1415
    1516
     
    298299    unsigned int ret;
    299300
     301    if (GIET_MONO_TTY)
     302    {
     303        ret = sys_call(SYSCALL_TTY_LOCK, 0, 0, 0, 0); // Get TTY lock
     304    }
     305
    300306printf_text:
    301307
     
    311317                           0xFFFFFFFF,
    312318                           0);
    313             if (ret != i)  return 1;     /* return error */
     319
     320            if (ret != i) goto return_error;
     321
    314322            format += i;
    315323        }
     
    319327            goto printf_arguments;
    320328        }
     329    }
     330
     331    if (GIET_MONO_TTY)
     332    {
     333        ret = sys_call(SYSCALL_TTY_LOCK, 1, 0, 0, 0); // Release TTY lock
    321334    }
    322335
     
    349362                                   0xFFFFFFFF,
    350363                                   0);
    351                     if (ret != 1)  return 1;     /* return error */
     364                    if (ret != 1) goto return_error;
    352365                }
    353366            case ('u'):             /* decimal unsigned integer */
     
    366379                               0xFFFFFFFF,
    367380                               0);
    368                 if (ret != 2) return 1;       /* return error */
     381                if (ret != 2) goto return_error;       /* return error */
    369382                for(i = 0; i < 8; i++)
    370383                {
     
    394407                       0xFFFFFFFF,
    395408                       0);
    396         if (ret != len)  return 1;
     409        if (ret != len)  goto return_error;
     410       
    397411        goto printf_text;
    398412    }
     413
     414return_error:
     415    if (GIET_MONO_TTY)
     416    {
     417        ret = sys_call(SYSCALL_TTY_LOCK, 1, 0, 0, 0); // Release TTY lock
     418    }
     419
     420    return 1;
    399421}
    400422
     
    663685}
    664686
     687//////////////////////////////////////////////////////////////////////////////////
     688// giet_thread_id()
     689//////////////////////////////////////////////////////////////////////////////////
     690// This functions returns the thread index of the current task.
     691//////////////////////////////////////////////////////////////////////////////////
     692int giet_thread_id()
     693{
     694    return sys_call( SYSCALL_THREAD_ID,
     695                     0, 0, 0, 0 );
     696}
     697
    665698///////////////////////////////////////////////////////////////////////////////////
    666699///////////////////// FAT related system calls ////////////////////////////////////
  • soft/giet_vm/giet_libs/stdio.h

    r260 r267  
    3131#define SYSCALL_FB_SYNC_WRITE     0x10
    3232#define SYSCALL_FB_SYNC_READ      0x11
    33 #define SYSCALL_FREE_12           0x12
    34 #define SYSCALL_FREE_13           0x13
     33#define SYSCALL_THREAD_ID         0x12
     34#define SYSCALL_TTY_LOCK          0x13
    3535#define SYSCALL_FREE_14           0x14
    3636#define SYSCALL_FREE_15           0x15
     
    209209extern int giet_global_task_id();
    210210
     211extern int giet_thread_id();
     212
    211213extern void giet_assert( unsigned int,
    212214                         char* string );
Note: See TracChangeset for help on using the changeset viewer.