140 likes | 149 Views
NET+OS 6.1 Training. LCD Driver. LCD Driver. LCD Driver API in BSP Open Sequence Close Sequence ioctl Requests LCD_PANEL_INFO_TYPE FRAME_BUFFER_TYPE PALETTE_ENTRY_TYPE. LCD Driver API. open(): open a display device ioctl(): set up/change/get display device info
E N D
NET+OS 6.1 Training NetSilicon & Digi Confidential
LCD Driver NetSilicon & Digi Confidential
LCD Driver • LCD Driver API in BSP • Open Sequence • Close Sequence • ioctl Requests • LCD_PANEL_INFO_TYPE • FRAME_BUFFER_TYPE • PALETTE_ENTRY_TYPE NetSilicon & Digi Confidential
LCD Driver API • open(): open a display device • ioctl(): set up/change/get display device info • close(): close a display device • read()—not implemented • write()—not implemented NetSilicon & Digi Confidential
Open Sequence • Open the device fd = open ("/display/0", O_RDWR); • Set up the LCD display retval = ioctl (fd, LCD_SET_DISPLAY_TYPE, (void *)&lcdInfo); • Control enable on = 1; retval = ioctl (fd, LCD_SET_CONTROL_ENABLE, (void *)&on); • Delay according to LCD data sheet tx_thread_sleep (TFT_DELAY_TIME); • Power enable on = 1; retval = ioctl (fd, LCD_SET_POWER_ENABLE, (void *)&on); NetSilicon & Digi Confidential
Close Sequence • Disable LCD power on =0; ioctl (fd, LCD_SET_POWER_ENABLE, (void *)&on); • Delay according to LCD data sheet tx_thread_sleep (TFT_DELAY_TIME); • Disable LCD control on=0; ioctl (fd, LCD_SET_CONTROL_ENABLE, (void *)&on); • Close device close (fd); NetSilicon & Digi Confidential
ioctl Requests • LCD_SET_DISPLAY_TYPE • LCD_SET_CONTROL_ENABLE • LCD_SET_POWER_ENABLE • LCD_GET_PRIMARY_BUFFER • LCD_GET_CURRENT_BUFFER • LCD_SET_SWITCH_BUFFER • LCD_SET_PALETTE_ENTRY • LCD_GET_DISPLAY_WIDTH • LCD_GET_DISPLAY_HEIGHT • LCD_GET_DISPLAY_BPP • LCD_GET_DISPLAY_BYTEORDER • LCD_GET_DISPLAY_PIXELORDER • LCD_GET_DISPLAY_TYPE • LCD_GET_PALETTE_SIZE NetSilicon & Digi Confidential
LCD_PANEL_INFO_TYPE typedef struct { int lcdType; int lcdColor; int lcdMono8; int lcdWidth; int lcdHeight; unsigned char lcdBpp; unsigned char lcdClockSelect; int lcdBypassPixelClockDivider; unsigned char lcdPanelClockDivisor; int lcdPixelOrder; int lcdByteOrder; int lcdRGB; unsigned char lcdHorzBackPorch; unsigned char lcdHorzFrontPorch; unsigned char lcdHorzSyncPulseWidth; unsigned char lcdVertBackPorch; unsigned char lcdVertFrontPorch; unsigned char lcdVertSyncPulseWidth; int lcdInvertOutputEnable; int lcdInvertPanelClock; int lcdInvertHorzSync; int lcdInvertVertSync; unsigned char lcdAcBiasPinFrequency; int lcdLineEndEnable; unsigned char lcdLineEndDelay; } LCD_PANEL_INFO_TYPE; NetSilicon & Digi Confidential
FRAME_BUFFER_TYPE typedef struct { char* frameBuffer; int frameBufferLength; } FRAME_BUFFER_TYPE; frameBuffer can’t be in WRITE_BACK cached memory region NetSilicon & Digi Confidential
PALETTE_ENTRY_TYPE typedef struct { int paletteIndex; int intensity; unsigned char red; unsigned char green; unsigned char blue; } PALETTE_ENTRY_TYPE; NetSilicon & Digi Confidential
GUI API • Separate Library • Pixel API - put one pixel on the display - dcPutPixel() • Bitmap API - decode and display a bitmap file - dcDecodeBitmapHeader() - dcDisplayBmp() - dcSetUpPaletteFromBitmap NetSilicon & Digi Confidential
Double Buffering • Call dcPutPixel() with an user frame buffer • Call ioctl with request LCD_SET_SWITCH_BUFFER • Call dcDisplayBmp() with an user frame buffer • Call ioctl with request LCD_SET_SWITCH_BUFFER NetSilicon & Digi Confidential
For example: dcPutPixel() int dcPutPixel ( int fd, FRAME_BUFFER_TYPE *frameBuffer, int x, int y, unsigned char red, unsigned char green, unsigned char blue, int intensity); NetSilicon & Digi Confidential
References • HW manual • Auto doc: LCD driver and GUI library • Examples/lcd_tft24 • Data sheets: - Sharp: LQ10D421 - Sharp: LM057QC1T01 - Grand Pacific Optoelectronics Corp: GPG240X320-NFPDELW3 - LG. Philips LCD Co. , Ltd: LCD130V01 NetSilicon & Digi Confidential