Changeset 643


Ignore:
Timestamp:
Oct 17, 2019, 3:14:01 PM (4 years ago)
Author:
alain
Message:

Introduce FBF related syscalls.

Location:
trunk/libs
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/libs/libalmosmkh/almosmkh.c

    r641 r643  
    2626#include <hal_macros.h>
    2727#include <hal_shared_types.h>
     28#include <shared_fbf.h>
    2829#include <syscalls_numbers.h>
    2930#include <string.h>
     
    14511452}  // end pthread_parallel_create()
    14521453
     1454/////////////////////////////////////////////////////////////////////////////////////////
     1455///////////////    non standard Frame Buffer related syscalls
     1456/////////////////////////////////////////////////////////////////////////////////////////
     1457
     1458/////////////////////////////////
     1459int fbf_get_config( int * width,
     1460                    int * height,
     1461                    int * type )
     1462{
     1463    return hal_user_syscall( SYS_FBF,
     1464                             FBF_GET_CONFIG,
     1465                             (reg_t)width,
     1466                             (reg_t)height,                           
     1467                             (reg_t)type );                           
     1468}
     1469
     1470////////////////////////////
     1471int fbf_read( void * buffer,
     1472              int    length,
     1473              int    offset )
     1474{
     1475    return hal_user_syscall( SYS_FBF,
     1476                             FBF_READ,
     1477                             (reg_t)buffer,
     1478                             (reg_t)length,                           
     1479                             (reg_t)offset );                         
     1480}
     1481
     1482////////////////////////////
     1483int fbf_write( void * buffer,
     1484               int    length,
     1485               int    offset )
     1486{
     1487    return hal_user_syscall( SYS_FBF,
     1488                             FBF_WRITE,
     1489                             (reg_t)buffer,
     1490                             (reg_t)length,                           
     1491                             (reg_t)offset );   
     1492}
    14531493
    14541494
  • trunk/libs/libalmosmkh/almosmkh.h

    r641 r643  
    380380#define MALLOC_INITIALIZED         0xBABEF00D   // magic number when initialised
    381381#define MALLOC_MIN_BLOCK_SIZE      0x40         // 64 bytes
    382 #define MALLOC_LOCAL_STORE_SIZE    0x800000     // 8 Mbytes     
     382#define MALLOC_LOCAL_STORE_SIZE    0x2000000    // 32 Mbytes     
    383383#define MALLOC_MAX_CLUSTERS        0x100        // 256 clusters
    384384
     
    496496/*****************************************************************************************
    497497 * This blocking function creates N working threads that execute the code defined
    498  * by the <work_func> and <work_args> arguments.
     498 * by the <work_func> and <work_args> arguments, and returns only when all working
     499 * threads completed.
    499500 * The number N of created threads is entirely defined by the <root_level> argument.
    500501 * This value defines an abstract quad-tree, with a square base : level in [0,1,2,3,4],
     
    521522                             void         * parent_barriers_array );
    522523
     524/********* Non standard (ALMOS-MKH specific) Frame Buffer access syscalls   *************/
     525
     526//////////////////////////////////////////////////////////////////////////////////////////
     527// The following system calls can be used to access the SoCLib Frame Buffer, that
     528// is a very simple graphic controller, that is seen by the software as a single
     529// buffer of <height> lines of <width> pixels.
     530//////////////////////////////////////////////////////////////////////////////////////////
     531
     532/*****************************************************************************************
     533 * This function returns in the <width> and <height> arguments the buffer size.
     534 *****************************************************************************************
     535 * @ width   : [out] number of pixels per line.
     536 * @ height  : [out] number of lines.
     537 * @ type    : [out] pixel encoding type.
     538 * @ returns 0 if success / returns -1 if error.
     539 ****************************************************************************************/
     540int fbf_get_config( int * width,
     541                    int * height,
     542                    int * type );
     543
     544/*****************************************************************************************
     545 * This blocking function moves <length> bytes from the frame buffer, starting
     546 * from <offset>, to the user buffer defined by <buffer> argument.
     547 *****************************************************************************************
     548 * @ buffer  : pointer on buffer in user space.
     549 * @ length  : number of pixels (one byte per pixel).
     550 * @ offset  : first pixel index in frame buffer.
     551 * @ returns 0 if success / returns -1 if error.
     552 ****************************************************************************************/
     553int fbf_read( void * buffer,
     554              int    length,
     555              int    offset );
     556
     557/*****************************************************************************************
     558 * This blocking function moves <length> bytes from the user buffer defined by <buffer>
     559 * argument to the frame buffer, starting at <offset> in frame buffer.
     560 *****************************************************************************************
     561 * @ buffer  : pointer on buffer in user space.
     562 * @ length  : number of pixels (one byte per pixel).
     563 * @ offset  : first pixel index in frame buffer.
     564 * @ returns 0 if success / returns -1 if error.
     565 ****************************************************************************************/
     566int fbf_write( void * buffer,
     567               int    length,
     568               int    offset );
     569
    523570#endif /* _LIBALMOSMKH_H_ */
    524571
  • trunk/libs/mini-libc/stdio.c

    r628 r643  
    399399}  // end fclose()
    400400
     401//////////////////////////////////////////
     402unsigned int fread( void         * buffer,
     403                    unsigned int   size,
     404                    unsigned int   nitems,
     405                    FILE         * stream )
     406{
     407    // check stream valid
     408    if( stream->key != VALID_OPEN_FILE ) return EOF;
     409
     410    // get file descriptor from stream pointer
     411    int fd = stream->fd;
     412
     413    // compute nbytes
     414    unsigned int nbytes = size * nitems;
     415
     416    if( hal_user_syscall( SYS_READ,
     417                          (reg_t)fd,
     418                          (reg_t)buffer,
     419                          (reg_t)nbytes, 0 ) == nbytes ) return nitems;
     420    else return 0;
     421
     422}  // end fread()
     423
     424//////////////////////////////////////////
     425unsigned int fwrite( void         * buffer,
     426                     unsigned int   size,
     427                     unsigned int   nitems,
     428                     FILE         * stream )
     429{
     430    // check stream valid
     431    if( stream->key != VALID_OPEN_FILE ) return EOF;
     432
     433    // get file descriptor from stream pointer
     434    int fd = stream->fd;
     435
     436    // compute nbytes
     437    unsigned int nbytes = size * nitems;
     438
     439    if( hal_user_syscall( SYS_WRITE,
     440                          (reg_t)fd,
     441                          (reg_t)buffer,
     442                          (reg_t)nbytes, 0 ) == nbytes ) return nitems;
     443    else return 0;
     444
     445}  // end fwrite()
     446
    401447/////////////////////////////////
    402448int fprintf( FILE       * stream,
  • trunk/libs/mini-libc/stdio.h

    r637 r643  
    141141             const char * format, ... );
    142142
     143/*********************************************************************************************
     144 * This function moves <nitems> oblects, each <size> bytes long, from an input stream
     145 * identified by <stream>, to the user buffer identified by the <buffer> argument.
     146 * It can be a regular file or a character oriented input device.
     147 *********************************************************************************************
     148 * @ stream    : pointer on a stream.
     149 * @ format    : formated string.
     150 * @ returns actual number of items read if success / returns 0 if failure.
     151 ********************************************************************************************/
     152unsigned int fread( void         * buffer,
     153                    unsigned int   size,
     154                    unsigned int   nitems,
     155                    FILE         * stream ); 
     156
     157/*********************************************************************************************
     158 * This function moves <nitems> oblects, each <size> bytes long, from an user buffer
     159 * identified by the <buffer> argument, to an output stream identified by <stream>.
     160 * It can be a  regular file or a character oriented input device.
     161 *********************************************************************************************
     162 * @ stream    : pointer on a stream.
     163 * @ format    : formated string.
     164 * @ returns actual number of written items if success / returns 0 if failure.
     165 ********************************************************************************************/
     166unsigned int fwrite( void         * buffer,
     167                     unsigned int   size,
     168                     unsigned int   nitems,
     169                     FILE         * stream ); 
    143170
    144171#endif  // _STDIO_H_
  • trunk/libs/mini-libc/stdlib.h

    r476 r643  
    3939 * This function terminates a process.
    4040 *****************************************************************************************
    41  * @ status   : terminaison status : 0 / EXIT_SUCCESS / EXIT_FAILURE.
     41 * @ status   : terminaison status : EXIT_SUCCESS / EXIT_FAILURE.
    4242 ****************************************************************************************/
    4343void exit( int status );
Note: See TracChangeset for help on using the changeset viewer.