Patrick Georgi | 1e916e0 | 2011-01-28 07:54:11 +0000 | [diff] [blame] | 1 | #include <assert.h> |
| 2 | #include "cmos_lowlevel.h" |
| 3 | |
| 4 | static void mem_hal_init(void* data); |
| 5 | static unsigned char mem_hal_read(unsigned addr); |
| 6 | static void mem_hal_write(unsigned addr, unsigned char value); |
| 7 | static void mem_set_iopl(int level); |
| 8 | |
| 9 | static unsigned char* mem_hal_data = (unsigned char*)-1; |
| 10 | static void mem_hal_init(void *data) |
| 11 | { |
| 12 | mem_hal_data = data; |
| 13 | } |
| 14 | |
| 15 | static unsigned char mem_hal_read(unsigned index) |
| 16 | { |
| 17 | assert(mem_hal_data != (unsigned char*)-1); |
| 18 | return mem_hal_data[index]; |
| 19 | } |
| 20 | |
| 21 | static void mem_hal_write(unsigned index, unsigned char value) |
| 22 | { |
| 23 | assert(mem_hal_data != (unsigned char*)-1); |
| 24 | mem_hal_data[index] = value; |
| 25 | } |
| 26 | |
| 27 | static void mem_set_iopl(__attribute__ ((unused)) int level) |
| 28 | { |
| 29 | } |
| 30 | |
| 31 | cmos_access_t memory_hal = { |
| 32 | .init = mem_hal_init, |
| 33 | .read = mem_hal_read, |
| 34 | .write = mem_hal_write, |
| 35 | .set_iopl = mem_set_iopl, |
| 36 | }; |