COM iMX6 WinCE: Difference between revisions

From Wiki-DB
Jump to navigationJump to search
Ageisreiter (talk | contribs)
Capfel (talk | contribs)
No edit summary
Line 9: Line 9:
: 2. Wait for the ActiveSync connection to be ready.
: 2. Wait for the ActiveSync connection to be ready.
: 3. Start ASRDisp.exe.
: 3. Start ASRDisp.exe.
== <br/>WEC7 DHHalLib (function library) ==
The DHHalLib provides hardware related functions for Windows Embedded CE 6 and Windows Embedded Compact 7. All the functionality is available from the user mode.
=== Version numbers ===
:'''Read DHHalLib version'''
:{| class="wikitable"
|''<code> unsigned long DHHalLibGetVersion() </code>''
|}
:Return value: <code>unsigned long</code> --> version number (e.g. 0x01040001 for version 1.4.0.1)
:'''BSP version'''
:{| class="wikitable"
|''<code> unsigned long BSPGetVersion() </code>''
|}
:Return value: <code>unsigned long</code> --> version number (e.g. 0x01040001 for version 1.4.0.1)
:Note: The version number information is stored in the following registry key: <code>[HKEY_LOCAL_MACHINE\Ident] dword:"BSPVersionNumber"</code>
:'''Read image version'''
:{| class="wikitable"
|''<code> unsigned long WinCEImageGetVersion() </code>''
|}
:Return value: <code>unsigned long</code> --> version number (e.g. 0x01040001 for version 1.4.0.1)
=== GPIO ===
:'''Note:''' These functions can only access the DHCOM standard GPIOs. The mapping is done with the following enum.
  typedef enum DHCOM_GPIOEnum
  {
    DHCOM_GPIO_A,
    DHCOM_GPIO_B,
    DHCOM_GPIO_C,
    DHCOM_GPIO_D,
    DHCOM_GPIO_E,
    DHCOM_GPIO_F,
    DHCOM_GPIO_G,
    DHCOM_GPIO_H,
    DHCOM_GPIO_I,
    DHCOM_GPIO_J,
    DHCOM_GPIO_K,
    DHCOM_GPIO_L,
    DHCOM_GPIO_M,
    DHCOM_GPIO_N,
    DHCOM_GPIO_O,
    DHCOM_GPIO_P,
    DHCOM_GPIO_Q,
    DHCOM_GPIO_R,
    DHCOM_GPIO_S,
    DHCOM_GPIO_T,
    DHCOM_GPIO_U,
    DHCOM_GPIO_V,
    DHCOM_GPIO_W,
    DHCOM_GPIO_NOT_DEFINED
  }*pDHCOM_GPIOEnum;
:'''Direction'''
:{| class="wikitable"
|''<code> bool GPIOSetDirection( DHCOM_GPIOEnum eGpio, bool bInOut, bool bDefaultState) </code>''
|}
:Input values:
::<code>DHCOM_GPIOEnum eGpio </code>= DHCOM GPIO pin name
::<code>bool bInOut</code> = GPIO direction (1 = input / 0 = output)
::<code>bool bDefaultState </code>= Default state (0 = low / 1 = high)
:Return value: <code>bool</code> --> true = success; false = failed
:'''Set state'''
:{| class="wikitable"
|''<code> void GPIOSetPin(DHCOM_GPIOEnum eGpio, bool bState) </code>''
|}
:Input values:
::<code>DHCOM_GPIOEnum eGpio</code> = DHCOM GPIO pin name
::<code>bool bState</code> = pin state ( 0 = low / 1 = high)
:'''Read state'''
:{| class="wikitable"
|''<code> bool GPIOGetPin(DHCOM_GPIOEnum eGpio) </code>''
|}
:Input values:
::<code>DHCOM_GPIOEnum eGpio</code> = DHCOM GPIO pin name
:Return value: <code>bool</code> --> 0 = low; 1 = high
:'''Set Interrupt'''
:{| class="wikitable"
|''<code> bool GPIOSetInterrupt(DHCOM_GPIOEnum eGpio, HANDLE *hEvent, unsigned long ulTimeout) </code>''
|}
:Input values:
::<code>DHCOM_GPIOEnum eGpio</code> = DHCOM GPIO pin name
::<code>HANDLE *hEvent</code> = external EventHandle Pointer
::<code>bool bState</code> = GPIO Interrupt State
:Return value: <code>bool</code> --> true = success; false = failed
:'''Clear Interrupt'''
:{| class="wikitable"
|''<code> bool GPIOClearInterrupt(DHCOM_GPIOEnum eGpio) </code>''
|}
:Input values:
::<code>DHCOM_GPIOEnum eGpio</code> = DHCOM GPIO pin name
:Return value: <code>bool</code> --> true = success; false = failed
=== I2C ===
:'''Note:''' These freqencies can only be set. The mapping is done with the following enum.
  typedef enum DHCOM_I2CEnum
  {
    DHCOM_I2C0=0,
    DHCOM_I2C1,
    DHCOM_I2C2,
    DHCOM_I2C3,
    DHCOM_I2C_NOT_DEFINED
  }*pDHCOM_I2CEnum;
