Changeset 085bd54 in mainline for console/console.c


Ignore:
Timestamp:
2006-06-06T15:16:08Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63bb83e
Parents:
d7eafd8
Message:

Revised ipc. Now it is preferrable to use only functions from async.h, they
take care of correct buffering, waiting for answers etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • console/console.c

    rd7eafd8 r085bd54  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
     28/* TODO: remove */
     29#include <stdio.h>
    2830
    2931
     
    9294static void clrscr(void)
    9395{
    94         nsend_call(fb_info.phone, FB_CLEAR, 0);
     96        async_msg(fb_info.phone, FB_CLEAR, 0);
    9597}
    9698
    9799static void curs_visibility(int v)
    98100{
    99         send_call(fb_info.phone, FB_CURSOR_VISIBILITY, v);
     101        async_msg(fb_info.phone, FB_CURSOR_VISIBILITY, v);
    100102}
    101103
    102104static void curs_goto(int row, int col)
    103105{
    104         nsend_call_2(fb_info.phone, FB_CURSOR_GOTO, row, col);
     106        async_msg_2(fb_info.phone, FB_CURSOR_GOTO, row, col);
    105107       
    106108}
     
    108110static void set_style(style_t *style)
    109111{
    110         nsend_call_2(fb_info.phone, FB_SET_STYLE, style->fg_color, style->bg_color);
     112        async_msg_2(fb_info.phone, FB_SET_STYLE, style->fg_color, style->bg_color);
    111113}
    112114
    113115static void set_style_col(int fgcolor, int bgcolor)
    114116{
    115         nsend_call_2(fb_info.phone, FB_SET_STYLE, fgcolor, bgcolor);
     117        async_msg_2(fb_info.phone, FB_SET_STYLE, fgcolor, bgcolor);
    116118}
    117119
    118120static void prtchr(char c, int row, int col)
    119121{
    120         nsend_call_3(fb_info.phone, FB_PUTCHAR, c, row, col);
     122        async_msg_3(fb_info.phone, FB_PUTCHAR, c, row, col);
    121123       
    122124}
     
    166168                screenbuffer_clear_line(scr, scr->top_line++);
    167169                if (console == active_console)
    168                         nsend_call(fb_info.phone, FB_SCROLL, 1);
     170                        async_msg(fb_info.phone, FB_SCROLL, 1);
    169171        }
    170172       
     
    186188       
    187189        /* Save screen */
    188         newpmap = sync_send(fb_info.phone, FB_VP2PIXMAP, 0, NULL);
     190        newpmap = async_req(fb_info.phone, FB_VP2PIXMAP, 0, NULL);
    189191        if (newpmap < 0)
    190192                return -1;
     
    192194        if (oldpixmap != -1) {
    193195                /* Show old screen */
    194                 nsend_call_2(fb_info.phone, FB_VP_DRAW_PIXMAP, 0, oldpixmap);
     196                async_msg_2(fb_info.phone, FB_VP_DRAW_PIXMAP, 0, oldpixmap);
    195197                /* Drop old pixmap */
    196                 nsend_call(fb_info.phone, FB_DROP_PIXMAP, oldpixmap);
     198                async_msg(fb_info.phone, FB_DROP_PIXMAP, oldpixmap);
    197199        }
    198200       
     
    237239                console_pixmap = -1;
    238240        }
    239        
    240241        active_console = newcons;
    241242        gcons_change_console(newcons);
     
    245246        curs_goto(conn->screenbuffer.position_y, conn->screenbuffer.position_x);
    246247        curs_visibility(0);
    247        
    248248        if (interbuffer) {
    249249                for (i = 0; i < conn->screenbuffer.size_x; i++)
     
    251251                                interbuffer[i + j*conn->screenbuffer.size_x] = *get_field_at(&(conn->screenbuffer),i, j);
    252252                /* This call can preempt, but we are already at the end */
    253                 j = sync_send_2(fb_info.phone, FB_DRAW_TEXT_DATA, 0, 0, NULL, NULL);           
     253                j = async_req_2(fb_info.phone, FB_DRAW_TEXT_DATA, 0, 0, NULL, NULL);           
    254254        };
    255255       
     
    302302//                      if ((c >= KBD_KEY_F1) && (c < KBD_KEY_F1 + CONSOLE_COUNT)) {
    303303                        if ((c >= 0x101) && (c < 0x101 + CONSOLE_COUNT)) {
     304                                async_serialize_start();
    304305                                if (c == 0x112)
    305306                                        change_console(KERNEL_CONSOLE);
    306307                                else
    307308                                        change_console(c - 0x101);
     309                                async_serialize_end();
    308310                                break;
    309311                        }
     
    322324                default:
    323325                        retval = ENOENT;
    324                 }               
     326                }
    325327                ipc_answer_fast(callid, retval, 0, 0);
    326328        }
     
    341343        }
    342344        conn = &connections[consnum];
    343        
     345        conn->used = 1;
     346       
     347        async_serialize_start();
    344348        gcons_notify_connect(consnum);
    345         conn->used = 1;
    346349        conn->client_phone = IPC_GET_ARG3(call);
    347350        screenbuffer_clear(&conn->screenbuffer);
     
    349352        /* Accept the connection */
    350353        ipc_answer_fast(iid,0,0,0);
    351        
     354
    352355        while (1) {
     356                async_serialize_end();
    353357                callid = async_get_call(&call);
     358                async_serialize_start();
     359
    354360                arg1 = arg2 = 0;
    355361                switch (IPC_GET_METHOD(call)) {
    356362                case IPC_M_PHONE_HUNGUP:
    357363                        gcons_notify_disconnect(consnum);
     364                       
    358365                        /* Answer all pending requests */
    359366                        while (conn->keyrequest_counter > 0) {         
     
    365372                        /* Commit hangup */
    366373                        ipc_answer_fast(callid, 0,0,0);
     374                        async_serialize_end();
    367375                        return;
    368376                case CONSOLE_PUTCHAR:
     
    373381                        /* Send message to fb */
    374382                        if (consnum == active_console) {
    375                                 send_call(fb_info.phone, FB_CLEAR, 0);
     383                                async_msg(fb_info.phone, FB_CLEAR, 0);
    376384                        }
    377385                       
     
    392400                        break;
    393401                case CONSOLE_FLUSH:
    394                         sync_send_2(fb_info.phone, FB_FLUSH, 0, 0, NULL, NULL);         
     402                        async_req_2(fb_info.phone, FB_FLUSH, 0, 0, NULL, NULL);         
    395403                        break;
    396404                case CONSOLE_SET_STYLE:
     
    460468        gcons_init(fb_info.phone);
    461469        /* Synchronize, the gcons can have something in queue */
    462         sync_send(fb_info.phone, FB_FLUSH, 0, NULL);
     470        async_req(fb_info.phone, FB_FLUSH, 0, NULL);
    463471
    464472       
Note: See TracChangeset for help on using the changeset viewer.