HAL Flat Display Driver Demystified

转自:http://blogs.msdn.com/ce_base/archive/2007/02/07/hal-flat-display-driver-demystified.aspx

 

Let’s talk about display drivers, particularly HAL Flat ones. HAL stands for Hardware Abstraction Layer and is also known as OEM Adaptation Layer (OAL).

 

What is a HAL Flat display driver?

 

In brief, it is yet another implementation of a GPE (Graphics Primitive Engine) based display driver, but with a twist: The driver itself does not contain any hardware dependent code and therefore it is totally platform independent. The hardware dependent code is pushed down to OAL. It communicates with OAL through I/O control (IOCTL) messages.

 

As its name suggests it requires a flat (contiguous) frame buffer either on the display hardware or in memory.

 

The driver source is under %_WINCEROOT%/Public/Common/OAK/Drivers/Display/hflat.

 

Why care about writing a HAL Flat display driver?

 

A HAL Flat driver is a good choice to quickly make the display work on a new platform.

 

HAL Flat driver is based on GPE technology only and not on DirectDraw (DDGPE). Therefore, it is much simpler and easier to implement. Writing the hardware dependent code in OAL is straightforward: just right the basic hardware initialization code and data transfer routines for the frame buffer (if needed at all). You don’t need to write any DMA or HW acceleration code unless the HAL Flat driver will be the final display driver for your platform. Either way your efforts in developing the hardware routines won’t go wasted, you can put them into a DDGPE based driver if you choose to implement one later.

 

How do I implement a HAL Flat display driver?

 

Here are the steps to make the HAL Flat driver to work with your hardware:

 

1.      Add the following line to into the IOCTL table in %_WINCEROOT%/Platform/%_TGTPLAT%/src/inc/ioctl_tab.h:

 

{ IOCTL_HAL_DDI,                        0,          OALIoCtlHalDDI              },

 

IOCTL_HAL_DDI is the IOCTL message for HAL Flat services that enter OAL at OALIoCtlHalDDI function.

 

2.      Add OALIoCtlHalDDI function to OAL code. Write the necessary hardware initialization and power management code and call it from OALIoCtlHalDDI.

 

Sample code for how to write OAL part of the HAL Flat display driver can be found under:

 

Windows CE 5.0:

%_WINCEROOT%/Platform/DBAu1100/src/kernel/oal/lcd.c

 

Windows CE 6.0:

%_WINCEROOT%/Platform/Aspen7750R/src/oal/oallib/ddi.c

 

Build OAL without any warnings or errors.

 

3.      Add the following section to %_WINCEROOT%/Platform/%_TGTPLAT%/Files/Platform.bib:

 

Windows CE 5.0:

 

; @CESYSGEN IF CE_MODULES_DISPLAY

IF BSP_NODISPLAY !

IF BSP_DISPLAY_HFLAT

 

ddi_hflat.dll       $(_FLATRELEASEDIR)/ddi_hflat.dll            NK  SH

 

ENDIF BSP_DISPLAY_HFLAT

ENDIF BSP_NODISPLAY !

; @CESYSGEN ENDIF CE_MODULES_DISPLAY

 

Windows CE 6.0:

 

; @CESYSGEN IF CE_MODULES_DISPLAY

IF BSP_NODISPLAY !

IF BSP_DISPLAY_HFLAT

 

ddi_hflat.dll       $(_FLATRELEASEDIR)/ddi_hflat.dll            NK  SHK

 

ENDIF BSP_DISPLAY_HFLAT

ENDIF BSP_NODISPLAY !

; @CESYSGEN ENDIF CE_MODULES_DISPLAY

 

4.      Add the following section to %_WINCEROOT%/Platform/%_TGTPLAT%/Files/Platform.reg:

 

Windows CE 5.0 and Windows CE 6.0:

 

; @CESYSGEN IF CE_MODULES_DISPLAY

IF BSP_NODISPLAY !

            IF BSP_DISPLAY_HFLAT

 

[HKEY_LOCAL_MACHINE/System/GDI/Drivers]

    "Display"="ddi_hflat.dll"   ; HAL FLAT driver uses hard coded configuration values

 

ENDIF BSP_DISPLAY_HFLAT

ENDIF BSP_NODISPLAY !

; @CESYSGEN ENDIF CE_MODULES_DISPLAY

 

5.      Build the image with BSP_DISPLAY_HFLAT flag set and BSP_DISPLAY_NOP flag cleared.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值