:'''Note:''' These freqencies can only be set. The mapping is done with the following enum.
typedef enum DHCOM_I2CFREQMode
  {
    I2C_100K=0,
    I2C_400K,
    I2C_800K,I2C_1600K,
    I2C_2400K,
    I2C_3200K
  }*pDHCOM_I2CFREQMode;
:'''Open'''
:{| class="wikitable"
|''<code> bool I2COpen(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq) </code>''
|}
:Input values:
::<code>DHCOM_I2CEnum eI2CPort</code> = DHCOM I2C port name (e.g. DHCOM_I2C0)
::<code>DHCOM_I2CFREQMode eI2CFreq</code> = DHCOM I2C port freqency name(e.g. I2C_100K)
:Return value: <code>bool</code> --> true = success; false = failed
:'''Close'''
:{| class="wikitable"
|''<code> void I2CClose(DHCOM_I2CEnum eI2CPort) </code>''
|}
:Input values:
::<code>DHCOM_I2CEnum eI2CPort</code> = DHCOM I2C port name (e.g. DHCOM_I2C0)
:'''Read'''
:{| class="wikitable"
|''<code> bool I2CRead(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, unsigned char cDevId, unsigned char cI2CReg, unsigned char *pOutBuffer) </code>''
|}
:Input values:
::<code>DHCOM_I2CEnum eI2CPort</code> = DHCOM I2C port name (e.g. DHCOM_I2C0)
::<code>DHCOM_I2CFREQMode eI2CFreq</code> = DHCOM I2C port freqency name(e.g. I2C_100K)
::<code>unsigned char cDevId</code> = I2C device address (0..127)
::<code>unsigned char cI2CReg</code> = I2C device register address (0..255)
::<code>unsigned char *pOutBuffer</code> = Pointer to the read byte
:Return value: <code>bool</code> --> true = success; false = failed
:'''Write'''
:{| class="wikitable"
|''<code> bool I2CWrite(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, unsigned char cDevId, unsigned char cI2CReg, unsigned char cValue) </code>''
|}
:Input values:
::<code>DHCOM_I2CEnum eI2CPort</code> = DHCOM I2C port name (e.g. DHCOM_I2C0)
::<code>DHCOM_I2CFREQMode eI2CFreq</code> = DHCOM I2C port freqency name(e.g. I2C_100K)
::<code>unsigned char cDevId</code> = I2C device address (0..127)
::<code>unsigned char cI2CReg</code> = I2C device register address (0..255)
::<code>unsigned char cValue</code> = Value to be written
:Return value: <code>bool</code> --> true = success; false = failed
:'''Read multiple bytes'''
:{| class="wikitable"
|''<code> bool I2CReadMultipleBytes(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, unsigned char cDevId, unsigned char cI2CReg, unsigned char cBytes, unsigned char *pOutBuffer) </code>''
|}
:Input values:
::<code>DHCOM_I2CEnum eI2CPort</code> = DHCOM I2C port name (e.g. DHCOM_I2C0)
::<code>DHCOM_I2CFREQMode eI2CFreq</code> = DHCOM I2C port freqency name(e.g. I2C_100K)
::<code>unsigned char cDevId</code> = I2C device address (0..127)
::<code>unsigned char cI2CReg</code> = I2C device register address (0..255)
::<code>unsigned char cBytes</code> = Number of bytes to be read (max. 255)
::<code>unsigned char *pOutBuffer</code> = Pointer to the read buffer
:Return value: <code>bool</code> --> true = success; false = failed
:'''Write multiple bytes'''
:{| class="wikitable"
|''<code> bool I2CWriteMultipleBytes(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, unsigned char cDevId, unsigned char cI2CReg, unsigned char cBytes, unsigned char *pInBuffer)</code>''
|}
:Input values:
::<code>DHCOM_I2CEnum eI2CPort</code> = DHCOM I2C port name (e.g. DHCOM_I2C0)
::<code>DHCOM_I2CFREQMode eI2CFreq</code> = DHCOM I2C port freqency name(e.g. I2C_100K)
::<code>unsigned char cDevId</code> = I2C device address (0..127)
::<code>unsigned char cI2CReg</code> = I2C device register address (0..255)
::<code>unsigned char cBytes</code> = Number of bytes to be read (max. 255)
::<code>unsigned char *pInBuffer</code> = Pointer to the input buffer
:Return value: <code>bool</code> --> true = success; false = failed
=== Memory ===
:'''Read physical address'''
:{| class="wikitable"
|''<code> int ReadPhysicalAddress(int iPhyAddr, unsigned char cRegSize) </code>''
|}
:Input values:
::<code>int iPhyAddr</code> = Physical address
::<code>unsigned char cRegSize</code> = Register size (16 = 16bit; 32 = 32bit)
:Return value: <code>int</code> --> current value of the physical address
:'''Write physical address'''
:{| class="wikitable"
|''<code> int WritePhysicalAddress( int iPhyAddr, unsigned char cRegSize, int iValue, bool bReadBack) </code>''
|}
:Input values:
::<code>int iPhyAddr</code> = physical address
::<code>unsigned char cRegSize</code> = Register size (16 = 16bit; 32 = 32bit)
::<code>int iValue</code> = Value to be written
::<code>bool bReadBack</code> = true --> the current value is read back after the write; false --> the current value isn’t read back after the write
:Return value: <code>int</code> --> content of the physical address after write, if <code>bReadBack</code> = true. Otherwise the function returns 0.
=== KITL ===
:'''Restart'''
:{| class="wikitable"
|''<code> bool RestartPowerKITL() </code>''
|}
:Input values:
:Return value: <code>bool</code> --> true = success; false = failed
:'''Control'''
:{| class="wikitable"
|''<code> bool ControlPowerKITL(bool bEnable) </code>''
|}
:Input values:
::<code>bool bEnable</code> = Enable/Disable KITL Connection
:Return value: <code>bool</code> --> true = success; false = failed
=== Backlight ===
:'''Backlight Level'''
:{| class="wikitable"
|''<code> bool SetBacklightLevel(int Level) </code>''
|}
:Input values:
::<code>int Level</code> = Backlight Level (0 ... 255)
:Return value: <code>bool</code> --> true = success; false = failed
:'''Backlight Timeout'''
:{| class="wikitable"
|''<code> bool SetBacklightSuspend(int Timeout, bool bEnable) </code>''
|}
:Input values:
::<code>int Timeout</code> = Timeout for Backlight (seconds)
::<code>bool bEnable</code> = Enable/Disable Timeout Backlight --> true = On; false = Off
:Return value: <code>bool</code> --> true = success; false = failed
=== Touch screen===
:'''Calibrate touch'''
:{| class="wikitable"
|''<code> bool CalibrateTouch() </code>''
|}
:Return value: <code>bool</code> --> true = success; false = failed
:'''Clear calibration data'''
:{| class="wikitable"
|''<code> bool ClearTouchCalibrationData() </code>''
|}
:Description:
:: This function delete the registry entry <code>[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TOUCH] dword:"TouchCalibrationDone" </code>. For saving the value permanent please call <code>SaveRegistry() </code>afterwards.
:Return value: <code>bool</code> --> true = success; false = failed
=== Registry ===
:'''Save HIVE registry'''
:{| class="wikitable"
|''<code> bool SaveRegistry() </code>''
|}
:Return value: <code>bool</code> --> true = success; false = failed
:'''Create backup'''
:{| class="wikitable"
|''<code> bool CreateRegistryBackup() </code>''
|}
:Description:
:: This function generates the files ave_HKLM_Reg.srg and Save_HKLCU_Reg.srg in the folder \Storage Card\. These files can be used at a later time to restore the registry.
:Return value: <code>bool</code> --> true = success; false = failed
:'''Restore backup'''
:{| class="wikitable"
|''<code> bool RestoreRegistryBackup() </code>''
|}
:Description:
:: This function restores the registry from the files Save_HKLM_Reg.srg and Save_HKLCU_Reg.srg in the folder \Storage Card\. Afterwards a restart is carried out automatically. If the backup files are not present, then the function returns the return value flase.
:Return value: <code>bool</code> --> true = this never happens because a soft reset is performed; false = failed
=== Watchdog & Reset ===
:'''Soft reset'''
:{| class="wikitable"
|''<code> void SoftReset() </code>''
|}

