COM iMX6 WinCE: Difference between revisions

From Wiki-DB
Jump to navigationJump to search
Rgoellner (talk | contribs)
Capfel (talk | contribs)
 
(37 intermediate revisions by 3 users not shown)
Line 73: Line 73:
     DHCOM_GPIO_V,
     DHCOM_GPIO_V,
     DHCOM_GPIO_W,
     DHCOM_GPIO_W,
    DHCOM_GPIO_PWM,
    DHCOM_GPIO_INT_PRIO,
    DHCOM_GPIO_166,
    DHCOM_GPIO_165,
     DHCOM_GPIO_NOT_DEFINED
     DHCOM_GPIO_NOT_DEFINED
   }*pDHCOM_GPIOEnum;
   }*pDHCOM_GPIOEnum;
Line 247: Line 251:
     typedef enum DHCOM_SPIModeEnum
     typedef enum DHCOM_SPIModeEnum
     {
     {
         SPI_CS0=0,
         SPI_MODE0=0,
         SPI_CS1,
         SPI_MODE1,
         SPI_CS2,
         SPI_MODE2,
         SPI_CS3
         SPI_MODE3
     }*pDHCOM_SPIModeEnum;
     }*pDHCOM_SPIModeEnum;


:'''Note 1:''' Buffer fill instructions''
:'''Buffer fill instructions'''
:'''Note 2:''' Byte order in first array-element is always "little endian"''
:'''Note 1:''' Bits in first array-element are aligned to right.
:'''Note 3:''' First bit transferred is at bit-position "0" of array-element "0".
:'''Note 2:''' First bit transferred is at highest valid bit-position of array-element "0".
:'''Note 4:''' The remainder of the modulo operation "total number of SPI-transfer bits" mod 32 is always located in array-element "0".
:'''Note 3:''' The remainder of the modulo operation "total number of SPI-transfer bits" mod 32 is equal to the number of valid bits located in array-element "0".
:'''Note 5:''' Byte order in array-elements "n" (n>0) is always "big endian"''
:'''Note 4:''' If data length > 32 bits, all bit positions of required array-elements "n" (n>0) are always utilized.
:'''Note 6:''' First bit transferred in array-elements "n" (n>0) is at bit-position "31"
:'''Note 5:''' First bit transferred in array-elements "n" (n>0) is at bit-position "31"
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |                              Array-Element[0]                                      |                          Array-Element[n]                                          |
  |                              Array-Element[0]                                      |                          Array-Element[n]                                          |
  | ---- If data length less than 32 bit(s) data shift to right ----->>>>               | <<<<---- If data length greater than 32 bit(s) data shift to left ----              |
  | ---- If remainder of above modulo is > 0 then bit(s) shift to right ----->>>>       | ---- All bit positions of required array-elements "n" (n>0) are always utilized    |
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
  |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
| ---- If data length less than 64 bit(s) data shift to right ----->>>>              |                                                                                    |
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|


  '''Example less or equal than 32 bit(s):'''
  '''Examples less or equal than 32 bit(s):'''
|-------------------------------------------------------------------------------------|
|                              Array-Element[0]                                      |
  |-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|
  |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
  |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
  |-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|
  |0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Data
  |0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Example Data
  |-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|
  |          0x00        |          0x02        |        0x0f        |      0xaa    |
  |          0x00        |          0x02        |        0x0f        |      0xaa    | Example Data
  |-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|
  |                                         |   <---- 18 bit(s) to send/receive  --->   | Example: 18 bit(s)
  |                                                                     | <--8 bit(s)-->| Example:  8 bit(s)
|                                            | <---- 17 bit(s) to send/receive  ---> | Example: 17 bit(s)
  |                      |      <------  24 bit(s) to send/receive    ----->        | Example: 24 bit(s)
  |                      |      <------  24 bit(s) to send/receive    ----->        | Example: 24 bit(s)
  |                    <------  32 bit(s) to send/receive    ----->                    | Example: 32 bit(s)
  |                    <------  32 bit(s) to send/receive    ----->                    | Example: 32 bit(s)
  |-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|


  '''Example greater 32 bit(s) and less or equal than 64 bit(s):'''
  '''Examples greater 32 bit(s):'''
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|                              Array-Element[0]                                      |                          Array-Element[n]                                          |
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
  |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0|1|0|0|0|0|0|0|1|0|0 | 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0|
  |0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0|1|0|0|0|0|0|0|1|0|0 | 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Example Data
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |          0x00        |          0x00        |        0x01        |      0x02    |          0x04        |          0x08        |        0x0f        |      0xaa    |
  |          0x00        |          0x00        |        0x01        |      0x02    |          0x04        |          0x08        |        0x0f        |      0xaa    | Example Data
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |                            <---- first bit(s) of first data shift 1 to left ---< | | Example: 33 bit(s) to send/receive                                                 |
  | Example: 33 bit(s) to send/receive                                               |         <---- first bit located at bit-position "0" of array-element "0" --->        |
|              <------  first bit(s) of first data shift 2 to left    -----<    |   | Example: 34 bit(s) to send/receive                                                 |
| Example: 34 bit(s) to send/receive                                             |       <---- first bit located at bit-position "1" of array-element "0" --->            |
<------  first bit(s) of first data shift 10 to left  -----< |                   | Example: 42 bit(s) to send/receive                                                 |
| Example: 41 bit(s) to send/receive                               |            <---- first bit located at bit-position "9" of array-element "0" --->                     |
|            <------ data bits eqal data, no data shift is need ------>             | Example: 64 bit(s) to send/receive                                                 |
| Example: 64 bit(s) to send/receive           <---- first bit located at position "31" of array-element "0" (data length multiple of 32) --->                              |
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
:'''Example: Send 34bits (see example data (0x02 0x04 0x08 0x0F 0xAA) above) '''
:[[Image:WEC_SPI_example.png|800px]]


:'''Open'''
:'''Open'''
Line 317: Line 327:
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
::<code>DHCOM_SPIModeEnum eSPIMode</code> = DHCOM SPI mode name(e.g. DHCOM_CS0)
::<code>DHCOM_SPIModeEnum eSPIMode</code> = DHCOM SPI mode name(e.g. DHCOM_CS0)
::<code>unsigned int iSPIFreq</code> = DHCOM SPI frequency (e.g. 16MHz = 16000000)
::<code>unsigned int iSPIFreq</code> = DHCOM SPI clock (e.g. 1MHz = 1000000)
::<code>bool useDMA</code> = Enable DHCOM SPI DMA function
::<code>bool useDMA</code> = Enable DHCOM SPI DMA function
:Return value: <code>bool</code> --> true = success; false = failed
:Return value: <code>bool</code> --> true = success; false = failed
Line 327: Line 337:
:Input values:  
:Input values:  
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
::<code>int iBitCount</code> = Count of bit(s) length to send/receive
::<code>int iBitCount</code> = Data length (bit(s) count) to send/receive
::<code>unsigned long *pOutBuffer</code> = Pointer to the output buffer
::<code>unsigned long *pOutBuffer</code> = Pointer to the output buffer
::<code>unsigned long *pInBuffer</code> = Pointer to the input buffer
::<code>unsigned long *pInBuffer</code> = Pointer to the input buffer
Line 691: Line 701:
|}
|}
:Description:
: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.
:: This function delete the registry entry <code>[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TOUCH] dword:"TouchCalibrationDone" </code>.
:Return value: <code>bool</code> --> true = success; false = failed
 
:'''Save calibration data'''
:{| class="wikitable"
|''<code> bool SaveTouchCalibrationData() </code>''
|}
:Description:
:: This function save 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
:Return value: <code>bool</code> --> true = success; false = failed


