Changeset 00bb6965 in mainline


Ignore:
Timestamp:
2006-12-11T23:17:58Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
df496c5
Parents:
dff0a94
Message:

Coding style fixes.

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/include/context.h

    rdff0a94 r00bb6965  
    4646#endif
    4747
    48 #define context_set(c, _pc, stack, size)                                                                \
    49         (c)->pc = ((uintptr_t) _pc) - 8;                                                                \
    50         (c)->sp = ((uintptr_t) stack) + ALIGN_UP((size), STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA);    \
     48#define context_set(c, _pc, stack, size)                        \
     49        (c)->pc = ((uintptr_t) _pc) - 8;                        \
     50        (c)->sp = ((uintptr_t) stack) + ALIGN_UP((size),        \
     51                STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA);     \
    5152        (c)->fp = -STACK_BIAS
    5253       
    5354
    5455/*
    55  * Only save registers that must be preserved across
     56 * Save only registers that must be preserved across
    5657 * function calls.
    5758 */
  • kernel/generic/include/ipc/ipc.h

    rdff0a94 r00bb6965  
    129129
    130130/** Send as_area over IPC
    131  * - ARG1 - src base address
    132  * - ARG2 - size of src as(filled automatically by kernel)
    133  * - ARG3 - flags of the area being sent
    134  * - on answer ARG1 - dst base adress
     131 * - ARG1 - src as_area base address
     132 * - ARG2 - size of src as_area (filled automatically by kernel)
     133 * - ARG3 - flags of the as_area being sent
     134 *
     135 * on answer:
     136 * - ARG1 - dst as_area base adress
    135137 */
    136138#define IPC_M_AS_AREA_SEND      5
    137139
    138140/** Get as_area over IPC
    139  * - ARG1 - Where the area will be mapped
    140  * - ARG2 - Expected size of area
    141  * - ARG3 - User defined argument
    142  * on answer - the server sets ARG1 as src as address of the as_area
    143  * to be shared, ARG2 is set to rights that will be used for sharing,
    144  * which is returned as part of answer back to the receiver
     141 * - ARG1 - where the as_area will be mapped
     142 * - ARG2 - expected size of the as_area
     143 * - ARG3 - user defined argument
     144 *
     145 * on answer, the server sets:
     146 *
     147 * - ARG1 - src as_area base address
     148 * - ARG2 - flags that will be used for sharing
    145149 */
    146150#define IPC_M_AS_AREA_RECV      6
  • uspace/console/console.c

    rdff0a94 r00bb6965  
    7171typedef struct {
    7272        keybuffer_t keybuffer;          /**< Buffer for incoming keys. */
    73         FIFO_CREATE_STATIC(keyrequests, ipc_callid_t , MAX_KEYREQUESTS_BUFFERED);       /**< Buffer for unsatisfied request for keys. */
     73        /** Buffer for unsatisfied request for keys. */
     74        FIFO_CREATE_STATIC(keyrequests, ipc_callid_t,
     75                MAX_KEYREQUESTS_BUFFERED);     
    7476        int keyrequest_counter;         /**< Number of requests in buffer. */
    7577        int client_phone;               /**< Phone to connected client. */
    76         int used;                       /**< 1 if this virtual console is connected to some client.*/
    77         screenbuffer_t screenbuffer;    /**< Screenbuffer for saving screen contents and related settings. */
     78        int used;                       /**< 1 if this virtual console is
     79                                         * connected to some client.*/
     80        screenbuffer_t screenbuffer;    /**< Screenbuffer for saving screen
     81                                         * contents and related settings. */
    7882} connection_t;
    7983
    80 static connection_t connections[CONSOLE_COUNT]; /**< Array of data for virtual consoles */
    81 static keyfield_t *interbuffer = NULL;                  /**< Pointer to memory shared with framebufer used for faster virt. console switching */
    82 
    83 static int kernel_pixmap = -1;      /**< Number of fb pixmap, where kernel console is stored */
     84static connection_t connections[CONSOLE_COUNT]; /**< Array of data for virtual
     85                                                 * consoles */
     86static keyfield_t *interbuffer = NULL;          /**< Pointer to memory shared
     87                                                 * with framebufer used for
     88                                                 * faster virtual console
     89                                                 *switching */
     90
     91static int kernel_pixmap = -1;  /**< Number of fb pixmap, where kernel
     92                                 * console is stored */
    8493
    8594
     
    116125static void set_style(style_t *style)
    117126{
    118         async_msg_2(fb_info.phone, FB_SET_STYLE, style->fg_color, style->bg_color);
     127        async_msg_2(fb_info.phone, FB_SET_STYLE, style->fg_color,
     128                style->bg_color);
    119129}
    120130
     
    138148       
    139149        switch (key) {
    140                 case '\n':
    141                         scr->position_y += 1;
    142                         scr->position_x =  0;
    143                         break;
    144                 case '\r':
    145                         break;
    146                 case '\t':
    147                         scr->position_x += 8;
    148                         scr->position_x -= scr->position_x % 8;
    149                         break;
    150                 case '\b':
    151                         if (scr->position_x == 0)
    152                                 break;
    153 
    154                         scr->position_x--;
    155 
    156                         if (console == active_console)
    157                                 prtchr(' ', scr->position_y, scr->position_x);
    158        
    159                         screenbuffer_putchar(scr, ' ');
    160                        
    161                         break;
    162                 default:       
    163                         if (console == active_console)
    164                                 prtchr(key, scr->position_y, scr->position_x);
    165        
    166                         screenbuffer_putchar(scr, key);
    167                         scr->position_x++;
     150        case '\n':
     151                scr->position_y += 1;
     152                scr->position_x =  0;
     153                break;
     154        case '\r':
     155                break;
     156        case '\t':
     157                scr->position_x += 8;
     158                scr->position_x -= scr->position_x % 8;
     159                break;
     160        case '\b':
     161                if (scr->position_x == 0)
     162                        break;
     163                scr->position_x--;
     164                if (console == active_console)
     165                        prtchr(' ', scr->position_y, scr->position_x);
     166                screenbuffer_putchar(scr, ' ');
     167                break;
     168        default:       
     169                if (console == active_console)
     170                        prtchr(key, scr->position_y, scr->position_x);
     171
     172                screenbuffer_putchar(scr, key);
     173                scr->position_x++;
    168174        }
    169175       
     
    258264                for (i = 0; i < conn->screenbuffer.size_x; i++)
    259265                        for (j = 0; j < conn->screenbuffer.size_y; j++)
    260                                 interbuffer[i + j*conn->screenbuffer.size_x] = *get_field_at(&(conn->screenbuffer),i, j);
     266                                interbuffer[i + j * conn->screenbuffer.size_x]
     267                                        = *get_field_at(&(conn->screenbuffer),
     268                                        i, j);
    261269                /* This call can preempt, but we are already at the end */
    262                 rc = async_req_2(fb_info.phone, FB_DRAW_TEXT_DATA, 0, 0, NULL, NULL);           
     270                rc = async_req_2(fb_info.phone, FB_DRAW_TEXT_DATA, 0, 0, NULL,
     271                        NULL);         
    263272        };
    264273       
     
    270279                for (j = 0; j < conn->screenbuffer.size_y; j++)
    271280                        for (i = 0; i < conn->screenbuffer.size_x; i++) {
    272                                 field = get_field_at(&(conn->screenbuffer),i, j);
     281                                field = get_field_at(&(conn->screenbuffer), i,
     282                                        j);
    273283                                if (!style_same(*style, field->style))
    274284                                        set_style(&field->style);
    275285                                style = &field->style;
    276                                 if ((field->character == ' ') && (style_same(field->style, conn->screenbuffer.style)))
     286                                if ((field->character == ' ') &&
     287                                        (style_same(field->style,
     288                                        conn->screenbuffer.style)))
    277289                                        continue;
    278290
     
    281293        }
    282294       
    283         curs_goto(conn->screenbuffer.position_y, conn->screenbuffer.position_x);
     295        curs_goto(conn->screenbuffer.position_y,
     296                conn->screenbuffer.position_x);
    284297        curs_visibility(conn->screenbuffer.is_cursor_visible);
    285298
     
    311324                        break;
    312325                case KBD_MS_MOVE:
    313                         gcons_mouse_move(IPC_GET_ARG1(call), IPC_GET_ARG2(call));
     326                        gcons_mouse_move(IPC_GET_ARG1(call),
     327                                IPC_GET_ARG2(call));
    314328                        retval = 0;
    315329                        break;
     
    322336                       
    323337                        conn = &connections[active_console];
    324 //                      if ((c >= KBD_KEY_F1) && (c < KBD_KEY_F1 + CONSOLE_COUNT)) {
     338/*
     339 *                      if ((c >= KBD_KEY_F1) && (c < KBD_KEY_F1 +
     340 *                              CONSOLE_COUNT)) {
     341 */
    325342                        if ((c >= 0x101) && (c < 0x101 + CONSOLE_COUNT)) {
    326343                                if (c == 0x112)
     
    334351                        if (conn->keyrequest_counter > 0) {             
    335352                                conn->keyrequest_counter--;
    336                                 ipc_answer_fast(fifo_pop(conn->keyrequests), 0, c, 0);
     353                                ipc_answer_fast(fifo_pop(conn->keyrequests), 0,
     354                                        c, 0);
    337355                                break;
    338356                        }
     
    386404                        while (conn->keyrequest_counter > 0) {         
    387405                                conn->keyrequest_counter--;
    388                                 ipc_answer_fast(fifo_pop(conn->keyrequests), ENOENT, 0, 0);
     406                                ipc_answer_fast(fifo_pop(conn->keyrequests),
     407                                        ENOENT, 0, 0);
    389408                                break;
    390409                        }
     
    405424                        break;
    406425                case CONSOLE_GOTO:
    407                        
    408                         screenbuffer_goto(&conn->screenbuffer, IPC_GET_ARG2(call), IPC_GET_ARG1(call));
     426                        screenbuffer_goto(&conn->screenbuffer,
     427                                IPC_GET_ARG2(call), IPC_GET_ARG1(call));
    409428                        if (consnum == active_console)
    410                                 curs_goto(IPC_GET_ARG1(call),IPC_GET_ARG2(call));
    411                        
    412                         break;
    413 
     429                                curs_goto(IPC_GET_ARG1(call),
     430                                        IPC_GET_ARG2(call));
     431                        break;
    414432                case CONSOLE_GETSIZE:
    415433                        arg1 = fb_info.rows;
     
    418436                case CONSOLE_FLUSH:
    419437                        if (consnum == active_console)
    420                                 async_req_2(fb_info.phone, FB_FLUSH, 0, 0, NULL, NULL);         
     438                                async_req_2(fb_info.phone, FB_FLUSH, 0, 0,
     439                                        NULL, NULL);           
    421440                        break;
    422441                case CONSOLE_SET_STYLE:
    423                        
    424442                        arg1 = IPC_GET_ARG1(call);
    425443                        arg2 = IPC_GET_ARG2(call);
     
    427445                        if (consnum == active_console)
    428446                                set_style_col(arg1, arg2);
    429                                
    430447                        break;
    431448                case CONSOLE_CURSOR_VISIBILITY:
     
    438455                        if (keybuffer_empty(&conn->keybuffer)) {
    439456                                /* buffer is empty -> store request */
    440                                 if (conn->keyrequest_counter < MAX_KEYREQUESTS_BUFFERED) {             
     457                                if (conn->keyrequest_counter <
     458                                        MAX_KEYREQUESTS_BUFFERED) {     
    441459                                        fifo_push(conn->keyrequests, callid);
    442460                                        conn->keyrequest_counter++;
    443461                                } else {
    444                                         /* no key available and too many requests => fail */
     462                                        /*
     463                                         * No key available and too many
     464                                         * requests => fail.
     465                                        */
    445466                                        ipc_answer_fast(callid, ELIMIT, 0, 0);
    446467                                }
    447468                                continue;
    448                         };
    449                         keybuffer_pop(&conn->keybuffer, (int *)&arg1);
    450                        
     469                        }
     470                        keybuffer_pop(&conn->keybuffer, (int *) &arg1);
    451471                        break;
    452472                }
     
    465485        /* Connect to keyboard driver */
    466486
    467         while ((kbd_phone = ipc_connect_me_to(PHONE_NS, SERVICE_KEYBOARD, 0)) < 0) {
     487        while ((kbd_phone = ipc_connect_me_to(PHONE_NS, SERVICE_KEYBOARD, 0))
     488                < 0) {
    468489                usleep(10000);
    469         };
    470        
    471         if (ipc_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, &phonehash) != 0) {
     490        }
     491       
     492        if (ipc_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, &phonehash) != 0)
     493                {
    472494                return -1;
    473         };
     495        }
    474496        async_new_connection(phonehash, 0, NULL, keyboard_events);
    475497       
    476498        /* Connect to framebuffer driver */
    477499       
    478         while ((fb_info.phone = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0)) < 0) {
     500        while ((fb_info.phone = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0))
     501                < 0) {
    479502                usleep(10000);
    480503        }
     
    490513        async_msg_2(fb_info.phone, FB_VIEWPORT_DB, (sysarg_t)-1, 1);
    491514       
    492         async_req_2(fb_info.phone, FB_GET_CSIZE, 0, 0, &(fb_info.rows), &(fb_info.cols));
     515        async_req_2(fb_info.phone, FB_GET_CSIZE, 0, 0, &(fb_info.rows),
     516                &(fb_info.cols));
    493517        set_style_col(DEFAULT_FOREGROUND, DEFAULT_BACKGROUND);
    494518        clrscr();
     
    499523                keybuffer_init(&(connections[i].keybuffer));
    500524               
    501                 connections[i].keyrequests.head = connections[i].keyrequests.tail = 0;
     525                connections[i].keyrequests.head =
     526                        connections[i].keyrequests.tail = 0;
    502527                connections[i].keyrequests.items = MAX_KEYREQUESTS_BUFFERED;
    503528                connections[i].keyrequest_counter = 0;
    504529               
    505                 if (screenbuffer_init(&(connections[i].screenbuffer), fb_info.cols, fb_info.rows ) == NULL) {
     530                if (screenbuffer_init(&(connections[i].screenbuffer),
     531                        fb_info.cols, fb_info.rows) == NULL) {
    506532                        /*FIXME: handle error */
    507533                        return -1;
     
    510536        connections[KERNEL_CONSOLE].used = 1;
    511537       
    512         if ((interbuffer = mmap(NULL, sizeof(keyfield_t) * fb_info.cols * fb_info.rows , PROTO_READ|PROTO_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, 0 ,0 )) != NULL) {
    513                 if (async_req_3(fb_info.phone, IPC_M_AS_AREA_SEND, (ipcarg_t)interbuffer, 0, AS_AREA_READ, NULL, NULL, NULL) != 0) {
    514                         munmap(interbuffer, sizeof(keyfield_t) * fb_info.cols * fb_info.rows);
     538        if ((interbuffer = mmap(NULL, sizeof(keyfield_t) * fb_info.cols *
     539                fb_info.rows, PROTO_READ | PROTO_WRITE, MAP_ANONYMOUS |
     540                MAP_PRIVATE, 0, 0)) != NULL) {
     541                if (async_req_3(fb_info.phone, IPC_M_AS_AREA_SEND, (ipcarg_t)
     542                        interbuffer, 0, AS_AREA_READ, NULL, NULL, NULL) != 0) {
     543                        munmap(interbuffer, sizeof(keyfield_t) * fb_info.cols
     544                                * fb_info.rows);
    515545                        interbuffer = NULL;
    516546                }
     
    523553        if (ipc_connect_to_me(PHONE_NS, SERVICE_CONSOLE, 0, &phonehash) != 0) {
    524554                return -1;
    525         };
     555        }
    526556       
    527557        async_manager();
  • uspace/console/gcons.c

    rdff0a94 r00bb6965  
    7575
    7676/** List of pixmaps identifying these icons */
    77 static int ic_pixmaps[CONS_LAST] = {-1,-1,-1,-1,-1,-1};
     77static int ic_pixmaps[CONS_LAST] = {-1, -1, -1, -1, -1, -1};
    7878static int animation = -1;
    7979
     
    120120        vp_switch(cstatus_vp[consnum]);
    121121        if (ic_pixmaps[state] != -1)
    122                 async_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[consnum], ic_pixmaps[state]);
    123 
    124         if (state != CONS_DISCONNECTED && state != CONS_KERNEL && state != CONS_DISCONNECTED_SEL) {
    125                 snprintf(data, 5, "%d", consnum+1);
    126                 for (i=0;data[i];i++)
    127                         tran_putch(data[i], 1, 2+i);
     122                async_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[consnum],
     123                        ic_pixmaps[state]);
     124
     125        if (state != CONS_DISCONNECTED && state != CONS_KERNEL && state !=
     126                CONS_DISCONNECTED_SEL) {
     127                snprintf(data, 5, "%d", consnum + 1);
     128                for (i=0; data[i]; i++)
     129                        tran_putch(data[i], 1, 2 + i);
    128130        }
    129131}
     
    138140
    139141        if (active_console == KERNEL_CONSOLE) {
    140                 for (i=0; i < CONSOLE_COUNT; i++)
     142                for (i = 0; i < CONSOLE_COUNT; i++)
    141143                        redraw_state(i);
    142144                if (animation != -1)
     
    167169                return;
    168170
    169         if (consnum == active_console || console_state[consnum] == CONS_HAS_DATA)
     171        if (consnum == active_console || console_state[consnum] ==
     172                CONS_HAS_DATA)
    170173                return;
    171174
     
    258261static int gcons_find_conbut(int x, int y)
    259262{
    260         int status_start = STATUS_START + (xres-800) / 2;;
    261 
    262         if (y < STATUS_TOP || y >= STATUS_TOP+STATUS_HEIGHT)
     263        int status_start = STATUS_START + (xres - 800) / 2;;
     264
     265        if (y < STATUS_TOP || y >= STATUS_TOP + STATUS_HEIGHT)
    263266                return -1;
    264267       
     
    266269                return -1;
    267270       
    268         if (x >= status_start + (STATUS_WIDTH+STATUS_SPACE)*CONSOLE_COUNT)
     271        if (x >= status_start + (STATUS_WIDTH + STATUS_SPACE) * CONSOLE_COUNT)
    269272                return -1;
    270273        if (((x - status_start) % (STATUS_WIDTH+STATUS_SPACE)) < STATUS_SPACE)
    271274                return -1;
    272275       
    273         return (x-status_start) / (STATUS_WIDTH+STATUS_SPACE);
     276        return (x - status_start) / (STATUS_WIDTH+STATUS_SPACE);
    274277}
    275278
     
    315318
    316319        /* Create area */
    317         shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
     320        shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED |
     321                MAP_ANONYMOUS, 0, 0);
    318322        if (shm == MAP_FAILED)
    319323                return;
     
    321325        memcpy(shm, logo, size);
    322326        /* Send area */
    323         rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t)shm, 0, NULL, NULL);
     327        rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm, 0, NULL,
     328                NULL);
    324329        if (rc)
    325330                goto exit;
    326         rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t)shm, 0, PROTO_READ, NULL, NULL, NULL);
     331        rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0,
     332                PROTO_READ, NULL, NULL, NULL);
    327333        if (rc)
    328334                goto drop;
     
    352358        set_style(MAIN_COLOR, MAIN_COLOR);
    353359        clear();
    354         draw_pixmap(_binary_helenos_ppm_start, (size_t)&_binary_helenos_ppm_size, xres-66, 2);
    355         draw_pixmap(_binary_nameic_ppm_start, (size_t)&_binary_nameic_ppm_size, 5, 17);
    356 
    357         for (i=0;i < CONSOLE_COUNT; i++)
     360        draw_pixmap(_binary_helenos_ppm_start, (size_t)
     361                &_binary_helenos_ppm_size, xres - 66, 2);
     362        draw_pixmap(_binary_nameic_ppm_start, (size_t)
     363                &_binary_nameic_ppm_size, 5, 17);
     364
     365        for (i=0;i < CONSOLE_COUNT; i++)
    358366                redraw_state(i);
    359367        vp_switch(console_vp);
     
    373381
    374382        /* Create area */
    375         shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
     383        shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED |
     384                MAP_ANONYMOUS, 0, 0);
    376385        if (shm == MAP_FAILED)
    377386                return -1;
     
    379388        memcpy(shm, data, size);
    380389        /* Send area */
    381         rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t)shm, 0, NULL, NULL);
     390        rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm, 0, NULL,
     391                NULL);
    382392        if (rc)
    383393                goto exit;
    384         rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t)shm, 0, PROTO_READ, NULL, NULL, NULL);
     394        rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0,
     395                PROTO_READ, NULL, NULL, NULL);
    385396        if (rc)
    386397                goto drop;
     
    409420extern char _binary_anim_4_ppm_start[0];
    410421extern int _binary_anim_4_ppm_size;
     422
    411423static void make_anim(void)
    412424{
     
    414426        int pm;
    415427
    416         an = async_req(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE], NULL);
     428        an = async_req(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE],
     429                NULL);
    417430        if (an < 0)
    418431                return;
    419432
    420         pm = make_pixmap(_binary_anim_1_ppm_start, (int)&_binary_anim_1_ppm_size);
     433        pm = make_pixmap(_binary_anim_1_ppm_start, (int)
     434                &_binary_anim_1_ppm_size);
    421435        async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    422436
    423         pm = make_pixmap(_binary_anim_2_ppm_start, (int)&_binary_anim_2_ppm_size);
     437        pm = make_pixmap(_binary_anim_2_ppm_start, (int)
     438                &_binary_anim_2_ppm_size);
    424439        async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    425440
    426         pm = make_pixmap(_binary_anim_3_ppm_start, (int)&_binary_anim_3_ppm_size);
     441        pm = make_pixmap(_binary_anim_3_ppm_start, (int)
     442                &_binary_anim_3_ppm_size);
    427443        async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    428444
    429         pm = make_pixmap(_binary_anim_4_ppm_start, (int)&_binary_anim_4_ppm_size);
     445        pm = make_pixmap(_binary_anim_4_ppm_start, (int)
     446                &_binary_anim_4_ppm_size);
    430447        async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    431448
     
    443460extern char _binary_cons_kernel_ppm_start[0];
    444461extern int _binary_cons_kernel_ppm_size;
     462
    445463/** Initialize nice graphical console environment */
    446464void gcons_init(int phone)
     
    461479        /* create console viewport */
    462480        /* Align width & height to character size */
    463         console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP,
    464                                ALIGN_DOWN(xres-2*CONSOLE_MARGIN, 8),
    465                                ALIGN_DOWN(yres-(CONSOLE_TOP+CONSOLE_MARGIN),16));
     481        console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP, ALIGN_DOWN(xres -
     482                2 * CONSOLE_MARGIN, 8), ALIGN_DOWN(yres - (CONSOLE_TOP +
     483                CONSOLE_MARGIN), 16));
    466484        if (console_vp < 0)
    467485                return;
    468486       
    469487        /* Create status buttons */
    470         status_start += (xres-800) / 2;
    471         for (i=0; i < CONSOLE_COUNT; i++) {
    472                 cstatus_vp[i] = vp_create(status_start+CONSOLE_MARGIN+i*(STATUS_WIDTH+STATUS_SPACE),
    473                                           STATUS_TOP, STATUS_WIDTH, STATUS_HEIGHT);
     488        status_start += (xres - 800) / 2;
     489        for (i = 0; i < CONSOLE_COUNT; i++) {
     490                cstatus_vp[i] = vp_create(status_start + CONSOLE_MARGIN + i *
     491                        (STATUS_WIDTH + STATUS_SPACE), STATUS_TOP,
     492                        STATUS_WIDTH, STATUS_HEIGHT);
    474493                if (cstatus_vp[i] < 0)
    475494                        return;
     
    479498       
    480499        /* Initialize icons */
    481         ic_pixmaps[CONS_SELECTED] = make_pixmap(_binary_cons_selected_ppm_start,
    482                                               (int)&_binary_cons_selected_ppm_size);
    483         ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start,
    484                                               (int)&_binary_cons_idle_ppm_size);
    485         ic_pixmaps[CONS_HAS_DATA] = make_pixmap(_binary_cons_has_data_ppm_start,
    486                                                 (int)&_binary_cons_has_data_ppm_size);
    487         ic_pixmaps[CONS_DISCONNECTED] = make_pixmap(_binary_cons_idle_ppm_start,
    488                                               (int)&_binary_cons_idle_ppm_size);
     500        ic_pixmaps[CONS_SELECTED] =
     501                make_pixmap(_binary_cons_selected_ppm_start, (int)
     502                &_binary_cons_selected_ppm_size);
     503        ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start, (int)
     504                &_binary_cons_idle_ppm_size);
     505        ic_pixmaps[CONS_HAS_DATA] =
     506                make_pixmap(_binary_cons_has_data_ppm_start, (int)
     507                &_binary_cons_has_data_ppm_size);
     508        ic_pixmaps[CONS_DISCONNECTED] =
     509                make_pixmap(_binary_cons_idle_ppm_start, (int)
     510                &_binary_cons_idle_ppm_size);
    489511        ic_pixmaps[CONS_KERNEL] = make_pixmap(_binary_cons_kernel_ppm_start,
    490                                               (int)&_binary_cons_kernel_ppm_size);
     512                (int) &_binary_cons_kernel_ppm_size);
    491513        ic_pixmaps[CONS_DISCONNECTED_SEL] = ic_pixmaps[CONS_SELECTED];
    492514       
  • uspace/fb/ega.c

    rdff0a94 r00bb6965  
    8383        int i;
    8484       
    85         for (i=0; i < scr_width*scr_height; i++) {
    86                 scr_addr[i*2] = ' ';
    87                 scr_addr[i*2+1] = style;
     85        for (i = 0; i < scr_width*scr_height; i++) {
     86                scr_addr[i * 2] = ' ';
     87                scr_addr[i * 2 + 1] = style;
    8888        }
    8989}
     
    9393        int ega_cursor;
    9494
    95         ega_cursor=col+scr_width*row;
     95        ega_cursor = col + scr_width * row;
    9696       
    97         outb(EGA_IO_ADDRESS    , 0xe);
    98         outb(EGA_IO_ADDRESS + 1, (ega_cursor >>8) & 0xff);
    99         outb(EGA_IO_ADDRESS    , 0xf);
     97        outb(EGA_IO_ADDRESS, 0xe);
     98        outb(EGA_IO_ADDRESS + 1, (ega_cursor >> 8) & 0xff);
     99        outb(EGA_IO_ADDRESS, 0xf);
    100100        outb(EGA_IO_ADDRESS + 1, ega_cursor & 0xff);
    101101}
     
    105105        uint8_t stat;
    106106
    107         outb(EGA_IO_ADDRESS , 0xa);
     107        outb(EGA_IO_ADDRESS, 0xa);
    108108        stat=inb(EGA_IO_ADDRESS + 1);
    109         outb(EGA_IO_ADDRESS , 0xa);
    110         outb(EGA_IO_ADDRESS +1 ,stat | (1<<5) );
     109        outb(EGA_IO_ADDRESS, 0xa);
     110        outb(EGA_IO_ADDRESS + 1, stat | (1 << 5));
    111111}
    112112
     
    115115        uint8_t stat;
    116116
    117         outb(EGA_IO_ADDRESS , 0xa);
     117        outb(EGA_IO_ADDRESS, 0xa);
    118118        stat=inb(EGA_IO_ADDRESS + 1);
    119         outb(EGA_IO_ADDRESS , 0xa);
    120         outb(EGA_IO_ADDRESS +1 ,stat & (~(1<<5)) );
     119        outb(EGA_IO_ADDRESS, 0xa);
     120        outb(EGA_IO_ADDRESS + 1, stat & (~(1 << 5)));
    121121}
    122122
     
    125125        int i;
    126126        if (rows > 0) {
    127                 memcpy (scr_addr,((char *)scr_addr) + rows * scr_width * 2,
     127                memcpy(scr_addr, ((char *) scr_addr) + rows * scr_width * 2,
    128128                        scr_width * scr_height * 2 - rows * scr_width * 2);
    129                 for (i = 0; i < rows * scr_width ; i ++)
    130                         (((short *)scr_addr) + scr_width * scr_height - rows *
    131                                 scr_width) [i] = ((style << 8) + ' ');
     129                for (i = 0; i < rows * scr_width; i++)
     130                        (((short *) scr_addr) + scr_width * scr_height - rows *
     131                                scr_width)[i] = ((style << 8) + ' ');
    132132        } else if (rows < 0) {
    133                 memcpy (((char *)scr_addr) - rows * scr_width * 2, scr_addr,
     133                memcpy(((char *)scr_addr) - rows * scr_width * 2, scr_addr,
    134134                        scr_width * scr_height * 2 + rows * scr_width * 2);
    135                 for (i = 0; i < - rows * scr_width ; i++)
    136                         ((short *)scr_addr) [i] = ((style << 8 ) + ' ');
     135                for (i = 0; i < -rows * scr_width; i++)
     136                        ((short *)scr_addr)[i] = ((style << 8 ) + ' ');
    137137        }
    138138}
     
    140140static void printchar(char c, unsigned int row, unsigned int col)
    141141{
    142         scr_addr[(row*scr_width + col)*2] = c;
    143         scr_addr[(row*scr_width + col)*2+1] = style;
     142        scr_addr[(row * scr_width + col) * 2] = c;
     143        scr_addr[(row * scr_width + col) * 2 + 1] = style;
    144144       
    145         cursor_goto(row,col+1);
     145        cursor_goto(row, col + 1);
    146146}
    147147
     
    150150        int i;
    151151
    152         for (i=0; i < scr_width*scr_height; i++) {
    153                 scr_addr[i*2] = data[i].character;
    154                 scr_addr[i*2+1] = EGA_STYLE(data[i].style.fg_color, data[i].style.bg_color);
     152        for (i = 0; i < scr_width * scr_height; i++) {
     153                scr_addr[i * 2] = data[i].character;
     154                scr_addr[i * 2 + 1] = EGA_STYLE(data[i].style.fg_color,
     155                        data[i].style.bg_color);
    155156        }
    156157}
     
    160161        int i;
    161162
    162         for (i=0; ( i < MAX_SAVED_SCREENS ) && (saved_screens[i].data); i++)
     163        for (i=0; (i < MAX_SAVED_SCREENS) && (saved_screens[i].data); i++)
    163164                ;
    164165        if (i == MAX_SAVED_SCREENS)
    165166                return EINVAL;
    166         if (!(saved_screens[i].data=malloc( 2 * scr_width*scr_height )))
     167        if (!(saved_screens[i].data = malloc(2 * scr_width * scr_height)))
    167168                return ENOMEM;
    168169        memcpy(saved_screens[i].data, scr_addr, 2 * scr_width * scr_height);
     
    174175{
    175176        if (saved_screens[i].data)
    176                 memcpy(scr_addr, saved_screens[i].data, 2 * scr_width * scr_height);
    177         else return EINVAL;
     177                memcpy(scr_addr, saved_screens[i].data, 2 * scr_width *
     178                        scr_height);
     179        else
     180                return EINVAL;
    178181        return i;
    179182}
     
    204207                case IPC_M_PHONE_HUNGUP:
    205208                        client_connected = 0;
    206                         ipc_answer_fast(callid,0,0,0);
     209                        ipc_answer_fast(callid, 0, 0, 0);
    207210                        return; /* Exit thread */
    208211                case IPC_M_AS_AREA_SEND:
    209212                        /* We accept one area for data interchange */
    210213                        intersize = IPC_GET_ARG2(call);
    211                         if (intersize >= scr_width*scr_height*sizeof(*interbuf)) {
    212                                 receive_comm_area(callid,&call,(void *)&interbuf);
     214                        if (intersize >= scr_width * scr_height *
     215                                sizeof(*interbuf)) {
     216                                receive_comm_area(callid, &call, (void *)
     217                                        &interbuf);
    213218                                continue;
    214219                        }
     
    238243                                break;
    239244                        }
    240                         printchar(c,row,col);
     245                        printchar(c, row, col);
    241246                        retval = 0;
    242247                        break;
     
    248253                                break;
    249254                        }
    250                         cursor_goto(row,col);
     255                        cursor_goto(row, col);
    251256                        retval = 0;
    252257                        break;
    253258                case FB_SCROLL:
    254259                        i = IPC_GET_ARG1(call);
    255                         if (i > scr_height || i < (- (int)scr_height)) {
     260                        if (i > scr_height || i < -((int) scr_height)) {
    256261                                retval = EINVAL;
    257262                                break;
     
    296301                        retval = ENOENT;
    297302                }
    298                 ipc_answer_fast(callid,retval,0,0);
     303                ipc_answer_fast(callid, retval, 0, 0);
    299304        }
    300305}
     
    305310        size_t sz;
    306311
    307 
    308         ega_ph_addr=(void *)sysinfo_value("fb.address.physical");
    309         scr_width=sysinfo_value("fb.width");
    310         scr_height=sysinfo_value("fb.height");
     312        ega_ph_addr = (void *) sysinfo_value("fb.address.physical");
     313        scr_width = sysinfo_value("fb.width");
     314        scr_height = sysinfo_value("fb.height");
    311315        iospace_enable(task_get_id(), (void *) EGA_IO_ADDRESS, 2);
    312316
  • uspace/fb/fb.c

    rdff0a94 r00bb6965  
    162162static void bgr_byte0888(void *dst, int rgb)
    163163{
    164         *((uint32_t *) dst) = BLUE(rgb, 8) << 16 | GREEN(rgb, 8) << 8 | RED(rgb, 8);
     164        *((uint32_t *) dst) = BLUE(rgb, 8) << 16 | GREEN(rgb, 8) << 8 |
     165                RED(rgb, 8);
    165166}
    166167
     
    168169{
    169170        int color = *(uint32_t *)(src);
    170         return ((color & 0xff) << 16) | (((color >> 8) & 0xff) << 8) | ((color >> 16) & 0xff);
     171        return ((color & 0xff) << 16) | (((color >> 8) & 0xff) << 8) | ((color
     172                >> 16) & 0xff);
    171173}
    172174
     
    199201{
    200202        /* 5-bit, 5-bits, 5-bits */
    201         *((uint16_t *)(dst)) = RED(rgb, 5) << 10 | GREEN(rgb, 5) << 5 | BLUE(rgb, 5);
     203        *((uint16_t *)(dst)) = RED(rgb, 5) << 10 | GREEN(rgb, 5) << 5 |
     204                BLUE(rgb, 5);
    202205}
    203206
     
    206209{
    207210        int color = *(uint16_t *)(src);
    208         return (((color >> 10) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x1f) << (8 + 3)) | ((color & 0x1f) << 3);
     211        return (((color >> 10) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x1f) <<
     212                (8 + 3)) | ((color & 0x1f) << 3);
    209213}
    210214
     
    213217{
    214218        /* 5-bit, 6-bits, 5-bits */
    215         *((uint16_t *)(dst)) = RED(rgb, 5) << 11 | GREEN(rgb, 6) << 5 | BLUE(rgb, 5);
     219        *((uint16_t *)(dst)) = RED(rgb, 5) << 11 | GREEN(rgb, 6) << 5 |
     220                BLUE(rgb, 5);
    216221}
    217222
     
    220225{
    221226        int color = *(uint16_t *)(src);
    222         return (((color >> 11) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3);
     227        return (((color >> 11) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x3f) <<
     228                (8 + 2)) | ((color & 0x1f) << 3);
    223229}
    224230
     
    233239{
    234240        int color = *(uint8_t *)src;
    235         return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5);
     241        return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) <<
     242                (8 + 6)) | ((color & 0x7) << 5);
    236243}
    237244
     
    243250 * @param color RGB color
    244251 */
    245 static void putpixel(viewport_t *vport, unsigned int x, unsigned int y, int color)
     252static void putpixel(viewport_t *vport, unsigned int x, unsigned int y, int
     253        color)
    246254{
    247255        int dx = vport->x + x;
     
    267275}
    268276
    269 static inline void putpixel_mem(char *mem, unsigned int x, unsigned int y,
    270                                 int color)
     277static inline void putpixel_mem(char *mem, unsigned int x, unsigned int y, int
     278        color)
    271279{
    272280        (*screen.rgb2scr)(&mem[POINTPOS(x,y)], COLOR(color));
     
    274282
    275283static void draw_rectangle(viewport_t *vport, unsigned int sx, unsigned int sy,
    276                            unsigned int width, unsigned int height,
    277                            int color)
     284        unsigned int width, unsigned int height, int color)
    278285{
    279286        unsigned int x, y;
     
    297304        }
    298305        if (vport->dbdata) {
    299                 for (y=sy;y < sy+height; y++) {
     306                for (y = sy; y < sy + height; y++) {
    300307                        int rline = (y + vport->dboffset) % vport->height;
    301                         int rpos = (rline * vport->width + sx) * screen.pixelbytes;
    302                         memcpy(&vport->dbdata[rpos], tmpline, screen.pixelbytes * width);
     308                        int rpos = (rline * vport->width + sx) *
     309                                screen.pixelbytes;
     310                        memcpy(&vport->dbdata[rpos], tmpline,
     311                                screen.pixelbytes * width);
    303312                }
    304313        }
     
    309318static void clear_port(viewport_t *vport)
    310319{
    311         draw_rectangle(vport, 0, 0, vport->width, vport->height, vport->style.bg_color);
     320        draw_rectangle(vport, 0, 0, vport->width, vport->height,
     321                vport->style.bg_color);
    312322}
    313323
     
    322332
    323333        if (lines > 0) {
    324                 for (y=vport->y; y < vport->y+vport->height - lines; y++)
     334                for (y = vport->y; y < vport->y+vport->height - lines; y++)
    325335                        memcpy(&screen.fbaddress[POINTPOS(vport->x,y)],
    326336                               &screen.fbaddress[POINTPOS(vport->x,y + lines)],
    327337                               screen.pixelbytes * vport->width);
    328                 draw_rectangle(vport, 0, vport->height - lines,
    329                                vport->width, lines, vport->style.bg_color);
     338                draw_rectangle(vport, 0, vport->height - lines, vport->width,
     339                        lines, vport->style.bg_color);
    330340        } else if (lines < 0) {
    331341                lines = -lines;
    332                 for (y=vport->y + vport->height-1; y >= vport->y + lines; y--)
     342                for (y = vport->y + vport->height-1; y >= vport->y + lines;
     343                         y--)
    333344                        memcpy(&screen.fbaddress[POINTPOS(vport->x,y)],
    334345                               &screen.fbaddress[POINTPOS(vport->x,y - lines)],
    335346                               screen.pixelbytes * vport->width);
    336                 draw_rectangle(vport, 0, 0, vport->width, lines, vport->style.bg_color);
     347                draw_rectangle(vport, 0, 0, vport->width, lines,
     348                        vport->style.bg_color);
    337349        }
    338350}
     
    408420 * @param transparent If false, print background color
    409421 */
    410 static void draw_glyph(viewport_t *vport,uint8_t glyph, unsigned int sx, unsigned int sy,
    411                       style_t style, int transparent)
     422static void draw_glyph(viewport_t *vport,uint8_t glyph, unsigned int sx,
     423         unsigned int sy, style_t style, int transparent)
    412424{
    413425        int i;
     
    419431                for (i = 0; i < 8; i++) {
    420432                        if (glline & (1 << (7 - i)))
    421                                 putpixel(vport, sx + i, sy + y, style.fg_color);
     433                                putpixel(vport, sx + i, sy + y,
     434                                        style.fg_color);
    422435                        else if (!transparent)
    423                                 putpixel(vport, sx + i, sy + y, style.bg_color);
     436                                putpixel(vport, sx + i, sy + y,
     437                                        style.bg_color);
    424438                }
    425439        }
     
    434448        for (x = 0; x < COL_WIDTH; x++)
    435449                for (y = 0; y < FONT_SCANLINES; y++)
    436                         invert_pixel(vport, col * COL_WIDTH + x, row * FONT_SCANLINES + y);
     450                        invert_pixel(vport, col * COL_WIDTH + x, row *
     451                                FONT_SCANLINES + y);
    437452}
    438453
     
    446461 */
    447462static int viewport_create(unsigned int x, unsigned int y,unsigned int width,
    448                            unsigned int height)
     463        unsigned int height)
    449464{
    450465        int i;
     
    488503 *
    489504 */
    490 static bool screen_init(void *addr, unsigned int xres, unsigned int yres, unsigned int scan, unsigned int visual, bool invert_colors)
     505static bool screen_init(void *addr, unsigned int xres, unsigned int yres,
     506        unsigned int scan, unsigned int visual, bool invert_colors)
    491507{
    492508        switch (visual) {
     
    578594 * @param transparent If false, print background color with character
    579595 */
    580 static void draw_char(viewport_t *vport, char c, unsigned int row, unsigned int col,
    581                       style_t style, int transparent)
     596static void draw_char(viewport_t *vport, char c, unsigned int row, unsigned int
     597        col, style_t style, int transparent)
    582598{
    583599        /* Optimize - do not hide cursor if we are going to overwrite it */
     
    586602                invert_char(vport, vport->cur_row, vport->cur_col);
    587603       
    588         draw_glyph(vport, c, col * COL_WIDTH, row * FONT_SCANLINES, style, transparent);
     604        draw_glyph(vport, c, col * COL_WIDTH, row * FONT_SCANLINES, style,
     605                transparent);
    589606
    590607        vport->cur_col = col;
     
    592609
    593610        vport->cur_col++;
    594         if (vport->cur_col>= vport->cols) {
     611        if (vport->cur_col >= vport->cols) {
    595612                vport->cur_col = 0;
    596613                vport->cur_row++;
     
    612629
    613630        clear_port(vport);
    614         for (i=0; i < vport->cols * vport->rows; i++) {
    615                 if (data[i].character == ' ' && style_same(data[i].style,vport->style))
     631        for (i = 0; i < vport->cols * vport->rows; i++) {
     632                if (data[i].character == ' ' && style_same(data[i].style,
     633                        vport->style))
    616634                        continue;
    617635                col = i % vport->cols;
    618636                row = i / vport->cols;
    619                 draw_glyph(vport, data[i].character, col * COL_WIDTH, row * FONT_SCANLINES,
    620                            data[i].style, style_same(data[i].style,vport->style));
     637                draw_glyph(vport, data[i].character, col * COL_WIDTH, row *
     638                        FONT_SCANLINES, data[i].style,
     639                        style_same(data[i].style,vport->style));
    621640        }
    622641        cursor_print(vport);
     
    671690 * Protocol for drawing pixmaps:
    672691 * - FB_PREPARE_SHM(client shm identification)
    673  * - IPC_M_SEND_AS_AREA
     692 * - IPC_M_AS_AREA_SEND
    674693 * - FB_DRAW_PPM(startx,starty)
    675694 * - FB_DROP_SHM
    676695 *
    677696 * Protocol for text drawing
    678  * - IPC_M_SEND_AS_AREA
     697 * - IPC_M_AS_AREA_SEND
    679698 * - FB_DRAW_TEXT_DATA
    680699 *
     
    755774                }
    756775               
    757                 ppm_draw(shm, shm_size, IPC_GET_ARG1(*call), IPC_GET_ARG2(*call),
    758                          vport->width - x, vport->height - y, (putpixel_cb_t)putpixel, vport);
     776                ppm_draw(shm, shm_size, IPC_GET_ARG1(*call),
     777                        IPC_GET_ARG2(*call), vport->width - x, vport->height -
     778                        y, (putpixel_cb_t)putpixel, vport);
    759779                break;
    760780        case FB_DRAW_TEXT_DATA:
     
    763783                        break;
    764784                }
    765                 if (intersize < vport->cols*vport->rows*sizeof(*interbuffer)) {
     785                if (intersize < vport->cols * vport->rows *
     786                        sizeof(*interbuffer)) {
    766787                        retval = EINVAL;
    767788                        break;
     
    793814        rowsize = width * screen.pixelbytes;
    794815
    795         for (y=0;y < height; y++) {
    796                 tmp = (vport->y + y) * screen.scanline + vport->x * screen.pixelbytes;
    797                 memcpy(pmap->data + rowsize*y, screen.fbaddress + tmp, rowsize);
     816        for (y = 0; y < height; y++) {
     817                tmp = (vport->y + y) * screen.scanline + vport->x *
     818                        screen.pixelbytes;
     819                memcpy(pmap->data + rowsize * y, screen.fbaddress + tmp,
     820                        rowsize);
    798821        }
    799822}
     
    852875
    853876        for (y=0; y < realheight; y++) {
    854                 tmp = (vport->y + y) * screen.scanline + vport->x * screen.pixelbytes;
    855                 memcpy(screen.fbaddress + tmp, pmap->data + y * srcrowsize, realrowsize);
     877                tmp = (vport->y + y) * screen.scanline + vport->x *
     878                        screen.pixelbytes;
     879                memcpy(screen.fbaddress + tmp, pmap->data + y * srcrowsize,
     880                        realrowsize);
    856881        }
    857882        return 0;
     
    865890       
    866891        /* Limit redrawing */
    867         counts = (counts+1) % 8;
     892        counts = (counts + 1) % 8;
    868893        if (counts)
    869894                return;
    870895
    871896        for (i=0; i < MAX_ANIMATIONS; i++) {
    872                 if (!animations[i].animlen || !animations[i].initialized || !animations[i].enabled)
     897                if (!animations[i].animlen || !animations[i].initialized ||
     898                        !animations[i].enabled)
    873899                        continue;
    874                 draw_pixmap(animations[i].vp, animations[i].pixmaps[animations[i].pos]);
    875                 animations[i].pos = (animations[i].pos+1) % animations[i].animlen;
     900                draw_pixmap(animations[i].vp,
     901                        animations[i].pixmaps[animations[i].pos]);
     902                animations[i].pos = (animations[i].pos + 1) %
     903                        animations[i].animlen;
    876904        }
    877905}
     
    895923        /* Save image under the cursor */
    896924        if (pointer_vport == -1) {
    897                 pointer_vport = viewport_create(pointer_x, pointer_y, pointer_width, pointer_height);
     925                pointer_vport = viewport_create(pointer_x, pointer_y,
     926                        pointer_width, pointer_height);
    898927                if (pointer_vport < 0)
    899928                        return;
     
    906935                pointer_pixmap = save_vp_to_pixmap(&viewports[pointer_vport]);
    907936        else
    908                 copy_vp_to_pixmap(&viewports[pointer_vport], &pixmaps[pointer_pixmap]);
     937                copy_vp_to_pixmap(&viewports[pointer_vport],
     938                        &pixmaps[pointer_pixmap]);
    909939
    910940        /* Draw cursor */
    911         for (i=0; i < pointer_height; i++)
    912                 for (j=0;j < pointer_width; j++) {
    913                         bytepos = i*((pointer_width-1)/8+1) + j/8;
    914                         visibility = pointer_mask_bits[bytepos] & (1 << (j % 8));
     941        for (i = 0; i < pointer_height; i++)
     942                for (j = 0; j < pointer_width; j++) {
     943                        bytepos = i * ((pointer_width - 1) / 8 + 1) + j / 8;
     944                        visibility = pointer_mask_bits[bytepos] & (1 << (j %
     945                                8));
    915946                        if (visibility) {
    916                                 color = pointer_bits[bytepos] & (1 << (j % 8)) ? 0 : 0xffffff;
    917                                 if (pointer_x+j < screen.xres && pointer_y+i < screen.yres)
    918                                         putpixel(&viewports[0], pointer_x+j, pointer_y+i, color);
     947                                color = pointer_bits[bytepos] & (1 << (j % 8))
     948                                        ? 0 : 0xffffff;
     949                                if (pointer_x + j < screen.xres && pointer_y +
     950                                        i < screen.yres)
     951                                        putpixel(&viewports[0], pointer_x + j,
     952                                                 pointer_y+i, color);
    919953                        }
    920954                }
     
    951985                if (nvp == -1)
    952986                        nvp = vp;
    953                 if (nvp >= MAX_VIEWPORTS || nvp < 0 || !viewports[nvp].initialized) {
    954                         retval = EINVAL;
    955                         break;
    956                 }
    957                 for (i=0; i < MAX_ANIMATIONS; i++) {
    958                         if (! animations[i].initialized)
     987                if (nvp >= MAX_VIEWPORTS || nvp < 0 ||
     988                        !viewports[nvp].initialized) {
     989                        retval = EINVAL;
     990                        break;
     991                }
     992                for (i = 0; i < MAX_ANIMATIONS; i++) {
     993                        if (!animations[i].initialized)
    959994                                break;
    960995                }
     
    9801015        case FB_ANIM_ADDPIXMAP:
    9811016                i = IPC_GET_ARG1(*call);
    982                 if (i >= MAX_ANIMATIONS || i < 0 || !animations[i].initialized) {
     1017                if (i >= MAX_ANIMATIONS || i < 0 ||
     1018                        !animations[i].initialized) {
    9831019                        retval = EINVAL;
    9841020                        break;
     
    9891025                }
    9901026                newval = IPC_GET_ARG2(*call);
    991                 if (newval < 0 || newval > MAX_PIXMAPS || !pixmaps[newval].data) {
     1027                if (newval < 0 || newval > MAX_PIXMAPS ||
     1028                        !pixmaps[newval].data) {
    9921029                        retval = EINVAL;
    9931030                        break;
     
    10041041                if (nvp == -1)
    10051042                        nvp = vp;
    1006                 if (nvp >= MAX_VIEWPORTS || nvp < 0 || !viewports[nvp].initialized) {
     1043                if (nvp >= MAX_VIEWPORTS || nvp < 0 ||
     1044                        !viewports[nvp].initialized) {
    10071045                        retval = EINVAL;
    10081046                        break;
     
    10431081                if (nvp == -1)
    10441082                        nvp = vp;
    1045                 if (nvp < 0 || nvp >= MAX_VIEWPORTS || !viewports[nvp].initialized) {
     1083                if (nvp < 0 || nvp >= MAX_VIEWPORTS ||
     1084                        !viewports[nvp].initialized) {
    10461085                        retval = EINVAL;
    10471086                        break;
     
    10541093                if (nvp == -1)
    10551094                        nvp = vp;
    1056                 if (nvp < 0 || nvp >= MAX_VIEWPORTS || !viewports[nvp].initialized)
     1095                if (nvp < 0 || nvp >= MAX_VIEWPORTS ||
     1096                        !viewports[nvp].initialized)
    10571097                        retval = EINVAL;
    10581098                else
     
    11261166                        client_connected = 0;
    11271167                        /* cleanup other viewports */
    1128                         for (i=1; i < MAX_VIEWPORTS; i++)
     1168                        for (i = 1; i < MAX_VIEWPORTS; i++)
    11291169                                vport->initialized = 0;
    11301170                        return; /* Exit thread */
     
    11411181                        ipc_answer_fast(callid,0,0,0);
    11421182
    1143                         draw_char(vport, c, row, col, vport->style, IPC_GET_METHOD(call) == FB_TRANS_PUTCHAR);
     1183                        draw_char(vport, c, row, col, vport->style,
     1184                                IPC_GET_METHOD(call) == FB_TRANS_PUTCHAR);
    11441185                        continue; /* msg already answered */
    11451186                case FB_CLEAR:
     
    11961237                        viewports[i].dboffset = 0;
    11971238                        if (IPC_GET_ARG2(call) == 1 && !viewports[i].dbdata)
    1198                                 viewports[i].dbdata = malloc(screen.pixelbytes*viewports[i].width * viewports[i].height);
    1199                         else if (IPC_GET_ARG2(call) == 0 && viewports[i].dbdata) {
     1239                                viewports[i].dbdata = malloc(screen.pixelbytes
     1240                                        * viewports[i].width *
     1241                                        viewports[i].height);
     1242                        else if (IPC_GET_ARG2(call) == 0 &&
     1243                                viewports[i].dbdata) {
    12001244                                free(viewports[i].dbdata);
    12011245                                viewports[i].dbdata = NULL;
     
    12211265                case FB_VIEWPORT_CREATE:
    12221266                        retval = viewport_create(IPC_GET_ARG1(call) >> 16,
    1223                                                  IPC_GET_ARG1(call) & 0xffff,
    1224                                                  IPC_GET_ARG2(call) >> 16,
    1225                                                  IPC_GET_ARG2(call) & 0xffff);
     1267                                IPC_GET_ARG1(call) & 0xffff, IPC_GET_ARG2(call)
     1268                                 >> 16, IPC_GET_ARG2(call) & 0xffff);
    12261269                        break;
    12271270                case FB_VIEWPORT_DELETE:
     
    12841327
    12851328        asz = fb_scanline * fb_height;
    1286         fb_addr = as_get_mappable_page(asz, (int) sysinfo_value("fb.address.color"));
    1287        
    1288         physmem_map(fb_ph_addr, fb_addr, ALIGN_UP(asz, PAGE_SIZE) >> PAGE_WIDTH,
    1289                     AS_AREA_READ | AS_AREA_WRITE);
     1329        fb_addr = as_get_mappable_page(asz, (int)
     1330                sysinfo_value("fb.address.color"));
     1331       
     1332        physmem_map(fb_ph_addr, fb_addr, ALIGN_UP(asz, PAGE_SIZE) >>
     1333                PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE);
    12901334
    12911335        if (screen_init(fb_addr, fb_width, fb_height, fb_scanline, fb_visual,
  • uspace/fb/main.c

    rdff0a94 r00bb6965  
    4646        dest = as_get_mappable_page(IPC_GET_ARG2(*call),
    4747                PAGE_COLOR(IPC_GET_ARG1(*call)));
    48         if (ipc_answer_fast(callid, 0, (sysarg_t)dest, 0) == 0) {
     48        if (ipc_answer_fast(callid, 0, (sysarg_t) dest, 0) == 0) {
    4949                if (*area)
    5050                        as_area_destroy(*area);
     
    6565#endif
    6666#ifdef EGA_ENABLED
    67         if (! initialized && sysinfo_value("fb.kind") == 2) {
     67        if (!initialized && sysinfo_value("fb.kind") == 2) {
    6868                if (ega_init() == 0)
    6969                        initialized = 1;
  • uspace/libc/arch/sparc64/include/psthread.h

    rdff0a94 r00bb6965  
    4646#endif
    4747
    48 #define context_set(c, _pc, stack, size, ptls)                                                          \
    49         (c)->pc = ((uintptr_t) _pc) - 8;                                                                \
    50         (c)->sp = ((uintptr_t) stack) + ALIGN_UP((size), STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA);    \
    51         (c)->fp = -STACK_BIAS;                                                                          \
     48#define context_set(c, _pc, stack, size, ptls)                  \
     49        (c)->pc = ((uintptr_t) _pc) - 8;                        \
     50        (c)->sp = ((uintptr_t) stack) + ALIGN_UP((size),        \
     51                STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA);     \
     52        (c)->fp = -STACK_BIAS;                                  \
    5253        (c)->tp = ptls
    5354       
    5455/*
    55  * Only save registers that must be preserved across
     56 * Save only registers that must be preserved across
    5657 * function calls.
    5758 */
Note: See TracChangeset for help on using the changeset viewer.