Revision as of 15:25, 1 February 2016


FAQ


WEC7 Tools

CE Remote Display Application

The Remote Display allows to operate the target device's Win CE desktop from a Windows PC. It requires a USB ActiveSync connection.
Download X86 remote display application (over ActiveSync connection)
Usage
1. Extract the zip file on your PC.
2. Wait for the ActiveSync connection to be ready.
3. Start ASRDisp.exe.


WEC7 DHHalLib (function library)

The DHHalLib provides hardware related functions for Windows Embedded CE 6 and Windows Embedded Compact 7. All the functionality is available from the user mode.

Version numbers

Read DHHalLib version
unsigned long DHHalLibGetVersion()
Return value: unsigned long --> version number (e.g. 0x01040001 for version 1.4.0.1)
BSP version
unsigned long BSPGetVersion()
Return value: unsigned long --> version number (e.g. 0x01040001 for version 1.4.0.1)
Note: The version number information is stored in the following registry key: [HKEY_LOCAL_MACHINE\Ident] dword:"BSPVersionNumber"
Read image version
unsigned long WinCEImageGetVersion()
Return value: unsigned long --> version number (e.g. 0x01040001 for version 1.4.0.1)

GPIO

Note: These functions can only access the DHCOM standard GPIOs. The mapping is done with the following enum.
  typedef enum DHCOM_GPIOEnum
  {
    DHCOM_GPIO_A,
    DHCOM_GPIO_B,
    DHCOM_GPIO_C,
    DHCOM_GPIO_D,
    DHCOM_GPIO_E,
    DHCOM_GPIO_F,
    DHCOM_GPIO_G,
    DHCOM_GPIO_H,
    DHCOM_GPIO_I,
    DHCOM_GPIO_J,
    DHCOM_GPIO_K,
    DHCOM_GPIO_L,
    DHCOM_GPIO_M,
    DHCOM_GPIO_N,
    DHCOM_GPIO_O,
    DHCOM_GPIO_P,
    DHCOM_GPIO_Q,
    DHCOM_GPIO_R,
    DHCOM_GPIO_S,
    DHCOM_GPIO_T,
    DHCOM_GPIO_U,
    DHCOM_GPIO_V,
    DHCOM_GPIO_W,
    DHCOM_GPIO_NOT_DEFINED
  }*pDHCOM_GPIOEnum;