Line 722: Line 740:
|''<code> void SoftReset() </code>''
|''<code> void SoftReset() </code>''
|}
|}
=== Audio ===
:'''Set WAVE Out Volume Level'''
:{| class="wikitable"
|''<code> void SetWAVEOutVolumeLevel(int volumeLevel) </code>''
|}
:Description:
:: This function set wave audio volume to specified given value. The range of 0 to 100 are only allowed.


== <br/>(WEC7) / WEC2013 DHHalLib C# Wrapper (function wrapper) ==
== <br/>(WEC7) / WEC2013 DHHalLib C# Wrapper (function wrapper) ==
Line 774: Line 800:
     DHCOM_GPIO_V,
     DHCOM_GPIO_V,
     DHCOM_GPIO_W,
     DHCOM_GPIO_W,
    DHCOM_GPIO_PWM,
    DHCOM_GPIO_INT_PRIO,
    DHCOM_GPIO_166,
    DHCOM_GPIO_165,
     DHCOM_GPIO_NOT_DEFINED
     DHCOM_GPIO_NOT_DEFINED
   };
   }*pDHCOM_GPIOEnum;


   public enum DHCOM_GPIOISRType
   public enum DHCOM_GPIOISRType
Line 936: Line 966:
     public enum DHCOM_SPIModeEnum
     public enum DHCOM_SPIModeEnum
     {
     {
         SPI_CS0=0,
         SPI_MODE0=0,
         SPI_CS1,
         SPI_MODE1,
         SPI_CS2,
         SPI_MODE2,
         SPI_CS3
         SPI_MODE3
     };
     };


:'''Note:''' Buffer fill instructions''
:'''Buffer fill instructions'''
:'''Note 1:''' Bits in first array-element are aligned to right.
:'''Note 2:''' First bit transferred is at highest valid bit-position of array-element "0".
:'''Note 3:''' The remainder of the modulo operation "total number of SPI-transfer bits" mod 32 is equal to the number of valid bits located in array-element "0".
:'''Note 4:''' If data length > 32 bits, all bit positions of required array-elements "n" (n>0) are always utilized.
:'''Note 5:''' First bit transferred in array-elements "n" (n>0) is at bit-position "31"
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |                                   Array[0]                                         |                                   Array[1]                                          |
  |                               Array-Element[0]                                     |                           Array-Element[n]                                          |
  | ---- If data length less than 32 bit(s) data shift to right ----->>>>               | <<<<---- If data length greater than 32 bit(s) data shift to left ----              |
  | ---- If remainder of above modulo is > 0 then bit(s) shift to right ----->>>>       | ---- All bit positions of required array-elements "n" (n>0) are always utilized    |
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
  |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
| ---- If data length less than 64 bit(s) data shift to right ----->>>>              |                                                                                    |
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|


  '''Example less or equal than 32 bit(s):'''
  '''Examples less or equal than 32 bit(s):'''
|-------------------------------------------------------------------------------------|
|                              Array-Element[0]                                      |
  |-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|
  |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
  |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
  |-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|
  |0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Data
  |0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Example Data
  |-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|
  |          0x00        |          0x02        |        0x0f        |      0xaa    |
  |          0x00        |          0x02        |        0x0f        |      0xaa    | Example Data
  |-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|
  |                                         |   <---- 18 bit(s) to send/receive  --->   | Example: 18 bit(s)
  |                                                                     | <--8 bit(s)-->| Example:  8 bit(s)
|                                            | <---- 17 bit(s) to send/receive  ---> | Example: 17 bit(s)
  |                      |      <------  24 bit(s) to send/receive    ----->        | Example: 24 bit(s)
  |                      |      <------  24 bit(s) to send/receive    ----->        | Example: 24 bit(s)
  |                    <------  32 bit(s) to send/receive    ----->                    | Example: 32 bit(s)
  |                    <------  32 bit(s) to send/receive    ----->                    | Example: 32 bit(s)
  |-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|


  '''Example greater 32 bit(s) and less or equal than 64 bit(s):'''
  '''Examples greater 32 bit(s):'''
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|                              Array-Element[0]                                      |                          Array-Element[n]                                          |
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
  |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0|1|0|0|0|0|0|0|1|0|0 | 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0|
  |0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0|1|0|0|0|0|0|0|1|0|0 | 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Example Data
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |          0x00        |          0x00        |        0x01        |      0x02    |          0x04        |          0x08        |        0x0f        |      0xaa    |
  |          0x00        |          0x00        |        0x01        |      0x02    |          0x04        |          0x08        |        0x0f        |      0xaa    | Example Data
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |                            <---- first bit(s) of first data shift 1 to left ---< | | Example: 33 bit(s) to send/receive                                                 |
  | Example: 33 bit(s) to send/receive                                               |         <---- first bit located at bit-position "0" of array-element "0" --->        |
|              <------  first bit(s) of first data shift 2 to left    -----<    |   | Example: 34 bit(s) to send/receive                                                 |
| Example: 34 bit(s) to send/receive                                             |       <---- first bit located at bit-position "1" of array-element "0" --->            |
<------  first bit(s) of first data shift 10 to left  -----< |                   | Example: 42 bit(s) to send/receive                                                 |
| Example: 41 bit(s) to send/receive                               |            <---- first bit located at bit-position "9" of array-element "0" --->                     |
|            <------ data bits eqal data, no data shift is need ------>             | Example: 64 bit(s) to send/receive                                                 |
| Example: 64 bit(s) to send/receive           <---- first bit located at position "31" of array-element "0" (data length multiple of 32) --->                              |
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
  |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
:'''Example: Send 34bits (see example data (0x02 0x04 0x08 0x0F 0xAA) above) '''
:[[Image:WEC_SPI_example.png|800px]]


:'''Open'''
:'''Open'''
Line 1,379: Line 1,420:
:Description:
: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.
:: 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
:'''Save calibration data'''
:{| class="wikitable"
|''<code> bool SaveTouchCalibrationData() </code>''
|}
:Description:
:: This function save 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
:Return value: <code>bool</code> --> true = success; false = failed


Line 1,409: Line 1,458:
|''<code> void SoftReset() </code>''
|''<code> void SoftReset() </code>''
|}
|}
=== Audio ===
:'''Set WAVE Out Volume Level'''
:{| class="wikitable"
|''<code> void SetWAVEOutVolumeLevel(int volumeLevel) </code>''
|}
:Description:
:: This function set wave audio volume to specified given value. The range of 0 to 100 are only allowed.


