2007年5月27日 星期日

WinCE 5.0 BSP Migrate to 6.0 note -BSP Directory Rearchitecture

The following list is a summary of the differences between Windows CE 5.0 and Windows Embedded CE 6.0:
  • Public\Common\OAK\CSP\...

has been moved to
Platform\Common\Src\SOC\...

  • Chipset-specific code in:


Platform\Common\Src\x86\...
Platform\Common\Src\ARM\...
Platform\Common\Src\MIPS\...
Platform\Common\Src\SHx\...

has been moved to


Platform\Common\Src\SOC\...

Note:
Code that is specific to a CPU or is reusable by all platforms will still reside in Platform\Common\Src\ or Platform\Common\Src\Common

  • In the process of migrating to Platform\Common\Src\SOC\..., the directory, library, and dll names have been associated with a vendor and version to prevent conflicts. The naming convention for the directory is:__.

2007年5月25日 星期五

Driver Activate and Deactivate note

Activate:
HANDLE hdl=ActivateDeviceEx(
ACVTIVE_REG,NULL, 0, NULL );
if(hdl==INVALID_HANDLE_VALUE)
{
DWORD m = GetLastError();
RETAILMSG(1, (TEXT("ActivateDevice fail ,ErrCode = %d")),m);
}

note1. do not need HKEY_LOCAL_MACHINE\
note2. could not load \builtin registry


Deactivate :
m_devpre=L"CSR1:";
HANDLE dev =
CreateFile( m_devpre, GENERIC_READ GENERIC_WRITE,
0, NULL,
OPEN_EXISTING, 0, 0);

DEVMGR_DEVICE_INFORMATION DeviceInfo =
{ sizeof(DEVMGR_DEVICE_INFORMATION) };
GetDeviceInformationByFileHandle( dev, &DeviceInfo );
// Be sure to close the file handle before we unload the driver!
CloseHandle( dev );
DeactivateDevice( DeviceInfo.hDevice );

Bluetooth control Ap

