Rev 4142 | Rev 4167 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4142 | Rev 4164 | ||
---|---|---|---|
Line 241... | Line 241... | ||
241 | a0 = a1; |
241 | a0 = a1; |
242 | } |
242 | } |
243 | } |
243 | } |
244 | } |
244 | } |
245 | 245 | ||
- | 246 | int lastcol = 0; |
|
- | 247 | int lastrow = 0; |
|
- | 248 | ||
- | 249 | #define FB_WRITE_BUF_SIZE 256 |
|
- | 250 | static char fb_write_buf[FB_WRITE_BUF_SIZE]; |
|
- | 251 | ||
- | 252 | static void fb_write(ipc_callid_t rid, ipc_call_t *request) |
|
- | 253 | { |
|
- | 254 | int row, col; |
|
- | 255 | ipc_callid_t callid; |
|
- | 256 | size_t len; |
|
- | 257 | size_t i; |
|
- | 258 | ||
- | 259 | row = IPC_GET_ARG1(*request); |
|
- | 260 | col = IPC_GET_ARG2(*request); |
|
- | 261 | ||
- | 262 | if ((col >= scr_width) || (row >= scr_height)) { |
|
- | 263 | ipc_answer_0(callid, EINVAL); |
|
- | 264 | ipc_answer_0(rid, EINVAL); |
|
- | 265 | return; |
|
- | 266 | } |
|
- | 267 | ||
- | 268 | if (!ipc_data_write_receive(&callid, &len)) { |
|
- | 269 | ipc_answer_0(callid, EINVAL); |
|
- | 270 | ipc_answer_0(rid, EINVAL); |
|
- | 271 | return; |
|
- | 272 | } |
|
- | 273 | ||
- | 274 | if (len > FB_WRITE_BUF_SIZE) |
|
- | 275 | len = FB_WRITE_BUF_SIZE; |
|
- | 276 | if (len >= scr_width - col) |
|
- | 277 | len = scr_width - col; |
|
- | 278 | ||
- | 279 | (void) ipc_data_write_finalize(callid, fb_write_buf, len); |
|
- | 280 | ||
- | 281 | if ((lastcol != col) || (lastrow != row)) |
|
- | 282 | serial_goto(row, col); |
|
- | 283 | ||
- | 284 | for (i = 0; i < len; i++) { |
|
- | 285 | (*putc_function)(fb_write_buf[i]); |
|
- | 286 | } |
|
- | 287 | ||
- | 288 | lastcol = col + len; |
|
- | 289 | lastrow = row; |
|
- | 290 | ||
- | 291 | ipc_answer_1(rid, EOK, len); |
|
- | 292 | } |
|
- | 293 | ||
246 | /** |
294 | /** |
247 | * Main function of the thread serving client connections. |
295 | * Main function of the thread serving client connections. |
248 | */ |
296 | */ |
249 | void serial_client_connection(ipc_callid_t iid, ipc_call_t *icall) |
297 | void serial_client_connection(ipc_callid_t iid, ipc_call_t *icall) |
250 | { |
298 | { |
Line 253... | Line 301... | ||
253 | ipc_call_t call; |
301 | ipc_call_t call; |
254 | keyfield_t *interbuf = NULL; |
302 | keyfield_t *interbuf = NULL; |
255 | size_t intersize = 0; |
303 | size_t intersize = 0; |
256 | 304 | ||
257 | char c; |
305 | char c; |
258 | int lastcol = 0; |
- | |
259 | int lastrow = 0; |
- | |
260 | int newcol; |
306 | int newcol; |
261 | int newrow; |
307 | int newrow; |
262 | int fgcolor; |
308 | int fgcolor; |
263 | int bgcolor; |
309 | int bgcolor; |
264 | int flags; |
310 | int flags; |
Line 315... | Line 361... | ||
315 | lastcol = newcol + 1; |
361 | lastcol = newcol + 1; |
316 | lastrow = newrow; |
362 | lastrow = newrow; |
317 | (*putc_function)(c); |
363 | (*putc_function)(c); |
318 | retval = 0; |
364 | retval = 0; |
319 | break; |
365 | break; |
- | 366 | case FB_WRITE: |
|
- | 367 | fb_write(callid, &call); |
|
- | 368 | ||
- | 369 | /* Message already answered */ |
|
- | 370 | continue; |
|
320 | case FB_CURSOR_GOTO: |
371 | case FB_CURSOR_GOTO: |
321 | newrow = IPC_GET_ARG1(call); |
372 | newrow = IPC_GET_ARG1(call); |
322 | newcol = IPC_GET_ARG2(call); |
373 | newcol = IPC_GET_ARG2(call); |
323 | serial_goto(newrow, newcol); |
374 | serial_goto(newrow, newcol); |
324 | lastrow = newrow; |
375 | lastrow = newrow; |