== <br/>WEC2013 Debugging ==
== <br/>WEC2013 Debugging ==
Line 1,420: Line 1,477:
: 3. Now the debug session can be started from visual studio.
: 3. Now the debug session can be started from visual studio.
:: [[Image:WEC2013_debug.JPG|500px]]
:: [[Image:WEC2013_debug.JPG|500px]]
== <br/>WEC2013 eMMC Memory ==
If the Image is stored on the microSD card (default case), the eMMC flash memory is mounted to folder '''MMCMemory''' during running WEC2013 system.
The flash memory can be used to store any user data.
== <br/>WEC2013 FTP Connection==
WinSCP can be used to establish FTP connection to the system.
: 1. Download [https://winscp.net/eng/index.php WinSCP]
:: NOTES:
::* protocol: '''FTP'''
::* user name: '''user'''
::* default password: '''dhcom_imx6'''
::* port number: '''21'''
::* IP address: Use IP scanner (e.g. [http://angryip.org/ Angry IP scanner] to get device address. Hostname: '''DHCOM_IMX6'''


== <br/>WEC2013 VNC Connection==
== <br/>WEC2013 VNC Connection==

Latest revision as of 10:48, 12 May 2022


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.


Binary BSP user guide

1. Download binary BSP (Please have a look at the iMX6 Downloads section.).
2. Unzip the files to any folder on your PC.
3. Call link-DHCOM_iMX6_BIN_GEN.bat file in the folder ...\DHCOM_iMX6_BSP_BIN\, to generate symbolic links in the \WINCE700\ folder.
4. Start Visual Studio 2008 with WEC7 platform builder.
5. Open platform builder project DHCOM_iMX6.pbxml at location C:\WINCE700\OSDesigns\DHCOM_iMX6_WEC7\.
6. Select retail build.
7. Call build --> rebuild solution to build the WEC7 image.
8. After the image build has completed successfully, the nk.nb0 image is stored at location C:\WINCE700\OSDesigns\DHCOM_iMX6_WEC7\RelDir\_1_Retail_DHCOM_iMX6_ARMV7\.
9. Copy the new nk.nb0 to your mircoSD card and restart the system.
Note: To delete the symbolic links (see 3.) please call unlink-DHCOM_iMX6_BIN_GEN.bat file in the folder ...\DHCOM_iMX6_BSP_BIN\


WEC7 / WEC2013 DHHalLib (function library)

The DHHalLib provides hardware related functions for Windows Embedded CE 6, Windows Embedded Compact 7 and Windows Embedded Compact 2013. 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_PWM,
    DHCOM_GPIO_INT_PRIO,
    DHCOM_GPIO_166,
    DHCOM_GPIO_165,
    DHCOM_GPIO_NOT_DEFINED
  }*pDHCOM_GPIOEnum;
  typedef enum DHCOM_GPIOISRType
  {
    DHCOM_GPIO_INTR_LOW_LEV=0,
    DHCOM_GPIO_INTR_HIGH_LEV,
    DHCOM_GPIO_INTR_RISE_EDGE,
    DHCOM_GPIO_INTR_FALL_EDGE,
    DHCOM_GPIO_INTR_BOTH_EDGE,
    DHCOM_GPIO_INTR_NONE
  }*pDHCOM_GPIOISRType;
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, DHCOM_GPIOISRType eISRType, HANDLE *hEvent, unsigned long ulTimeout)
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
DHCOM_GPIOISRType eISRType = DHCOM GPIO interrupt trigger level
HANDLE *hEvent = external EventHandle Pointer
unsigned long ulTimeout = Interrupt timeout (0 = infinite)
bool bState = GPIO Interrupt State
Return value: bool --> true = success; false = failed
Set Single Interrupt
bool GPIOSetSingleInterrupt(DHCOM_GPIOEnum eGpio, DHCOM_GPIOISRType eISRType, unsigned long ulTimeout)
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
DHCOM_GPIOISRType eISRType = DHCOM GPIO interrupt trigger level
unsigned long ulTimeout = Interrupt timeout (0 = infinite)
bool bState = GPIO Interrupt State
Return value: bool --> true = success; false = failed
Clear Interrupt
bool GPIOClearInterrupt(DHCOM_GPIOEnum eGpio)
Note: Gpio Interrupt cannot disable by Hardware.
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
Return value: bool --> true = success; false = failed

I2C

Note: These I2C Devices 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

SPI

Note: The following SPI Devices can be set. The mapping is done with the following enum.
  typedef enum DHCOM_SPIEnum
  {
       DHCOM_SPI1=0,
       DHCOM_SPI2,
       DHCOM_SPI_NOT_DEFINED
  }*pDHCOM_SPIEnum;
Note: These chip selects can be set. The mapping is done with the following enum.
   typedef enum DHCOM_SPIModeEnum
   {
       SPI_MODE0=0,
       SPI_MODE1,
       SPI_MODE2,
       SPI_MODE3
   }*pDHCOM_SPIModeEnum;
Buffer fill instructions
Note 1: Bits in first array-element are aligned to right.
Note 2: First bit transferred is at highest valid bit-position of array-element "0".
Note 3: The remainder of the modulo operation "total number of SPI-transfer bits" mod 32 is equal to the number of valid bits located in array-element "0".
Note 4: If data length > 32 bits, all bit positions of required array-elements "n" (n>0) are always utilized.
Note 5: First bit transferred in array-elements "n" (n>0) is at bit-position "31"
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|                               Array-Element[0]                                      |                           Array-Element[n]                                          |
| ---- If remainder of above modulo is > 0 then bit(s) shift to right ----->>>>       | ---- All bit positions of required array-elements "n" (n>0) are always utilized     |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
Examples less or equal than 32 bit(s):
|-------------------------------------------------------------------------------------|
|                               Array-Element[0]                                      |
|-------------------------------------------------------------------------------------|
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|
|0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Example Data
|-------------------------------------------------------------------------------------|
|          0x00         |          0x02         |        0x0f         |      0xaa     | Example Data
|-------------------------------------------------------------------------------------|
|                                                                     | <--8 bit(s)-->| Example:  8 bit(s)
|                                            | <---- 17 bit(s) to send/receive  --->  | Example: 17 bit(s)
|                       |       <------   24 bit(s) to send/receive    ----->         | Example: 24 bit(s)
|                    <------   32 bit(s) to send/receive    ----->                    | Example: 32 bit(s)
|-------------------------------------------------------------------------------------|
Examples greater 32 bit(s):
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|                               Array-Element[0]                                      |                           Array-Element[n]                                          |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0|1|0|0|0|0|0|0|1|0|0 | 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Example Data
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|          0x00         |          0x00         |        0x01         |      0x02     |          0x04         |          0x08         |        0x0f         |      0xaa     | Example Data
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
| Example: 33 bit(s) to send/receive                                                |         <---- first bit located at bit-position "0" of array-element "0" --->         |
| Example: 34 bit(s) to send/receive                                              |        <---- first bit located at bit-position "1" of array-element "0" --->            |
| Example: 41 bit(s) to send/receive                                |            <---- first bit located at bit-position "9" of array-element "0" --->                      | 
| Example: 64 bit(s) to send/receive           <---- first bit located at position "31" of array-element "0" (data length multiple of 32) --->                              |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
Example: Send 34bits (see example data (0x02 0x04 0x08 0x0F 0xAA) above)
Open
bool SPIOpen(DHCOM_SPIEnum eSPIPort)
Input values:
DHCOM_SPIEnum eSPIPort = DHCOM SPI port name (e.g. DHCOM_SPI1)
Return value: bool --> true = success; false = failed
Close
void SPIClose(DHCOM_SPIEnum eSPIPort)
Input values:
DHCOM_SPIEnum eSPIPort = DHCOM SPI port name (e.g. DHCOM_SPI1)
Configure
bool SPIConfigure(DHCOM_SPIEnum eSPIPort, DHCOM_SPIModeEnum eSPIMode, unsigned int iSPIFreq)
Input values:
DHCOM_SPIEnum eSPIPort = DHCOM SPI port name (e.g. DHCOM_SPI1)
DHCOM_SPIModeEnum eSPIMode = DHCOM SPI mode name(e.g. DHCOM_CS0)
unsigned int iSPIFreq = DHCOM SPI clock (e.g. 1MHz = 1000000)
bool useDMA = Enable DHCOM SPI DMA function
Return value: bool --> true = success; false = failed
Exchange
bool SPIExchange(DHCOM_SPIEnum eSPIPort, int iBitCount, unsigned long *pOutBuffer, unsigned long *pInBuffer)
Input values:
DHCOM_SPIEnum eSPIPort = DHCOM SPI port name (e.g. DHCOM_SPI1)
int iBitCount = Data length (bit(s) count) to send/receive
unsigned long *pOutBuffer = Pointer to the output buffer
unsigned long *pInBuffer = Pointer to the input buffer
Return value: bool --> true = success; false = failed

UART

(Note: Currently available for WEC 2013)

Note: These UART Devices can only be set. The mapping is done with the following enum.
  typedef enum DHCOM_UARTEnum
  {
       DHCOM_UART1=1,
       DHCOM_UART2,
       DHCOM_UART3
  }*pDHCOM_UARTEnum;
Note: These mode selects can be set. The mapping is done with the following enum.
   typedef enum DHCOM_UARTModeEnum
   {
       DHCOM_HSHAKE_OFF=1,
       DHCOM_HSHAKE_SOFTWARE,
       DHCOM_HSHAKE_HARDWARE
   }*pDHCOM_UARTModeEnum;
Note: These parity selects can be set. The mapping is done with the following enum.
   typedef enum DHCOM_UARTParityEnum
   {
       DHCOM_NOPARITY=0,
       DHCOM_ODDPARITY,
       DHCOM_EVENPARITY,
       DHCOM_MARKPARITY,
       DHCOM_SPACEPARITY
   }*pDHCOM_UARTParityEnum;
Note: These stopbit selects can be set. The mapping is done with the following enum.
   typedef enum DHCOM_UARTStopBitEnum
   {
       DHCOM_ONESTOPBIT=0,
       DHCOM_ONE5STOPBITS,
       DHCOM_TWOSTOPBITS
   }*pDHCOM_UARTStopBitEnum;
Note: These byte size selects can be set. The mapping is done with the following enum.
   typedef enum DHCOM_UARTByteSizeEnum
   {
       DHCOM_5BIT=5,
       DHCOM_6BIT,
       DHCOM_7BIT,
       DHCOM_8BIT
   }*pDHCOM_UARTByteSizeEnum;
Note: These event selects can be set. The mapping is done with the following enum.
   typedef enum DHCOM_UARTWEvent
   {
       SIG_RX_CHAR_DETECT_Flag=1,
       SIG_RX_EVENT_DETECT_Flag=2,
       SIG_TX_BUFFER_EMPTY_Flag=4,
       SIG_CTS_CHANGED_Flag=8,
       SIG_DSR_CHANGED_Flag=16,
       SIG_RLSD_CHANGED_Flag=32,
       SIG_BREAK_DETECT_Error=64,
       SIG_LINE_STATUS_Error=128,
       SIG_RING_DETECT_Error=512
   }*pDHCOM_UARTWEvent;
Open
bool UARTOpen(DHCOM_UARTEnum eUARTPort, DHCOM_UARTModeEnum eUARTMode, unsigned long lUARTFreq)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
DHCOM_UARTModeEnum eUARTMode = DHCOM UART mode name(e.g. DHCOM_HSHAKE_OFF)
unsigned long lUARTFreq = DHCOM UART frequency (e.g. 115200 bit/s = 115200)
Return value: bool --> true = success; false = failed
Close
void UARTClose(DHCOM_UARTEnum eUARTPort)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
Configure
bool UARTConfigure(DHCOM_UARTEnum eUARTPort, DHCOM_UARTModeEnum eUARTMode, DHCOM_UARTParityEnum eUARTParity, DHCOM_UARTStopBitEnum eUARTStopBit, DHCOM_UARTByteSizeEnum eUARTByteSize, unsigned long lUARTFreq)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
DHCOM_UARTModeEnum eUARTMode = DHCOM UART mode name(e.g. DHCOM_HSHAKE_OFF)
DHCOM_UARTParityEnum eUARTParity = DHCOM UART parity name (e.g. DHCOM_NOPARITY)
DHCOM_UARTStopBitEnum eUARTStopBit = DHCOM UART stop bit name (e.g. DHCOM_ONESTOPBIT)
DHCOM_UARTByteSizeEnum eUARTByteSize = DHCOM UART byte size name (e.g. DHCOM_8BIT)
unsigned long lUARTFreq = DHCOM UART frequency (e.g. 115200 bit/s = 115200)
Return value: bool --> true = success; false = failed
Configure Timeout
bool UARTConfigureTimeout(DHCOM_UARTEnum eUARTPort, unsigned long lReadIntervalTimeout, unsigned long lReadTotalTimeoutConstant, unsigned long lReadTotalTimeoutMultiplier, unsigned long ulWriteTotalTimeoutConstant, unsigned long ulWriteTotalTimeoutMultiplier)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
unsigned long lReadIntervalTimeout = Read interval timeout
unsigned long lReadTotalTimeoutConstant = Read total timeout
unsigned long lReadTotalTimeoutMultiplier = Read total timeout multiplier
unsigned long ulWriteTotalTimeoutConstant = Write total timeout
unsigned long ulWriteTotalTimeoutMultiplier = Write total timeout multiplier
Return value: bool --> true = success; false = failed
Clear buffer
bool UARTClearBuffer(DHCOM_UARTEnum eUARTPort)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
Read
bool UARTRead(DHCOM_UARTEnum eUARTPort, int iDataLength, unsigned char *pInBuffer)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
int iDataLength = Read data length
unsigned char *pInBuffer = Pointer to the input buffer
Return value: bool --> true = success; false = failed
Write
bool UARTWrite(DHCOM_UARTEnum eUARTPort, unsigned char *pOutBuffer)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
unsigned char *pOutBuffer = Pointer to the output buffer
Return value: bool --> true = success; false = failed

CAN

(Note: Currently available for WEC 2013)

Note: These CAN Devices can only be set. The mapping is done with the following enum.
  typedef enum DHCOM_CANEnum
  {
       DHCOM_CAN1=1,
       DHCOM_CAN_NOT_DEFINED
  }*pDHCOM_CANEnum;
Note: These mode selects can be set. The mapping is done with the following enum.
   typedef enum DHCOM_CANModeEnum
   {
       DHCOM_CAN_STANDARD=0,
       DHCOM_CAN_EXTENDED
   }*pDHCOM_CANModeEnum;
Note: These frame selects can be set. The mapping is done with the following enum.
   typedef enum DHCOM_CANFrameEnum
   {
       DHCOM_CAN_DATA=0,
       DHCOM_CAN_REMOTE
   }*pDHCOM_CANFrameEnum;
Open
bool CANOpen(DHCOM_CANEnum eCANPort, DHCOM_CANModeEnum eCANMode)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN port name (e.g. DHCOM_CAN1)
DHCOM_CANModeEnum eCANMode = DHCOM CAN mode name(e.g. DHCOM_CAN_STANDARD)
Return value: bool --> true = success; false = failed
Close
void CANClose(DHCOM_CANEnum eCANPort)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN port name (e.g. DHCOM_CAN1)
Configure
bool CANConfigureMode(DHCOM_CANEnum eCANPort, DHCOM_CANModeEnum eCANMode, unsigned long lCANBitrate = 0, bool bCANTLPrio = false, bool bCANLoopback = false)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
DHCOM_CANModeEnum eCANMode = DHCOM CAN id type (e.g. DHCOM_CAN_STANDARD | DHCOM_CAN_EXTENDED)
unsigned long lCANBitrate = DHCOM UART bitrate (e.g. 500000 bit/s = 500kbit)
bool bCANTLPrio = DHCOM CAN transmit local priority (e.g. false = disabled)
bool bCANLoopback = DHCOM CAN loopback mode (e.g. false = disabled)
Return value: bool --> true = success; false = failed
Configure Timing
bool CANConfigureTiming(DHCOM_CANEnum eCANPort, unsigned long lPrescaler, unsigned char cPropSeg, unsigned char cPhase1Seg, unsigned char cPhase2Seg, unsigned char RJW)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
unsigned long lPrescaler = Prescaler value
unsigned char cPropSeg = Property segmentation time value
unsigned char cPhase1Seg = Phase 1 segmentation time value
unsigned char cPhase2Seg = Phase 2 segmentation time value
unsigned char RJW = Request jump time value
Return value: bool --> true = success; false = failed
Configure Filter
bool CANConfigureFilter(DHCOM_CANEnum eCANPort, int iFilterID, int iFilterIDMask, bool bFilterFormat, bool bFilterRemote) Attention: CANConfigureFilter() might be call before you can read data.
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
int iFilterID = Filter ID value
int iFilterIDMask = Filter ID Mask value
bool bFilterFormat = Filter format (e.g. false = disabled)
bool bFilterRemote = Filter remote frame (e.g. false = disabled)
Return value: bool --> true = success; false = failed
Remove Filter
bool CANResetFilter(DHCOM_CANEnum eCANPort)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
Return value: bool --> true = success; false = failed
Configure Message
bool CANConfigureMessage(DHCOM_CANEnum eCANPort, DHCOM_CANFrameEnum eCANFrame, int iCANMsgID, unsigned char cCANMsgPrio, unsigned long lCANMsgTimeout, bool bReadWrite)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
DHCOM_CANFrameEnum eCANFrame = DHCOM CAN frame type (e.g. DHCOM_CAN_DATA | DHCOM_CAN_REMOTE)
int iCANMsgID = CAN Message identification number (e.g. 0x2) - only for can write
unsigned char cCANMsgPrio = CAN Message priority (e.g. 1) - only for can write
unsigned long lCANMsgTimeout = CAN Message timeout (e.g. 1000 = 1 sec)
bool bReadWrite = (Read = false, Write = true)
Return value: bool --> true = success; false = failed
Get Message Header
bool CANGetMessageParameter(DHCOM_CANEnum eCANPort, int *iCANMsgID, int *iCANMsgLength, int *iCANFrame, unsigned char *cCANMsgPrio, unsigned long *lCANMsgTimeout, int *iTXAbort)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
int *iCANMsgID = Pointer to Message identification value
int *iCANMsgLength = Pointer to Message length value
int *iCANFrame = Pointer to Message frame value
unsigned char *cCANMsgPrio = Pointer to Message priority value
unsigned long *lCANMsgTimeout = Pointer to Message timeout value
int *iTXAbort = Pointer to Message TX abort value
Return value: bool --> true = success; false = failed
Read
bool CANRead(DHCOM_CANEnum eCANPort, unsigned char *pInBuffer, int iDataLength, int *iResult) Attention: CANConfigureFilter() might be call before you can read data.
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
unsigned char *pInBuffer = Pointer to the input buffer
int iDataLength = Read data length
int *iResult = Pointer to the Result Value
Return value: bool --> true = success; false = failed
Write
bool CANWrite(DHCOM_CANEnum eCANPort, unsigned char *pOutBuffer, int iDataLength, int *iResult)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
unsigned char *pOutBuffer = Pointer to the output buffer
int iDataLength = Write data length
int *iResult = Pointer to the Result Value
Return value: bool --> true = success; false = failed

Physical Memory

Note: These freqencies can only be set. The mapping is done with the following enum.
   typedef enum DHCOM_PHYEnum
   {
       DHCOM_PHY1=1,
       DHCOM_PHY2,
       DHCOM_PHY3,
       DHCOM_PHY4,
       DHCOM_PHY5,
       DHCOM_PHY6,
       DHCOM_PHY7,
       DHCOM_PHY8,
       DHCOM_PHY9
   }*pDHCOM_PHYEnum;
Write Physical Address
int WritePhysicalAddress(DHCOM_PHYEnum PHYDev, unsigned long ulPhyAddr, unsigned char cRegSize, int iValue, bool bReadBack)
Input values:
DHCOM_PHYEnum PHYDev = DHCOM PHY Device name (e.g. DHCOM_PHY1)
unsigned long ulPhyAddr = Physical Address to write (e.g. GPIO1_MASK_REG = 0x209c014)
unsigned char cRegSize = Register Size (8 = 8bit, 16 = 16bit, 32 = 32bit)
int iValue = Value for Physical Address to write
bool bReadBack = Enable/Disable Readback function (enable = true -> disable = false)
Return value: int --> returns the written value from the specified Physical Address
if bReadBack == TRUE, else 0x0 will be returned
Read Physical Address
int ReadPhysicalAddress(DHCOM_PHYEnum PHYDev, unsigned long ulPhyAddr, unsigned char cRegSize)
Input values:
DHCOM_PHYEnum PHYDev = DHCOM PHY Device name (e.g. DHCOM_PHY1)
unsigned long ulPhyAddr = Physical Address to write (e.g. GPIO1_MASK_REG = 0x209c014)
unsigned char cRegSize = Register Size (8 = 8bit, 16 = 16bit, 32 = 32bit)
Return value: int --> returns the value from the specified Physical Address

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)
Note: In DHHalLib Version 1.0.0.0 only Backlight Enable/Disable available. (Value 0 = Disable, Value 1 to 255 = Enable)
Input values:
int Level = Backlight Level (0 ... 255)
Return value: bool --> true = success; false = failed
Backlight Timeout
bool SetBacklightSuspend(int Timeout, bool bEnable)
Note: In DHHalLib Version 1.0.0.0 not available.
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" .
Return value: bool --> true = success; false = failed
Save calibration data
bool SaveTouchCalibrationData()
Description:
This function save 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()

