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

Last change on this file since 165 was 165, checked in by alain, 12 years ago

Introducing various modifications in kernel initialisation

File size: 3.2 KB
Line 
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
11#include <mapping_info.h>
12
13/* MIPS32 related functions */
14unsigned int giet_procid();
15unsigned int giet_proctime();
16
17/* TTY device related functions */
18unsigned int giet_tty_putc(char byte);
19unsigned int giet_tty_puts(char *buf);
20unsigned int giet_tty_putw(unsigned int val);
21unsigned int giet_tty_getc_no_irq(char *byte);
22unsigned int giet_tty_getc(char *byte);
23unsigned int giet_tty_gets(char *buf, unsigned int bufsize);
24unsigned int giet_tty_getw(unsigned int *val);
25unsigned int giet_tty_printf(char *format,...);
26
27/* GCD coprocessor related functions */
28unsigned int giet_gcd_set_opa(unsigned int val);
29unsigned int giet_gcd_set_opb(unsigned int val);
30unsigned int giet_gcd_start();
31unsigned int giet_gcd_get_result(unsigned int *val);
32unsigned int giet_gcd_get_status(unsigned int *val);
33
34/* Block device related functions */
35unsigned int giet_ioc_read( unsigned int        lba, 
36                            void*                       buffer, 
37                            unsigned int        count);
38unsigned int giet_ioc_write(unsigned int        lba, 
39                            void*                       buffer, 
40                            unsigned int        count);
41unsigned int giet_ioc_completed();
42
43/* Frame buffer device related functions */
44unsigned int giet_fb_sync_read( unsigned int    offset, 
45                                void*                   buffer, 
46                                unsigned int    length );
47unsigned int giet_fb_sync_write(unsigned int    offset, 
48                                void*                   buffer, 
49                                unsigned int    length );
50unsigned int giet_fb_read(      unsigned int    offset, 
51                                void*                   buffer, 
52                                unsigned int    length );
53unsigned int giet_fb_write(     unsigned int    offset, 
54                                void*                   buffer, 
55                                unsigned int    length );
56unsigned int giet_fb_completed();
57
58/* Misc */
59unsigned int giet_vobj_get_vbase( char* vspace_name, 
60                                  char* vobj_name,
61                                  unsigned int vobj_type, 
62                                  unsigned int* vobj_vaddr );
63void         giet_exit();
64unsigned int giet_rand();
65unsigned int ctx_switch();
66unsigned int giet_procnumber();
67
68/*
69 * memcpy function
70 * This function is required because it can be gnerated by GCC
71 * during compilation so we must provide it.
72 * Code taken from MutekH.
73 */
74static inline void *memcpy(void *_dst, const void *_src, unsigned int size)
75{
76    unsigned int *dst = _dst;
77    const unsigned int *src = _src;
78
79    /* if source and destination buffer are word-aligned,
80     * then copy word-by-word */
81    if (!((unsigned int)dst & 3) && !((unsigned int)src & 3))
82        while (size > 3) {
83            *dst++ = *src++;
84            size -= 4;
85        }
86
87    unsigned char *cdst = (unsigned char*)dst;
88    unsigned char *csrc = (unsigned char*)src;
89
90    /* byte-by-byte copy */
91    while (size--) {
92        *cdst++ = *csrc++;
93    }
94    return _dst;
95}
96
97#endif
98
Note: See TracBrowser for help on using the repository browser.