Rev 3678 | Rev 3826 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3678 | Rev 3692 | ||
---|---|---|---|
Line 296... | Line 296... | ||
296 | { |
296 | { |
297 | unsigned int ac = ofw_get_address_cells(ofw_memory) / |
297 | unsigned int ac = ofw_get_address_cells(ofw_memory) / |
298 | (sizeof(uintptr_t) / sizeof(uint32_t)); |
298 | (sizeof(uintptr_t) / sizeof(uint32_t)); |
299 | unsigned int sc = ofw_get_size_cells(ofw_memory) / |
299 | unsigned int sc = ofw_get_size_cells(ofw_memory) / |
300 | (sizeof(uintptr_t) / sizeof(uint32_t)); |
300 | (sizeof(uintptr_t) / sizeof(uint32_t)); |
301 | printf("address cells: %d, size cells: %d. ", ac, sc); |
- | |
302 | 301 | ||
303 | uintptr_t buf[((ac + sc) * MEMMAP_MAX_RECORDS)]; |
302 | uintptr_t buf[((ac + sc) * MEMMAP_MAX_RECORDS)]; |
304 | int ret = ofw_get_property(ofw_memory, "reg", buf, sizeof(buf)); |
303 | int ret = ofw_get_property(ofw_memory, "reg", buf, sizeof(buf)); |
305 | if (ret <= 0) /* ret is the number of written bytes */ |
304 | if (ret <= 0) /* ret is the number of written bytes */ |
306 | return false; |
305 | return false; |
Line 403... | Line 402... | ||
403 | /* required in order to be able to make a method call */ |
402 | /* required in order to be able to make a method call */ |
404 | ihandle screen = ofw_open(device_name); |
403 | ihandle screen = ofw_open(device_name); |
405 | if (screen == -1) |
404 | if (screen == -1) |
406 | return false; |
405 | return false; |
407 | 406 | ||
408 | /* setup the palette so that the 3:2:3 scheme is usable */ |
407 | /* setup the palette so that the (inverted) 3:2:3 scheme is usable */ |
409 | unsigned int i; |
408 | unsigned int i; |
410 | for (i = 0; i < 256; i++) |
409 | for (i = 0; i < 256; i++) |
411 | if (ofw_call("call-method", 6, 1, NULL, "color!", screen, |
410 | if (ofw_call("call-method", 6, 1, NULL, "color!", screen, |
412 | i, |
411 | 255 - i, |
413 | i << 5, |
412 | i << 5, |
414 | (i >> 3) << 6, |
413 | (i >> 3) << 6, |
415 | (i >> 5) << 5) != 0); |
414 | (i >> 5) << 5) != 0); |
416 | return true; |
415 | return true; |
417 | } |
416 | } |