Audio

Set WAVE Out Volume Level
void SetWAVEOutVolumeLevel(int volumeLevel)
Description:
This function set wave audio volume to specified given value. The range of 0 to 100 are only allowed.


(WEC7) / WEC2013 DHHalLib C# Wrapper (function wrapper)

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

Version numbers

Read DHHalLib version
UInt32 DHHalLibGetVersion()
Return value: UInt32 --> version number (e.g. 0x01040001 for version 1.4.0.1)
BSP version
UInt32 BSPGetVersion()
Return value: UInt32 --> 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
UInt32 WinCEImageGetVersion()
Return value: UInt32 --> 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.
  public 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_PWM,
    DHCOM_GPIO_INT_PRIO,
    DHCOM_GPIO_166,
    DHCOM_GPIO_165,
    DHCOM_GPIO_NOT_DEFINED
  }*pDHCOM_GPIOEnum;
  public enum DHCOM_GPIOISRType
  {
    DHCOM_GPIO_INTR_LOW_LEV=0,
    DHCOM_GPIO_INTR_HIGH_LEV,
    DHCOM_GPIO_INTR_RISE_EDGE,
    DHCOM_GPIO_INTR_FALL_EDGE,
    DHCOM_GPIO_INTR_BOTH_EDGE,
    DHCOM_GPIO_INTR_NONE
  };
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 Single Interrupt
bool GPIOSetSingleInterrupt(DHCOM_GPIOEnum eGpio, DHCOM_GPIOISRType eISRType, ulong ulTimeout)
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
DHCOM_GPIOISRType eISRType = DHCOM GPIO interrupt trigger level
ulong ulTimeout = Interrupt timeout (0 = infinite)
bool bState = GPIO Interrupt State
Return value: bool --> true = success; false = failed
Clear Interrupt
bool GPIOClearInterrupt(DHCOM_GPIOEnum eGpio)
Note: Gpio Interrupt cannot disable by Hardware.
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
Return value: bool --> true = success; false = failed

