1 | /********************************************************************************* |
---|
2 | fichier stdio.h |
---|
3 | Written Alain greiner & Nicolas Pouillon |
---|
4 | Date : 15/09/2009 |
---|
5 | *********************************************************************************/ |
---|
6 | |
---|
7 | #ifndef _STDIO_H_ |
---|
8 | #define _STDIO_H_ |
---|
9 | |
---|
10 | #define SYSCALL_PROCID 0x00 |
---|
11 | #define SYSCALL_PROCTIME 0x01 |
---|
12 | #define SYSCALL_TTY_WRITE 0x02 |
---|
13 | #define SYSCALL_TTY_READ 0x03 |
---|
14 | #define SYSCALL_TIMER_WRITE 0x04 |
---|
15 | #define SYSCALL_TIMER_READ 0x05 |
---|
16 | #define SYSCALL_GCD_WRITE 0x06 |
---|
17 | #define SYSCALL_GCD_READ 0x07 |
---|
18 | #define SYSCALL_ICU_WRITE 0x08 |
---|
19 | #define SYSCALL_ICU_READ 0x09 |
---|
20 | #define SYSCALL_TTY_READ_IRQ 0x0A |
---|
21 | #define SYSCALL_TTY_WRITE_IRQ 0x0B |
---|
22 | #define SYSCALL_LOCKS_WRITE 0x0C |
---|
23 | #define SYSCALL_LOCKS_READ 0x0D |
---|
24 | #define SYSCALL_EXIT 0x0E |
---|
25 | #define SYSCALL_PROCNUMBER 0x0F |
---|
26 | |
---|
27 | #define SYSCALL_FB_SYNC_WRITE 0x10 |
---|
28 | #define SYSCALL_FB_SYNC_READ 0x11 |
---|
29 | #define SYSCALL_FB_WRITE 0x12 |
---|
30 | #define SYSCALL_FB_READ 0x13 |
---|
31 | #define SYSCALL_FB_COMPLETED 0x14 |
---|
32 | #define SYSCALL_IOC_WRITE 0x15 |
---|
33 | #define SYSCALL_IOC_READ 0x16 |
---|
34 | #define SYSCALL_IOC_COMPLETED 0x17 |
---|
35 | #define SYSCALL_BARRIER_INIT 0x18 |
---|
36 | #define SYSCALL_BARRIER_WAIT 0x19 |
---|
37 | |
---|
38 | typedef unsigned int size_t; |
---|
39 | |
---|
40 | /**************************************************************** |
---|
41 | this is a generic C function to implement all system calls. |
---|
42 | - The first argument is the system call index. |
---|
43 | - The four next arguments are the system call arguments. |
---|
44 | They will be written in registers $2, $4, $5, $6, $7. |
---|
45 | ****************************************************************/ |
---|
46 | int sys_call(int call_no, |
---|
47 | int arg_o, |
---|
48 | int arg_1, |
---|
49 | int arg_2, |
---|
50 | int arg_3); |
---|
51 | |
---|
52 | /**************************************************************** |
---|
53 | These functions access the MIPS protected registers |
---|
54 | ****************************************************************/ |
---|
55 | int procid(); |
---|
56 | int proctime(); |
---|
57 | int procnumber(); |
---|
58 | int exit(); |
---|
59 | int rand(); |
---|
60 | |
---|
61 | /**************************************************************** |
---|
62 | These functions access the MULTI_TTY peripheral |
---|
63 | ****************************************************************/ |
---|
64 | int tty_puts(char* string); |
---|
65 | int tty_putc(char byte); |
---|
66 | int tty_putw(int word); |
---|
67 | int tty_getc(char* byte); |
---|
68 | int tty_getc_irq(char* byte); |
---|
69 | int tty_gets_irq(char* buf, int bufsize); |
---|
70 | int tty_getw_irq(int* word); |
---|
71 | int tty_printf(char* format,...); |
---|
72 | |
---|
73 | /**************************************************************** |
---|
74 | These functions access the MULTI_TIMER peripheral |
---|
75 | ****************************************************************/ |
---|
76 | int timer_set_mode(int timer_index, int mode); |
---|
77 | int timer_set_period(int timer_index, int period); |
---|
78 | int timer_reset_irq(int timer_index); |
---|
79 | int timer_get_time(int timer_index, int* time); |
---|
80 | |
---|
81 | /**************************************************************** |
---|
82 | These functions access the GCD peripheral |
---|
83 | ****************************************************************/ |
---|
84 | int gcd_set_opa(int val); |
---|
85 | int gcd_set_opb(int val); |
---|
86 | int gcd_start(); |
---|
87 | int gcd_get_result(int* val); |
---|
88 | int gcd_get_status(int* val); |
---|
89 | |
---|
90 | /**************************************************************** |
---|
91 | These functions access the ICU peripheral |
---|
92 | ****************************************************************/ |
---|
93 | int icu_set_mask(int val); |
---|
94 | int icu_clear_mask(int val); |
---|
95 | int icu_get_mask(int* buffer); |
---|
96 | int icu_get_irqs(int* buffer); |
---|
97 | int icu_get_index(int* buffer); |
---|
98 | |
---|
99 | /**************************************************************** |
---|
100 | These functions access the LOCKS peripheral |
---|
101 | ****************************************************************/ |
---|
102 | int lock_acquire(int lock_index); |
---|
103 | int lock_release(int lock_index); |
---|
104 | |
---|
105 | /**************************************************************** |
---|
106 | These functions access the BLOCK_DEVICE peripheral |
---|
107 | ****************************************************************/ |
---|
108 | int ioc_read(size_t lba, void* buffer, size_t count); |
---|
109 | int ioc_write(size_t lba, void* buffer, size_t count); |
---|
110 | int ioc_completed(); |
---|
111 | |
---|
112 | /**************************************************************** |
---|
113 | These functions access the FRAME_BUFFER peripheral |
---|
114 | ****************************************************************/ |
---|
115 | int fb_read(size_t offset, void* buffer, size_t length); |
---|
116 | int fb_write(size_t offset, void* buffer, size_t length); |
---|
117 | int fb_completed(); |
---|
118 | int fb_sync_read(size_t offset, void* buffer, size_t length); |
---|
119 | int fb_sync_write(size_t offset, void* buffer, size_t length); |
---|
120 | |
---|
121 | /**************************************************************** |
---|
122 | These functions access the synchronization barriers |
---|
123 | ****************************************************************/ |
---|
124 | int barrier_init(size_t index, size_t count); |
---|
125 | int barrier_wait(size_t index); |
---|
126 | |
---|
127 | #endif |
---|
128 | |
---|
129 | // Local Variables: |
---|
130 | // tab-width: 4; |
---|
131 | // c-basic-offset: 4; |
---|
132 | // c-file-offsets:((innamespace . 0)(inline-open . 0)); |
---|
133 | // indent-tabs-mode: nil; |
---|
134 | // End: |
---|
135 | // |
---|
136 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
137 | |
---|