Changeset d9fae235 in mainline for uspace/srv/hid/fb


Ignore:
Timestamp:
2010-04-17T01:28:38Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9d6bfa5
Parents:
9256ad29
Message:

sysinfo overhaul

  • cleanup (nicer data structures, use of SLAB allocator)
  • add support for storing arbitrary binary data
  • properly reimplement non-constant values (generated by functions)
  • add support for non-constant subtrees (generated by functions)
  • syscall ABI change, libc API change
  • reflect changes in user code

libc: task_spawn() can now return error code

  • reflect change in user code, print error strings after failed task_spawn()

uspace cleanup

  • more use of string and other constants
  • more use of str_error()
  • unify error reporting in init
Location:
uspace/srv/hid/fb
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/fb/ega.c

    r9256ad29 rd9fae235  
    415415        void *ega_ph_addr;
    416416        size_t sz;
    417 
    418         ega_ph_addr = (void *) sysinfo_value("fb.address.physical");
    419         scr_width = sysinfo_value("fb.width");
    420         scr_height = sysinfo_value("fb.height");
    421 
    422         if (sysinfo_value("fb.blinking")) {
     417       
     418        sysarg_t paddr;
     419        if (sysinfo_get_value("fb.address.physical", &paddr) != EOK)
     420                return -1;
     421       
     422        sysarg_t width;
     423        if (sysinfo_get_value("fb.width", &width) != EOK)
     424                return -1;
     425       
     426        sysarg_t height;
     427        if (sysinfo_get_value("fb.width", &height) != EOK)
     428                return -1;
     429       
     430        sysarg_t blinking;
     431        if (sysinfo_get_value("fb.blinking", &blinking) != EOK)
     432                blinking = false;
     433       
     434        ega_ph_addr = (void *) paddr;
     435        scr_width = width;
     436        scr_height = height;
     437        if (blinking) {
    423438                ega_normal_color &= 0x77;
    424439                ega_inverted_color &= 0x77;
    425440        }
    426 
     441       
    427442        style = NORMAL_COLOR;
    428 
     443       
    429444        iospace_enable(task_get_id(), (void *) EGA_IO_BASE, 2);
    430 
     445       
    431446        sz = scr_width * scr_height * 2;
    432447        scr_addr = as_get_mappable_page(sz);
    433 
     448       
    434449        if (physmem_map(ega_ph_addr, scr_addr, ALIGN_UP(sz, PAGE_SIZE) >>
    435450            PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE) != 0)
  • uspace/srv/hid/fb/fb.c

    r9256ad29 rd9fae235  
    17561756        async_set_client_connection(fb_client_connection);
    17571757       
    1758         void *fb_ph_addr = (void *) sysinfo_value("fb.address.physical");
    1759         unsigned int fb_offset = sysinfo_value("fb.offset");
    1760         unsigned int fb_width = sysinfo_value("fb.width");
    1761         unsigned int fb_height = sysinfo_value("fb.height");
    1762         unsigned int fb_scanline = sysinfo_value("fb.scanline");
    1763         unsigned int fb_visual = sysinfo_value("fb.visual");
    1764 
    1765         unsigned int fbsize = fb_scanline * fb_height;
     1758        sysarg_t fb_ph_addr;
     1759        if (sysinfo_get_value("fb.address.physical", &fb_ph_addr) != EOK)
     1760                return -1;
     1761       
     1762        sysarg_t fb_offset;
     1763        if (sysinfo_get_value("fb.offset", &fb_offset) != EOK)
     1764                fb_offset = 0;
     1765       
     1766        sysarg_t fb_width;
     1767        if (sysinfo_get_value("fb.width", &fb_width) != EOK)
     1768                return -1;
     1769       
     1770        sysarg_t fb_height;
     1771        if (sysinfo_get_value("fb.height", &fb_height) != EOK)
     1772                return -1;
     1773       
     1774        sysarg_t fb_scanline;
     1775        if (sysinfo_get_value("fb.scanline", &fb_scanline) != EOK)
     1776                return -1;
     1777       
     1778        sysarg_t fb_visual;
     1779        if (sysinfo_get_value("fb.visual", &fb_visual) != EOK)
     1780                return -1;
     1781       
     1782        sysarg_t fbsize = fb_scanline * fb_height;
    17661783        void *fb_addr = as_get_mappable_page(fbsize);
    1767 
    1768         if (physmem_map(fb_ph_addr + fb_offset, fb_addr,
     1784       
     1785        if (physmem_map((void *) fb_ph_addr + fb_offset, fb_addr,
    17691786            ALIGN_UP(fbsize, PAGE_SIZE) >> PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE) != 0)
    17701787                return -1;
    1771 
     1788       
    17721789        if (screen_init(fb_addr, fb_width, fb_height, fb_scanline, fb_visual))
    17731790                return 0;
    1774 
     1791       
    17751792        return -1;
    17761793}
  • uspace/srv/hid/fb/main.c

    r9256ad29 rd9fae235  
    6060int main(int argc, char *argv[])
    6161{
    62         printf(NAME ": HelenOS Framebuffer service\n");
     62        printf("%s: HelenOS Framebuffer service\n", NAME);
    6363       
    64         ipcarg_t phonead;
    6564        bool initialized = false;
     65        sysarg_t fb_present;
     66        sysarg_t fb_kind;
     67       
     68        if (sysinfo_get_value("fb", &fb_present) != EOK)
     69                fb_present = false;
     70       
     71        if (sysinfo_get_value("fb.kind", &fb_kind) != EOK) {
     72                printf("%s: Unable to detect framebuffer configuration\n", NAME);
     73                return -1;
     74        }
    6675       
    6776#ifdef FB_ENABLED
    68         if (sysinfo_value("fb.kind") == 1) {
     77        if ((!initialized) && (fb_kind == 1)) {
    6978                if (fb_init() == 0)
    7079                        initialized = true;
     
    7281#endif
    7382#ifdef EGA_ENABLED
    74         if ((!initialized) && (sysinfo_value("fb.kind") == 2)) {
     83        if ((!initialized) && (fb_kind == 2)) {
    7584                if (ega_init() == 0)
    7685                        initialized = true;
     
    7887#endif
    7988#ifdef MSIM_ENABLED
    80         if ((!initialized) && (sysinfo_value("fb.kind") == 3)) {
     89        if ((!initialized) && (fb_kind == 3)) {
    8190                if (msim_init() == 0)
    8291                        initialized = true;
     
    8493#endif
    8594#ifdef SGCN_ENABLED
    86         if ((!initialized) && (sysinfo_value("fb.kind") == 4)) {
     95        if ((!initialized) && (fb_kind == 4)) {
    8796                if (sgcn_init() == 0)
    8897                        initialized = true;
     
    9099#endif
    91100#ifdef NIAGARA_ENABLED
    92         if ((!initialized) && (sysinfo_value("fb.kind") == 5)) {
     101        if ((!initialized) && (fb_kind == 5)) {
    93102                if (niagara_init() == 0)
    94103                        initialized = true;
     
    96105#endif
    97106#ifdef SKI_ENABLED
    98         if ((!initialized) && (sysinfo_value("fb") != true)) {
     107        if ((!initialized) && (!fb_present)) {
    99108                if (ski_init() == 0)
    100109                        initialized = true;
     
    105114                return -1;
    106115       
     116        ipcarg_t phonead;
    107117        if (ipc_connect_to_me(PHONE_NS, SERVICE_VIDEO, 0, 0, &phonead) != 0)
    108118                return -1;
    109119       
    110         printf(NAME ": Accepting connections\n");
     120        printf("%s: Accepting connections\n", NAME);
    111121        async_manager();
    112122       
  • uspace/srv/hid/fb/msim.c

    r9256ad29 rd9fae235  
    2929
    3030/** @defgroup msimfb MSIM text console
    31  * @brief       HelenOS MSIM text console.
     31 * @brief HelenOS MSIM text console.
    3232 * @ingroup fbs
    3333 * @{
    34  */ 
     34 */
    3535/** @file
    3636 */
     
    4141#include <as.h>
    4242#include <ddi.h>
     43#include <errno.h>
    4344
    4445#include "serial_console.h"
     
    5758int msim_init(void)
    5859{
    59         void *phys_addr = (void *) sysinfo_value("fb.address.physical");
     60        sysarg_t phys_addr;
     61        if (sysinfo_get_value("fb.address.physical", &phys_addr) != EOK)
     62                return -1;
     63       
    6064        virt_addr = (char *) as_get_mappable_page(1);
    6165       
    62         if (physmem_map(phys_addr, virt_addr, 1, AS_AREA_READ | AS_AREA_WRITE) != 0)
     66        if (physmem_map((void *) phys_addr, virt_addr, 1,
     67            AS_AREA_READ | AS_AREA_WRITE) != 0)
    6368                return -1;
    6469       
     
    6974}
    7075
    71 /**
    72  * @}
     76/** @}
    7377 */
  • uspace/srv/hid/fb/niagara.c

    r9256ad29 rd9fae235  
    9191int niagara_init(void)
    9292{
     93        sysarg_t paddr;
     94        if (sysinfo_get_value("niagara.outbuf.address", &paddr) != EOK)
     95                return -1;
     96       
    9397        output_buffer_addr = (uintptr_t) as_get_mappable_page(PAGE_SIZE);
    94         int result = physmem_map(
    95                 (void *) sysinfo_value("niagara.outbuf.address"),
    96                 (void *) output_buffer_addr,
    97                 1, AS_AREA_READ | AS_AREA_WRITE);
     98        int result = physmem_map((void *) paddr,
     99            (void *) output_buffer_addr, 1,
     100            AS_AREA_READ | AS_AREA_WRITE);
    98101
    99102        if (result != 0) {
  • uspace/srv/hid/fb/sgcn.c

    r9256ad29 rd9fae235  
    122122int sgcn_init(void)
    123123{
    124         sram_virt_addr = (uintptr_t) as_get_mappable_page(sysinfo_value("sram.area.size"));
     124        sysarg_t sram_paddr;
     125        if (sysinfo_get_value("sram.address.physical", &sram_paddr) != EOK)
     126                return -1;
    125127       
    126         if (physmem_map((void *) sysinfo_value("sram.address.physical"),
    127             (void *) sram_virt_addr, sysinfo_value("sram.area.size") / PAGE_SIZE,
    128             AS_AREA_READ | AS_AREA_WRITE) != 0)
     128        sysarg_t sram_size;
     129        if (sysinfo_get_value("sram.area.size", &sram_size) != EOK)
     130                return -1;
     131       
     132        if (sysinfo_get_value("sram.buffer.offset", &sram_buffer_offset) != EOK)
     133                sram_buffer_offset = 0;
     134       
     135        sram_virt_addr = (uintptr_t) as_get_mappable_page(sram_size);
     136       
     137        if (physmem_map((void *) sram_paddr, (void *) sram_virt_addr,
     138            sram_size / PAGE_SIZE, AS_AREA_READ | AS_AREA_WRITE) != 0)
    129139                return -1;
    130140       
    131141        serial_console_init(sgcn_putc, WIDTH, HEIGHT);
    132        
    133         sram_buffer_offset = sysinfo_value("sram.buffer.offset");
    134142       
    135143        async_set_client_connection(serial_client_connection);
Note: See TracChangeset for help on using the changeset viewer.