I2C

Note: These I2C Devices can only be set. The mapping is done with the following enum.
  public enum DHCOM_I2CEnum
  {
   DHCOM_I2C0=0,
   DHCOM_I2C1,
   DHCOM_I2C2,
   DHCOM_I2C3,
   DHCOM_I2C_NOT_DEFINED
  };
Note: These freqencies can only be set. The mapping is done with the following enum.
  public enum DHCOM_I2CFREQMode
  {
   I2C_100K=0,
   I2C_400K,
   I2C_800K,I2C_1600K,
   I2C_2400K,
   I2C_3200K
  };
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, byte cDevId, byte cI2CReg, byte[] 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)
byte cDevId = I2C device address (0..127)
byte cI2CReg = I2C device register address (0..255)
ref byte pOutBuffer = Pointer to the read byte
Return value: bool --> true = success; false = failed
Write
bool I2CWrite(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, byte cDevId, byte cI2CReg, byte 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)
byte cDevId = I2C device address (0..127)
byte cI2CReg = I2C device register address (0..255)
byte cValue = Value to be written
Return value: bool --> true = success; false = failed
Read multiple bytes
bool I2CReadMultipleBytes(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, byte cDevId, byte cI2CReg, byte cBytes, byte[] 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)
byte cDevId = I2C device address (0..127)
byte cI2CReg = I2C device register address (0..255)
byte cBytes = Number of bytes to be read (max. 255)
byte[] pInBuffer = Pointer to the read buffer
Return value: bool --> true = success; false = failed
Write multiple bytes
bool I2CWriteMultipleBytes(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, byte cDevId, byte cI2CReg, byte cBytes, byte[] 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)
byte cDevId = I2C device address (0..127)
byte cI2CReg = I2C device register address (0..255)
byte cBytes = Number of bytes to be read (max. 255)
byte[] pOutBuffer = Pointer to the input buffer
Return value: bool --> true = success; false = failed

