| 1 | /**************************************************************************************** | 
|---|
| 2 | File : drivers.h | 
|---|
| 3 | Written by Alain Greiner & Nicolas Pouillon | 
|---|
| 4 | Date : september 2009 | 
|---|
| 5 |  | 
|---|
| 6 | These system calls are used by the MIPS GIET, that is running | 
|---|
| 7 | on the MIPS32 processor architecture. | 
|---|
| 8 |  | 
|---|
| 9 | The supported peripherals are: | 
|---|
| 10 | - the SoClib vci_multi_tty | 
|---|
| 11 | - the SocLib vci_multi_timer | 
|---|
| 12 | - the SocLib vci_dma | 
|---|
| 13 | - The SoCLib vci_icu | 
|---|
| 14 | - The SoCLib vci_gcd | 
|---|
| 15 | - The SoCLib vci_frame_buffer | 
|---|
| 16 | - The SoCLib vci_block_device | 
|---|
| 17 | ****************************************************************************************/ | 
|---|
| 18 |  | 
|---|
| 19 | #ifndef _DRIVERS_H_ | 
|---|
| 20 | #define _DRIVERS_H_ | 
|---|
| 21 |  | 
|---|
| 22 | #include "tty.h" | 
|---|
| 23 | #include "dma.h" | 
|---|
| 24 | #include "gcd.h" | 
|---|
| 25 | #include "timer.h" | 
|---|
| 26 | #include "icu.h" | 
|---|
| 27 | #include "block_device.h" | 
|---|
| 28 |  | 
|---|
| 29 | typedef unsigned int    size_t; | 
|---|
| 30 |  | 
|---|
| 31 | // global variables defined in giet.s | 
|---|
| 32 |  | 
|---|
| 33 | extern  unsigned int    _task_context_array[]; | 
|---|
| 34 | extern  unsigned int    _current_task_array[]; | 
|---|
| 35 | extern  unsigned int    _task_number_array[]; | 
|---|
| 36 |  | 
|---|
| 37 | // function defined in giet.s | 
|---|
| 38 |  | 
|---|
| 39 | void _ctx_switch(); | 
|---|
| 40 |  | 
|---|
| 41 | // global variables defined in drivers.c | 
|---|
| 42 |  | 
|---|
| 43 | extern  int volatile    _dma_status[]; | 
|---|
| 44 | extern  int volatile    _dma_busy[]; | 
|---|
| 45 |  | 
|---|
| 46 | extern  int volatile    _ioc_lock; | 
|---|
| 47 | extern  int volatile    _ioc_done; | 
|---|
| 48 | extern  int volatile    _ioc_status; | 
|---|
| 49 |  | 
|---|
| 50 | extern  char volatile   _tty_get_buf[]; | 
|---|
| 51 | extern  int volatile    _tty_get_full[]; | 
|---|
| 52 |  | 
|---|
| 53 | extern  char volatile   _tty_put_buf[]; | 
|---|
| 54 | extern  int volatile    _tty_put_full[]; | 
|---|
| 55 |  | 
|---|
| 56 | // functions defined in drivers.c | 
|---|
| 57 |  | 
|---|
| 58 | unsigned int    _procid(); | 
|---|
| 59 | unsigned int    _proctime(); | 
|---|
| 60 | unsigned int    _procnumber(); | 
|---|
| 61 |  | 
|---|
| 62 | unsigned int    _segment_increment(); | 
|---|
| 63 |  | 
|---|
| 64 | void _itoa_dec(unsigned int val, char* buf); | 
|---|
| 65 | void _itoa_hex(int val, char* buf); | 
|---|
| 66 |  | 
|---|
| 67 | int _exit(); | 
|---|
| 68 |  | 
|---|
| 69 | int _timer_write(size_t timer_index, size_t register_index, int value); | 
|---|
| 70 | int _timer_read(size_t timer_index, size_t register_index, int* buffer); | 
|---|
| 71 |  | 
|---|
| 72 | int _tty_write(char* buffer, int length); | 
|---|
| 73 | int _tty_read(char* buffer, int length); | 
|---|
| 74 |  | 
|---|
| 75 | int _io_write(size_t lba, void* buffer, size_t count); | 
|---|
| 76 | int _io_read(size_t lba, void* buffer, size_t count); | 
|---|
| 77 | int _io_completed(); | 
|---|
| 78 |  | 
|---|
| 79 | int _icu_write(size_t register_index, int  value); | 
|---|
| 80 | int _icu_read(size_t register_index, int*  buffer); | 
|---|
| 81 |  | 
|---|
| 82 | int _gcd_write(size_t register_index, int  value); | 
|---|
| 83 | int _gcd_read(size_t register_index, int*  buffer); | 
|---|
| 84 |  | 
|---|
| 85 | int _locks_write(size_t lock_index); | 
|---|
| 86 | int _locks_read(size_t lock_index); | 
|---|
| 87 |  | 
|---|
| 88 | int _fb_sync_write(size_t offset, void* buffer, size_t length); | 
|---|
| 89 | int _fb_sync_read(size_t offset, void* buffer, size_t length); | 
|---|
| 90 |  | 
|---|
| 91 | int _fb_write(size_t offset, void* buffer, size_t length); | 
|---|
| 92 | int _fb_read(size_t offset, void* buffer, size_t length); | 
|---|
| 93 | int _fb_completed(); | 
|---|
| 94 |  | 
|---|
| 95 | int _barrier_init(size_t index, size_t count); | 
|---|
| 96 | int _barrier_wait(size_t index); | 
|---|
| 97 |  | 
|---|
| 98 | #endif | 
|---|
| 99 |  | 
|---|
| 100 | // Local Variables: | 
|---|
| 101 | // tab-width: 4; | 
|---|
| 102 | // c-basic-offset: 4; | 
|---|
| 103 | // c-file-offsets:((innamespace . 0)(inline-open . 0)); | 
|---|
| 104 | // indent-tabs-mode: nil; | 
|---|
| 105 | // End: | 
|---|
| 106 | // | 
|---|
| 107 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 | 
|---|
| 108 |  | 
|---|