Direction
bool GPIOSetDirection( DHCOM_GPIOEnum eGpio, bool bInOut, bool bDefaultState)
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
bool bInOut = GPIO direction (1 = input / 0 = output)
bool bDefaultState = Default state (0 = low / 1 = high)
Return value: bool --> true = success; false = failed
Set state
void GPIOSetPin(DHCOM_GPIOEnum eGpio, bool bState)
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
bool bState = pin state ( 0 = low / 1 = high)
Read state
bool GPIOGetPin(DHCOM_GPIOEnum eGpio)
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
Return value: bool --> 0 = low; 1 = high
Set Interrupt
bool GPIOSetInterrupt(DHCOM_GPIOEnum eGpio, HANDLE *hEvent, unsigned long ulTimeout)
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
HANDLE *hEvent = external EventHandle Pointer
bool bState = GPIO Interrupt State
Return value: bool --> true = success; false = failed
Clear Interrupt
bool GPIOClearInterrupt(DHCOM_GPIOEnum eGpio)
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
Return value: bool --> true = success; false = failed

I2C

Note: These freqencies can only be set. The mapping is done with the following enum.
  typedef enum DHCOM_I2CEnum
  {
   DHCOM_I2C0=0,
   DHCOM_I2C1,
   DHCOM_I2C2,
   DHCOM_I2C3,
   DHCOM_I2C_NOT_DEFINED
  }*pDHCOM_I2CEnum;
Note: These freqencies can only be set. The mapping is done with the following enum.

typedef enum DHCOM_I2CFREQMode

  {
   I2C_100K=0,
   I2C_400K,
   I2C_800K,I2C_1600K,
   I2C_2400K,
   I2C_3200K
  }*pDHCOM_I2CFREQMode;
