source: trunk/softs/giet_tsar/stdio.h @ 628

Last change on this file since 628 was 626, checked in by cfuguet, 11 years ago

Introducing generic soft_sort_giet application for the
GIET nano-kernel.

It uses the number of clusters and the number of processors
defined in the hard_config.h file to deduce the number of
threads executing the application.

File size: 3.7 KB
Line 
1////////////////////////////////////////////////////////////////////////////////////////
2// File : stdio.h
3// Written by Alain Greiner
4// Date : 17/01/2014
5//
6// This file define varions functions that can be used by applications to access
7// peripherals, or other ressources such as processor registers, spin_locks
8// or synchronisation barriers.
9// It is dedicated for the TSAR multi-processors multi_clusters architecture.
10// There is NO separation between application code and system code.
11// This basic GIET does not use the virtual memory, and does nort support multi-tasking.
12//
13//The supported peripherals are:
14//- the SoClib multi_tty
15//- The SoCLib frame_buffer
16//- The SoCLib block_device
17//
18//The following parameters must be defined in the hard_config.h file.
19//- X_SIZE          : number of clusters in a row
20//- Y_SIZE          : number of clusters in a column
21//- X_WIDTH         : number of bits for X field in proc_id
22//- Y_WIDTH         : number of bits for Y field in proc_id
23//- NB_PROCS_MAX    : max number of processor per cluster
24//- NB_TTY_CHANNELS : max number of TTY channels
25//
26//The follobing base addresses must be defined in the ldscript
27//- seg_tty_base
28//- seg_fbf_base
29//- seg_ioc_base
30////////////////////////////////////////////////////////////////////////////////////////
31
32#ifndef _GIET_STDIO_H_
33#define _GIET_STDIO_H_
34
35#include "tty.h"
36#include "block_device.h"
37#include "hard_config.h"
38#include <stdarg.h>
39
40typedef unsigned int    size_t;
41
42// global variables defined in stdio.c
43
44extern  int volatile    _ioc_lock;
45extern  int volatile    _ioc_done;
46extern  int volatile    _ioc_status;
47
48extern  char volatile   _tty_get_buf[];
49extern  int volatile    _tty_get_full[];
50
51extern int volatile     _barrier_value[];
52extern int volatile     _barrier_count[];
53extern int volatile     _barrier_lock[];
54
55extern int volatile     _spin_lock[];
56
57// functions defined in stdio.c
58
59void*           _memcpy( void* dst, const void* src, size_t size );
60
61unsigned int    _procid();
62unsigned int    _proctime();
63unsigned int    _procnumber();
64
65unsigned int    _rand();
66
67void            _it_mask();
68void            _it_enable();
69
70void            _dcache_buf_invalidate( const void* buffer, size_t size );
71
72void            _exit();
73
74void            _itoa_dec( unsigned int val, char* buf );
75void            _itoa_hex( unsigned int val, char* buf );
76
77int             _tty_write( char* buffer, size_t length, size_t channel );
78int             _tty_read( char* buffer, size_t channel );
79void            _tty_puts( char* string );
80void            _tty_putd( unsigned int val );
81void            _tty_putx( unsigned int val );
82void            _tty_get_lock( size_t channel );
83void            _tty_release_lock( size_t channel );
84void            _tty_getc( char* buffer );
85void            _tty_getw( unsigned int* buffer );
86void            _tty_printf( char* format, ... );
87
88void            _ioc_get_lock();
89void            _ioc_write( size_t lba, void* buffer, size_t count, size_t ext );
90void            _ioc_read (size_t lba, void* buffer, size_t count, size_t ext );
91void            _ioc_completed();
92void            _ioc_isr();
93
94void            _mmc_isr();
95
96void            _fb_sync_write( size_t offset, void* buffer, size_t length, size_t ext );
97void            _fb_sync_read( size_t offset, void* buffer, size_t length, size_t ext );
98
99void            _release_lock( size_t lock_index );
100void            _get_lock( size_t lock_index );
101
102void            _barrier_init(size_t index, size_t count);
103void            _barrier_wait(size_t index);
104
105#endif
106
107// Local Variables:
108// tab-width: 4;
109// c-basic-offset: 4;
110// c-file-offsets:((innamespace . 0)(inline-open . 0));
111// indent-tabs-mode: nil;
112// End:
113//
114// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
115
Note: See TracBrowser for help on using the repository browser.