SPI

Note: These SPI Devices can only be set. The mapping is done with the following enum.
  public enum DHCOM_SPIEnum
  {
       DHCOM_SPI1=0,
       DHCOM_SPI2,
       DHCOM_SPI_NOT_DEFINED
  };
Note: These chip selects can be set. The mapping is done with the following enum.
   public enum DHCOM_SPIModeEnum
   {
       SPI_MODE0=0,
       SPI_MODE1,
       SPI_MODE2,
       SPI_MODE3
   };
Buffer fill instructions
Note 1: Bits in first array-element are aligned to right.
Note 2: First bit transferred is at highest valid bit-position of array-element "0".
Note 3: The remainder of the modulo operation "total number of SPI-transfer bits" mod 32 is equal to the number of valid bits located in array-element "0".
Note 4: If data length > 32 bits, all bit positions of required array-elements "n" (n>0) are always utilized.
Note 5: First bit transferred in array-elements "n" (n>0) is at bit-position "31"
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|                               Array-Element[0]                                      |                           Array-Element[n]                                          |
| ---- If remainder of above modulo is > 0 then bit(s) shift to right ----->>>>       | ---- All bit positions of required array-elements "n" (n>0) are always utilized     |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
Examples less or equal than 32 bit(s):
|-------------------------------------------------------------------------------------|
|                               Array-Element[0]                                      |
|-------------------------------------------------------------------------------------|
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|
|0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Example Data
|-------------------------------------------------------------------------------------|
|          0x00         |          0x02         |        0x0f         |      0xaa     | Example Data
|-------------------------------------------------------------------------------------|
|                                                                     | <--8 bit(s)-->| Example:  8 bit(s)
|                                            | <---- 17 bit(s) to send/receive  --->  | Example: 17 bit(s)
|                       |       <------   24 bit(s) to send/receive    ----->         | Example: 24 bit(s)
|                    <------   32 bit(s) to send/receive    ----->                    | Example: 32 bit(s)
|-------------------------------------------------------------------------------------|
Examples greater 32 bit(s):
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|                               Array-Element[0]                                      |                           Array-Element[n]                                          |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0|1|0|0|0|0|0|0|1|0|0 | 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Example Data
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|          0x00         |          0x00         |        0x01         |      0x02     |          0x04         |          0x08         |        0x0f         |      0xaa     | Example Data
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
| Example: 33 bit(s) to send/receive                                                |         <---- first bit located at bit-position "0" of array-element "0" --->         |
| Example: 34 bit(s) to send/receive                                              |        <---- first bit located at bit-position "1" of array-element "0" --->            |
| Example: 41 bit(s) to send/receive                                |            <---- first bit located at bit-position "9" of array-element "0" --->                      | 
| Example: 64 bit(s) to send/receive           <---- first bit located at position "31" of array-element "0" (data length multiple of 32) --->                              |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
Example: Send 34bits (see example data (0x02 0x04 0x08 0x0F 0xAA) above)
Open
bool SPIOpen(DHCOM_SPIEnum eSPIPort, DHCOM_SPIModeEnum eSPIMode, uint iSPIFreq)
Input values:
DHCOM_SPIEnum eSPIPort = DHCOM SPI port name (e.g. DHCOM_SPI1)
DHCOM_SPIModeEnum eSPIMode = DHCOM SPI mode name(e.g. DHCOM_CS0)
uint iSPIFreq = DHCOM SPI frequency (e.g. 16MHz = 16000000)
Return value: bool --> true = success; false = failed
Close
void SPIClose(DHCOM_SPIEnum eSPIPort)
Input values:
DHCOM_SPIEnum eSPIPort = DHCOM SPI port name (e.g. DHCOM_SPI1)
Configure
bool SPIConfigure(DHCOM_SPIEnum eSPIPort, DHCOM_SPIModeEnum eSPIMode, uint iSPIFreq, bool useDMA)
Input values:
DHCOM_SPIEnum eSPIPort = DHCOM SPI port name (e.g. DHCOM_SPI1)
DHCOM_SPIModeEnum eSPIMode = DHCOM SPI mode name(e.g. DHCOM_CS0)
uint iSPIFreq = DHCOM SPI frequency (e.g. 16MHz = 16000000)
bool useDMA = Enable DHCOM SPI DMA function
Return value: bool --> true = success; false = failed
Exchange
bool SPIExchange(DHCOM_SPIEnum eSPIPort, int iBitCount, ulong[] pOutBuffer, ulong[] pInBuffer)
Input values:
DHCOM_SPIEnum eSPIPort = DHCOM SPI port name (e.g. DHCOM_SPI1)
int iBitCount = Count of bit(s) length to send/receive
ulong[] pOutBuffer = Array to the output buffer
ulong[] pInBuffer = Array to the input buffer
Return value: bool --> true = success; false = failed

UART

(only available for C/C++ applications) (Note: Currently available for WEC 2013)

Note: These UART Devices can only be set. The mapping is done with the following enum.
  public enum DHCOM_UARTEnum
  {
       DHCOM_UART1=1,
       DHCOM_UART2,
       DHCOM_UART3
  };
Note: These mode selects can be set. The mapping is done with the following enum.
   public enum DHCOM_UARTModeEnum
   {
       DHCOM_HSHAKE_OFF=1,
       DHCOM_HSHAKE_SOFTWARE,
       DHCOM_HSHAKE_HARDWARE
   };
Note: These parity selects can be set. The mapping is done with the following enum.
   public enum DHCOM_UARTParityEnum
   {
       DHCOM_NOPARITY=0,
       DHCOM_ODDPARITY,
       DHCOM_EVENPARITY,
       DHCOM_MARKPARITY,
       DHCOM_SPACEPARITY
   };
Note: These stopbit selects can be set. The mapping is done with the following enum.
   public enum DHCOM_UARTStopBitEnum
   {
       DHCOM_ONESTOPBIT=0,
       DHCOM_ONE5STOPBITS,
       DHCOM_TWOSTOPBITS
   };
Note: These byte size selects can be set. The mapping is done with the following enum.
   public enum DHCOM_UARTByteSizeEnum
   {
       DHCOM_5BIT=5,
       DHCOM_6BIT,
       DHCOM_7BIT,
       DHCOM_8BIT
   };
