title: Windows CE 7 SPI Driver Not Loaded at Startup
body: <p>I am a newbie. </p>
  
  <p>I want to develop device drivers on Windows CE 7.</p>
  
  <p>I use Adeneo BSP on TI AM33xx Development Board</p>
  
  <p>I want to drive a SPI Flash so I should use SPI driver. </p>
  
  <p>I have written my driver and when I debug it, all functions calling correctly. But when I call the </p>
  
  <pre><code>CreateFile( _T("SPI1:"),
              GENERIC_READ | GENERIC_WRITE,
              FILE_SHARE_READ | FILE_SHARE_WRITE,
              NULL, OPEN_EXISTING, 0, NULL);
  </code></pre>
  
  <p>deviceHandle always return invalid value. So when I debug the low level SPI driver, I seen , SPI_Init() stream function never called. </p>
  
  <p>There is this tines in my platform.reg file </p>
  
  <pre><code>;===============================================================================
  ; MCSPI driver
  #include "$(_PLATFORMROOT)\AM33x_BSP\SRC\DRIVERS\MCSPI\mcspi.reg"
  </code></pre>
  
  <p>And </p>
  
  <p>My mcspi.reg file is </p>
  
  <pre><code>;-- SPI Driver -----------------------------------------------------------------
  IF BSP_AM33X_MCSPI1
  [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\SPI1]
      "Prefix"="SPI"
      "Dll"="am33x_mcspi.dll"
      "Index"=dword:1
      "Port"=dword:1
      "Order"=dword:8
      "MemBase"=multi_sz:"48030000"
      "MemLen"=multi_sz:"00000100"
      "Timeout"=dword:300
      "PowerFlags"=dword:00000103              ; send pre/post device state changes
      ; PMCLASS_PMEXT_GUID
      "IClass"=multi_sz:"{0AE2066F-89A2-4D70-8FC2-29AEFA68413C}"
  ENDIF
  </code></pre>
  
  <p><strong>[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\SPI1]</strong> this lines say to us, "SPI1 driver will be loaded at startup", isnt it ??? But spi driver SPI_Init function never loaded at starttup. I havent seen any extra setting in Microsoft White Paper. </p>
  
  <p>And additional,</p>
  
  <p>I have tried </p>
  
  <pre><code>ActivateDeviceEx(TEXT("Drivers\\BuiltIn\\SPI1"), NULL, 0, NULL);
  </code></pre>
  
  <p>and</p>
  
  <pre><code>LoadLibrary(TEXT("am33x_mcspi.dll"));
  </code></pre>
  
  <p>functions but result is same. </p>
  
  <p>Is there any extra setting for Driver Loading?</p>
  
  <p>Thanks</p>
  
  <p>Murat.</p>