Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3617 → Rev 3618

/branches/sparc/kernel/genarch/include/fb/fb.h
38,8 → 38,34
#include <arch/types.h>
#include <synch/spinlock.h>
 
/**
* Properties of the framebuffer device.
*/
typedef struct fb_properties {
/** Physical address of the framebuffer device (as returned by OBP) */
uintptr_t addr;
 
/**
* Address where the first (top left) pixel is mapped,
* relative to "addr"
*/
unsigned int fb_start;
 
/** Screen width in pixels */
unsigned int x;
 
/** Screen height in pixels */
unsigned int y;
 
/** Bytes per one scanline */
unsigned int scan;
 
/** Color model */
unsigned int visual;
} fb_properties_t;
 
SPINLOCK_EXTERN(fb_lock);
void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int scan, unsigned int visual);
void fb_init(fb_properties_t *props);
 
#endif
 
/branches/sparc/kernel/genarch/src/fb/fb.c
436,17 → 436,12
 
/** Initialize framebuffer as a chardev output device
*
* @param addr Physical address of the framebuffer
* @param x Screen width in pixels
* @param y Screen height in pixels
* @param scan Bytes per one scanline
* @param visual Color model
* @param props properties of the framebuffer device
*
*/
void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int scan,
unsigned int visual)
void fb_init(fb_properties_t *props)
{
switch (visual) {
switch (props->visual) {
case VISUAL_INDIRECT_8:
rgb2scr = rgb_byte8;
scr2rgb = byte8_rgb;
486,19 → 481,20
panic("Unsupported visual.\n");
}
unsigned int fbsize = scan * y;
unsigned int fbsize = (props->scan) * (props->y) + (props->fb_start);
/* Map the framebuffer */
fbaddress = (uint8_t *) hw_map((uintptr_t) addr, fbsize);
fbaddress = (uint8_t *) hw_map((uintptr_t) (props->addr), fbsize);
fbaddress += props->fb_start;
xres = x;
yres = y;
scanline = scan;
xres = props->x;
yres = props->y;
scanline = props->scan;
rows = y / FONT_SCANLINES;
columns = x / COL_WIDTH;
rows = (props->y) / FONT_SCANLINES;
columns = (props->x) / COL_WIDTH;
 
fb_parea.pbase = (uintptr_t) addr;
fb_parea.pbase = (uintptr_t) (props->addr);
fb_parea.vbase = (uintptr_t) fbaddress;
fb_parea.frames = SIZE2FRAMES(fbsize);
fb_parea.cacheable = false;
508,9 → 504,9
sysinfo_set_item_val("fb.kind", NULL, 1);
sysinfo_set_item_val("fb.width", NULL, xres);
sysinfo_set_item_val("fb.height", NULL, yres);
sysinfo_set_item_val("fb.scanline", NULL, scan);
sysinfo_set_item_val("fb.visual", NULL, visual);
sysinfo_set_item_val("fb.address.physical", NULL, addr);
sysinfo_set_item_val("fb.scanline", NULL, (props->scan));
sysinfo_set_item_val("fb.visual", NULL, (props->visual));
sysinfo_set_item_val("fb.address.physical", NULL, (props->addr));
sysinfo_set_item_val("fb.invert-colors", NULL, invert_colors);
 
/* Allocate double buffer */
524,6 → 520,7
blankline = (uint8_t *) malloc(ROW_BYTES, FRAME_ATOMIC);
if (!blankline)
panic("Failed to allocate blank line for framebuffer.");
unsigned int x, y;
for (y = 0; y < FONT_SCANLINES; y++)
for (x = 0; x < xres; x++)
(*rgb2scr)(&blankline[POINTPOS(x, y)], COLOR(BGCOLOR));
/branches/sparc/kernel/genarch/src/ofw/ofw_tree.c
209,7 → 209,8
*
* @return NULL if there is no such peer or pointer to the matching peer node.
*/
ofw_tree_node_t *ofw_tree_find_peer_by_name(ofw_tree_node_t *node, const char *name)
ofw_tree_node_t *ofw_tree_find_peer_by_name(ofw_tree_node_t *node,
const char *name)
{
ofw_tree_node_t *cur;
ofw_tree_property_t *prop;