Rev 1896 | Rev 1899 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1896 | Rev 1897 | ||
|---|---|---|---|
| Line 35... | Line 35... | ||
| 35 | #include <ofw.h> |
35 | #include <ofw.h> |
| 36 | #include <printf.h> |
36 | #include <printf.h> |
| 37 | #include <string.h> |
37 | #include <string.h> |
| 38 | #include "main.h" |
38 | #include "main.h" |
| 39 | 39 | ||
| 40 | int bpp2align[] = { |
- | |
| 41 | [0] = 0, /** Invalid bpp. */ |
- | |
| 42 | [1] = 1, /** 8bpp is not aligned. */ |
- | |
| 43 | [2] = 2, /** 16bpp is naturally aligned. */ |
- | |
| 44 | [3] = 4, /** 24bpp is aligned on 4 byte boundary. */ |
- | |
| 45 | [4] = 4, /** 32bpp is naturally aligned. */ |
- | |
| 46 | }; |
- | |
| 47 | - | ||
| 48 | void write(const char *str, const int len) |
40 | void write(const char *str, const int len) |
| 49 | { |
41 | { |
| 50 | int i; |
42 | int i; |
| 51 | 43 | ||
| 52 | for (i = 0; i < len; i++) { |
44 | for (i = 0; i < len; i++) { |
| Line 59... | Line 51... | ||
| 59 | int ofw_translate_failed(ofw_arg_t flag) |
51 | int ofw_translate_failed(ofw_arg_t flag) |
| 60 | { |
52 | { |
| 61 | return flag != -1; |
53 | return flag != -1; |
| 62 | } |
54 | } |
| 63 | 55 | ||
| 64 | int ofw_keyboard(keyboard_t *keyboard) |
- | |
| 65 | { |
- | |
| 66 | char device_name[BUF_SIZE]; |
- | |
| 67 | uint32_t virtaddr; |
- | |
| 68 | - | ||
| 69 | if (ofw_get_property(ofw_aliases, "keyboard", device_name, sizeof(device_name)) <= 0) |
- | |
| 70 | return false; |
- | |
| 71 | - | ||
| 72 | phandle device = ofw_find_device(device_name); |
- | |
| 73 | if (device == -1) |
- | |
| 74 | return false; |
- | |
| 75 | - | ||
| 76 | if (ofw_get_property(device, "address", &virtaddr, sizeof(virtaddr)) <= 0) |
- | |
| 77 | return false; |
- | |
| 78 | - | ||
| 79 | if (!(keyboard->addr = ofw_translate((void *) ((uintptr_t) virtaddr)))) |
- | |
| 80 | return false; |
- | |
| 81 | - | ||
| 82 | return true; |
- | |
| 83 | } |
- | |
| 84 | - | ||
| 85 | int ofw_cpu(cpu_t *cpu) |
56 | int ofw_cpu(cpu_t *cpu) |
| 86 | { |
57 | { |
| 87 | char type_name[BUF_SIZE]; |
58 | char type_name[BUF_SIZE]; |
| 88 | 59 | ||
| 89 | phandle node; |
60 | phandle node; |