Rev 1489 | Rev 1493 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1489 | Rev 1490 | ||
---|---|---|---|
Line 25... | Line 25... | ||
25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | */ |
28 | */ |
29 | 29 | ||
30 | #include <stdio.h> |
- | |
31 | #include <stdlib.h> |
30 | #include <stdlib.h> |
32 | #include <unistd.h> |
31 | #include <unistd.h> |
33 | #include <string.h> |
32 | #include <string.h> |
34 | #include <ddi.h> |
33 | #include <ddi.h> |
35 | #include <task.h> |
- | |
36 | #include <sysinfo.h> |
34 | #include <sysinfo.h> |
37 | #include <align.h> |
35 | #include <align.h> |
38 | #include <as.h> |
36 | #include <as.h> |
39 | #include <ipc/fb.h> |
37 | #include <ipc/fb.h> |
40 | #include <ipc/ipc.h> |
38 | #include <ipc/ipc.h> |
Line 387... | Line 385... | ||
387 | viewport_create(0,0,xres,yres); |
385 | viewport_create(0,0,xres,yres); |
388 | 386 | ||
389 | clear_port(0); |
387 | clear_port(0); |
390 | } |
388 | } |
391 | 389 | ||
392 | static int init_fb(void) |
- | |
393 | { |
- | |
394 | __address fb_ph_addr; |
- | |
395 | unsigned int fb_width; |
- | |
396 | unsigned int fb_height; |
- | |
397 | unsigned int fb_bpp; |
- | |
398 | unsigned int fb_scanline; |
- | |
399 | __address fb_addr; |
- | |
400 | int a=0; |
- | |
401 | int i,j,k; |
- | |
402 | int w; |
- | |
403 | char text[]="HelenOS Framebuffer driver\non Virtual Framebuffer\nVFB "; |
- | |
404 | - | ||
405 | fb_ph_addr=sysinfo_value("fb.address.physical"); |
- | |
406 | fb_width=sysinfo_value("fb.width"); |
- | |
407 | fb_height=sysinfo_value("fb.height"); |
- | |
408 | fb_bpp=sysinfo_value("fb.bpp"); |
- | |
409 | fb_scanline=sysinfo_value("fb.scanline"); |
- | |
410 | - | ||
411 | fb_addr=ALIGN_UP(((__address)set_maxheapsize(USER_ADDRESS_SPACE_SIZE_ARCH>>1)),PAGE_SIZE); |
- | |
412 | - | ||
413 | map_physmem(task_get_id(),(void *)((__address)fb_ph_addr),(void *)fb_addr, |
- | |
414 | (fb_scanline*fb_height+PAGE_SIZE-1)>>PAGE_WIDTH, |
- | |
415 | AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); |
- | |
416 | - | ||
417 | screen_init(fb_addr, fb_width, fb_height, fb_bpp, fb_scanline); |
- | |
418 | - | ||
419 | return 0; |
- | |
420 | } |
- | |
421 | - | ||
422 | static void draw_char(int vp, char c, unsigned int row, unsigned int col) |
390 | static void draw_char(int vp, char c, unsigned int row, unsigned int col) |
423 | { |
391 | { |
424 | viewport_t *vport = &viewports[vp]; |
392 | viewport_t *vport = &viewports[vp]; |
425 | 393 | ||
426 | if (vport->cursor_active && (vport->cur_col != col || vport->cur_row != row)) |
394 | if (vport->cursor_active && (vport->cur_col != col || vport->cur_row != row)) |
Line 440... | Line 408... | ||
440 | } |
408 | } |
441 | if (vport->cursor_active) |
409 | if (vport->cursor_active) |
442 | invert_char(vp, vport->cur_row, vport->cur_col); |
410 | invert_char(vp, vport->cur_row, vport->cur_col); |
443 | } |
411 | } |
444 | 412 | ||
445 | void client_connection(ipc_callid_t iid, ipc_call_t *icall) |
413 | static void fb_client_connection(ipc_callid_t iid, ipc_call_t *icall) |
446 | { |
414 | { |
447 | ipc_callid_t callid; |
415 | ipc_callid_t callid; |
448 | ipc_call_t call; |
416 | ipc_call_t call; |
449 | int retval; |
417 | int retval; |
450 | int i; |
418 | int i; |
Line 575... | Line 543... | ||
575 | } |
543 | } |
576 | ipc_answer_fast(callid,retval,0,0); |
544 | ipc_answer_fast(callid,retval,0,0); |
577 | } |
545 | } |
578 | } |
546 | } |
579 | 547 | ||
580 | int main(int argc, char *argv[]) |
548 | int fb_init(void) |
581 | { |
549 | { |
582 | char connected = 0; |
550 | __address fb_ph_addr; |
- | 551 | unsigned int fb_width; |
|
- | 552 | unsigned int fb_height; |
|
583 | int res; |
553 | unsigned int fb_bpp; |
- | 554 | unsigned int fb_scanline; |
|
584 | ipcarg_t phonead; |
555 | __address fb_addr; |
585 | 556 | ||
- | 557 | async_set_client_connection(fb_client_connection); |
|
- | 558 | ||
- | 559 | fb_ph_addr=sysinfo_value("fb.address.physical"); |
|
- | 560 | fb_width=sysinfo_value("fb.width"); |
|
- | 561 | fb_height=sysinfo_value("fb.height"); |
|
586 | if(!sysinfo_value("fb")) |
562 | fb_bpp=sysinfo_value("fb.bpp"); |
587 | return -1; |
563 | fb_scanline=sysinfo_value("fb.scanline"); |
588 | 564 | ||
589 | if ((res = ipc_connect_to_me(PHONE_NS, SERVICE_VIDEO, 0, &phonead)) != 0) |
565 | fb_addr=ALIGN_UP(((__address)set_maxheapsize(USER_ADDRESS_SPACE_SIZE_ARCH>>1)),PAGE_SIZE); |
590 | return -1; |
- | |
591 | 566 | ||
- | 567 | map_physmem(task_get_id(),(void *)((__address)fb_ph_addr),(void *)fb_addr, |
|
592 | if (init_fb() != 0) |
568 | (fb_scanline*fb_height+PAGE_SIZE-1)>>PAGE_WIDTH, |
- | 569 | AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); |
|
593 | return -1; |
570 | |
- | 571 | screen_init(fb_addr, fb_width, fb_height, fb_bpp, fb_scanline); |
|
594 | 572 | ||
595 | async_manager(); |
- | |
596 | /* Never reached */ |
- | |
597 | return 0; |
573 | return 0; |
598 | } |
574 | } |
- | 575 |