summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-01-11 20:49:46 +0700
committerhathach <[email protected]>2013-01-11 20:49:46 +0700
commite935f29541d1c65a0bd7f480f0ccf0137450f091 (patch)
treecbd64175b9e9179345569acf7a867b2a036bcb85
parentd76df5400379495d0eb6c6a8301a84042681ea12 (diff)
tested keyboard device with lpcXpresso1347 board
-rw-r--r--demos/device/keyboard/.cproject30
-rw-r--r--tinyusb/class/hid.c4
-rw-r--r--tinyusb/common/common.h62
-rw-r--r--tinyusb/device/dcd.c2
-rw-r--r--tinyusb/tusb.h2
5 files changed, 24 insertions, 76 deletions
diff --git a/demos/device/keyboard/.cproject b/demos/device/keyboard/.cproject
index 9f9b3be7d..14fa2b05e 100644
--- a/demos/device/keyboard/.cproject
+++ b/demos/device/keyboard/.cproject
@@ -18,7 +18,7 @@
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
- <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser" id="com.crt.advproject.config.exe.debug.856400198" name="Board LPCXpresso1347" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size &quot;${BuildArtifactFileName}&quot;; # arm-none-eabi-objcopy -O binary &quot;${BuildArtifactFileName}&quot; &quot;${BuildArtifactFileBaseName}.bin&quot; ; checksum -p ${TargetChip} -d &quot;${BuildArtifactFileBaseName}.bin&quot;; " preannouncebuildStep="" prebuildStep="">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.MakeErrorParser" id="com.crt.advproject.config.exe.debug.856400198" name="Board LPCXpresso1347" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="" preannouncebuildStep="" prebuildStep="">
<folderInfo id="com.crt.advproject.config.exe.debug.856400198." name="/" resourcePath="">
<toolChain errorParsers="" id="com.crt.advproject.toolchain.exe.debug.469819926" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
<targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.548956113" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
@@ -34,7 +34,7 @@
<listOptionValue builtIn="false" value="DEBUG"/>
<listOptionValue builtIn="false" value="__CODE_RED"/>
</option>
- <option id="gnu.c.compiler.option.misc.other.204394496" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections $(CFLAGS)" valueType="string"/>
+ <option id="gnu.c.compiler.option.misc.other.204394496" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -Wextra $(CFLAGS)" valueType="string"/>
<option id="gnu.c.compiler.option.include.paths.1207481236" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/CMSISv2p10_LPC13Uxx/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/bsp}&quot;"/>
@@ -43,6 +43,8 @@
</option>
<option id="gnu.c.compiler.option.include.files.318820756" name="Include files (-include)" superClass="gnu.c.compiler.option.include.files"/>
<option id="com.crt.advproject.c.misc.dialect.1002654194" name="C Dialect" superClass="com.crt.advproject.c.misc.dialect" value="com.crt.advproject.misc.dialect.gnu99" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.warnings.pedantic.1441421653" name="Pedantic (-pedantic)" superClass="gnu.c.compiler.option.warnings.pedantic" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.warnings.pedantic.error.2105928976" name="Pedantic warnings as errors (-pedantic-errors)" superClass="gnu.c.compiler.option.warnings.pedantic.error" value="false" valueType="boolean"/>
<inputType id="com.crt.advproject.compiler.input.932601394" superClass="com.crt.advproject.compiler.input"/>
</tool>
<tool command="arm-none-eabi-gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.gas.exe.debug.1050918013" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
@@ -665,44 +667,46 @@
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
- <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="lpc11uxx from microbuilder" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser" id="com.crt.advproject.config.exe.debug.856400198.534940316" name="Board at86rf2xx" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size &quot;${BuildArtifactFileName}&quot;; #arm-none-eabi-objcopy -O binary &quot;${BuildArtifactFileName}&quot; &quot;${BuildArtifactFileBaseName}.bin&quot; ; checksum -p ${TargetChip} -d &quot;${BuildArtifactFileBaseName}.bin&quot;; " preannouncebuildStep="" prebuildStep="">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="lpc11uxx from microbuilder" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.MakeErrorParser" id="com.crt.advproject.config.exe.debug.856400198.534940316" name="Board at86rf2xx" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="" preannouncebuildStep="" prebuildStep="">
<folderInfo id="com.crt.advproject.config.exe.debug.856400198.534940316." name="/" resourcePath="">
<toolChain errorParsers="" id="com.crt.advproject.toolchain.exe.debug.1347871780" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
<targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1543738985" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
<builder buildPath="${workspace_loc:/device_keyboard/Debug}" errorParsers="org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.CWDLocator" id="com.crt.advproject.builder.exe.debug.1603637140" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
<tool id="com.crt.advproject.cpp.exe.debug.1912680765" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
<tool command="arm-none-eabi-gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GCCErrorParser" id="com.crt.advproject.gcc.exe.debug.901878888" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
- <option id="com.crt.advproject.gcc.arch.227583493" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm0" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.arch.227583493" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
<option id="com.crt.advproject.gcc.thumb.1429919562" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.690334585" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__REDLIB__"/>
- <listOptionValue builtIn="false" value="BOARD=BOARD_AT86RF2XX"/>
- <listOptionValue builtIn="false" value="MCU=MCU_LPC11UXX"/>
+ <listOptionValue builtIn="false" value="MCU=MCU_LPC13UXX"/>
+ <listOptionValue builtIn="false" value="BOARD=BOARD_LPCXPRESSO1347"/>
<listOptionValue builtIn="false" value="DEBUG"/>
<listOptionValue builtIn="false" value="__CODE_RED"/>
</option>
- <option id="gnu.c.compiler.option.misc.other.1222444467" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections $(CFLAGS)" valueType="string"/>
+ <option id="gnu.c.compiler.option.misc.other.1222444467" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -Wextra $(CFLAGS)" valueType="string"/>
<option id="gnu.c.compiler.option.include.paths.2143003127" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
- <listOptionValue builtIn="false" value="&quot;${workspace_loc:/CMSISv2p00_LPC11Uxx/inc}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/CMSISv2p10_LPC13Uxx/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/bsp}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/tinyusb}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}&quot;"/>
</option>
<option id="gnu.c.compiler.option.include.files.1663093508" name="Include files (-include)" superClass="gnu.c.compiler.option.include.files"/>
<option id="com.crt.advproject.c.misc.dialect.378026709" name="C Dialect" superClass="com.crt.advproject.c.misc.dialect" value="com.crt.advproject.misc.dialect.gnu99" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.warnings.pedantic.840430236" name="Pedantic (-pedantic)" superClass="gnu.c.compiler.option.warnings.pedantic" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.warnings.pedantic.error.559479440" name="Pedantic warnings as errors (-pedantic-errors)" superClass="gnu.c.compiler.option.warnings.pedantic.error" value="false" valueType="boolean"/>
<inputType id="com.crt.advproject.compiler.input.1660235734" superClass="com.crt.advproject.compiler.input"/>
</tool>
<tool command="arm-none-eabi-gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.gas.exe.debug.1919954827" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
- <option id="com.crt.advproject.gas.arch.62277376" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm0" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.arch.62277376" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
<option id="com.crt.advproject.gas.thumb.567012827" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
<option id="gnu.both.asm.option.flags.crt.1544048579" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
<inputType id="com.crt.advproject.assembler.input.2112542401" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
</tool>
<tool id="com.crt.advproject.link.cpp.exe.debug.438186138" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
<tool command="arm-none-eabi-gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GLDErrorParser" id="com.crt.advproject.link.exe.debug.332994381" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
- <option id="com.crt.advproject.link.arch.5439507" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm0" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.arch.5439507" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
<option id="com.crt.advproject.link.thumb.1052282054" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
- <option id="com.crt.advproject.link.script.1723865493" name="Linker script" superClass="com.crt.advproject.link.script" value="&quot;device_keyboard_Board_at86rf2xx.ld&quot;" valueType="string"/>
+ <option id="com.crt.advproject.link.script.1723865493" name="Linker script" superClass="com.crt.advproject.link.script" value="&quot;device_keyboard_Board_LPCXpresso1347.ld&quot;" valueType="string"/>
<option id="com.crt.advproject.link.manage.314167409" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
<option id="gnu.c.link.option.nostdlibs.7792622" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
<option id="gnu.c.link.option.other.1046893879" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
@@ -710,10 +714,10 @@
<listOptionValue builtIn="false" value="--gc-sections"/>
</option>
<option id="gnu.c.link.option.paths.1946871342" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
- <listOptionValue builtIn="false" value="&quot;${workspace_loc:/CMSISv2p00_LPC11Uxx/Debug}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/CMSISv2p10_LPC13Uxx/Debug}&quot;"/>
</option>
<option id="gnu.c.link.option.libs.937236410" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
- <listOptionValue builtIn="false" value="CMSISv2p00_LPC11Uxx"/>
+ <listOptionValue builtIn="false" value="CMSISv2p10_LPC13Uxx"/>
</option>
<option id="com.crt.advproject.link.gcc.hdrlib.1273255587" name="Use C library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.888929207" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
diff --git a/tinyusb/class/hid.c b/tinyusb/class/hid.c
index b5416faa3..ec2df6156 100644
--- a/tinyusb/class/hid.c
+++ b/tinyusb/class/hid.c
@@ -41,12 +41,12 @@
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
USB_HID_KeyboardReport_t hid_keyboard_report;
-volatile static bool bKeyChanged = false;
+static volatile bool bKeyChanged = false;
#endif
#ifdef TUSB_CFG_DEVICE_HID_MOUSE
USB_HID_MouseReport_t hid_mouse_report;
-volatile static bool bMouseChanged = false;
+static volatile bool bMouseChanged = false;
#endif
/**************************************************************************/
diff --git a/tinyusb/common/common.h b/tinyusb/common/common.h
index abd0743d0..921de01bc 100644
--- a/tinyusb/common/common.h
+++ b/tinyusb/common/common.h
@@ -64,6 +64,8 @@
#include "compiler/compiler.h"
#include "tusb_option.h"
#include "errors.h"
+#include "assertion.h"
+#include "binary.h"
#include "mcu/mcu.h"
#include "hal/hal.h"
@@ -76,66 +78,6 @@
/// max value
#define MAX_(x, y) (((x) > (y)) ? (x) : (y))
-/// n-th Bit
-#define BIT_(n) (1 << (n))
-
-/// set n-th bit of x to 1
-#define BIT_SET_(x, n) ( (x) | BIT_(n) )
-
-/// clear n-th bit of x
-#define BIT_CLR_(x, n) ( (x) & (~BIT_(n)) )
-
-/// add hex represenation
-#define HEX_(n) 0x##n##LU
-
-// internal macro of B8, B16, B32
-#define _B8__(x) ((x&0x0000000FLU)?1:0) \
- +((x&0x000000F0LU)?2:0) \
- +((x&0x00000F00LU)?4:0) \
- +((x&0x0000F000LU)?8:0) \
- +((x&0x000F0000LU)?16:0) \
- +((x&0x00F00000LU)?32:0) \
- +((x&0x0F000000LU)?64:0) \
- +((x&0xF0000000LU)?128:0)
-
-#define B8_(d) ((unsigned char)_B8__(HEX_(d)))
-#define B16_(dmsb,dlsb) (((unsigned short)B8(dmsb)<<8) + B8(dlsb))
-#define B32_(dmsb,db2,db3,dlsb) \
- (((unsigned long)B8(dmsb)<<24) \
- + ((unsigned long)B8(db2)<<16) \
- + ((unsigned long)B8(db3)<<8) \
- + B8(dlsb))
-
-
-
-//#if ( defined CFG_PRINTF_UART || defined CFG_PRINTF_USBCDC || defined CFG_PRINTF_DEBUG )
-#if TUSB_CFG_DEBUG
- #define PRINTF(...) printf(__VA_ARGS__)
-#else
- #define PRINTF(...)
-#endif
-
-#define ASSERT_MESSAGE(condition, value, message) \
- do{\
- if (!(condition)) {\
- PRINTF("Assert at %s %s line %d: %s\n", __BASE_FILE__, __PRETTY_FUNCTION__, __LINE__, message); \
- return (value);\
- }\
- }while(0)
-
-#define ASSERT(condition, value) ASSERT_MESSAGE(condition, value, NULL)
-
-#define ASSERT_ERROR_MESSAGE(sts, message) \
- do{\
- TUSB_Error_t status = (TUSB_Error_t)(sts);\
- if (tERROR_NONE != status) {\
- PRINTF("Assert at %s line %d: %s %s\n", __BASE_FILE__, __PRETTY_FUNCTION__, __LINE__, TUSB_ErrorStr[status], message); \
- return status;\
- }\
- }while(0)
-
-#define ASSERT_ERROR(sts) ASSERT_ERROR_MESSAGE(sts, NULL)
-
#ifdef __cplusplus
}
#endif
diff --git a/tinyusb/device/dcd.c b/tinyusb/device/dcd.c
index 2913fdab0..ea4de2561 100644
--- a/tinyusb/device/dcd.c
+++ b/tinyusb/device/dcd.c
@@ -47,7 +47,7 @@
#define USB_ROM_SIZE (1024*2)
uint8_t usb_RomDriver_buffer[USB_ROM_SIZE] ATTR_ALIGNED(2048) __DATA(RAM2);
USBD_HANDLE_T g_hUsb;
-volatile static bool isConfigured = false;
+static volatile bool isConfigured = false;
/**************************************************************************/
/*!
diff --git a/tinyusb/tusb.h b/tinyusb/tusb.h
index a706e9c32..9eb153371 100644
--- a/tinyusb/tusb.h
+++ b/tinyusb/tusb.h
@@ -66,6 +66,8 @@
#include "class/cdc.h"
#endif
+TUSB_Error_t tusb_init(void);
+
#ifdef __cplusplus
}
#endif