Ignore:
Timestamp:
Oct 4, 2014, 3:21:56 PM (10 years ago)
Author:
alain
Message:

Introducing fixed format (X_WIDTH / YWIDTH / P_WIDTH) for processor index.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_common/utils.h

    r408 r430  
    88// They define more or less the GIET-VM Hardware Abstraction Layer,
    99// and contains various utility functions, that can be used by both the
    10 // boot code and the kernel code.
     10// boot code and the kernel code (but not by the user applications).
    1111///////////////////////////////////////////////////////////////////////////////////
    1212
     
    150150///////////////////////////////////////////////////////////////////////////////////
    151151///////////////////////////////////////////////////////////////////////////////////
    152 //     Physical addressing related functions
    153 ///////////////////////////////////////////////////////////////////////////////////
    154 ///////////////////////////////////////////////////////////////////////////////////
    155 
     152//     Physical addressing functions
     153///////////////////////////////////////////////////////////////////////////////////
     154///////////////////////////////////////////////////////////////////////////////////
     155
     156////////////////////////////////////////////////////////////////////////////
     157// This function makes a physical read access to a 32 bits word in memory,
     158// after a temporary DTLB de-activation and paddr extension.
     159////////////////////////////////////////////////////////////////////////////
    156160extern unsigned int _physical_read(  unsigned long long paddr );
     161
     162////////////////////////////////////////////////////////////////////////////
     163// This function makes a physical write access to a 32 bits word in memory,
     164// after a temporary DTLB de-activation and paddr extension.
     165////////////////////////////////////////////////////////////////////////////
    157166extern void         _physical_write( unsigned long long paddr,
    158167                                     unsigned int       value );
    159168
     169////////////////////////////////////////////////////////////////////////////
     170// This function makes a physical read access to a 64 bits word in memory,
     171// after a temporary DTLB de-activation and paddr extension.
     172////////////////////////////////////////////////////////////////////////////
    160173extern unsigned long long _physical_read_ull(  unsigned long long paddr );
     174
     175////////////////////////////////////////////////////////////////////////////
     176// This function makes a physical write access to a 64 bits word in memory,
     177// after a temporary DTLB de-activation and paddr extension.
     178////////////////////////////////////////////////////////////////////////////
    161179extern void               _physical_write_ull( unsigned long long paddr,
    162180                                               unsigned long long value );
    163181
     182///////////////////////////////////////////////////////////////////////////////////
     183// This function makes a memcpy from a source buffer to a destination buffer,
     184// using physical addresses, after a temporary DTLB de-activation.
     185// The source and destination buffers must be word aligned, and size must be
     186// multiple of 4 bytes.
     187///////////////////////////////////////////////////////////////////////////////////
    164188extern void         _physical_memcpy( unsigned long long dst_paddr,
    165189                                      unsigned long long src_paddr,
    166190                                      unsigned int       size );
    167191
     192///////////////////////////////////////////////////////////////////////////////////
     193// This function set a data value in all words of a destination buffer,
     194// using physical addresses, after a temporary DTLB de-activation.
     195// The destination buffer must be word aligned, and size multiple of 4 bytes.
     196///////////////////////////////////////////////////////////////////////////////////
     197extern void         _physical_memset( unsigned long long buf_paddr,
     198                                      unsigned int       size,
     199                                      unsigned int       data );
     200
     201///////////////////////////////////////////////////////////////////////////////////
     202// This function is used by several drivers (_xxx_get_register() function).
     203// If the MMU is not activated, the virtual address is extended using
     204// X_IO and Y_IO to reach the cluster_io.
     205///////////////////////////////////////////////////////////////////////////////////
    168206extern unsigned int _io_extended_read(  unsigned int* vaddr );
     207
     208///////////////////////////////////////////////////////////////////////////////////
     209// This function is used by all drivers (_xxx_set_register() function)
     210// If the MMU is not activated, the virtual address is extended using
     211// X_IO and Y_IO to reach the cluster_io.
     212///////////////////////////////////////////////////////////////////////////////////
    169213extern void         _io_extended_write( unsigned int* vaddr,
    170214                                        unsigned int  value );
     
    174218///////////////////////////////////////////////////////////////////////////////////
    175219
     220
     221///////////////////////////////////////////////////////////////////////////////////
     222// Takes a lock with a blocking ll/sc atomic access.
     223// - When the cache coherence is granted by the hardware,
     224//   the first read is a standard (cacheable) lw, as the local copy
     225//   can be polled when the lock is already taken by another task, reducing
     226//   trafic on the interconnect. When the lock is released by the owner task,
     227//   the local copy is updated or invalidated by the coherence protocol.
     228// - If there is no hardware cache coherence a random delay is introduced
     229//   between two successive retry.
     230///////////////////////////////////////////////////////////////////////////////////
    176231extern void         _get_lock(giet_lock_t* lock);
     232
     233///////////////////////////////////////////////////////////////////////////////////
     234// Release a previouly taken lock.
     235///////////////////////////////////////////////////////////////////////////////////
    177236extern void         _release_lock(giet_lock_t* lock);
     237
    178238
    179239///////////////////////////////////////////////////////////////////////////////////
     
    190250extern void         _getc( char*        byte );       
    191251
     252
    192253///////////////////////////////////////////////////////////////////////////////////
    193254//     Scheduler and task context access functions
    194255///////////////////////////////////////////////////////////////////////////////////
    195256
     257
     258///////////////////////////////////////////////////////////////////////////////////
     259// Returns index of the currently running task from the processor scheduler.
     260///////////////////////////////////////////////////////////////////////////////////
    196261extern unsigned int _get_current_task_id(void);
    197262
    198 extern unsigned int _get_task_slot( unsigned int gpid,
     263////////////////////////////////////////////////////////////////////////////////////
     264// This function returns the content of a context slot
     265// for a task identified by the ltid argument (local task index),
     266// and a processor identified by the (x,y,p) arguments.
     267////////////////////////////////////////////////////////////////////////////////////
     268extern unsigned int _get_task_slot( unsigned int x,
     269                                    unsigned int y,
     270                                    unsigned int p,
    199271                                    unsigned int ltid,
    200272                                    unsigned int slot );
    201 extern void         _set_task_slot( unsigned int gpid,
     273
     274////////////////////////////////////////////////////////////////////////////////////
     275// This function updates the content of a context slot
     276// for any task identified by the ltid argument (local task index),
     277// and a processor identified by the (x,y,p) arguments.
     278////////////////////////////////////////////////////////////////////////////////////
     279extern void         _set_task_slot( unsigned int x,
     280                                    unsigned int y,
     281                                    unsigned int p,
    202282                                    unsigned int ltid,
    203283                                    unsigned int slot,
    204284                                    unsigned int value );
    205285
     286////////////////////////////////////////////////////////////////////////////////////
     287// This function returns the content of a context slot for the running task.
     288////////////////////////////////////////////////////////////////////////////////////
    206289extern unsigned int _get_context_slot( unsigned int slot );
     290
     291////////////////////////////////////////////////////////////////////////////////////
     292// This function updates the content of a context slot for the running task.
     293////////////////////////////////////////////////////////////////////////////////////
    207294extern void         _set_context_slot( unsigned int slot,
    208295                                       unsigned int value );
Note: See TracChangeset for help on using the changeset viewer.