[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 */ |
---|
[165] | 14 | unsigned int giet_procid(); |
---|
| 15 | unsigned int giet_proctime(); |
---|
[158] | 16 | |
---|
| 17 | /* TTY device related functions */ |
---|
[165] | 18 | unsigned int giet_tty_putc(char byte); |
---|
| 19 | unsigned int giet_tty_puts(char *buf); |
---|
| 20 | unsigned int giet_tty_putw(unsigned int val); |
---|
| 21 | unsigned int giet_tty_getc_no_irq(char *byte); |
---|
| 22 | unsigned int giet_tty_getc(char *byte); |
---|
| 23 | unsigned int giet_tty_gets(char *buf, unsigned int bufsize); |
---|
| 24 | unsigned int giet_tty_getw(unsigned int *val); |
---|
| 25 | unsigned int giet_tty_printf(char *format,...); |
---|
[158] | 26 | |
---|
| 27 | /* GCD coprocessor related functions */ |
---|
[165] | 28 | unsigned int giet_gcd_set_opa(unsigned int val); |
---|
| 29 | unsigned int giet_gcd_set_opb(unsigned int val); |
---|
| 30 | unsigned int giet_gcd_start(); |
---|
| 31 | unsigned int giet_gcd_get_result(unsigned int *val); |
---|
| 32 | unsigned int giet_gcd_get_status(unsigned int *val); |
---|
[158] | 33 | |
---|
| 34 | /* Block device related functions */ |
---|
[165] | 35 | unsigned int giet_ioc_read( unsigned int lba, |
---|
| 36 | void* buffer, |
---|
| 37 | unsigned int count); |
---|
| 38 | unsigned int giet_ioc_write(unsigned int lba, |
---|
| 39 | void* buffer, |
---|
| 40 | unsigned int count); |
---|
| 41 | unsigned int giet_ioc_completed(); |
---|
[158] | 42 | |
---|
| 43 | /* Frame buffer device related functions */ |
---|
[165] | 44 | unsigned int giet_fb_sync_read( unsigned int offset, |
---|
| 45 | void* buffer, |
---|
| 46 | unsigned int length ); |
---|
| 47 | unsigned int giet_fb_sync_write(unsigned int offset, |
---|
| 48 | void* buffer, |
---|
| 49 | unsigned int length ); |
---|
| 50 | unsigned int giet_fb_read( unsigned int offset, |
---|
| 51 | void* buffer, |
---|
| 52 | unsigned int length ); |
---|
| 53 | unsigned int giet_fb_write( unsigned int offset, |
---|
| 54 | void* buffer, |
---|
| 55 | unsigned int length ); |
---|
| 56 | unsigned int giet_fb_completed(); |
---|
[158] | 57 | |
---|
| 58 | /* Misc */ |
---|
[165] | 59 | unsigned int giet_vobj_get_vbase( char* vspace_name, |
---|
| 60 | char* vobj_name, |
---|
| 61 | unsigned int vobj_type, |
---|
| 62 | unsigned int* vobj_vaddr ); |
---|
| 63 | void giet_exit(); |
---|
| 64 | unsigned int giet_rand(); |
---|
[158] | 65 | unsigned int ctx_switch(); |
---|
[165] | 66 | unsigned int giet_procnumber(); |
---|
[158] | 67 | |
---|
| 68 | /* |
---|
| 69 | * memcpy function |
---|
[165] | 70 | * This function is required because it can be gnerated by GCC |
---|
| 71 | * during compilation so we must provide it. |
---|
[158] | 72 | * Code taken from MutekH. |
---|
| 73 | */ |
---|
| 74 | static 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 | |
---|