display_controller.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2011-08-08 lgnq first version for LS1B
  9. */
  10. #ifndef __DISPLAY_CONTROLLER_H__
  11. #define __DISPLAY_CONTROLLER_H__
  12. #include <rtthread.h>
  13. #include "ls1b.h"
  14. #define DC_BASE 0xBC301240 //Display Controller
  15. /* Frame Buffer registers */
  16. #define DC_FB_CONFIG __REG32(DC_BASE + 0x000)
  17. #define DC_FB_BUFFER_ADDR0 __REG32(DC_BASE + 0x020)
  18. #define DC_FB_BUFFER_STRIDE __REG32(DC_BASE + 0x040)
  19. #define DC_FB_BUFFER_ORIGIN __REG32(DC_BASE + 0x060)
  20. #define DC_DITHER_CONFIG __REG32(DC_BASE + 0x120)
  21. #define DC_DITHER_TABLE_LOW __REG32(DC_BASE + 0x140)
  22. #define DC_DITHER_TABLE_HIGH __REG32(DC_BASE + 0x160)
  23. #define DC_PANEL_CONFIG __REG32(DC_BASE + 0x180)
  24. #define DC_PANEL_TIMING __REG32(DC_BASE + 0x1A0)
  25. #define DC_HDISPLAY __REG32(DC_BASE + 0x1C0)
  26. #define DC_HSYNC __REG32(DC_BASE + 0x1E0)
  27. #define DC_VDISPLAY __REG32(DC_BASE + 0x240)
  28. #define DC_VSYNC __REG32(DC_BASE + 0x260)
  29. #define DC_FB_BUFFER_ADDR1 __REG32(DC_BASE + 0x340)
  30. /* Display Controller driver for 1024x768 16bit */
  31. #define FB_XSIZE 1024
  32. #define FB_YSIZE 768
  33. #define CONFIG_VIDEO_16BPP
  34. #define APB_CLK 33333333
  35. #define K1BASE 0xA0000000
  36. #define KSEG1(addr) ((void *)(K1BASE | (rt_uint32_t)(addr)))
  37. #define HW_FB_ADDR KSEG1(_rt_framebuffer)
  38. #define HW_FB_PIXEL(x, y) *(volatile rt_uint16_t*)((rt_uint8_t*)HW_FB_ADDR + (y * FB_XSIZE * 2) + x * 2)
  39. struct vga_struct
  40. {
  41. long pclk;
  42. int hr,hss,hse,hfl;
  43. int vr,vss,vse,vfl;
  44. };
  45. #endif