source: soft/giet_vm/libs/stdio.h @ 163

Last change on this file since 163 was 160, checked in by karaoui, 12 years ago

giet-vm new version

File size: 3.1 KB
RevLine 
[158]1//////////////////////////////////////////////////////////////////////////////////
2// File     : stdio.h         
3// Date     : 01/04/2010
4// Author   : alain greiner & Joel Porquet
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////////
7
8#ifndef _STDIO_H
9#define _STDIO_H
10
[160]11#include <mapping_info.h>
12
[158]13/* MIPS32 related functions */
14unsigned int procid();
15unsigned int proctime();
16unsigned int procnumber();
17
18/* TTY device related functions */
19unsigned int tty_putc(char byte);
20unsigned int tty_puts(char *buf);
21unsigned int tty_putw(unsigned int val);
22unsigned int tty_getc(char *byte);
23unsigned int tty_getc_irq(char *byte);
24unsigned int tty_gets_irq(char *buf, unsigned int bufsize);
25unsigned int tty_getw_irq(unsigned int *val);
26unsigned int tty_printf(char *format,...);
27
28/* Timer device related functions */
29unsigned int timer_set_mode(unsigned int mode);
30unsigned int timer_set_period(unsigned int period);
31unsigned int timer_reset_irq();
32unsigned int timer_get_time(unsigned int *time);
33
34/* GCD coprocessor related functions */
35unsigned int gcd_set_opa(unsigned int val);
36unsigned int gcd_set_opb(unsigned int val);
37unsigned int gcd_start();
38unsigned int gcd_get_result(unsigned int *val);
39unsigned int gcd_get_status(unsigned int *val);
40
41/* Block device related functions */
42unsigned int ioc_read(unsigned int lba, void *buffer, unsigned int count);
43unsigned int ioc_write(unsigned int lba, void *buffer, unsigned int count);
44unsigned int ioc_completed();
45
46/* Frame buffer device related functions */
47unsigned int fb_sync_read(unsigned int offset, void *buffer, unsigned int length);
48unsigned int fb_sync_write(unsigned int offset, void *buffer, unsigned int length);
49unsigned int fb_read(unsigned int offset, void *buffer, unsigned int length);
50unsigned int fb_write(unsigned int offset, void *buffer, unsigned int length);
51unsigned int fb_completed();
52
53/* Software barrier related functions */
54unsigned int barrier_init(unsigned int index, unsigned int count);
55unsigned int barrier_wait(unsigned int index);
56
57/* Misc */
58void exit();
59unsigned int rand();
60unsigned int ctx_switch();
[160]61unsigned int vobj_get_vbase( char* vspace_name, char* vobj_name,
62                        unsigned int vobj_type, unsigned int* vobj_buffer);
[158]63
64/*
65 * memcpy function
66 *
67 * This function is likely not to be called directly but GCC can automatically
68 * issue call to it during compilation so we must provide it. 'static inline'
69 * so the function's code is directly included when used.
70 *
71 * Code taken from MutekH.
72 */
73static inline void *memcpy(void *_dst, const void *_src, unsigned int size)
74{
75    unsigned int *dst = _dst;
76    const unsigned int *src = _src;
77
78    /* if source and destination buffer are word-aligned,
79     * then copy word-by-word */
80    if (!((unsigned int)dst & 3) && !((unsigned int)src & 3))
81        while (size > 3) {
82            *dst++ = *src++;
83            size -= 4;
84        }
85
86    unsigned char *cdst = (unsigned char*)dst;
87    unsigned char *csrc = (unsigned char*)src;
88
89    /* byte-by-byte copy */
90    while (size--) {
91        *cdst++ = *csrc++;
92    }
93    return _dst;
94}
95
96#endif
97
Note: See TracBrowser for help on using the repository browser.