Note: These event selects can be set. The mapping is done with the following enum.
   public enum DHCOM_UARTWEvent
   {
       SIG_RX_CHAR_DETECT_Flag=1,
       SIG_RX_EVENT_DETECT_Flag=2,
       SIG_TX_BUFFER_EMPTY_Flag=4,
       SIG_CTS_CHANGED_Flag=8,
       SIG_DSR_CHANGED_Flag=16,
       SIG_RLSD_CHANGED_Flag=32,
       SIG_BREAK_DETECT_Error=64,
       SIG_LINE_STATUS_Error=128,
       SIG_RING_DETECT_Error=512
   };
Open
bool UARTOpen(DHCOM_UARTEnum eUARTPort, DHCOM_UARTModeEnum eUARTMode, ulong lUARTFreq)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
DHCOM_UARTModeEnum eUARTMode = DHCOM UART mode name(e.g. DHCOM_HSHAKE_OFF)
ulong lUARTFreq = DHCOM UART frequency (e.g. 115200 bit/s = 115200)
Return value: bool --> true = success; false = failed
Close
void UARTClose(DHCOM_UARTEnum eUARTPort)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
Configure
bool UARTConfigure(DHCOM_UARTEnum eUARTPort, DHCOM_UARTModeEnum eUARTMode, DHCOM_UARTParityEnum eUARTParity, DHCOM_UARTStopBitEnum eUARTStopBit, DHCOM_UARTByteSizeEnum eUARTByteSize, ulong lUARTFreq)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
DHCOM_UARTModeEnum eUARTMode = DHCOM UART mode name(e.g. DHCOM_HSHAKE_OFF)
DHCOM_UARTParityEnum eUARTParity = DHCOM UART parity name (e.g. DHCOM_NOPARITY)
DHCOM_UARTStopBitEnum eUARTStopBit = DHCOM UART stop bit name (e.g. DHCOM_ONESTOPBIT)
DHCOM_UARTByteSizeEnum eUARTByteSize = DHCOM UART byte size name (e.g. DHCOM_8BIT)
ulong lUARTFreq = DHCOM UART frequency (e.g. 115200 bit/s = 115200)
Return value: bool --> true = success; false = failed
Configure Timeout
bool UARTConfigureTimeout(DHCOM_UARTEnum eUARTPort, ulong lReadIntervalTimeout, ulong lReadTotalTimeoutConstant, ulong lReadTotalTimeoutMultiplier, ulong ulWriteTotalTimeoutConstant, ulong ulWriteTotalTimeoutMultiplier)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
ulong lReadIntervalTimeout = Read interval timeout
ulong lReadTotalTimeoutConstant = Read total timeout
ulong lReadTotalTimeoutMultiplier = Read total timeout multiplier
ulong ulWriteTotalTimeoutConstant = Write total timeout
ulong ulWriteTotalTimeoutMultiplier = Write total timeout multiplier
Return value: bool --> true = success; false = failed
Clear buffer
bool UARTClearBuffer(DHCOM_UARTEnum eUARTPort)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
Read
bool UARTRead(DHCOM_UARTEnum eUARTPort, int iDataLength, byte[] pInBuffer)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
int iDataLength = Read data length
byte[] pInBuffer = Pointer to the input buffer
Return value: bool --> true = success; false = failed
Write
bool UARTWrite(DHCOM_UARTEnum eUARTPort, byte[] pOutBuffer)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
byte[] pOutBuffer = Pointer to the output buffer
Return value: bool --> true = success; false = failed

CAN

(Note: Currently available for WEC 2013)

Note: These CAN Devices can only be set. The mapping is done with the following enum.
  public enum DHCOM_CANEnum
  {
       DHCOM_CAN1=1,
       DHCOM_CAN_NOT_DEFINED
  };
Note: These mode selects can be set. The mapping is done with the following enum.
   public enum DHCOM_CANModeEnum
   {
       DHCOM_CAN_STANDARD=0,
       DHCOM_CAN_EXTENDED
   };
Note: These frame selects can be set. The mapping is done with the following enum.
   public enum DHCOM_CANFrameEnum
   {
       DHCOM_CAN_DATA=0,
       DHCOM_CAN_REMOTE
   };
Open
bool CANOpen(DHCOM_CANEnum eCANPort, DHCOM_CANModeEnum eCANMode)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
DHCOM_CANModeEnum eCANMode = DHCOM CAN mode name(e.g. DHCOM_CAN_STANDARD)
Return value: bool --> true = success; false = failed
Close
void CANClose(DHCOM_CANEnum eCANPort)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
Configure
bool CANConfigureMode(DHCOM_CANEnum eCANPort, DHCOM_CANModeEnum eCANMode, UInt32 lCANBitrate = 0, bool bCANTLPrio = false, bool bCANLoopback = false)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
DHCOM_CANModeEnum eCANMode = DHCOM CAN id type (e.g. DHCOM_CAN_STANDARD | DHCOM_CAN_EXTENDED)
UInt32 lCANBitrate = DHCOM UART bitrate (e.g. 500000 bit/s = 500kbit)
bool bCANTLPrio = DHCOM CAN transmit local prio (e.g. false = disabled)
bool bCANLoopback = DHCOM CAN loopback mode (e.g. false = disabled)
Return value: bool --> true = success; false = failed
Configure Timing
bool CANConfigureTiming(DHCOM_CANEnum eCANPort, UInt32 lPrescaler, byte cPropSeg, byte cPhase1Seg, byte cPhase2Seg, byte RJW)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
UInt32 lPrescaler = Prescaler value
byte cPropSeg = Property segmentation time value
byte cPhase1Seg = Phase 1 segmentation time value
byte cPhase2Seg = Phase 2 segmentation time value
byte RJW = Request jump time value
Return value: bool --> true = success; false = failed
Configure Filter
bool CANConfigureFilter(DHCOM_CANEnum eCANPort, int iFilterID, int iFilterIDMask, bool bFilterFormat, bool bFilterRemote) Attention: CANConfigureFilter() might be call before you can read data.
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN port name (e.g. DHCOM_CAN1)
int iFilterID = Filter ID value
int iFilterIDMask = Filter ID Mask value
bool bFilterFormat = Filter format (e.g. false = disabled)
bool bFilterRemote = Filter remote frame (e.g. false = disabled)
Return value: bool --> true = success; false = failed
Remove Filter
bool CANResetFilter(DHCOM_CANEnum eCANPort)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
Return value: bool --> true = success; false = failed
Configure Message
bool CANConfigureMessage(DHCOM_CANEnum eCANPort, DHCOM_CANFrameEnum eCANFrame, int iCANMsgID, byte cCANMsgPrio, UInt32 lCANMsgTimeout, bool bReadWrite)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
DHCOM_CANFrameEnum eCANFrame = DHCOM CAN frame type (e.g. DHCOM_CAN_DATA | DHCOM_CAN_REMOTE)
int iCANMsgID = CAN Message identification number (e.g. 0x2) - only for write
byte cCANMsgPrio = CAN Message priority (e.g. 1) - only for write
UInt32 lCANMsgTimeout = CAN Message timeout (e.g. hex value: fa0 = 1 sec)
bool bReadWrite = (Read = false, Write = true)
Return value: bool --> true = success; false = failed
Get Message Header
bool CANGetMessageParameter(DHCOM_CANEnum eCANPort, ref int iCANMsgID, ref int iCANMsgLength, ref int iCANFrame, ref byte cCANMsgPrio, ref UInt32 lCANMsgTimeout, ref int iTXAbort)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
ref int iCANMsgID = Pointer to Message identification value
ref int iCANMsgLength = Pointer to Message length value
ref int iCANFrame = Pointer to Message frame value
ref byte cCANMsgPrio = Pointer to Message priority value
ref UInt32 lCANMsgTimeout = Pointer to Message timeout value
ref int iTXAbort = Pointer to Message TX abort value
Return value: bool --> true = success; false = failed
Read
bool CANRead(DHCOM_CANEnum eCANPort, byte[] pInBuffer, int iDataLength, ref int iResult) Attention: CANConfigureFilter() might be call before you can read data.
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
byte[] pInBuffer = Pointer to the input buffer
int iDataLength = Read data length
ref int iResult = Pointer to the Result Value
Return value: bool --> true = success; false = failed
Write
bool CANWrite(DHCOM_CANEnum eCANPort, byte[] pOutBuffer, int iDataLength, ref int iResult)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
byte[] pOutBuffer = Pointer to the output buffer
int iDataLength = Write data length
ref int iResult = Pointer to the Result Value
Return value: bool --> true = success; false = failed