Sample in \WINCE500\PUBLIC\COMMON\OAK\DRIVERS\BLUETOOTH\SAMPLE\BTLOADER\
Code examples for Bluetooth ON/OFF
ON:
{
HANDLE hDev =
CreateFile(
L"BTD0:", GENERIC_READ GENERIC_WRITE,
FILE_SHARE_READ FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
DWORD ictl = IOCTL_SERVICE_START;
if (hDev == INVALID_HANDLE_VALUE)
return;
WCHAR *argPtr = L"card";
DeviceIoControl(hDev, ictl, argPtr, sizeof(WCHAR) * (wcslen (argPtr) + 1), NULL, NULL, NULL, NULL);
CloseHandle (hDev);
}

OFF:
{
HANDLE hDev =
CreateFile(L"BTD0:",
GENERIC_READ GENERIC_WRITE,
FILE_SHARE_READ FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
DWORD ictl = IOCTL_SERVICE_STOP;
INT nBtStatus = 0;
if (hDev == INVALID_HANDLE_VALUE)
return;
WCHAR *argPtr = L"card";
DeviceIoControl(hDev, ictl, argPtr, sizeof(WCHAR) * (wcslen (argPtr) + 1), NULL, NULL, NULL, NULL);
CloseHandle(hDev);
}

2007年5月23日 星期三

RegCreate note

RegCreateKeyEx(
HKEY_LOCAL_MACHINE,
TEXT("GoPal"), 0,
TEXT("GoPal"),
REG_OPTION_NON_VOLATILE,// 特別注意此參數
// 是否要永久寫入
// Reg
// REG_OPTION_VOLATILE
0, NULL, &hRegKey, &ulDisposition)

WinCE 5.0 BSP Migrate to 6.0 note

BSP Migration Guide
In Windows Embedded CE 6.0, the kernel and OEM code are divided into the following three components:
1.Oal.exe

  • This contains the startup code and the OEM adaptation layer (OAL) implementation.
  • This component was previously named Kern.exe.

2.Kernel.dll

  • This contains the OAL-independent kernel implementation.

3.Kitl.dll

  • This contains the platform-specific KITL support.
Note:
Microsoft recommends that OEMs move KITL support out of the OAL and into Kitl.dll. All Microsoft sample board support packages (BSPs) will follow this model.


The goals for this design are to:

  • Minimize OAL changes
  • Clearly define the functions that the OAL can and cannot use
  • Provide version information between components to provide forward compatibility

This model provides the following advantages:

  • Allows Microsoft to update the kernel for retail devices without going through the OEM because the kernel is no longer dependent on the OAL.
  • Simplifies the debugging process with an instrumented kernel. You only need to include a new instrumented Kernel.dll into the release directory and then re-make the run-time image.
  • Provides OEMs with a binary-only version of the platform, which they can give to their customers.
  • Makes loadable KITL possible. (I don`t understand)
  • Enables all communication between the OEM code and the kernel to take place through well-defined interfaces.

BSP Migration Scenarios

Common.bib and the Make Run-Time Image (MakeImg) process require the following names:

  • Oal.exe, use this to rename Kern.exe
  • OalKitl.exe, use this to rename KernKitl.exe

從eVC轉到VS2005的注意事項

http://www.cnblogs.com/mengshu-lbq/archive/2007/03/15/675882.html

使用VS2005 技巧
http://blog.csdn.net/vcmfc/archive/2001/02/19/3583.aspx

SDRAM change from 64MB to 128MB

1. Nboot change
change
1.1 MEMC_TYPE to 32x16 ,mobil dram
1.2 PWR_DELAY_CTRL0 and PWR_DELAY_CTRL1
in D:\WINCE500\PLATFORM\MGPS\Nboot\sdram32.s
2. CE change
To change SDRAM size to 128M, we need to change the following files:
2.1. ATLASII_HH.BAT : SET DRAM_128M=1
2.2.\WINCE500\PLATFORM\ARAGORN\FILES\CONFIGCE.BIB
Change the Dram Size to fit the 128M usage - 0x073B0000(128M) = 0x033B0000(64M) + 0x4000000
IF DRAM_128M=1

#define FREE_RAMSIZE 073B0000
ELSE
#define FREE_RAMSIZE 033B0000

ENDIF
2.3.\WINCE500\PLATFORM\ARAGORN\INC\ARMMAP.INC
Change the DRAM_SIZE to 128M
DCD 0x8C000000, 0xC0000000, 128 ; 128 MB SDRAM

2007年5月22日 星期二

Bluetooth init flow

關於BT init 流程終於弄懂,流程如下
1. Device.exe 根據 registry builtin/driver load 各driver
2. Load serialCSR.dll -> run CSR_init()
3. Load AFD.dll -> Run HCI_OpenConnection() 此 Function
會根據
[HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\HCI]
"Driver"="bthcsr.dll"
"Name"="CSR1:"
"baud"=dword:1c200
"flags"=dword:4
"resetdelay"=dword:1388
去 createfile CSR1 , 這樣就會呼叫到 CSR_OPEN()
此時 會做 BC4 config 花 2~3 sec
4. service.exe running, check MS BT stack ready
5. MS BT function 就可以正常 work

為了讓開機省 3 sec ,必須 不能執行 HCI_OpenConnection() 去成功 creatfile CSR1
但測試結果
1. 如果 開機不LOAD serialCSR.dll ,HCI_OpenConnection 會執行失敗
MS BT Stack 就不能用, 所有BT function 就不能用
2. 試者開機後再去LOAD AFD.dll , 也不能work , 此檔案沒source code,無法進ㄧ步研究

2007年5月21日 星期一

WinCE driver load flow

WinCE driver load 流程是 device.exe 這個process 根據寫在registry 裡面 driver/builtin list 去 load 每隻 stream interface driver , 通常也只有執行各driver xxx_init() function
BT driver 會多花3 秒 是在 MS BT stack 執行 HCI_OpenConnection() function 對應到serialCSR 是 CSR_OPEN() function 做 BC4 參數設定

2007年5月20日 星期日

Build public folder

例如需要作一個 bthcsr.dll debug version 可以按下列步驟
set wincedebug=debug
set wincerel=1
switch to bthusb directory, typing build -c
set wincedebug=retial
sysgen -p common bthcsr

makeimg

測試結果還是需要做Sysgen

2007年5月18日 星期五

Bluetooth Driver in WinCE config

http://msdn2.microsoft.com/en-us/library/ms890956.aspx

[HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\HCI] "Driver"="bthcsr.dll"
"Name"="CSR1:"
"baud"=dword:1c200
"flags"=dword:4
"resetdelay"=dword:1388

基本上Bluetooth driver 只要com port 設對了 在適當得的Registry 寫好MS BT Stack 所會用到的dll , 就可以Work了

2007年5月11日 星期五