Changeset 253 for soft/giet_vm/libs


Ignore:
Timestamp:
Aug 14, 2013, 11:19:29 PM (11 years ago)
Author:
alain
Message:

1/ introducing support to display images on the frame buffer
with the vci_chbuf_dma (in stdio.c and drivers.c)
2/ introducing support for mem_cache configuration segment
as the memory cache is considered as another addressable peripheral type
(in drivers.c)
3/ Introducing the new "increment" parameter in the mapping header.
This parameter define the virtual address increment for the vsegs
associated to the replicated peripherals (ICU, XICU, MDMA, TIMER, MMC).
This parameter is mandatory, and all map.xml files the "mappings"
directory have been updated.

Location:
soft/giet_vm/libs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/libs/mwmr_channel.h

    r228 r253  
    1515///////////////////////////////////////////////////////////////////////////////////
    1616
    17 typedef struct mwmr_channel_s {
     17typedef struct mwmr_channel_s
     18{
    1819    unsigned int ptr;        // index of the first valid data word
    1920    unsigned int ptw;        // index of the first empty slot
  • soft/giet_vm/libs/stdio.c

    r238 r253  
    1313#include <stdio.h>
    1414
    15 #define SYSCALL_PROCID          0x00
    16 #define SYSCALL_PROCTIME        0x01
    17 #define SYSCALL_TTY_WRITE       0x02
    18 #define SYSCALL_TTY_READ        0x03
    19 #define SYSCALL_TIMER_START     0x04
    20 #define SYSCALL_TIMER_STOP      0x05
    21 #define SYSCALL_GCD_WRITE       0x06
    22 #define SYSCALL_GCD_READ        0x07
    23 #define SYSCALL_HEAP_INFO       0x08
    24 #define SYSCALL_PROC_TASK_ID    0x09
    25 #define SYSCALL_GLOBAL_TASK_ID  0x0A
    26 #define SYSCALL_CTX_SWITCH      0x0D
    27 #define SYSCALL_EXIT            0x0E
    28 #define SYSCALL_PROC_NUMBER     0x0F
    29 #define SYSCALL_FB_SYNC_WRITE   0x10
    30 #define SYSCALL_FB_SYNC_READ    0x11
    31 #define SYSCALL_FB_WRITE        0x12
    32 #define SYSCALL_FB_READ         0x13
    33 #define SYSCALL_FB_COMPLETED    0x14
    34 #define SYSCALL_IOC_WRITE       0x15
    35 #define SYSCALL_IOC_READ        0x16
    36 #define SYSCALL_IOC_COMPLETED   0x17
    37 #define SYSCALL_IOC_BLOCK_SIZE  0x18
    38 #define SYSCALL_VOBJ_GET_VBASE  0x1A
    39 #define SYSCALL_NIC_WRITE       0x1B
    40 #define SYSCALL_NIC_READ        0x1C
    41 #define SYSCALL_NIC_COMPLETED   0x1D
     15#define SYSCALL_PROCID            0x00
     16#define SYSCALL_PROCTIME          0x01
     17#define SYSCALL_TTY_WRITE         0x02
     18#define SYSCALL_TTY_READ          0x03
     19#define SYSCALL_TIMER_START       0x04
     20#define SYSCALL_TIMER_STOP        0x05
     21#define SYSCALL_GCD_WRITE         0x06
     22#define SYSCALL_GCD_READ          0x07
     23#define SYSCALL_HEAP_INFO         0x08
     24#define SYSCALL_LOCAL_TASK_ID     0x09
     25#define SYSCALL_GLOBAL_TASK_ID    0x0A
     26#define SYSCALL_FB_CMA_INIT       0x0B
     27#define SYSCALL_FB_CMA_WRITE      0x0C
     28#define SYSCALL_FB_CMA_STOP       0x0D
     29#define SYSCALL_EXIT              0x0E
     30#define SYSCALL_PROC_NUMBER       0x0F
     31#define SYSCALL_FB_SYNC_WRITE     0x10
     32#define SYSCALL_FB_SYNC_READ      0x11
     33#define SYSCALL_FB_DMA_WRITE      0x12
     34#define SYSCALL_FB_DMA_READ       0x13
     35#define SYSCALL_FB_DMA_COMPLETED  0x14
     36#define SYSCALL_IOC_WRITE         0x15
     37#define SYSCALL_IOC_READ          0x16
     38#define SYSCALL_IOC_COMPLETED     0x17
     39#define SYSCALL_IOC_BLOCK_SIZE    0x18
     40#define SYSCALL_CTX_SWITCH        0x19
     41#define SYSCALL_VOBJ_GET_VBASE    0x1A
     42#define SYSCALL_NIC_CMA_RX_INIT   0x1B
     43#define SYSCALL_NIC_CMA_TX_INIT   0x1C
     44#define SYSCALL_NIC_CMA_STOP      0x1D
     45#define SYSCALL_NIC_SYNC_READ     0x1E
     46#define SYSCALL_NIC_SYNC_WRITE    0x1F
    4247
    4348//////////////////////////////////////////////////////////////////////////////////
     
    4752// and tells GCC what has been modified by system call execution.
    4853//////////////////////////////////////////////////////////////////////////////////
    49 static inline unsigned int sys_call(unsigned int call_no,
    50         unsigned int arg_0,
    51         unsigned int arg_1,
    52         unsigned int arg_2,
    53         unsigned int arg_3) {
     54static inline unsigned int sys_call( unsigned int call_no,
     55                                     unsigned int arg_0,
     56                                     unsigned int arg_1,
     57                                     unsigned int arg_2,
     58                                     unsigned int arg_3 )
     59{
    5460    register unsigned int reg_no_and_output asm("v0") = call_no;
    5561    register unsigned int reg_a0 asm("a0") = arg_0;
     
    109115
    110116
    111 //////     TTY device related system calls /////
     117//////  TTY device related system calls /////
    112118
    113119////////////////////////////////////////////////////////////////////////////////////
     
    123129    return sys_call(SYSCALL_TTY_WRITE, (unsigned int) (&byte), 1, 0, 0);
    124130}
    125 
    126 
    127131////////////////////////////////////////////////////////////////////////////////////
    128132// giet_tty_puts()
     
    140144    return sys_call(SYSCALL_TTY_WRITE, (unsigned int) buf, length, 0, 0);
    141145}
    142 
    143 
    144146////////////////////////////////////////////////////////////////////////////////////
    145147// giet_tty_putw()
     
    161163    return sys_call(SYSCALL_TTY_WRITE, (unsigned int) buf, 10, 0, 0);
    162164}
    163 
    164 
    165165////////////////////////////////////////////////////////////////////////////////////
    166166// giet_tty_getc()
     
    180180    return 0;
    181181}
    182 
    183 
    184182////////////////////////////////////////////////////////////////////////////////////
    185183// giet_tty_gets()
     
    226224    return 0;
    227225}
    228 
    229 
    230226////////////////////////////////////////////////////////////////////////////////////
    231227// giet_tty_getw()
     
    325321    return 0;
    326322}
    327 
    328 
    329323////////////////////////////////////////////////////////////////////////////////////
    330324// giet_tty_printf()
     
    448442// - Returns 0 if success, > 0 if error.
    449443//////////////////////////////////////////////////////////////////////////////////
    450 unsigned int giet_timer_start() {
     444unsigned int giet_timer_start()
     445{
    451446    return sys_call(SYSCALL_TIMER_START, 0, 0, 0, 0);
    452447}
    453 
    454 
    455448//////////////////////////////////////////////////////////////////////////////////
    456449// giet_timer_stop()
     
    459452// - Returns 0 if success, > 0 if error.
    460453//////////////////////////////////////////////////////////////////////////////////
    461 unsigned int giet_timer_stop() {
     454unsigned int giet_timer_stop()
     455{
    462456    return sys_call(SYSCALL_TIMER_STOP, 0, 0, 0, 0);
    463457}
     
    477471// - Returns 0 if success, > 0 if error.
    478472//////////////////////////////////////////////////////////////////////////////////
    479 unsigned int giet_gcd_set_opa(unsigned int val) {
     473unsigned int giet_gcd_set_opa(unsigned int val)
     474{
    480475    return sys_call(SYSCALL_GCD_WRITE, GCD_OPA, val, 0, 0);
    481476}
    482 
    483 
    484477//////////////////////////////////////////////////////////////////////////////////
    485478//     giet_gcd_set_opb()
     
    488481// - Returns 0 if success, > 0 if error.
    489482//////////////////////////////////////////////////////////////////////////////////
    490 unsigned int giet_gcd_set_opb(unsigned int val) {
     483unsigned int giet_gcd_set_opb(unsigned int val)
     484{
    491485    return sys_call(SYSCALL_GCD_WRITE, GCD_OPB, val, 0, 0);
    492486}
    493 
    494 
    495487//////////////////////////////////////////////////////////////////////////////////
    496488//     giet_gcd_start()
     
    499491// - Returns 0 if success, > 0 if error.
    500492//////////////////////////////////////////////////////////////////////////////////
    501 unsigned int giet_gcd_start() {
     493unsigned int giet_gcd_start()
     494{
    502495    return sys_call(SYSCALL_GCD_WRITE, GCD_START, 0, 0, 0);
    503496}
    504 
    505 
    506497//////////////////////////////////////////////////////////////////////////////////
    507498//     giet_gcd_get_status()
     
    510501// - The value is 0 when the coprocessor is idle (computation completed).
    511502//////////////////////////////////////////////////////////////////////////////////
    512 unsigned int giet_gcd_get_status(unsigned int * val) {
     503unsigned int giet_gcd_get_status(unsigned int * val)
     504{
    513505    return sys_call(SYSCALL_GCD_READ, GCD_STATUS, (unsigned int) val, 0, 0);
    514506}
    515 
    516 
    517507//////////////////////////////////////////////////////////////////////////////////
    518508//     giet_gcd_get_result()
     
    520510// This function gets the result of the computation from the GCD coprocessor.
    521511//////////////////////////////////////////////////////////////////////////////////
    522 unsigned int giet_gcd_get_result(unsigned int * val) {
     512unsigned int giet_gcd_get_result(unsigned int * val)
     513{
    523514    return sys_call(SYSCALL_GCD_READ, GCD_OPA, (unsigned int) val, 0, 0);
    524515}
     
    536527// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    537528//////////////////////////////////////////////////////////////////////////////////
    538 unsigned int giet_ioc_write( unsigned int lba, void * buffer, unsigned int count) {
     529unsigned int giet_ioc_write( unsigned int lba,
     530                             void *       buffer,
     531                             unsigned int count)
     532{
    539533    return sys_call(SYSCALL_IOC_WRITE, lba, (unsigned int) buffer, count, 0);
    540534}
    541 
    542 
    543535//////////////////////////////////////////////////////////////////////////////////
    544536// giet_ioc_read()
     
    550542// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    551543//////////////////////////////////////////////////////////////////////////////////
    552 unsigned int giet_ioc_read(unsigned int lba, void * buffer, unsigned int count) {
     544unsigned int giet_ioc_read( unsigned int lba,
     545                            void *       buffer,
     546                            unsigned int count )
     547{
    553548    return sys_call(SYSCALL_IOC_READ, lba, (unsigned int) buffer, count, 0);
    554549}
    555 
    556 
    557550//////////////////////////////////////////////////////////////////////////////////
    558551// giet_ioc_completed()
     
    561554// successfully completed, and returns 1 if an address error has been detected.
    562555//////////////////////////////////////////////////////////////////////////////////
    563 unsigned int giet_ioc_completed() {
     556unsigned int giet_ioc_completed()
     557{
    564558    return sys_call(SYSCALL_IOC_COMPLETED, 0, 0, 0, 0);
    565559}
    566 
    567 
    568560//////////////////////////////////////////////////////////////////////////////////
    569561// giet_ioc_block_size()
     
    571563// This blocking function returns the block_size (in bytes) of the block device
    572564//////////////////////////////////////////////////////////////////////////////////
    573 unsigned int giet_ioc_block_size() {
     565unsigned int giet_ioc_block_size()
     566{
    574567    return sys_call(SYSCALL_IOC_BLOCK_SIZE, 0, 0, 0, 0);
    575568}
     
    588581// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    589582//////////////////////////////////////////////////////////////////////////////////
    590 unsigned int giet_fb_sync_write(unsigned int offset, void * buffer, unsigned int length) {
     583unsigned int giet_fb_sync_write( unsigned int offset,
     584                                 void *       buffer,
     585                                 unsigned int length )
     586{
    591587    return sys_call(SYSCALL_FB_SYNC_WRITE, offset, (unsigned int) buffer, length, 0);
    592588}
    593 
    594 
    595589//////////////////////////////////////////////////////////////////////////////////
    596590// giet_fb_sync_read()
     
    603597// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    604598//////////////////////////////////////////////////////////////////////////////////
    605 unsigned int giet_fb_sync_read(unsigned int offset, void * buffer, unsigned int length) {
     599unsigned int giet_fb_sync_read( unsigned int offset,
     600                                void *       buffer,
     601                                unsigned int length )
     602{
    606603    return sys_call(SYSCALL_FB_SYNC_READ, offset, (unsigned int) buffer, length, 0);
    607604}
    608 
    609 
    610 //////////////////////////////////////////////////////////////////////////////////
    611 // giet_fb_write()
     605//////////////////////////////////////////////////////////////////////////////////
     606// giet_fb_dma_write()
    612607//////////////////////////////////////////////////////////////////////////////////
    613608// This non-blocking function use the DMA coprocessor to transfer data from a
     
    620615// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    621616//////////////////////////////////////////////////////////////////////////////////
    622 unsigned int giet_fb_write(unsigned int offset, void * buffer, unsigned int length) {
    623     return sys_call(SYSCALL_FB_WRITE, offset, (unsigned int) buffer, length, 0);
    624 }
    625 
    626 
    627 //////////////////////////////////////////////////////////////////////////////////
    628 // giet_fb_read()
     617unsigned int giet_fb_dma_write( unsigned int offset,
     618                                void *       buffer,
     619                                unsigned int length )
     620{
     621    return sys_call(SYSCALL_FB_DMA_WRITE, offset, (unsigned int) buffer, length, 0);
     622}
     623//////////////////////////////////////////////////////////////////////////////////
     624// giet_fb_dma_read()
    629625//////////////////////////////////////////////////////////////////////////////////
    630626// This non-blocking function use the DMA coprocessor to transfer data from the
     
    637633// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    638634//////////////////////////////////////////////////////////////////////////////////
    639 unsigned int giet_fb_read(unsigned int offset, void * buffer, unsigned int length) {
    640     return sys_call(SYSCALL_FB_READ, offset, (unsigned int) buffer, length, 0);
    641 }
    642 
    643 
    644 //////////////////////////////////////////////////////////////////////////////////
    645 // giet_fb_completed()
     635unsigned int giet_fb_dma_read( unsigned int offset,
     636                               void *       buffer,
     637                               unsigned int length )
     638{
     639    return sys_call(SYSCALL_FB_DMA_READ, offset, (unsigned int) buffer, length, 0);
     640}
     641//////////////////////////////////////////////////////////////////////////////////
     642// giet_fb_dma_completed()
    646643//////////////////////////////////////////////////////////////////////////////////
    647644// This blocking function returns when the transfer is completed.
    648645// - Returns 0 if success, > 0 if error.
    649646//////////////////////////////////////////////////////////////////////////////////
    650 unsigned int giet_fb_completed() {
    651     return sys_call(SYSCALL_FB_COMPLETED, 0, 0, 0, 0);
    652 }
    653 
    654 
    655 //////////////////////////////////////////////////////////////////////////////////
    656 // giet_nic_write()
    657 //////////////////////////////////////////////////////////////////////////////////
    658 // This non-blocking function use the DMA coprocessor to transfer data from the
    659 // NIC device to an user buffer.
    660 // - offset : offset (in bytes) in the NIC
    661 // - buffer : base address of the memory buffer
    662 // - length : number of bytes to be transfered
    663 // The transfer completion is signaled by an IRQ, and must be tested by the
    664 // nic_completed() function.
     647unsigned int giet_fb_dma_completed()
     648{
     649    return sys_call(SYSCALL_FB_DMA_COMPLETED, 0, 0, 0, 0);
     650}
     651//////////////////////////////////////////////////////////////////////////////////
     652// giet_fb_cma_init()
     653//////////////////////////////////////////////////////////////////////////////////
     654// This function initializes the two chbuf SRC an DST used by the CMA controller
     655// and activates the CMA channel allocated to the calling task.
     656// - buf0   : first user buffer virtual address
     657// - buf0   : second user buffer virtual address
     658// - length : buffer size (bytes)
     659// - Returns 0 if success, > 0 if error.
     660//////////////////////////////////////////////////////////////////////////////////
     661unsigned int giet_fb_cma_init( void *       buf0,
     662                               void *       buf1,
     663                               unsigned int length )
     664{
     665    return sys_call(SYSCALL_FB_CMA_INIT, (unsigned int)buf0, (unsigned int)buf1, length, 0);
     666}
     667//////////////////////////////////////////////////////////////////////////////////
     668// giet_fb_cma_write()
     669//////////////////////////////////////////////////////////////////////////////////
     670// This function set the valid status for one of the SRC user buffer.
     671// and reset the valid status for the DST frame buffer.
     672// - bufffer_id : 0 => buf0 valid is set / not 0  => buf1 valid is set
     673// - Returns 0 if success, > 0 if error.
     674//////////////////////////////////////////////////////////////////////////////////
     675unsigned int giet_fb_cma_write( unsigned int buffer_id )
     676{
     677    return sys_call(SYSCALL_FB_CMA_WRITE, buffer_id, 0, 0, 0);
     678}
     679//////////////////////////////////////////////////////////////////////////////////
     680// giet_fb_cma_stop()
     681//////////////////////////////////////////////////////////////////////////////////
     682// This function desactivates the CMA channel allocated to the calling task.
     683// - Returns 0 if success, > 0 if error.
     684//////////////////////////////////////////////////////////////////////////////////
     685unsigned int giet_fb_cma_stop( )
     686{
     687    return sys_call(SYSCALL_FB_CMA_STOP, 0, 0, 0, 0);
     688}
     689
     690
     691//////// NIC related system calls ////////
     692
     693//////////////////////////////////////////////////////////////////////////////////
     694// giet_nic_cma_rx_init()
     695//////////////////////////////////////////////////////////////////////////////////
     696// This function initializes the two chbuf SRC an DST used by the CMA controller
     697// and activates the NIC RX channel allocated to the calling task, and the
     698// CMA channel used for RX transfer.
     699// - buf0   : first user buffer virtual address
     700// - buf0   : second user buffer virtual address
     701// - length : buffer size (bytes)
    665702// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    666703//////////////////////////////////////////////////////////////////////////////////
    667 
    668 unsigned int giet_nic_write(unsigned int offset, void * buffer, unsigned int length) {
    669     return sys_call(SYSCALL_NIC_WRITE, offset, (unsigned int) buffer, length, 0);
    670 }
    671 
    672 
    673 //////////////////////////////////////////////////////////////////////////////////
    674 // giet_nic_read()
    675 //////////////////////////////////////////////////////////////////////////////////
    676 // This non-blocking function use the DMA coprocessor to transfer data from the
    677 // NIC device to an user buffer.
    678 // - offset : offset (in bytes) in the NIC
    679 // - buffer : base address of the memory buffer
    680 // - length : number of bytes to be transfered
    681 // The transfer completion is signaled by an IRQ, and must be tested by the
    682 // nic_completed() function.
     704unsigned int giet_nic_cma_rx_init( void *       buf0,
     705                                   void *       buf1,
     706                                   unsigned int length )
     707{
     708    return sys_call(SYSCALL_NIC_CMA_RX_INIT, (unsigned int)buf0, (unsigned int)buf1, length, 0);
     709}
     710//////////////////////////////////////////////////////////////////////////////////
     711// giet_nic_cma_tx_init()
     712//////////////////////////////////////////////////////////////////////////////////
     713// This function initializes the two chbuf SRC an DST used by the CMA controller
     714// and activates the NIC TX channel allocated to the calling task, and the two
     715// CMA channel used for TX transfer.
     716// - buf0   : first user buffer virtual address
     717// - buf0   : second user buffer virtual address
     718// - length : buffer size (bytes)
    683719// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    684720//////////////////////////////////////////////////////////////////////////////////
    685 
    686 unsigned int giet_nic_read(unsigned int offset, void * buffer, unsigned int length) {
    687     return sys_call(SYSCALL_NIC_READ, offset, (unsigned int) buffer, length, 0);
    688 }
    689 
    690 
    691 //////////////////////////////////////////////////////////////////////////////////
    692 // giet_nic_completed()
    693 //////////////////////////////////////////////////////////////////////////////////
    694 // This blocking function returns when the transfer is completed.
    695 // - Returns 0 if success, > 0 if error.
    696 //////////////////////////////////////////////////////////////////////////////////
    697 unsigned int giet_nic_completed() {
    698     return sys_call(SYSCALL_NIC_COMPLETED, 0, 0, 0, 0);
    699 }
    700 
    701 
    702 ///// Miscellaneous related system calls /////
     721unsigned int giet_nic_cma_tx_init( void *       buf0,
     722                                   void *       buf1,
     723                                   unsigned int length )
     724{
     725    return sys_call(SYSCALL_NIC_CMA_TX_INIT, (unsigned int)buf0, (unsigned int)buf1, length, 0);
     726}
     727//////////////////////////////////////////////////////////////////////////////////
     728// giet_nic_cma_stop()
     729//////////////////////////////////////////////////////////////////////////////////
     730// This function desactivates the NIC channel and the two CMA channels
     731// allocated to the calling task.
     732// - Returns 0 if success, > 0 if error.
     733//////////////////////////////////////////////////////////////////////////////////
     734unsigned int giet_nic_cma_stop( )
     735{
     736    return sys_call(SYSCALL_NIC_CMA_STOP, 0, 0, 0, 0);
     737}
     738
     739
     740///// Miscellaneous system calls /////
    703741
    704742//////////////////////////////////////////////////////////////////////////////////
     
    711749// - Returns the address if success,  0 if error ( not defined or wrong type )
    712750//////////////////////////////////////////////////////////////////////////////////
    713 unsigned int giet_vobj_get_vbase(char * vspace_name, char * vobj_name, unsigned int vobj_type, unsigned int * vobj_vaddr) {
     751unsigned int giet_vobj_get_vbase( char*         vspace_name,
     752                                  char*         vobj_name,
     753                                  unsigned int  vobj_type,
     754                                  unsigned int* vobj_vaddr )
     755{
    714756    return sys_call(SYSCALL_VOBJ_GET_VBASE,
    715757            (unsigned int) vspace_name,
     
    718760            (unsigned int) vobj_vaddr);
    719761}
    720 
    721 
    722762////////////////////////////////////////////////////////////////////////////////////
    723763// giet_proc_number()
     
    727767// - Returns 0 if success, > 0 if error ( cluster index too large )
    728768////////////////////////////////////////////////////////////////////////////////////
    729 unsigned int giet_proc_number(unsigned int cluster_id, unsigned int * buffer) {
     769unsigned int giet_proc_number( unsigned int  cluster_id,
     770                               unsigned int* buffer )
     771{
    730772    return sys_call(SYSCALL_PROC_NUMBER, cluster_id, (unsigned int) buffer, 0, 0);
    731773}
    732 
    733 
    734 /////  Miscellaneous system calls /////
    735 
    736 //////////////////////////////////////////////////////////////////////////////////
    737 // giet_task_exit()
     774//////////////////////////////////////////////////////////////////////////////////
     775// giet_exit()
    738776//////////////////////////////////////////////////////////////////////////////////
    739777// This function stops execution of the calling task with a TTY message,
    740 // and enter an infinite loop.
    741 // The task is blocked, but it still consume processor cycles ...
    742 //////////////////////////////////////////////////////////////////////////////////
    743 void giet_exit() {
     778// and the task is descheduled and becomes not runable.
     779// It does not consume processor cycles anymore.
     780//////////////////////////////////////////////////////////////////////////////////
     781void giet_exit()
     782{
    744783    sys_call(SYSCALL_EXIT, 0, 0, 0, 0);
    745784}
    746 
     785//////////////////////////////////////////////////////////////////////////////////
     786// giet_context_switch()
     787// The user task calling this function is descheduled and
     788// the processor is allocated to another task.
     789//////////////////////////////////////////////////////////////////////////////////
     790unsigned int giet_context_switch()
     791{
     792    return sys_call(SYSCALL_CTX_SWITCH, 0, 0, 0, 0);
     793}
     794//////////////////////////////////////////////////////////////////////////////////
     795// giet_proc_task_id()
     796// This functions returns the local task id, i.e. the processor task id (ranging
     797// from 0 to n-1(p) for each processor if p has n tasks)
     798//////////////////////////////////////////////////////////////////////////////////
     799unsigned int giet_proc_task_id()
     800{
     801    return sys_call(SYSCALL_LOCAL_TASK_ID, 0, 0, 0, 0);
     802}
     803//////////////////////////////////////////////////////////////////////////////////
     804// giet_heap_info()
     805// This function returns the base address and size of the current task's heap
     806//////////////////////////////////////////////////////////////////////////////////
     807unsigned int giet_heap_info( unsigned int* vaddr,
     808                             unsigned int* length)
     809{
     810    return sys_call(SYSCALL_HEAP_INFO, (unsigned int)vaddr, (unsigned int)length, 0, 0);
     811}
     812//////////////////////////////////////////////////////////////////////////////////
     813// giet_global_task_id()
     814// This functions returns the global task id, which is unique in all the giet.
     815//////////////////////////////////////////////////////////////////////////////////
     816unsigned int giet_global_task_id()
     817{
     818    return sys_call(SYSCALL_GLOBAL_TASK_ID, 0, 0, 0, 0);
     819}
     820///////////////////////////////////////////////////////////////////////////////////
     821// giet_assert()
     822// This function
     823///////////////////////////////////////////////////////////////////////////////////
     824void giet_assert( unsigned int condition,
     825                  char*        string )
     826{
     827    if ( condition == 0 )
     828    {
     829        giet_tty_puts( string );
     830        giet_exit();
     831    }
     832}
     833
     834////// Pseudo system calls (no syscall instruction) ///////
    747835
    748836///////////////////////////////////////////////////////////////////////////////////
     
    751839// count. This value is comprised between 0 & 65535.
    752840///////////////////////////////////////////////////////////////////////////////////
    753 unsigned int giet_rand() {
     841unsigned int giet_rand()
     842{
    754843    unsigned int x = sys_call(SYSCALL_PROCTIME, 0, 0, 0, 0);
    755844    if ((x & 0xF) > 7) {
     
    761850}
    762851
    763 
    764 //////////////////////////////////////////////////////////////////////////////////
    765 // giet_context_switch()
    766 // The user task calling this function is descheduled and
    767 // the processor is allocated to another task.
    768 //////////////////////////////////////////////////////////////////////////////////
    769 unsigned int giet_context_switch() {
    770     return sys_call(SYSCALL_CTX_SWITCH, 0, 0, 0, 0);
    771 }
    772 
    773 //////////////////////////////////////////////////////////////////////////////////
    774 // giet_proc_task_id()
    775 // This functions returns the local task id, i.e. the processor task id (ranging
    776 // from 0 to n-1(p) for each processor if p has n tasks)
    777 //////////////////////////////////////////////////////////////////////////////////
    778 unsigned int giet_proc_task_id() {
    779     return sys_call(SYSCALL_PROC_TASK_ID, 0, 0, 0, 0);
    780 }
    781 
    782 //////////////////////////////////////////////////////////////////////////////////
    783 // giet_heap_info()
    784 // This function returns the base address and size of the current task's heap
    785 //////////////////////////////////////////////////////////////////////////////////
    786 unsigned int giet_heap_info(unsigned int * vaddr, unsigned int * length) {
    787     return sys_call(SYSCALL_HEAP_INFO, (unsigned int) vaddr, (unsigned int) length, 0, 0);
    788 }
    789 
    790 
    791 //////////////////////////////////////////////////////////////////////////////////
    792 // giet_global_task_id()
    793 // This functions returns the global task id, which is unique in all the giet
    794 //////////////////////////////////////////////////////////////////////////////////
    795 unsigned int giet_global_task_id() {
    796     return sys_call(SYSCALL_GLOBAL_TASK_ID, 0, 0, 0, 0);
    797 }
    798852
    799853// Local Variables:
  • soft/giet_vm/libs/stdio.h

    r237 r253  
    1515/* TTY device related functions */
    1616unsigned int giet_tty_putc(char byte);
    17 unsigned int giet_tty_puts(char * buf);
     17unsigned int giet_tty_puts(char* buf);
    1818unsigned int giet_tty_putw(unsigned int val);
    19 unsigned int giet_tty_getc_no_irq(char * byte);
    20 unsigned int giet_tty_getc(char * byte);
    21 unsigned int giet_tty_gets(char * buf, unsigned int bufsize);
    22 unsigned int giet_tty_getw(unsigned int * val);
    23 unsigned int giet_tty_printf(char * format,...);
     19unsigned int giet_tty_getc_no_irq(char* byte);
     20unsigned int giet_tty_getc(char* byte);
     21unsigned int giet_tty_gets(char* buf, unsigned int bufsize);
     22unsigned int giet_tty_getw(unsigned int* val);
     23unsigned int giet_tty_printf(char* format,...);
    2424
     25/* TIMER device related functions */
     26unsigned int giet_timer_start();
     27unsigned int giet_timer_stop();
     28 
    2529/* GCD coprocessor related functions */
    2630unsigned int giet_gcd_set_opa(unsigned int val);
    2731unsigned int giet_gcd_set_opb(unsigned int val);
    2832unsigned int giet_gcd_start();
    29 unsigned int giet_gcd_get_result(unsigned int * val);
    30 unsigned int giet_gcd_get_status(unsigned int * val);
     33unsigned int giet_gcd_get_result(unsigned int* val);
     34unsigned int giet_gcd_get_status(unsigned int* val);
    3135
    3236/* Block device related functions */
    33 unsigned int giet_ioc_read(unsigned int lba, void * buffer, unsigned int count);
    34 unsigned int giet_ioc_write(unsigned int lba, void * buffer, unsigned int count);
     37unsigned int giet_ioc_read(unsigned int lba, void* buffer, unsigned int count);
     38unsigned int giet_ioc_write(unsigned int lba, void* buffer, unsigned int count);
    3539unsigned int giet_ioc_completed();
    3640unsigned int giet_ioc_block_size();
    3741
    3842/* Frame buffer device related functions */
    39 unsigned int giet_fb_sync_read(unsigned int offset, void * buffer, unsigned int length );
    40 unsigned int giet_fb_sync_write(unsigned int offset, void * buffer, unsigned int length);
    41 unsigned int giet_fb_read(unsigned int offset, void * buffer, unsigned int length);
    42 unsigned int giet_fb_write(unsigned int offset, void * buffer, unsigned int length);
    43 unsigned int giet_nic_write(unsigned int offset, void * buffer, unsigned int length);
    44 unsigned int giet_nic_read(unsigned int offset, void * buffer, unsigned int length);
    45 unsigned int giet_fb_completed();
    46 unsigned int giet_nic_completed();
     43unsigned int giet_fb_sync_read(unsigned int offset, void* buffer, unsigned int length );
     44unsigned int giet_fb_sync_write(unsigned int offset, void* buffer, unsigned int length);
     45unsigned int giet_fb_dma_read(unsigned int offset, void* buffer, unsigned int length);
     46unsigned int giet_fb_dma_write(unsigned int offset, void* buffer, unsigned int length);
     47unsigned int giet_fb_dma_completed();
     48unsigned int giet_fb_cma_init(void* buf0, void* buf1, unsigned int length);
     49unsigned int giet_fb_cma_write(unsigned int buf_id);
     50unsigned int giet_fb_cma_stop();
     51
     52/* Network controller relate functions */
     53unsigned int giet_nic_cma_rx_init(void* buf0, void* buf1, unsigned int length);
     54unsigned int giet_nic_cma_tx_init(void* buf0, void* buf1, unsigned int length);
     55unsigned int giet_nic_cma_stop();
    4756
    4857/* Misc */
    49 unsigned int giet_vobj_get_vbase(char * vspace_name, char * vobj_name, unsigned int vobj_type, unsigned int * vobj_vaddr);
     58unsigned int giet_vobj_get_vbase(char* vspace_name, char* vobj_name,
     59                                 unsigned int vobj_type, unsigned int* vobj_vaddr);
     60unsigned int giet_procnumber();
    5061void giet_exit();
    51 unsigned int giet_rand();
    5262unsigned int giet_context_switch();
    5363unsigned int giet_proc_task_id();
    54 unsigned int giet_heap_info(unsigned int * vaddr, unsigned int * size);
     64unsigned int giet_heap_info(unsigned int* vaddr, unsigned int* size);
    5565unsigned int giet_global_task_id();
    56 
    57 unsigned int giet_procnumber();
     66void giet_assert( unsigned int, char* string);
     67unsigned int giet_rand();
    5868
    5969#endif
Note: See TracChangeset for help on using the changeset viewer.