Physical Memory

Note: These freqencies can only be set. The mapping is done with the following enum.
   public enum DHCOM_PHYEnum
   {
       DHCOM_PHY1=1,
       DHCOM_PHY2,
       DHCOM_PHY3,
       DHCOM_PHY4,
       DHCOM_PHY5,
       DHCOM_PHY6,
       DHCOM_PHY7,
       DHCOM_PHY8,
       DHCOM_PHY9
   };
Write Physical Address
int WritePhysicalAddress(DHCOM_PHYEnum PHYDev, UInt32 ulPhyAddr, byte cRegSize, int iValue, bool bReadBack)
Input values:
DHCOM_PHYEnum PHYDev = DHCOM PHY Device name (e.g. DHCOM_PHY1)
UInt32 ulPhyAddr = Physical Address to write (e.g. GPIO1_MASK_REG = 0x209c014)
byte cRegSize = Register Size (8 = 8bit, 16 = 16bit, 32 = 32bit)
int iValue = Value for Physical Address to write
bool bReadBack = Enable/Disable Readback function (enable = true -> disable = false)
Return value: int --> returns the written value from the specified Physical Address
if bReadBack == TRUE, else 0x0 will be returned
Read Physical Address
int ReadPhysicalAddress(DHCOM_PHYEnum PHYDev, UInt32 ulPhyAddr, byte cRegSize)
Input values:
DHCOM_PHYEnum PHYDev = DHCOM PHY Device name (e.g. DHCOM_PHY1)
UInt32 ulPhyAddr = Physical Address to write (e.g. GPIO1_MASK_REG = 0x209c014)
byte cRegSize = Register Size (8 = 8bit, 16 = 16bit, 32 = 32bit)
Return value: int --> returns the value from the specified Physical Address

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)
Note: In DHHalLib Version 1.0.0.0 only Backlight Enable/Disable available. (Value 0 = Disable, Value 1 to 255 = Enable)
Input values:
int Level = Backlight Level (0 ... 255)
Return value: bool --> true = success; false = failed
Backlight Timeout
bool SetBacklightSuspend(int Timeout, bool bEnable)
Note: In DHHalLib Version 1.0.0.0 not available.
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
Save calibration data
bool SaveTouchCalibrationData()
Description:
This function save 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()

Audio

Set WAVE Out Volume Level
void SetWAVEOutVolumeLevel(int volumeLevel)
Description:
This function set wave audio volume to specified given value. The range of 0 to 100 are only allowed.


WEC2013 Debugging

1. Enable connection to WEC2013 device via Telnet. DH electronics recommends PuTTY for Telnet connection.
Notes: PuTTY can be downloaded from www.heise.de. Default IP address is 192.168.1.110. No Login is used with the testsystem.
2. Before the Remote Debug session can be started it is necessary to start two applications via the telnet connection, by using the following commands:
  • START conmanclient3.exe
  • START cmaccept3.exe
NOTE: If you boot up the device, you have to start the service conmanclient3.exe once. The service cmaccept3.exe needs to be start before you will deploy or debug your application. The service cmaccept3.exe is closed automatically after 3 minutes. Be sure to connect your application with the device during this time period. Otherwise you have to start the cmaccept3.exe again. The files are stored in folder \windows\ at testimage.
3. Now the debug session can be started from visual studio.


WEC2013 eMMC Memory

If the Image is stored on the microSD card (default case), the eMMC flash memory is mounted to folder MMCMemory during running WEC2013 system. The flash memory can be used to store any user data.


WEC2013 FTP Connection

WinSCP can be used to establish FTP connection to the system.

1. Download WinSCP
NOTES:
  • protocol: FTP
  • user name: user
  • default password: dhcom_imx6
  • port number: 21
  • IP address: Use IP scanner (e.g. Angry IP scanner to get device address. Hostname: DHCOM_IMX6


WEC2013 VNC Connection

With WEC2013 efonVNC is used for remote desktop connection. For more information and license click here.

1. vncconfig.exe can be used to configure password and connection details (stored in folder \apps\wec2013\ at testimage).
NOTES:
  • default password: dhcom_imx6
  • default port number: 5900
  • Configuration is stored in registry at path [HKEY_CURRENT_USER\Software\RealVNC\WinVNC4]
2. winvnc.exe (stored in folder \apps\wec2013\ at testimage) must be started. This is done atomatically at startup with the testimage. Otherwise the application can be started via telnet.
3. Download VNC viewer provided by RealVNC for PC/Laptop from here. For more information and license click here.
4. Run VNC viewer application and connect the device by using IP address and port number.
NOTES:
  • default IP address: 192.168.1.110
  • default port number: 5900


WEC2013 Remote Tools

Before remote tools can be used, it is necessary to sstart some applications on WEC2013 Device.

1. Enable connection to WEC2013 device via Telnet. DH electronics recommends PuTTY for Telnet connection.
Notes: PuTTY can be downloaded from www.heise.de. Default IP address is 192.168.1.110. No Login is used with the testsystem.
2. Before the Remote Debug session can be started it is necessary to start two applications via the telnet connection, by using the following commands:
  • START conmanclient3.exe
  • START cmaccept3.exe
NOTE: If you boot up the device, you have to start the service conmanclient3.exe once. The service cmaccept3.exe needs to be start before you will deploy or debug your application. The service cmaccept3.exe is closed automatically after 3 minutes. Be sure to connect your application with the device during this time period. Otherwise you have to start the cmaccept3.exe again. The files are stored in folder \windows\ at testimage.
3. Now it is possible to use remote tools from Visual Studio


WEC2013 Test Tools

TEST_APP_CANTEST

The app can be used to test DHCOM CAN Port. The application is stored at folder \apps\wec2013\.
Download CAN Demo source code
CAN WRITE:
TEST_APP_CANTEST --write --len 8 --id 0x12 --idlen 11 --val 0x55 --remote 0
Description of the example:
  • --len: Send 8 Bytes
  • --id: Message ID is 0x12
  • --idlen: 11 = Standard ID; 29 can be used fpr extended ID
  • --val: Data starts with 0x55, then 0x56, ...
  • --remote: 0 = no remote frame
CAN READ:
TEST_APP_CANTEST --read --timeout 10000
Description of the example:
  • The application waits for 10 seconds to receive data.
CAN GET BITRATE:
TEST_APP_CANTEST --getbitrate
Description of the example:
  • The application shows the current used bitrate.
CAN SET BITRATE:
TEST_APP_CANTEST --setbitrate --bitrate 250000
Description of the example:
  • The application sets bitrate to 250kbps.

UART_Test

The app can be used to test DHCOM UART 2 Port. The application is stored at folder \apps\wec2013\.
Download UART Demo source code
UART_Test
Description of the example:
  • The application cyclic sends "Hello World" and receives data.
  • The baudrate 115200 is used for the demo.
  • q must be send to exit the demo.