| 624 | } |
| 625 | |
| 626 | static rt_err_t fb_control(rt_device_t dev, int cmd, void *args) |
| 627 | { |
| 628 | switch(cmd) { |
| 629 | case FBIOGET_PIXELINFO: |
| 630 | { |
| 631 | int *fmt = (int *)args; |
| 632 | *fmt = RTGRAPHIC_PIXEL_FORMAT_ARGB888; |
| 633 | break; |
| 634 | } |
| 635 | case FBIOPAN_DISPLAY: |
| 636 | { |
| 637 | struct lcd_device *lcd_drv = g_lcd; |
| 638 | rt_hw_cpu_dcache_clean(lcd_drv->framebuffer, LCD_DRV_FB_SZ); |
| 639 | rt_lcd_control((rt_device_t)g_lcd, RTGRAPHIC_CTRL_RECT_UPDATE, RT_NULL); |
| 640 | break; |
| 641 | } |
| 642 | case FBIOGET_FSCREENINFO: |
| 643 | { |
| 644 | rt_lcd_control((rt_device_t)g_lcd,FBIOGET_FSCREENINFO,args); |
| 645 | break; |
| 646 | } |
| 647 | case FBIOGET_VSCREENINFO: |
| 648 | { |
| 649 | struct lcd_device *lcd_drv = g_lcd; |
| 650 | struct fb_var_screeninfo *info = (struct fb_var_screeninfo *)args; |
| 651 | info->xres = lcd_drv->lcd_info.width; |
| 652 | info->yres = lcd_drv->lcd_info.height; |
| 653 | break; |
| 654 | } |
| 655 | case RT_FIOMMAP2: |
| 656 | { |
| 657 | struct dfs_mmap2_args *mmap2 = (struct dfs_mmap2_args *)args; |
| 658 | if (mmap2) |
| 659 | { |
| 660 | mmap2->ret = lwp_map_user_phy(lwp_self(),RT_NULL,g_lcd->framebuffer,mmap2->length,1); |
| 661 | } |
| 662 | else |
| 663 | { |
| 664 | return -EIO; |
| 665 | } |
| 666 | |
| 667 | break; |
| 668 | } |
| 669 | default: |
| 670 | break; |
| 671 | } |
| 672 | |
| 673 | return RT_EOK; |
| 674 | } |
| 675 | |
| 676 | #ifdef RT_USING_DEVICE_OPS |
| 677 | const static struct rt_device_ops fb_ops = |
nothing calls this directly
no test coverage detected