stmhal: Add windows cdc .inf driver to flash filesystem.

This commit is contained in:
Damien George 2014-04-09 01:16:49 +01:00
parent 8e6f98b166
commit b99ca2cdde
2 changed files with 104 additions and 1 deletions

View File

@ -133,6 +133,10 @@ static const char fresh_main_py[] =
"# main.py -- put your code here!\n"
;
static const char fresh_pybcdc_inf[] =
#include "pybcdc.h"
;
int main(void) {
// TODO disable JTAG
@ -206,7 +210,9 @@ soft_reset:
}
HAL_Delay(20);
if (i % 30 == 29) {
reset_mode = (reset_mode + 1) & 7;
if (++reset_mode > 3) {
reset_mode = 1;
}
led_state(2, reset_mode & 1);
led_state(3, reset_mode & 2);
led_state(4, reset_mode & 4);
@ -310,6 +316,11 @@ soft_reset:
// TODO check we could write n bytes
f_close(&fp);
// create .inf driver file
f_open(&fp, "0:/pybcdc.inf", FA_WRITE | FA_CREATE_ALWAYS);
f_write(&fp, fresh_pybcdc_inf, sizeof(fresh_pybcdc_inf) - 1 /* don't count null terminator */, &n);
f_close(&fp);
// keep LED on for at least 200ms
sys_tick_wait_at_least(start_tick, 200);
led_state(PYB_LED_R2, 0);

92
stmhal/pybcdc.h Normal file
View File

@ -0,0 +1,92 @@
"; Windows USB CDC ACM Setup File\n"
"; Based on INF files which were:\n"
"; Copyright (c) 2000 Microsoft Corporation\n"
"; Copyright (C) 2007 Microchip Technology Inc.\n"
"; Likely to be covered by the MLPL as found at:\n"
"; <http://msdn.microsoft.com/en-us/cc300389.aspx#MLPL>.\n"
"\n"
"[Version]\n"
"Signature=\"$Windows NT$\"\n"
"Class=Ports\n"
"ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}\n"
"Provider=%MFGNAME%\n"
"LayoutFile=layout.inf\n"
"DriverVer=03/11/2010,5.1.2600.3\n"
"\n"
"[Manufacturer]\n"
"%MFGNAME%=DeviceList, NTamd64\n"
"\n"
"[DestinationDirs]\n"
"DefaultDestDir=12\n"
"\n"
";---------------------------------------------------------------------\n"
"; Windows 2000/XP/Server2003/Vista/Server2008/7 - 32bit Sections\n"
"\n"
"[DriverInstall.nt]\n"
"include=mdmcpq.inf\n"
"CopyFiles=DriverCopyFiles.nt\n"
"AddReg=DriverInstall.nt.AddReg\n"
"\n"
"[DriverCopyFiles.nt]\n"
"usbser.sys,,,0x20\n"
"\n"
"[DriverInstall.nt.AddReg]\n"
"HKR,,DevLoader,,*ntkern\n"
"HKR,,NTMPDriver,,usbser.sys\n"
"HKR,,EnumPropPages32,,\"MsPorts.dll,SerialPortPropPageProvider\"\n"
"\n"
"[DriverInstall.nt.Services]\n"
"AddService=usbser, 0x00000002, DriverService.nt\n"
"\n"
"[DriverService.nt]\n"
"DisplayName=%SERVICE%\n"
"ServiceType=1\n"
"StartType=3\n"
"ErrorControl=1\n"
"ServiceBinary=%12%\\usbser.sys\n"
"\n"
";---------------------------------------------------------------------\n"
"; Windows XP/Server2003/Vista/Server2008/7 - 64bit Sections\n"
"\n"
"[DriverInstall.NTamd64]\n"
"include=mdmcpq.inf\n"
"CopyFiles=DriverCopyFiles.NTamd64\n"
"AddReg=DriverInstall.NTamd64.AddReg\n"
"\n"
"[DriverCopyFiles.NTamd64]\n"
"usbser.sys,,,0x20\n"
"\n"
"[DriverInstall.NTamd64.AddReg]\n"
"HKR,,DevLoader,,*ntkern\n"
"HKR,,NTMPDriver,,usbser.sys\n"
"HKR,,EnumPropPages32,,\"MsPorts.dll,SerialPortPropPageProvider\"\n"
"\n"
"[DriverInstall.NTamd64.Services]\n"
"AddService=usbser, 0x00000002, DriverService.NTamd64\n"
"\n"
"[DriverService.NTamd64]\n"
"DisplayName=%SERVICE%\n"
"ServiceType=1\n"
"StartType=3\n"
"ErrorControl=1\n"
"ServiceBinary=%12%\\usbser.sys\n"
"\n"
";---------------------------------------------------------------------\n"
"; Vendor and Product ID Definitions\n"
"\n"
"[SourceDisksFiles]\n"
"[SourceDisksNames]\n"
"[DeviceList]\n"
"%DESCRIPTION%=DriverInstall, USB\\VID_0483&PID_5740&MI_00\n"
"\n"
"[DeviceList.NTamd64]\n"
"%DESCRIPTION%=DriverInstall, USB\\VID_0483&PID_5740&MI_00\n"
"\n"
";---------------------------------------------------------------------\n"
"; String Definitions\n"
"\n"
"[Strings]\n"
"MFGFILENAME=\"pybcdc\"\n"
"MFGNAME=\"Micro Python\"\n"
"DESCRIPTION=\"Pyboard USB Comm Port\"\n"
"SERVICE=\"USB Serial Driver\"\n"