/trunk/boot/tools/ia32/gen_vga323.c |
---|
1,8 → 1,36 |
/* |
* Copyright (c) 2008 Martin Decky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <stdio.h> |
#define RED(i) ((i >> 5) & ((1 << 3) - 1)) |
#define GREEN(i) ((i >> 3) & ((1 << 2) - 1)) |
#define BLUE(i) (i & ((1 << 3) - 1)) |
#define RED(i) (((i) >> 5) & ((1 << 3) - 1)) |
#define GREEN(i) (((i) >> 3) & ((1 << 2) - 1)) |
#define BLUE(i) ((i) & ((1 << 3) - 1)) |
int main(int argc, char *argv[]) { |
unsigned int i; |
/trunk/boot/genarch/ofw.h |
---|
123,7 → 123,7 |
extern int ofw_memmap(memmap_t *map); |
extern int ofw_screen(screen_t *screen); |
extern int ofw_macio(macio_t *macio); |
extern int setup_palette(void); |
extern int ofw_setup_palette(void); |
extern void ofw_quiesce(void); |
#endif |
/trunk/boot/genarch/ofw.c |
---|
372,6 → 372,12 |
return true; |
} |
#define RED(i) (((i) >> 5) & ((1 << 3) - 1)) |
#define GREEN(i) (((i) >> 3) & ((1 << 2) - 1)) |
#define BLUE(i) ((i) & ((1 << 3) - 1)) |
#define CLIP(i) ((i) <= 255 ? (i) : 255) |
/** |
* Sets up the palette for the 8-bit color depth configuration so that the |
* 3:2:3 color scheme can be used. Checks that setting the palette makes sense |
379,8 → 385,9 |
* than 8). |
* |
* @return true if the palette has been set, false otherwise |
* |
*/ |
int setup_palette(void) |
int ofw_setup_palette(void) |
{ |
char device_name[BUF_SIZE]; |
407,11 → 414,8 |
/* setup the palette so that the (inverted) 3:2:3 scheme is usable */ |
unsigned int i; |
for (i = 0; i < 256; i++) |
if (ofw_call("call-method", 6, 1, NULL, "color!", screen, |
255 - i, |
i << 5, |
(i >> 3) << 6, |
(i >> 5) << 5) != 0); |
ofw_call("call-method", 6, 1, NULL, "color!", screen, |
255 - i, CLIP(BLUE(i) * 37), GREEN(i) * 85, CLIP(RED(i) * 37)); |
return true; |
} |
/trunk/boot/arch/sparc64/loader/main.c |
---|
269,7 → 269,7 |
printf("done.\n"); |
#endif |
setup_palette(); |
ofw_setup_palette(); |
printf("\nBooting the kernel...\n"); |
jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, |
/trunk/boot/arch/ppc32/loader/main.c |
---|
176,6 → 176,8 |
fix_overlap(&trans, &trans_pa, "translation table", &top); |
fix_overlap(&bootinfo, &bootinfo_pa, "boot info", &top); |
ofw_setup_palette(); |
printf("\nBooting the kernel...\n"); |
jump_to_kernel(bootinfo_pa, sizeof(bootinfo), trans_pa, pages << PAGE_WIDTH, real_mode_pa, (void *) bootinfo.screen.addr, bootinfo.screen.scanline); |
} |