ARM non-init issue.

This commit is contained in:
Lei Shi 2013-09-27 17:07:05 +08:00
parent 40d81b68b5
commit 952e6f1e98
3 changed files with 34 additions and 16 deletions

View file

@ -22,20 +22,28 @@
<option id="de.innot.avreclipse.toolchain.options.toolchain.size.app.debug.911590357" name="Print Size" superClass="de.innot.avreclipse.toolchain.options.toolchain.size.app.debug"/> <option id="de.innot.avreclipse.toolchain.options.toolchain.size.app.debug.911590357" name="Print Size" superClass="de.innot.avreclipse.toolchain.options.toolchain.size.app.debug"/>
<option id="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.debug.1254471694" name="AVRDude" superClass="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.debug"/> <option id="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.debug.1254471694" name="AVRDude" superClass="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.debug"/>
<targetPlatform id="de.innot.avreclipse.targetplatform.winavr.app.debug.680900962" name="AVR Cross-Target" superClass="de.innot.avreclipse.targetplatform.winavr.app.debug"/> <targetPlatform id="de.innot.avreclipse.targetplatform.winavr.app.debug.680900962" name="AVR Cross-Target" superClass="de.innot.avreclipse.targetplatform.winavr.app.debug"/>
<builder buildPath="${workspace_loc:/uhs20_xxxfts}/Debug" id="de.innot.avreclipse.target.builder.winavr.app.debug.1820107274" managedBuildOn="true" name="AVR GNU Make Builder.Debug" superClass="de.innot.avreclipse.target.builder.winavr.app.debug"/> <builder buildPath="${workspace_loc:/uhs20_xxxfts}/Debug" id="de.innot.avreclipse.target.builder.winavr.app.debug.1820107274" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="AVR GNU Make Builder" superClass="de.innot.avreclipse.target.builder.winavr.app.debug"/>
<tool id="de.innot.avreclipse.tool.assembler.winavr.app.debug.249073553" name="AVR Assembler" superClass="de.innot.avreclipse.tool.assembler.winavr.app.debug"> <tool id="de.innot.avreclipse.tool.assembler.winavr.app.debug.249073553" name="AVR Assembler" superClass="de.innot.avreclipse.tool.assembler.winavr.app.debug">
<option id="de.innot.avreclipse.assembler.option.debug.level.678993369" superClass="de.innot.avreclipse.assembler.option.debug.level"/> <option id="de.innot.avreclipse.assembler.option.debug.level.678993369" name="Generate Debugging Info" superClass="de.innot.avreclipse.assembler.option.debug.level"/>
<inputType id="de.innot.avreclipse.tool.assembler.input.1387995044" superClass="de.innot.avreclipse.tool.assembler.input"/>
</tool> </tool>
<tool id="de.innot.avreclipse.tool.compiler.winavr.app.debug.1883314783" name="AVR Compiler" superClass="de.innot.avreclipse.tool.compiler.winavr.app.debug"> <tool id="de.innot.avreclipse.tool.compiler.winavr.app.debug.1883314783" name="AVR Compiler" superClass="de.innot.avreclipse.tool.compiler.winavr.app.debug">
<option id="de.innot.avreclipse.compiler.option.debug.level.1520455099" superClass="de.innot.avreclipse.compiler.option.debug.level"/> <option id="de.innot.avreclipse.compiler.option.debug.level.1520455099" name="Generate Debugging Info" superClass="de.innot.avreclipse.compiler.option.debug.level"/>
<option id="de.innot.avreclipse.compiler.option.optimize.1050914000" superClass="de.innot.avreclipse.compiler.option.optimize"/> <option id="de.innot.avreclipse.compiler.option.optimize.1050914000" name="Optimization Level" superClass="de.innot.avreclipse.compiler.option.optimize"/>
<inputType id="de.innot.avreclipse.compiler.winavr.input.1039170141" name="C Source Files" superClass="de.innot.avreclipse.compiler.winavr.input"/>
</tool> </tool>
<tool id="de.innot.avreclipse.tool.cppcompiler.app.debug.1449872558" name="AVR C++ Compiler" superClass="de.innot.avreclipse.tool.cppcompiler.app.debug"> <tool id="de.innot.avreclipse.tool.cppcompiler.app.debug.1449872558" name="AVR C++ Compiler" superClass="de.innot.avreclipse.tool.cppcompiler.app.debug">
<option id="de.innot.avreclipse.cppcompiler.option.debug.level.1896963299" superClass="de.innot.avreclipse.cppcompiler.option.debug.level"/> <option id="de.innot.avreclipse.cppcompiler.option.debug.level.1896963299" name="Generate Debugging Info" superClass="de.innot.avreclipse.cppcompiler.option.debug.level"/>
<option id="de.innot.avreclipse.cppcompiler.option.optimize.506012164" superClass="de.innot.avreclipse.cppcompiler.option.optimize"/> <option id="de.innot.avreclipse.cppcompiler.option.optimize.506012164" name="Optimization Level" superClass="de.innot.avreclipse.cppcompiler.option.optimize"/>
<inputType id="de.innot.avreclipse.cppcompiler.input.1555944364" superClass="de.innot.avreclipse.cppcompiler.input"/>
</tool> </tool>
<tool id="de.innot.avreclipse.tool.linker.winavr.app.debug.1686895004" name="AVR C Linker" superClass="de.innot.avreclipse.tool.linker.winavr.app.debug"/> <tool id="de.innot.avreclipse.tool.linker.winavr.app.debug.1686895004" name="AVR C Linker" superClass="de.innot.avreclipse.tool.linker.winavr.app.debug"/>
<tool id="de.innot.avreclipse.tool.cpplinker.app.debug.1401371388" name="AVR C++ Linker" superClass="de.innot.avreclipse.tool.cpplinker.app.debug"/> <tool id="de.innot.avreclipse.tool.cpplinker.app.debug.1401371388" name="AVR C++ Linker" superClass="de.innot.avreclipse.tool.cpplinker.app.debug">
<inputType id="de.innot.avreclipse.tool.cpplinker.input.43760027" name="OBJ Files" superClass="de.innot.avreclipse.tool.cpplinker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="de.innot.avreclipse.tool.archiver.winavr.base.1824884811" name="AVR Archiver" superClass="de.innot.avreclipse.tool.archiver.winavr.base"/> <tool id="de.innot.avreclipse.tool.archiver.winavr.base.1824884811" name="AVR Archiver" superClass="de.innot.avreclipse.tool.archiver.winavr.base"/>
<tool id="de.innot.avreclipse.tool.objdump.winavr.app.debug.769628549" name="AVR Create Extended Listing" superClass="de.innot.avreclipse.tool.objdump.winavr.app.debug"/> <tool id="de.innot.avreclipse.tool.objdump.winavr.app.debug.769628549" name="AVR Create Extended Listing" superClass="de.innot.avreclipse.tool.objdump.winavr.app.debug"/>
<tool id="de.innot.avreclipse.tool.objcopy.flash.winavr.app.debug.1849139969" name="AVR Create Flash image" superClass="de.innot.avreclipse.tool.objcopy.flash.winavr.app.debug"/> <tool id="de.innot.avreclipse.tool.objcopy.flash.winavr.app.debug.1849139969" name="AVR Create Flash image" superClass="de.innot.avreclipse.tool.objcopy.flash.winavr.app.debug"/>
@ -69,19 +77,19 @@
<option id="de.innot.avreclipse.toolchain.options.toolchain.size.app.release.22599495" name="Print Size" superClass="de.innot.avreclipse.toolchain.options.toolchain.size.app.release"/> <option id="de.innot.avreclipse.toolchain.options.toolchain.size.app.release.22599495" name="Print Size" superClass="de.innot.avreclipse.toolchain.options.toolchain.size.app.release"/>
<option id="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.release.1314599722" name="AVRDude" superClass="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.release"/> <option id="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.release.1314599722" name="AVRDude" superClass="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.release"/>
<targetPlatform id="de.innot.avreclipse.targetplatform.winavr.app.release.1371775116" name="AVR Cross-Target" superClass="de.innot.avreclipse.targetplatform.winavr.app.release"/> <targetPlatform id="de.innot.avreclipse.targetplatform.winavr.app.release.1371775116" name="AVR Cross-Target" superClass="de.innot.avreclipse.targetplatform.winavr.app.release"/>
<builder buildPath="${workspace_loc:/uhs20_xxxfts}/Release" id="de.innot.avreclipse.target.builder.winavr.app.release.202421499" managedBuildOn="true" name="AVR GNU Make Builder.Release" superClass="de.innot.avreclipse.target.builder.winavr.app.release"/> <builder buildPath="${workspace_loc:/uhs20_xxxfts}/Release" id="de.innot.avreclipse.target.builder.winavr.app.release.202421499" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="AVR GNU Make Builder" superClass="de.innot.avreclipse.target.builder.winavr.app.release"/>
<tool id="de.innot.avreclipse.tool.assembler.winavr.app.release.1564831434" name="AVR Assembler" superClass="de.innot.avreclipse.tool.assembler.winavr.app.release"> <tool id="de.innot.avreclipse.tool.assembler.winavr.app.release.1564831434" name="AVR Assembler" superClass="de.innot.avreclipse.tool.assembler.winavr.app.release">
<option id="de.innot.avreclipse.assembler.option.debug.level.362365658" superClass="de.innot.avreclipse.assembler.option.debug.level" value="de.innot.avreclipse.assembler.option.debug.level.none" valueType="enumerated"/> <option id="de.innot.avreclipse.assembler.option.debug.level.362365658" name="Generate Debugging Info" superClass="de.innot.avreclipse.assembler.option.debug.level" value="de.innot.avreclipse.assembler.option.debug.level.none" valueType="enumerated"/>
<inputType id="de.innot.avreclipse.tool.assembler.input.916800558" superClass="de.innot.avreclipse.tool.assembler.input"/> <inputType id="de.innot.avreclipse.tool.assembler.input.916800558" superClass="de.innot.avreclipse.tool.assembler.input"/>
</tool> </tool>
<tool id="de.innot.avreclipse.tool.compiler.winavr.app.release.1679352788" name="AVR Compiler" superClass="de.innot.avreclipse.tool.compiler.winavr.app.release"> <tool id="de.innot.avreclipse.tool.compiler.winavr.app.release.1679352788" name="AVR Compiler" superClass="de.innot.avreclipse.tool.compiler.winavr.app.release">
<option id="de.innot.avreclipse.compiler.option.debug.level.29260148" superClass="de.innot.avreclipse.compiler.option.debug.level" value="de.innot.avreclipse.compiler.option.debug.level.none" valueType="enumerated"/> <option id="de.innot.avreclipse.compiler.option.debug.level.29260148" name="Generate Debugging Info" superClass="de.innot.avreclipse.compiler.option.debug.level" value="de.innot.avreclipse.compiler.option.debug.level.none" valueType="enumerated"/>
<option id="de.innot.avreclipse.compiler.option.optimize.1367097945" superClass="de.innot.avreclipse.compiler.option.optimize" value="de.innot.avreclipse.compiler.optimize.size" valueType="enumerated"/> <option id="de.innot.avreclipse.compiler.option.optimize.1367097945" name="Optimization Level" superClass="de.innot.avreclipse.compiler.option.optimize" value="de.innot.avreclipse.compiler.optimize.size" valueType="enumerated"/>
<inputType id="de.innot.avreclipse.compiler.winavr.input.887077747" name="C Source Files" superClass="de.innot.avreclipse.compiler.winavr.input"/> <inputType id="de.innot.avreclipse.compiler.winavr.input.887077747" name="C Source Files" superClass="de.innot.avreclipse.compiler.winavr.input"/>
</tool> </tool>
<tool id="de.innot.avreclipse.tool.cppcompiler.app.release.1117610135" name="AVR C++ Compiler" superClass="de.innot.avreclipse.tool.cppcompiler.app.release"> <tool id="de.innot.avreclipse.tool.cppcompiler.app.release.1117610135" name="AVR C++ Compiler" superClass="de.innot.avreclipse.tool.cppcompiler.app.release">
<option id="de.innot.avreclipse.cppcompiler.option.debug.level.2056460468" superClass="de.innot.avreclipse.cppcompiler.option.debug.level" value="de.innot.avreclipse.cppcompiler.option.debug.level.none" valueType="enumerated"/> <option id="de.innot.avreclipse.cppcompiler.option.debug.level.2056460468" name="Generate Debugging Info" superClass="de.innot.avreclipse.cppcompiler.option.debug.level" value="de.innot.avreclipse.cppcompiler.option.debug.level.none" valueType="enumerated"/>
<option id="de.innot.avreclipse.cppcompiler.option.optimize.1295403915" superClass="de.innot.avreclipse.cppcompiler.option.optimize" value="de.innot.avreclipse.cppcompiler.optimize.size" valueType="enumerated"/> <option id="de.innot.avreclipse.cppcompiler.option.optimize.1295403915" name="Optimization Level" superClass="de.innot.avreclipse.cppcompiler.option.optimize" value="de.innot.avreclipse.cppcompiler.optimize.size" valueType="enumerated"/>
<inputType id="de.innot.avreclipse.cppcompiler.input.852570633" superClass="de.innot.avreclipse.cppcompiler.input"/> <inputType id="de.innot.avreclipse.cppcompiler.input.852570633" superClass="de.innot.avreclipse.cppcompiler.input"/>
</tool> </tool>
<tool id="de.innot.avreclipse.tool.linker.winavr.app.release.678151743" name="AVR C Linker" superClass="de.innot.avreclipse.tool.linker.winavr.app.release"/> <tool id="de.innot.avreclipse.tool.linker.winavr.app.release.678151743" name="AVR C Linker" superClass="de.innot.avreclipse.tool.linker.winavr.app.release"/>
@ -101,6 +109,7 @@
</folderInfo> </folderInfo>
</configuration> </configuration>
</storageModule> </storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration> </cconfiguration>
</storageModule> </storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <storageModule moduleId="cdtBuildSystem" version="4.0.0">