Open
bool I2COpen(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
DHCOM_I2CFREQMode eI2CFreq = DHCOM I2C port freqency name(e.g. I2C_100K)
Return value: bool --> true = success; false = failed
Close
void I2CClose(DHCOM_I2CEnum eI2CPort)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
Read
bool I2CRead(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, unsigned char cDevId, unsigned char cI2CReg, unsigned char *pOutBuffer)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
DHCOM_I2CFREQMode eI2CFreq = DHCOM I2C port freqency name(e.g. I2C_100K)
unsigned char cDevId = I2C device address (0..127)
unsigned char cI2CReg = I2C device register address (0..255)
unsigned char *pOutBuffer = Pointer to the read byte
Return value: bool --> true = success; false = failed
Write
bool I2CWrite(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, unsigned char cDevId, unsigned char cI2CReg, unsigned char cValue)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
DHCOM_I2CFREQMode eI2CFreq = DHCOM I2C port freqency name(e.g. I2C_100K)
unsigned char cDevId = I2C device address (0..127)
unsigned char cI2CReg = I2C device register address (0..255)
unsigned char cValue = Value to be written
Return value: bool --> true = success; false = failed
Read multiple bytes
bool I2CReadMultipleBytes(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, unsigned char cDevId, unsigned char cI2CReg, unsigned char cBytes, unsigned char *pOutBuffer)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
DHCOM_I2CFREQMode eI2CFreq = DHCOM I2C port freqency name(e.g. I2C_100K)
unsigned char cDevId = I2C device address (0..127)
unsigned char cI2CReg = I2C device register address (0..255)
unsigned char cBytes = Number of bytes to be read (max. 255)
unsigned char *pOutBuffer = Pointer to the read buffer
Return value: bool --> true = success; false = failed
Write multiple bytes
bool I2CWriteMultipleBytes(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, unsigned char cDevId, unsigned char cI2CReg, unsigned char cBytes, unsigned char *pInBuffer)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
DHCOM_I2CFREQMode eI2CFreq = DHCOM I2C port freqency name(e.g. I2C_100K)
unsigned char cDevId = I2C device address (0..127)
unsigned char cI2CReg = I2C device register address (0..255)
unsigned char cBytes = Number of bytes to be read (max. 255)
unsigned char *pInBuffer = Pointer to the input buffer
Return value: bool --> true = success; false = failed

Memory

Read physical address
int ReadPhysicalAddress(int iPhyAddr, unsigned char cRegSize)
Input values:
int iPhyAddr = Physical address
unsigned char cRegSize = Register size (16 = 16bit; 32 = 32bit)
Return value: int --> current value of the physical address
Write physical address
int WritePhysicalAddress( int iPhyAddr, unsigned char cRegSize, int iValue, bool bReadBack)
Input values:
int iPhyAddr = physical address
unsigned char cRegSize = Register size (16 = 16bit; 32 = 32bit)
int iValue = Value to be written
bool bReadBack = true --> the current value is read back after the write; false --> the current value isn’t read back after the write
Return value: int --> content of the physical address after write, if bReadBack = true. Otherwise the function returns 0.

KITL

Restart
bool RestartPowerKITL()
Input values:
Return value: bool --> true = success; false = failed
Control
bool ControlPowerKITL(bool bEnable)
Input values:
bool bEnable = Enable/Disable KITL Connection
Return value: bool --> true = success; false = failed

Backlight

Backlight Level
bool SetBacklightLevel(int Level)
Input values:
int Level = Backlight Level (0 ... 255)
Return value: bool --> true = success; false = failed
Backlight Timeout
bool SetBacklightSuspend(int Timeout, bool bEnable)
Input values:
int Timeout = Timeout for Backlight (seconds)
bool bEnable = Enable/Disable Timeout Backlight --> true = On; false = Off
Return value: bool --> true = success; false = failed

Touch screen

Calibrate touch
bool CalibrateTouch()
Return value: bool --> true = success; false = failed
Clear calibration data
bool ClearTouchCalibrationData()
Description:
This function delete the registry entry [HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TOUCH] dword:"TouchCalibrationDone" . For saving the value permanent please call SaveRegistry() afterwards.
Return value: bool --> true = success; false = failed

Registry

Save HIVE registry
bool SaveRegistry()
Return value: bool --> true = success; false = failed
Create backup
bool CreateRegistryBackup()
Description:
This function generates the files ave_HKLM_Reg.srg and Save_HKLCU_Reg.srg in the folder \Storage Card\. These files can be used at a later time to restore the registry.
Return value: bool --> true = success; false = failed
Restore backup
bool RestoreRegistryBackup()
Description:
This function restores the registry from the files Save_HKLM_Reg.srg and Save_HKLCU_Reg.srg in the folder \Storage Card\. Afterwards a restart is carried out automatically. If the backup files are not present, then the function returns the return value flase.
Return value: bool --> true = this never happens because a soft reset is performed; false = failed

Watchdog & Reset

Soft reset
void SoftReset()