12
BTD.cpp
View file

@ -25,19 +25,27 @@ const uint8_t BTD::BTD_DATAIN_PIPE = 2;
const uint8_t BTD::BTD_DATAOUT_PIPE = 3; const uint8_t BTD::BTD_DATAOUT_PIPE = 3;
BTD::BTD(USB *p) : BTD::BTD(USB *p) :
connectToWii(false),
pairWithWii(false),
pUsb(p), // Pointer to USB class instance - mandatory pUsb(p), // Pointer to USB class instance - mandatory
bAddress(0), // Device address - mandatory bAddress(0), // Device address - mandatory
bNumEP(1), // If config descriptor needs to be parsed bNumEP(1), // If config descriptor needs to be parsed
qNextPollTime(0), // Reset NextPollTime qNextPollTime(0), // Reset NextPollTime
pollInterval(0),
bPollEnable(false) // Don't start polling before dongle is connected bPollEnable(false) // Don't start polling before dongle is connected
{ {
for (uint8_t i = 0; i < BTD_MAX_ENDPOINTS; i++) { uint8_t i;
for (i = 0; i < BTD_MAX_ENDPOINTS; i++) {
epInfo[i].epAddr = 0; epInfo[i].epAddr = 0;
epInfo[i].maxPktSize = (i) ? 0 : 8; epInfo[i].maxPktSize = (i) ? 0 : 8;
epInfo[i].epAttribs = 0; epInfo[i].epAttribs = 0;
epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER; epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER;
} }
for(i = 0; i < BTD_NUMSERVICES; i++)
btService[i] = NULL;
if (pUsb) // register in USB subsystem if (pUsb) // register in USB subsystem
pUsb->RegisterDeviceClass(this); //set devConfig[] entry pUsb->RegisterDeviceClass(this); //set devConfig[] entry
} }
@ -1235,4 +1243,4 @@ void BTD::setMoveBdaddr(uint8_t* bdaddr) {
// bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x05), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data) // bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x05), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data)
pUsb->ctrlReq(bAddress, epInfo[BTD_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x05, 0x03, 0x00, 11, 11, buf, NULL); pUsb->ctrlReq(bAddress, epInfo[BTD_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x05, 0x03, 0x00, 11, 11, buf, NULL);
} }

View file

@ -64,6 +64,7 @@ void SPP::Reset() {
connected = false; connected = false;
RFCOMMConnected = false; RFCOMMConnected = false;
SDPConnected = false; SDPConnected = false;
waitForLastCommand = false;
l2cap_sdp_state = L2CAP_SDP_WAIT; l2cap_sdp_state = L2CAP_SDP_WAIT;
l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT; l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT;
l2cap_event_flag = 0; l2cap_event_flag = 0;
@ -808,4 +809,4 @@ int SPP::read(void) {
#endif #endif
} }
return output; return output;
} }