Browse Source

Merge remote-tracking branch 'upstream/master'

# Conflicts:
#	src/thread.c
xuzhuoyi 6 years ago
parent
commit
37db67d94a
100 changed files with 7513 additions and 7354 deletions
  1. 8 0
      .gitignore
  2. 7 2
      .travis.yml
  3. 0 340
      COPYING
  4. 130 0
      ChangeLog.md
  5. 201 0
      LICENSE
  6. 20 9
      README.md
  7. 12 4
      README_zh.md
  8. 23 23
      bsp/allwinner_tina/drivers/drv_gpio.c
  9. 22 22
      bsp/allwinner_tina/drivers/drv_sdio.c
  10. 68 71
      bsp/allwinner_tina/drivers/spi/drv_spi.c
  11. 129 23
      bsp/amebaz/.config
  12. 2 5
      bsp/amebaz/Kconfig
  13. 179 51
      bsp/amebaz/README.md
  14. 2 9
      bsp/amebaz/applications/main.c
  15. 146 0
      bsp/amebaz/applications/smartconfig_app.c
  16. 9 0
      bsp/amebaz/drivers/Kconfig
  17. 3 8
      bsp/amebaz/drivers/SConscript
  18. 2 4
      bsp/amebaz/drivers/board.c
  19. 11 1
      bsp/amebaz/drivers/board.h
  20. 8 10
      bsp/amebaz/drivers/drv_uart.c
  21. 0 3
      bsp/amebaz/drivers/drv_uart.h
  22. 0 453
      bsp/amebaz/drivers/drv_wifi.c
  23. 0 31
      bsp/amebaz/drivers/drv_wifi.h
  24. 5 4
      bsp/amebaz/drivers/wlan/SConscript
  25. 0 642
      bsp/amebaz/drivers/wlan/amebaz_wlan.c
  26. 0 54
      bsp/amebaz/drivers/wlan/amebaz_wlan.h
  27. 660 0
      bsp/amebaz/drivers/wlan/drv_wifi.c
  28. 31 0
      bsp/amebaz/drivers/wlan/drv_wifi.h
  29. 366 0
      bsp/amebaz/drivers/wlan/drv_wlan.c
  30. 119 0
      bsp/amebaz/drivers/wlan/drv_wlan.h
  31. BIN
      bsp/amebaz/figures/iar_build.png
  32. BIN
      bsp/amebaz/figures/iar_download.png
  33. BIN
      bsp/amebaz/figures/image-tool_v2.2.0.png
  34. 7 0
      bsp/amebaz/libraries/Kconfig
  35. 12 0
      bsp/amebaz/libraries/SConscript
  36. 18 0
      bsp/amebaz/libraries/smartconfig/SConscript
  37. 62 0
      bsp/amebaz/libraries/smartconfig/inc/smartconfig.h
  38. BIN
      bsp/amebaz/libraries/smartconfig/libs/libsmartconfig_armcm4_gcc.a
  39. BIN
      bsp/amebaz/libraries/smartconfig/libs/libsmartconfig_armcm4_iar.a
  40. 2697 0
      bsp/amebaz/project.ewd
  41. 153 185
      bsp/amebaz/project.ewp
  42. 0 2504
      bsp/amebaz/project.ewt
  43. 56 12
      bsp/amebaz/rtconfig.h
  44. 20 36
      bsp/amebaz/rtconfig.py
  45. 21 265
      bsp/amebaz/template.ewd
  46. 57 76
      bsp/amebaz/template.ewp
  47. 946 1909
      bsp/amebaz/template.ewt
  48. 0 0
      bsp/amebaz/template.eww
  49. 2 2
      bsp/amebaz/tmp.board
  50. 54 31
      bsp/apollo2/board/adc.c
  51. 3 3
      bsp/apollo2/board/adc.h
  52. 4 2
      bsp/apollo2/board/board.c
  53. 1 1
      bsp/apollo2/board/flash.c
  54. 137 9
      bsp/apollo2/board/gpio.c
  55. 34 10
      bsp/apollo2/board/i2c.c
  56. 33 68
      bsp/apollo2/board/pdm.c
  57. 1 1
      bsp/apollo2/board/pdm.h
  58. 2 0
      bsp/apollo2/board/pwm.h
  59. 0 1
      bsp/apollo2/board/rtc.c
  60. 8 9
      bsp/apollo2/board/smbus.c
  61. 49 43
      bsp/apollo2/board/spi.c
  62. 10 11
      bsp/apollo2/board/uart.c
  63. 1 0
      bsp/apollo2/libraries/drivers/SConscript
  64. 1 1
      bsp/apollo2/libraries/drivers/am_mcu_apollo.h
  65. 1 1
      bsp/apollo2/libraries/drivers/hal/am_hal_adc.c
  66. 6 6
      bsp/apollo2/libraries/drivers/hal/am_hal_adc.h
  67. 1 1
      bsp/apollo2/libraries/drivers/hal/am_hal_cachectrl.c
  68. 6 6
      bsp/apollo2/libraries/drivers/hal/am_hal_cachectrl.h
  69. 18 10
      bsp/apollo2/libraries/drivers/hal/am_hal_clkgen.c
  70. 6 6
      bsp/apollo2/libraries/drivers/hal/am_hal_clkgen.h
  71. 11 10
      bsp/apollo2/libraries/drivers/hal/am_hal_ctimer.c
  72. 7 7
      bsp/apollo2/libraries/drivers/hal/am_hal_ctimer.h
  73. 1 1
      bsp/apollo2/libraries/drivers/hal/am_hal_debug.c
  74. 6 6
      bsp/apollo2/libraries/drivers/hal/am_hal_debug.h
  75. 42 1
      bsp/apollo2/libraries/drivers/hal/am_hal_flash.c
  76. 19 9
      bsp/apollo2/libraries/drivers/hal/am_hal_flash.h
  77. 1 1
      bsp/apollo2/libraries/drivers/hal/am_hal_global.c
  78. 6 6
      bsp/apollo2/libraries/drivers/hal/am_hal_global.h
  79. 2 2
      bsp/apollo2/libraries/drivers/hal/am_hal_gpio.c
  80. 14 5
      bsp/apollo2/libraries/drivers/hal/am_hal_gpio.h
  81. 11 11
      bsp/apollo2/libraries/drivers/hal/am_hal_i2c_bit_bang.c
  82. 11 10
      bsp/apollo2/libraries/drivers/hal/am_hal_i2c_bit_bang.h
  83. 4 4
      bsp/apollo2/libraries/drivers/hal/am_hal_interrupt.c
  84. 6 5
      bsp/apollo2/libraries/drivers/hal/am_hal_interrupt.h
  85. 571 158
      bsp/apollo2/libraries/drivers/hal/am_hal_iom.c
  86. 84 32
      bsp/apollo2/libraries/drivers/hal/am_hal_iom.h
  87. 45 11
      bsp/apollo2/libraries/drivers/hal/am_hal_ios.c
  88. 5 5
      bsp/apollo2/libraries/drivers/hal/am_hal_ios.h
  89. 4 27
      bsp/apollo2/libraries/drivers/hal/am_hal_itm.c
  90. 6 7
      bsp/apollo2/libraries/drivers/hal/am_hal_itm.h
  91. 1 1
      bsp/apollo2/libraries/drivers/hal/am_hal_mcuctrl.c
  92. 6 6
      bsp/apollo2/libraries/drivers/hal/am_hal_mcuctrl.h
  93. 1 1
      bsp/apollo2/libraries/drivers/hal/am_hal_otp.c
  94. 6 6
      bsp/apollo2/libraries/drivers/hal/am_hal_otp.h
  95. 1 1
      bsp/apollo2/libraries/drivers/hal/am_hal_pdm.c
  96. 10 1
      bsp/apollo2/libraries/drivers/hal/am_hal_pdm.h
  97. 30 39
      bsp/apollo2/libraries/drivers/hal/am_hal_pin.h
  98. 1 1
      bsp/apollo2/libraries/drivers/hal/am_hal_pwrctrl.c
  99. 10 1
      bsp/apollo2/libraries/drivers/hal/am_hal_pwrctrl.h
  100. 1 1
      bsp/apollo2/libraries/drivers/hal/am_hal_queue.c

+ 8 - 0
.gitignore

@@ -26,3 +26,11 @@ tools/kconfig-frontends/kconfig-mconf
 packages
 cconfig.h
 GPUCache
+
+#cscope files
+cscope.*
+ncscope.*
+
+#ctag files
+tags
+

+ 7 - 2
.travis.yml

@@ -12,7 +12,7 @@ before_script:
   # - "[ $RTT_TOOL_CHAIN = 'sourcery-arm' ] && export RTT_EXEC_PATH=/usr/bin && arm-none-eabi-gcc --version || true"
   # - "[ $RTT_TOOL_CHAIN = 'sourcery-arm' ] && curl -s https://sourcery.mentor.com/public/gnu_toolchain/arm-none-eabi/arm-2014.05-28-arm-none-eabi-i686-pc-linux-gnu.tar.bz2 | sudo tar xjf - -C /opt && export RTT_EXEC_PATH=/opt/arm-2014.05/bin && /opt/arm-2014.05/bin/arm-none-eabi-gcc --version || true"
   - "[ $RTT_TOOL_CHAIN = 'sourcery-arm' ] && wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/arm-2017q2-v6/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2 && sudo tar xjf gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2 -C /opt && export RTT_EXEC_PATH=/opt/gcc-arm-none-eabi-6-2017-q2-update/bin && /opt/gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-gcc --version || true"
-  - "[ $RTT_TOOL_CHAIN = 'sourcery-mips' ] && curl -s https://sourcery.mentor.com/public/gnu_toolchain/mips-sde-elf/mips-2012.09-98-mips-sde-elf-i686-pc-linux-gnu.tar.bz2 | sudo tar xjf - -C /opt && export RTT_EXEC_PATH=/opt/mips-2012.09/bin && /opt/mips-2012.09/bin/mips-sde-elf-gcc --version || true"
+  - "[ $RTT_TOOL_CHAIN = 'sourcery-mips' ] && curl -s https://sourcery.mentor.com/public/gnu_toolchain/mips-sde-elf/mips-2016.05-7-mips-sde-elf-i686-pc-linux-gnu.tar.bz2 | sudo tar xjf - -C /opt && export RTT_EXEC_PATH=/opt/mips-2016.05/bin && /opt/mips-2016.05/bin/mips-sde-elf-gcc --version || true"
   # - "[ $RTT_TOOL_CHAIN = 'sourcery-ppc' ] && curl -s https://sourcery.mentor.com/public/gnu_toolchain/powerpc-eabi/freescale-2011.03-39-powerpc-eabi-i686-pc-linux-gnu.tar.bz2 | sudo tar xjf - -C /opt && export RTT_EXEC_PATH=/opt/freescale-2011.03/bin && /opt/freescale-2011.03/bin/powerpc-eabi-gcc --version || true"
   # - "[ $RTT_TOOL_CHAIN = 'atmel-avr32' ] && curl -s http://www.atmel.com/images/avr32-gnu-toolchain-3.4.1.348-linux.any.x86.tar.gz | sudo tar xzf - -C /opt && export RTT_EXEC_PATH=/opt/avr32-gnu-toolchain-linux_x86/bin && /opt/avr32-gnu-toolchain-linux_x86/bin/avr32-gcc --version && curl -sO http://www.atmel.com/images/avr-headers-3.2.3.970.zip && unzip -qq avr-headers-3.2.3.970.zip -d bsp/$RTT_BSP || true"
   - export RTT_ROOT=`pwd`
@@ -24,7 +24,7 @@ script:
 env:
 #  - RTT_BSP='simulator' RTT_CC='clang-analyze' RTT_EXEC_PATH=/usr/share/clang/scan-build
   - RTT_BSP='CME_M7' RTT_TOOL_CHAIN='sourcery-arm'
-#  - RTT_BSP='apollo2' RTT_TOOL_CHAIN='sourcery-arm'
+  - RTT_BSP='apollo2' RTT_TOOL_CHAIN='sourcery-arm'
   - RTT_BSP='asm9260t' RTT_TOOL_CHAIN='sourcery-arm'
   - RTT_BSP='at91sam9260' RTT_TOOL_CHAIN='sourcery-arm'
   - RTT_BSP='allwinner_tina' RTT_TOOL_CHAIN='sourcery-arm'
@@ -33,6 +33,7 @@ env:
 #  - RTT_BSP='bf533' # no scons
   - RTT_BSP='efm32' RTT_TOOL_CHAIN='sourcery-arm' 
 #  - RTT_BSP='gd32450z-eval' RTT_TOOL_CHAIN='sourcery-arm' 
+  - RTT_BSP='gkipc' RTT_TOOL_CHAIN='sourcery-arm'
   - RTT_BSP='lm3s8962' RTT_TOOL_CHAIN='sourcery-arm' 
   - RTT_BSP='lm3s9b9x' RTT_TOOL_CHAIN='sourcery-arm' 
   - RTT_BSP='lm4f232' RTT_TOOL_CHAIN='sourcery-arm' 
@@ -58,8 +59,11 @@ env:
   - RTT_BSP='mini2440' RTT_TOOL_CHAIN='sourcery-arm' 
 #  - RTT_BSP='mini4020' # no scons
 #  - RTT_BSP='nios_ii' # no scons
+  - RTT_BSP='nuvoton_nuc472' RTT_TOOL_CHAIN='sourcery-arm'
+  - RTT_BSP='nuvoton_m05x' RTT_TOOL_CHAIN='sourcery-arm'
 #  - RTT_BSP='pic32ethernet' # no scons
   - RTT_BSP='qemu-vexpress-a9' RTT_TOOL_CHAIN='sourcery-arm'
+  - RTT_BSP='qemu-vexpress-gemini' RTT_TOOL_CHAIN='sourcery-arm'
   - RTT_BSP='sam7x' RTT_TOOL_CHAIN='sourcery-arm'
 #  - RTT_BSP='simulator' # x86
   - RTT_BSP='stm32f0x' RTT_TOOL_CHAIN='sourcery-arm' 
@@ -76,6 +80,7 @@ env:
   - RTT_BSP='stm32f429-disco' RTT_TOOL_CHAIN='sourcery-arm' 
   - RTT_BSP='stm32l475-iot-disco' RTT_TOOL_CHAIN='sourcery-arm' 
   - RTT_BSP='stm32l476-nucleo' RTT_TOOL_CHAIN='sourcery-arm' 
+  - RTT_BSP='stm32h743-nucleo' RTT_TOOL_CHAIN='sourcery-arm' 
 #  - RTT_BSP='taihu' RTT_TOOL_CHAIN='sourcery-ppc'
 #  - RTT_BSP='upd70f3454' # iar
 #  - RTT_BSP='x86' # x86

+ 0 - 340
COPYING

@@ -1,340 +0,0 @@
-		    GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-		    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-			    NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-	    How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year  name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.

+ 130 - 0
ChangeLog.md

@@ -1,3 +1,133 @@
+# RT-Thread v3.1.1 Change Log
+
+## Kernel
+
+* Support the configuration of the upward growth stack which is defined by the `ARCH_CPU_STACK_GROWS_UPWARD` macro. Because there are fewer ARCH for stacks growing upward, this configuration item does not display directly in menuconfig. When a CPU ARCH needs stacks growing upward, the configuration of `ARCH_CPU_STACK_GROWS_UPWARD` can be selected by BSP Kconfig file in default.
+* Support for ARMCC V6 and later compiler (LLVM-based Compiler); currently it's mainly used in Keil MDK IDE. Please notes that the "Warnings" needs to use `Moderate Warnings` in project configuration in C/C++ (AC6) TAB; After using ARMCC v6, RT-Thread will add an additional `CLANG_ARM` macro definition; (liruncong, nongxiaoming, bernard)
+* The `RT_USING_IDLE_HOOK` configuration in Kconfig becomes a separate configuration item, not limited to `RT_USING_HOOK`; (geniusgogo)
+
+## Components
+
+* Improve the PWM driver framework and add more interfaces.
+* Fix the F_SETFL handling in ioctrl function; Fix the return value issue of fcntl function which is always 0 value.
+* Fix the memheap object type issue when creating a ramfs object.
+* Add power management framework for low power applications.
+* Add multi-segment support for read and write operations in MC/SDIO driver framework (for stm32, you can choose a separate stm32_sdio package); (weety)
+* Add ringblk_buf component for the block mode but in ringbuffer applications;
+* Improve WLAN management framework with unified interfaces, management, commands, to provide more friendly support to developers and users;
+* Add the conditional macro in the finsh when the MSH component is not enabled, even if the code files are compiled.
+* Remove gdbstub and move to rt-thread packages.
+* Upgrade and improve SAL and AT components: (linuxhan, eddylin83, slyant, luofanlu, Hubert Xie, Lawlieta, zhaojuntao, armink)
+  * Fix the none cleared issue when closing socket in SAL, which lead to the socket is always holding.
+  * Fix the `select()` issue for UDP communication in AT component. Add the receiving data handling to complete the clearing of received event;
+  * Add the errno value when receive data timeout in at_recvfrom function in the AT component.
+  * Add the receive data timeout handling in at_client_recv function in the AT component.
+* Fix a possible issue in fputc function implementation when using microlib;
+* Add gmtime_r implementation for ARMCC, IAR tool chain;
+* Improve time function support in IAR and support 64bit time; (hichard)
+* DHCPD's support for IPv6;
+* Remove lwIP-1.3.2 porting and add lwIP-2.1.0 porting; lwIP-2.0.2 is still the default version.
+* Add a lightweight ulog component and automatically replace the debug macro of the original rtdbg.h when it's enable.
+* USB stack update
+  * HOST, optimize the USB HOST timeout mechanism; fix the un-alignment visit issue in F4xx-HAL USB host driver;
+  * Device: Add the check when class drivers are illegally registered; Fix the un-aligned access issue in some platforms; optimize CDC VCOM classes, add the timeout mechanism and ID definition.
+
+## BSP
+
+* Upgrade the wlan adaptor to the new version of Wi-Fi management framework in amebaz BSP.
+* Add airkiss wifi configuration code to amebaz BSP.
+* Update Apollo2 BSP with ADC, GPIO, I2C, PDM, SPI, UART and other drivers; (Haleyl)
+* BeagleBone BSP is changed to main function mode, and adds Kconfig configuration file.
+* DM365 BSP adds Kconfig configuration file;
+* Update HiFive1 BSP and add more documentation.
+* Update imx6sx BSP to main function mode, and add Kconfig configuration file.
+* Change the old imxrt1052-evk BSP. The imxrt1052-related BSPs are classified into the `bsp/imxrt` directory; A touch framework is added to `bsp/imxrt`, and later will be moved into `components/drivers` directory;
+* Improve stm32f4xx-HAL BSP with PWM, I2C, USB Host driver; (XuanZe, xuzhuoyi)
+* Improve stm32f10x BSP with CAN driver and increase I2C driver; (wuhanstudio, AubrCool)
+* Improve stm32f10x-HAL BSP with I2C, IWG, PWM, RTC and other drivers, improve UART driver; (XuanZe)
+* Improve stm32f429-disco BSP and add I2C, LCD, Touch driver; (xuzhuoyi)
+* Improve x86 BSP, support dlmodule function; (SASANO Takayoshi, parai)
+
+## Tool
+
+* Modify the building script to support Python 3; <Python 3 patches have been submitted to scons and need to wait for next scons release,maybe scons-3.0.2> (Arda)
+* Add `scons --pyconfig` mode, which has a TK UI configurator; (weety)
+* Support for GNU GCC 7/8 version toolchains (The `-std=c99` is not added into C-compiler flags), but please note: PThreads component failed in 2.5 and new version of newlib.
+
+# RT-Thread 3.1.0 Change Log
+
+## Kernel
+
+* The main thread priority can be configured by Kconfig;
+* Add the checking of kernel object type, which can effectively avoid the problem of continuing to use kernel objects after they are destroyed.
+* Add the idle hook list to mount multiple idle hook, and can be configured by Kconfig.
+* Add the device_ops operation set to reduce the footprint of device object.
+* Remove the special memory operation in application module when using SLAB memory management algorithm.
+* Move application module from the kernel to `libc/libdl`.
+* Enhance the debug information output of `rtdbg.h` file.
+* In Keil/IAR tool chain, the `RT_USED` is used to keep symbols and avoid to add more argument or section in link phrase.
+
+## Components
+
+* Remove all of external codes, which will be moved to packages in the future.
+* Add initialization flag for shell, file system, network protocol stack etc to prevent repeated initialization;
+* Enable the long file name feature of ELM FatFs in default.
+* Change DFS FD to dynamic allocation mode. The maximum number of allocation is still DFS_FD_MAX.
+* Add dfs_fdtable_get() function to get different fdtable;
+* Add more DFS error messages, and provide easy to understand log when abnormal.
+* Fix the disk format issue of FatFs file system when multiple FatFs file systems are mounted.
+* Remove the folder enter feature in msh when input a folder name;
+* Add `int finsh_set_prompt (const char * prompt);` routine for setting a custom prompt for msh;
+* Add the VBUS configuration in Kconfig.
+* Move the application module from kernel to `libc/libdl` component;
+* Rewrite most of the management code for application module: replace the original object container with the object list; split the symbol resolution code into different processor architecture etc.
+* Update the application module chapter in the programming guide, and change it into dynamic module chapter.
+* Overwrite the exit() function of newlib to take over the processing of exit for a dlmodule.
+* Add SAL (Socket Abstraction Layer) component for adapting different protocol stacks and network implementations, and update the relevant sections of the programming guide;
+* Add AT component, including AT client, AT server and AT Socket function;
+* Remove the poll/select API of DFS_NET and move them to SAL component.
+* Remove the strong dependence of lwIP component for DFS_NET and replace it with Kconfig configuration in SAL.
+* Add the DHCP server function with lwIP raw API;
+* Fix the wait queue none-initialization issue in socket allocation of lwIP.
+* When a thread is about to block on a wait queue, fix the wake up issue for `rt_wqueue_wakeup' is executed to wake up that thread;
+* Add the PWM driver framework;
+* Fix the sdio_irq_wakeup release issue in the MMC/SD framework.
+* Fix the problem of DMA handling in the serial driver framework.
+* Update SFUD to v1.0.6 version;
+
+## BSP
+
+* Fix the SP issue when hard fault occurs for ARM Cortex-M arch;
+* Add C-Sky CK802 architecture porting;
+* Add Realtek amebaz WiFi SOC (rtl8710bn) BSP;
+* Update imxrt1052-evk firmware SDK to support B model chip.
+* Fix the copying packets issue in the Godson 1C BSP when sending message.
+* The Nuvoton m05x/m451 BSP are changed into the main() entry mode, and supports GCC compilation;
+* Fix the inconsistency issue between touch range and LCD resolution in qemu-vexpress-a9.
+* Add qemu-vexpress-gemini BSP for dual core A9 (RT-Thread + Linux) arch;
+* Add the basic porting for Raspberry Pi 2B ;
+* Add CAN and PWM drivers in stm32f4xx-HAL BSP;
+* Optimize the GPIO driver in stm32f4xx-HAL BSP;
+* Add UART3 driver in stm32f4xx-HAL BSP;
+* Fix the I2C1 driver clock in stm32f10x BSP and WDG control interface.
+* Add rt_hw_us_delay interface in stm32f10x-HAL BSP;
+* Optimize the GPIO driver in stm32f10x-HAL BSP;
+* Add GPIO driver and RTC driver in stm32f107 BSP;
+
+## Tool
+
+* ENV update to v1.0.0 final version.
+* ENV added the China mirror for software package, which can speed up the software package download, update  etc.
+* Fix the ENV known bugs and enhance the interaction with users.
+* Add building script to detect the version of GCC & newlib;
+* Add building script to detect the version of armcc;
+* Add `scons --dist` function to make distribution for a BSP.
+* Add `scons - dist - strip' function to make a minimal files of distribution for a BSP.
+* Add `ASFLAGS/LOCAL_ASFLAGS' parameters for defined a group and pass them to assembler;
+* Fix some errors in building script under the Linux environment.
+* Add the C-Sky CDK IDE project generation.
+* Add `scons --target=vsc -s` to generate friendly configuration files for VSCode;
+
 # RT-Thread 3.0.4 Change Log
 
 ## Kernel

+ 201 - 0
LICENSE

@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

+ 20 - 9
README.md

@@ -2,6 +2,7 @@
 
 [中文页](README_zh.md) |
 
+[![GitHub](https://img.shields.io/github/license/RT-Thread/rt-thread.svg)](https://github.com/RT-Thread/rt-thread/blob/master/LICENSE)
 [![GitHub release](https://img.shields.io/github/release/RT-Thread/rt-thread.svg)](https://github.com/RT-Thread/rt-thread/releases)
 [![Build Status](https://travis-ci.org/RT-Thread/rt-thread.svg)](https://travis-ci.org/RT-Thread/rt-thread)
 [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/RT-Thread/rt-thread?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@@ -16,13 +17,13 @@ RT-Thread RTOS like a traditional real-time operating system. The kernel has rea
 
 * Device Driver;
 * Component;
-* Application Module
+* Dyanmic Module
 
 The device driver is more like a driver framework, UART, IIC, SPI, SDIO, USB device/host, EMAC, MTD NAND etc. The developer can easily add low level driver and board configuration, then combined with the upper framework, he/she can use lots of features.
 
 The Component is a software concept upon RT-Thread kernel, for example a shell (finsh/msh shell), virtual file system (FAT, YAFFS, UFFS, ROM/RAM file system etc), TCP/IP protocol stack (lwIP), POSIX (thread) interface etc. One component must be a directory under RT-Thread/Components and one component can be descripted by a SConscript file (then be compiled and linked into the system).
 
-The Appliation Module, or User Applicaion (UA) is a dyanmic loaded module, it can be compiled standalone without Kernel. Each UA has its own object container to manage thread/semaphore/kernel object which was created or initialized inside this UA. More information about UA, please visit another [git repo](https://github.com/RT-Thread/rtthread-apps). 
+The Dyanmic Module, formerly named as User Applicaion (UA) is a dyanmic loaded module or library, it can be compiled standalone without Kernel. Each Dyanmic Module has its own object list to manage thread/semaphore/kernel object which was created or initialized inside this UA. More information about UA, please visit another [git repo](https://github.com/RT-Thread/rtthread-apps).
 
 ## Board Support Package ##
 
@@ -42,9 +43,19 @@ RT-Thread RTOS can support many architectures:
 
 ## License ##
 
-RT-Thread RTOS is free software; you can redistribute it and/or modify it under terms of the GNU General Public License version 2 as published by the Free Software Foundation. RT-Thread RTOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with RT-Thread; see file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+RT-Thread is Open Source software under the Apache License 2.0 since RT-Thread v3.1.1. License and copyright information can be found within the code.
 
-As a special exception, including RT-Thread RTOS header files in a file, instantiating RT-Thread RTOS generics or templates, or linking other files with RT-Thread RTOS objects to produce an executable application, does not by itself cause the resulting executable application to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU Public License.
+    /*
+     * Copyright (c) 2006-2018, RT-Thread Development Team
+     *
+     * SPDX-License-Identifier: Apache-2.0
+     */
+
+Since 9th of September 2018, PRs submitted by the community may be merged into the main line only after signing the Contributor License Agreement(CLA).
+
+NOTE:
+
+RT-Thread using the Apache license v2.0 is only launched after the release of v3.1.1, and is still in preparation right now.
 
 ## Usage ##
 
@@ -60,18 +71,18 @@ In SConstruct file:
 
 When you set these variables correctly, you can use command:
 
-    scons 
+    scons
 
 under BSP directory to simplely compile RT-Thread RTOS.
 
 If you want to generate the IDE's project file, you can use command:
 
-    scons --target=mdk/mdk4/mdk5/iar/cb -s 
+    scons --target=mdk/mdk4/mdk5/iar/cb -s
 
-to generate the project file. 
+to generate the project file.
 
-NOTE: RT-Thread scons building system will tailor the system according to your rtconfig.h configuration header file. For example, if you disable the lwIP in the rtconfig.h by commenting the ```#define RT_USING_LWIP```, the generated project file should have no lwIP related files. 
+NOTE: RT-Thread scons building system will tailor the system according to your rtconfig.h configuration header file. For example, if you disable the lwIP in the rtconfig.h by commenting the ```#define RT_USING_LWIP```, the generated project file should have no lwIP related files.
 
 ## Contribution ##
 
-Please refer the contributors in the github. Thank all of RT-Thread Developers. 
+Please refer the contributors in the github. Thank all of RT-Thread Developers.

+ 12 - 4
README_zh.md

@@ -31,7 +31,7 @@ RT-Thread包含了一个自有的、传统的硬实时内核:可抢占的多
 
 更多的IoT软件包则以package方式被添加到RT-Thread系统中。
 
-应用模块,或者说用户应用(User Application,UA)是一个可动态加载的模块:它可以独立于RT-Thread固件而单独编译。一般的,每个UA都包含一个main函数入口;一个它自己的对象容器,用于管理这个应用的任务/信号量/消息队列等内核对象,创建、初始化、销毁等。更多关于UA的信息,请访问另外一个 [git 仓库](https://github.com/RT-Thread/rtthread-apps) 了解。
+应用模块,或者说用户应用(User Application,UA)是一个可动态加载的模块:它可以独立于RT-Thread固件而单独编译。一般的,每个UA都包含一个main函数入口;一个它自己的对象链表,用于管理这个应用的任务/信号量/消息队列等内核对象,创建、初始化、销毁等。更多关于UA的信息,请访问另外一个 [git 仓库](https://github.com/RT-Thread/rtthread-apps) 了解。
 
 ## 支持的芯片架构 ##
 
@@ -51,11 +51,19 @@ RT-Thread支持数种芯片体系架构,已经覆盖当前应用中的主流
 
 ## 许可证 ##
 
-RT-Thread is free software; you can redistribute it and/or modify it under terms of the GNU General Public License version 2 as published by the Free Software Foundation. RT-Thread RTOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with RT-Thread; see file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+RT-Thread从v3.1.1版本开始,是一个以Apache许可证2.0版本授权的开源软件,许可证信息以及版权信息一般的可以在代码首部看到:
 
-As a special exception, including RT-Thread RTOS header files in a file, instantiating RT-Thread RTOS generics or templates, or linking other files with RT-Thread RTOS objects to produce an executable application, does not by itself cause the resulting executable application to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU Public License.
+    /*
+     * Copyright (c) 2006-2018, RT-Thread Development Team
+     *
+     * SPDX-License-Identifier: Apache-2.0
+     */
 
-RT-Thread始终以开源的方式发展,所有发布的代码都遵循GPLv2+许可证。注意,GPLv2+的意思是,它是GPLv2的一个修改版本,添加了一定的例外。简单的来说,当使用RT-Thread时,除了RT-Thread发布的源代码以外的代码,可以不用遵循GPLv2的方式开源代码。
+从2018/09/09开始,开发者提交PR需要签署贡献者许可协议(CLA)。
+
+注意:
+
+以Apache许可协议v2.0版本授权仅在RT-Thread v3.1.1正式版发布之后才正式实施,当前依然在准备阶段(准备所有原有开发者签署CLA协议)。
 
 ## 编译 ##
 

+ 23 - 23
bsp/allwinner_tina/drivers/drv_gpio.c

@@ -53,7 +53,7 @@ int gpio_set_func(enum gpio_port port, enum gpio_pin pin, rt_uint8_t func)
 
     if (func & 0x8)
     {
-        dbg_log(DBG_WARNING, "[line]:%d There is a warning with parameter input\n", __LINE__);
+        LOG_W("[line]:%d There is a warning with parameter input", __LINE__);
         return RT_EINVAL;
     }
 
@@ -65,7 +65,7 @@ int gpio_set_func(enum gpio_port port, enum gpio_pin pin, rt_uint8_t func)
     data |= func << offset;
     writel(data, addr);
 
-    dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr));
+    LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
     return RT_EOK;
 }
 
@@ -80,7 +80,7 @@ int gpio_set_value(enum gpio_port port, enum gpio_pin pin, rt_uint8_t value)
 
     if (value & 0xE)
     {
-        dbg_log(DBG_WARNING, "[line]:%d There is a warning with parameter input\n", __LINE__);
+        LOG_W("[line]:%d There is a warning with parameter input", __LINE__);
         return RT_EINVAL;
     }
 
@@ -92,7 +92,7 @@ int gpio_set_value(enum gpio_port port, enum gpio_pin pin, rt_uint8_t value)
     data |= value << offset;
     writel(data, addr);
 
-    dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr));
+    LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
     return RT_EOK;
 }
 
@@ -110,7 +110,7 @@ int gpio_get_value(enum gpio_port port, enum gpio_pin pin)
 
     data = readl(addr);
 
-    dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr));
+    LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
     return (data >> offset) & 0x01;
 }
 
@@ -125,7 +125,7 @@ int gpio_set_pull_mode(enum gpio_port port,  enum gpio_pin pin, enum gpio_pull p
 
     if (pull & 0xC)
     {
-        dbg_log(DBG_WARNING, "[line]:%d There is a warning with parameter input\n", __LINE__);
+        LOG_W("[line]:%d There is a warning with parameter input", __LINE__);
         return RT_EINVAL;
     }
 
@@ -138,7 +138,7 @@ int gpio_set_pull_mode(enum gpio_port port,  enum gpio_pin pin, enum gpio_pull p
     data |= pull << offset;
     writel(data, addr);
 
-    dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr));
+    LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
     return RT_EOK;
 }
 
@@ -153,7 +153,7 @@ int gpio_set_drive_level(enum gpio_port port, enum gpio_pin pin, enum gpio_drv_l
 
     if (level & 0xC)
     {
-        dbg_log(DBG_WARNING, "[line]:%d There is a warning with parameter input\n", __LINE__);
+        LOG_W("[line]:%d There is a warning with parameter input", __LINE__);
         return RT_EINVAL;
     }
 
@@ -166,7 +166,7 @@ int gpio_set_drive_level(enum gpio_port port, enum gpio_pin pin, enum gpio_drv_l
     data |= level << offset;
     writel(data, addr);
 
-    dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr));
+    LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
     return RT_EOK;
 }
 
@@ -187,7 +187,7 @@ void gpio_direction_input(enum gpio_port port,  enum gpio_pin pin)
     data |= IO_INPUT << offset;
     writel(data, addr);
 
-    dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr));
+    LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
 }
 
 void gpio_direction_output(enum gpio_port port, enum gpio_pin pin, int value)
@@ -208,7 +208,7 @@ void gpio_direction_output(enum gpio_port port, enum gpio_pin pin, int value)
     data |= IO_OUTPUT << offset;
     writel(data, addr);
 
-    dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr));
+    LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
 }
 /*********************************************************
 **   IRQ
@@ -237,7 +237,7 @@ void gpio_select_irq_clock(enum gpio_port port, enum gpio_irq_clock clock)
     data &= ~0x01;
     data |= clock;
     writel(data, addr);
-    dbg_log(DBG_LOG, "[line]:%d addr:%08x data:%08x\n", __LINE__, addr, *((rt_uint32_t *)addr));
+    LOG_D("[line]:%d addr:%08x data:%08x", __LINE__, addr, *((rt_uint32_t *)addr));
 }
 
 void gpio_set_debounce(enum gpio_port port, enum gpio_direction_type prescaler)
@@ -253,7 +253,7 @@ void gpio_set_debounce(enum gpio_port port, enum gpio_direction_type prescaler)
     data &= ~(0x07 << 4);
     data |= prescaler << 4;
     writel(data, addr);
-    dbg_log(DBG_LOG, "[line]:%d addr:%08x data:%08x\n", __LINE__, addr, *((rt_uint32_t *)addr));
+    LOG_D("[line]:%d addr:%08x data:%08x", __LINE__, addr, *((rt_uint32_t *)addr));
 }
 
 void gpio_irq_enable(enum gpio_port port,  enum gpio_pin pin)
@@ -272,7 +272,7 @@ void gpio_irq_enable(enum gpio_port port,  enum gpio_pin pin)
     data |= 0x1 << offset;
     writel(data, addr);
     gpio_select_irq_clock(port, GPIO_IRQ_HOSC_24MHZ);
-    dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr));
+    LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
 }
 
 void gpio_irq_disable(enum gpio_port port,  enum gpio_pin pin)
@@ -292,7 +292,7 @@ void gpio_irq_disable(enum gpio_port port,  enum gpio_pin pin)
     data &= ~(0x1 << offset);
 
     writel(data, addr);
-    dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr));
+    LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
 }
 
 void gpio_set_irq_type(enum gpio_port port,  enum gpio_pin pin, enum gpio_irq_type irq_type)
@@ -312,7 +312,7 @@ void gpio_set_irq_type(enum gpio_port port,  enum gpio_pin pin, enum gpio_irq_ty
     data |= irq_type << offset;
     writel(data, addr);
 
-    dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr));
+    LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
 }
 
 static struct gpio_irq_def _g_gpio_irq_tbl[GPIO_PORT_NUM];
@@ -353,7 +353,7 @@ static void gpio_irq_handler(int irq, void *param)
     {
         if ((pend & 0x1) && (irq_def->irq_cb[pin] != RT_NULL))
         {
-            dbg_log(DBG_LOG, "do irq callback...\n", port, pin);
+            LOG_D("do irq callback...", port, pin);
             irq_def->irq_cb[pin](irq_def->irq_arg[pin]);
         }
         pin++;
@@ -452,7 +452,7 @@ static void pin_mode(struct rt_device *dev, rt_base_t pin, rt_base_t mode)
 {
     if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC))
     {
-        dbg_log(DBG_ERROR, "pin:%d value wrongful\n", pin);
+        LOG_E("pin:%d value wrongful", pin);
         return;
     }
 
@@ -463,7 +463,7 @@ static void pin_write(struct rt_device *dev, rt_base_t pin, rt_base_t value)
 {
     if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC))
     {
-        dbg_log(DBG_ERROR, "pin:%d value wrongful\n", pin);
+        LOG_E("pin:%d value wrongful", pin);
         return;
     }
 
@@ -474,7 +474,7 @@ static int pin_read(struct rt_device *device, rt_base_t pin)
 {
     if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC))
     {
-        dbg_log(DBG_ERROR, "pin:%d value wrongful\n", pin);
+        LOG_E("pin:%d value wrongful", pin);
         return 0;
     }
 
@@ -485,7 +485,7 @@ static rt_err_t pin_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint
 {
     if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC))
     {
-        dbg_log(DBG_ERROR, "pin:%d value wrongful\n", pin);
+        LOG_E("pin:%d value wrongful", pin);
         return RT_ERROR;
     }
 
@@ -497,7 +497,7 @@ static rt_err_t pin_detach_irq(struct rt_device *device, rt_int32_t pin)
 {
     if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC))
     {
-        dbg_log(DBG_ERROR, "pin:%d value wrongful\n", pin);
+        LOG_E("pin:%d value wrongful", pin);
         return RT_ERROR;
     }
 
@@ -510,7 +510,7 @@ rt_err_t pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t ena
 {
     if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC))
     {
-        dbg_log(DBG_ERROR, "pin:%d value wrongful\n", pin);
+        LOG_E("pin:%d value wrongful", pin);
         return RT_ERROR;
     }
 

+ 22 - 22
bsp/allwinner_tina/drivers/drv_sdio.c

@@ -99,7 +99,7 @@ static void mmc_delay_us(int us)
 
 static void mmc_dump_errinfo(unsigned int err)
 {
-    dbg_log(DBG_ERROR, "[err]:0x%08x, %s%s%s%s%s%s%s%s%s%s%s\n",
+    LOG_E("[err]:0x%08x, %s%s%s%s%s%s%s%s%s%s%s",
                err,
                err & SDXC_RespErr     ? " RE"     : "",
                err & SDXC_RespCRCErr  ? " RCE"    : "",
@@ -130,7 +130,7 @@ static int mmc_update_clk(tina_mmc_t mmc)
     }
     if (!timeout)
     {
-        dbg_log(DBG_ERROR, "mmc update clk failed\n");
+        LOG_E("mmc update clk failed");
         return -RT_ERROR;
     }
     /* clean interrupt */
@@ -189,8 +189,8 @@ static rt_err_t mmc_trans_data_by_dma(tina_mmc_t mmc, struct mmc_xfe_des *xfe)
             pdes[des_idx].buf_addr_ptr2 = (unsigned long)&pdes[des_idx+1];
         }
 
-        dbg_log(DBG_LOG, "frag %d, remain %d, des[%d](%08x): " \
-            "[0] = %08x, [1] = %08x, [2] = %08x, [3] = %08x\n", \
+        LOG_D("frag %d, remain %d, des[%d](%08x): " \
+            "[0] = %08x, [1] = %08x, [2] = %08x, [3] = %08x", \
             i, remain, des_idx, (unsigned int)&pdes[des_idx],
             (unsigned int)((unsigned int*)&pdes[des_idx])[0], (unsigned int)((unsigned int*)&pdes[des_idx])[1],
             (unsigned int)((unsigned int*)&pdes[des_idx])[2], (unsigned int)((unsigned int*)&pdes[des_idx])[3]);
@@ -243,7 +243,7 @@ static rt_err_t mmc_trans_data_by_cpu(tina_mmc_t mmc, struct mmc_xfe_des *xfe)
 
             if (timeout <= 0)
             {
-                dbg_log(DBG_ERROR, "write data by cpu failed status:0x%08x\n", mmc->star_reg);
+                LOG_E("write data by cpu failed status:0x%08x", mmc->star_reg);
                 return -RT_ERROR;
             }
             mmc->fifo_reg = buff[i];
@@ -258,7 +258,7 @@ static rt_err_t mmc_trans_data_by_cpu(tina_mmc_t mmc, struct mmc_xfe_des *xfe)
 
             if (timeout <= 0)
             {
-                dbg_log(DBG_ERROR, "read data by cpu failed status:0x%08x\n", mmc->star_reg);
+                LOG_E("read data by cpu failed status:0x%08x", mmc->star_reg);
                 return -RT_ERROR;
             }
             buff[i] = mmc->fifo_reg;
@@ -279,7 +279,7 @@ static rt_err_t mmc_config_clock(tina_mmc_t mmc, int clk)
     mmc->ckcr_reg = rval;
     if (mmc_update_clk(mmc) != RT_EOK)
     {
-        dbg_log(DBG_ERROR, "clk update fail line:%d\n", __LINE__);
+        LOG_E("clk update fail line:%d", __LINE__);
         return -RT_ERROR;
     }
 
@@ -298,7 +298,7 @@ static rt_err_t mmc_config_clock(tina_mmc_t mmc, int clk)
     mmc->ckcr_reg = rval;
     if(mmc_update_clk(mmc) != RT_EOK)
     {
-        dbg_log(DBG_ERROR, "clk update fail line:%d\n", __LINE__);
+        LOG_E("clk update fail line:%d", __LINE__);
         return -RT_ERROR;
     }
 
@@ -307,12 +307,12 @@ static rt_err_t mmc_config_clock(tina_mmc_t mmc, int clk)
 
 static rt_err_t mmc_set_ios(tina_mmc_t mmc, int clk, int bus_width)
 {
-    dbg_log(DBG_LOG, "mmc set io bus width:%d clock:%d\n", \
+    LOG_D("mmc set io bus width:%d clock:%d", \
         (bus_width == MMCSD_BUS_WIDTH_8 ? 8 : (bus_width == MMCSD_BUS_WIDTH_4 ? 4 : 1)), clk);
     /* change clock */
     if (clk && (mmc_config_clock(mmc, clk) != RT_EOK))
     {
-        dbg_log(DBG_ERROR, "update clock failed\n");
+        LOG_E("update clock failed");
         return -RT_ERROR;
     }
 
@@ -349,13 +349,13 @@ static int mmc_send_cmd(struct rt_mmcsd_host *host, struct rt_mmcsd_cmd *cmd)
     status = mmc->star_reg;
     while (status & (1 << 9))
     {
-        dbg_log(DBG_LOG, "note: check card busy\n");
+        LOG_D("note: check card busy");
 
         status = mmc->star_reg;
         if (!timeout--)
         {
             err = -1;
-            dbg_log(DBG_ERROR, "mmc cmd12 busy timeout data:0x%08x\n", status);
+            LOG_E("mmc cmd12 busy timeout data:0x%08x", status);
             return err;
         }
         mmc_delay_us(1);
@@ -397,7 +397,7 @@ static int mmc_send_cmd(struct rt_mmcsd_host *host, struct rt_mmcsd_cmd *cmd)
         mmc->bycr_reg = bytecnt;
     }
 
-    dbg_log(DBG_LOG, "cmd %d(0x%08x), arg 0x%08x\n", cmd->cmd_code, cmdval | cmd->cmd_code, cmd->arg);
+    LOG_D("cmd %d(0x%08x), arg 0x%08x", cmd->cmd_code, cmdval | cmd->cmd_code, cmd->arg);
     mmc->cagr_reg = cmd->arg;
     if (!data)
     {
@@ -412,7 +412,7 @@ static int mmc_send_cmd(struct rt_mmcsd_host *host, struct rt_mmcsd_cmd *cmd)
      */
     if (data)
     {
-        dbg_log(DBG_LOG, "mmc trans data %d bytes addr:0x%08x\n", bytecnt, data);
+        LOG_D("mmc trans data %d bytes addr:0x%08x", bytecnt, data);
 #ifdef CONFIG_MMC_USE_DMA
         if (bytecnt > 64)
         {
@@ -478,13 +478,13 @@ static int mmc_send_cmd(struct rt_mmcsd_host *host, struct rt_mmcsd_cmd *cmd)
         cmd->resp[2] = mmc->resp1_reg;
         cmd->resp[1] = mmc->resp2_reg;
         cmd->resp[0] = mmc->resp3_reg;
-        dbg_log(DBG_LOG, "mmc resp 0x%08x 0x%08x 0x%08x 0x%08x\n",
+        LOG_D("mmc resp 0x%08x 0x%08x 0x%08x 0x%08x",
                   cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
     }
     else
     {
         cmd->resp[0] = mmc->resp0_reg;
-        dbg_log(DBG_LOG, "mmc resp 0x%08x\n", cmd->resp[0]);
+        LOG_D("mmc resp 0x%08x", cmd->resp[0]);
     }
 
 out:
@@ -516,16 +516,16 @@ out:
             mmc->gctl_reg = mmc->gctl_reg | 0x80000000;
             mmc->dbgc_reg = 0xdeb;
             timeout = 1000;
-            dbg_log(DBG_LOG, "Read remain data\n");
+            LOG_D("Read remain data");
             while (mmc->bbcr_reg < 512)
             {
                 unsigned int tmp = mmc->fifo_reg;
                 tmp = tmp;
-                dbg_log(DBG_LOG, "Read data 0x%08x, bbcr 0x%04x\n", tmp, mmc->bbcr_reg);
+                LOG_D("Read data 0x%08x, bbcr 0x%04x", tmp, mmc->bbcr_reg);
                 mmc_delay_us(1);
                 if (!(timeout--))
                 {
-                    dbg_log(DBG_ERROR, "Read remain data timeout\n");
+                    LOG_E("Read remain data timeout");
                     break;
                 }
             }
@@ -536,7 +536,7 @@ out:
 
         mmc_update_clk(mmc);
         cmd->err = -RT_ETIMEOUT;
-        dbg_log(DBG_ERROR, "mmc cmd %d err\n", cmd->cmd_code);
+        LOG_E("mmc cmd %d err", cmd->cmd_code);
     }
 
     mmc->gctl_reg &= ~(0x1 << 4);
@@ -744,13 +744,13 @@ int tina_sdio_init(void)
         host = mmcsd_alloc_host();
         if (!host)
         {
-            dbg_log(DBG_ERROR, "alloc host failed\n");
+            LOG_E("alloc host failed");
             goto err;
         }
 
         if (rt_sem_init(&_sdio_drv.rt_sem, "sdio_sem", RT_NULL, RT_IPC_FLAG_FIFO))
         {
-            dbg_log(DBG_ERROR, "sem init failed\n");
+            LOG_E("sem init failed");
             goto err;
         }
         _sdio_drv.mmc_des = (tina_mmc_t)MMC0_BASE_ADDR;

+ 68 - 71
bsp/allwinner_tina/drivers/spi/drv_spi.c

@@ -33,25 +33,22 @@
 
 #define SPI_BUS_MAX_CLK    (30 * 1000 * 1000)
 
+//#define DEBUG
+
 #define DBG_ENABLE
 #define DBG_SECTION_NAME  "SPI"
+#ifdef DEBUG
+#define DBG_LEVEL         DBG_LOG
+#else
 #define DBG_LEVEL         DBG_WARNING
+#endif /* DEBUG */
 #define DBG_COLOR
 #include <rtdbg.h>
 
 #ifdef RT_USING_SPI
 
-//#define DEBUG
-
 #define ARR_LEN(__N)      (sizeof(__N) / sizeof(__N[0]))
 
-#ifdef DEBUG
-#define DEBUG_PRINTF(...)   rt_kprintf(__VA_ARGS__)
-#else
-#define DEBUG_PRINTF(...)
-#endif
-
-
 #define __SPI_STATIC_INLINE__ rt_inline
 
 /*
@@ -296,7 +293,7 @@ void SPI_DMA(SPI_T *spi, bool txEn, bool rxEn)
  * @brief
  */
 __SPI_STATIC_INLINE__
-void SPI_SetTxFifoThreshold(SPI_T *spi, uint8_t threshold)
+void SPI_SetTxFifoThreshold(SPI_T *spi, rt_uint8_t threshold)
 {
     HAL_MODIFY_REG(spi->FCTL, SPI_FCTL_TX_TRIG_LEVEL_MASK, threshold << SPI_FCTL_TX_TRIG_LEVEL_SHIFT);
 }
@@ -305,7 +302,7 @@ void SPI_SetTxFifoThreshold(SPI_T *spi, uint8_t threshold)
  * @brief
  */
 __SPI_STATIC_INLINE__
-void SPI_SetRxFifoThreshold(SPI_T *spi, uint8_t threshold)
+void SPI_SetRxFifoThreshold(SPI_T *spi, rt_uint8_t threshold)
 {
     HAL_MODIFY_REG(spi->FCTL, SPI_FCTL_RX_TRIG_LEVEL_MASK, threshold << SPI_FCTL_RX_TRIG_LEVEL_SHIFT);
 }
@@ -314,18 +311,18 @@ void SPI_SetRxFifoThreshold(SPI_T *spi, uint8_t threshold)
  * @brief
  */
 __SPI_STATIC_INLINE__
-uint8_t SPI_GetTxFifoCounter(SPI_T *spi)
+rt_uint8_t SPI_GetTxFifoCounter(SPI_T *spi)
 {
-    return (uint8_t)((spi->FST & SPI_FST_TF_CNT_MASK) >> SPI_FST_TF_CNT_SHIFT);
+    return (rt_uint8_t)((spi->FST & SPI_FST_TF_CNT_MASK) >> SPI_FST_TF_CNT_SHIFT);
 }
 
 /*
  * @brief
  */
 __SPI_STATIC_INLINE__
-uint8_t SPI_GetRxFifoCounter(SPI_T *spi)
+rt_uint8_t SPI_GetRxFifoCounter(SPI_T *spi)
 {
-    return (uint8_t)((spi->FST & SPI_FST_RF_CNT_MASK) >> SPI_FST_RF_CNT_SHIFT);
+    return (rt_uint8_t)((spi->FST & SPI_FST_RF_CNT_MASK) >> SPI_FST_RF_CNT_SHIFT);
 }
 
 /*
@@ -350,7 +347,7 @@ void SPI_DisableDualMode(SPI_T *spi)
  * @brief
  */
 __SPI_STATIC_INLINE__
-void SPI_SetInterval(SPI_T *spi, uint16_t nSCLK)
+void SPI_SetInterval(SPI_T *spi, rt_uint16_t nSCLK)
 {
     HAL_MODIFY_REG(spi->WAIT, SPI_WAIT_WCC_MASK, nSCLK << SPI_WAIT_WCC_SHIFT);
 }
@@ -358,9 +355,9 @@ void SPI_SetInterval(SPI_T *spi, uint16_t nSCLK)
 /*
  * @brief
  */
-static void SPI_SetClkDiv(SPI_T *spi, uint16_t div)
+static void SPI_SetClkDiv(SPI_T *spi, rt_uint16_t div)
 {
-    uint8_t n = 0;
+    rt_uint8_t n = 0;
     if (div < 1)
     {
         return;
@@ -401,7 +398,7 @@ void SPI_SetDataSize(SPI_T *spi, rt_uint32_t data_size, rt_uint32_t dummy_size)
  * @brief
  */
 __SPI_STATIC_INLINE__
-void SPI_Write(SPI_T *spi, uint8_t *data)
+void SPI_Write(SPI_T *spi, rt_uint8_t *data)
 {
     HAL_REG_8BIT(&spi->TXD) = *data;
 }
@@ -410,7 +407,7 @@ void SPI_Write(SPI_T *spi, uint8_t *data)
  * @brief
  */
 __SPI_STATIC_INLINE__
-void SPI_Read(SPI_T *spi, uint8_t *data)
+void SPI_Read(SPI_T *spi, rt_uint8_t *data)
 {
     *data = HAL_REG_8BIT(&spi->RXD);
 }
@@ -419,18 +416,18 @@ void SPI_Read(SPI_T *spi, uint8_t *data)
  * @brief
  */
 __SPI_STATIC_INLINE__
-uint8_t *SPI_TxAddress(SPI_T *spi)
+rt_uint8_t *SPI_TxAddress(SPI_T *spi)
 {
-    return (uint8_t *)&spi->TXD;
+    return (rt_uint8_t *)&spi->TXD;
 }
 
 /*
  * @brief
  */
 __SPI_STATIC_INLINE__
-uint8_t *SPI_RxAddress(SPI_T *spi)
+rt_uint8_t *SPI_RxAddress(SPI_T *spi)
 {
-    return (uint8_t *)&spi->RXD;
+    return (rt_uint8_t *)&spi->RXD;
 }
 
 /* private rt-thread spi ops function */
@@ -451,30 +448,30 @@ static rt_err_t configure(struct rt_spi_device *device,
     struct tina_spi *_spi_info = (struct tina_spi *)spi_bus->parent.user_data;
     SPI_T *spi = _spi_info->spi;
 
-    DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+    LOG_D("%s -> %d", __FUNCTION__, __LINE__);
 
     RT_ASSERT(device != RT_NULL);
     RT_ASSERT(configuration != RT_NULL);
 
-    DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+    LOG_D("%s -> %d", __FUNCTION__, __LINE__);
 
-    DEBUG_PRINTF("spi address: %08X\n", (rt_uint32_t)spi);
+    LOG_D("spi address: %08X", (rt_uint32_t)spi);
 
     SPI_Disable(spi);
     SPI_Reset(spi);
     SPI_ResetRxFifo(spi);
     SPI_ResetTxFifo(spi);
 
-    DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+    LOG_D("%s -> %d", __FUNCTION__, __LINE__);
 
     /* data_width */
     if (configuration->data_width != 8)
     {
-        DEBUG_PRINTF("error: data_width is %d\n", configuration->data_width);
+        LOG_D("error: data_width is %d", configuration->data_width);
         return RT_EIO;
     }
 
-    DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+    LOG_D("%s -> %d", __FUNCTION__, __LINE__);
     SPI_SetDuplex(spi, SPI_TCTRL_DHB_FULL_DUPLEX);
     SPI_SetMode(spi, SPI_CTRL_MODE_MASTER);
 
@@ -510,7 +507,7 @@ static rt_err_t configure(struct rt_spi_device *device,
         rt_uint32_t max_hz;
         rt_uint32_t div;
 
-        DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+        LOG_D("%s -> %d", __FUNCTION__, __LINE__);
 
         max_hz = configuration->max_hz;
 
@@ -520,14 +517,14 @@ static rt_err_t configure(struct rt_spi_device *device,
         }
         spi_clock = ahb_get_clk();
 
-        DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+        LOG_D("%s -> %d", __FUNCTION__, __LINE__);
 
         div = (spi_clock + max_hz - 1) / max_hz;
 
-        dbg_log(DBG_LOG, "configuration->max_hz: %d\n", configuration->max_hz);
-        dbg_log(DBG_LOG, "max freq: %d\n", max_hz);
-        dbg_log(DBG_LOG, "spi_clock: %d\n", spi_clock);
-        dbg_log(DBG_LOG, "div: %d\n", div);
+        LOG_D("configuration->max_hz: %d", configuration->max_hz);
+        LOG_D("max freq: %d", max_hz);
+        LOG_D("spi_clock: %d", spi_clock);
+        LOG_D("div: %d", div);
 
         SPI_SetClkDiv(spi, div / 2);
     } /* baudrate */
@@ -536,7 +533,7 @@ static rt_err_t configure(struct rt_spi_device *device,
     SPI_SetDataSize(spi, 0, 0);
     SPI_Enable(spi);
 
-    DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+    LOG_D("%s -> %d", __FUNCTION__, __LINE__);
 
     return RT_EOK;
 };
@@ -552,19 +549,19 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message *mes
     RT_ASSERT(device != NULL);
     RT_ASSERT(message != NULL);
 
-    DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
-    DEBUG_PRINTF("spi_info: %08X\n", (rt_uint32_t)_spi_info);
-    DEBUG_PRINTF("spi address: %08X\n", (rt_uint32_t)spi);
+    LOG_D("%s -> %d", __FUNCTION__, __LINE__);
+    LOG_D("spi_info: %08X", (rt_uint32_t)_spi_info);
+    LOG_D("spi address: %08X", (rt_uint32_t)spi);
 
     /* take CS */
     if (message->cs_take)
     {
         SPI_ManualChipSelect(spi, tina_spi_cs->cs);
         SPI_SetCsLevel(spi, false);
-        DEBUG_PRINTF("spi take cs\n");
+        LOG_D("spi take cs");
     }
 
-    DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+    LOG_D("%s -> %d", __FUNCTION__, __LINE__);
 
     {
         if ((config->data_width <= 8) && (message->length > 0))
@@ -574,7 +571,7 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message *mes
             rt_uint32_t tx_size = message->length;
             rt_uint32_t rx_size = message->length;
 
-            DEBUG_PRINTF("spi poll transfer start: %d\n", tx_size);
+            LOG_D("spi poll transfer start: %d", tx_size);
 
             SPI_ResetTxFifo(spi);
             SPI_ResetRxFifo(spi);
@@ -582,12 +579,12 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message *mes
 
             SPI_StartTransmit(spi);
 
-            DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+            LOG_D("%s -> %d", __FUNCTION__, __LINE__);
 
             while (tx_size > 0 || rx_size > 0)
             {
-                uint8_t tx_data = 0xFF;
-                uint8_t rx_data = 0xFF;
+                rt_uint8_t tx_data = 0xFF;
+                rt_uint8_t rx_data = 0xFF;
 
                 while ((SPI_GetTxFifoCounter(spi) < SPI_FIFO_SIZE) && (tx_size > 0))
                 {
@@ -611,25 +608,25 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message *mes
                 }
             }
 
-            DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+            LOG_D("%s -> %d", __FUNCTION__, __LINE__);
 
             if ((tx_size != 0) || (rx_size != 0))
             {
-                DEBUG_PRINTF("spi_tx_rx error with tx count = %d, rx count = %d.\n", tx_size, rx_size);
+                LOG_D("spi_tx_rx error with tx count = %d, rx count = %d.", tx_size, rx_size);
 
                 return 0;
             }
 
-            DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+            LOG_D("%s -> %d", __FUNCTION__, __LINE__);
 
             while (SPI_IntState(spi, SPI_INT_TRANSFER_COMPLETE) == 0);
             SPI_ClearInt(spi, SPI_INT_TRANSFER_COMPLETE);
 
-            DEBUG_PRINTF("spi poll transfer finsh\n");
+            LOG_D("spi poll transfer finsh");
         }
         else if (config->data_width > 8)
         {
-            DEBUG_PRINTF("data width: %d\n", config->data_width);
+            LOG_D("data width: %d", config->data_width);
             RT_ASSERT(NULL);
         }
     }
@@ -638,7 +635,7 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message *mes
     if (message->cs_release)
     {
         SPI_SetCsLevel(spi, true);
-        DEBUG_PRINTF("spi release cs\n");
+        LOG_D("spi release cs");
     }
 
     return message->length;
@@ -676,7 +673,7 @@ rt_err_t tina_spi_bus_register(SPI_T *spi, const char *spi_bus_name)
 {
     int i;
 
-    DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+    LOG_D("%s -> %d", __FUNCTION__, __LINE__);
 
     RT_ASSERT(spi_bus_name != RT_NULL);
 
@@ -688,67 +685,67 @@ rt_err_t tina_spi_bus_register(SPI_T *spi, const char *spi_bus_name)
             bus_gate_clk_enalbe(spis[i].spi_gate);
 
             spis[i].spi_bus->parent.user_data = (void *)&spis[i];
-            DEBUG_PRINTF("bus  addr: %08X\n", (rt_uint32_t)spis[i].spi_bus);
-            DEBUG_PRINTF("user_data: %08X\n", (rt_uint32_t)spis[i].spi_bus->parent.user_data);
-            DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+            LOG_D("bus  addr: %08X", (rt_uint32_t)spis[i].spi_bus);
+            LOG_D("user_data: %08X", (rt_uint32_t)spis[i].spi_bus->parent.user_data);
+            LOG_D("%s -> %d", __FUNCTION__, __LINE__);
             rt_spi_bus_register(spis[i].spi_bus, spi_bus_name, &tina_spi_ops);
-            DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+            LOG_D("%s -> %d", __FUNCTION__, __LINE__);
             return RT_EOK;
         }
     }
 
-    DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+    LOG_D("%s -> %d", __FUNCTION__, __LINE__);
 
     return RT_ERROR;
 }
 
 int rt_hw_spi_init(void)
 {
-    DEBUG_PRINTF("register spi bus\n");
+    LOG_D("register spi bus");
 
 #ifdef TINA_USING_SPI0
     /* register spi bus */
     {
         rt_err_t result;
 
-        DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+        LOG_D("%s -> %d", __FUNCTION__, __LINE__);
 
         gpio_set_func(GPIO_PORT_C, GPIO_PIN_0, IO_FUN_1);
         gpio_set_func(GPIO_PORT_C, GPIO_PIN_2, IO_FUN_1);
         gpio_set_func(GPIO_PORT_C, GPIO_PIN_3, IO_FUN_1);
 
-        DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+        LOG_D("%s -> %d", __FUNCTION__, __LINE__);
 
         result = tina_spi_bus_register((SPI_T *)SPI0_BASE_ADDR, "spi0");
         if (result != RT_EOK)
         {
-            DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+            LOG_D("%s -> %d", __FUNCTION__, __LINE__);
             return result;
         }
     }
 
-    DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+    LOG_D("%s -> %d", __FUNCTION__, __LINE__);
     /* attach cs */
     {
         static struct rt_spi_device spi_device;
         static struct tina_spi_cs  spi_cs;
         rt_err_t result;
 
-        DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+        LOG_D("%s -> %d", __FUNCTION__, __LINE__);
         spi_cs.cs = SPI_TCTRL_SS_SEL_SS0;
 
-        DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+        LOG_D("%s -> %d", __FUNCTION__, __LINE__);
         gpio_set_func(GPIO_PORT_C, GPIO_PIN_1, IO_FUN_1);
 
-        DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+        LOG_D("%s -> %d", __FUNCTION__, __LINE__);
         result = rt_spi_bus_attach_device(&spi_device, "spi00", "spi0", (void *)&spi_cs);
         if (result != RT_EOK)
         {
-            DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+            LOG_D("%s -> %d", __FUNCTION__, __LINE__);
             return result;
         }
     }
-    DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
+    LOG_D("%s -> %d", __FUNCTION__, __LINE__);
 #endif
 
 #ifdef TINA_USING_SPI1
@@ -763,12 +760,12 @@ int rt_hw_spi_init(void)
         result = tina_spi_bus_register((SPI_T *)SPI1_BASE_ADDR, "spi1");
         if (result != RT_EOK)
         {
-            DEBUG_PRINTF("register spi bus faild: %d\n", result);
+            LOG_D("register spi bus faild: %d", result);
             return result;
         }
     }
 
-    DEBUG_PRINTF("attach cs\n");
+    LOG_D("attach cs");
     /* attach cs */
     {
         static struct rt_spi_device spi_device;
@@ -781,7 +778,7 @@ int rt_hw_spi_init(void)
         result = rt_spi_bus_attach_device(&spi_device, "spi10", "spi1", (void *)&spi_cs);
         if (result != RT_EOK)
         {
-            DEBUG_PRINTF("attach cs faild: %d\n", result);
+            LOG_D("attach cs faild: %d", result);
             return result;
         }
     }

+ 129 - 23
bsp/amebaz/.config

@@ -13,15 +13,24 @@ CONFIG_RT_THREAD_PRIORITY_32=y
 # CONFIG_RT_THREAD_PRIORITY_256 is not set
 CONFIG_RT_THREAD_PRIORITY_MAX=32
 CONFIG_RT_TICK_PER_SECOND=1000
-CONFIG_RT_DEBUG=y
 CONFIG_RT_USING_OVERFLOW_CHECK=y
-CONFIG_RT_DEBUG_INIT=0
-CONFIG_RT_DEBUG_THREAD=0
 CONFIG_RT_USING_HOOK=y
+CONFIG_RT_IDEL_HOOK_LIST_SIZE=4
 CONFIG_IDLE_THREAD_STACK_SIZE=256
 CONFIG_RT_USING_TIMER_SOFT=y
 CONFIG_RT_TIMER_THREAD_PRIO=4
-CONFIG_RT_TIMER_THREAD_STACK_SIZE=512
+CONFIG_RT_TIMER_THREAD_STACK_SIZE=1024
+CONFIG_RT_DEBUG=y
+# CONFIG_RT_DEBUG_INIT_CONFIG is not set
+# CONFIG_RT_DEBUG_THREAD_CONFIG is not set
+# CONFIG_RT_DEBUG_SCHEDULER_CONFIG is not set
+# CONFIG_RT_DEBUG_IPC_CONFIG is not set
+# CONFIG_RT_DEBUG_TIMER_CONFIG is not set
+# CONFIG_RT_DEBUG_IRQ_CONFIG is not set
+# CONFIG_RT_DEBUG_MEM_CONFIG is not set
+# CONFIG_RT_DEBUG_SLAB_CONFIG is not set
+# CONFIG_RT_DEBUG_MEMHEAP_CONFIG is not set
+# CONFIG_RT_DEBUG_MODULE_CONFIG is not set
 
 #
 # Inter-Thread communication
@@ -53,13 +62,14 @@ CONFIG_RT_USING_DEVICE=y
 CONFIG_RT_USING_CONSOLE=y
 CONFIG_RT_CONSOLEBUF_SIZE=128
 CONFIG_RT_CONSOLE_DEVICE_NAME="dbg"
-# CONFIG_RT_USING_MODULE is not set
 
 #
 # RT-Thread Components
 #
 CONFIG_RT_USING_COMPONENTS_INIT=y
-# CONFIG_RT_USING_USER_MAIN is not set
+CONFIG_RT_USING_USER_MAIN=y
+CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048
+CONFIG_RT_MAIN_THREAD_PRIORITY=10
 
 #
 # C++ features
@@ -82,7 +92,7 @@ CONFIG_FINSH_CMD_SIZE=80
 # CONFIG_FINSH_USING_AUTH is not set
 CONFIG_FINSH_USING_MSH=y
 CONFIG_FINSH_USING_MSH_DEFAULT=y
-# CONFIG_FINSH_USING_MSH_ONLY is not set
+CONFIG_FINSH_USING_MSH_ONLY=y
 CONFIG_FINSH_ARG_MAX=10
 
 #
@@ -94,26 +104,49 @@ CONFIG_FINSH_ARG_MAX=10
 # Device Drivers
 #
 CONFIG_RT_USING_DEVICE_IPC=y
+CONFIG_RT_PIPE_BUFSZ=512
 CONFIG_RT_USING_SERIAL=y
 # CONFIG_RT_USING_CAN is not set
 # CONFIG_RT_USING_HWTIMER is not set
 # CONFIG_RT_USING_CPUTIME is not set
 # CONFIG_RT_USING_I2C is not set
-CONFIG_RT_USING_PIN=y
+# CONFIG_RT_USING_PIN is not set
 # CONFIG_RT_USING_PWM is not set
 # CONFIG_RT_USING_MTD_NOR is not set
 # CONFIG_RT_USING_MTD_NAND is not set
+# CONFIG_RT_USING_MTD is not set
 # CONFIG_RT_USING_RTC is not set
 # CONFIG_RT_USING_SDIO is not set
 # CONFIG_RT_USING_SPI is not set
 # CONFIG_RT_USING_WDT is not set
-CONFIG_RT_USING_WIFI=y
-CONFIG_RT_USING_WLAN_STA=y
-CONFIG_RT_USING_WLAN_AP=y
-CONFIG_WIFI_DEVICE_STA_NAME="w0"
-CONFIG_WIFI_DEVICE_AP_NAME="ap"
 # CONFIG_RT_USING_AUDIO is not set
 
+#
+# Using WiFi
+#
+CONFIG_RT_USING_WIFI=y
+CONFIG_RT_WLAN_DEVICE_STA_NAME="wlan0"
+CONFIG_RT_WLAN_DEVICE_AP_NAME="wlan1"
+CONFIG_RT_WLAN_DEFAULT_PROT="lwip"
+CONFIG_RT_WLAN_SCAN_WAIT_MS=10000
+CONFIG_RT_WLAN_CONNECT_WAIT_MS=10000
+CONFIG_RT_WLAN_SSID_MAX_LENGTH=32
+CONFIG_RT_WLAN_PASSWORD_MAX_LENGTH=32
+CONFIG_RT_WLAN_SCAN_SORT=y
+CONFIG_RT_WLAN_CFG_INFO_MAX=3
+CONFIG_RT_WLAN_WORKQUEUE_THREAD_NAME="wlan_job"
+CONFIG_RT_WLAN_WORKQUEUE_THREAD_SIZE=2048
+CONFIG_RT_WLAN_WORKQUEUE_THREAD_PRIO=22
+CONFIG_RT_WLAN_DEV_EVENT_NUM=2
+# CONFIG_RT_WLAN_PROT_LWIP_PBUF_FORCE is not set
+CONFIG_RT_WLAN_DEBUG=y
+CONFIG_RT_WLAN_CMD_DEBUG=y
+# CONFIG_RT_WLAN_MGNT_DEBUG is not set
+# CONFIG_RT_WLAN_DEV_DEBUG is not set
+# CONFIG_RT_WLAN_PROT_DEBUG is not set
+# CONFIG_RT_WLAN_CFG_DEBUG is not set
+# CONFIG_RT_WLAN_LWIP_DEBUG is not set
+
 #
 # Using USB
 #
@@ -127,15 +160,21 @@ CONFIG_RT_USING_LIBC=y
 # CONFIG_RT_USING_PTHREADS is not set
 
 #
-# Network stack
+# Network
 #
 
+#
+# Socket abstraction layer
+#
+# CONFIG_RT_USING_SAL is not set
+
 #
 # light weight TCP/IP stack
 #
 CONFIG_RT_USING_LWIP=y
-CONFIG_RT_USING_LWIP141=y
-# CONFIG_RT_USING_LWIP202 is not set
+# CONFIG_RT_USING_LWIP141 is not set
+CONFIG_RT_USING_LWIP202=y
+# CONFIG_RT_USING_LWIP_IPV6 is not set
 CONFIG_RT_LWIP_IGMP=y
 CONFIG_RT_LWIP_ICMP=y
 # CONFIG_RT_LWIP_SNMP is not set
@@ -178,12 +217,22 @@ CONFIG_LWIP_SO_SNDTIMEO=1
 CONFIG_LWIP_SO_RCVBUF=1
 # CONFIG_RT_LWIP_NETIF_LOOPBACK is not set
 CONFIG_LWIP_NETIF_LOOPBACK=0
+# CONFIG_RT_LWIP_STATS is not set
+# CONFIG_RT_LWIP_DEBUG is not set
 
 #
 # Modbus master and slave stack
 #
 # CONFIG_RT_USING_MODBUS is not set
-# CONFIG_LWIP_USING_DHCPD is not set
+
+#
+# AT commands
+#
+# CONFIG_RT_USING_AT is not set
+CONFIG_LWIP_USING_DHCPD=y
+CONFIG_DHCPD_SERVER_IP="192.168.169.1"
+CONFIG_DHCPD_USING_ROUTER=y
+# CONFIG_LWIP_USING_CUSTOMER_DNS_SERVER is not set
 
 #
 # VBUS(Virtual Software BUS)
@@ -212,7 +261,6 @@ CONFIG_LWIP_NETIF_LOOPBACK=0
 # CONFIG_PKG_USING_LJSON is not set
 # CONFIG_PKG_USING_EZXML is not set
 # CONFIG_PKG_USING_NANOPB is not set
-# CONFIG_PKG_USING_GAGENT_CLOUD is not set
 
 #
 # Wi-Fi
@@ -230,7 +278,16 @@ CONFIG_LWIP_NETIF_LOOPBACK=0
 # CONFIG_PKG_USING_COAP is not set
 # CONFIG_PKG_USING_NOPOLL is not set
 # CONFIG_PKG_USING_NETUTILS is not set
+# CONFIG_PKG_USING_AT_DEVICE is not set
+# CONFIG_PKG_USING_WIZNET is not set
+
+#
+# IoT Cloud
+#
 # CONFIG_PKG_USING_ONENET is not set
+# CONFIG_PKG_USING_GAGENT_CLOUD is not set
+# CONFIG_PKG_USING_ALI_IOTKIT is not set
+# CONFIG_PKG_USING_AZURE is not set
 
 #
 # security packages
@@ -242,6 +299,7 @@ CONFIG_LWIP_NETIF_LOOPBACK=0
 #
 # language packages
 #
+# CONFIG_PKG_USING_LUA is not set
 # CONFIG_PKG_USING_JERRYSCRIPT is not set
 # CONFIG_PKG_USING_MICROPYTHON is not set
 
@@ -258,6 +316,7 @@ CONFIG_LWIP_NETIF_LOOPBACK=0
 # CONFIG_PKG_USING_EASYFLASH is not set
 # CONFIG_PKG_USING_EASYLOGGER is not set
 # CONFIG_PKG_USING_SYSTEMVIEW is not set
+# CONFIG_PKG_USING_RDB is not set
 
 #
 # system packages
@@ -271,22 +330,29 @@ CONFIG_LWIP_NETIF_LOOPBACK=0
 # CONFIG_PKG_USING_SQLITE is not set
 # CONFIG_PKG_USING_RTI is not set
 # CONFIG_PKG_USING_LITTLEVGL2RTT is not set
+# CONFIG_PKG_USING_CMSIS is not set
+# CONFIG_PKG_USING_DFS_YAFFS is not set
 
 #
 # peripheral libraries and drivers
 #
-# CONFIG_PKG_USING_STM32F4_HAL is not set
-# CONFIG_PKG_USING_STM32F4_DRIVERS is not set
 CONFIG_PKG_USING_REALTEK_AMEBA=y
 CONFIG_PKG_REALTEK_AMEBA_PATH="/packages/peripherals/realtek_ameba"
 CONFIG_PKG_USING_REALTEK_AMEBA_LATEST_VERSION=y
 # CONFIG_PKG_USING_REALTEK_AMEBA_V100 is not set
 CONFIG_PKG_REALTEK_AMEBA_VER="latest"
-# CONFIG_PKG_USING_CC3200_SDK is not set
+# CONFIG_PKG_USING_SHT2X is not set
+# CONFIG_PKG_USING_AHT10 is not set
+# CONFIG_PKG_USING_AP3216C is not set
+# CONFIG_PKG_USING_STM32_SDIO is not set
+# CONFIG_PKG_USING_ICM20608 is not set
+# CONFIG_PKG_USING_U8G2 is not set
 
 #
 # miscellaneous packages
 #
+# CONFIG_PKG_USING_LIBCSV is not set
+# CONFIG_PKG_USING_OPTPARSE is not set
 # CONFIG_PKG_USING_FASTLZ is not set
 # CONFIG_PKG_USING_MINILZO is not set
 # CONFIG_PKG_USING_QUICKLZ is not set
@@ -298,17 +364,57 @@ CONFIG_PKG_REALTEK_AMEBA_VER="latest"
 #
 # sample package
 #
-# CONFIG_PKG_USING_SAMPLES is not set
+
+#
+# samples: kernel and components samples
+#
+# CONFIG_PKG_USING_KERNEL_SAMPLES is not set
+# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set
+# CONFIG_PKG_USING_NETWORK_SAMPLES is not set
+# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set
 
 #
 # example package: hello
 #
 # CONFIG_PKG_USING_HELLO is not set
 
+#
+# Privated Packages of RealThread
+#
+# CONFIG_PKG_USING_CODEC is not set
+# CONFIG_PKG_USING_PLAYER is not set
+# CONFIG_PKG_USING_PERSIMMON_SRC is not set
+
+#
+# Network Utilities
+#
+# CONFIG_PKG_USING_MDNS is not set
+# CONFIG_PKG_USING_UPNP is not set
+# CONFIG_PKG_USING_WICED is not set
+# CONFIG_PKG_USING_CLOUDSDK is not set
+# CONFIG_PKG_USING_COREMARK is not set
+# CONFIG_PKG_USING_POWER_MANAGER is not set
+# CONFIG_PKG_USING_RT_OTA is not set
+# CONFIG_PKG_USING_RDBD_SRC is not set
+# CONFIG_PKG_USING_RTINSIGHT is not set
+# CONFIG_PKG_USING_SMARTCONFIG is not set
+
+#
+# Test Packages of RealThread
+#
+# CONFIG_PKG_USING_JERRYSCRIPT_WIN32 is not set
+# CONFIG_PKG_USING_JS_PERSIMMON is not set
+
 #
 # Env config
 #
 # CONFIG_SYS_AUTO_UPDATE_PKGS is not set
 # CONFIG_SYS_CREATE_MDK_IAR_PROJECT is not set
 # CONFIG_SYS_PKGS_DOWNLOAD_ACCELERATE is not set
-CONFIG_RT_USING_UART0=y
+
+#
+# External Libraries
+#
+CONFIG_RT_USING_SMARTCONFIG_LIB=y
+# CONFIG_BSP_USING_UART0 is not set
+CONFIG_BSP_USING_WIFI=y

+ 2 - 5
bsp/amebaz/Kconfig

@@ -26,10 +26,7 @@ config $ENV_DIR
 source "$RTT_DIR/Kconfig"
 source "$PKGS_DIR/Kconfig"
 source "$ENV_DIR/tools/scripts/cmds/Kconfig"
-
-config RT_USING_UART0
-    bool "Using RT_USING_UART0"
-    default y
+source "$BSP_DIR/libraries/Kconfig"
+source "$BSP_DIR/drivers/Kconfig"
 
 select PKG_USING_REALTEK_AMEBA
-

+ 179 - 51
bsp/amebaz/README.md

@@ -1,9 +1,8 @@
 # amebaz on RT-Thread
 
-## 1. 简介
+## 1 简介
 
-amebaz 是由Realtek推出的Cortex-M4内核的WiFi SOC芯片rtl8710b系列
-包括如下硬件特性:
+amebaz 是由Realtek推出的Cortex-M4内核的WiFi SOC芯片,属于rtl8710b系列。硬件特性如下:
 
 | 硬件 | 描述 |
 | -- | -- |
@@ -11,25 +10,42 @@ amebaz 是由Realtek推出的Cortex-M4内核的WiFi SOC芯片rtl8710b系列
 |CPU| Cortex-M4 |
 |主频| 125MHz |
 
-## 2. 编译说明
-
+## 2 编译说明
 
 | 环境         | 说明                                                         |
 | ------------ | ------------------------------------------------------------ |
 | PC操作系统   | Linux/MacOS/Windows                                          |
-| 编译器       | arm-none-eabi-gcc version 6.3.1 20170620 (release)/iar |
-| 构建工具     | scons/iar                                               |
+| 编译器       | arm-none-eabi-gcc version 6.3.1 20170620 (release) |
+| 构建工具     | scons                                               |
 | 依赖软件环境 | Env工具/(IAR或arm-none-eabi-gcc)/git/调试器驱动         |
 
-1) 下载源码
+## 3 下载源码
 
 ```bash
     git clone https://github.com/RT-Thread/rt-thread.git
 ```
 
-2) 配置工程并准备env
+## 4 环境准备
 
-(Linux/Mac)
+### 4.1 Windows 环境准备
+
+Windows环境下有两种开发环境,`GCC toolchain` 和 `IAR IDE`,根据不同的需求自行选择。
+
+#### 4.1.1 IAR 发开环境
+
+IAR 开发环境需要开发者自己安装软件,安装过程这里就不特别说明了。amebaz工程当前仅支持 `IAR 7.X` 的版本。
+
+#### 4.4.2 GCC 开发环境
+
+GCC开发使用 RT-Thread 官方提供的 env 工具,该工具集成 GCC 工具链,还具有编译构建环境、图形化系统配置及软件包管理功能。
+
+下载地址:[点击下载env工具](https://www.rt-thread.org/page/download.html)
+
+第一次使用env工具的开发者可以去这里查看教程:[RT-Thread env 工具用户手册](https://www.rt-thread.org/document/site/rtthread-development-guide/rtthread-tool-manual/env/env-user-manual/)。
+
+### 4.2 Linux/Mac 环境准备
+
+Linux/Mac 仅支持 GCC 工具链。
 
 ```bash
     cd rt-thread/bsp/amebaz
@@ -38,68 +54,62 @@ amebaz 是由Realtek推出的Cortex-M4内核的WiFi SOC芯片rtl8710b系列
     pkgs --upgrade
 ```
 
-(Windows
+## 5 配置工程(可选
 
->在[RT-Thread官网][1]下载ENV工具包
+### 5.1 Windows 配置工程
 
-3) 配置芯片型号
-
-(Linux/Mac)
+配置工程,需要在相应的工程目录下使用 `menuconfig` 命令打开图形界面,开发者根据自己的需求开关功能组件。
 
 ```bash
-    scons --menuconfig
+    menuconfig
 ```
 
-(Windows(ENV环境中))
+### 5.2 Linux/Mac 配置工程
+
+(Linux/Mac)
 
 ```bash
-    menuconfig
+    scons --menuconfig
 ```
 
-在menuconfig页面配置并选择对应的芯片型号,若开发环境为IAR,则需要生成工程
-
-4) 下载package
+## 6 更新软件包
 
-amebaz配套的驱动库以package形式提供,故需先下载对应的package(realtek-ameba),请使用env下载package
+amebaz 配套的驱动库以 package 形式提供,故需先下载对应的 package(realtek-ameba),在工程目录下,使用下面命令下载软件包。
 
 ```bash
     pkgs --update
 ```
 
-5) 生成工程(Mac/Linux下请跳过此步骤)
-
-(Windows IAR)
+## 7 编译
 
-```bash
-    SET RTT_CC=iar
-    scons --target=iar -s
-```
+### 7.1 Windows 编译工程
 
-*该板级支持包不支持生成mdk的工程
+#### 7.1.1 IAR 编译工程
 
+先打开工程目录下的IAR工程(project.eww),然后单击 Project 选项卡,单击 Rebuild All 选项,进行编译
 
-6) 编译
+![ ](figures/iar_build.png)
 
-使用IAR请参见对应教
+#### 7.1.2 GCC 编译工
 
-(Windows arm-none-eabi-gcc)
-使用以下指令设置gcc路径
+可以使用env编译工程,无需设置GCC工具链路径,直接在 rt-thread/bsp/amebaz 工程目录下输入 `scons` 编译即可。编译完成后,在工程目录下生成 `image2_all_ota1.bin` 文件。
 
 ```bash
-    SET RTT_EXEC_PATH=[GCC路径]
+    scons
 ```
 
-(Linux/Mac arm-none-eabi-gcc)
-使用以下指令设置gcc路径
+### 7.2 Linux/Mac 编译工程
+
+如果没有配置GCC路径的环境变量,则需要使用以下指令设置gcc路径。
 
 ```bash
     export RTT_EXEC_PATH=[GCC路径]
 ```
 
-编译(WindowsLinux/Mac arm-none-eabi-gcc)
+设置 GCC 路径后,使用 `scons` 编译工程。
 
 ```bash
-    scons -j4
+    scons
 ```
 
 出现下列信息即为编译成功
@@ -128,35 +138,153 @@ Done...
 scons: done building targets.
 ```
 
-如果编译正确无误,会产生image2_all_ota1.bin文件。
+如果编译正确无误,会在工程目录下生成 image2_all_ota1.bin 文件。
+
+## 8 烧写及执行
+
+### 8.1 IAR下载
+
+下载程序分为两部分:
+
+(a)先使用jlink工具正确连接A14(CLK),A15(TMS),GND,VCC引脚
+
+(b)打开 IAR 工程并完成编译后,单击 Project 选项卡下 Download 选项,选择 Download active application 下载程序。
+
+![IAR下载程序](figures/iar_download.png)
+
+(c)短按复位按钮,连接串口查看调试信息
+
+### 8.2 串口下载
+
+串口下载分为三个步骤
+
+(a)板子进入下载模式
+
+板子使用 `micros usb` 上电,然后按住 `FLASH` 键不放手,短按 `RST` 键,松开 `RST` 和 `FLASH` 键进入下载模式。
+
+(b)配置下载工具
 
-## 3. 烧写及执行
+打开 Image Tool 下载工具配置使用,选择 `micros usb` 所对应的串口端口,选择波特率,默认波特率 1.5Mbps,然后打开串口端口,如下载工具图“①”所示
 
-烧写可以使用仿真器 串口等多种方式 此处不再赘述
+![串口下载程序](figures/image-tool_v2.2.0.png)
 
-### 3.1 运行结果
+boot选择工程提供的 `boot_all.bin`, OTA1 选择生成的 image2_all_ota1.bin 文件(通常在工程目录下),并且注意在这两个选项前面打勾确认,其他默认即可,如下载工具图“②”。
 
-如果编译 & 烧写无误,会在专用日志串口*上看到RT-Thread的启动logo信息:
+(c)下载程序
+
+按下 Download(如下载工具图 “③”),即可开始下载程序,并且可以从日志窗口查看到下载信息。
+
+## 9 运行
+
+下载程序后,连接串口(默认使用板子上 `micro usb`),打开串口工具,配置串口波特率 115200,数据位 8 位,停止位 1 位,无校验,无流控;短按 `RST` 键复位,串口将输出调试信息,如下所示:
 
 ```bash
  \ | /
 - RT -     Thread Operating System
- / | \     3.0.4 build May 15 2018
+ / | \     3.1.1 build Oct 25 2018
  2006 - 2018 Copyright by rt-thread team
-msh />
+lwIP-2.0.2 initialized!
+
+Initializing WIFI ...
+LDO Mode, BD_Info: 0
+
+LDO Mode, BD_Info: 0
+
+WIFI initialized
+[I/WIFI] amebaz_wifi_start success
+build time: Oct 25 2018 10:52:02
+Hello RT-Thread!
+[I/WLAN.dev] wlan init success
+[I/WLAN.lwip] eth device init ok name:w0
+msh >
+```
+
+## 10 WIFI简单使用
+
+### wifi扫描命令
+
+wifi 扫描命令格式如下
+
+```bash
+    wifi scan
+```
+
+命令说明  
+
+| 字段 | 描述                     |
+| ---- | ------------------------ |
+| wifi | 有关wifi命令都以wifi开头 |
+| scan | wifi执行扫描动作         |
+
+在调试工具中输入该命令,即可进行 wifi 命令扫描,调试信息如下
+
+```bash
+scan ap down
+             SSID                      MAC              security    rssi   chn    Mbps
+------------------------------- -----------------    -------------- ----   ---    ----
+NEO-shanghai-ap2                58:66:ba:a1:ee:71    WPA2_TKIP_PSK   -74    11    0
+WQ1                             88:25:93:94:51:54    WPA2_AES_PSK    -76    13    0
+shyc1                           a0:40:a0:a3:e8:c9    WPA2_AES_PSK    -77    13    0
+KVIP                            70:65:82:3b:71:43    WPA2_AES_PSK    -83    11    0
+YST2016                         88:25:93:c6:67:d1    WPA2_TKIP_PSK   -84     4    0
 ```
 
-*默认串口
+> 注:wifi 有关的命令,均以wifi开头。
 
+### wifi 接入
 
-## 4. 驱动支持情况及计划
+接入 wifi 之前,先介绍一下其接入的命令 ,如下
+
+```bash
+    wifi join ssid 123456789
+```
+
+命令说明
+
+| 字段      | 描述                               |
+| --------- | ---------------------------------- |
+| wifi      | 有关wifi命令都以wifi开头           |
+| join      | wifi执行连接动作                   |
+| ssid      | 热点的名字                         |
+| 123456789 | 热点的密码,没有密码可不输入这一项 |
+
+了解上述命令,并且成功完成前面步骤,在串口中输入 `wifi w0 join realthread_VIP 123456789` ,如下日志表示连接成功
+
+```bash
+
+WIFI  wlan0 Setting:
+==============================
+      MODE => STATION
+      SSID => realthread_VIP
+   CHANNEL => 6
+  SECURITY => AES
+  PASSWORD => 123456789
+[I/WLAN.mgnt] wifi connect success ssid:realthread_VIP
+
+```
+
+另外,提供一个简单的测试使用命令,查询设备IP地址命令:ifconfig。
+
+```bash
+network interface: w0 (Default)
+MTU: 1500
+MAC: 00 e0 4c d5 ac 46
+FLAGS: UP LINK_UP ETHARP BROADCAST
+ip address: 172.16.200.110
+gw address: 172.16.200.1
+net mask  : 255.255.255.0
+dns server #0: 172.16.200.1
+dns server #1: 223.5.5.5
+```
+
+## 驱动支持情况及计划
 
 | 驱动       | 支持情况 | 备注                         |
 | ---------- | :------: | :--------------------------: |
-| UART       | 支持     | UART0                   |
-
+| UART       | 支持     | UART0                        |
+| WLAN       | 部分支持 | 仅支持STA模式                |
 
-## 5. 联系人信息
+## 联系人信息
 
 维护人:
 [flyingcys][4] < [flyingcys@163.com][5] >

+ 2 - 9
bsp/amebaz/applications/main.c

@@ -15,19 +15,12 @@
 
 #include <rthw.h>
 #include <rtthread.h>
-
-/**
- * @addtogroup ameba
- */
-
-/*@{*/
+#include <rtdevice.h>
 
 int main(void)
 {
     rt_kprintf("build time: %s %s\n", __DATE__, __TIME__);
     rt_kprintf("Hello RT-Thread!\n");
-    
+    rt_wlan_set_mode(RT_WLAN_DEVICE_STA_NAME, RT_WLAN_STATION);
     return 0;
 }
-
-/*@}*/

+ 146 - 0
bsp/amebaz/applications/smartconfig_app.c

@@ -0,0 +1,146 @@
+/*
+ * File      : smartconfig_demo.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2018-09-13     Bernard      the first version
+ */
+#include <rtthread.h>
+#include <rtdevice.h>
+
+#ifdef RT_USING_SMARTCONFIG_LIB
+
+#include <sys/socket.h>
+#include "smartconfig.h"
+
+#define NET_READY_TIME_OUT       (rt_tick_from_millisecond(30 * 1000))
+
+static int rt_wlan_device_connetct(char *ssid, char *passwd)
+{
+    int result = RT_EOK;
+    rt_uint8_t time_cnt = 0;
+
+    result = rt_wlan_connect(ssid, passwd);
+    if (result != RT_EOK)
+    {
+        rt_kprintf("\nconnect ssid %s error:%d!\n", ssid, result);
+        return result;
+    };
+
+    do
+    {
+        rt_thread_mdelay(1000);
+        time_cnt ++;
+        if (rt_wlan_is_ready())
+        {
+            break;
+        }
+    }
+    while (time_cnt <= (NET_READY_TIME_OUT / 1000));
+
+    if (time_cnt <= (NET_READY_TIME_OUT / 1000))
+    {
+        rt_kprintf("networking ready!\n");
+    }
+    else
+    {
+        rt_kprintf("wait ip got timeout!\n");
+        result = -RT_ETIMEOUT;
+    }
+
+    return result;
+}
+
+static void airkiss_send_notification(uint8_t random)
+{
+    int sock = -1;
+    int udpbufsize = 2;
+    struct sockaddr_in UDPBCAddr, UDPBCServerAddr;
+
+    sock = socket(AF_INET, SOCK_DGRAM, 0);
+    if (sock < 0)
+    {
+        rt_kprintf("notify create socket error!\n");
+        goto _exit;
+    }
+
+    UDPBCAddr.sin_family = AF_INET;
+    UDPBCAddr.sin_port = htons(10000);
+    UDPBCAddr.sin_addr.s_addr = htonl(0xffffffff);
+    rt_memset(&(UDPBCAddr.sin_zero), 0, sizeof(UDPBCAddr.sin_zero));
+
+    UDPBCServerAddr.sin_family = AF_INET;
+    UDPBCServerAddr.sin_port = htons(10000);
+    UDPBCServerAddr.sin_addr.s_addr = htonl(INADDR_ANY);
+    rt_memset(&(UDPBCServerAddr.sin_zero), 0, sizeof(UDPBCServerAddr.sin_zero));
+
+    if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &udpbufsize, sizeof(int)) != 0)
+    {
+        rt_kprintf("notify socket setsockopt error\n");
+        goto _exit;
+    }
+
+    if (bind(sock, (struct sockaddr *)&UDPBCServerAddr, sizeof(UDPBCServerAddr)) != 0)
+    {
+        rt_kprintf("notify socket bind error\n");
+        goto _exit;
+    }
+
+    for (int i = 0; i <= 20; i++)
+    {
+        int ret = sendto(sock, (char *)&random, 1, 0, (struct sockaddr *)&UDPBCAddr, sizeof(UDPBCAddr));
+        rt_thread_delay(10);
+    }
+
+    rt_kprintf("airkiss notification thread exit!\n");
+
+_exit:
+    if (sock >= 0)
+    {
+        closesocket(sock);
+    }
+}
+
+static int smartconfig_result(rt_smartconfig_type result_type, char *ssid, char *passwd, void *userdata, rt_uint8_t userdata_len)
+{
+    rt_uint8_t random = *(rt_uint8_t *)userdata;
+
+    rt_kprintf("type:%d\n", result_type);
+    rt_kprintf("ssid:%s\n", ssid);
+    rt_kprintf("passwd:%s\n", passwd);
+    rt_kprintf("user_data:0x%02x\n", random);
+    if (rt_wlan_device_connetct(ssid, passwd) == RT_EOK)
+    {
+        airkiss_send_notification(random);
+    }
+
+    return 0;
+}
+
+void smartconfig_demo(void)
+{
+    rt_smartconfig_start(SMARTCONFIG_TYPE_AIRKISS, SMARTCONFIG_ENCRYPT_NONE, RT_NULL, smartconfig_result);
+}
+
+#ifdef RT_USING_FINSH
+#include "finsh.h"
+MSH_CMD_EXPORT(smartconfig_demo, smartconfig demo);
+#endif
+
+#endif

+ 9 - 0
bsp/amebaz/drivers/Kconfig

@@ -0,0 +1,9 @@
+config BSP_USING_UART0
+    bool "Using UART0"
+    select RT_USING_SERIAL
+    default y
+
+config BSP_USING_WIFI
+    bool "Using WIFI"
+    select RT_USING_WIFI
+    default y

+ 3 - 8
bsp/amebaz/drivers/SConscript

@@ -5,14 +5,9 @@ list = os.listdir(cwd)
 objs = []
 
 src = Split('''
-	board.c
-	drv_uart.c
-	''')
-
-if GetDepend(['RT_USING_LWIP']):
-	src += Split('''
-		drv_wifi.c
-		''')
+    board.c
+    drv_uart.c
+    ''')
 
 CPPPATH = [cwd]
 

+ 2 - 4
bsp/amebaz/drivers/board.c

@@ -12,10 +12,8 @@
  * 2009-01-05     Bernard      first implementation
  * 2018-03-15     flyingcys    add amebaz
  */
+#include <rtl8710b.h>
 #include <stdint.h>
-#include <rthw.h>
-#include <rtthread.h>
-
 #include "board.h"
 #include "drv_uart.h"
 
@@ -87,7 +85,7 @@ void rt_hw_board_init(void)
 {
     extern uint32_t SystemCoreClock;
     SysTick_Config(SystemCoreClock/RT_TICK_PER_SECOND);
-    
+
 #ifdef RT_USING_HEAP
         rt_system_heap_init((void*)HEAP_BEGIN, (void*)HEAP_END);
 #endif

+ 11 - 1
bsp/amebaz/drivers/board.h

@@ -17,7 +17,17 @@
 #ifndef __BOARD_H__
 #define __BOARD_H__
 
-#include "rtl8710b.h"
+#ifdef _LITTLE_ENDIAN
+#undef _LITTLE_ENDIAN
+#endif
+
+#ifdef SECTION
+#undef SECTION
+#endif
+
+#include <rthw.h>
+#include <rtthread.h>
+#include <rtdevice.h>
 
 void rt_hw_board_init(void);
 

+ 8 - 10
bsp/amebaz/drivers/drv_uart.c

@@ -22,11 +22,8 @@
  * 2017-05-30     Bernard      the first version
  * 2018-03-15     flyingcys    add amebaz
  */
-
-#include <rthw.h>
-#include <rtthread.h>
-#include <rtdevice.h>
-
+#include <rtl8710b.h>
+#include <serial_api.h>
 #include "board.h"
 #include "drv_uart.h"
 
@@ -37,7 +34,9 @@ struct device_uart
     rt_uint32_t irqno;
 };
 
-#ifdef RT_USING_UART0
+extern int LOGUART_SetBaud(u32 BaudRate);
+
+#ifdef BSP_USING_UART0
 static struct rt_serial_device  serial0;
 static struct device_uart       uart0;
 #endif
@@ -64,7 +63,6 @@ const struct rt_uart_ops _uart_ops =
  */
 static rt_err_t ameba_uart_configure (struct rt_serial_device *serial, struct serial_configure *cfg)
 {
-     rt_uint32_t baud_div;
      struct device_uart * uart;
 
      RT_ASSERT(serial != RT_NULL);
@@ -230,16 +228,16 @@ int rt_hw_uart_init(void)
     struct rt_serial_device *serial;
     struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
 
-#ifdef RT_USING_UART0
+#ifdef BSP_USING_UART0
     {
         struct device_uart      *uart;
         
         serial  = &serial0;
         uart    = &uart0;
-                
+
         /* Init UART Hardware */
         serial_init(&uart->serial, UART_TX, UART_RX);
-        
+
         serial->ops              = &_uart_ops;
         serial->config           = config;
         serial->config.baud_rate = 115200;

+ 0 - 3
bsp/amebaz/drivers/drv_uart.h

@@ -26,9 +26,6 @@
 #ifndef __DRV_UART_H__
 #define __DRV_UART_H__
 
-#include "ameba_soc.h"
-#include "serial_api.h"
-
 #if defined(CONFIG_PLATFORM_8711B)
 // 8710B
 #define UART_TX PA_23

+ 0 - 453
bsp/amebaz/drivers/drv_wifi.c

@@ -1,453 +0,0 @@
-/*
- * File      : drv_wifi.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2017, RT-Thread Development Team
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License along
- *  with this program; if not, write to the Free Software Foundation, Inc.,
- *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Change Logs:
- * Date           Author       Notes
- * 2017-5-30      Bernard      the first version
- * 2018-5-30      flyingcys    add amebaz wifi driver
- */
-
-#include <rtthread.h>
-#include <wlan_dev.h>
-#include <skbuff.h>
-
-#include "amebaz_wlan.h"
-
-//#define ETH_RX_DUMP
-//#define ETH_TX_DUMP
-//#define MINI_DUMP
-
-struct sk_buff * rltk_wlan_get_recv_skb(int idx);
-struct sk_buff * rltk_wlan_alloc_skb(unsigned int total_len);
-
-#define     MAX_ADDR_LEN        6
-
-struct ameba_wifi
-{
-    struct rt_wlan_device parent;
-
-    rt_uint8_t dev_addr[MAX_ADDR_LEN];
-    
-    int idx;
-    int connected;
-};
-
-#ifdef RT_USING_WLAN_STA
-static struct ameba_wifi wifi_sta;
-#endif
-
-#ifdef RT_USING_WLAN_AP
-static struct ameba_wifi wifi_ap;
-#endif
-
-#if defined(ETH_RX_DUMP) ||  defined(ETH_TX_DUMP)
-static void packet_dump(const char *msg, const struct pbuf *p)
-{
-    const struct pbuf *q;
-    rt_uint32_t i, j;
-    rt_uint8_t *ptr;
-
-    rt_kprintf("%s %d byte\n", msg, p->tot_len);
-
-#ifdef MINI_DUMP
-	return;
-#endif
-
-    i = 0;
-    for (q = p; q != RT_NULL; q = q->next)
-    {
-        ptr = q->payload;
-
-        for (j = 0; j < q->len; j++)
-        {
-            if ((i % 8) == 0)
-            {
-                rt_kprintf("  ");
-            }
-            
-            if ((i % 16) == 0)
-            {
-                rt_kprintf("\r\n");
-            }
-            rt_kprintf("%02x ", *ptr);
-
-            i++;
-            ptr++;
-        }
-    }
-
-    rt_kprintf("\n\n");
-}
-#endif /* dump */
-
-#define netifapi_netif_set_link_up(n)      netifapi_netif_common(n, netif_set_link_up, NULL)
-#define netifapi_netif_set_link_down(n)    netifapi_netif_common(n, netif_set_link_down, NULL)
-
-void netif_set_connected(int connected)
-{
-    wifi_sta.connected = connected;
-    if (connected)
-    {
-        netifapi_netif_set_link_up(wifi_sta.parent.parent.netif);
-    }
-    else
-    {
-        netifapi_netif_set_link_down(wifi_sta.parent.parent.netif);
-    }
-} 
-
-void rltk_wlan_set_netif_info(int idx_wlan, void * dev, unsigned char * dev_addr)
-{
-    struct ameba_wifi *wifi;
-    
-    if(idx_wlan == 0)
-         wifi = &wifi_sta;
-    
-    rtw_memcpy(wifi->dev_addr, dev_addr, 6);
-    rt_hw_wifi_init();
-}
-
-void netif_rx(int idx, unsigned int len)
-{
-    struct ameba_wifi *wifi;
-	struct pbuf *p, *q;
-	int sg_len = 0;
-	struct sk_buff *skb = RT_NULL;
-
-    if(idx == 0)
-         wifi = &wifi_sta;
-    
-#if CONFIG_WLAN
-    if(!wifi->connected || !rltk_wlan_running(idx))
-        return;
-#endif
-
-    skb = rltk_wlan_get_recv_skb(idx);
-    if(!skb)
-    {
-        rt_kprintf("netif_rx rltk_wlan_get_recv_skb NULL.\n");
-        return;
-    }
-    
-	p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
-	if (p != RT_NULL)
-	{
-        pbuf_take(p, skb->data, len);
-        skb_pull(skb, len);
-        
-#ifdef ETH_RX_DUMP
-        packet_dump("RX dump", p);
-#endif /* ETH_RX_DUMP */
-
-        if(wifi->parent.parent.netif->input(p, wifi->parent.parent.netif) != ERR_OK)
-        {
-            pbuf_free(p);
-        }
-    }
-    else
-    {
-		rt_kprintf("pbuf_alloc NULL for wifi RX.\n");
-	}
-}
-      
-int netif_is_valid_IP(int idx, unsigned char *ip_dest)
-{
-
-	struct netif * pnetif;
-	struct ip_addr addr = { 0 };
-	u32_t *ip_dest_addr  = (u32_t*)ip_dest;
-
-    if(idx == 0)
-        pnetif = wifi_sta.parent.parent.netif;
-    
-	addr.addr = *ip_dest_addr;
-
-    if(pnetif == RT_NULL)
-        return 0;
-    
-	if(pnetif->ip_addr.addr == 0)
-		return 1;
-	
-	if(ip_addr_ismulticast(&addr) || ip_addr_isbroadcast(&addr,pnetif))
-    {
-		return 1;
-	}
-		
-	if(ip_addr_cmp(&(pnetif->ip_addr), &addr))
-		return 1;
-
-	return 0;
-}
-       
-void netif_post_sleep_processing(void)
-{
-
-}
-
-void netif_pre_sleep_processing(void)
-{
-
-}
-
-unsigned char *rltk_wlan_get_ip(int idx)
-{
-    struct ameba_wifi *wifi;
-
-    if(idx == 0)
-        wifi = &wifi_sta;
-
-    return (unsigned char *)&(wifi->parent.parent.netif->ip_addr);
-}
-
-struct netif *rltk_wlan_get_netif(int idx)
-{
-    struct netif *netif;
-    
-    if(idx == 0)
-        netif = wifi_sta.parent.parent.netif;
-    else if(idx == 1)
-        netif = wifi_ap.parent.parent.netif;
-
-    return netif;
-}
-
-
-rt_err_t rt_ameba_wifi_init(rt_device_t dev)
-{
-    return RT_EOK;
-}
-
-rt_err_t rt_ameba_wifi_open(rt_device_t dev, rt_uint16_t oflag)
-{
-    return RT_EOK;
-}
-
-rt_err_t rt_ameba_wifi_close(rt_device_t dev)
-{
-    return RT_EOK;
-}
-
-rt_size_t rt_ameba_wifi_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
-{
-    rt_set_errno(-RT_ENOSYS);
-    return 0;
-}
-
-rt_size_t rt_ameba_wifi_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
-{
-    rt_set_errno(-RT_ENOSYS);
-    return 0;
-}
-
-rt_err_t  rt_ameba_wifi_control(rt_device_t dev, int cmd, void *args)
-{
-    switch(cmd)
-    {
-    case NIOCTL_GADDR:
-    {
-        struct ameba_wifi *wifi = (struct ameba_wifi *)dev;
-        if(args)
-            memcpy(args, wifi->dev_addr, MAX_ADDR_LEN);
-        else
-            return -RT_ERROR;
-    }
-        break;
-
-    case WIFI_INIT:
-    {
-        rt_wlan_mode_t mode = *(rt_wlan_mode_t *)args;
-        rt_kprintf("mode:%d\n", mode);
-    }
-        break;    
-
-    case WIFI_SCAN:
-    {
-        struct rt_wlan_scan_result *dst = RT_NULL;
-        dst = (struct rt_wlan_scan_result *)rt_malloc(sizeof(struct rt_wlan_scan_result));
-        if(dst == RT_NULL)
-        {
-            rt_kprintf("rt_malloc for scan result failed!\n");
-            return -RT_ENOMEM;
-        }
-
-        memset(dst, 0, sizeof(struct rt_wlan_scan_result));
-        if(amebaz_wifi_scan(dst) != RT_EOK)
-        {
-            rt_kprintf("amebaz_wifi_scan failed...\n");
-            return -RT_ERROR;
-        }
-
-        *(struct rt_wlan_scan_result **)args = dst;
-    }
-        break;
-
-    case WIFI_JOIN:
-        
-        break;
-    
-    case WIFI_EASYJOIN:
-    {
-        struct rt_wlan_device *wlan = (struct rt_wlan_device *)dev;
-        if(amebaz_wifi_connect(wlan->info->ssid, (char *)args) != RT_EOK)
-        {
-            rt_kprintf("amebaz_wifi_connect failed...\n");
-            return -RT_ERROR;
-        }
-    }
-        break;
-        
-    case WIFI_SOFTAP:
-    {
-        struct rt_wlan_device *wlan = (struct rt_wlan_device *)dev;
-        if(amebaz_wifi_ap_start(wlan->info->ssid, (char *)args, wlan->info->channel) != RT_EOK)
-        {
-            rt_kprintf("amebaz_wifi_ap_start failed...\n");
-            return -RT_ERROR;
-        }
-    }
-        break;
-        
-    case WIFI_DISCONNECT:
-        if(amebaz_wifi_disconnect() != RT_EOK)
-        {
-            rt_kprintf("amebaz_wifi_disconnect failed...\n");
-            return -RT_ERROR;
-        }
-        break;
-        
-    case WIFI_GET_RSSI:
-    {
-        int *rssi = (int *)args;
-        
-        *rssi = amebaz_wifi_get_rssi();
-    }
-        break;
-        
-    case WIFI_ENTER_POWERSAVE:
-        
-        break;
-        
-    case WIFI_CFG_MONITOR:
-
-        break;
-        
-    case WIFI_SET_CHANNEL:
-    {
-        int channel = *(int *)args;
-        
-        amebaz_wifi_set_channel(channel);
-    }
-        break;
-        
-    case WIFI_GET_CHANNEL:
-    {
-        int *channel = (int *)args;
-
-        *channel = amebaz_wifi_get_channel();
-    }
-        break;
-        
-    case WIFI_SET_MONITOR_CALLBACK:
-        
-        break;
-    }
-
-    return RT_EOK;
-}
-
-rt_err_t rt_ameba_wifi_tx(rt_device_t dev, struct pbuf* p)
-{
-    rt_err_t result = RT_EOK;
-    struct ameba_wifi *wifi = (struct ameba_wifi *)dev;
-    int idx;
-    rt_base_t level;
-	struct sk_buff *skb = RT_NULL;
-
-    idx = wifi->idx;
-
-    level = rt_hw_interrupt_disable();
-	if(wifi->connected && rltk_wlan_check_isup(idx))
-		rltk_wlan_tx_inc(idx);
-    else
-    {
-        rt_hw_interrupt_enable(level);
-//		rt_kprintf("is not: connected && rltk_wlan_check_isup(idx)\n");
-
-        result = -RT_ERROR;
-        goto _exit;
-    }
-
-    rt_hw_interrupt_enable(level);
-    
-#ifdef ETH_TX_DUMP
-    packet_dump("TX dump", p);
-#endif /* ETH_TX_DUMP */
-
-    skb = rltk_wlan_alloc_skb(p->tot_len); 
-    if(skb != RT_NULL)
-    {
-		/* copy pbuf to a whole ETH frame */
-		pbuf_copy_partial(p, skb->tail, p->tot_len, 0);
-        skb_put(skb, p->tot_len);
-        
-    	rltk_wlan_send_skb(idx, skb);
-    }
-	else
-	{
-		rt_kprintf("rltk_wlan_alloc_skb NULL for WIFI TX.\n");
-        result = -RT_ENOMEM;
-	}
-
-_exit:  
-    level = rt_hw_interrupt_disable();
-    rltk_wlan_tx_dec(idx);
-    rt_hw_interrupt_enable(level);
-    
-    return result;
-}
-
-int rt_hw_wifi_init(void)
-{
-    rt_kprintf("%s %d\n", __FUNCTION__, __LINE__);
-    
-#ifdef RT_USING_WLAN_STA
-    wifi_sta.parent.parent.parent.init = rt_ameba_wifi_init;
-    wifi_sta.parent.parent.parent.open = rt_ameba_wifi_open;
-    wifi_sta.parent.parent.parent.close = rt_ameba_wifi_close;
-    wifi_sta.parent.parent.parent.read = rt_ameba_wifi_read;
-    wifi_sta.parent.parent.parent.write = rt_ameba_wifi_write;
-    wifi_sta.parent.parent.parent.control = rt_ameba_wifi_control;
-    wifi_sta.parent.parent.parent.user_data = RT_NULL;
-    //
-    wifi_sta.idx = 0;
-    //
-    wifi_sta.parent.parent.eth_rx = RT_NULL;
-    wifi_sta.parent.parent.eth_tx = rt_ameba_wifi_tx;
-
-    /* register wifi device */
-    eth_device_init(&wifi_sta.parent.parent, WIFI_DEVICE_STA_NAME);   
-#endif
-
-#ifdef RT_USING_WLAN_AP
-
-#endif
-    
-    return RT_EOK;
-}
-

+ 0 - 31
bsp/amebaz/drivers/drv_wifi.h

@@ -1,31 +0,0 @@
-/*
- * File      : drv_wifi.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2017, RT-Thread Development Team
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License along
- *  with this program; if not, write to the Free Software Foundation, Inc.,
- *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Change Logs:
- * Date           Author       Notes
- * 2017-5-30      Bernard      the first version
- */
- 
-#ifndef __DRV_WIFI_H__
-#define __DRV_WIFI_H__
-
-int rt_hw_wifi_init(void);
-    
-#endif /* __DRV_WIFI_H__ */
-

+ 5 - 4
bsp/amebaz/drivers/wlan/SConscript

@@ -6,10 +6,11 @@ CPPPATH = [cwd, str(Dir('#'))]
 
 src = []
 if GetDepend(['RT_USING_LWIP']):
-	src += Split('''
-		amebaz_wlan.c
-		''')
+        src += Split('''
+                drv_wifi.c
+                drv_wlan.c
+                ''')
 
-group = DefineGroup('amebaz_wlan', src, depend = [''], CPPPATH = CPPPATH)
+group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
 
 Return('group')

+ 0 - 642
bsp/amebaz/drivers/wlan/amebaz_wlan.c

@@ -1,642 +0,0 @@
-/*
- * File      : amebaz_wlan.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2017, RT-Thread Development Team
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License along
- *  with this program; if not, write to the Free Software Foundation, Inc.,
- *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Change Logs:
- * Date           Author       Notes
- * 2017-5-30      Bernard      the first version
- * 2018-6-12      flyingcys    add amebaz wlan interface
- */
-#include <rtthread.h>
-#include <netif/ethernetif.h>
-
-#include "wifi_structures.h"
-#include "wifi_constants.h"
-#include <wifi/wifi_util.h>
-#include <wifi/wifi_conf.h>
-
-
-#define     PASSWD_LEN          65
-#define     SCAN_WAIT_TIME      10000
-
-typedef enum
-{
-    WIFI_NONE,
-    WIFI_STATION,
-    WIFI_AP,
-} rt_wlan_mode_t;
-
-struct rt_wlan_info
-{
-    rt_wlan_mode_t mode;   /* wifi mode */
-    rtw_security_t security;
-
-    char *ssid;
-    uint8_t bssid[6];
-
-    /* maximal data rate */
-    uint32_t datarate;
-    /* radio channel */
-    uint16_t channel;
-    /* signal strength */
-    int16_t  rssi;
-};
-
-typedef struct rt_wlan_scan_result
-{
-    char ap_num;
-    struct rt_wlan_info *ap_table;
-} rt_wlan_scan_result_t;
-
-
-static rtw_network_info_t wifi_info = {0};
-static rtw_ap_info_t ap_info = {0};
-static unsigned char wifi_password[65] = {0};
-static unsigned char ap_password[PASSWD_LEN] = {0};
-static rt_sem_t scan_done_sem = RT_NULL;
-static char *scan_buf = RT_NULL;
-static int ApNum = 0;
-
-extern struct netif *rltk_wlan_get_netif(int idx);
-
-static void LwIP_ReleaseIP(uint8_t idx)
-{
-	struct ip_addr ipaddr;
-	struct ip_addr netmask;
-	struct ip_addr gw;
-	struct netif *pnetif = rltk_wlan_get_netif(idx);
-	
-	IP4_ADDR(&ipaddr, 0, 0, 0, 0);
-	IP4_ADDR(&netmask, 255, 255, 255, 0);
-	IP4_ADDR(&gw, 0, 0, 0, 0);
-	
-	netif_set_addr(pnetif, &ipaddr , &netmask, &gw);
-}
-
-static rtw_result_t amebaz_scan_result_handler( rtw_scan_handler_result_t* malloced_scan_result )
-{
-	if (malloced_scan_result->scan_complete != RTW_TRUE) {
-		rtw_scan_result_t* record = &malloced_scan_result->ap_details;
-		record->SSID.val[record->SSID.len] = 0; /* Ensure the SSID is null terminated */
-
-        ++ ApNum;
-        
-		if(malloced_scan_result->user_data)
-			memcpy((void *)((char *)malloced_scan_result->user_data+(ApNum-1)*sizeof(rtw_scan_result_t)), (char *)record, sizeof(rtw_scan_result_t));
-	} 
-    else
-    {
-        rt_kprintf("ap num:%d\n", ApNum);
-
-        if(scan_done_sem)
-        {
-            rt_sem_release(scan_done_sem);
-        }
-    }
-    
-	return RTW_SUCCESS;
-}
-
-
-static int amebaz_wifi_do_scan(void)
-{
-    int ret = RTW_SUCCESS;
-
-    rt_kprintf("wifi scan start...\n");
-
-	scan_buf = malloc(65*sizeof(rtw_scan_result_t));
-	if(scan_buf == NULL){
-		ret = RTW_BUFFER_UNAVAILABLE_TEMPORARY;
-		return -RT_ENOMEM;
-	}
-    
-	memset(scan_buf, 0, 65 * sizeof(rtw_scan_result_t));
-
-    if((ret = wifi_scan_networks(amebaz_scan_result_handler, scan_buf)) != RTW_SUCCESS){
-        rt_kprintf("ERROR: wifi scan failed\n\r");
-
-        return -RT_ERROR;
-    }
-
-    return RT_EOK;
-}
-
-int amebaz_wifi_scan(struct rt_wlan_scan_result *dst)
-{
-    rt_uint32_t i;
-    rt_uint32_t j = 0;
-    
-    scan_done_sem = rt_sem_create("scandone", 0, RT_IPC_FLAG_FIFO);
-    if(scan_done_sem == RT_NULL)
-        return -RT_ENOMEM;
-
-    if(amebaz_wifi_do_scan() != RT_EOK)
-    {
-        rt_kprintf("amebaz_wifi_do_scan failed...\n");
-        return -RT_ERROR;
-    }
-
-    if(rt_sem_take(scan_done_sem, rt_tick_from_millisecond(SCAN_WAIT_TIME)) != RT_EOK)
-    {
-        rt_kprintf("scan wait timeout...\n");
-        return -RT_ETIMEOUT;
-    } 
-
-    if(scan_done_sem)
-    {
-        rt_sem_delete(scan_done_sem);
-        scan_done_sem = RT_NULL;
-    }
-
-    rtw_scan_result_t *ptr = (rtw_scan_result_t *)scan_buf;
-    dst->ap_num = ApNum;
-    ApNum = 0;
-
-    dst->ap_table = (struct rt_wlan_info *)rt_malloc(sizeof(struct rt_wlan_info) * dst->ap_num);
-    if(dst->ap_table == RT_NULL)
-    {
-        rt_kprintf("rt_malloc for ap table failed...\n");
-        goto __exit;
-    }
-
-    for(i = 0; i < dst->ap_num; i ++)
-    {
-        dst->ap_table[i].mode = 1;
-        dst->ap_table[i].security = ptr->security;
-        dst->ap_table[i].ssid = (char *)rt_malloc(33);
-        if(dst->ap_table[i].ssid == RT_NULL)
-        {
-			rt_kprintf("rt_malloc for ssid Failed! times:%d,total:%d\n",i,ApNum);
-            j = i;
-            goto __exit;
-        }
-
-        memset(dst->ap_table[i].ssid, 0, 33);
-        memcpy(dst->ap_table[i].ssid, ptr->SSID.val, ptr->SSID.len);
-        memcpy(dst->ap_table[i].bssid, ptr->BSSID.octet, 6);
-        dst->ap_table[i].datarate = 0;
-        dst->ap_table[i].channel = ptr->channel;
-        dst->ap_table[i].rssi = ptr->signal_strength;
-
-        ptr ++;
-    }
-
-    if(scan_buf != RT_NULL)
-    {
-        rt_free(scan_buf);
-        scan_buf = RT_NULL;
-    }
-    
-    return RT_EOK;
-
-__exit:
-    
-    if(scan_buf != RT_NULL)
-    {
-        rt_free(scan_buf);
-        scan_buf = RT_NULL;
-    }
-
-    if(dst->ap_table)
-    {
-        for(i = 0; i < j; i ++)
-            rt_free(dst->ap_table[i].ssid);
-        rt_free(dst->ap_table);
-        dst->ap_table = RT_NULL;
-        dst->ap_num = 0;
-    }
-
-    return -RT_ERROR;
-}
-
-void amebaz_wifi_info_init(void)
-{
-    memset(wifi_info.ssid.val, 0, sizeof(wifi_info.ssid.val));
-    memset(wifi_info.bssid.octet, 0, 6);  
-    memset(wifi_password, 0, sizeof(wifi_password));
-    wifi_info.ssid.len = 0;
-    wifi_info.password = NULL;
-    wifi_info.password_len = 0;
-    wifi_info.key_id = -1;
-    
-    memset(ap_info.ssid.val, 0, sizeof(ap_info.ssid.val));
-    ap_info.ssid.len = 0;
-    ap_info.security_type = RTW_SECURITY_UNKNOWN;
-    ap_info.password = NULL;
-    ap_info.password_len = 0;
-    ap_info.channel = 1;
-}
-
-static int amebaz_wifi_set_sta_info(char *ssid, char *passwd)
-{
-    if(ssid == RT_NULL || strlen(ssid) > 32)
-    {
-        rt_kprintf("Invalid argument...\n");
-        return -RT_EINVAL;
-    }
-
-    strcpy(wifi_info.ssid.val, ssid);
-    wifi_info.ssid.len = strlen(ssid);
-
-    if(passwd != NULL)
-    {
-        if(strlen(passwd) > 64)
-        {
-            rt_kprintf("Invalid argument...\n");
-            return -RT_EINVAL;
-        }
-        strcpy(wifi_password, passwd);
-        wifi_info.password = wifi_password;
-        wifi_info.password_len = strlen(passwd);
-    }
-    else
-        wifi_info.password = RT_NULL;
-
-    return RT_EOK;
-}
-
-static int amebaz_wifi_set_ap_info(char *ssid, char *passwd, int channel)
-{
-    if(ssid == RT_NULL || strlen(ssid) > 32)
-    {
-        rt_kprintf("Invalid argument...\n");
-        return -RT_EINVAL;
-    }
-
-    strcpy(ap_info.ssid.val, ssid);
-    ap_info.ssid.len = strlen(ssid);
-
-    if(passwd != NULL)
-    {
-        if(strlen(passwd) > 64)
-        {
-            rt_kprintf("Invalid argument...\n");
-            return -RT_EINVAL;
-        }
-        strcpy(ap_password, passwd);
-        ap_info.password = ap_password;
-        ap_info.password_len = strlen(passwd);
-    }
-    else
-        ap_info.password = RT_NULL;
-
-    ap_info.channel = channel;
-    return RT_EOK;
-}
-
-static int amebaz_wifi_do_connect(void)
-{
-    int mode, ret;
-    char empty_bssid[6] = {0};
-    char assoc_by_bssid = 0;  
-        
-    rt_kprintf("amebaz wifi do connect start...\n"); 
-    if(memcmp (wifi_info.bssid.octet, empty_bssid, 6))
-    {
-        assoc_by_bssid = 1;
-    }
-    else if(wifi_info.ssid.val[0] == 0)
-    {
-        ret = RTW_BADARG;
-        return -RT_ERROR;
-    }
-    
-    if(wifi_info.password != RT_NULL)
-    {
-        if((wifi_info.key_id >= 0) && (wifi_info.key_id <= 3))
-        {
-            wifi_info.security_type = RTW_SECURITY_WEP_PSK;
-        }
-        else
-        {
-            wifi_info.security_type = RTW_SECURITY_WPA2_AES_PSK;
-        }
-    }
-    else
-    {
-        wifi_info.security_type = RTW_SECURITY_OPEN;
-    }
-    
-    //Check if in AP mode
-    wext_get_mode(WLAN0_NAME, &mode);
-    if(mode == IW_MODE_MASTER)
-    {
-    #if 0
-#if CONFIG_LWIP_LAYER
-        dhcps_deinit();
-#endif
-        wifi_off();
-        vTaskDelay(20);
-        if (wifi_on(RTW_MODE_STA) < 0){
-            printf("\n\rERROR: Wifi on failed!");
-                        ret = RTW_ERROR;
-            goto EXIT;
-        }
-    #endif
-    }
-
-    if(assoc_by_bssid)
-    {
-        rt_kprintf("Joining BSS by BSSID \"MAC_FMT\" ...\n", MAC_ARG(wifi_info.bssid.octet));
-        ret = wifi_connect_bssid(wifi_info.bssid.octet, (char*)wifi_info.ssid.val, wifi_info.security_type, (char*)wifi_info.password, 
-                        ETH_ALEN, wifi_info.ssid.len, wifi_info.password_len, wifi_info.key_id, NULL);     
-    } 
-    else 
-    {
-        rt_kprintf("\n\rJoining BSS by SSID %s...\n\r", (char*)wifi_info.ssid.val);
-        ret = wifi_connect((char*)wifi_info.ssid.val, wifi_info.security_type, 
-                        (char*)wifi_info.password, wifi_info.ssid.len,
-                        wifi_info.password_len, wifi_info.key_id, NULL);
-    }
-    
-    if(ret!= RTW_SUCCESS)
-    {
-        if(ret == RTW_INVALID_KEY)
-            rt_kprintf("ERROR:Invalid Key\n");
-        
-        rt_kprintf("ERROR: Can't connect to AP\n");
-        return -RT_ERROR;
-    }
-
-    rt_kprintf("now start dhcp...\n");
-    netif_set_connected(1);
-    dhcp_start(netif_default);
-    rt_kprintf("dhcp success...\n");
-    
-    return RT_EOK;
-}
-
-int amebaz_wifi_connect(char *ssid, char *passwd)
-{
-    int ret;
-
-    ret = amebaz_wifi_set_sta_info(ssid, passwd);
-    if(ret != RT_EOK)
-    {
-        amebaz_wifi_info_init();
-        return ret;
-    }
-    
-    if(amebaz_wifi_do_connect() != RT_EOK)
-    {
-        amebaz_wifi_info_init();
-        rt_kprintf("amebaz_wifi_do_connect failed...\n");
-        return -RT_ERROR;
-    }
-
-    amebaz_wifi_info_init();
-    
-    return RT_EOK;
-}
-
-static int amebaz_wifi_do_disconnect(void)
-{
-	int timeout = 20;
-	char essid[33];
-	int ret = RTW_SUCCESS;
-
-	if(wext_get_ssid(WLAN0_NAME, (unsigned char *) essid) < 0) 
-    {
-		rt_kprintf("\nWIFI disconnected!\n");
-        return -RT_ERROR;
-	}
-
-	if((ret = wifi_disconnect()) < 0) 
-    {
-        return -RT_ERROR;
-	}
-
-	while(1) 
-    {
-		if(wext_get_ssid(WLAN0_NAME, (unsigned char *) essid) < 0)
-        {
-			rt_kprintf("\nWIFI disconnected!\n");
-			break;
-		}
-
-		if(timeout == 0) 
-        {
-			rt_kprintf("ERROR: Deassoc timeout!\n\r");
-			ret = RTW_TIMEOUT;
-			break;
-		}
-
-		vTaskDelay(10);
-		timeout --;
-	}
-
-	LwIP_ReleaseIP(WLAN0_IDX);
-    
-    if(ret != RTW_SUCCESS)
-        return -RT_ERROR;
-
-    rt_kprintf("amebaz wifi do disconnect success...\n");
-    return RT_EOK;
-}
-
-int amebaz_wifi_disconnect(void)
-{
-    int ret = RT_EOK;
-
-    ret = amebaz_wifi_do_disconnect();
-    if(ret != RT_EOK)
-        rt_kprintf("amebaz_wifi_do_disconnect failed...\n");
-    
-    amebaz_wifi_info_init();
-
-    return ret;
-}
-
-static int amebaz_wifi_do_ap_start(void)
-{
-    struct ip_addr ipaddr;
-    struct ip_addr netmask;
-    struct ip_addr gw;
-    struct netif *pnetif = rltk_wlan_get_netif(1);
-
-    int timeout = 20;
-    int ret = RTW_SUCCESS;
-    
-    if(ap_info.ssid.val[0] == 0){
-        rt_kprintf("ERROR: SSID can't be empty\n\r");
-        return -RT_ERROR;
-    }
-    
-    if(ap_info.password == NULL)
-    {
-        ap_info.security_type = RTW_SECURITY_OPEN;
-    }
-    else
-    {
-        if(ap_info.password_len <= RTW_MAX_PSK_LEN && ap_info.password_len >= RTW_MIN_PSK_LEN)
-        { 
-            ap_info.security_type = RTW_SECURITY_WPA2_AES_PSK;
-        }
-        else
-        {
-            rt_kprintf("ERROR: password length is between 8 to 64 \n");
-            return -RT_ERROR;
-        }
-    }
-    
-//#if CONFIG_LWIP_LAYER
-//    dhcps_deinit();
-//    IP4_ADDR(&ipaddr, GW_ADDR0, GW_ADDR1, GW_ADDR2, GW_ADDR3);
-//    IP4_ADDR(&netmask, NETMASK_ADDR0, NETMASK_ADDR1 , NETMASK_ADDR2, NETMASK_ADDR3);
-//    IP4_ADDR(&gw, GW_ADDR0, GW_ADDR1, GW_ADDR2, GW_ADDR3);
-//    netif_set_addr(pnetif, &ipaddr, &netmask,&gw);
-//#ifdef CONFIG_DONT_CARE_TP
-//        pnetif->flags |= NETIF_FLAG_IPSWITCH;
-//#endif
-//#endif
-
-    wifi_off();
-    vTaskDelay(20);
-    if (wifi_on(RTW_MODE_AP) < 0)
-    {
-        rt_kprintf("ERROR: Wifi on failed!\n");
-        return -RT_ERROR;
-    }
-    rt_kprintf("Now start AP mode...\n");
-
-    if((ret = wifi_start_ap((char*)ap_info.ssid.val, ap_info.security_type, (char*)ap_info.password, ap_info.ssid.len, ap_info.password_len, ap_info.channel) ) < 0) 
-    {
-        rt_kprintf("ERROR: Operation failed!");
-        return -RT_ERROR;
-    }
-    
-    while(1) 
-    {
-        char essid[33];
-
-        if(wext_get_ssid(WLAN0_NAME, (unsigned char *) essid) > 0) 
-        {
-            if(strcmp((const char *) essid, (const char *)ap_info.ssid.val) == 0) 
-            {
-                rt_kprintf("AP %s started...\n", ap_info.ssid.val);
-                ret = RTW_SUCCESS;
-                break;
-            }
-        }
-
-        if(timeout == 0) 
-        {
-            rt_kprintf("ERROR: Start AP timeout!");
-            ret = RTW_TIMEOUT; 
-            break;
-        }
-
-        vTaskDelay(10);
-        timeout --;
-    }
-
-    if(ret != RTW_SUCCESS)
-        return -RT_ERROR;
-
-//#if CONFIG_LWIP_LAYER
-    //LwIP_UseStaticIP(pnetif);
-//    dhcps_init(pnetif);
-//#endif
-
-    return RT_EOK;
-}
-
-static int amebaz_wifi_do_ap_stop(void)
-{
-    return RT_EOK;
-}
-
-int amebaz_wifi_ap_start(char *ssid, char *passwd, int channel)
-{
-    int ret;
-
-    ret = amebaz_wifi_set_ap_info(ssid, passwd, channel);
-    if(ret != RT_EOK)
-    {
-        amebaz_wifi_info_init();
-        return ret;
-    }
-    
-    if(amebaz_wifi_do_ap_start() != RT_EOK)
-    {
-        amebaz_wifi_info_init();
-        rt_kprintf("amebaz_wifi_ap_start failed...\n");
-        return -RT_ERROR;
-    }
-
-    amebaz_wifi_info_init();
-    return RT_EOK;
-}
-
-int amebaz_wifi_ap_stop(void)
-{
-    int ret;
-
-    if(amebaz_wifi_do_ap_stop() != RT_EOK)
-    {
-        amebaz_wifi_info_init();
-        rt_kprintf("amebaz_wifi_ap_stop failed...\n");
-        return -RT_ERROR;
-    }
-
-    amebaz_wifi_info_init();
-    return RT_EOK;
-}
-
-int amebaz_wifi_get_rssi(void)
-{
-	int rssi = 0;
-    
-	wifi_get_rssi(&rssi);
-    
-    return rssi;
-}
-
-void amebaz_wifi_set_channel(int channel)
-{
-    wifi_set_channel(channel);
-}
-
-int amebaz_wifi_get_channel(void)
-{
-    int channel;
-    
-    wifi_get_channel(&channel);
-    
-    return channel;
-}
-
-int amebaz_wifi_init(rt_wlan_mode_t mode)
-{
-    int ret;
-    rtw_mode_t rtw_mode;
-
-    if(mode == WIFI_STATION)
-        rtw_mode = RTW_MODE_STA;
-    else if(mode == WIFI_AP)
-        rtw_mode = RTW_MODE_AP;
-    
-    if(wifi_on(mode) < 0)
-        return -RT_ERROR;
-    
-    if(wifi_set_autoreconnect(1) < 0)
-        return -RT_ERROR;
-
-    return RT_EOK;
-}
-

+ 0 - 54
bsp/amebaz/drivers/wlan/amebaz_wlan.h

@@ -1,54 +0,0 @@
-/*
- * File      : amebaz_wlan.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2017, RT-Thread Development Team
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License along
- *  with this program; if not, write to the Free Software Foundation, Inc.,
- *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Change Logs:
- * Date           Author       Notes
- * 2017-5-30      Bernard      the first version
- * 2018-6-12      flyingcys    add amebaz wlan interface
- */
- 
-#ifndef __AMEBAZ_WLAN_H__
-#define __AMEBAZ_WLAN_H__
-
-int amebaz_wifi_scan();
-
-void amebaz_wifi_info_init(void);
-
-int amebaz_wifi_set_sta_info(char *ssid, char *passwd);
-
-int amebaz_wifi_set_ap_info(char *ssid, char *passwd);
-
-int amebaz_wifi_connect(char *ssid, char *passwd);
-
-int amebaz_wifi_disconnect(void);
-
-int amebaz_wifi_ap_start(char *ssid, char *passwd, int channel);
-
-int amebaz_wifi_ap_stop(void);
-
-int amebaz_wifi_get_rssi(void);
-
-void amebaz_wifi_set_channel(int channel);
-
-int amebaz_wifi_get_channel(void);
-
-int amebaz_wifi_init(rt_wlan_mode_t mode);
-
-#endif /* __AMEBAZ_WLAN_H__ */
-

+ 660 - 0
bsp/amebaz/drivers/wlan/drv_wifi.c

@@ -0,0 +1,660 @@
+/*
+ * File      : drv_wifi.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2017, RT-Thread Development Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2017-5-30      Bernard      the first version
+ * 2018-5-30      flyingcys    add amebaz wifi driver
+ */
+#include <skbuff.h>
+#include "board.h"
+#include <string.h>
+#include "drv_wlan.h"
+#include "drv_wifi.h"
+
+#define DBG_ENABLE
+#define DBG_LEVEL DBG_INFO
+#define DBG_SECTION_NAME  "WIFI"
+#define DBG_COLOR
+#include <rtdbg.h>
+
+#define MAX_ADDR_LEN          (6)
+#define RT_WLAN_SSID_MAX_LEN  (32)
+
+#define WIFI_INIT_FLAG        (0x1 << 0)
+#define WIFI_MAC_FLAG         (0x1 << 1)
+#define WIFI_TYPE_STA         (0)
+#define WIFI_TYPE_AP          (1)
+
+struct ameba_wifi
+{
+    struct rt_wlan_device *wlan;
+    rt_uint8_t dev_addr[MAX_ADDR_LEN];
+    rt_uint8_t flag;
+    int connected;
+    int type;
+};
+
+extern unsigned char rltk_wlan_running(unsigned char idx);
+extern struct sk_buff * rltk_wlan_get_recv_skb(int idx);
+extern unsigned char rltk_wlan_check_isup(int idx);
+extern void rltk_wlan_tx_inc(int idx);
+extern struct sk_buff * rltk_wlan_alloc_skb(unsigned int total_len);
+extern void rltk_wlan_send_skb(int idx, struct sk_buff *skb);
+extern void rltk_wlan_tx_dec(int idx);
+extern void rtw_event_register(int event, void (*fun)(char *buf, int len, int flags, void *user_data) , void *user_data);
+
+static const struct rt_wlan_dev_ops ops;
+
+static struct ameba_wifi wifi_sta;
+static struct ameba_wifi wifi_ap;
+
+rt_inline struct ameba_wifi *rthw_wifi_get_dev(int idx)
+{
+    int mode = rthw_wifi_mode_get();
+
+    if (mode == 1) return &wifi_sta;
+    if (mode == 2) return &wifi_ap;
+    if (idx == 0) return &wifi_sta;
+    if (idx == 1) return &wifi_ap;
+    return RT_NULL;
+}
+
+rt_inline int rthw_wifi_get_idx(struct ameba_wifi *wifi)
+{
+    int mode = rthw_wifi_mode_get();
+
+    if (mode == 1) return 0;
+    if (mode == 2) return 0;
+    return wifi->type;
+}
+
+int rthw_wifi_register(struct ameba_wifi *wifi)
+{
+    struct rt_wlan_device *wlan = RT_NULL;
+
+    if ((wifi->flag & WIFI_INIT_FLAG) == 0)
+    {
+        if (wifi->type == WIFI_TYPE_STA)
+            wlan = rt_wlan_dev_register(RT_WLAN_DEVICE_STA_NAME, &ops, 0, wifi);
+        if (wifi->type == WIFI_TYPE_AP)
+            wlan = rt_wlan_dev_register(RT_WLAN_DEVICE_AP_NAME, &ops, 0, wifi);
+        wifi->flag |= WIFI_INIT_FLAG;
+        wifi->wlan = wlan;
+        LOG_D("F:%s L:%d wifi:0x%08x wlan:0x%08x\n", __FUNCTION__, __LINE__, wifi, wlan);
+    }
+    return RT_EOK;
+}
+
+void netif_post_sleep_processing(void)
+{
+}
+
+void netif_pre_sleep_processing(void)
+{
+}
+
+unsigned char *rltk_wlan_get_ip(int idx)
+{   
+    struct ameba_wifi *wifi;
+
+    wifi = rthw_wifi_get_dev(idx);
+    if (wifi == RT_NULL)
+        return RT_NULL;
+
+    LOG_D("F:%s L:%d is run", __FUNCTION__, __LINE__);
+
+    /* 这里留空了,会不会炸未知 */
+    return RT_NULL;
+}
+
+int netif_is_valid_IP(int idx, unsigned char *ip_dest)
+{
+    LOG_D("F:%s L:%d is run ip: %d:%d:%d:%d", __FUNCTION__, __LINE__, 
+        ip_dest[0], ip_dest[1], ip_dest[2], ip_dest[3]);
+    return 1;
+}
+
+void rltk_wlan_set_netif_info(int idx, void *dev, rt_uint8_t *dev_addr)
+{
+    struct ameba_wifi *wifi = RT_NULL;
+
+    wifi = rthw_wifi_get_dev(idx);
+    if (wifi == RT_NULL)
+        return;
+    LOG_D("F:%s L:%d wifi:0x%08x  type:0x%x", __FUNCTION__, __LINE__, wifi, wifi->flag);
+    rt_memcpy(wifi->dev_addr, dev_addr, 6);
+    wifi->flag |= WIFI_MAC_FLAG;
+    rthw_wifi_register(wifi);
+    LOG_D("wifi type:%d", wifi->type);
+    LOG_D("idx:%d MAC %02x:%02x:%02x:%02x:%02x:%02x", idx, dev_addr[0], dev_addr[1], dev_addr[2], dev_addr[3], dev_addr[4], dev_addr[5]);
+}
+
+static void rtw_connect_callbackfn(char *buf, int len, int flags, void *user_data)
+{
+    struct ameba_wifi *wifi = user_data;
+
+    LOG_D("L:%d wifi connect callback flags:%d user_data:%08x", __LINE__, flags, user_data);
+    if( wifi_is_connected_to_ap() == 0)
+    {
+        wifi->connected = 1;
+        rt_wlan_dev_indicate_event_handle(wifi->wlan, RT_WLAN_DEV_EVT_CONNECT, RT_NULL);
+    }
+}
+
+static void rtw_connect_fail_callbackfn(char *buf, int len, int flags, void *user_data)
+{
+    struct ameba_wifi *wifi = user_data;
+
+    LOG_D("L:%d wifi connect callback flags:%d", __LINE__, flags);
+    wifi->connected = 0;
+    rt_wlan_dev_indicate_event_handle(wifi->wlan, RT_WLAN_DEV_EVT_CONNECT_FAIL, RT_NULL);
+}
+
+static void rtw_disconnect_callbackfn(char *buf, int len, int flags, void *user_data)
+{
+    struct ameba_wifi *wifi = user_data;
+
+    LOG_D("L:%d wifi disconnect callback flags:%d", __LINE__, flags);
+    wifi->connected = 0;
+    rt_wlan_dev_indicate_event_handle(wifi->wlan, RT_WLAN_DEV_EVT_DISCONNECT, RT_NULL);
+}
+
+static void rtw_sta_assoc_callbackfn(char *buf, int len, int flags, void *user_data)
+{
+    LOG_D("L:%d wifi sta assoc callback flags:%d", __LINE__, flags);
+}
+
+static void rtw_sta_disassoc_callbackfn(char *buf, int len, int flags, void *user_data)
+{
+    LOG_D("L:%d wifi sta assoc callback flags:%d buf:%08x %08x", __LINE__, flags, *((rt_uint32_t*)buf), *((rt_uint32_t*)buf + 4));
+}
+
+void netif_rx(int idx, unsigned int len)
+{
+    struct ameba_wifi *wifi = RT_NULL;
+    struct sk_buff *skb = RT_NULL;
+
+    wifi = rthw_wifi_get_dev(idx);
+    if (wifi == RT_NULL)
+        return;
+
+    LOG_D("F:%s L:%d idx:%d len:%d", __FUNCTION__, __LINE__, idx, len);
+    if((!wifi->connected) || (!rltk_wlan_running(idx)))
+        return;
+
+    skb = (struct sk_buff *)rltk_wlan_get_recv_skb(idx);
+    if(!skb)
+    {
+        LOG_D("netif_rx rltk_wlan_get_recv_skb NULL.");
+        return;
+    }
+    rt_wlan_dev_report_data(wifi->wlan, skb->data, len);
+}
+
+static rt_wlan_security_t security_map_from_ameba(rthw_security_t security)
+{
+    rt_wlan_security_t result = SECURITY_OPEN;
+
+    switch (security)
+    {
+    case RTHW_SECURITY_OPEN: result = SECURITY_OPEN; break;
+    case RTHW_SECURITY_WEP_PSK: result = SECURITY_WEP_PSK; break;
+    case RTHW_SECURITY_WEP_SHARED: result = SECURITY_WEP_SHARED; break;
+    case RTHW_SECURITY_WPA_TKIP_PSK: result = SECURITY_WPA_TKIP_PSK; break;
+    case RTHW_SECURITY_WPA_AES_PSK: result = SECURITY_WPA_AES_PSK; break;
+    case RTHW_SECURITY_WPA2_AES_PSK: result = SECURITY_WPA2_AES_PSK; break;
+    case RTHW_SECURITY_WPA2_TKIP_PSK: result = SECURITY_WPA2_TKIP_PSK; break;
+    case RTHW_SECURITY_WPA2_MIXED_PSK: result = SECURITY_WPA2_MIXED_PSK; break;
+    case RTHW_SECURITY_WPA_WPA2_MIXED: result = SECURITY_WPA2_AES_PSK; break;
+    case RTHW_SECURITY_WPS_OPEN: result = SECURITY_WPS_OPEN; break;
+    case RTHW_SECURITY_WPS_SECURE: result = SECURITY_WPS_SECURE; break;
+    default: result = -1; break;
+    }
+
+    return result;
+}
+
+static rthw_security_t security_map_from_rtthread(rt_wlan_security_t security)
+{
+    rt_wlan_security_t result = RTHW_SECURITY_OPEN;
+
+    switch (security)
+    {
+    case SECURITY_OPEN:                result = RTHW_SECURITY_OPEN;             break;
+    case SECURITY_WEP_PSK:             result = RTHW_SECURITY_WEP_PSK;          break;
+    case SECURITY_WEP_SHARED:          result = RTHW_SECURITY_WEP_SHARED;       break;
+    case SECURITY_WPA_TKIP_PSK:        result = RTHW_SECURITY_WPA_TKIP_PSK;     break;
+    case SECURITY_WPA_AES_PSK:         result = RTHW_SECURITY_WPA_AES_PSK;      break;
+    case SECURITY_WPA2_AES_PSK:        result = RTHW_SECURITY_WPA2_AES_PSK;     break;
+    case SECURITY_WPA2_TKIP_PSK:       result = RTHW_SECURITY_WPA2_TKIP_PSK;    break;
+    case SECURITY_WPA2_MIXED_PSK:      result = RTHW_SECURITY_WPA2_MIXED_PSK;   break;
+    case SECURITY_WPS_OPEN:            result = RTHW_SECURITY_WPS_OPEN;         break;
+    case SECURITY_WPS_SECURE:          result = RTHW_SECURITY_WPS_SECURE;       break;
+    default: result = -1; break;
+    }
+
+    return result;
+}
+
+static void rt_ameba_wifi_scan_callback(struct rthw_wlan_info *info, void *user_data)
+{
+    struct rt_wlan_info wlan_info = { 0 };
+    struct rt_wlan_buff buff;
+    struct ameba_wifi *wifi = user_data;
+
+    if (info == RT_NULL)
+    {
+        rt_wlan_dev_indicate_event_handle(wifi->wlan, RT_WLAN_DEV_EVT_SCAN_DONE, RT_NULL);
+        return;
+    }
+    memcpy(&wlan_info.bssid[0], info->bssid, 6);
+    strncpy(&wlan_info.ssid.val[0], info->ssid, RT_WLAN_SSID_MAX_LEN);
+    wlan_info.ssid.len = strlen(&wlan_info.ssid.val[0]);
+    wlan_info.band = info->band == RTHW_802_11_BAND_2_4GHZ ? RTHW_802_11_BAND_2_4GHZ : RTHW_802_11_BAND_5GHZ;
+    wlan_info.channel = info->channel;
+    wlan_info.datarate = info->datarate * 1000;
+    wlan_info.security = security_map_from_ameba(info->security);
+    wlan_info.rssi = info->rssi;
+
+    buff.data = &wlan_info;
+    buff.len = sizeof(wlan_info);
+    rt_wlan_dev_indicate_event_handle(wifi->wlan, RT_WLAN_DEV_EVT_SCAN_REPORT, &buff);
+}
+
+static void rthw_wlan_monitor_callback(rt_uint8_t *data, int len, void *user_data)
+{
+    rt_wlan_dev_promisc_handler(wifi_sta.wlan, data, len);
+}
+
+static rt_err_t rthw_wlan_init                 (struct rt_wlan_device *wlan)
+{
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+    return RT_EOK;
+}
+
+static rt_err_t rthw_wlan_mode                 (struct rt_wlan_device *wlan, rt_wlan_mode_t mode)
+{
+    struct ameba_wifi *wifi = (struct ameba_wifi *)(wlan->user_data);
+
+    LOG_D("F:%s L:%d mode:%d", __FUNCTION__, __LINE__, mode);
+
+    if (mode == RT_WLAN_STATION)
+    {
+        if (wifi->type != WIFI_TYPE_STA)
+        {
+            LOG_D("this wlan not support sta mode");
+            return -RT_ERROR;
+        }
+    }
+    else if (mode == RT_WLAN_AP)
+    {
+        if (wifi->type != WIFI_TYPE_AP)
+        {
+            LOG_D("this wlan not support ap mode");
+            return -RT_ERROR;
+        }
+    }
+
+    return RT_EOK;
+}
+
+static rt_err_t rthw_wlan_scan                 (struct rt_wlan_device *wlan, struct rt_scan_info *scan_info)
+{
+    struct ameba_wifi *wifi = (struct ameba_wifi *)(wlan->user_data);
+
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+    LOG_D("F:%s L:%d wifi:0x%08x type:0x%x", __FUNCTION__, __LINE__, wifi, wifi->type);
+
+    if (wifi->type != WIFI_TYPE_STA)
+    {
+        LOG_D("this wlan not support scan mode");
+        return -RT_ERROR;
+    }
+    if (rthw_wifi_mode_get() == RTHW_MODE_NONE)
+    {
+        if(rthw_wifi_start(RTHW_MODE_STA_AP) != RT_EOK)
+        {
+            LOG_D("L:%d wifistart failed...", __LINE__);
+            return -1;
+        }
+    }
+    rthw_wifi_scan(rt_ameba_wifi_scan_callback, wifi);
+    return RT_EOK;
+}
+
+static rt_err_t rthw_wlan_join                 (struct rt_wlan_device *wlan, struct rt_sta_info *sta_info)
+{
+    struct ameba_wifi *wifi = (struct ameba_wifi *)(wlan->user_data);
+    int result = 0, i;
+    char *ssid = RT_NULL, *key = RT_NULL;
+
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+    if (wifi->type != WIFI_TYPE_STA)
+    {
+        LOG_E("this wlan not support sta mode");
+        return -RT_ERROR;
+    }
+    if ((rthw_wifi_mode_get() != RTHW_MODE_STA) && (rthw_wifi_mode_get() != RTHW_MODE_STA_AP))
+    {
+        rthw_wifi_stop();
+        rt_thread_delay(RT_TICK_PER_SECOND / 10);
+        if (rthw_wifi_start(RTHW_MODE_STA_AP) != RT_EOK)
+        {
+            LOG_E("wifi on failed, join fail");
+            return -RT_ERROR;
+        }
+    }
+    for (i = 0; i < RT_WLAN_BSSID_MAX_LENGTH; i++)
+    {
+        if (sta_info->bssid[i] != 0xff || sta_info->bssid[i] != 0x00)
+            break;
+    }
+    if (i < RT_WLAN_BSSID_MAX_LENGTH)
+    {
+        if (sta_info->ssid.len > 0)
+            ssid = &sta_info->ssid.val[0];
+        if (sta_info->key.len > 0)
+            key = &sta_info->key.val[0];
+            LOG_D("bssid connect bssid: %02x:%02x:%02x:%02x:%02x:%02x ssid:%s ssid_len:%d key:%s key_len%d", 
+            sta_info->bssid[0],sta_info->bssid[1],sta_info->bssid[2],sta_info->bssid[3],sta_info->bssid[4],sta_info->bssid[5],
+            ssid, 
+            sta_info->ssid.len,
+            key,
+            sta_info->key.len
+            );
+        result = rthw_wifi_connect_bssid(sta_info->bssid, ssid, sta_info->ssid.len, key, sta_info->key.len, security_map_from_rtthread(sta_info->security));
+    }
+    else
+    {
+        result = rthw_wifi_connect(sta_info->ssid.val, sta_info->ssid.len, sta_info->key.val, sta_info->key.len, security_map_from_rtthread(sta_info->security));
+    }
+    if (result != 0)
+    {
+        LOG_E("amebaz_wifi_connect failed...");
+        return -RT_ERROR;
+    }
+    // netif_set_connected((struct ameba_wifi *)wlan, 1);
+    LOG_D("amebaz_wifi_connect do");
+    return RT_EOK;
+}
+
+static rt_err_t rthw_wlan_softap               (struct rt_wlan_device *wlan, struct rt_ap_info *ap_info)
+{
+    struct ameba_wifi *wifi = (struct ameba_wifi *)(wlan->user_data);
+
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+
+    if (wifi->type != WIFI_TYPE_AP)
+    {
+        LOG_E("this wlan not support ap mode");
+        return -RT_ERROR;
+    }
+    if (rthw_wifi_ap_start(&ap_info->ssid.val[0], &ap_info->key.val[0], ap_info->channel) != 0)
+    {
+        rt_wlan_dev_indicate_event_handle(wifi->wlan, RT_WLAN_DEV_EVT_AP_STOP, RT_NULL);
+        wifi->connected = 0;
+        return -RT_ERROR;
+    }
+    rt_wlan_dev_indicate_event_handle(wifi->wlan, RT_WLAN_DEV_EVT_AP_START, RT_NULL);
+    wifi->connected = 1;
+    return RT_EOK;
+}
+
+static rt_err_t rthw_wlan_disconnect           (struct rt_wlan_device *wlan)
+{
+    struct ameba_wifi *wifi = (struct ameba_wifi *)(wlan->user_data);
+
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+
+    if (wifi->type != WIFI_TYPE_STA)
+    {
+        LOG_E("this wlan not support sta mode");
+        return -RT_ERROR;
+    }
+    wifi->connected = 0;
+    rthw_wifi_sta_disconnect();
+    rt_wlan_dev_indicate_event_handle(wifi->wlan, RT_WLAN_DEV_EVT_AP_STOP, RT_NULL);
+    return RT_EOK;
+}
+
+static rt_err_t rthw_wlan_ap_stop              (struct rt_wlan_device *wlan)
+{
+    struct ameba_wifi *wifi = (struct ameba_wifi *)(wlan->user_data);
+
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+
+    if (wifi->type != WIFI_TYPE_AP)
+    {
+        LOG_E("this wlan not support ap mode");
+        return -RT_ERROR;
+    }
+
+    rthw_wifi_ap_disconnect();
+    return RT_EOK;
+}
+
+static rt_err_t rthw_wlan_ap_deauth            (struct rt_wlan_device *wlan, rt_uint8_t mac[])
+{
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+    return RT_EOK;
+}
+
+static rt_err_t rthw_wlan_scan_stop            (struct rt_wlan_device *wlan)
+{
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+    return RT_EOK;
+}
+
+static int rthw_wlan_get_rssi                  (struct rt_wlan_device *wlan)
+{
+    struct ameba_wifi *wifi = (struct ameba_wifi *)(wlan->user_data);
+
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+
+    if (wifi->type != WIFI_TYPE_STA)
+    {
+        LOG_E("this wlan not support sta mode");
+        return -RT_ERROR;
+    }
+
+    return rthw_wifi_rssi_get();
+}
+
+static rt_err_t rthw_wlan_set_powersave            (struct rt_wlan_device *wlan, int level)
+{
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+    return RT_EOK;
+}
+
+static int rthw_wlan_get_powersave            (struct rt_wlan_device *wlan)
+{
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+    return 0;
+}
+
+static rt_err_t rthw_wlan_cfg_promisc          (struct rt_wlan_device *wlan, rt_bool_t start)
+{
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+
+    if(start)
+    {
+        rthw_wifi_monitor_callback_set(rthw_wlan_monitor_callback);
+        rthw_wifi_monitor_enable(1);
+    }
+    else
+    {
+        rthw_wifi_monitor_callback_set(RT_NULL);
+        rthw_wifi_monitor_enable(0);
+    }
+    return RT_EOK;
+}
+
+static rt_err_t rthw_wlan_cfg_filter           (struct rt_wlan_device *wlan, struct rt_wlan_filter *filter)
+{
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+    return RT_EOK;
+}
+
+static rt_err_t rthw_wlan_set_channel          (struct rt_wlan_device *wlan, int channel)
+{
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+
+    rthw_wifi_channel_set(channel);
+
+    return RT_EOK;
+}
+
+static int rthw_wlan_get_channel               (struct rt_wlan_device *wlan)
+{
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+
+    return rthw_wifi_channel_get();
+}
+
+static rt_err_t rthw_wlan_set_country          (struct rt_wlan_device *wlan, rt_country_code_t country_code)
+{
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+    return RT_EOK;
+}
+
+static rt_country_code_t rthw_wlan_get_country (struct rt_wlan_device *wlan)
+{
+    LOG_D("F:%s L:%d\n", __FUNCTION__, __LINE__);
+    return RT_EOK;
+}
+
+static rt_err_t rthw_wlan_set_mac              (struct rt_wlan_device *wlan, rt_uint8_t mac[])
+{
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+    return -RT_ERROR;
+}
+
+static rt_err_t rthw_wlan_get_mac              (struct rt_wlan_device *wlan, rt_uint8_t mac[])
+{
+    struct ameba_wifi *wifi = (struct ameba_wifi *)wlan->user_data;
+
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+    if(mac == RT_NULL)
+    {
+        return -RT_ERROR;
+    }
+    memcpy(mac, wifi->dev_addr, MAX_ADDR_LEN);
+    return RT_EOK;
+}
+
+static int rthw_wlan_recv                      (struct rt_wlan_device *wlan, void *buff, int len)
+{
+    LOG_D("F:%s L:%d", __FUNCTION__, __LINE__);
+    return RT_EOK;
+}
+
+static int rthw_wlan_send                      (struct rt_wlan_device *wlan, void *buff, int len)
+{
+    struct ameba_wifi *wifi = (struct ameba_wifi *)wlan->user_data;
+    int idx = rthw_wifi_get_idx(wifi);
+    rt_base_t level;
+    struct sk_buff *skb = RT_NULL;
+
+    LOG_D("F:%s L:%d len:%d", __FUNCTION__, __LINE__, len);
+
+    level = rt_hw_interrupt_disable();
+    if(!wifi->connected || !rltk_wlan_check_isup(idx))
+    {
+        rt_hw_interrupt_enable(level);
+        return -RT_ERROR;
+    }
+    rltk_wlan_tx_inc(idx);
+    rt_hw_interrupt_enable(level);
+
+    skb = (struct sk_buff *)rltk_wlan_alloc_skb(len);
+    if (skb == RT_NULL)
+    {
+        LOG_W("rltk_wlan_alloc_skb NULL for WIFI TX.");
+        goto exit;
+    }
+    /* copy buff to a whole ETH frame */
+    memcpy(skb->tail, buff, len);
+    skb_put(skb, len);
+    rltk_wlan_send_skb(idx, skb);
+
+exit:
+    level = rt_hw_interrupt_disable();
+    rltk_wlan_tx_dec(idx);
+    rt_hw_interrupt_enable(level);
+
+    LOG_D("F:%s L:%d end", __FUNCTION__, __LINE__);
+
+    return RT_EOK;
+}
+
+static const struct rt_wlan_dev_ops ops = 
+{
+    .wlan_init             =     rthw_wlan_init           ,
+    .wlan_mode             =     rthw_wlan_mode           ,
+    .wlan_scan             =     rthw_wlan_scan           ,
+    .wlan_join             =     rthw_wlan_join           ,
+    .wlan_softap           =     rthw_wlan_softap         ,
+    .wlan_disconnect       =     rthw_wlan_disconnect     ,
+    .wlan_ap_stop          =     rthw_wlan_ap_stop        ,
+    .wlan_ap_deauth        =     rthw_wlan_ap_deauth      ,
+    .wlan_scan_stop        =     rthw_wlan_scan_stop      ,
+    .wlan_get_rssi         =     rthw_wlan_get_rssi       ,
+    .wlan_set_powersave    =     rthw_wlan_set_powersave  ,
+    .wlan_get_powersave    =     rthw_wlan_get_powersave  ,
+    .wlan_cfg_promisc      =     rthw_wlan_cfg_promisc    ,
+    .wlan_cfg_filter       =     rthw_wlan_cfg_filter     ,
+    .wlan_set_channel      =     rthw_wlan_set_channel    ,
+    .wlan_get_channel      =     rthw_wlan_get_channel    ,
+    .wlan_set_country      =     rthw_wlan_set_country    ,
+    .wlan_get_country      =     rthw_wlan_get_country    ,
+    .wlan_set_mac          =     rthw_wlan_set_mac        ,
+    .wlan_get_mac          =     rthw_wlan_get_mac        ,
+    .wlan_recv             =     rthw_wlan_recv           ,
+    .wlan_send             =     rthw_wlan_send           ,
+};
+
+int rthw_wifi_low_init(void)
+{
+    static rt_int8_t _init_flag = 0;
+
+    if (_init_flag)
+    {
+        return 1;
+    }
+    rt_memset(&wifi_sta, 0, sizeof(wifi_sta));
+    rt_memset(&wifi_ap, 0, sizeof(wifi_ap));
+    wifi_sta.type = WIFI_TYPE_STA;
+    wifi_ap.type = WIFI_TYPE_AP;
+    if(rthw_wifi_start(RTHW_MODE_STA_AP) != RT_EOK)
+    {
+        LOG_E("amebaz_wifi_start failed...");
+        return -1;
+    }
+    LOG_I("amebaz_wifi_start success");
+    LOG_D("F:%s L:%d wifi_sta:0x%08x   wifi_ap:0x%08x", __FUNCTION__, __LINE__, &wifi_sta, &wifi_ap);
+
+    wifi_reg_event_handler(RTHW_WIFI_EVENT_FOURWAY_HANDSHAKE_DONE, rtw_connect_callbackfn, &wifi_sta);
+    wifi_reg_event_handler(RTHW_WIFI_EVENT_DISCONNECT, rtw_disconnect_callbackfn, &wifi_sta);
+
+    _init_flag = 1;
+
+    return 0;
+}
+INIT_DEVICE_EXPORT(rthw_wifi_low_init);

+ 31 - 0
bsp/amebaz/drivers/wlan/drv_wifi.h

@@ -0,0 +1,31 @@
+/*
+ * File      : drv_wifi.h
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2017, RT-Thread Development Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2017-5-30      Bernard      the first version
+ */
+ 
+#ifndef __DRV_WIFI_H__
+#define __DRV_WIFI_H__
+
+int rthw_wifi_low_init(void);
+
+#endif /* __DRV_WIFI_H__ */
+

+ 366 - 0
bsp/amebaz/drivers/wlan/drv_wlan.c

@@ -0,0 +1,366 @@
+/*
+ * File      : drv_wlan.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2017, RT-Thread Development Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2018-7-10      tyx          the first version
+ */
+
+#include "wifi_structures.h"
+#include "wifi_constants.h"
+#include <wifi/wifi_util.h>
+#include <wifi/wifi_conf.h>
+#include "board.h"
+#include "drv_wlan.h"
+
+// #define SCAN_WAIT_TIME       (10000)
+
+struct scan_user_data
+{
+    struct rt_completion done;
+    scan_callback_fn fun;
+    void *data;
+};
+
+extern rthw_mode_t wifi_mode;
+
+rthw_mode_t rthw_wifi_mode_get(void)
+{
+    return wifi_mode;
+}
+
+int rthw_wifi_stop(void)
+{
+    return wifi_off();
+}
+
+int rthw_wifi_start(rthw_mode_t mode)
+{
+    if(wifi_on(mode) < 0)
+    {
+        rt_kprintf("ERROR: wifi_on failed\n");
+        return -1;
+    }
+    return 0;
+}
+
+int rthw_wifi_connect(char *ssid, int ssid_len, char *password, int pass_len, rthw_security_t security_type)
+{
+    int mode;
+    rtw_wifi_setting_t setting;
+
+    mode = rthw_wifi_mode_get();
+    if ((mode != RTHW_MODE_STA) && (mode != RTHW_MODE_STA_AP))
+    {
+        return -1;
+    }
+    if(wext_get_mode(WLAN0_NAME, &mode) < 0)
+    {
+        rt_kprintf("L:%d wifi get mode err\n", __LINE__);
+        return -1;
+    }
+    if(wifi_connect(ssid, security_type, password, ssid_len, pass_len, -1, NULL) != RTW_SUCCESS)
+    {
+        rt_kprintf("wifi connect fail\n");
+        return -1;
+    }
+    rt_kprintf("wifi connect success\n");
+    rt_kprintf("Show Wi-Fi information\n");
+    wifi_get_setting(WLAN0_NAME,&setting);
+    wifi_show_setting(WLAN0_NAME,&setting);
+    return 0;
+}
+
+int rthw_wifi_connect_bssid(char *bssid, char *ssid, int ssid_len, char *password, int pass_len, rthw_security_t security_type)
+{
+    int mode;
+    rtw_wifi_setting_t setting;
+
+    mode = rthw_wifi_mode_get();
+    if ((mode != RTHW_MODE_STA) && (mode != RTHW_MODE_STA_AP))
+    {
+        return -1;
+    }
+    if(wext_get_mode(WLAN0_NAME, &mode) < 0)
+    {
+        rt_kprintf("L:%d wifi get mode err\n", __LINE__);
+        return -1;
+    }
+
+    if(wifi_connect_bssid(bssid, ssid, security_type, password, 6, ssid_len, pass_len, -1, NULL) != RTW_SUCCESS)
+    {
+        rt_kprintf("wifi connect fail\n");
+        return -1;
+    }
+    rt_kprintf("wifi connect success\n");
+    rt_kprintf("Show Wi-Fi information\n");
+    wifi_get_setting(WLAN0_NAME,&setting);
+    wifi_show_setting(WLAN0_NAME,&setting);
+    return 0;
+}
+
+int rthw_wifi_ap_start(char *ssid, char *password, int channel)
+{
+    int mode = 0, timeout = 20;
+    rtw_security_t security_type = RTW_SECURITY_WPA2_AES_PSK;
+    char *name = RT_NULL;
+
+    mode = rthw_wifi_mode_get();
+    if (mode == RTHW_MODE_AP)
+    {
+        name = WLAN0_NAME;
+    }
+    else if (mode == RTHW_MODE_STA_AP)
+    {
+        name = WLAN1_NAME;
+    }
+    else
+    {
+        return -1;
+    }
+
+    if(wext_get_mode(name, &mode) < 0)
+    {
+        rt_kprintf("L:%d wifi get mode err\n", __LINE__);
+        return -1;
+    }
+    if (password == RT_NULL)
+    {
+        security_type = RTW_SECURITY_OPEN;
+    }
+
+    if(wifi_start_ap(ssid, security_type, password, rt_strlen(ssid), rt_strlen(password), 6) != 0)
+    {
+        rt_kprintf("ERROR: wifi_start_ap failed\n");
+        return -1;
+    }
+
+    while(1) 
+    {
+        char essid[33];
+        if(wext_get_ssid(name, (unsigned char *) essid) > 0)
+        {
+            if(strcmp((const char *) essid, (const char *)ssid) == 0) 
+            {
+                rt_kprintf("%s started\n", ssid);
+                break;
+            }
+        }
+        if(timeout == 0) 
+        {
+            rt_kprintf("Start AP timeout\n");   
+            return -1;
+        }
+        rt_thread_delay(1 * RT_TICK_PER_SECOND);
+        timeout --;
+    }
+
+    return 0;
+}
+
+static int rthw_wifi_disconnect(char *name)
+{
+    char essid[33];
+    int timeout = 20;
+    const rt_uint8_t null_bssid[ETH_ALEN + 2] = {0, 0, 0, 0, 0, 1, 0, 0};
+
+    if (name == RT_NULL)
+        return -1;
+
+    if (wext_get_ssid(name, (unsigned char *) essid) < 0) 
+    {
+        rt_kprintf("\nWIFI disconnected!\n");
+        return -1;
+    }
+
+    if (wext_set_bssid(name, null_bssid) < 0)
+    {
+        rt_kprintf("Failed to set bogus BSSID to disconnect");
+        return -1;
+    }
+
+    while (1)
+    {
+        if(wext_get_ssid(name, (unsigned char *) essid) < 0)
+        {
+            rt_kprintf("WIFI disconnected!\n");
+            break;
+        }
+
+        if(timeout == 0) 
+        {
+            rt_kprintf("ERROR: Deassoc timeout!\n");
+            return -1;
+        }
+
+        rt_thread_delay(10);
+        timeout --;
+    }
+    return 0;
+}
+
+int rthw_wifi_sta_disconnect(void)
+{
+    int mode = 0;
+    char *name = RT_NULL;
+
+    mode = rthw_wifi_mode_get();
+    if (mode == RTHW_MODE_STA)
+    {
+        name = WLAN0_NAME;
+    }
+    else if (mode == RTHW_MODE_STA_AP)
+    {
+        name = WLAN0_NAME;
+    }
+    else
+    {
+        return -1;
+    }
+    return rthw_wifi_disconnect(name);
+}
+
+int rthw_wifi_ap_disconnect(void)
+{
+    int mode = 0;
+    char *name = RT_NULL;
+
+    mode = rthw_wifi_mode_get();
+    if (mode == RTHW_MODE_AP)
+    {
+        name = WLAN0_NAME;
+    }
+    else if (mode == RTHW_MODE_STA_AP)
+    {
+        name = WLAN1_NAME;
+    }
+    else
+    {
+        return -1;
+    }
+    return rthw_wifi_disconnect(name);
+}
+
+int rthw_wifi_rssi_get(void)
+{
+    int rssi = 0;   
+    wifi_get_rssi(&rssi);
+    return rssi;
+}
+
+void rthw_wifi_channel_set(int channel)
+{
+    wifi_set_channel(channel);
+}
+
+int rthw_wifi_channel_get(void)
+{
+    int channel;
+    wifi_get_channel(&channel);
+    return channel;
+}
+
+static rtw_result_t rthw_wifi_scan_result_handler( rtw_scan_handler_result_t* malloced_scan_result)
+{
+    struct scan_user_data* user_data = malloced_scan_result->user_data;
+    struct rthw_wlan_info info = { 0 };
+
+    if (malloced_scan_result->scan_complete != RTW_TRUE)
+    {
+        rtw_scan_result_t* record = &malloced_scan_result->ap_details;
+
+        if (user_data->fun != RT_NULL)
+        {
+            record->SSID.val[record->SSID.len] = 0; /* Ensure the SSID is null terminated */
+            info.ssid = record->SSID.val;
+            info.bssid = record->BSSID.octet;
+            info.band = record->band;
+            info.datarate = 0;
+            info.channel = record->channel;
+            info.rssi = record->signal_strength;
+            info.security = record->security;
+            user_data->fun(&info, user_data->data);
+        }
+    }
+    else
+    {
+        user_data->fun(RT_NULL, user_data->data);
+        rt_free(user_data);
+        rt_kprintf("scan ap down\n");
+    }
+
+    return RTW_SUCCESS;
+}
+
+int rthw_wifi_scan(scan_callback_fn fun, void *data)
+{
+    struct scan_user_data *user_data;
+
+    if (fun == RT_NULL)
+    {
+        rt_kprintf("scan callback fun is null\n");
+        return -1;
+    }
+    user_data = rt_malloc(sizeof(struct scan_user_data));
+    if (user_data == RT_NULL)
+    {
+        rt_kprintf("wifi scan malloc fail\n");
+        return -1;
+    }
+    user_data->fun = fun;
+    user_data->data = data;
+
+    if (wifi_scan_networks(rthw_wifi_scan_result_handler, user_data) != RTW_SUCCESS)
+    {
+        rt_kprintf("ERROR: wifi scan failed\n\r");
+        return -1;
+    }
+
+    return 0;
+}
+
+static rthw_wlan_monitor_callback_t monitor_callback;
+
+static void rthw_wifi_promisc_callback(unsigned char *buf, unsigned int len, void* userdata)
+{
+    if (monitor_callback)
+    {
+        monitor_callback(userdata, len, RT_NULL);
+    }
+}
+
+void rthw_wifi_monitor_callback_set(rthw_wlan_monitor_callback_t callback)
+{
+    monitor_callback = callback;
+}
+
+void rthw_wifi_monitor_enable(int enable)
+{
+    if (enable)
+    {
+        wifi_enter_promisc_mode();
+        wifi_set_promisc(RTW_PROMISC_ENABLE, rthw_wifi_promisc_callback, 1);
+        rt_kprintf("%s run \n", __FUNCTION__);
+    }
+    else
+    {
+        wifi_set_promisc(RTW_PROMISC_DISABLE, RT_NULL, 0);
+        rthw_wifi_stop();
+    }
+}

+ 119 - 0
bsp/amebaz/drivers/wlan/drv_wlan.h

@@ -0,0 +1,119 @@
+/*
+ * File      : drv_wlan.h
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2017, RT-Thread Development Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2018-7-10      tyx          the first version
+ */
+
+#ifndef __DRV_WLAN_H__
+#define __DRV_WLAN_H__
+
+typedef enum 
+{
+	RTHW_MODE_NONE = 0,
+	RTHW_MODE_STA,
+	RTHW_MODE_AP,
+	RTHW_MODE_STA_AP,
+	RTHW_MODE_PROMISC,
+	RTHW_MODE_P2P
+}rthw_mode_t;
+
+#define SHARED_ENABLED  0x00008000
+#define WPA_SECURITY    0x00200000
+#define WPA2_SECURITY   0x00400000
+#define WPS_ENABLED     0x10000000
+#define WEP_ENABLED     0x0001
+#define TKIP_ENABLED    0x0002
+#define AES_ENABLED     0x0004
+#define WSEC_SWFLAG     0x0008
+
+typedef enum {
+    RTHW_SECURITY_OPEN           = 0,                                                /**< Open security                           */
+    RTHW_SECURITY_WEP_PSK        = WEP_ENABLED,                                      /**< WEP Security with open authentication   */
+    RTHW_SECURITY_WEP_SHARED     = ( WEP_ENABLED | SHARED_ENABLED ),                 /**< WEP Security with shared authentication */
+    RTHW_SECURITY_WPA_TKIP_PSK   = ( WPA_SECURITY  | TKIP_ENABLED ),                 /**< WPA Security with TKIP                  */
+    RTHW_SECURITY_WPA_AES_PSK    = ( WPA_SECURITY  | AES_ENABLED ),                  /**< WPA Security with AES                   */
+    RTHW_SECURITY_WPA2_AES_PSK   = ( WPA2_SECURITY | AES_ENABLED ),                  /**< WPA2 Security with AES                  */
+    RTHW_SECURITY_WPA2_TKIP_PSK  = ( WPA2_SECURITY | TKIP_ENABLED ),                 /**< WPA2 Security with TKIP                 */
+    RTHW_SECURITY_WPA2_MIXED_PSK = ( WPA2_SECURITY | AES_ENABLED | TKIP_ENABLED ),   /**< WPA2 Security with AES & TKIP           */
+    RTHW_SECURITY_WPA_WPA2_MIXED = ( WPA_SECURITY  | WPA2_SECURITY ),                /**< WPA/WPA2 Security                       */
+
+    RTHW_SECURITY_WPS_OPEN       = WPS_ENABLED,                                      /**< WPS with open security                  */
+    RTHW_SECURITY_WPS_SECURE     = (WPS_ENABLED | AES_ENABLED),                      /**< WPS with AES security                   */
+
+    RTHW_SECURITY_UNKNOWN        = -1,                                               /**< May be returned by scan function if security is unknown. Do not pass this to the join function! */
+
+    RTHW_SECURITY_FORCE_32_BIT   = 0x7fffffff                                        /**< Exists only to force rtw_security_t type to 32 bits */
+} rthw_security_t;
+
+typedef enum {
+    RTHW_WIFI_EVENT_CONNECT = 0,
+    RTHW_WIFI_EVENT_DISCONNECT = 1,
+    RTHW_WIFI_EVENT_FOURWAY_HANDSHAKE_DONE = 2,	
+    RTHW_WIFI_EVENT_SCAN_RESULT_REPORT = 3,
+    RTHW_WIFI_EVENT_SCAN_DONE = 4,
+    RTHW_WIFI_EVENT_RECONNECTION_FAIL = 5,
+    RTHW_WIFI_EVENT_SEND_ACTION_DONE = 6,
+    RTHW_WIFI_EVENT_RX_MGNT = 7,
+    RTHW_WIFI_EVENT_STA_ASSOC = 8,
+    RTHW_WIFI_EVENT_STA_DISASSOC = 9,
+    RTHW_WIFI_EVENT_STA_WPS_START = 10,
+    RTHW_WIFI_EVENT_WPS_FINISH = 11,
+    RTHW_WIFI_EVENT_EAPOL_START = 12,
+    RTHW_WIFI_EVENT_EAPOL_RECVD = 13,
+    RTHW_WIFI_EVENT_NO_NETWORK = 14,
+    RTHW_WIFI_EVENT_BEACON_AFTER_DHCP = 15,
+    RTHW_WIFI_EVENT_MAX,
+}rthw_event_indicate_t;
+
+typedef enum {
+    RTHW_802_11_BAND_5GHZ   = 0, /**< Denotes 5GHz radio band   */
+    RTHW_802_11_BAND_2_4GHZ = 1  /**< Denotes 2.4GHz radio band */
+} rthw_802_11_band_t;
+
+struct rthw_wlan_info
+{
+    char *ssid;
+    rt_uint8_t *bssid;
+    rthw_802_11_band_t band;
+    rt_uint32_t datarate;
+    rt_uint16_t channel;
+    rt_int16_t  rssi;
+    rthw_security_t security;
+};
+
+typedef void (*scan_callback_fn)(struct rthw_wlan_info *info, void *user_data);
+typedef void (*rthw_wlan_monitor_callback_t)(rt_uint8_t *data, int len, void *user_data);
+
+rthw_mode_t rthw_wifi_mode_get(void);
+int rthw_wifi_stop(void);
+int rthw_wifi_start(rthw_mode_t mode);
+int rthw_wifi_connect(char *ssid, int ssid_len, char *password, int pass_len, rthw_security_t security_type);
+int rthw_wifi_connect_bssid(char *bssid, char *ssid, int ssid_len, char *password, int pass_len, rthw_security_t security_type);
+int rthw_wifi_ap_start(char *ssid, char *password, int channel);
+int rthw_wifi_rssi_get(void);
+void rthw_wifi_channel_set(int channel);
+int rthw_wifi_channel_get(void);
+int rthw_wifi_sta_disconnect(void);
+int rthw_wifi_ap_disconnect(void);
+int rthw_wifi_scan(scan_callback_fn fun, void *data);
+void rthw_wifi_monitor_enable(int enable);
+void rthw_wifi_monitor_callback_set(rthw_wlan_monitor_callback_t callback);
+#endif

BIN
bsp/amebaz/figures/iar_build.png


BIN
bsp/amebaz/figures/iar_download.png


BIN
bsp/amebaz/figures/image-tool_v2.2.0.png


+ 7 - 0
bsp/amebaz/libraries/Kconfig

@@ -0,0 +1,7 @@
+menu "External Libraries"
+
+    config RT_USING_SMARTCONFIG_LIB
+        bool "Using RT-Thrad SmartConfig Library"
+        default n
+
+endmenu

+ 12 - 0
bsp/amebaz/libraries/SConscript

@@ -0,0 +1,12 @@
+import os
+from building import *
+
+objs = []
+cwd  = GetCurrentDir()
+list = os.listdir(cwd)
+
+for item in list:
+    if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
+        objs = objs + SConscript(os.path.join(item, 'SConscript'))
+
+Return('objs')

+ 18 - 0
bsp/amebaz/libraries/smartconfig/SConscript

@@ -0,0 +1,18 @@
+Import('rtconfig')
+from building import *
+
+cwd = GetCurrentDir()
+src = []
+path = [cwd + '/inc']
+libs = ['']
+libpath = [cwd + '/libs']
+
+if rtconfig.CROSS_TOOL == 'gcc':
+    libs += ['libsmartconfig_armcm4_gcc']
+elif rtconfig.CROSS_TOOL == 'iar':
+    libs += ['libsmartconfig_armcm4_iar']
+
+group = DefineGroup('smartconfig', src, depend = ['RT_USING_SMARTCONFIG_LIB'], CPPPATH = path, LIBS = libs, LIBPATH = libpath)
+
+Return('group')
+

+ 62 - 0
bsp/amebaz/libraries/smartconfig/inc/smartconfig.h

@@ -0,0 +1,62 @@
+/*
+ * File      : smartconfig.h
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2018-09-13     Bernard      the first version
+ */
+#ifndef __SMARTCONFIG_H__
+#define __SMARTCONFIG_H__
+
+#define SMARTCONFIG_EVENT_CHANGE_CHANNEL    (1 << 0)
+#define SMARTCONFIG_EVENT_LOCKED_CHANNEL    (1 << 1)
+#define SMARTCONFIG_EVENT_COMPLETE          (1 << 2)
+#define SMARTCONFIG_EVENT_RESTART           (1 << 3)
+#define SMARTCONFIG_EVENT_STOP              (1 << 4)
+
+typedef enum
+{
+    SMARTCONFIG_TYPE_AIRKISS = 0,
+    SMARTCONFIG_TYPE_JDSMART = 1,
+    SMARTCONFIG_TYPE_ESPTOUCH,
+    SMARTCONFIG_TYPE_REALTOUCH,
+    SMARTCONFIG_TYPE_ALL,
+    SMARTCONFIG_TYPE_MAX,
+} rt_smartconfig_type;
+
+typedef enum
+{
+    SMARTCONFIG_ENCRYPT_NONE,
+    SMARTCONFIG_ENCRYPT_AES,
+} rt_smartconfig_encrypt_type;
+
+typedef int (*rt_smartconfig_result_cb)(rt_smartconfig_type result_type, char *ssid, char *passwd, \
+                                        void *userdata, rt_uint8_t userdata_len);
+typedef void (*rt_smartconfig_event_handle)(rt_uint32_t event, void *userdata);
+
+int rt_smartconfig_start(rt_smartconfig_type config_type, rt_smartconfig_encrypt_type encrypt_type, char *encrypt, \
+                         rt_smartconfig_result_cb result_cb);
+
+int rt_smartconfig_stop(void);
+
+void rt_smartconfig_set_event_handle(rt_smartconfig_event_handle handle, void *userdata);
+
+char *rt_smartconfig_version(void);
+
+#endif

BIN
bsp/amebaz/libraries/smartconfig/libs/libsmartconfig_armcm4_gcc.a


BIN
bsp/amebaz/libraries/smartconfig/libs/libsmartconfig_armcm4_iar.a


+ 2697 - 0
bsp/amebaz/project.ewd

@@ -0,0 +1,2697 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<project>
+  <fileVersion>2</fileVersion>
+  <configuration>
+    <name>Debug</name>
+    <toolchain>
+      <name>ARM</name>
+    </toolchain>
+    <debug>1</debug>
+    <settings>
+      <name>C-SPY</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>26</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>1</debug>
+        <option>
+          <name>CInput</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CEndian</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CProcessor</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCVariant</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>MacOverride</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>MacFile</name>
+          <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\misc\iar_utility\common\preload.mac</state>
+        </option>
+        <option>
+          <name>MemOverride</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>MemFile</name>
+          <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\misc\iar_utility\common\preload.mac</state>
+        </option>
+        <option>
+          <name>RunToEnable</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>RunToName</name>
+          <state>main</state>
+        </option>
+        <option>
+          <name>CExtraOptionsCheck</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CExtraOptions</name>
+          <state></state>
+        </option>
+        <option>
+          <name>CFpuProcessor</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCDDFArgumentProducer</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCDownloadSuppressDownload</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCDownloadVerifyAll</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCProductVersion</name>
+          <state>7.30.4.8186</state>
+        </option>
+        <option>
+          <name>OCDynDriverList</name>
+          <state>JLINK_ID</state>
+        </option>
+        <option>
+          <name>OCLastSavedByProductVersion</name>
+          <state>7.20.2.7418</state>
+        </option>
+        <option>
+          <name>OCDownloadAttachToProgram</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>UseFlashLoader</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CLowLevel</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCBE8Slave</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>MacFile2</name>
+          <state></state>
+        </option>
+        <option>
+          <name>CDevice</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>FlashLoadersV3</name>
+          <state>$PROJ_DIR$\tmp.board</state>
+        </option>
+        <option>
+          <name>OCImagesSuppressCheck1</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCImagesPath1</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCImagesSuppressCheck2</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCImagesPath2</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCImagesSuppressCheck3</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCImagesPath3</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OverrideDefFlashBoard</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCImagesOffset1</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCImagesOffset2</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCImagesOffset3</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCImagesUse1</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCImagesUse2</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCImagesUse3</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCDeviceConfigMacroFile</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCDebuggerExtraOption</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCAllMTBOptions</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCMulticoreNrOfCores</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCMulticoreMaster</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCMulticorePort</name>
+          <state>53461</state>
+        </option>
+        <option>
+          <name>OCMulticoreWorkspace</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCMulticoreSlaveProject</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCMulticoreSlaveConfiguration</name>
+          <state></state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>ARMSIM_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>1</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>1</debug>
+        <option>
+          <name>OCSimDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCSimEnablePSP</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCSimPspOverrideConfig</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCSimPspConfigFile</name>
+          <state></state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>ANGEL_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>0</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>1</debug>
+        <option>
+          <name>CCAngelHeartbeat</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CAngelCommunication</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CAngelCommBaud</name>
+          <version>0</version>
+          <state>3</state>
+        </option>
+        <option>
+          <name>CAngelCommPort</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>ANGELTCPIP</name>
+          <state>aaa.bbb.ccc.ddd</state>
+        </option>
+        <option>
+          <name>DoAngelLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>AngelLogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>CMSISDAP_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>2</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>1</debug>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CMSISDAPAttachSlave</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCIarProbeScriptFile</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CMSISDAPResetList</name>
+          <version>1</version>
+          <state>10</state>
+        </option>
+        <option>
+          <name>CMSISDAPHWResetDuration</name>
+          <state>300</state>
+        </option>
+        <option>
+          <name>CMSISDAPHWResetDelay</name>
+          <state>200</state>
+        </option>
+        <option>
+          <name>CMSISDAPDoLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPLogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>CMSISDAPInterfaceRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPInterfaceCmdLine</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPMultiTargetEnable</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPMultiTarget</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPJtagSpeedList</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPBreakpointRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPRestoreBreakpointsCheck</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPUpdateBreakpointsEdit</name>
+          <state>_call_main</state>
+        </option>
+        <option>
+          <name>RDICatchReset</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>RDICatchUndef</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>RDICatchSWI</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>RDICatchData</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>RDICatchPrefetch</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>RDICatchIRQ</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>RDICatchFIQ</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CatchCORERESET</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CatchMMERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchNOCPERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchCHKERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchSTATERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchBUSERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchINTERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchHARDERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchDummy</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPMultiCPUEnable</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPMultiCPUNumber</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCProbeCfgOverride</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCProbeConfig</name>
+          <state></state>
+        </option>
+        <option>
+          <name>CMSISDAPProbeConfigRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPSelectedCPUBehaviour</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>ICpuName</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCJetEmuParams</name>
+          <state>1</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>GDBSERVER_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>0</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>1</debug>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>TCPIP</name>
+          <state>aaa.bbb.ccc.ddd</state>
+        </option>
+        <option>
+          <name>DoLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>LogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>CCJTagBreakpointRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJTagDoUpdateBreakpoints</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJTagUpdateBreakpoints</name>
+          <state>_call_main</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>IARROM_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>1</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>1</debug>
+        <option>
+          <name>CRomLogFileCheck</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CRomLogFileEditB</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>CRomCommPort</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CRomCommBaud</name>
+          <version>0</version>
+          <state>7</state>
+        </option>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>IJET_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>3</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>1</debug>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>IjetAttachSlave</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCIarProbeScriptFile</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>IjetResetList</name>
+          <version>1</version>
+          <state>10</state>
+        </option>
+        <option>
+          <name>IjetHWResetDuration</name>
+          <state>300</state>
+        </option>
+        <option>
+          <name>IjetHWResetDelay</name>
+          <state>200</state>
+        </option>
+        <option>
+          <name>IjetPowerFromProbe</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>IjetPowerRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetDoLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetLogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>IjetInterfaceRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetInterfaceCmdLine</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetMultiTargetEnable</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetMultiTarget</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetScanChainNonARMDevices</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetIRLength</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetJtagSpeedList</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetProtocolRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetSwoPin</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetCpuClockEdit</name>
+          <state>72.0</state>
+        </option>
+        <option>
+          <name>IjetSwoPrescalerList</name>
+          <version>1</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetBreakpointRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetRestoreBreakpointsCheck</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetUpdateBreakpointsEdit</name>
+          <state>_call_main</state>
+        </option>
+        <option>
+          <name>RDICatchReset</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>RDICatchUndef</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>RDICatchSWI</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>RDICatchData</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>RDICatchPrefetch</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>RDICatchIRQ</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>RDICatchFIQ</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CatchCORERESET</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CatchMMERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchNOCPERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchCHKERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchSTATERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchBUSERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchINTERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchHARDERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchDummy</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCProbeCfgOverride</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCProbeConfig</name>
+          <state></state>
+        </option>
+        <option>
+          <name>IjetProbeConfigRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetMultiCPUEnable</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetMultiCPUNumber</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetSelectedCPUBehaviour</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>ICpuName</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCJetEmuParams</name>
+          <state>1</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>JLINK_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>15</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>1</debug>
+        <option>
+          <name>JLinkSpeed</name>
+          <state>1000</state>
+        </option>
+        <option>
+          <name>CCJLinkDoLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkLogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>CCJLinkHWResetDelay</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>JLinkInitialSpeed</name>
+          <state>1000</state>
+        </option>
+        <option>
+          <name>CCDoJlinkMultiTarget</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCScanChainNonARMDevices</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkMultiTarget</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkIRLength</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkCommRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkTCPIP</name>
+          <state>aaa.bbb.ccc.ddd</state>
+        </option>
+        <option>
+          <name>CCJLinkSpeedRadioV2</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCUSBDevice</name>
+          <version>1</version>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CCRDICatchReset</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchUndef</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchSWI</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchData</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchPrefetch</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchIRQ</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchFIQ</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkBreakpointRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkDoUpdateBreakpoints</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkUpdateBreakpoints</name>
+          <state>_call_main</state>
+        </option>
+        <option>
+          <name>CCJLinkInterfaceRadio</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCJLinkAttachSlave</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CCJLinkResetList</name>
+          <version>6</version>
+          <state>7</state>
+        </option>
+        <option>
+          <name>CCJLinkInterfaceCmdLine</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchCORERESET</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchMMERR</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchNOCPERR</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchCHRERR</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchSTATERR</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchBUSERR</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchINTERR</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchHARDERR</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchDummy</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCJLinkScriptFile</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CCJLinkUsbSerialNo</name>
+          <state></state>
+        </option>
+        <option>
+          <name>CCTcpIpAlt</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkTcpIpSerialNo</name>
+          <state></state>
+        </option>
+        <option>
+          <name>CCCpuClockEdit</name>
+          <state>72.0</state>
+        </option>
+        <option>
+          <name>CCSwoClockAuto</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCSwoClockEdit</name>
+          <state>2000</state>
+        </option>
+        <option>
+          <name>OCJLinkTraceSource</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCJLinkTraceSourceDummy</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCJLinkDeviceName</name>
+          <state>1</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>LMIFTDI_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>2</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>1</debug>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>LmiftdiSpeed</name>
+          <state>500</state>
+        </option>
+        <option>
+          <name>CCLmiftdiDoLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCLmiftdiLogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>CCLmiFtdiInterfaceRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCLmiFtdiInterfaceCmdLine</name>
+          <state>0</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>MACRAIGOR_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>3</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>1</debug>
+        <option>
+          <name>jtag</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>EmuSpeed</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>TCPIP</name>
+          <state>aaa.bbb.ccc.ddd</state>
+        </option>
+        <option>
+          <name>DoLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>LogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>DoEmuMultiTarget</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>EmuMultiTarget</name>
+          <state>0@ARM7TDMI</state>
+        </option>
+        <option>
+          <name>EmuHWReset</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CEmuCommBaud</name>
+          <version>0</version>
+          <state>4</state>
+        </option>
+        <option>
+          <name>CEmuCommPort</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>jtago</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>UnusedAddr</name>
+          <state>0x00800000</state>
+        </option>
+        <option>
+          <name>CCMacraigorHWResetDelay</name>
+          <state></state>
+        </option>
+        <option>
+          <name>CCJTagBreakpointRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJTagDoUpdateBreakpoints</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJTagUpdateBreakpoints</name>
+          <state>_call_main</state>
+        </option>
+        <option>
+          <name>CCMacraigorInterfaceRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCMacraigorInterfaceCmdLine</name>
+          <state>0</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>PEMICRO_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>1</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>1</debug>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCPEMicroAttachSlave</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CCPEMicroInterfaceList</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCPEMicroResetDelay</name>
+          <state></state>
+        </option>
+        <option>
+          <name>CCPEMicroJtagSpeed</name>
+          <state>#UNINITIALIZED#</state>
+        </option>
+        <option>
+          <name>CCJPEMicroShowSettings</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>DoLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>LogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>CCPEMicroUSBDevice</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCPEMicroSerialPort</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJPEMicroTCPIPAutoScanNetwork</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CCPEMicroTCPIP</name>
+          <state>10.0.0.1</state>
+        </option>
+        <option>
+          <name>CCPEMicroCommCmdLineProducer</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCSTLinkInterfaceRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCSTLinkInterfaceCmdLine</name>
+          <state>0</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>RDI_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>2</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>1</debug>
+        <option>
+          <name>CRDIDriverDll</name>
+          <state>###Uninitialized###</state>
+        </option>
+        <option>
+          <name>CRDILogFileCheck</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CRDILogFileEdit</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>CCRDIHWReset</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchReset</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchUndef</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchSWI</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchData</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchPrefetch</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchIRQ</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchFIQ</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>STLINK_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>2</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>1</debug>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CCSTLinkInterfaceRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCSTLinkInterfaceCmdLine</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCSTLinkResetList</name>
+          <version>1</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCpuClockEdit</name>
+          <state>72.0</state>
+        </option>
+        <option>
+          <name>CCSwoClockAuto</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCSwoClockEdit</name>
+          <state>2000</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>THIRDPARTY_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>0</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>1</debug>
+        <option>
+          <name>CThirdPartyDriverDll</name>
+          <state>###Uninitialized###</state>
+        </option>
+        <option>
+          <name>CThirdPartyLogFileCheck</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CThirdPartyLogFileEditB</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>XDS100_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>2</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>1</debug>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCXDS100AttachSlave</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>TIPackageOverride</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>TIPackage</name>
+          <state></state>
+        </option>
+        <option>
+          <name>CCXds100InterfaceList</name>
+          <version>2</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>BoardFile</name>
+          <state></state>
+        </option>
+        <option>
+          <name>DoLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>LogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+      </data>
+    </settings>
+    <debuggerPlugins>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin</file>
+        <loadFlag>1</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin</file>
+        <loadFlag>1</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+    </debuggerPlugins>
+  </configuration>
+  <configuration>
+    <name>Release</name>
+    <toolchain>
+      <name>ARM</name>
+    </toolchain>
+    <debug>0</debug>
+    <settings>
+      <name>C-SPY</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>26</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>0</debug>
+        <option>
+          <name>CInput</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CEndian</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CProcessor</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCVariant</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>MacOverride</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>MacFile</name>
+          <state></state>
+        </option>
+        <option>
+          <name>MemOverride</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>MemFile</name>
+          <state></state>
+        </option>
+        <option>
+          <name>RunToEnable</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>RunToName</name>
+          <state>main</state>
+        </option>
+        <option>
+          <name>CExtraOptionsCheck</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CExtraOptions</name>
+          <state></state>
+        </option>
+        <option>
+          <name>CFpuProcessor</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCDDFArgumentProducer</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCDownloadSuppressDownload</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCDownloadVerifyAll</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCProductVersion</name>
+          <state>7.30.4.8186</state>
+        </option>
+        <option>
+          <name>OCDynDriverList</name>
+          <state>ARMSIM_ID</state>
+        </option>
+        <option>
+          <name>OCLastSavedByProductVersion</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCDownloadAttachToProgram</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>UseFlashLoader</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CLowLevel</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCBE8Slave</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>MacFile2</name>
+          <state></state>
+        </option>
+        <option>
+          <name>CDevice</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>FlashLoadersV3</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCImagesSuppressCheck1</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCImagesPath1</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCImagesSuppressCheck2</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCImagesPath2</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCImagesSuppressCheck3</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCImagesPath3</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OverrideDefFlashBoard</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCImagesOffset1</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCImagesOffset2</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCImagesOffset3</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCImagesUse1</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCImagesUse2</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCImagesUse3</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCDeviceConfigMacroFile</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCDebuggerExtraOption</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCAllMTBOptions</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCMulticoreNrOfCores</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCMulticoreMaster</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCMulticorePort</name>
+          <state>53461</state>
+        </option>
+        <option>
+          <name>OCMulticoreWorkspace</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCMulticoreSlaveProject</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCMulticoreSlaveConfiguration</name>
+          <state></state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>ARMSIM_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>1</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>0</debug>
+        <option>
+          <name>OCSimDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCSimEnablePSP</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCSimPspOverrideConfig</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCSimPspConfigFile</name>
+          <state></state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>ANGEL_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>0</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>0</debug>
+        <option>
+          <name>CCAngelHeartbeat</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CAngelCommunication</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CAngelCommBaud</name>
+          <version>0</version>
+          <state>3</state>
+        </option>
+        <option>
+          <name>CAngelCommPort</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>ANGELTCPIP</name>
+          <state>aaa.bbb.ccc.ddd</state>
+        </option>
+        <option>
+          <name>DoAngelLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>AngelLogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>CMSISDAP_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>2</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>0</debug>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CMSISDAPAttachSlave</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCIarProbeScriptFile</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CMSISDAPResetList</name>
+          <version>1</version>
+          <state>10</state>
+        </option>
+        <option>
+          <name>CMSISDAPHWResetDuration</name>
+          <state>300</state>
+        </option>
+        <option>
+          <name>CMSISDAPHWResetDelay</name>
+          <state>200</state>
+        </option>
+        <option>
+          <name>CMSISDAPDoLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPLogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>CMSISDAPInterfaceRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPInterfaceCmdLine</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPMultiTargetEnable</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPMultiTarget</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPJtagSpeedList</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPBreakpointRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPRestoreBreakpointsCheck</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPUpdateBreakpointsEdit</name>
+          <state>_call_main</state>
+        </option>
+        <option>
+          <name>RDICatchReset</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>RDICatchUndef</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>RDICatchSWI</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>RDICatchData</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>RDICatchPrefetch</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>RDICatchIRQ</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>RDICatchFIQ</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CatchCORERESET</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CatchMMERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchNOCPERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchCHKERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchSTATERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchBUSERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchINTERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchHARDERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchDummy</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPMultiCPUEnable</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPMultiCPUNumber</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCProbeCfgOverride</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCProbeConfig</name>
+          <state></state>
+        </option>
+        <option>
+          <name>CMSISDAPProbeConfigRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CMSISDAPSelectedCPUBehaviour</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>ICpuName</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCJetEmuParams</name>
+          <state>1</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>GDBSERVER_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>0</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>0</debug>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>TCPIP</name>
+          <state>aaa.bbb.ccc.ddd</state>
+        </option>
+        <option>
+          <name>DoLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>LogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>CCJTagBreakpointRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJTagDoUpdateBreakpoints</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJTagUpdateBreakpoints</name>
+          <state>_call_main</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>IARROM_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>1</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>0</debug>
+        <option>
+          <name>CRomLogFileCheck</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CRomLogFileEditB</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>CRomCommPort</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CRomCommBaud</name>
+          <version>0</version>
+          <state>7</state>
+        </option>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>IJET_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>3</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>0</debug>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>IjetAttachSlave</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCIarProbeScriptFile</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>IjetResetList</name>
+          <version>1</version>
+          <state>10</state>
+        </option>
+        <option>
+          <name>IjetHWResetDuration</name>
+          <state>300</state>
+        </option>
+        <option>
+          <name>IjetHWResetDelay</name>
+          <state>200</state>
+        </option>
+        <option>
+          <name>IjetPowerFromProbe</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>IjetPowerRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetDoLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetLogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>IjetInterfaceRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetInterfaceCmdLine</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetMultiTargetEnable</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetMultiTarget</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetScanChainNonARMDevices</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetIRLength</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetJtagSpeedList</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetProtocolRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetSwoPin</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetCpuClockEdit</name>
+          <state>72.0</state>
+        </option>
+        <option>
+          <name>IjetSwoPrescalerList</name>
+          <version>1</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetBreakpointRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetRestoreBreakpointsCheck</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetUpdateBreakpointsEdit</name>
+          <state>_call_main</state>
+        </option>
+        <option>
+          <name>RDICatchReset</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>RDICatchUndef</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>RDICatchSWI</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>RDICatchData</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>RDICatchPrefetch</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>RDICatchIRQ</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>RDICatchFIQ</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CatchCORERESET</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CatchMMERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchNOCPERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchCHKERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchSTATERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchBUSERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchINTERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchHARDERR</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CatchDummy</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCProbeCfgOverride</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCProbeConfig</name>
+          <state></state>
+        </option>
+        <option>
+          <name>IjetProbeConfigRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetMultiCPUEnable</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetMultiCPUNumber</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>IjetSelectedCPUBehaviour</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>ICpuName</name>
+          <state></state>
+        </option>
+        <option>
+          <name>OCJetEmuParams</name>
+          <state>1</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>JLINK_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>15</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>0</debug>
+        <option>
+          <name>JLinkSpeed</name>
+          <state>1000</state>
+        </option>
+        <option>
+          <name>CCJLinkDoLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkLogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>CCJLinkHWResetDelay</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>JLinkInitialSpeed</name>
+          <state>1000</state>
+        </option>
+        <option>
+          <name>CCDoJlinkMultiTarget</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCScanChainNonARMDevices</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkMultiTarget</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkIRLength</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkCommRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkTCPIP</name>
+          <state>aaa.bbb.ccc.ddd</state>
+        </option>
+        <option>
+          <name>CCJLinkSpeedRadioV2</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCUSBDevice</name>
+          <version>1</version>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CCRDICatchReset</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchUndef</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchSWI</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchData</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchPrefetch</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchIRQ</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchFIQ</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkBreakpointRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkDoUpdateBreakpoints</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkUpdateBreakpoints</name>
+          <state>_call_main</state>
+        </option>
+        <option>
+          <name>CCJLinkInterfaceRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCJLinkAttachSlave</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CCJLinkResetList</name>
+          <version>6</version>
+          <state>5</state>
+        </option>
+        <option>
+          <name>CCJLinkInterfaceCmdLine</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchCORERESET</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchMMERR</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchNOCPERR</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchCHRERR</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchSTATERR</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchBUSERR</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchINTERR</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchHARDERR</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCatchDummy</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCJLinkScriptFile</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CCJLinkUsbSerialNo</name>
+          <state></state>
+        </option>
+        <option>
+          <name>CCTcpIpAlt</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJLinkTcpIpSerialNo</name>
+          <state></state>
+        </option>
+        <option>
+          <name>CCCpuClockEdit</name>
+          <state>72.0</state>
+        </option>
+        <option>
+          <name>CCSwoClockAuto</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCSwoClockEdit</name>
+          <state>2000</state>
+        </option>
+        <option>
+          <name>OCJLinkTraceSource</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCJLinkTraceSourceDummy</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCJLinkDeviceName</name>
+          <state>1</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>LMIFTDI_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>2</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>0</debug>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>LmiftdiSpeed</name>
+          <state>500</state>
+        </option>
+        <option>
+          <name>CCLmiftdiDoLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCLmiftdiLogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>CCLmiFtdiInterfaceRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCLmiFtdiInterfaceCmdLine</name>
+          <state>0</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>MACRAIGOR_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>3</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>0</debug>
+        <option>
+          <name>jtag</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>EmuSpeed</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>TCPIP</name>
+          <state>aaa.bbb.ccc.ddd</state>
+        </option>
+        <option>
+          <name>DoLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>LogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>DoEmuMultiTarget</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>EmuMultiTarget</name>
+          <state>0@ARM7TDMI</state>
+        </option>
+        <option>
+          <name>EmuHWReset</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CEmuCommBaud</name>
+          <version>0</version>
+          <state>4</state>
+        </option>
+        <option>
+          <name>CEmuCommPort</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>jtago</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>UnusedAddr</name>
+          <state>0x00800000</state>
+        </option>
+        <option>
+          <name>CCMacraigorHWResetDelay</name>
+          <state></state>
+        </option>
+        <option>
+          <name>CCJTagBreakpointRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJTagDoUpdateBreakpoints</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJTagUpdateBreakpoints</name>
+          <state>_call_main</state>
+        </option>
+        <option>
+          <name>CCMacraigorInterfaceRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCMacraigorInterfaceCmdLine</name>
+          <state>0</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>PEMICRO_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>1</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>0</debug>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCPEMicroAttachSlave</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CCPEMicroInterfaceList</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCPEMicroResetDelay</name>
+          <state></state>
+        </option>
+        <option>
+          <name>CCPEMicroJtagSpeed</name>
+          <state>#UNINITIALIZED#</state>
+        </option>
+        <option>
+          <name>CCJPEMicroShowSettings</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>DoLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>LogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>CCPEMicroUSBDevice</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCPEMicroSerialPort</name>
+          <version>0</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCJPEMicroTCPIPAutoScanNetwork</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CCPEMicroTCPIP</name>
+          <state>10.0.0.1</state>
+        </option>
+        <option>
+          <name>CCPEMicroCommCmdLineProducer</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCSTLinkInterfaceRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCSTLinkInterfaceCmdLine</name>
+          <state>0</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>RDI_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>2</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>0</debug>
+        <option>
+          <name>CRDIDriverDll</name>
+          <state>###Uninitialized###</state>
+        </option>
+        <option>
+          <name>CRDILogFileCheck</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CRDILogFileEdit</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>CCRDIHWReset</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchReset</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchUndef</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchSWI</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchData</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchPrefetch</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchIRQ</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCRDICatchFIQ</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>STLINK_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>2</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>0</debug>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>CCSTLinkInterfaceRadio</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCSTLinkInterfaceCmdLine</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCSTLinkResetList</name>
+          <version>1</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCCpuClockEdit</name>
+          <state>72.0</state>
+        </option>
+        <option>
+          <name>CCSwoClockAuto</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CCSwoClockEdit</name>
+          <state>2000</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>THIRDPARTY_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>0</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>0</debug>
+        <option>
+          <name>CThirdPartyDriverDll</name>
+          <state>###Uninitialized###</state>
+        </option>
+        <option>
+          <name>CThirdPartyLogFileCheck</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>CThirdPartyLogFileEditB</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+      </data>
+    </settings>
+    <settings>
+      <name>XDS100_ID</name>
+      <archiveVersion>2</archiveVersion>
+      <data>
+        <version>2</version>
+        <wantNonLocal>1</wantNonLocal>
+        <debug>0</debug>
+        <option>
+          <name>OCDriverInfo</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>OCXDS100AttachSlave</name>
+          <state>1</state>
+        </option>
+        <option>
+          <name>TIPackageOverride</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>TIPackage</name>
+          <state></state>
+        </option>
+        <option>
+          <name>CCXds100InterfaceList</name>
+          <version>2</version>
+          <state>0</state>
+        </option>
+        <option>
+          <name>BoardFile</name>
+          <state></state>
+        </option>
+        <option>
+          <name>DoLogfile</name>
+          <state>0</state>
+        </option>
+        <option>
+          <name>LogFile</name>
+          <state>$PROJ_DIR$\cspycomm.log</state>
+        </option>
+      </data>
+    </settings>
+    <debuggerPlugins>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin</file>
+        <loadFlag>1</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin</file>
+        <loadFlag>1</loadFlag>
+      </plugin>
+      <plugin>
+        <file>$EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin</file>
+        <loadFlag>0</loadFlag>
+      </plugin>
+    </debuggerPlugins>
+  </configuration>
+</project>
+
+

+ 153 - 185
bsp/amebaz/project.ewp

@@ -10,7 +10,7 @@
       <name>General</name>
       <archiveVersion>3</archiveVersion>
       <data>
-        <version>24</version>
+        <version>22</version>
         <wantNonLocal>1</wantNonLocal>
         <debug>1</debug>
         <option>
@@ -25,6 +25,11 @@
           <name>ListPath</name>
           <state>Debug\List</state>
         </option>
+        <option>
+          <name>Variant</name>
+          <version>21</version>
+          <state>39</state>
+        </option>
         <option>
           <name>GEndianMode</name>
           <state>0</state>
@@ -32,25 +37,30 @@
         <option>
           <name>Input variant</name>
           <version>3</version>
-          <state>7</state>
+          <state>0</state>
         </option>
         <option>
           <name>Input description</name>
-          <state>No specifier n, no float nor long long, no scan set, no assignment suppressing, without multibyte support.</state>
+          <state>Automatic choice of formatter.</state>
         </option>
         <option>
           <name>Output variant</name>
           <version>2</version>
-          <state>7</state>
+          <state>0</state>
         </option>
         <option>
           <name>Output description</name>
-          <state>No specifier a, A, no specifier n, no float nor long long, no flags.</state>
+          <state>Automatic choice of formatter.</state>
         </option>
         <option>
           <name>GOutputBinary</name>
           <state>0</state>
         </option>
+        <option>
+          <name>FPU</name>
+          <version>3</version>
+          <state>5</state>
+        </option>
         <option>
           <name>OGCoreOrChip</name>
           <state>0</state>
@@ -71,11 +81,11 @@
         </option>
         <option>
           <name>OGProductVersion</name>
-          <state>6.10.1.52170</state>
+          <state>7.30.4.8186</state>
         </option>
         <option>
           <name>OGLastSavedByProductVersion</name>
-          <state>7.40.3.8937</state>
+          <state>7.30.4.8186</state>
         </option>
         <option>
           <name>GeneralEnableMisra</name>
@@ -87,11 +97,11 @@
         </option>
         <option>
           <name>OGChipSelectEditMenu</name>
-          <state>STM32F107xC	ST STM32F107xC</state>
+          <state>Default	None</state>
         </option>
         <option>
           <name>GenLowLevelInterface</name>
-          <state>0</state>
+          <state>1</state>
         </option>
         <option>
           <name>GEndianModeBE</name>
@@ -123,9 +133,14 @@
           <name>RTConfigPath2</name>
           <state>$TOOLKIT_DIR$\INC\c\DLib_Config_Normal.h</state>
         </option>
+        <option>
+          <name>GFPUCoreSlave</name>
+          <version>21</version>
+          <state>39</state>
+        </option>
         <option>
           <name>GBECoreSlave</name>
-          <version>22</version>
+          <version>21</version>
           <state>39</state>
         </option>
         <option>
@@ -140,34 +155,6 @@
           <name>GRuntimeLibThreads</name>
           <state>0</state>
         </option>
-        <option>
-          <name>CoreVariant</name>
-          <version>22</version>
-          <state>39</state>
-        </option>
-        <option>
-          <name>GFPUDeviceSlave</name>
-          <state>STM32F107xC	ST STM32F107xC</state>
-        </option>
-        <option>
-          <name>FPU2</name>
-          <version>0</version>
-          <state>4</state>
-        </option>
-        <option>
-          <name>NrRegs</name>
-          <version>0</version>
-          <state>1</state>
-        </option>
-        <option>
-          <name>NEON</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GFPUCoreSlave2</name>
-          <version>22</version>
-          <state>39</state>
-        </option>
       </data>
     </settings>
     <settings>
@@ -181,6 +168,14 @@
           <name>CCDefines</name>
           <state />
           <state>CONFIG_PLATFORM_8711B</state>
+          <state>CONFIG_BUILD_ROM</state>
+          <state>PLATFORM_RTTHREAD</state>
+          <state>__IEEE_LITTLE_ENDIAN</state>
+          <state>RT_USING_DLIBC</state>
+          <state>_DLIB_FILE_DESCRIPTOR</state>
+          <state>_DLIB_THREAD_SUPPORT</state>
+          <state>CONFIG_PLATFORM_8711B</state>
+          <state>PLATFORM_RTTHREAD</state>
           <state>__IEEE_LITTLE_ENDIAN</state>
           <state>RT_USING_DLIBC</state>
         </option>
@@ -312,39 +307,39 @@
         <option>
           <name>CCIncludePath2</name>
           <state />
-          <state>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\api</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\drivers\wlan\realtek\wlan_ram_map\rom</state>
-          <state>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\include\lwip</state>
           <state>$PROJ_DIR$\..\..\components\libc\compilers\dlib</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\misc</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\api\platform</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\rtthread_patch</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\rtthread_patch\realtek\8711b\include</state>
           <state>$PROJ_DIR$\..\..\include</state>
+          <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include\netif</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\app\monitor\include</state>
           <state>$PROJ_DIR$\..\..\libcpu\arm\common</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\os\os_dep\include</state>
           <state>$PROJ_DIR$\..\..\components\drivers\include</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\os\freertos\freertos_v8.1.2\Source\include</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\api\wifi\rtw_wpa_supplicant\src</state>
+          <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src</state>
           <state>$PROJ_DIR$\drivers</state>
-          <state>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\include\netif</state>
+          <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include\ipv4</state>
           <state>$PROJ_DIR$\..\..\libcpu\arm\cortex-m4</state>
           <state>$PROJ_DIR$\.</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\drivers\wlan\realtek\include</state>
-          <state>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\include</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\cmsis\device</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\swlib\std_lib\libc\rom\string</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\mbed\hal</state>
+          <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\mbed\hal_ext</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc</state>
+          <state>$PROJ_DIR$\..\..\components\net\lwip_dhcpd</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\os\freertos</state>
           <state>$PROJ_DIR$\applications</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\network\ssl\polarssl-1.3.8\include</state>
           <state>$PROJ_DIR$\drivers\wlan</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\os\freertos\freertos_v8.1.2\Source\portable\IAR\ARM_CM4F</state>
-          <state>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\include\ipv4</state>
           <state>$PROJ_DIR$\..\..\components\finsh</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\cmsis</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\swlib\rtl_lib</state>
@@ -354,10 +349,12 @@
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\drivers\wlan\realtek\src\osdep</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\network\ssl\ssl_ram_map\rom</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\swlib\std_lib\include</state>
-          <state>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\arch\include</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\api\wifi</state>
+          <state>$PROJ_DIR$\libraries\smartconfig\inc</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\mbed\api</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\mbed\targets\hal\rtl8711b</state>
+          <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include\posix</state>
+          <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\arch\include</state>
         </option>
         <option>
           <name>CCStdIncCheck</name>
@@ -644,7 +641,7 @@
         <debug>1</debug>
         <option>
           <name>OOCOutputFormat</name>
-          <version>3</version>
+          <version>2</version>
           <state>0</state>
         </option>
         <option>
@@ -821,6 +818,7 @@
         <option>
           <name>IlinkAdditionalLibs</name>
           <state />
+          <state>$PROJ_DIR$\libraries\smartconfig\libs\libsmartconfig_armcm4_iar.a</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\misc\bsp\lib\common\IAR\lib_platform.a</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\misc\bsp\lib\common\IAR\lib_rtlstd.a</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\misc\bsp\lib\common\IAR\lib_wlan.a</state>
@@ -1018,7 +1016,7 @@
       <name>General</name>
       <archiveVersion>3</archiveVersion>
       <data>
-        <version>24</version>
+        <version>22</version>
         <wantNonLocal>1</wantNonLocal>
         <debug>0</debug>
         <option>
@@ -1033,6 +1031,11 @@
           <name>ListPath</name>
           <state>Release\List</state>
         </option>
+        <option>
+          <name>Variant</name>
+          <version>21</version>
+          <state>0</state>
+        </option>
         <option>
           <name>GEndianMode</name>
           <state>0</state>
@@ -1040,7 +1043,7 @@
         <option>
           <name>Input variant</name>
           <version>3</version>
-          <state>1</state>
+          <state>0</state>
         </option>
         <option>
           <name>Input description</name>
@@ -1049,7 +1052,7 @@
         <option>
           <name>Output variant</name>
           <version>2</version>
-          <state>1</state>
+          <state>0</state>
         </option>
         <option>
           <name>Output description</name>
@@ -1059,6 +1062,11 @@
           <name>GOutputBinary</name>
           <state>0</state>
         </option>
+        <option>
+          <name>FPU</name>
+          <version>3</version>
+          <state>0</state>
+        </option>
         <option>
           <name>OGCoreOrChip</name>
           <state>0</state>
@@ -1079,11 +1087,11 @@
         </option>
         <option>
           <name>OGProductVersion</name>
-          <state>6.10.1.52170</state>
+          <state>7.30.4.8186</state>
         </option>
         <option>
           <name>OGLastSavedByProductVersion</name>
-          <state>7.40.3.8937</state>
+          <state />
         </option>
         <option>
           <name>GeneralEnableMisra</name>
@@ -1095,7 +1103,7 @@
         </option>
         <option>
           <name>OGChipSelectEditMenu</name>
-          <state>Default	None</state>
+          <state />
         </option>
         <option>
           <name>GenLowLevelInterface</name>
@@ -1131,10 +1139,15 @@
           <name>RTConfigPath2</name>
           <state />
         </option>
+        <option>
+          <name>GFPUCoreSlave</name>
+          <version>21</version>
+          <state>1</state>
+        </option>
         <option>
           <name>GBECoreSlave</name>
-          <version>22</version>
-          <state>0</state>
+          <version>21</version>
+          <state>1</state>
         </option>
         <option>
           <name>OGUseCmsis</name>
@@ -1148,34 +1161,6 @@
           <name>GRuntimeLibThreads</name>
           <state>0</state>
         </option>
-        <option>
-          <name>CoreVariant</name>
-          <version>22</version>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GFPUDeviceSlave</name>
-          <state>Default	None</state>
-        </option>
-        <option>
-          <name>FPU2</name>
-          <version>0</version>
-          <state>0</state>
-        </option>
-        <option>
-          <name>NrRegs</name>
-          <version>0</version>
-          <state>0</state>
-        </option>
-        <option>
-          <name>NEON</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GFPUCoreSlave2</name>
-          <version>22</version>
-          <state>0</state>
-        </option>
       </data>
     </settings>
     <settings>
@@ -1189,6 +1174,7 @@
           <name>CCDefines</name>
           <state>NDEBUG</state>
           <state>CONFIG_PLATFORM_8711B</state>
+          <state>PLATFORM_RTTHREAD</state>
           <state>__IEEE_LITTLE_ENDIAN</state>
           <state>RT_USING_DLIBC</state>
         </option>
@@ -1320,39 +1306,39 @@
         <option>
           <name>CCIncludePath2</name>
           <state />
-          <state>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\api</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\drivers\wlan\realtek\wlan_ram_map\rom</state>
-          <state>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\include\lwip</state>
           <state>$PROJ_DIR$\..\..\components\libc\compilers\dlib</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\misc</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\api\platform</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\rtthread_patch</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\rtthread_patch\realtek\8711b\include</state>
           <state>$PROJ_DIR$\..\..\include</state>
+          <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include\netif</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\app\monitor\include</state>
           <state>$PROJ_DIR$\..\..\libcpu\arm\common</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\os\os_dep\include</state>
           <state>$PROJ_DIR$\..\..\components\drivers\include</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\os\freertos\freertos_v8.1.2\Source\include</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\api\wifi\rtw_wpa_supplicant\src</state>
+          <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src</state>
           <state>$PROJ_DIR$\drivers</state>
-          <state>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\include\netif</state>
+          <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include\ipv4</state>
           <state>$PROJ_DIR$\..\..\libcpu\arm\cortex-m4</state>
           <state>$PROJ_DIR$\.</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\drivers\wlan\realtek\include</state>
-          <state>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\include</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\cmsis\device</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\swlib\std_lib\libc\rom\string</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\mbed\hal</state>
+          <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\mbed\hal_ext</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc</state>
+          <state>$PROJ_DIR$\..\..\components\net\lwip_dhcpd</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\os\freertos</state>
           <state>$PROJ_DIR$\applications</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\network\ssl\polarssl-1.3.8\include</state>
           <state>$PROJ_DIR$\drivers\wlan</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\os\freertos\freertos_v8.1.2\Source\portable\IAR\ARM_CM4F</state>
-          <state>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\include\ipv4</state>
           <state>$PROJ_DIR$\..\..\components\finsh</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\cmsis</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\swlib\rtl_lib</state>
@@ -1362,10 +1348,12 @@
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\drivers\wlan\realtek\src\osdep</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\network\ssl\ssl_ram_map\rom</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\swlib\std_lib\include</state>
-          <state>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\arch\include</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\api\wifi</state>
+          <state>$PROJ_DIR$\libraries\smartconfig\inc</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\mbed\api</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\mbed\targets\hal\rtl8711b</state>
+          <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include\posix</state>
+          <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\arch\include</state>
         </option>
         <option>
           <name>CCStdIncCheck</name>
@@ -1652,7 +1640,7 @@
         <debug>0</debug>
         <option>
           <name>OOCOutputFormat</name>
-          <version>3</version>
+          <version>2</version>
           <state>0</state>
         </option>
         <option>
@@ -1829,6 +1817,7 @@
         <option>
           <name>IlinkAdditionalLibs</name>
           <state />
+          <state>$PROJ_DIR$\libraries\smartconfig\libs\libsmartconfig_armcm4_iar.a</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\misc\bsp\lib\common\IAR\lib_platform.a</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\misc\bsp\lib\common\IAR\lib_rtlstd.a</state>
           <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\misc\bsp\lib\common\IAR\lib_wlan.a</state>
@@ -2021,6 +2010,9 @@
     <file>
       <name>$PROJ_DIR$\applications\main.c</name>
     </file>
+    <file>
+      <name>$PROJ_DIR$\applications\smartconfig_app.c</name>
+    </file>
   </group>
   <group>
     <name>Drivers</name>
@@ -2031,47 +2023,41 @@
       <name>$PROJ_DIR$\drivers\drv_uart.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\drivers\drv_wifi.c</name>
+      <name>$PROJ_DIR$\drivers\wlan\drv_wifi.c</name>
     </file>
-  </group>
-  <group>
-    <name>amebaz_wlan</name>
     <file>
-      <name>$PROJ_DIR$\drivers\wlan\amebaz_wlan.c</name>
+      <name>$PROJ_DIR$\drivers\wlan\drv_wlan.c</name>
     </file>
   </group>
   <group>
-    <name>rtt_patch</name>
+    <name>smartconfig</name>
+  </group>
+  <group>
+    <name>amebaz_sdk</name>
     <file>
       <name>$PROJ_DIR$\packages\realtek_ameba-latest\rtthread_patch\os\rtthread_service.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba-latest\rtthread_patch\realtek\8711b\rtl8710b_startup.c</name>
+      <name>$PROJ_DIR$\packages\realtek_ameba-latest\rtthread_patch\realtek\8711b\app_start.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba-latest\rtthread_patch\realtek\8711b\app_start.c</name>
+      <name>$PROJ_DIR$\packages\realtek_ameba-latest\rtthread_patch\realtek\8711b\rtl8710b_startup.c</name>
     </file>
     <file>
       <name>$PROJ_DIR$\packages\realtek_ameba-latest\rtthread_patch\realtek\common\wifi\wifi_conf.c</name>
     </file>
-  </group>
-  <group>
-    <name>ameba_wifi</name>
     <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\api\wifi\wifi_ind.c</name>
+      <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\api\wifi\rtw_wpa_supplicant\wpa_supplicant\wifi_eap_config.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\api\wifi\wifi_util.c</name>
+      <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\api\wifi\wifi_ind.c</name>
     </file>
     <file>
       <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\api\wifi\wifi_promisc.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\api\wifi\rtw_wpa_supplicant\wpa_supplicant\wifi_eap_config.c</name>
+      <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\api\wifi\wifi_util.c</name>
     </file>
-  </group>
-  <group>
-    <name>mbed</name>
     <file>
       <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\mbed\targets\hal\rtl8711b\analogin_api.c</name>
     </file>
@@ -2141,29 +2127,23 @@
     <file>
       <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\common\mbed\targets\hal\rtl8711b\wdt_api.c</name>
     </file>
-  </group>
-  <group>
-    <name>os_dep</name>
     <file>
       <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\os\os_dep\osdep_service.c</name>
     </file>
-  </group>
-  <group>
-    <name>soc_8711b</name>
     <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\cmsis\device\system_8195a.c</name>
+      <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\app\monitor\ram\monitor.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\fwlib\ram_lib\rtl8710b_pinmapcfg.c</name>
+      <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\app\monitor\ram\rtl_consol.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\fwlib\ram_lib\rtl8710b_intfcfg.c</name>
+      <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\cmsis\device\system_8195a.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\app\monitor\ram\rtl_consol.c</name>
+      <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\fwlib\ram_lib\rtl8710b_intfcfg.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\app\monitor\ram\monitor.c</name>
+      <name>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\fwlib\ram_lib\rtl8710b_pinmapcfg.c</name>
     </file>
   </group>
   <group>
@@ -2231,9 +2211,6 @@
   </group>
   <group>
     <name>DeviceDrivers</name>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\drivers\misc\pin.c</name>
-    </file>
     <file>
       <name>$PROJ_DIR$\..\..\components\drivers\serial\serial.c</name>
     </file>
@@ -2246,6 +2223,9 @@
     <file>
       <name>$PROJ_DIR$\..\..\components\drivers\src\pipe.c</name>
     </file>
+    <file>
+      <name>$PROJ_DIR$\..\..\components\drivers\src\ringblk_buf.c</name>
+    </file>
     <file>
       <name>$PROJ_DIR$\..\..\components\drivers\src\ringbuffer.c</name>
     </file>
@@ -2255,15 +2235,27 @@
     <file>
       <name>$PROJ_DIR$\..\..\components\drivers\src\workqueue.c</name>
     </file>
+    <file>
+      <name>$PROJ_DIR$\..\..\components\drivers\wlan\wlan_cfg.c</name>
+    </file>
     <file>
       <name>$PROJ_DIR$\..\..\components\drivers\wlan\wlan_cmd.c</name>
     </file>
     <file>
       <name>$PROJ_DIR$\..\..\components\drivers\wlan\wlan_dev.c</name>
     </file>
+    <file>
+      <name>$PROJ_DIR$\..\..\components\drivers\wlan\wlan_lwip.c</name>
+    </file>
     <file>
       <name>$PROJ_DIR$\..\..\components\drivers\wlan\wlan_mgnt.c</name>
     </file>
+    <file>
+      <name>$PROJ_DIR$\..\..\components\drivers\wlan\wlan_prot.c</name>
+    </file>
+    <file>
+      <name>$PROJ_DIR$\..\..\components\drivers\wlan\wlan_workqueue.c</name>
+    </file>
   </group>
   <group>
     <name>finsh</name>
@@ -2285,36 +2277,6 @@
     <file>
       <name>$PROJ_DIR$\..\..\components\finsh\msh_file.c</name>
     </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_compiler.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_error.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_heap.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_init.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_node.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_ops.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_parser.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_var.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_vm.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_token.c</name>
-    </file>
   </group>
   <group>
     <name>dlib</name>
@@ -2356,111 +2318,117 @@
     </file>
   </group>
   <group>
-    <name>LwIP</name>
+    <name>lwIP</name>
+    <file>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\arch\sys_arch.c</name>
+    </file>
+    <file>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\api\api_lib.c</name>
+    </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\api\api_lib.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\api\api_msg.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\api\api_msg.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\api\err.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\api\err.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\api\netbuf.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\api\netbuf.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\api\netdb.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\api\netdb.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\api\netifapi.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\api\netifapi.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\api\sockets.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\api\sockets.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\api\tcpip.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\api\tcpip.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\def.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\arch\sys_arch.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\dns.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\def.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\inet_chksum.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\dhcp.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\init.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\dns.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\ip.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\init.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\memp.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\memp.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\netif.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\netif.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\pbuf.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\pbuf.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\raw.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\raw.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\stats.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\stats.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\sys.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\sys.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\tcp.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\tcp.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\tcp_in.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\tcp_in.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\tcp_out.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\tcp_out.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\timeouts.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\timers.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\udp.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\udp.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\netif\ethernet.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\ipv4\autoip.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\netif\ethernetif.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\ipv4\icmp.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\netif\lowpan6.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\ipv4\igmp.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\ipv4\autoip.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\ipv4\inet.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\ipv4\dhcp.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\ipv4\inet_chksum.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\ipv4\etharp.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\ipv4\ip.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\ipv4\icmp.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\ipv4\ip_addr.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\ipv4\igmp.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\ipv4\ip_frag.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\ipv4\ip4.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\netif\etharp.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\ipv4\ip4_addr.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\netif\ethernetif.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\core\ipv4\ip4_frag.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\netif\slipif.c</name>
+      <name>$PROJ_DIR$\..\..\components\net\lwip_dhcpd\dhcp_server_raw.c</name>
     </file>
   </group>
 </project>

+ 0 - 2504
bsp/amebaz/project.ewt

@@ -1,2504 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-
-<project>
-  <fileVersion>2</fileVersion>
-  <configuration>
-    <name>Debug</name>
-    <toolchain>
-      <name>ARM</name>
-    </toolchain>
-    <debug>1</debug>
-    <settings>
-      <name>C-STAT</name>
-      <archiveVersion>1</archiveVersion>
-      <data>
-        <version>1</version>
-        <cstatargs>
-          <useExtraArgs>0</useExtraArgs>
-          <extraArgs></extraArgs>
-          <analyzeTimeout>600</analyzeTimeout>
-          <enableParallel>0</enableParallel>
-          <parallelThreads>2</parallelThreads>
-        </cstatargs>
-        <cstatsettings>
-          <package checked="true" name="STDCHECKS">
-            <group checked="true" name="ARR">
-              <check checked="true" name="ARR-inv-index-pos"/>
-              <check checked="true" name="ARR-inv-index-ptr-pos"/>
-              <check checked="true" name="ARR-inv-index-ptr"/>
-              <check checked="true" name="ARR-inv-index"/>
-              <check checked="true" name="ARR-neg-index"/>
-              <check checked="true" name="ARR-uninit-index"/>
-            </group>
-            <group checked="true" name="ATH">
-              <check checked="true" name="ATH-cmp-float"/>
-              <check checked="true" name="ATH-cmp-unsign-neg"/>
-              <check checked="true" name="ATH-cmp-unsign-pos"/>
-              <check checked="true" name="ATH-div-0-assign"/>
-              <check checked="true" name="ATH-div-0-cmp-aft"/>
-              <check checked="true" name="ATH-div-0-cmp-bef"/>
-              <check checked="true" name="ATH-div-0-interval"/>
-              <check checked="true" name="ATH-div-0-pos"/>
-              <check checked="true" name="ATH-div-0-unchk-global"/>
-              <check checked="true" name="ATH-div-0-unchk-local"/>
-              <check checked="true" name="ATH-div-0-unchk-param"/>
-              <check checked="true" name="ATH-div-0"/>
-              <check checked="true" name="ATH-inc-bool"/>
-              <check checked="true" name="ATH-malloc-overrun"/>
-              <check checked="true" name="ATH-neg-check-nonneg"/>
-              <check checked="true" name="ATH-neg-check-pos"/>
-              <check checked="true" name="ATH-new-overrun"/>
-              <check checked="false" name="ATH-overflow-cast"/>
-              <check checked="true" name="ATH-overflow"/>
-              <check checked="true" name="ATH-shift-bounds"/>
-              <check checked="true" name="ATH-shift-neg"/>
-              <check checked="true" name="ATH-sizeof-by-sizeof"/>
-            </group>
-            <group checked="true" name="CAST">
-              <check checked="false" name="CAST-old-style"/>
-            </group>
-            <group checked="true" name="CATCH">
-              <check checked="true" name="CATCH-object-slicing"/>
-              <check checked="false" name="CATCH-xtor-bad-member"/>
-            </group>
-            <group checked="true" name="COMMA">
-              <check checked="false" name="COMMA-overload"/>
-            </group>
-            <group checked="true" name="COMMENT">
-              <check checked="true" name="COMMENT-nested"/>
-            </group>
-            <group checked="false" name="CONCURRENCY">
-              <check checked="true" name="CONCURRENCY-double-lock"/>
-              <check checked="true" name="CONCURRENCY-double-unlock"/>
-              <check checked="true" name="CONCURRENCY-lock-no-unlock"/>
-              <check checked="true" name="CONCURRENCY-sleep-while-locking"/>
-            </group>
-            <group checked="true" name="CONST">
-              <check checked="false" name="CONST-local"/>
-              <check checked="true" name="CONST-member-ret"/>
-              <check checked="false" name="CONST-param"/>
-            </group>
-            <group checked="true" name="COP">
-              <check checked="true" name="COP-alloc-ctor"/>
-              <check checked="true" name="COP-assign-op-ret"/>
-              <check checked="true" name="COP-assign-op-self"/>
-              <check checked="true" name="COP-assign-op"/>
-              <check checked="true" name="COP-copy-ctor"/>
-              <check checked="true" name="COP-dealloc-dtor"/>
-              <check checked="true" name="COP-dtor-throw"/>
-              <check checked="true" name="COP-dtor"/>
-              <check checked="true" name="COP-init-order"/>
-              <check checked="true" name="COP-init-uninit"/>
-              <check checked="true" name="COP-member-uninit"/>
-            </group>
-            <group checked="true" name="CPU">
-              <check checked="true" name="CPU-ctor-call-virt"/>
-              <check checked="false" name="CPU-ctor-implicit"/>
-              <check checked="true" name="CPU-delete-throw"/>
-              <check checked="true" name="CPU-delete-void"/>
-              <check checked="true" name="CPU-dtor-call-virt"/>
-              <check checked="true" name="CPU-malloc-class"/>
-              <check checked="true" name="CPU-nonvirt-dtor"/>
-              <check checked="true" name="CPU-return-ref-to-class-data"/>
-            </group>
-            <group checked="true" name="DECL">
-              <check checked="false" name="DECL-implicit-int"/>
-            </group>
-            <group checked="true" name="DEFINE">
-              <check checked="true" name="DEFINE-hash-multiple"/>
-            </group>
-            <group checked="true" name="ENUM">
-              <check checked="false" name="ENUM-bounds"/>
-            </group>
-            <group checked="true" name="EXP">
-              <check checked="true" name="EXP-cond-assign"/>
-              <check checked="true" name="EXP-dangling-else"/>
-              <check checked="true" name="EXP-loop-exit"/>
-              <check checked="false" name="EXP-main-ret-int"/>
-              <check checked="false" name="EXP-null-stmt"/>
-              <check checked="false" name="EXP-stray-semicolon"/>
-            </group>
-            <group checked="true" name="EXPR">
-              <check checked="true" name="EXPR-const-overflow"/>
-            </group>
-            <group checked="false" name="FPT">
-              <check checked="true" name="FPT-arith-address"/>
-              <check checked="true" name="FPT-arith"/>
-              <check checked="true" name="FPT-cmp-null"/>
-              <check checked="false" name="FPT-literal"/>
-              <check checked="true" name="FPT-misuse"/>
-            </group>
-            <group checked="true" name="FUNC">
-              <check checked="false" name="FUNC-implicit-decl"/>
-              <check checked="false" name="FUNC-unprototyped-all"/>
-              <check checked="true" name="FUNC-unprototyped-used"/>
-            </group>
-            <group checked="true" name="INCLUDE">
-              <check checked="false" name="INCLUDE-c-file"/>
-            </group>
-            <group checked="true" name="INT">
-              <check checked="false" name="INT-use-signed-as-unsigned-pos"/>
-              <check checked="true" name="INT-use-signed-as-unsigned"/>
-            </group>
-            <group checked="true" name="ITR">
-              <check checked="true" name="ITR-end-cmp-aft"/>
-              <check checked="true" name="ITR-end-cmp-bef"/>
-              <check checked="true" name="ITR-invalidated"/>
-              <check checked="true" name="ITR-mismatch-alg"/>
-              <check checked="true" name="ITR-store"/>
-              <check checked="true" name="ITR-uninit"/>
-            </group>
-            <group checked="true" name="LIB">
-              <check checked="false" name="LIB-bsearch-overrun-pos"/>
-              <check checked="false" name="LIB-bsearch-overrun"/>
-              <check checked="false" name="LIB-buf-size"/>
-              <check checked="false" name="LIB-fn-unsafe"/>
-              <check checked="false" name="LIB-fread-overrun-pos"/>
-              <check checked="true" name="LIB-fread-overrun"/>
-              <check checked="false" name="LIB-memchr-overrun-pos"/>
-              <check checked="true" name="LIB-memchr-overrun"/>
-              <check checked="false" name="LIB-memcpy-overrun-pos"/>
-              <check checked="true" name="LIB-memcpy-overrun"/>
-              <check checked="false" name="LIB-memset-overrun-pos"/>
-              <check checked="true" name="LIB-memset-overrun"/>
-              <check checked="false" name="LIB-putenv"/>
-              <check checked="false" name="LIB-qsort-overrun-pos"/>
-              <check checked="false" name="LIB-qsort-overrun"/>
-              <check checked="true" name="LIB-return-const"/>
-              <check checked="true" name="LIB-return-error"/>
-              <check checked="true" name="LIB-return-leak"/>
-              <check checked="true" name="LIB-return-neg"/>
-              <check checked="true" name="LIB-return-null"/>
-              <check checked="false" name="LIB-sprintf-overrun"/>
-              <check checked="false" name="LIB-std-sort-overrun-pos"/>
-              <check checked="true" name="LIB-std-sort-overrun"/>
-              <check checked="false" name="LIB-strcat-overrun-pos"/>
-              <check checked="true" name="LIB-strcat-overrun"/>
-              <check checked="false" name="LIB-strcpy-overrun-pos"/>
-              <check checked="true" name="LIB-strcpy-overrun"/>
-              <check checked="false" name="LIB-strncat-overrun-pos"/>
-              <check checked="true" name="LIB-strncat-overrun"/>
-              <check checked="false" name="LIB-strncmp-overrun-pos"/>
-              <check checked="true" name="LIB-strncmp-overrun"/>
-              <check checked="false" name="LIB-strncpy-overrun-pos"/>
-              <check checked="true" name="LIB-strncpy-overrun"/>
-            </group>
-            <group checked="true" name="LOGIC">
-              <check checked="false" name="LOGIC-overload"/>
-            </group>
-            <group checked="false" name="MEM">
-              <check checked="true" name="MEM-alias-double-free"/>
-              <check checked="true" name="MEM-delete-array-op"/>
-              <check checked="true" name="MEM-delete-op"/>
-              <check checked="true" name="MEM-double-free-alias"/>
-              <check checked="true" name="MEM-double-free-some"/>
-              <check checked="true" name="MEM-double-free"/>
-              <check checked="true" name="MEM-free-field"/>
-              <check checked="true" name="MEM-free-fptr"/>
-              <check checked="false" name="MEM-free-no-alloc-struct"/>
-              <check checked="true" name="MEM-free-no-alloc"/>
-              <check checked="true" name="MEM-free-no-use"/>
-              <check checked="true" name="MEM-free-op"/>
-              <check checked="true" name="MEM-free-struct-field"/>
-              <check checked="true" name="MEM-free-variable-alias"/>
-              <check checked="true" name="MEM-free-variable"/>
-              <check checked="true" name="MEM-leak-alias"/>
-              <check checked="false" name="MEM-leak"/>
-              <check checked="false" name="MEM-malloc-arith"/>
-              <check checked="true" name="MEM-malloc-diff-type"/>
-              <check checked="true" name="MEM-malloc-sizeof-ptr"/>
-              <check checked="true" name="MEM-malloc-sizeof"/>
-              <check checked="false" name="MEM-malloc-strlen"/>
-              <check checked="true" name="MEM-realloc-diff-type"/>
-              <check checked="true" name="MEM-return-free"/>
-              <check checked="true" name="MEM-return-no-assign"/>
-              <check checked="true" name="MEM-stack-alias"/>
-              <check checked="true" name="MEM-stack-global-alias"/>
-              <check checked="true" name="MEM-stack-global-field"/>
-              <check checked="true" name="MEM-stack-global"/>
-              <check checked="true" name="MEM-stack-param-ref"/>
-              <check checked="true" name="MEM-stack-param"/>
-              <check checked="true" name="MEM-stack-pos"/>
-              <check checked="true" name="MEM-stack-ref"/>
-              <check checked="true" name="MEM-stack"/>
-              <check checked="true" name="MEM-use-free-all"/>
-              <check checked="true" name="MEM-use-free-some"/>
-            </group>
-            <group checked="false" name="POR">
-              <check checked="true" name="POR-imp-cast-subscript"/>
-              <check checked="false" name="POR-imp-cast-ternary"/>
-            </group>
-            <group checked="true" name="PTR">
-              <check checked="true" name="PTR-arith-field"/>
-              <check checked="true" name="PTR-arith-stack"/>
-              <check checked="true" name="PTR-arith-var"/>
-              <check checked="true" name="PTR-cmp-str-lit"/>
-              <check checked="true" name="PTR-null-assign-fun-pos"/>
-              <check checked="true" name="PTR-null-assign-pos"/>
-              <check checked="true" name="PTR-null-assign"/>
-              <check checked="true" name="PTR-null-cmp-aft"/>
-              <check checked="true" name="PTR-null-cmp-bef-fun"/>
-              <check checked="true" name="PTR-null-cmp-bef"/>
-              <check checked="true" name="PTR-null-fun-pos"/>
-              <check checked="true" name="PTR-null-literal-pos"/>
-              <check checked="false" name="PTR-overload"/>
-              <check checked="true" name="PTR-singleton-arith-pos"/>
-              <check checked="true" name="PTR-singleton-arith"/>
-              <check checked="true" name="PTR-unchk-param-some"/>
-              <check checked="false" name="PTR-unchk-param"/>
-              <check checked="true" name="PTR-uninit-pos"/>
-              <check checked="true" name="PTR-uninit"/>
-            </group>
-            <group checked="true" name="RED">
-              <check checked="false" name="RED-case-reach"/>
-              <check checked="false" name="RED-cmp-always"/>
-              <check checked="false" name="RED-cmp-never"/>
-              <check checked="false" name="RED-cond-always"/>
-              <check checked="true" name="RED-cond-const-assign"/>
-              <check checked="false" name="RED-cond-const-expr"/>
-              <check checked="false" name="RED-cond-const"/>
-              <check checked="false" name="RED-cond-never"/>
-              <check checked="true" name="RED-dead"/>
-              <check checked="false" name="RED-expr"/>
-              <check checked="false" name="RED-func-no-effect"/>
-              <check checked="true" name="RED-local-hides-global"/>
-              <check checked="true" name="RED-local-hides-local"/>
-              <check checked="true" name="RED-local-hides-member"/>
-              <check checked="true" name="RED-local-hides-param"/>
-              <check checked="false" name="RED-no-effect"/>
-              <check checked="true" name="RED-self-assign"/>
-              <check checked="true" name="RED-unused-assign"/>
-              <check checked="false" name="RED-unused-param"/>
-              <check checked="false" name="RED-unused-return-val"/>
-              <check checked="false" name="RED-unused-val"/>
-              <check checked="true" name="RED-unused-var-all"/>
-            </group>
-            <group checked="true" name="RESOURCE">
-              <check checked="false" name="RESOURCE-deref-file"/>
-              <check checked="true" name="RESOURCE-double-close"/>
-              <check checked="true" name="RESOURCE-file-no-close-all"/>
-              <check checked="false" name="RESOURCE-file-pos-neg"/>
-              <check checked="true" name="RESOURCE-file-use-after-close"/>
-              <check checked="false" name="RESOURCE-implicit-deref-file"/>
-              <check checked="true" name="RESOURCE-write-ronly-file"/>
-            </group>
-            <group checked="false" name="SEM">
-              <check checked="false" name="SEM-const-call"/>
-              <check checked="false" name="SEM-const-global"/>
-              <check checked="false" name="SEM-pure-call"/>
-              <check checked="false" name="SEM-pure-global"/>
-            </group>
-            <group checked="true" name="SIZEOF">
-              <check checked="true" name="SIZEOF-side-effect"/>
-            </group>
-            <group checked="true" name="SPC">
-              <check checked="false" name="SPC-init-list"/>
-              <check checked="true" name="SPC-order"/>
-              <check checked="true" name="SPC-return"/>
-              <check checked="true" name="SPC-uninit-arr-all"/>
-              <check checked="true" name="SPC-uninit-struct-field-heap"/>
-              <check checked="true" name="SPC-uninit-struct-field"/>
-              <check checked="true" name="SPC-uninit-struct"/>
-              <check checked="true" name="SPC-uninit-var-all"/>
-              <check checked="true" name="SPC-uninit-var-some"/>
-              <check checked="false" name="SPC-volatile-reads"/>
-              <check checked="false" name="SPC-volatile-writes"/>
-            </group>
-            <group checked="true" name="STR">
-              <check checked="true" name="STR-trigraph"/>
-            </group>
-            <group checked="true" name="STRUCT">
-              <check checked="false" name="STRUCT-signed-bit"/>
-            </group>
-            <group checked="true" name="SWITCH">
-              <check checked="true" name="SWITCH-fall-through"/>
-            </group>
-            <group checked="true" name="THROW">
-              <check checked="false" name="THROW-empty"/>
-              <check checked="false" name="THROW-main"/>
-              <check checked="true" name="THROW-null"/>
-              <check checked="true" name="THROW-ptr"/>
-              <check checked="true" name="THROW-static"/>
-              <check checked="true" name="THROW-unhandled"/>
-            </group>
-            <group checked="true" name="UNION">
-              <check checked="true" name="UNION-overlap-assign"/>
-              <check checked="true" name="UNION-type-punning"/>
-            </group>
-          </package>
-          <package checked="false" name="MISRAC2004">
-            <group checked="false" name="MISRAC2004-1">
-              <check checked="true" name="MISRAC2004-1.1"/>
-              <check checked="true" name="MISRAC2004-1.2_a"/>
-              <check checked="true" name="MISRAC2004-1.2_b"/>
-              <check checked="true" name="MISRAC2004-1.2_c"/>
-              <check checked="true" name="MISRAC2004-1.2_d"/>
-              <check checked="true" name="MISRAC2004-1.2_e"/>
-              <check checked="true" name="MISRAC2004-1.2_f"/>
-              <check checked="true" name="MISRAC2004-1.2_g"/>
-              <check checked="true" name="MISRAC2004-1.2_h"/>
-              <check checked="true" name="MISRAC2004-1.2_i"/>
-              <check checked="true" name="MISRAC2004-1.2_j"/>
-            </group>
-            <group checked="true" name="MISRAC2004-2">
-              <check checked="true" name="MISRAC2004-2.1"/>
-              <check checked="true" name="MISRAC2004-2.2"/>
-              <check checked="true" name="MISRAC2004-2.3"/>
-              <check checked="false" name="MISRAC2004-2.4"/>
-            </group>
-            <group checked="true" name="MISRAC2004-4">
-              <check checked="true" name="MISRAC2004-4.2"/>
-            </group>
-            <group checked="true" name="MISRAC2004-5">
-              <check checked="true" name="MISRAC2004-5.2_a"/>
-              <check checked="true" name="MISRAC2004-5.2_b"/>
-              <check checked="true" name="MISRAC2004-5.2_c"/>
-              <check checked="true" name="MISRAC2004-5.3"/>
-              <check checked="true" name="MISRAC2004-5.4"/>
-              <check checked="false" name="MISRAC2004-5.5"/>
-            </group>
-            <group checked="true" name="MISRAC2004-6">
-              <check checked="true" name="MISRAC2004-6.1"/>
-              <check checked="false" name="MISRAC2004-6.3"/>
-              <check checked="true" name="MISRAC2004-6.4"/>
-              <check checked="true" name="MISRAC2004-6.5"/>
-            </group>
-            <group checked="true" name="MISRAC2004-7">
-              <check checked="true" name="MISRAC2004-7.1"/>
-            </group>
-            <group checked="true" name="MISRAC2004-8">
-              <check checked="true" name="MISRAC2004-8.1"/>
-              <check checked="true" name="MISRAC2004-8.2"/>
-              <check checked="true" name="MISRAC2004-8.5_a"/>
-              <check checked="true" name="MISRAC2004-8.5_b"/>
-              <check checked="true" name="MISRAC2004-8.12"/>
-            </group>
-            <group checked="true" name="MISRAC2004-9">
-              <check checked="true" name="MISRAC2004-9.1_a"/>
-              <check checked="true" name="MISRAC2004-9.1_b"/>
-              <check checked="true" name="MISRAC2004-9.1_c"/>
-              <check checked="true" name="MISRAC2004-9.2"/>
-            </group>
-            <group checked="true" name="MISRAC2004-10">
-              <check checked="true" name="MISRAC2004-10.1_a"/>
-              <check checked="true" name="MISRAC2004-10.1_b"/>
-              <check checked="true" name="MISRAC2004-10.1_c"/>
-              <check checked="true" name="MISRAC2004-10.1_d"/>
-              <check checked="true" name="MISRAC2004-10.2_a"/>
-              <check checked="true" name="MISRAC2004-10.2_b"/>
-              <check checked="true" name="MISRAC2004-10.2_c"/>
-              <check checked="true" name="MISRAC2004-10.2_d"/>
-              <check checked="true" name="MISRAC2004-10.3"/>
-              <check checked="true" name="MISRAC2004-10.4"/>
-              <check checked="true" name="MISRAC2004-10.5"/>
-              <check checked="true" name="MISRAC2004-10.6"/>
-            </group>
-            <group checked="true" name="MISRAC2004-11">
-              <check checked="true" name="MISRAC2004-11.1"/>
-              <check checked="false" name="MISRAC2004-11.3"/>
-              <check checked="false" name="MISRAC2004-11.4"/>
-              <check checked="true" name="MISRAC2004-11.5"/>
-            </group>
-            <group checked="true" name="MISRAC2004-12">
-              <check checked="false" name="MISRAC2004-12.1"/>
-              <check checked="true" name="MISRAC2004-12.2_a"/>
-              <check checked="true" name="MISRAC2004-12.2_b"/>
-              <check checked="true" name="MISRAC2004-12.2_c"/>
-              <check checked="true" name="MISRAC2004-12.3"/>
-              <check checked="true" name="MISRAC2004-12.4"/>
-              <check checked="false" name="MISRAC2004-12.6_a"/>
-              <check checked="false" name="MISRAC2004-12.6_b"/>
-              <check checked="true" name="MISRAC2004-12.7"/>
-              <check checked="true" name="MISRAC2004-12.8"/>
-              <check checked="true" name="MISRAC2004-12.9"/>
-              <check checked="true" name="MISRAC2004-12.10"/>
-              <check checked="false" name="MISRAC2004-12.11"/>
-              <check checked="true" name="MISRAC2004-12.12_a"/>
-              <check checked="true" name="MISRAC2004-12.12_b"/>
-              <check checked="false" name="MISRAC2004-12.13"/>
-            </group>
-            <group checked="true" name="MISRAC2004-13">
-              <check checked="true" name="MISRAC2004-13.1"/>
-              <check checked="false" name="MISRAC2004-13.2_a"/>
-              <check checked="false" name="MISRAC2004-13.2_b"/>
-              <check checked="false" name="MISRAC2004-13.2_c"/>
-              <check checked="false" name="MISRAC2004-13.2_d"/>
-              <check checked="false" name="MISRAC2004-13.2_e"/>
-              <check checked="true" name="MISRAC2004-13.3"/>
-              <check checked="true" name="MISRAC2004-13.4"/>
-              <check checked="true" name="MISRAC2004-13.5"/>
-              <check checked="true" name="MISRAC2004-13.6"/>
-              <check checked="true" name="MISRAC2004-13.7_a"/>
-              <check checked="true" name="MISRAC2004-13.7_b"/>
-            </group>
-            <group checked="true" name="MISRAC2004-14">
-              <check checked="true" name="MISRAC2004-14.1"/>
-              <check checked="true" name="MISRAC2004-14.2"/>
-              <check checked="true" name="MISRAC2004-14.3"/>
-              <check checked="true" name="MISRAC2004-14.4"/>
-              <check checked="true" name="MISRAC2004-14.5"/>
-              <check checked="true" name="MISRAC2004-14.6"/>
-              <check checked="true" name="MISRAC2004-14.7"/>
-              <check checked="true" name="MISRAC2004-14.8_a"/>
-              <check checked="true" name="MISRAC2004-14.8_b"/>
-              <check checked="true" name="MISRAC2004-14.8_c"/>
-              <check checked="true" name="MISRAC2004-14.8_d"/>
-              <check checked="true" name="MISRAC2004-14.9"/>
-              <check checked="true" name="MISRAC2004-14.10"/>
-            </group>
-            <group checked="true" name="MISRAC2004-15">
-              <check checked="true" name="MISRAC2004-15.0"/>
-              <check checked="true" name="MISRAC2004-15.1"/>
-              <check checked="true" name="MISRAC2004-15.2"/>
-              <check checked="true" name="MISRAC2004-15.3"/>
-              <check checked="true" name="MISRAC2004-15.4"/>
-              <check checked="true" name="MISRAC2004-15.5"/>
-            </group>
-            <group checked="true" name="MISRAC2004-16">
-              <check checked="true" name="MISRAC2004-16.1"/>
-              <check checked="true" name="MISRAC2004-16.2_a"/>
-              <check checked="true" name="MISRAC2004-16.2_b"/>
-              <check checked="true" name="MISRAC2004-16.3"/>
-              <check checked="true" name="MISRAC2004-16.5"/>
-              <check checked="true" name="MISRAC2004-16.7"/>
-              <check checked="true" name="MISRAC2004-16.8"/>
-              <check checked="true" name="MISRAC2004-16.9"/>
-              <check checked="true" name="MISRAC2004-16.10"/>
-            </group>
-            <group checked="true" name="MISRAC2004-17">
-              <check checked="true" name="MISRAC2004-17.1_a"/>
-              <check checked="true" name="MISRAC2004-17.1_b"/>
-              <check checked="true" name="MISRAC2004-17.1_c"/>
-              <check checked="true" name="MISRAC2004-17.4_a"/>
-              <check checked="true" name="MISRAC2004-17.4_b"/>
-              <check checked="true" name="MISRAC2004-17.5"/>
-              <check checked="true" name="MISRAC2004-17.6_a"/>
-              <check checked="true" name="MISRAC2004-17.6_b"/>
-              <check checked="true" name="MISRAC2004-17.6_c"/>
-              <check checked="true" name="MISRAC2004-17.6_d"/>
-            </group>
-            <group checked="true" name="MISRAC2004-18">
-              <check checked="true" name="MISRAC2004-18.1"/>
-              <check checked="true" name="MISRAC2004-18.2"/>
-              <check checked="true" name="MISRAC2004-18.4"/>
-            </group>
-            <group checked="true" name="MISRAC2004-19">
-              <check checked="false" name="MISRAC2004-19.2"/>
-              <check checked="true" name="MISRAC2004-19.6"/>
-              <check checked="false" name="MISRAC2004-19.7"/>
-              <check checked="true" name="MISRAC2004-19.12"/>
-              <check checked="false" name="MISRAC2004-19.13"/>
-              <check checked="true" name="MISRAC2004-19.15"/>
-            </group>
-            <group checked="true" name="MISRAC2004-20">
-              <check checked="true" name="MISRAC2004-20.1"/>
-              <check checked="true" name="MISRAC2004-20.4"/>
-              <check checked="true" name="MISRAC2004-20.5"/>
-              <check checked="true" name="MISRAC2004-20.6"/>
-              <check checked="true" name="MISRAC2004-20.7"/>
-              <check checked="true" name="MISRAC2004-20.8"/>
-              <check checked="true" name="MISRAC2004-20.9"/>
-              <check checked="true" name="MISRAC2004-20.10"/>
-              <check checked="true" name="MISRAC2004-20.11"/>
-              <check checked="true" name="MISRAC2004-20.12"/>
-            </group>
-          </package>
-          <package checked="false" name="MISRAC2012">
-            <group checked="true" name="MISRAC2012-Dir-4">
-              <check checked="true" name="MISRAC2012-Dir-4.3"/>
-              <check checked="false" name="MISRAC2012-Dir-4.4"/>
-              <check checked="false" name="MISRAC2012-Dir-4.6_a"/>
-              <check checked="false" name="MISRAC2012-Dir-4.6_b"/>
-              <check checked="false" name="MISRAC2012-Dir-4.9"/>
-              <check checked="true" name="MISRAC2012-Dir-4.10"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-1">
-              <check checked="true" name="MISRAC2012-Rule-1.3_a"/>
-              <check checked="true" name="MISRAC2012-Rule-1.3_b"/>
-              <check checked="true" name="MISRAC2012-Rule-1.3_c"/>
-              <check checked="true" name="MISRAC2012-Rule-1.3_d"/>
-              <check checked="true" name="MISRAC2012-Rule-1.3_e"/>
-              <check checked="true" name="MISRAC2012-Rule-1.3_f"/>
-              <check checked="true" name="MISRAC2012-Rule-1.3_g"/>
-              <check checked="true" name="MISRAC2012-Rule-1.3_h"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-2">
-              <check checked="true" name="MISRAC2012-Rule-2.1_a"/>
-              <check checked="true" name="MISRAC2012-Rule-2.1_b"/>
-              <check checked="true" name="MISRAC2012-Rule-2.2_a"/>
-              <check checked="true" name="MISRAC2012-Rule-2.2_c"/>
-              <check checked="false" name="MISRAC2012-Rule-2.7"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-3">
-              <check checked="true" name="MISRAC2012-Rule-3.1"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-4">
-              <check checked="false" name="MISRAC2012-Rule-4.2"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-5">
-              <check checked="true" name="MISRAC2012-Rule-5.1"/>
-              <check checked="true" name="MISRAC2012-Rule-5.3_a"/>
-              <check checked="true" name="MISRAC2012-Rule-5.3_b"/>
-              <check checked="true" name="MISRAC2012-Rule-5.3_c"/>
-              <check checked="true" name="MISRAC2012-Rule-5.4_c89"/>
-              <check checked="true" name="MISRAC2012-Rule-5.4_c99"/>
-              <check checked="true" name="MISRAC2012-Rule-5.5_c89"/>
-              <check checked="true" name="MISRAC2012-Rule-5.5_c99"/>
-              <check checked="true" name="MISRAC2012-Rule-5.6"/>
-              <check checked="true" name="MISRAC2012-Rule-5.7"/>
-              <check checked="true" name="MISRAC2012-Rule-5.8"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-6">
-              <check checked="true" name="MISRAC2012-Rule-6.1"/>
-              <check checked="true" name="MISRAC2012-Rule-6.2"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-7">
-              <check checked="true" name="MISRAC2012-Rule-7.1"/>
-              <check checked="true" name="MISRAC2012-Rule-7.2"/>
-              <check checked="true" name="MISRAC2012-Rule-7.3"/>
-              <check checked="true" name="MISRAC2012-Rule-7.4_a"/>
-              <check checked="true" name="MISRAC2012-Rule-7.4_b"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-8">
-              <check checked="true" name="MISRAC2012-Rule-8.1"/>
-              <check checked="true" name="MISRAC2012-Rule-8.2_a"/>
-              <check checked="true" name="MISRAC2012-Rule-8.2_b"/>
-              <check checked="true" name="MISRAC2012-Rule-8.10"/>
-              <check checked="false" name="MISRAC2012-Rule-8.11"/>
-              <check checked="true" name="MISRAC2012-Rule-8.14"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-9">
-              <check checked="true" name="MISRAC2012-Rule-9.1_a"/>
-              <check checked="true" name="MISRAC2012-Rule-9.1_b"/>
-              <check checked="true" name="MISRAC2012-Rule-9.1_c"/>
-              <check checked="true" name="MISRAC2012-Rule-9.1_d"/>
-              <check checked="true" name="MISRAC2012-Rule-9.1_e"/>
-              <check checked="true" name="MISRAC2012-Rule-9.1_f"/>
-              <check checked="true" name="MISRAC2012-Rule-9.3"/>
-              <check checked="true" name="MISRAC2012-Rule-9.5_a"/>
-              <check checked="true" name="MISRAC2012-Rule-9.5_b"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-10">
-              <check checked="true" name="MISRAC2012-Rule-10.1_R2"/>
-              <check checked="true" name="MISRAC2012-Rule-10.1_R3"/>
-              <check checked="true" name="MISRAC2012-Rule-10.1_R4"/>
-              <check checked="true" name="MISRAC2012-Rule-10.1_R5"/>
-              <check checked="true" name="MISRAC2012-Rule-10.1_R6"/>
-              <check checked="true" name="MISRAC2012-Rule-10.1_R7"/>
-              <check checked="true" name="MISRAC2012-Rule-10.1_R8"/>
-              <check checked="true" name="MISRAC2012-Rule-10.2"/>
-              <check checked="true" name="MISRAC2012-Rule-10.3"/>
-              <check checked="true" name="MISRAC2012-Rule-10.4"/>
-              <check checked="true" name="MISRAC2012-Rule-10.6"/>
-              <check checked="true" name="MISRAC2012-Rule-10.7"/>
-              <check checked="true" name="MISRAC2012-Rule-10.8"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-11">
-              <check checked="true" name="MISRAC2012-Rule-11.1"/>
-              <check checked="true" name="MISRAC2012-Rule-11.3"/>
-              <check checked="false" name="MISRAC2012-Rule-11.4"/>
-              <check checked="true" name="MISRAC2012-Rule-11.7"/>
-              <check checked="true" name="MISRAC2012-Rule-11.8"/>
-              <check checked="true" name="MISRAC2012-Rule-11.9"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-12">
-              <check checked="false" name="MISRAC2012-Rule-12.1"/>
-              <check checked="true" name="MISRAC2012-Rule-12.2"/>
-              <check checked="false" name="MISRAC2012-Rule-12.3"/>
-              <check checked="false" name="MISRAC2012-Rule-12.4"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-13">
-              <check checked="true" name="MISRAC2012-Rule-13.1"/>
-              <check checked="true" name="MISRAC2012-Rule-13.2_a"/>
-              <check checked="true" name="MISRAC2012-Rule-13.2_b"/>
-              <check checked="true" name="MISRAC2012-Rule-13.2_c"/>
-              <check checked="false" name="MISRAC2012-Rule-13.3"/>
-              <check checked="false" name="MISRAC2012-Rule-13.4_a"/>
-              <check checked="false" name="MISRAC2012-Rule-13.4_b"/>
-              <check checked="true" name="MISRAC2012-Rule-13.5"/>
-              <check checked="true" name="MISRAC2012-Rule-13.6"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-14">
-              <check checked="true" name="MISRAC2012-Rule-14.1_a"/>
-              <check checked="true" name="MISRAC2012-Rule-14.1_b"/>
-              <check checked="true" name="MISRAC2012-Rule-14.2"/>
-              <check checked="true" name="MISRAC2012-Rule-14.3_a"/>
-              <check checked="true" name="MISRAC2012-Rule-14.3_b"/>
-              <check checked="true" name="MISRAC2012-Rule-14.4_a"/>
-              <check checked="true" name="MISRAC2012-Rule-14.4_b"/>
-              <check checked="true" name="MISRAC2012-Rule-14.4_c"/>
-              <check checked="true" name="MISRAC2012-Rule-14.4_d"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-15">
-              <check checked="false" name="MISRAC2012-Rule-15.1"/>
-              <check checked="true" name="MISRAC2012-Rule-15.2"/>
-              <check checked="true" name="MISRAC2012-Rule-15.3"/>
-              <check checked="false" name="MISRAC2012-Rule-15.4"/>
-              <check checked="false" name="MISRAC2012-Rule-15.5"/>
-              <check checked="true" name="MISRAC2012-Rule-15.6_a"/>
-              <check checked="true" name="MISRAC2012-Rule-15.6_b"/>
-              <check checked="true" name="MISRAC2012-Rule-15.6_c"/>
-              <check checked="true" name="MISRAC2012-Rule-15.6_d"/>
-              <check checked="true" name="MISRAC2012-Rule-15.6_e"/>
-              <check checked="true" name="MISRAC2012-Rule-15.7"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-16">
-              <check checked="true" name="MISRAC2012-Rule-16.1"/>
-              <check checked="true" name="MISRAC2012-Rule-16.2"/>
-              <check checked="true" name="MISRAC2012-Rule-16.3"/>
-              <check checked="true" name="MISRAC2012-Rule-16.4"/>
-              <check checked="true" name="MISRAC2012-Rule-16.5"/>
-              <check checked="true" name="MISRAC2012-Rule-16.6"/>
-              <check checked="true" name="MISRAC2012-Rule-16.7"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-17">
-              <check checked="true" name="MISRAC2012-Rule-17.1"/>
-              <check checked="true" name="MISRAC2012-Rule-17.2_a"/>
-              <check checked="true" name="MISRAC2012-Rule-17.2_b"/>
-              <check checked="true" name="MISRAC2012-Rule-17.3"/>
-              <check checked="true" name="MISRAC2012-Rule-17.4"/>
-              <check checked="true" name="MISRAC2012-Rule-17.6"/>
-              <check checked="true" name="MISRAC2012-Rule-17.7"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-18">
-              <check checked="true" name="MISRAC2012-Rule-18.1_a"/>
-              <check checked="true" name="MISRAC2012-Rule-18.1_b"/>
-              <check checked="true" name="MISRAC2012-Rule-18.1_c"/>
-              <check checked="true" name="MISRAC2012-Rule-18.1_d"/>
-              <check checked="false" name="MISRAC2012-Rule-18.5"/>
-              <check checked="true" name="MISRAC2012-Rule-18.6_a"/>
-              <check checked="true" name="MISRAC2012-Rule-18.6_b"/>
-              <check checked="true" name="MISRAC2012-Rule-18.6_c"/>
-              <check checked="true" name="MISRAC2012-Rule-18.6_d"/>
-              <check checked="true" name="MISRAC2012-Rule-18.7"/>
-              <check checked="true" name="MISRAC2012-Rule-18.8"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-19">
-              <check checked="true" name="MISRAC2012-Rule-19.1"/>
-              <check checked="false" name="MISRAC2012-Rule-19.2"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-20">
-              <check checked="true" name="MISRAC2012-Rule-20.2"/>
-              <check checked="true" name="MISRAC2012-Rule-20.4_c89"/>
-              <check checked="true" name="MISRAC2012-Rule-20.4_c99"/>
-              <check checked="false" name="MISRAC2012-Rule-20.5"/>
-              <check checked="false" name="MISRAC2012-Rule-20.10"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-21">
-              <check checked="true" name="MISRAC2012-Rule-21.1"/>
-              <check checked="true" name="MISRAC2012-Rule-21.2"/>
-              <check checked="true" name="MISRAC2012-Rule-21.3"/>
-              <check checked="true" name="MISRAC2012-Rule-21.4"/>
-              <check checked="true" name="MISRAC2012-Rule-21.5"/>
-              <check checked="true" name="MISRAC2012-Rule-21.6"/>
-              <check checked="true" name="MISRAC2012-Rule-21.7"/>
-              <check checked="true" name="MISRAC2012-Rule-21.8"/>
-              <check checked="true" name="MISRAC2012-Rule-21.9"/>
-              <check checked="true" name="MISRAC2012-Rule-21.10"/>
-              <check checked="true" name="MISRAC2012-Rule-21.11"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-22">
-              <check checked="true" name="MISRAC2012-Rule-22.1_a"/>
-              <check checked="true" name="MISRAC2012-Rule-22.1_b"/>
-              <check checked="true" name="MISRAC2012-Rule-22.2_a"/>
-              <check checked="true" name="MISRAC2012-Rule-22.2_b"/>
-              <check checked="true" name="MISRAC2012-Rule-22.2_c"/>
-              <check checked="true" name="MISRAC2012-Rule-22.4"/>
-              <check checked="true" name="MISRAC2012-Rule-22.5_a"/>
-              <check checked="true" name="MISRAC2012-Rule-22.5_b"/>
-              <check checked="true" name="MISRAC2012-Rule-22.6"/>
-            </group>
-          </package>
-          <package checked="false" name="MISRAC++2008">
-            <group checked="true" name="MISRAC++2008-0-1">
-              <check checked="true" name="MISRAC++2008-0-1-1"/>
-              <check checked="true" name="MISRAC++2008-0-1-2_a"/>
-              <check checked="true" name="MISRAC++2008-0-1-2_b"/>
-              <check checked="true" name="MISRAC++2008-0-1-2_c"/>
-              <check checked="true" name="MISRAC++2008-0-1-3"/>
-              <check checked="true" name="MISRAC++2008-0-1-4"/>
-              <check checked="true" name="MISRAC++2008-0-1-6"/>
-              <check checked="true" name="MISRAC++2008-0-1-7"/>
-              <check checked="false" name="MISRAC++2008-0-1-8"/>
-              <check checked="true" name="MISRAC++2008-0-1-9"/>
-              <check checked="true" name="MISRAC++2008-0-1-11"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-0-2">
-              <check checked="true" name="MISRAC++2008-0-2-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-0-3">
-              <check checked="true" name="MISRAC++2008-0-3-2"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-2-3">
-              <check checked="true" name="MISRAC++2008-2-3-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-2-7">
-              <check checked="true" name="MISRAC++2008-2-7-1"/>
-              <check checked="true" name="MISRAC++2008-2-7-2"/>
-              <check checked="false" name="MISRAC++2008-2-7-3"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-2-10">
-              <check checked="true" name="MISRAC++2008-2-10-2_a"/>
-              <check checked="true" name="MISRAC++2008-2-10-2_b"/>
-              <check checked="true" name="MISRAC++2008-2-10-2_c"/>
-              <check checked="true" name="MISRAC++2008-2-10-2_d"/>
-              <check checked="true" name="MISRAC++2008-2-10-3"/>
-              <check checked="true" name="MISRAC++2008-2-10-4"/>
-              <check checked="false" name="MISRAC++2008-2-10-5"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-2-13">
-              <check checked="true" name="MISRAC++2008-2-13-2"/>
-              <check checked="true" name="MISRAC++2008-2-13-3"/>
-              <check checked="true" name="MISRAC++2008-2-13-4_a"/>
-              <check checked="true" name="MISRAC++2008-2-13-4_b"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-3-1">
-              <check checked="true" name="MISRAC++2008-3-1-1"/>
-              <check checked="true" name="MISRAC++2008-3-1-3"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-3-9">
-              <check checked="false" name="MISRAC++2008-3-9-2"/>
-              <check checked="true" name="MISRAC++2008-3-9-3"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-4-5">
-              <check checked="true" name="MISRAC++2008-4-5-1"/>
-              <check checked="true" name="MISRAC++2008-4-5-2"/>
-              <check checked="true" name="MISRAC++2008-4-5-3"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-5-0">
-              <check checked="true" name="MISRAC++2008-5-0-1_a"/>
-              <check checked="true" name="MISRAC++2008-5-0-1_b"/>
-              <check checked="true" name="MISRAC++2008-5-0-1_c"/>
-              <check checked="false" name="MISRAC++2008-5-0-2"/>
-              <check checked="true" name="MISRAC++2008-5-0-3"/>
-              <check checked="true" name="MISRAC++2008-5-0-4"/>
-              <check checked="true" name="MISRAC++2008-5-0-5"/>
-              <check checked="true" name="MISRAC++2008-5-0-6"/>
-              <check checked="true" name="MISRAC++2008-5-0-7"/>
-              <check checked="true" name="MISRAC++2008-5-0-8"/>
-              <check checked="true" name="MISRAC++2008-5-0-9"/>
-              <check checked="true" name="MISRAC++2008-5-0-10"/>
-              <check checked="true" name="MISRAC++2008-5-0-13_a"/>
-              <check checked="true" name="MISRAC++2008-5-0-13_b"/>
-              <check checked="true" name="MISRAC++2008-5-0-13_c"/>
-              <check checked="true" name="MISRAC++2008-5-0-13_d"/>
-              <check checked="true" name="MISRAC++2008-5-0-14"/>
-              <check checked="true" name="MISRAC++2008-5-0-15_a"/>
-              <check checked="true" name="MISRAC++2008-5-0-15_b"/>
-              <check checked="true" name="MISRAC++2008-5-0-16_a"/>
-              <check checked="true" name="MISRAC++2008-5-0-16_b"/>
-              <check checked="true" name="MISRAC++2008-5-0-16_c"/>
-              <check checked="true" name="MISRAC++2008-5-0-16_d"/>
-              <check checked="true" name="MISRAC++2008-5-0-16_e"/>
-              <check checked="true" name="MISRAC++2008-5-0-16_f"/>
-              <check checked="true" name="MISRAC++2008-5-0-19"/>
-              <check checked="true" name="MISRAC++2008-5-0-21"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-5-2">
-              <check checked="true" name="MISRAC++2008-5-2-4"/>
-              <check checked="true" name="MISRAC++2008-5-2-5"/>
-              <check checked="true" name="MISRAC++2008-5-2-6"/>
-              <check checked="true" name="MISRAC++2008-5-2-7"/>
-              <check checked="false" name="MISRAC++2008-5-2-9"/>
-              <check checked="false" name="MISRAC++2008-5-2-10"/>
-              <check checked="true" name="MISRAC++2008-5-2-11_a"/>
-              <check checked="true" name="MISRAC++2008-5-2-11_b"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-5-3">
-              <check checked="true" name="MISRAC++2008-5-3-1"/>
-              <check checked="true" name="MISRAC++2008-5-3-2_a"/>
-              <check checked="true" name="MISRAC++2008-5-3-2_b"/>
-              <check checked="true" name="MISRAC++2008-5-3-3"/>
-              <check checked="true" name="MISRAC++2008-5-3-4"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-5-8">
-              <check checked="true" name="MISRAC++2008-5-8-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-5-14">
-              <check checked="true" name="MISRAC++2008-5-14-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-5-18">
-              <check checked="true" name="MISRAC++2008-5-18-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-5-19">
-              <check checked="false" name="MISRAC++2008-5-19-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-6-2">
-              <check checked="true" name="MISRAC++2008-6-2-1"/>
-              <check checked="true" name="MISRAC++2008-6-2-2"/>
-              <check checked="true" name="MISRAC++2008-6-2-3"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-6-3">
-              <check checked="true" name="MISRAC++2008-6-3-1_a"/>
-              <check checked="true" name="MISRAC++2008-6-3-1_b"/>
-              <check checked="true" name="MISRAC++2008-6-3-1_c"/>
-              <check checked="true" name="MISRAC++2008-6-3-1_d"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-6-4">
-              <check checked="true" name="MISRAC++2008-6-4-1"/>
-              <check checked="true" name="MISRAC++2008-6-4-2"/>
-              <check checked="true" name="MISRAC++2008-6-4-3"/>
-              <check checked="true" name="MISRAC++2008-6-4-4"/>
-              <check checked="true" name="MISRAC++2008-6-4-5"/>
-              <check checked="true" name="MISRAC++2008-6-4-6"/>
-              <check checked="true" name="MISRAC++2008-6-4-7"/>
-              <check checked="true" name="MISRAC++2008-6-4-8"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-6-5">
-              <check checked="true" name="MISRAC++2008-6-5-1_a"/>
-              <check checked="true" name="MISRAC++2008-6-5-2"/>
-              <check checked="true" name="MISRAC++2008-6-5-3"/>
-              <check checked="true" name="MISRAC++2008-6-5-4"/>
-              <check checked="true" name="MISRAC++2008-6-5-6"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-6-6">
-              <check checked="true" name="MISRAC++2008-6-6-1"/>
-              <check checked="true" name="MISRAC++2008-6-6-2"/>
-              <check checked="true" name="MISRAC++2008-6-6-4"/>
-              <check checked="true" name="MISRAC++2008-6-6-5"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-7-1">
-              <check checked="true" name="MISRAC++2008-7-1-1"/>
-              <check checked="true" name="MISRAC++2008-7-1-2"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-7-2">
-              <check checked="true" name="MISRAC++2008-7-2-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-7-4">
-              <check checked="true" name="MISRAC++2008-7-4-3"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-7-5">
-              <check checked="true" name="MISRAC++2008-7-5-1_a"/>
-              <check checked="true" name="MISRAC++2008-7-5-1_b"/>
-              <check checked="true" name="MISRAC++2008-7-5-2_a"/>
-              <check checked="true" name="MISRAC++2008-7-5-2_b"/>
-              <check checked="true" name="MISRAC++2008-7-5-2_c"/>
-              <check checked="true" name="MISRAC++2008-7-5-2_d"/>
-              <check checked="false" name="MISRAC++2008-7-5-4_a"/>
-              <check checked="false" name="MISRAC++2008-7-5-4_b"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-8-0">
-              <check checked="true" name="MISRAC++2008-8-0-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-8-4">
-              <check checked="true" name="MISRAC++2008-8-4-1"/>
-              <check checked="true" name="MISRAC++2008-8-4-3"/>
-              <check checked="true" name="MISRAC++2008-8-4-4"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-8-5">
-              <check checked="true" name="MISRAC++2008-8-5-1_a"/>
-              <check checked="true" name="MISRAC++2008-8-5-1_b"/>
-              <check checked="true" name="MISRAC++2008-8-5-1_c"/>
-              <check checked="true" name="MISRAC++2008-8-5-2"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-9-3">
-              <check checked="true" name="MISRAC++2008-9-3-1"/>
-              <check checked="true" name="MISRAC++2008-9-3-2"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-9-5">
-              <check checked="true" name="MISRAC++2008-9-5-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-9-6">
-              <check checked="true" name="MISRAC++2008-9-6-2"/>
-              <check checked="true" name="MISRAC++2008-9-6-3"/>
-              <check checked="true" name="MISRAC++2008-9-6-4"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-12-1">
-              <check checked="true" name="MISRAC++2008-12-1-1_a"/>
-              <check checked="true" name="MISRAC++2008-12-1-1_b"/>
-              <check checked="true" name="MISRAC++2008-12-1-3"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-15-0">
-              <check checked="false" name="MISRAC++2008-15-0-2"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-15-1">
-              <check checked="true" name="MISRAC++2008-15-1-2"/>
-              <check checked="true" name="MISRAC++2008-15-1-3"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-15-3">
-              <check checked="true" name="MISRAC++2008-15-3-1"/>
-              <check checked="false" name="MISRAC++2008-15-3-2"/>
-              <check checked="true" name="MISRAC++2008-15-3-3"/>
-              <check checked="true" name="MISRAC++2008-15-3-4"/>
-              <check checked="true" name="MISRAC++2008-15-3-5"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-15-5">
-              <check checked="true" name="MISRAC++2008-15-5-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-16-0">
-              <check checked="true" name="MISRAC++2008-16-0-3"/>
-              <check checked="true" name="MISRAC++2008-16-0-4"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-16-2">
-              <check checked="true" name="MISRAC++2008-16-2-2"/>
-              <check checked="true" name="MISRAC++2008-16-2-3"/>
-              <check checked="true" name="MISRAC++2008-16-2-4"/>
-              <check checked="false" name="MISRAC++2008-16-2-5"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-16-3">
-              <check checked="true" name="MISRAC++2008-16-3-1"/>
-              <check checked="false" name="MISRAC++2008-16-3-2"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-17-0">
-              <check checked="true" name="MISRAC++2008-17-0-1"/>
-              <check checked="true" name="MISRAC++2008-17-0-3"/>
-              <check checked="true" name="MISRAC++2008-17-0-5"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-18-0">
-              <check checked="true" name="MISRAC++2008-18-0-1"/>
-              <check checked="true" name="MISRAC++2008-18-0-2"/>
-              <check checked="true" name="MISRAC++2008-18-0-3"/>
-              <check checked="true" name="MISRAC++2008-18-0-4"/>
-              <check checked="true" name="MISRAC++2008-18-0-5"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-18-2">
-              <check checked="true" name="MISRAC++2008-18-2-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-18-4">
-              <check checked="true" name="MISRAC++2008-18-4-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-18-7">
-              <check checked="true" name="MISRAC++2008-18-7-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-19-3">
-              <check checked="true" name="MISRAC++2008-19-3-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-27-0">
-              <check checked="true" name="MISRAC++2008-27-0-1"/>
-            </group>
-          </package>
-        </cstatsettings>
-      </data>
-    </settings>
-    <settings>
-      <name>RuntimeChecking</name>
-      <archiveVersion>0</archiveVersion>
-      <data>
-        <version>2</version>
-        <wantNonLocal>1</wantNonLocal>
-        <debug>1</debug>
-        <option>
-          <name>GenRtcDebugHeap</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcEnableBoundsChecking</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcCheckPtrsNonInstrMem</name>
-          <state>1</state>
-        </option>
-        <option>
-          <name>GenRtcTrackPointerBounds</name>
-          <state>1</state>
-        </option>
-        <option>
-          <name>GenRtcCheckAccesses</name>
-          <state>1</state>
-        </option>
-        <option>
-          <name>GenRtcGenerateEntries</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcNrTrackedPointers</name>
-          <state>1000</state>
-        </option>
-        <option>
-          <name>GenRtcIntOverflow</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcIncUnsigned</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcIntConversion</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcInclExplicit</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcIntShiftOverflow</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcInclUnsignedShiftOverflow</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcUnhandledCase</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcDivByZero</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcEnable</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcCheckPtrsNonInstrFunc</name>
-          <state>1</state>
-        </option>
-      </data>
-    </settings>
-  </configuration>
-  <configuration>
-    <name>Release</name>
-    <toolchain>
-      <name>ARM</name>
-    </toolchain>
-    <debug>0</debug>
-    <settings>
-      <name>C-STAT</name>
-      <archiveVersion>1</archiveVersion>
-      <data>
-        <version>1</version>
-        <cstatargs>
-          <useExtraArgs>0</useExtraArgs>
-          <extraArgs></extraArgs>
-          <analyzeTimeout>600</analyzeTimeout>
-          <enableParallel>0</enableParallel>
-          <parallelThreads>2</parallelThreads>
-        </cstatargs>
-        <cstatsettings>
-          <package checked="true" name="STDCHECKS">
-            <group checked="true" name="ARR">
-              <check checked="true" name="ARR-inv-index-pos"/>
-              <check checked="true" name="ARR-inv-index-ptr-pos"/>
-              <check checked="true" name="ARR-inv-index-ptr"/>
-              <check checked="true" name="ARR-inv-index"/>
-              <check checked="true" name="ARR-neg-index"/>
-              <check checked="true" name="ARR-uninit-index"/>
-            </group>
-            <group checked="true" name="ATH">
-              <check checked="true" name="ATH-cmp-float"/>
-              <check checked="true" name="ATH-cmp-unsign-neg"/>
-              <check checked="true" name="ATH-cmp-unsign-pos"/>
-              <check checked="true" name="ATH-div-0-assign"/>
-              <check checked="true" name="ATH-div-0-cmp-aft"/>
-              <check checked="true" name="ATH-div-0-cmp-bef"/>
-              <check checked="true" name="ATH-div-0-interval"/>
-              <check checked="true" name="ATH-div-0-pos"/>
-              <check checked="true" name="ATH-div-0-unchk-global"/>
-              <check checked="true" name="ATH-div-0-unchk-local"/>
-              <check checked="true" name="ATH-div-0-unchk-param"/>
-              <check checked="true" name="ATH-div-0"/>
-              <check checked="true" name="ATH-inc-bool"/>
-              <check checked="true" name="ATH-malloc-overrun"/>
-              <check checked="true" name="ATH-neg-check-nonneg"/>
-              <check checked="true" name="ATH-neg-check-pos"/>
-              <check checked="true" name="ATH-new-overrun"/>
-              <check checked="false" name="ATH-overflow-cast"/>
-              <check checked="true" name="ATH-overflow"/>
-              <check checked="true" name="ATH-shift-bounds"/>
-              <check checked="true" name="ATH-shift-neg"/>
-              <check checked="true" name="ATH-sizeof-by-sizeof"/>
-            </group>
-            <group checked="true" name="CAST">
-              <check checked="false" name="CAST-old-style"/>
-            </group>
-            <group checked="true" name="CATCH">
-              <check checked="true" name="CATCH-object-slicing"/>
-              <check checked="false" name="CATCH-xtor-bad-member"/>
-            </group>
-            <group checked="true" name="COMMA">
-              <check checked="false" name="COMMA-overload"/>
-            </group>
-            <group checked="true" name="COMMENT">
-              <check checked="true" name="COMMENT-nested"/>
-            </group>
-            <group checked="false" name="CONCURRENCY">
-              <check checked="true" name="CONCURRENCY-double-lock"/>
-              <check checked="true" name="CONCURRENCY-double-unlock"/>
-              <check checked="true" name="CONCURRENCY-lock-no-unlock"/>
-              <check checked="true" name="CONCURRENCY-sleep-while-locking"/>
-            </group>
-            <group checked="true" name="CONST">
-              <check checked="false" name="CONST-local"/>
-              <check checked="true" name="CONST-member-ret"/>
-              <check checked="false" name="CONST-param"/>
-            </group>
-            <group checked="true" name="COP">
-              <check checked="true" name="COP-alloc-ctor"/>
-              <check checked="true" name="COP-assign-op-ret"/>
-              <check checked="true" name="COP-assign-op-self"/>
-              <check checked="true" name="COP-assign-op"/>
-              <check checked="true" name="COP-copy-ctor"/>
-              <check checked="true" name="COP-dealloc-dtor"/>
-              <check checked="true" name="COP-dtor-throw"/>
-              <check checked="true" name="COP-dtor"/>
-              <check checked="true" name="COP-init-order"/>
-              <check checked="true" name="COP-init-uninit"/>
-              <check checked="true" name="COP-member-uninit"/>
-            </group>
-            <group checked="true" name="CPU">
-              <check checked="true" name="CPU-ctor-call-virt"/>
-              <check checked="false" name="CPU-ctor-implicit"/>
-              <check checked="true" name="CPU-delete-throw"/>
-              <check checked="true" name="CPU-delete-void"/>
-              <check checked="true" name="CPU-dtor-call-virt"/>
-              <check checked="true" name="CPU-malloc-class"/>
-              <check checked="true" name="CPU-nonvirt-dtor"/>
-              <check checked="true" name="CPU-return-ref-to-class-data"/>
-            </group>
-            <group checked="true" name="DECL">
-              <check checked="false" name="DECL-implicit-int"/>
-            </group>
-            <group checked="true" name="DEFINE">
-              <check checked="true" name="DEFINE-hash-multiple"/>
-            </group>
-            <group checked="true" name="ENUM">
-              <check checked="false" name="ENUM-bounds"/>
-            </group>
-            <group checked="true" name="EXP">
-              <check checked="true" name="EXP-cond-assign"/>
-              <check checked="true" name="EXP-dangling-else"/>
-              <check checked="true" name="EXP-loop-exit"/>
-              <check checked="false" name="EXP-main-ret-int"/>
-              <check checked="false" name="EXP-null-stmt"/>
-              <check checked="false" name="EXP-stray-semicolon"/>
-            </group>
-            <group checked="true" name="EXPR">
-              <check checked="true" name="EXPR-const-overflow"/>
-            </group>
-            <group checked="false" name="FPT">
-              <check checked="true" name="FPT-arith-address"/>
-              <check checked="true" name="FPT-arith"/>
-              <check checked="true" name="FPT-cmp-null"/>
-              <check checked="false" name="FPT-literal"/>
-              <check checked="true" name="FPT-misuse"/>
-            </group>
-            <group checked="true" name="FUNC">
-              <check checked="false" name="FUNC-implicit-decl"/>
-              <check checked="false" name="FUNC-unprototyped-all"/>
-              <check checked="true" name="FUNC-unprototyped-used"/>
-            </group>
-            <group checked="true" name="INCLUDE">
-              <check checked="false" name="INCLUDE-c-file"/>
-            </group>
-            <group checked="true" name="INT">
-              <check checked="false" name="INT-use-signed-as-unsigned-pos"/>
-              <check checked="true" name="INT-use-signed-as-unsigned"/>
-            </group>
-            <group checked="true" name="ITR">
-              <check checked="true" name="ITR-end-cmp-aft"/>
-              <check checked="true" name="ITR-end-cmp-bef"/>
-              <check checked="true" name="ITR-invalidated"/>
-              <check checked="true" name="ITR-mismatch-alg"/>
-              <check checked="true" name="ITR-store"/>
-              <check checked="true" name="ITR-uninit"/>
-            </group>
-            <group checked="true" name="LIB">
-              <check checked="false" name="LIB-bsearch-overrun-pos"/>
-              <check checked="false" name="LIB-bsearch-overrun"/>
-              <check checked="false" name="LIB-buf-size"/>
-              <check checked="false" name="LIB-fn-unsafe"/>
-              <check checked="false" name="LIB-fread-overrun-pos"/>
-              <check checked="true" name="LIB-fread-overrun"/>
-              <check checked="false" name="LIB-memchr-overrun-pos"/>
-              <check checked="true" name="LIB-memchr-overrun"/>
-              <check checked="false" name="LIB-memcpy-overrun-pos"/>
-              <check checked="true" name="LIB-memcpy-overrun"/>
-              <check checked="false" name="LIB-memset-overrun-pos"/>
-              <check checked="true" name="LIB-memset-overrun"/>
-              <check checked="false" name="LIB-putenv"/>
-              <check checked="false" name="LIB-qsort-overrun-pos"/>
-              <check checked="false" name="LIB-qsort-overrun"/>
-              <check checked="true" name="LIB-return-const"/>
-              <check checked="true" name="LIB-return-error"/>
-              <check checked="true" name="LIB-return-leak"/>
-              <check checked="true" name="LIB-return-neg"/>
-              <check checked="true" name="LIB-return-null"/>
-              <check checked="false" name="LIB-sprintf-overrun"/>
-              <check checked="false" name="LIB-std-sort-overrun-pos"/>
-              <check checked="true" name="LIB-std-sort-overrun"/>
-              <check checked="false" name="LIB-strcat-overrun-pos"/>
-              <check checked="true" name="LIB-strcat-overrun"/>
-              <check checked="false" name="LIB-strcpy-overrun-pos"/>
-              <check checked="true" name="LIB-strcpy-overrun"/>
-              <check checked="false" name="LIB-strncat-overrun-pos"/>
-              <check checked="true" name="LIB-strncat-overrun"/>
-              <check checked="false" name="LIB-strncmp-overrun-pos"/>
-              <check checked="true" name="LIB-strncmp-overrun"/>
-              <check checked="false" name="LIB-strncpy-overrun-pos"/>
-              <check checked="true" name="LIB-strncpy-overrun"/>
-            </group>
-            <group checked="true" name="LOGIC">
-              <check checked="false" name="LOGIC-overload"/>
-            </group>
-            <group checked="false" name="MEM">
-              <check checked="true" name="MEM-alias-double-free"/>
-              <check checked="true" name="MEM-delete-array-op"/>
-              <check checked="true" name="MEM-delete-op"/>
-              <check checked="true" name="MEM-double-free-alias"/>
-              <check checked="true" name="MEM-double-free-some"/>
-              <check checked="true" name="MEM-double-free"/>
-              <check checked="true" name="MEM-free-field"/>
-              <check checked="true" name="MEM-free-fptr"/>
-              <check checked="false" name="MEM-free-no-alloc-struct"/>
-              <check checked="true" name="MEM-free-no-alloc"/>
-              <check checked="true" name="MEM-free-no-use"/>
-              <check checked="true" name="MEM-free-op"/>
-              <check checked="true" name="MEM-free-struct-field"/>
-              <check checked="true" name="MEM-free-variable-alias"/>
-              <check checked="true" name="MEM-free-variable"/>
-              <check checked="true" name="MEM-leak-alias"/>
-              <check checked="false" name="MEM-leak"/>
-              <check checked="false" name="MEM-malloc-arith"/>
-              <check checked="true" name="MEM-malloc-diff-type"/>
-              <check checked="true" name="MEM-malloc-sizeof-ptr"/>
-              <check checked="true" name="MEM-malloc-sizeof"/>
-              <check checked="false" name="MEM-malloc-strlen"/>
-              <check checked="true" name="MEM-realloc-diff-type"/>
-              <check checked="true" name="MEM-return-free"/>
-              <check checked="true" name="MEM-return-no-assign"/>
-              <check checked="true" name="MEM-stack-alias"/>
-              <check checked="true" name="MEM-stack-global-alias"/>
-              <check checked="true" name="MEM-stack-global-field"/>
-              <check checked="true" name="MEM-stack-global"/>
-              <check checked="true" name="MEM-stack-param-ref"/>
-              <check checked="true" name="MEM-stack-param"/>
-              <check checked="true" name="MEM-stack-pos"/>
-              <check checked="true" name="MEM-stack-ref"/>
-              <check checked="true" name="MEM-stack"/>
-              <check checked="true" name="MEM-use-free-all"/>
-              <check checked="true" name="MEM-use-free-some"/>
-            </group>
-            <group checked="false" name="POR">
-              <check checked="true" name="POR-imp-cast-subscript"/>
-              <check checked="false" name="POR-imp-cast-ternary"/>
-            </group>
-            <group checked="true" name="PTR">
-              <check checked="true" name="PTR-arith-field"/>
-              <check checked="true" name="PTR-arith-stack"/>
-              <check checked="true" name="PTR-arith-var"/>
-              <check checked="true" name="PTR-cmp-str-lit"/>
-              <check checked="true" name="PTR-null-assign-fun-pos"/>
-              <check checked="true" name="PTR-null-assign-pos"/>
-              <check checked="true" name="PTR-null-assign"/>
-              <check checked="true" name="PTR-null-cmp-aft"/>
-              <check checked="true" name="PTR-null-cmp-bef-fun"/>
-              <check checked="true" name="PTR-null-cmp-bef"/>
-              <check checked="true" name="PTR-null-fun-pos"/>
-              <check checked="true" name="PTR-null-literal-pos"/>
-              <check checked="false" name="PTR-overload"/>
-              <check checked="true" name="PTR-singleton-arith-pos"/>
-              <check checked="true" name="PTR-singleton-arith"/>
-              <check checked="true" name="PTR-unchk-param-some"/>
-              <check checked="false" name="PTR-unchk-param"/>
-              <check checked="true" name="PTR-uninit-pos"/>
-              <check checked="true" name="PTR-uninit"/>
-            </group>
-            <group checked="true" name="RED">
-              <check checked="false" name="RED-case-reach"/>
-              <check checked="false" name="RED-cmp-always"/>
-              <check checked="false" name="RED-cmp-never"/>
-              <check checked="false" name="RED-cond-always"/>
-              <check checked="true" name="RED-cond-const-assign"/>
-              <check checked="false" name="RED-cond-const-expr"/>
-              <check checked="false" name="RED-cond-const"/>
-              <check checked="false" name="RED-cond-never"/>
-              <check checked="true" name="RED-dead"/>
-              <check checked="false" name="RED-expr"/>
-              <check checked="false" name="RED-func-no-effect"/>
-              <check checked="true" name="RED-local-hides-global"/>
-              <check checked="true" name="RED-local-hides-local"/>
-              <check checked="true" name="RED-local-hides-member"/>
-              <check checked="true" name="RED-local-hides-param"/>
-              <check checked="false" name="RED-no-effect"/>
-              <check checked="true" name="RED-self-assign"/>
-              <check checked="true" name="RED-unused-assign"/>
-              <check checked="false" name="RED-unused-param"/>
-              <check checked="false" name="RED-unused-return-val"/>
-              <check checked="false" name="RED-unused-val"/>
-              <check checked="true" name="RED-unused-var-all"/>
-            </group>
-            <group checked="true" name="RESOURCE">
-              <check checked="false" name="RESOURCE-deref-file"/>
-              <check checked="true" name="RESOURCE-double-close"/>
-              <check checked="true" name="RESOURCE-file-no-close-all"/>
-              <check checked="false" name="RESOURCE-file-pos-neg"/>
-              <check checked="true" name="RESOURCE-file-use-after-close"/>
-              <check checked="false" name="RESOURCE-implicit-deref-file"/>
-              <check checked="true" name="RESOURCE-write-ronly-file"/>
-            </group>
-            <group checked="false" name="SEM">
-              <check checked="false" name="SEM-const-call"/>
-              <check checked="false" name="SEM-const-global"/>
-              <check checked="false" name="SEM-pure-call"/>
-              <check checked="false" name="SEM-pure-global"/>
-            </group>
-            <group checked="true" name="SIZEOF">
-              <check checked="true" name="SIZEOF-side-effect"/>
-            </group>
-            <group checked="true" name="SPC">
-              <check checked="false" name="SPC-init-list"/>
-              <check checked="true" name="SPC-order"/>
-              <check checked="true" name="SPC-return"/>
-              <check checked="true" name="SPC-uninit-arr-all"/>
-              <check checked="true" name="SPC-uninit-struct-field-heap"/>
-              <check checked="true" name="SPC-uninit-struct-field"/>
-              <check checked="true" name="SPC-uninit-struct"/>
-              <check checked="true" name="SPC-uninit-var-all"/>
-              <check checked="true" name="SPC-uninit-var-some"/>
-              <check checked="false" name="SPC-volatile-reads"/>
-              <check checked="false" name="SPC-volatile-writes"/>
-            </group>
-            <group checked="true" name="STR">
-              <check checked="true" name="STR-trigraph"/>
-            </group>
-            <group checked="true" name="STRUCT">
-              <check checked="false" name="STRUCT-signed-bit"/>
-            </group>
-            <group checked="true" name="SWITCH">
-              <check checked="true" name="SWITCH-fall-through"/>
-            </group>
-            <group checked="true" name="THROW">
-              <check checked="false" name="THROW-empty"/>
-              <check checked="false" name="THROW-main"/>
-              <check checked="true" name="THROW-null"/>
-              <check checked="true" name="THROW-ptr"/>
-              <check checked="true" name="THROW-static"/>
-              <check checked="true" name="THROW-unhandled"/>
-            </group>
-            <group checked="true" name="UNION">
-              <check checked="true" name="UNION-overlap-assign"/>
-              <check checked="true" name="UNION-type-punning"/>
-            </group>
-          </package>
-          <package checked="false" name="MISRAC2004">
-            <group checked="false" name="MISRAC2004-1">
-              <check checked="true" name="MISRAC2004-1.1"/>
-              <check checked="true" name="MISRAC2004-1.2_a"/>
-              <check checked="true" name="MISRAC2004-1.2_b"/>
-              <check checked="true" name="MISRAC2004-1.2_c"/>
-              <check checked="true" name="MISRAC2004-1.2_d"/>
-              <check checked="true" name="MISRAC2004-1.2_e"/>
-              <check checked="true" name="MISRAC2004-1.2_f"/>
-              <check checked="true" name="MISRAC2004-1.2_g"/>
-              <check checked="true" name="MISRAC2004-1.2_h"/>
-              <check checked="true" name="MISRAC2004-1.2_i"/>
-              <check checked="true" name="MISRAC2004-1.2_j"/>
-            </group>
-            <group checked="true" name="MISRAC2004-2">
-              <check checked="true" name="MISRAC2004-2.1"/>
-              <check checked="true" name="MISRAC2004-2.2"/>
-              <check checked="true" name="MISRAC2004-2.3"/>
-              <check checked="false" name="MISRAC2004-2.4"/>
-            </group>
-            <group checked="true" name="MISRAC2004-4">
-              <check checked="true" name="MISRAC2004-4.2"/>
-            </group>
-            <group checked="true" name="MISRAC2004-5">
-              <check checked="true" name="MISRAC2004-5.2_a"/>
-              <check checked="true" name="MISRAC2004-5.2_b"/>
-              <check checked="true" name="MISRAC2004-5.2_c"/>
-              <check checked="true" name="MISRAC2004-5.3"/>
-              <check checked="true" name="MISRAC2004-5.4"/>
-              <check checked="false" name="MISRAC2004-5.5"/>
-            </group>
-            <group checked="true" name="MISRAC2004-6">
-              <check checked="true" name="MISRAC2004-6.1"/>
-              <check checked="false" name="MISRAC2004-6.3"/>
-              <check checked="true" name="MISRAC2004-6.4"/>
-              <check checked="true" name="MISRAC2004-6.5"/>
-            </group>
-            <group checked="true" name="MISRAC2004-7">
-              <check checked="true" name="MISRAC2004-7.1"/>
-            </group>
-            <group checked="true" name="MISRAC2004-8">
-              <check checked="true" name="MISRAC2004-8.1"/>
-              <check checked="true" name="MISRAC2004-8.2"/>
-              <check checked="true" name="MISRAC2004-8.5_a"/>
-              <check checked="true" name="MISRAC2004-8.5_b"/>
-              <check checked="true" name="MISRAC2004-8.12"/>
-            </group>
-            <group checked="true" name="MISRAC2004-9">
-              <check checked="true" name="MISRAC2004-9.1_a"/>
-              <check checked="true" name="MISRAC2004-9.1_b"/>
-              <check checked="true" name="MISRAC2004-9.1_c"/>
-              <check checked="true" name="MISRAC2004-9.2"/>
-            </group>
-            <group checked="true" name="MISRAC2004-10">
-              <check checked="true" name="MISRAC2004-10.1_a"/>
-              <check checked="true" name="MISRAC2004-10.1_b"/>
-              <check checked="true" name="MISRAC2004-10.1_c"/>
-              <check checked="true" name="MISRAC2004-10.1_d"/>
-              <check checked="true" name="MISRAC2004-10.2_a"/>
-              <check checked="true" name="MISRAC2004-10.2_b"/>
-              <check checked="true" name="MISRAC2004-10.2_c"/>
-              <check checked="true" name="MISRAC2004-10.2_d"/>
-              <check checked="true" name="MISRAC2004-10.3"/>
-              <check checked="true" name="MISRAC2004-10.4"/>
-              <check checked="true" name="MISRAC2004-10.5"/>
-              <check checked="true" name="MISRAC2004-10.6"/>
-            </group>
-            <group checked="true" name="MISRAC2004-11">
-              <check checked="true" name="MISRAC2004-11.1"/>
-              <check checked="false" name="MISRAC2004-11.3"/>
-              <check checked="false" name="MISRAC2004-11.4"/>
-              <check checked="true" name="MISRAC2004-11.5"/>
-            </group>
-            <group checked="true" name="MISRAC2004-12">
-              <check checked="false" name="MISRAC2004-12.1"/>
-              <check checked="true" name="MISRAC2004-12.2_a"/>
-              <check checked="true" name="MISRAC2004-12.2_b"/>
-              <check checked="true" name="MISRAC2004-12.2_c"/>
-              <check checked="true" name="MISRAC2004-12.3"/>
-              <check checked="true" name="MISRAC2004-12.4"/>
-              <check checked="false" name="MISRAC2004-12.6_a"/>
-              <check checked="false" name="MISRAC2004-12.6_b"/>
-              <check checked="true" name="MISRAC2004-12.7"/>
-              <check checked="true" name="MISRAC2004-12.8"/>
-              <check checked="true" name="MISRAC2004-12.9"/>
-              <check checked="true" name="MISRAC2004-12.10"/>
-              <check checked="false" name="MISRAC2004-12.11"/>
-              <check checked="true" name="MISRAC2004-12.12_a"/>
-              <check checked="true" name="MISRAC2004-12.12_b"/>
-              <check checked="false" name="MISRAC2004-12.13"/>
-            </group>
-            <group checked="true" name="MISRAC2004-13">
-              <check checked="true" name="MISRAC2004-13.1"/>
-              <check checked="false" name="MISRAC2004-13.2_a"/>
-              <check checked="false" name="MISRAC2004-13.2_b"/>
-              <check checked="false" name="MISRAC2004-13.2_c"/>
-              <check checked="false" name="MISRAC2004-13.2_d"/>
-              <check checked="false" name="MISRAC2004-13.2_e"/>
-              <check checked="true" name="MISRAC2004-13.3"/>
-              <check checked="true" name="MISRAC2004-13.4"/>
-              <check checked="true" name="MISRAC2004-13.5"/>
-              <check checked="true" name="MISRAC2004-13.6"/>
-              <check checked="true" name="MISRAC2004-13.7_a"/>
-              <check checked="true" name="MISRAC2004-13.7_b"/>
-            </group>
-            <group checked="true" name="MISRAC2004-14">
-              <check checked="true" name="MISRAC2004-14.1"/>
-              <check checked="true" name="MISRAC2004-14.2"/>
-              <check checked="true" name="MISRAC2004-14.3"/>
-              <check checked="true" name="MISRAC2004-14.4"/>
-              <check checked="true" name="MISRAC2004-14.5"/>
-              <check checked="true" name="MISRAC2004-14.6"/>
-              <check checked="true" name="MISRAC2004-14.7"/>
-              <check checked="true" name="MISRAC2004-14.8_a"/>
-              <check checked="true" name="MISRAC2004-14.8_b"/>
-              <check checked="true" name="MISRAC2004-14.8_c"/>
-              <check checked="true" name="MISRAC2004-14.8_d"/>
-              <check checked="true" name="MISRAC2004-14.9"/>
-              <check checked="true" name="MISRAC2004-14.10"/>
-            </group>
-            <group checked="true" name="MISRAC2004-15">
-              <check checked="true" name="MISRAC2004-15.0"/>
-              <check checked="true" name="MISRAC2004-15.1"/>
-              <check checked="true" name="MISRAC2004-15.2"/>
-              <check checked="true" name="MISRAC2004-15.3"/>
-              <check checked="true" name="MISRAC2004-15.4"/>
-              <check checked="true" name="MISRAC2004-15.5"/>
-            </group>
-            <group checked="true" name="MISRAC2004-16">
-              <check checked="true" name="MISRAC2004-16.1"/>
-              <check checked="true" name="MISRAC2004-16.2_a"/>
-              <check checked="true" name="MISRAC2004-16.2_b"/>
-              <check checked="true" name="MISRAC2004-16.3"/>
-              <check checked="true" name="MISRAC2004-16.5"/>
-              <check checked="true" name="MISRAC2004-16.7"/>
-              <check checked="true" name="MISRAC2004-16.8"/>
-              <check checked="true" name="MISRAC2004-16.9"/>
-              <check checked="true" name="MISRAC2004-16.10"/>
-            </group>
-            <group checked="true" name="MISRAC2004-17">
-              <check checked="true" name="MISRAC2004-17.1_a"/>
-              <check checked="true" name="MISRAC2004-17.1_b"/>
-              <check checked="true" name="MISRAC2004-17.1_c"/>
-              <check checked="true" name="MISRAC2004-17.4_a"/>
-              <check checked="true" name="MISRAC2004-17.4_b"/>
-              <check checked="true" name="MISRAC2004-17.5"/>
-              <check checked="true" name="MISRAC2004-17.6_a"/>
-              <check checked="true" name="MISRAC2004-17.6_b"/>
-              <check checked="true" name="MISRAC2004-17.6_c"/>
-              <check checked="true" name="MISRAC2004-17.6_d"/>
-            </group>
-            <group checked="true" name="MISRAC2004-18">
-              <check checked="true" name="MISRAC2004-18.1"/>
-              <check checked="true" name="MISRAC2004-18.2"/>
-              <check checked="true" name="MISRAC2004-18.4"/>
-            </group>
-            <group checked="true" name="MISRAC2004-19">
-              <check checked="false" name="MISRAC2004-19.2"/>
-              <check checked="true" name="MISRAC2004-19.6"/>
-              <check checked="false" name="MISRAC2004-19.7"/>
-              <check checked="true" name="MISRAC2004-19.12"/>
-              <check checked="false" name="MISRAC2004-19.13"/>
-              <check checked="true" name="MISRAC2004-19.15"/>
-            </group>
-            <group checked="true" name="MISRAC2004-20">
-              <check checked="true" name="MISRAC2004-20.1"/>
-              <check checked="true" name="MISRAC2004-20.4"/>
-              <check checked="true" name="MISRAC2004-20.5"/>
-              <check checked="true" name="MISRAC2004-20.6"/>
-              <check checked="true" name="MISRAC2004-20.7"/>
-              <check checked="true" name="MISRAC2004-20.8"/>
-              <check checked="true" name="MISRAC2004-20.9"/>
-              <check checked="true" name="MISRAC2004-20.10"/>
-              <check checked="true" name="MISRAC2004-20.11"/>
-              <check checked="true" name="MISRAC2004-20.12"/>
-            </group>
-          </package>
-          <package checked="false" name="MISRAC2012">
-            <group checked="true" name="MISRAC2012-Dir-4">
-              <check checked="true" name="MISRAC2012-Dir-4.3"/>
-              <check checked="false" name="MISRAC2012-Dir-4.4"/>
-              <check checked="false" name="MISRAC2012-Dir-4.6_a"/>
-              <check checked="false" name="MISRAC2012-Dir-4.6_b"/>
-              <check checked="false" name="MISRAC2012-Dir-4.9"/>
-              <check checked="true" name="MISRAC2012-Dir-4.10"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-1">
-              <check checked="true" name="MISRAC2012-Rule-1.3_a"/>
-              <check checked="true" name="MISRAC2012-Rule-1.3_b"/>
-              <check checked="true" name="MISRAC2012-Rule-1.3_c"/>
-              <check checked="true" name="MISRAC2012-Rule-1.3_d"/>
-              <check checked="true" name="MISRAC2012-Rule-1.3_e"/>
-              <check checked="true" name="MISRAC2012-Rule-1.3_f"/>
-              <check checked="true" name="MISRAC2012-Rule-1.3_g"/>
-              <check checked="true" name="MISRAC2012-Rule-1.3_h"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-2">
-              <check checked="true" name="MISRAC2012-Rule-2.1_a"/>
-              <check checked="true" name="MISRAC2012-Rule-2.1_b"/>
-              <check checked="true" name="MISRAC2012-Rule-2.2_a"/>
-              <check checked="true" name="MISRAC2012-Rule-2.2_c"/>
-              <check checked="false" name="MISRAC2012-Rule-2.7"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-3">
-              <check checked="true" name="MISRAC2012-Rule-3.1"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-4">
-              <check checked="false" name="MISRAC2012-Rule-4.2"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-5">
-              <check checked="true" name="MISRAC2012-Rule-5.1"/>
-              <check checked="true" name="MISRAC2012-Rule-5.3_a"/>
-              <check checked="true" name="MISRAC2012-Rule-5.3_b"/>
-              <check checked="true" name="MISRAC2012-Rule-5.3_c"/>
-              <check checked="true" name="MISRAC2012-Rule-5.4_c89"/>
-              <check checked="true" name="MISRAC2012-Rule-5.4_c99"/>
-              <check checked="true" name="MISRAC2012-Rule-5.5_c89"/>
-              <check checked="true" name="MISRAC2012-Rule-5.5_c99"/>
-              <check checked="true" name="MISRAC2012-Rule-5.6"/>
-              <check checked="true" name="MISRAC2012-Rule-5.7"/>
-              <check checked="true" name="MISRAC2012-Rule-5.8"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-6">
-              <check checked="true" name="MISRAC2012-Rule-6.1"/>
-              <check checked="true" name="MISRAC2012-Rule-6.2"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-7">
-              <check checked="true" name="MISRAC2012-Rule-7.1"/>
-              <check checked="true" name="MISRAC2012-Rule-7.2"/>
-              <check checked="true" name="MISRAC2012-Rule-7.3"/>
-              <check checked="true" name="MISRAC2012-Rule-7.4_a"/>
-              <check checked="true" name="MISRAC2012-Rule-7.4_b"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-8">
-              <check checked="true" name="MISRAC2012-Rule-8.1"/>
-              <check checked="true" name="MISRAC2012-Rule-8.2_a"/>
-              <check checked="true" name="MISRAC2012-Rule-8.2_b"/>
-              <check checked="true" name="MISRAC2012-Rule-8.10"/>
-              <check checked="false" name="MISRAC2012-Rule-8.11"/>
-              <check checked="true" name="MISRAC2012-Rule-8.14"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-9">
-              <check checked="true" name="MISRAC2012-Rule-9.1_a"/>
-              <check checked="true" name="MISRAC2012-Rule-9.1_b"/>
-              <check checked="true" name="MISRAC2012-Rule-9.1_c"/>
-              <check checked="true" name="MISRAC2012-Rule-9.1_d"/>
-              <check checked="true" name="MISRAC2012-Rule-9.1_e"/>
-              <check checked="true" name="MISRAC2012-Rule-9.1_f"/>
-              <check checked="true" name="MISRAC2012-Rule-9.3"/>
-              <check checked="true" name="MISRAC2012-Rule-9.5_a"/>
-              <check checked="true" name="MISRAC2012-Rule-9.5_b"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-10">
-              <check checked="true" name="MISRAC2012-Rule-10.1_R2"/>
-              <check checked="true" name="MISRAC2012-Rule-10.1_R3"/>
-              <check checked="true" name="MISRAC2012-Rule-10.1_R4"/>
-              <check checked="true" name="MISRAC2012-Rule-10.1_R5"/>
-              <check checked="true" name="MISRAC2012-Rule-10.1_R6"/>
-              <check checked="true" name="MISRAC2012-Rule-10.1_R7"/>
-              <check checked="true" name="MISRAC2012-Rule-10.1_R8"/>
-              <check checked="true" name="MISRAC2012-Rule-10.2"/>
-              <check checked="true" name="MISRAC2012-Rule-10.3"/>
-              <check checked="true" name="MISRAC2012-Rule-10.4"/>
-              <check checked="true" name="MISRAC2012-Rule-10.6"/>
-              <check checked="true" name="MISRAC2012-Rule-10.7"/>
-              <check checked="true" name="MISRAC2012-Rule-10.8"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-11">
-              <check checked="true" name="MISRAC2012-Rule-11.1"/>
-              <check checked="true" name="MISRAC2012-Rule-11.3"/>
-              <check checked="false" name="MISRAC2012-Rule-11.4"/>
-              <check checked="true" name="MISRAC2012-Rule-11.7"/>
-              <check checked="true" name="MISRAC2012-Rule-11.8"/>
-              <check checked="true" name="MISRAC2012-Rule-11.9"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-12">
-              <check checked="false" name="MISRAC2012-Rule-12.1"/>
-              <check checked="true" name="MISRAC2012-Rule-12.2"/>
-              <check checked="false" name="MISRAC2012-Rule-12.3"/>
-              <check checked="false" name="MISRAC2012-Rule-12.4"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-13">
-              <check checked="true" name="MISRAC2012-Rule-13.1"/>
-              <check checked="true" name="MISRAC2012-Rule-13.2_a"/>
-              <check checked="true" name="MISRAC2012-Rule-13.2_b"/>
-              <check checked="true" name="MISRAC2012-Rule-13.2_c"/>
-              <check checked="false" name="MISRAC2012-Rule-13.3"/>
-              <check checked="false" name="MISRAC2012-Rule-13.4_a"/>
-              <check checked="false" name="MISRAC2012-Rule-13.4_b"/>
-              <check checked="true" name="MISRAC2012-Rule-13.5"/>
-              <check checked="true" name="MISRAC2012-Rule-13.6"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-14">
-              <check checked="true" name="MISRAC2012-Rule-14.1_a"/>
-              <check checked="true" name="MISRAC2012-Rule-14.1_b"/>
-              <check checked="true" name="MISRAC2012-Rule-14.2"/>
-              <check checked="true" name="MISRAC2012-Rule-14.3_a"/>
-              <check checked="true" name="MISRAC2012-Rule-14.3_b"/>
-              <check checked="true" name="MISRAC2012-Rule-14.4_a"/>
-              <check checked="true" name="MISRAC2012-Rule-14.4_b"/>
-              <check checked="true" name="MISRAC2012-Rule-14.4_c"/>
-              <check checked="true" name="MISRAC2012-Rule-14.4_d"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-15">
-              <check checked="false" name="MISRAC2012-Rule-15.1"/>
-              <check checked="true" name="MISRAC2012-Rule-15.2"/>
-              <check checked="true" name="MISRAC2012-Rule-15.3"/>
-              <check checked="false" name="MISRAC2012-Rule-15.4"/>
-              <check checked="false" name="MISRAC2012-Rule-15.5"/>
-              <check checked="true" name="MISRAC2012-Rule-15.6_a"/>
-              <check checked="true" name="MISRAC2012-Rule-15.6_b"/>
-              <check checked="true" name="MISRAC2012-Rule-15.6_c"/>
-              <check checked="true" name="MISRAC2012-Rule-15.6_d"/>
-              <check checked="true" name="MISRAC2012-Rule-15.6_e"/>
-              <check checked="true" name="MISRAC2012-Rule-15.7"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-16">
-              <check checked="true" name="MISRAC2012-Rule-16.1"/>
-              <check checked="true" name="MISRAC2012-Rule-16.2"/>
-              <check checked="true" name="MISRAC2012-Rule-16.3"/>
-              <check checked="true" name="MISRAC2012-Rule-16.4"/>
-              <check checked="true" name="MISRAC2012-Rule-16.5"/>
-              <check checked="true" name="MISRAC2012-Rule-16.6"/>
-              <check checked="true" name="MISRAC2012-Rule-16.7"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-17">
-              <check checked="true" name="MISRAC2012-Rule-17.1"/>
-              <check checked="true" name="MISRAC2012-Rule-17.2_a"/>
-              <check checked="true" name="MISRAC2012-Rule-17.2_b"/>
-              <check checked="true" name="MISRAC2012-Rule-17.3"/>
-              <check checked="true" name="MISRAC2012-Rule-17.4"/>
-              <check checked="true" name="MISRAC2012-Rule-17.6"/>
-              <check checked="true" name="MISRAC2012-Rule-17.7"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-18">
-              <check checked="true" name="MISRAC2012-Rule-18.1_a"/>
-              <check checked="true" name="MISRAC2012-Rule-18.1_b"/>
-              <check checked="true" name="MISRAC2012-Rule-18.1_c"/>
-              <check checked="true" name="MISRAC2012-Rule-18.1_d"/>
-              <check checked="false" name="MISRAC2012-Rule-18.5"/>
-              <check checked="true" name="MISRAC2012-Rule-18.6_a"/>
-              <check checked="true" name="MISRAC2012-Rule-18.6_b"/>
-              <check checked="true" name="MISRAC2012-Rule-18.6_c"/>
-              <check checked="true" name="MISRAC2012-Rule-18.6_d"/>
-              <check checked="true" name="MISRAC2012-Rule-18.7"/>
-              <check checked="true" name="MISRAC2012-Rule-18.8"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-19">
-              <check checked="true" name="MISRAC2012-Rule-19.1"/>
-              <check checked="false" name="MISRAC2012-Rule-19.2"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-20">
-              <check checked="true" name="MISRAC2012-Rule-20.2"/>
-              <check checked="true" name="MISRAC2012-Rule-20.4_c89"/>
-              <check checked="true" name="MISRAC2012-Rule-20.4_c99"/>
-              <check checked="false" name="MISRAC2012-Rule-20.5"/>
-              <check checked="false" name="MISRAC2012-Rule-20.10"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-21">
-              <check checked="true" name="MISRAC2012-Rule-21.1"/>
-              <check checked="true" name="MISRAC2012-Rule-21.2"/>
-              <check checked="true" name="MISRAC2012-Rule-21.3"/>
-              <check checked="true" name="MISRAC2012-Rule-21.4"/>
-              <check checked="true" name="MISRAC2012-Rule-21.5"/>
-              <check checked="true" name="MISRAC2012-Rule-21.6"/>
-              <check checked="true" name="MISRAC2012-Rule-21.7"/>
-              <check checked="true" name="MISRAC2012-Rule-21.8"/>
-              <check checked="true" name="MISRAC2012-Rule-21.9"/>
-              <check checked="true" name="MISRAC2012-Rule-21.10"/>
-              <check checked="true" name="MISRAC2012-Rule-21.11"/>
-            </group>
-            <group checked="true" name="MISRAC2012-Rule-22">
-              <check checked="true" name="MISRAC2012-Rule-22.1_a"/>
-              <check checked="true" name="MISRAC2012-Rule-22.1_b"/>
-              <check checked="true" name="MISRAC2012-Rule-22.2_a"/>
-              <check checked="true" name="MISRAC2012-Rule-22.2_b"/>
-              <check checked="true" name="MISRAC2012-Rule-22.2_c"/>
-              <check checked="true" name="MISRAC2012-Rule-22.4"/>
-              <check checked="true" name="MISRAC2012-Rule-22.5_a"/>
-              <check checked="true" name="MISRAC2012-Rule-22.5_b"/>
-              <check checked="true" name="MISRAC2012-Rule-22.6"/>
-            </group>
-          </package>
-          <package checked="false" name="MISRAC++2008">
-            <group checked="true" name="MISRAC++2008-0-1">
-              <check checked="true" name="MISRAC++2008-0-1-1"/>
-              <check checked="true" name="MISRAC++2008-0-1-2_a"/>
-              <check checked="true" name="MISRAC++2008-0-1-2_b"/>
-              <check checked="true" name="MISRAC++2008-0-1-2_c"/>
-              <check checked="true" name="MISRAC++2008-0-1-3"/>
-              <check checked="true" name="MISRAC++2008-0-1-4"/>
-              <check checked="true" name="MISRAC++2008-0-1-6"/>
-              <check checked="true" name="MISRAC++2008-0-1-7"/>
-              <check checked="false" name="MISRAC++2008-0-1-8"/>
-              <check checked="true" name="MISRAC++2008-0-1-9"/>
-              <check checked="true" name="MISRAC++2008-0-1-11"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-0-2">
-              <check checked="true" name="MISRAC++2008-0-2-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-0-3">
-              <check checked="true" name="MISRAC++2008-0-3-2"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-2-3">
-              <check checked="true" name="MISRAC++2008-2-3-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-2-7">
-              <check checked="true" name="MISRAC++2008-2-7-1"/>
-              <check checked="true" name="MISRAC++2008-2-7-2"/>
-              <check checked="false" name="MISRAC++2008-2-7-3"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-2-10">
-              <check checked="true" name="MISRAC++2008-2-10-2_a"/>
-              <check checked="true" name="MISRAC++2008-2-10-2_b"/>
-              <check checked="true" name="MISRAC++2008-2-10-2_c"/>
-              <check checked="true" name="MISRAC++2008-2-10-2_d"/>
-              <check checked="true" name="MISRAC++2008-2-10-3"/>
-              <check checked="true" name="MISRAC++2008-2-10-4"/>
-              <check checked="false" name="MISRAC++2008-2-10-5"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-2-13">
-              <check checked="true" name="MISRAC++2008-2-13-2"/>
-              <check checked="true" name="MISRAC++2008-2-13-3"/>
-              <check checked="true" name="MISRAC++2008-2-13-4_a"/>
-              <check checked="true" name="MISRAC++2008-2-13-4_b"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-3-1">
-              <check checked="true" name="MISRAC++2008-3-1-1"/>
-              <check checked="true" name="MISRAC++2008-3-1-3"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-3-9">
-              <check checked="false" name="MISRAC++2008-3-9-2"/>
-              <check checked="true" name="MISRAC++2008-3-9-3"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-4-5">
-              <check checked="true" name="MISRAC++2008-4-5-1"/>
-              <check checked="true" name="MISRAC++2008-4-5-2"/>
-              <check checked="true" name="MISRAC++2008-4-5-3"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-5-0">
-              <check checked="true" name="MISRAC++2008-5-0-1_a"/>
-              <check checked="true" name="MISRAC++2008-5-0-1_b"/>
-              <check checked="true" name="MISRAC++2008-5-0-1_c"/>
-              <check checked="false" name="MISRAC++2008-5-0-2"/>
-              <check checked="true" name="MISRAC++2008-5-0-3"/>
-              <check checked="true" name="MISRAC++2008-5-0-4"/>
-              <check checked="true" name="MISRAC++2008-5-0-5"/>
-              <check checked="true" name="MISRAC++2008-5-0-6"/>
-              <check checked="true" name="MISRAC++2008-5-0-7"/>
-              <check checked="true" name="MISRAC++2008-5-0-8"/>
-              <check checked="true" name="MISRAC++2008-5-0-9"/>
-              <check checked="true" name="MISRAC++2008-5-0-10"/>
-              <check checked="true" name="MISRAC++2008-5-0-13_a"/>
-              <check checked="true" name="MISRAC++2008-5-0-13_b"/>
-              <check checked="true" name="MISRAC++2008-5-0-13_c"/>
-              <check checked="true" name="MISRAC++2008-5-0-13_d"/>
-              <check checked="true" name="MISRAC++2008-5-0-14"/>
-              <check checked="true" name="MISRAC++2008-5-0-15_a"/>
-              <check checked="true" name="MISRAC++2008-5-0-15_b"/>
-              <check checked="true" name="MISRAC++2008-5-0-16_a"/>
-              <check checked="true" name="MISRAC++2008-5-0-16_b"/>
-              <check checked="true" name="MISRAC++2008-5-0-16_c"/>
-              <check checked="true" name="MISRAC++2008-5-0-16_d"/>
-              <check checked="true" name="MISRAC++2008-5-0-16_e"/>
-              <check checked="true" name="MISRAC++2008-5-0-16_f"/>
-              <check checked="true" name="MISRAC++2008-5-0-19"/>
-              <check checked="true" name="MISRAC++2008-5-0-21"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-5-2">
-              <check checked="true" name="MISRAC++2008-5-2-4"/>
-              <check checked="true" name="MISRAC++2008-5-2-5"/>
-              <check checked="true" name="MISRAC++2008-5-2-6"/>
-              <check checked="true" name="MISRAC++2008-5-2-7"/>
-              <check checked="false" name="MISRAC++2008-5-2-9"/>
-              <check checked="false" name="MISRAC++2008-5-2-10"/>
-              <check checked="true" name="MISRAC++2008-5-2-11_a"/>
-              <check checked="true" name="MISRAC++2008-5-2-11_b"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-5-3">
-              <check checked="true" name="MISRAC++2008-5-3-1"/>
-              <check checked="true" name="MISRAC++2008-5-3-2_a"/>
-              <check checked="true" name="MISRAC++2008-5-3-2_b"/>
-              <check checked="true" name="MISRAC++2008-5-3-3"/>
-              <check checked="true" name="MISRAC++2008-5-3-4"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-5-8">
-              <check checked="true" name="MISRAC++2008-5-8-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-5-14">
-              <check checked="true" name="MISRAC++2008-5-14-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-5-18">
-              <check checked="true" name="MISRAC++2008-5-18-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-5-19">
-              <check checked="false" name="MISRAC++2008-5-19-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-6-2">
-              <check checked="true" name="MISRAC++2008-6-2-1"/>
-              <check checked="true" name="MISRAC++2008-6-2-2"/>
-              <check checked="true" name="MISRAC++2008-6-2-3"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-6-3">
-              <check checked="true" name="MISRAC++2008-6-3-1_a"/>
-              <check checked="true" name="MISRAC++2008-6-3-1_b"/>
-              <check checked="true" name="MISRAC++2008-6-3-1_c"/>
-              <check checked="true" name="MISRAC++2008-6-3-1_d"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-6-4">
-              <check checked="true" name="MISRAC++2008-6-4-1"/>
-              <check checked="true" name="MISRAC++2008-6-4-2"/>
-              <check checked="true" name="MISRAC++2008-6-4-3"/>
-              <check checked="true" name="MISRAC++2008-6-4-4"/>
-              <check checked="true" name="MISRAC++2008-6-4-5"/>
-              <check checked="true" name="MISRAC++2008-6-4-6"/>
-              <check checked="true" name="MISRAC++2008-6-4-7"/>
-              <check checked="true" name="MISRAC++2008-6-4-8"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-6-5">
-              <check checked="true" name="MISRAC++2008-6-5-1_a"/>
-              <check checked="true" name="MISRAC++2008-6-5-2"/>
-              <check checked="true" name="MISRAC++2008-6-5-3"/>
-              <check checked="true" name="MISRAC++2008-6-5-4"/>
-              <check checked="true" name="MISRAC++2008-6-5-6"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-6-6">
-              <check checked="true" name="MISRAC++2008-6-6-1"/>
-              <check checked="true" name="MISRAC++2008-6-6-2"/>
-              <check checked="true" name="MISRAC++2008-6-6-4"/>
-              <check checked="true" name="MISRAC++2008-6-6-5"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-7-1">
-              <check checked="true" name="MISRAC++2008-7-1-1"/>
-              <check checked="true" name="MISRAC++2008-7-1-2"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-7-2">
-              <check checked="true" name="MISRAC++2008-7-2-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-7-4">
-              <check checked="true" name="MISRAC++2008-7-4-3"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-7-5">
-              <check checked="true" name="MISRAC++2008-7-5-1_a"/>
-              <check checked="true" name="MISRAC++2008-7-5-1_b"/>
-              <check checked="true" name="MISRAC++2008-7-5-2_a"/>
-              <check checked="true" name="MISRAC++2008-7-5-2_b"/>
-              <check checked="true" name="MISRAC++2008-7-5-2_c"/>
-              <check checked="true" name="MISRAC++2008-7-5-2_d"/>
-              <check checked="false" name="MISRAC++2008-7-5-4_a"/>
-              <check checked="false" name="MISRAC++2008-7-5-4_b"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-8-0">
-              <check checked="true" name="MISRAC++2008-8-0-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-8-4">
-              <check checked="true" name="MISRAC++2008-8-4-1"/>
-              <check checked="true" name="MISRAC++2008-8-4-3"/>
-              <check checked="true" name="MISRAC++2008-8-4-4"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-8-5">
-              <check checked="true" name="MISRAC++2008-8-5-1_a"/>
-              <check checked="true" name="MISRAC++2008-8-5-1_b"/>
-              <check checked="true" name="MISRAC++2008-8-5-1_c"/>
-              <check checked="true" name="MISRAC++2008-8-5-2"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-9-3">
-              <check checked="true" name="MISRAC++2008-9-3-1"/>
-              <check checked="true" name="MISRAC++2008-9-3-2"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-9-5">
-              <check checked="true" name="MISRAC++2008-9-5-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-9-6">
-              <check checked="true" name="MISRAC++2008-9-6-2"/>
-              <check checked="true" name="MISRAC++2008-9-6-3"/>
-              <check checked="true" name="MISRAC++2008-9-6-4"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-12-1">
-              <check checked="true" name="MISRAC++2008-12-1-1_a"/>
-              <check checked="true" name="MISRAC++2008-12-1-1_b"/>
-              <check checked="true" name="MISRAC++2008-12-1-3"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-15-0">
-              <check checked="false" name="MISRAC++2008-15-0-2"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-15-1">
-              <check checked="true" name="MISRAC++2008-15-1-2"/>
-              <check checked="true" name="MISRAC++2008-15-1-3"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-15-3">
-              <check checked="true" name="MISRAC++2008-15-3-1"/>
-              <check checked="false" name="MISRAC++2008-15-3-2"/>
-              <check checked="true" name="MISRAC++2008-15-3-3"/>
-              <check checked="true" name="MISRAC++2008-15-3-4"/>
-              <check checked="true" name="MISRAC++2008-15-3-5"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-15-5">
-              <check checked="true" name="MISRAC++2008-15-5-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-16-0">
-              <check checked="true" name="MISRAC++2008-16-0-3"/>
-              <check checked="true" name="MISRAC++2008-16-0-4"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-16-2">
-              <check checked="true" name="MISRAC++2008-16-2-2"/>
-              <check checked="true" name="MISRAC++2008-16-2-3"/>
-              <check checked="true" name="MISRAC++2008-16-2-4"/>
-              <check checked="false" name="MISRAC++2008-16-2-5"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-16-3">
-              <check checked="true" name="MISRAC++2008-16-3-1"/>
-              <check checked="false" name="MISRAC++2008-16-3-2"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-17-0">
-              <check checked="true" name="MISRAC++2008-17-0-1"/>
-              <check checked="true" name="MISRAC++2008-17-0-3"/>
-              <check checked="true" name="MISRAC++2008-17-0-5"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-18-0">
-              <check checked="true" name="MISRAC++2008-18-0-1"/>
-              <check checked="true" name="MISRAC++2008-18-0-2"/>
-              <check checked="true" name="MISRAC++2008-18-0-3"/>
-              <check checked="true" name="MISRAC++2008-18-0-4"/>
-              <check checked="true" name="MISRAC++2008-18-0-5"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-18-2">
-              <check checked="true" name="MISRAC++2008-18-2-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-18-4">
-              <check checked="true" name="MISRAC++2008-18-4-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-18-7">
-              <check checked="true" name="MISRAC++2008-18-7-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-19-3">
-              <check checked="true" name="MISRAC++2008-19-3-1"/>
-            </group>
-            <group checked="true" name="MISRAC++2008-27-0">
-              <check checked="true" name="MISRAC++2008-27-0-1"/>
-            </group>
-          </package>
-        </cstatsettings>
-      </data>
-    </settings>
-    <settings>
-      <name>RuntimeChecking</name>
-      <archiveVersion>0</archiveVersion>
-      <data>
-        <version>2</version>
-        <wantNonLocal>1</wantNonLocal>
-        <debug>0</debug>
-        <option>
-          <name>GenRtcDebugHeap</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcEnableBoundsChecking</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcCheckPtrsNonInstrMem</name>
-          <state>1</state>
-        </option>
-        <option>
-          <name>GenRtcTrackPointerBounds</name>
-          <state>1</state>
-        </option>
-        <option>
-          <name>GenRtcCheckAccesses</name>
-          <state>1</state>
-        </option>
-        <option>
-          <name>GenRtcGenerateEntries</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcNrTrackedPointers</name>
-          <state>1000</state>
-        </option>
-        <option>
-          <name>GenRtcIntOverflow</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcIncUnsigned</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcIntConversion</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcInclExplicit</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcIntShiftOverflow</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcInclUnsignedShiftOverflow</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcUnhandledCase</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcDivByZero</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcEnable</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GenRtcCheckPtrsNonInstrFunc</name>
-          <state>1</state>
-        </option>
-      </data>
-    </settings>
-  </configuration>
-  <group>
-    <name>ameba_drivers</name>
-  </group>
-  <group>
-    <name>ameba_wifi</name>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\api\wifi\wifi_conf.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\api\wifi\rtw_wpa_supplicant\wpa_supplicant\wifi_eap_config.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\api\wifi\wifi_ind.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\api\wifi\wifi_promisc.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\api\wifi\wifi_util.c</name>
-    </file>
-  </group>
-  <group>
-    <name>Applications</name>
-    <file>
-      <name>$PROJ_DIR$\applications\application.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\applications\startup.c</name>
-    </file>
-  </group>
-  <group>
-    <name>CORTEX-M4</name>
-    <file>
-      <name>$PROJ_DIR$\..\..\libcpu\arm\common\backtrace.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\libcpu\arm\cortex-m4\context_iar.S</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\libcpu\arm\cortex-m4\cpuport.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\libcpu\arm\common\div0.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\libcpu\arm\common\showmem.c</name>
-    </file>
-  </group>
-  <group>
-    <name>DeviceDrivers</name>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\drivers\src\completion.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\drivers\src\dataqueue.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\drivers\misc\pin.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\drivers\src\pipe.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\drivers\src\ringbuffer.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\drivers\serial\serial.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\drivers\src\waitqueue.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\drivers\src\workqueue.c</name>
-    </file>
-  </group>
-  <group>
-    <name>Drivers</name>
-    <file>
-      <name>$PROJ_DIR$\drivers\board.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\drivers\drv_uart.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\drivers\drv_wifi.c</name>
-    </file>
-  </group>
-  <group>
-    <name>finsh</name>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\cmd.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_compiler.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_error.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_heap.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_init.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_node.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_ops.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_parser.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_token.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_var.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_vm.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\msh.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\msh_cmd.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\msh_file.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\shell.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\symbol.c</name>
-    </file>
-  </group>
-  <group>
-    <name>Kernel</name>
-    <file>
-      <name>$PROJ_DIR$\..\..\src\clock.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\src\components.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\src\device.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\src\idle.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\src\ipc.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\src\irq.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\src\kservice.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\src\mem.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\src\mempool.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\src\object.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\src\scheduler.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\src\signal.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\src\thread.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\src\timer.c</name>
-    </file>
-  </group>
-  <group>
-    <name>LwIP</name>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\api\api_lib.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\api\api_msg.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\ipv4\autoip.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\def.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\dhcp.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\dns.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\api\err.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\netif\etharp.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\netif\ethernetif.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\ipv4\icmp.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\ipv4\igmp.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\ipv4\inet.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\ipv4\inet_chksum.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\init.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\ipv4\ip.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\ipv4\ip_addr.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\ipv4\ip_frag.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\memp.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\api\netbuf.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\api\netdb.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\netif.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\api\netifapi.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\pbuf.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\raw.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\netif\slipif.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\api\sockets.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\stats.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\sys.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\arch\sys_arch.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\tcp.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\tcp_in.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\tcp_out.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\api\tcpip.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\timers.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\udp.c</name>
-    </file>
-  </group>
-  <group>
-    <name>mbed</name>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\analogin_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\dma_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\efuse_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\flash_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\gpio_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\gpio_irq_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\i2c_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\i2s_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\nfc_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\pinmap.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\pinmap_common.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\port_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\pwmout_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\rtc_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\serial_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\sleep.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\spi_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\sys_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\timer_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\us_ticker.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\us_ticker_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\wait_api.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\mbed\targets\hal\rtl8711b\wdt_api.c</name>
-    </file>
-  </group>
-  <group>
-    <name>os_dep</name>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\os\os_dep\osdep_service.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\os\rt-thread\rtthread_service.c</name>
-    </file>
-  </group>
-  <group>
-    <name>polarssl</name>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\common\network\ssl\ssl_ram_map\ssl_ram_map.c</name>
-    </file>
-  </group>
-  <group>
-    <name>soc_8711b</name>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\soc\realtek\8711b\cmsis\device\app_start.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\soc\realtek\8711b\app\monitor\ram\low_level_io.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\soc\realtek\8711b\app\monitor\ram\monitor.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\soc\realtek\8711b\fwlib\ram_lib\rt8710b_startup.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\soc\realtek\8711b\fwlib\ram_lib\rtl8710b_intfcfg.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\soc\realtek\8711b\fwlib\ram_lib\rtl8710b_pinmapcfg.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\soc\realtek\8711b\app\monitor\ram\rtl_consol.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\packages\realtek_ameba\soc\realtek\8711b\cmsis\device\system_8195a.c</name>
-    </file>
-  </group>
-</project>
-
-

+ 56 - 12
bsp/amebaz/rtconfig.h

@@ -11,15 +11,14 @@
 #define RT_THREAD_PRIORITY_32
 #define RT_THREAD_PRIORITY_MAX 32
 #define RT_TICK_PER_SECOND 1000
-#define RT_DEBUG
 #define RT_USING_OVERFLOW_CHECK
-#define RT_DEBUG_INIT 0
-#define RT_DEBUG_THREAD 0
 #define RT_USING_HOOK
+#define RT_IDEL_HOOK_LIST_SIZE 4
 #define IDLE_THREAD_STACK_SIZE 256
 #define RT_USING_TIMER_SOFT
 #define RT_TIMER_THREAD_PRIO 4
-#define RT_TIMER_THREAD_STACK_SIZE 512
+#define RT_TIMER_THREAD_STACK_SIZE 1024
+#define RT_DEBUG
 
 /* Inter-Thread communication */
 
@@ -45,6 +44,9 @@
 /* RT-Thread Components */
 
 #define RT_USING_COMPONENTS_INIT
+#define RT_USING_USER_MAIN
+#define RT_MAIN_THREAD_STACK_SIZE 2048
+#define RT_MAIN_THREAD_PRIORITY 10
 
 /* C++ features */
 
@@ -62,6 +64,7 @@
 #define FINSH_CMD_SIZE 80
 #define FINSH_USING_MSH
 #define FINSH_USING_MSH_DEFAULT
+#define FINSH_USING_MSH_ONLY
 #define FINSH_ARG_MAX 10
 
 /* Device virtual file system */
@@ -70,13 +73,27 @@
 /* Device Drivers */
 
 #define RT_USING_DEVICE_IPC
+#define RT_PIPE_BUFSZ 512
 #define RT_USING_SERIAL
-#define RT_USING_PIN
+
+/* Using WiFi */
+
 #define RT_USING_WIFI
-#define RT_USING_WLAN_STA
-#define RT_USING_WLAN_AP
-#define WIFI_DEVICE_STA_NAME "w0"
-#define WIFI_DEVICE_AP_NAME "ap"
+#define RT_WLAN_DEVICE_STA_NAME "wlan0"
+#define RT_WLAN_DEVICE_AP_NAME "wlan1"
+#define RT_WLAN_DEFAULT_PROT "lwip"
+#define RT_WLAN_SCAN_WAIT_MS 10000
+#define RT_WLAN_CONNECT_WAIT_MS 10000
+#define RT_WLAN_SSID_MAX_LENGTH 32
+#define RT_WLAN_PASSWORD_MAX_LENGTH 32
+#define RT_WLAN_SCAN_SORT
+#define RT_WLAN_CFG_INFO_MAX 3
+#define RT_WLAN_WORKQUEUE_THREAD_NAME "wlan_job"
+#define RT_WLAN_WORKQUEUE_THREAD_SIZE 2048
+#define RT_WLAN_WORKQUEUE_THREAD_PRIO 22
+#define RT_WLAN_DEV_EVENT_NUM 2
+#define RT_WLAN_DEBUG
+#define RT_WLAN_CMD_DEBUG
 
 /* Using USB */
 
@@ -85,12 +102,15 @@
 
 #define RT_USING_LIBC
 
-/* Network stack */
+/* Network */
+
+/* Socket abstraction layer */
+
 
 /* light weight TCP/IP stack */
 
 #define RT_USING_LWIP
-#define RT_USING_LWIP141
+#define RT_USING_LWIP202
 #define RT_LWIP_IGMP
 #define RT_LWIP_ICMP
 #define RT_LWIP_DNS
@@ -129,6 +149,12 @@
 /* Modbus master and slave stack */
 
 
+/* AT commands */
+
+#define LWIP_USING_DHCPD
+#define DHCPD_SERVER_IP "192.168.169.1"
+#define DHCPD_USING_ROUTER
+
 /* VBUS(Virtual Software BUS) */
 
 
@@ -148,6 +174,9 @@
 /* Wiced WiFi */
 
 
+/* IoT Cloud */
+
+
 /* security packages */
 
 
@@ -173,12 +202,27 @@
 
 /* sample package */
 
+/* samples: kernel and components samples */
+
 
 /* example package: hello */
 
 
+/* Privated Packages of RealThread */
+
+
+/* Network Utilities */
+
+
+/* Test Packages of RealThread */
+
+
 /* Env config */
 
-#define RT_USING_UART0
+
+/* External Libraries */
+
+#define RT_USING_SMARTCONFIG_LIB
+#define BSP_USING_WIFI
 
 #endif

+ 20 - 36
bsp/amebaz/rtconfig.py

@@ -9,12 +9,17 @@ if os.getenv('RTT_CC'):
     CROSS_TOOL = os.getenv('RTT_CC')
 if os.getenv('RTT_ROOT'):
     RTT_ROOT = os.getenv('RTT_ROOT')
+else:
+    RTT_ROOT = os.path.join(os.path.normpath(os.getcwd()), 'rt-thread')
 
 # cross_tool provides the cross compiler
 # EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR
 if  CROSS_TOOL == 'gcc':
     PLATFORM 	= 'gcc'
-    EXEC_PATH 	= r'/opt/gcc-arm-none-eabi-5_4-2016q3/bin'
+    EXEC_PATH 	= 'C:/work/env/tools/gnu_gcc/arm_gcc/mingw/bin'
+elif CROSS_TOOL == 'iar':
+    PLATFORM     = 'iar'
+    EXEC_PATH    = 'C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.0'
 else:
     print 'Please make sure your toolchains is GNU GCC!'
     exit(0)
@@ -39,7 +44,7 @@ if PLATFORM == 'gcc':
     NM = PREFIX + 'nm'
 
     DEVICE = ' -DM3 -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
-    CFLAGS = DEVICE + ' -g2 -w -O2 -Wno-pointer-sign -fno-common -fmessage-length=0  -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-short-enums -DF_CPU=166000000L -std=gnu99 -fsigned-char'
+    CFLAGS = DEVICE + ' -g2 -Wall -Wno-pointer-sign -fno-common -fmessage-length=0  -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-short-enums -DF_CPU=166000000L -std=gnu99 -fsigned-char'
     AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
     LFLAGS = DEVICE + ' -lm -lgcc -lc' + ' -g --specs=nano.specs -nostartfiles -Wl,-Map=rtthread.map -Os -Wl,--gc-sections -Wl,--cref -Wl,--entry=Reset_Handler -Wl,--no-enum-size-warning -Wl,--no-wchar-size-warning -T./rlx8711B-symbol-v02-img2_xip1.ld'
     LFLAGS += ' -Wl,-wrap,rtl_printf'
@@ -48,7 +53,7 @@ if PLATFORM == 'gcc':
     LPATH = ''
 
     if BUILD == 'debug':
-        CFLAGS += ' -O0 -gdwarf-2'
+        CFLAGS += ' -Os -gdwarf-2'
         AFLAGS += ' -gdwarf-2'
     else:
         CFLAGS += ' -O2'
@@ -61,32 +66,6 @@ if PLATFORM == 'gcc':
 
     M_CFLAGS = CFLAGS + ' -mlong-calls  -Dsourcerygxx -O0 -fPIC '
     M_LFLAGS = DEVICE + ' -Wl,-z,max-page-size=0x4 -shared -fPIC -e main -nostdlib'
-	
-elif PLATFORM == 'armcc':
-    # toolchains
-    CC = 'armcc'
-    AS = 'armasm'
-    AR = 'armar'
-    LINK = 'armlink'
-    TARGET_EXT = 'axf'
-
-    DEVICE = ' --cpu=cortex-m4.fp'
-    CFLAGS = DEVICE + ' --apcs=interwork -DSTM32F429_439xx'
-    AFLAGS = DEVICE
-    LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread-stm32.map --scatter stm32f429_flash.sct'
-
-    CFLAGS += ' -I' + EXEC_PATH + '/ARM/RV31/INC'
-    LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/RV31/LIB'
-
-    EXEC_PATH += '/arm/bin40/'
-
-    if BUILD == 'debug':
-        CFLAGS += ' -g -O0'
-        AFLAGS += ' -g'
-    else:
-        CFLAGS += ' -O2'
-
-    POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
 
 elif PLATFORM == 'iar':
     # toolchains
@@ -96,7 +75,7 @@ elif PLATFORM == 'iar':
     LINK = 'ilinkarm'
     TARGET_EXT = 'out'
 
-    DEVICE = ' -D USE_STDPERIPH_DRIVER' + ' -D STM32F10X_HD'
+    DEVICE = '-Dewarm'
 
     CFLAGS = DEVICE
     CFLAGS += ' --diag_suppress Pa050'
@@ -107,26 +86,31 @@ elif PLATFORM == 'iar':
     CFLAGS += ' --no_tbaa'
     CFLAGS += ' --no_clustering'
     CFLAGS += ' --no_scheduling'
-    CFLAGS += ' --debug'
     CFLAGS += ' --endian=little'
     CFLAGS += ' --cpu=Cortex-M4'
     CFLAGS += ' -e'
     CFLAGS += ' --fpu=None'
     CFLAGS += ' --dlib_config "' + EXEC_PATH + '/arm/INC/c/DLib_Config_Normal.h"'
-    CFLAGS += ' -Ol'
-    CFLAGS += ' --use_c++_inline'
+    CFLAGS += ' --silent'
 
-    AFLAGS = ''
+    AFLAGS = DEVICE
     AFLAGS += ' -s+'
     AFLAGS += ' -w+'
     AFLAGS += ' -r'
     AFLAGS += ' --cpu Cortex-M4'
     AFLAGS += ' --fpu None'
+    AFLAGS += ' -S'
+
+    if BUILD == 'debug':
+        CFLAGS += ' --debug'
+        CFLAGS += ' -On'
+    else:
+        CFLAGS += ' -Oh'
 
-    LFLAGS = ' --config stm32f429_flash.icf'
+    LFLAGS = ' --config rom_symbol_v01_iar.icf'
     LFLAGS += ' --redirect _Printf=_PrintfTiny'
     LFLAGS += ' --redirect _Scanf=_ScanfSmall'
     LFLAGS += ' --entry __iar_program_start'
 
     EXEC_PATH = EXEC_PATH + '/arm/bin/'
-    POST_ACTION = ''
+    POST_ACTION = 'ielftool --bin $TARGET rt-thread.bin'

+ 21 - 265
bsp/amebaz/template.ewd

@@ -45,7 +45,7 @@
         </option>
         <option>
           <name>MemFile</name>
-          <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\misc\iar_utility\common\8710b.ddf</state>
+          <state>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\misc\iar_utility\common\preload.mac</state>
         </option>
         <option>
           <name>RunToEnable</name>
@@ -81,7 +81,7 @@
         </option>
         <option>
           <name>OCProductVersion</name>
-          <state>7.40.3.8937</state>
+          <state>7.30.4.8186</state>
         </option>
         <option>
           <name>OCDynDriverList</name>
@@ -89,7 +89,7 @@
         </option>
         <option>
           <name>OCLastSavedByProductVersion</name>
-          <state>7.40.3.8937</state>
+          <state>7.30.4.8186</state>
         </option>
         <option>
           <name>OCDownloadAttachToProgram</name>
@@ -520,7 +520,7 @@
       <name>IJET_ID</name>
       <archiveVersion>2</archiveVersion>
       <data>
-        <version>6</version>
+        <version>5</version>
         <wantNonLocal>1</wantNonLocal>
         <debug>1</debug>
         <option>
@@ -603,7 +603,7 @@
         </option>
         <option>
           <name>IjetCpuClockEdit</name>
-          <state></state>
+          <state>72.0</state>
         </option>
         <option>
           <name>IjetSwoPrescalerList</name>
@@ -732,10 +732,6 @@
           <version>0</version>
           <state>2</state>
         </option>
-        <option>
-          <name>FlashBoardPathSlave</name>
-          <state>0</state>
-        </option>
       </data>
     </settings>
     <settings>
@@ -844,7 +840,7 @@
         </option>
         <option>
           <name>CCJLinkInterfaceRadio</name>
-          <state>0</state>
+          <state>1</state>
         </option>
         <option>
           <name>OCJLinkAttachSlave</name>
@@ -1256,7 +1252,7 @@
       <name>XDS100_ID</name>
       <archiveVersion>2</archiveVersion>
       <data>
-        <version>4</version>
+        <version>2</version>
         <wantNonLocal>1</wantNonLocal>
         <debug>1</debug>
         <option>
@@ -1275,6 +1271,11 @@
           <name>TIPackage</name>
           <state></state>
         </option>
+        <option>
+          <name>CCXds100InterfaceList</name>
+          <version>2</version>
+          <state>0</state>
+        </option>
         <option>
           <name>BoardFile</name>
           <state></state>
@@ -1287,129 +1288,6 @@
           <name>LogFile</name>
           <state>$PROJ_DIR$\cspycomm.log</state>
         </option>
-        <option>
-          <name>CCXds100BreakpointRadio</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100DoUpdateBreakpoints</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100UpdateBreakpoints</name>
-          <state>_call_main</state>
-        </option>
-        <option>
-          <name>CCXds100CatchReset</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchUndef</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchSWI</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchData</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchPrefetch</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchIRQ</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchFIQ</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchCORERESET</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchMMERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchNOCPERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchCHRERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchSTATERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchBUSERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchINTERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchHARDERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchDummy</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CpuClockEdit</name>
-          <state>72.0</state>
-        </option>
-        <option>
-          <name>CCXds100SwoClockAuto</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100SwoClockEdit</name>
-          <state>1000</state>
-        </option>
-        <option>
-          <name>CCXds100HWResetDelay</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100ResetList</name>
-          <version>0</version>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100UsbSerialNo</name>
-          <state></state>
-        </option>
-        <option>
-          <name>CCXds100UsbSerialNoSelect</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100JtagSpeedList</name>
-          <version>0</version>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100InterfaceRadio</name>
-          <state>2</state>
-        </option>
-        <option>
-          <name>CCXds100InterfaceCmdLine</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100ProbeList</name>
-          <version>0</version>
-          <state>0</state>
-        </option>
       </data>
     </settings>
     <debuggerPlugins>
@@ -1566,7 +1444,7 @@
         </option>
         <option>
           <name>OCProductVersion</name>
-          <state>7.40.3.8937</state>
+          <state>7.30.4.8186</state>
         </option>
         <option>
           <name>OCDynDriverList</name>
@@ -1670,7 +1548,7 @@
         </option>
         <option>
           <name>OCMulticoreNrOfCores</name>
-          <state></state>
+          <state>1</state>
         </option>
         <option>
           <name>OCMulticoreMaster</name>
@@ -2005,7 +1883,7 @@
       <name>IJET_ID</name>
       <archiveVersion>2</archiveVersion>
       <data>
-        <version>6</version>
+        <version>5</version>
         <wantNonLocal>1</wantNonLocal>
         <debug>0</debug>
         <option>
@@ -2217,10 +2095,6 @@
           <version>0</version>
           <state>2</state>
         </option>
-        <option>
-          <name>FlashBoardPathSlave</name>
-          <state>0</state>
-        </option>
       </data>
     </settings>
     <settings>
@@ -2741,7 +2615,7 @@
       <name>XDS100_ID</name>
       <archiveVersion>2</archiveVersion>
       <data>
-        <version>4</version>
+        <version>2</version>
         <wantNonLocal>1</wantNonLocal>
         <debug>0</debug>
         <option>
@@ -2760,6 +2634,11 @@
           <name>TIPackage</name>
           <state></state>
         </option>
+        <option>
+          <name>CCXds100InterfaceList</name>
+          <version>2</version>
+          <state>0</state>
+        </option>
         <option>
           <name>BoardFile</name>
           <state></state>
@@ -2772,129 +2651,6 @@
           <name>LogFile</name>
           <state>$PROJ_DIR$\cspycomm.log</state>
         </option>
-        <option>
-          <name>CCXds100BreakpointRadio</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100DoUpdateBreakpoints</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100UpdateBreakpoints</name>
-          <state>_call_main</state>
-        </option>
-        <option>
-          <name>CCXds100CatchReset</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchUndef</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchSWI</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchData</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchPrefetch</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchIRQ</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchFIQ</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchCORERESET</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchMMERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchNOCPERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchCHRERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchSTATERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchBUSERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchINTERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchHARDERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CatchDummy</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100CpuClockEdit</name>
-          <state>72.0</state>
-        </option>
-        <option>
-          <name>CCXds100SwoClockAuto</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100SwoClockEdit</name>
-          <state>1000</state>
-        </option>
-        <option>
-          <name>CCXds100HWResetDelay</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100ResetList</name>
-          <version>0</version>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100UsbSerialNo</name>
-          <state></state>
-        </option>
-        <option>
-          <name>CCXds100UsbSerialNoSelect</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100JtagSpeedList</name>
-          <version>0</version>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100InterfaceRadio</name>
-          <state>2</state>
-        </option>
-        <option>
-          <name>CCXds100InterfaceCmdLine</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCXds100ProbeList</name>
-          <version>0</version>
-          <state>0</state>
-        </option>
       </data>
     </settings>
     <debuggerPlugins>

+ 57 - 76
bsp/amebaz/template.ewp

@@ -12,7 +12,7 @@
       <name>General</name>
       <archiveVersion>3</archiveVersion>
       <data>
-        <version>24</version>
+        <version>22</version>
         <wantNonLocal>1</wantNonLocal>
         <debug>1</debug>
         <option>
@@ -27,6 +27,11 @@
           <name>ListPath</name>
           <state>Debug\List</state>
         </option>
+        <option>
+          <name>Variant</name>
+          <version>21</version>
+          <state>39</state>
+        </option>
         <option>
           <name>GEndianMode</name>
           <state>0</state>
@@ -34,25 +39,30 @@
         <option>
           <name>Input variant</name>
           <version>3</version>
-          <state>7</state>
+          <state>0</state>
         </option>
         <option>
           <name>Input description</name>
-          <state>No specifier n, no float nor long long, no scan set, no assignment suppressing, without multibyte support.</state>
+          <state>Automatic choice of formatter.</state>
         </option>
         <option>
           <name>Output variant</name>
           <version>2</version>
-          <state>7</state>
+          <state>0</state>
         </option>
         <option>
           <name>Output description</name>
-          <state>No specifier a, A, no specifier n, no float nor long long, no flags.</state>
+          <state>Automatic choice of formatter.</state>
         </option>
         <option>
           <name>GOutputBinary</name>
           <state>0</state>
         </option>
+        <option>
+          <name>FPU</name>
+          <version>3</version>
+          <state>5</state>
+        </option>
         <option>
           <name>OGCoreOrChip</name>
           <state>0</state>
@@ -73,11 +83,11 @@
         </option>
         <option>
           <name>OGProductVersion</name>
-          <state>6.10.1.52170</state>
+          <state>7.30.4.8186</state>
         </option>
         <option>
           <name>OGLastSavedByProductVersion</name>
-          <state>7.40.3.8937</state>
+          <state>7.30.4.8186</state>
         </option>
         <option>
           <name>GeneralEnableMisra</name>
@@ -89,11 +99,11 @@
         </option>
         <option>
           <name>OGChipSelectEditMenu</name>
-          <state>STM32F107xC	ST STM32F107xC</state>
+          <state>Default	None</state>
         </option>
         <option>
           <name>GenLowLevelInterface</name>
-          <state>0</state>
+          <state>1</state>
         </option>
         <option>
           <name>GEndianModeBE</name>
@@ -125,9 +135,14 @@
           <name>RTConfigPath2</name>
           <state>$TOOLKIT_DIR$\INC\c\DLib_Config_Normal.h</state>
         </option>
+        <option>
+          <name>GFPUCoreSlave</name>
+          <version>21</version>
+          <state>39</state>
+        </option>
         <option>
           <name>GBECoreSlave</name>
-          <version>22</version>
+          <version>21</version>
           <state>39</state>
         </option>
         <option>
@@ -142,34 +157,6 @@
           <name>GRuntimeLibThreads</name>
           <state>0</state>
         </option>
-        <option>
-          <name>CoreVariant</name>
-          <version>22</version>
-          <state>39</state>
-        </option>
-        <option>
-          <name>GFPUDeviceSlave</name>
-          <state>STM32F107xC	ST STM32F107xC</state>
-        </option>
-        <option>
-          <name>FPU2</name>
-          <version>0</version>
-          <state>4</state>
-        </option>
-        <option>
-          <name>NrRegs</name>
-          <version>0</version>
-          <state>1</state>
-        </option>
-        <option>
-          <name>NEON</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GFPUCoreSlave2</name>
-          <version>22</version>
-          <state>39</state>
-        </option>
       </data>
     </settings>
     <settings>
@@ -182,6 +169,13 @@
         <option>
           <name>CCDefines</name>
           <state></state>
+          <state>CONFIG_PLATFORM_8711B</state>
+          <state>CONFIG_BUILD_ROM</state>
+          <state>PLATFORM_RTTHREAD</state>
+          <state>__IEEE_LITTLE_ENDIAN</state>
+          <state>RT_USING_DLIBC</state>
+          <state>_DLIB_FILE_DESCRIPTOR</state>
+          <state>_DLIB_THREAD_SUPPORT</state>
         </option>
         <option>
           <name>CCPreprocFile</name>
@@ -597,7 +591,7 @@
         <debug>1</debug>
         <option>
           <name>OOCOutputFormat</name>
-          <version>3</version>
+          <version>2</version>
           <state>0</state>
         </option>
         <option>
@@ -967,7 +961,7 @@
       <name>General</name>
       <archiveVersion>3</archiveVersion>
       <data>
-        <version>24</version>
+        <version>22</version>
         <wantNonLocal>1</wantNonLocal>
         <debug>0</debug>
         <option>
@@ -982,6 +976,11 @@
           <name>ListPath</name>
           <state>Release\List</state>
         </option>
+        <option>
+          <name>Variant</name>
+          <version>21</version>
+          <state>0</state>
+        </option>
         <option>
           <name>GEndianMode</name>
           <state>0</state>
@@ -989,7 +988,7 @@
         <option>
           <name>Input variant</name>
           <version>3</version>
-          <state>1</state>
+          <state>0</state>
         </option>
         <option>
           <name>Input description</name>
@@ -998,7 +997,7 @@
         <option>
           <name>Output variant</name>
           <version>2</version>
-          <state>1</state>
+          <state>0</state>
         </option>
         <option>
           <name>Output description</name>
@@ -1008,6 +1007,11 @@
           <name>GOutputBinary</name>
           <state>0</state>
         </option>
+        <option>
+          <name>FPU</name>
+          <version>3</version>
+          <state>0</state>
+        </option>
         <option>
           <name>OGCoreOrChip</name>
           <state>0</state>
@@ -1028,11 +1032,11 @@
         </option>
         <option>
           <name>OGProductVersion</name>
-          <state>6.10.1.52170</state>
+          <state>7.30.4.8186</state>
         </option>
         <option>
           <name>OGLastSavedByProductVersion</name>
-          <state>7.40.3.8937</state>
+          <state></state>
         </option>
         <option>
           <name>GeneralEnableMisra</name>
@@ -1044,7 +1048,7 @@
         </option>
         <option>
           <name>OGChipSelectEditMenu</name>
-          <state>Default	None</state>
+          <state></state>
         </option>
         <option>
           <name>GenLowLevelInterface</name>
@@ -1080,10 +1084,15 @@
           <name>RTConfigPath2</name>
           <state></state>
         </option>
+        <option>
+          <name>GFPUCoreSlave</name>
+          <version>21</version>
+          <state>1</state>
+        </option>
         <option>
           <name>GBECoreSlave</name>
-          <version>22</version>
-          <state>0</state>
+          <version>21</version>
+          <state>1</state>
         </option>
         <option>
           <name>OGUseCmsis</name>
@@ -1097,34 +1106,6 @@
           <name>GRuntimeLibThreads</name>
           <state>0</state>
         </option>
-        <option>
-          <name>CoreVariant</name>
-          <version>22</version>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GFPUDeviceSlave</name>
-          <state>Default	None</state>
-        </option>
-        <option>
-          <name>FPU2</name>
-          <version>0</version>
-          <state>0</state>
-        </option>
-        <option>
-          <name>NrRegs</name>
-          <version>0</version>
-          <state>0</state>
-        </option>
-        <option>
-          <name>NEON</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>GFPUCoreSlave2</name>
-          <version>22</version>
-          <state>0</state>
-        </option>
       </data>
     </settings>
     <settings>
@@ -1552,7 +1533,7 @@
         <debug>0</debug>
         <option>
           <name>OOCOutputFormat</name>
-          <version>3</version>
+          <version>2</version>
           <state>0</state>
         </option>
         <option>

File diff suppressed because it is too large
+ 946 - 1909
bsp/amebaz/template.ewt


+ 0 - 0
bsp/tm4c129x-dk/template.eww → bsp/amebaz/template.eww


+ 2 - 2
bsp/amebaz/tmp.board

@@ -12,10 +12,10 @@
     <abs_offset>0xb020</abs_offset>  
   </pass> 
   <pass>    
-    <range>CODE 0x10005000 0x10005A6B</range>    
+    <range>CODE 0x10005000 0x10005A9B</range>    
     <loader>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\misc\iar_utility\common\flashloader\FlashRTL8195aMP.flash</loader>      
     <abs_offset>0xb000</abs_offset>    
     <args>--concat</args>    
   </pass>    
-  <ignore>CODE 0x10005a6c 0x1003dfff</ignore> 
+  <ignore>CODE 0x10005a9c 0x1003dfff</ignore> 
 </flash_board> 

+ 54 - 31
bsp/apollo2/board/adc.c

@@ -19,46 +19,57 @@
  *
  * Change Logs:
  * Date           Author       Notes
- * 2017-12-04     Haley        the first version
+ * 2017-09-18     Haley        the first version
  */
 
+#include <rtthread.h>
 #include <rtdevice.h>
 #include "am_mcu_apollo.h"
-#include "board.h"
 
 #ifdef RT_USING_ADC
 
-/* sem define */
-rt_sem_t adcsem = RT_NULL;
+/* messagequeue define */
+struct rt_messagequeue adcbat_mq;
 
-#define BATTERY_GPIO            29                        /* Battery */
-#define BATTERY_ADC_PIN         AM_HAL_PIN_29_ADCSE1 
-#define BATTERY_ADC_CHANNEL     AM_HAL_ADC_SLOT_CHSEL_SE1 /* BATTERY ADC采集通道 */
-#define BATTERY_ADC_CHANNELNUM  1                         /* BATTERY ADC采集通道号 */
+#define BATTERY_GPIO            35                        /* Battery */
+#define BATTERY_ADC_PIN         AM_HAL_PIN_35_ADCSE7 
+#define BATTERY_ADC_CHANNEL     AM_HAL_ADC_SLOT_CHSEL_SE7 /* BATTERY ADC采集通道 */
+#define BATTERY_ADC_CHANNELNUM  7                         /* BATTERY ADC采集通道号 */
 
 #define ADC_CTIMER_NUM          3                         /* ADC使用定时器 */
+#define ADC_CTIMER_COUNT        (2048/512 - 1)
 
 #define ADC_CHANNEL_NUM         1                         /* ADC采集通道个数 */
-#define ADC_SAMPLE_NUM          8                         /* ADC采样个数, NE_OF_OUTPUT */
+#define ADC_SAMPLE_NUM          8                         /* ADC采样个数 */
 
-rt_uint8_t bat_adc_cnt = (ADC_CHANNEL_NUM + 1)*ADC_SAMPLE_NUM;
-rt_int16_t am_adc_buffer_pool[64];
+rt_uint8_t bat_adc_cnt = 0;
+static rt_uint8_t am_adcbat_buffer_pool[256];
+static rt_int16_t am_adcbat_buffertemp[32];
 
-rt_uint8_t am_adc_data_get(rt_int16_t *buff, rt_uint16_t size)
+rt_uint8_t am_adc_data_get(rt_uint8_t channel, rt_int16_t *buff, rt_uint16_t size)
 {
-    /* wait adc interrupt release sem forever */	
-    rt_sem_take(adcsem, RT_WAITING_FOREVER);
+    rt_uint8_t adc_bufftemp[32];
+
+    if (channel == BATTERY_ADC_CHANNELNUM)
+    {
+        /* wait adc message forever */	
+        rt_mq_recv(&adcbat_mq, adc_bufftemp, 32, RT_WAITING_FOREVER);
+    }
 
     /* copy the data */
-    rt_memcpy(buff, am_adc_buffer_pool, size*sizeof(rt_int16_t));
+    rt_memcpy(buff, adc_bufftemp, size*sizeof(rt_int16_t));
 
     return 0;
 }
 
-void am_adc_start(void)
+void am_adc_start(rt_uint8_t channel)
 {
-    /* adcsem create */
-    adcsem = rt_sem_create("adcsem", 0, RT_IPC_FLAG_FIFO);
+    /* messagequeue init */
+    rt_mq_init(&adcbat_mq, "mq_adcbat",
+            &am_adcbat_buffer_pool[0],
+            32 - sizeof(void*),
+            sizeof(am_adcbat_buffer_pool),
+            RT_IPC_FLAG_FIFO);
 
     /* Start the ctimer */
     am_hal_ctimer_start(ADC_CTIMER_NUM, AM_HAL_CTIMER_TIMERA);
@@ -67,13 +78,16 @@ void am_adc_start(void)
     am_hal_adc_trigger();
 }
 
-void am_adc_stop(void)
+void am_adc_stop(rt_uint8_t channel)
 {
     /* Stop the ctimer */
     am_hal_ctimer_stop(ADC_CTIMER_NUM, AM_HAL_CTIMER_TIMERA);
 
-    /* adcsem delete */
-    rt_sem_delete(adcsem);
+    /* messagequeue delete */
+    rt_mq_delete(&adceeg_mq);
+
+    /* messagequeue delete */
+    rt_mq_delete(&adcbat_mq);
 }
 
 /**
@@ -87,6 +101,9 @@ void am_adc_isr(void)
 {
     uint32_t ui32Status, ui32FifoData;
 
+    /* enter interrupt */
+    rt_interrupt_enter();
+
     /* Read the interrupt status */
     ui32Status = am_hal_adc_int_status_get(true);
 
@@ -101,20 +118,23 @@ void am_adc_isr(void)
             /* Read the value from the FIFO into the circular buffer */
             ui32FifoData = am_hal_adc_fifo_pop();
 
-            if(AM_HAL_ADC_FIFO_SLOT(ui32FifoData) == BATTERY_ADC_CHANNELNUM)
-                am_adc_buffer_pool[bat_adc_cnt++] = AM_HAL_ADC_FIFO_SAMPLE(ui32FifoData);
+            if (AM_HAL_ADC_FIFO_SLOT(ui32FifoData) == BATTERY_ADC_CHANNELNUM)
+            {
+                am_adcbat_buffertemp[bat_adc_cnt++] = AM_HAL_ADC_FIFO_SAMPLE(ui32FifoData);
+            }
 
-            if(bat_adc_cnt > (ADC_CHANNEL_NUM + 1)*ADC_SAMPLE_NUM - 1)
+            if ((bat_adc_cnt > ADC_SAMPLE_NUM + 2 - 1))
             {
-                /* shift data */
-                rt_memmove(am_adc_buffer_pool, am_adc_buffer_pool + ADC_CHANNEL_NUM*ADC_SAMPLE_NUM, ADC_CHANNEL_NUM*ADC_SAMPLE_NUM*sizeof(rt_int16_t));
-                bat_adc_cnt = (ADC_CHANNEL_NUM + 1)*ADC_SAMPLE_NUM;
+                bat_adc_cnt = 0;
 
-                /* release adcsem */
-                rt_sem_release(adcsem);
+                /* send the message */
+                rt_mq_send(&adcbat_mq, am_adcbat_buffertemp, ADC_SAMPLE_NUM*sizeof(rt_int16_t));
             }
         } while (AM_HAL_ADC_FIFO_COUNT(ui32FifoData) > 0);
     }
+
+    /* leave interrupt */
+    rt_interrupt_leave();
 }
 
 static void timerA3_for_adc_init(void)
@@ -129,7 +149,7 @@ static void timerA3_for_adc_init(void)
     am_hal_ctimer_int_enable(AM_HAL_CTIMER_INT_TIMERA3);
 
     /* Set 512 sample rate */
-    am_hal_ctimer_period_set(ADC_CTIMER_NUM, AM_HAL_CTIMER_TIMERA, 3, 1);
+    am_hal_ctimer_period_set(ADC_CTIMER_NUM, AM_HAL_CTIMER_TIMERA, ADC_CTIMER_COUNT, 1);
 
     /* Enable the timer A3 to trigger the ADC directly */
     am_hal_ctimer_adc_trigger_enable();
@@ -184,7 +204,10 @@ int rt_hw_adc_init(void)
     /* Enable the ADC */
     am_hal_adc_enable();
 
-    rt_kprintf("adc_init!\n");
+    /* Trigger the ADC once */
+    //am_hal_adc_trigger();
+
+    //rt_kprintf("adc_init!\n");
 
     return 0;
 }

+ 3 - 3
bsp/apollo2/board/adc.h

@@ -32,8 +32,8 @@
  *
  */
 int rt_hw_adc_init(void);
-rt_uint8_t am_adc_data_get(rt_int16_t *buff, rt_uint16_t size);
-void am_adc_start(void);
-void am_adc_stop(void);
+rt_uint8_t am_adc_data_get(rt_uint8_t channel, rt_int16_t *buff, rt_uint16_t size);
+void am_adc_start(rt_uint8_t channel);
+void am_adc_stop(rt_uint8_t channel);
 
 #endif // __ADC_H_

+ 4 - 2
bsp/apollo2/board/board.c

@@ -104,15 +104,17 @@ void am_low_power_init(void)
     /* Turn off the voltage comparator as this is enabled on reset */
     am_hal_vcomp_disable();
 
+    #ifndef RT_USING_RTC
     /* Run the RTC off the LFRC */
     am_hal_rtc_osc_select(AM_HAL_RTC_OSC_LFRC);
 
     /* Stop the XT and LFRC */
     am_hal_clkgen_osc_stop(AM_HAL_CLKGEN_OSC_XT);
-    am_hal_clkgen_osc_stop(AM_HAL_CLKGEN_OSC_LFRC);
+    //am_hal_clkgen_osc_stop(AM_HAL_CLKGEN_OSC_LFRC);
 
     /* Disable the RTC */
     am_hal_rtc_osc_disable();
+    #endif
 }
 
 /**
@@ -159,7 +161,7 @@ void rt_hw_board_init(void)
 
     /* Turn off unused Flash & SRAM */
     am_hal_pwrctrl_memory_enable(AM_HAL_PWRCTRL_MEMEN_FLASH512K);
-    am_hal_pwrctrl_memory_enable(AM_HAL_PWRCTRL_MEMEN_SRAM32K);
+    //am_hal_pwrctrl_memory_enable(AM_HAL_PWRCTRL_MEMEN_SRAM32K);
 
 #endif
 

+ 1 - 1
bsp/apollo2/board/flash.c

@@ -140,7 +140,7 @@ int rt_hw_rom_init(void)
     /* register the device */
     rt_device_register(&device, "rom", RT_DEVICE_FLAG_RDWR);
 
-    rt_kprintf("register device rom!\r\n");
+    //rt_kprintf("register device rom!\r\n");
 
     return 0;
 }

+ 137 - 9
bsp/apollo2/board/gpio.c

@@ -24,10 +24,14 @@
 
 #include <rtthread.h>
 #include <rtdevice.h>
+#include <rthw.h>
 #include "am_mcu_apollo.h"
 
 #ifdef RT_USING_PIN
 
+#define APLLO2_PIN_NUMBERS    64 //[34, 64]
+struct rt_pin_irq_hdr am_pin_irq_hdr_tab[64];
+
 void am_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode)
 {
     if (mode == PIN_MODE_OUTPUT)
@@ -43,12 +47,17 @@ void am_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode)
     else if (mode == PIN_MODE_INPUT_PULLUP)
     {
         /* input setting: pull up. */
+        am_hal_gpio_pin_config(pin, AM_HAL_GPIO_INPUT);
+    }
+    else if (mode == PIN_MODE_INPUT_PULLDOWN)
+    {
+        /* input setting: pull down. */
         am_hal_gpio_pin_config(pin, AM_HAL_GPIO_OPENDRAIN);
     }
     else
     {
         /* input setting:default. */
-        am_hal_gpio_pin_config(pin, AM_HAL_GPIO_INPUT);
+        am_hal_gpio_pin_config(pin, AM_HAL_GPIO_3STATE);
     }
 }
 
@@ -58,40 +67,159 @@ void am_pin_write(rt_device_t dev, rt_base_t pin, rt_base_t value)
     {
         am_hal_gpio_out_bit_clear(pin);
     }
-    else
+    else if (value == PIN_HIGH)
     {
         am_hal_gpio_out_bit_set(pin);
-    }
+    }    
 }
 
 int am_pin_read(rt_device_t dev, rt_base_t pin)
 {
     int value = PIN_LOW;
 
-    if (am_hal_gpio_input_bit_read(pin) == 0)
+    if (am_hal_gpio_pin_config_read(pin) == AM_HAL_GPIO_OUTPUT)
     {
-        value = PIN_LOW;
+        if (am_hal_gpio_out_bit_read(pin) == 0)
+        {
+            value = PIN_LOW;
+        }
+        else
+        {
+            value = PIN_HIGH;
+        }
     }
     else
     {
-        value = PIN_HIGH;
+        if (am_hal_gpio_input_bit_read(pin) == 0)
+        {
+            value = PIN_LOW;
+        }
+        else
+        {
+            value = PIN_HIGH;
+        }
     }
 
     return value;
 }
 
-const static struct rt_pin_ops _am_pin_ops =
+rt_err_t am_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
+                rt_uint32_t mode, void (*hdr)(void *args), void *args)
+{
+    rt_base_t level;
+    rt_int32_t irqindex = -1;
+
+    irqindex = pin;
+
+    level = rt_hw_interrupt_disable();
+    if(am_pin_irq_hdr_tab[irqindex].pin == pin   &&
+       am_pin_irq_hdr_tab[irqindex].hdr == hdr   &&
+       am_pin_irq_hdr_tab[irqindex].mode == mode &&
+       am_pin_irq_hdr_tab[irqindex].args == args
+    )
+    {
+        rt_hw_interrupt_enable(level);
+        return RT_EOK;
+    }
+    if(am_pin_irq_hdr_tab[irqindex].pin != -1)
+    {
+        rt_hw_interrupt_enable(level);
+        return -RT_EBUSY;
+    }
+    am_pin_irq_hdr_tab[irqindex].pin = pin;
+    am_pin_irq_hdr_tab[irqindex].hdr = hdr;
+    am_pin_irq_hdr_tab[irqindex].mode = mode;
+    am_pin_irq_hdr_tab[irqindex].args = args;
+    rt_hw_interrupt_enable(level);
+
+    return RT_EOK;
+}
+
+rt_err_t am_pin_dettach_irq(struct rt_device *device, rt_int32_t pin)
+{
+    rt_base_t level;
+    rt_int32_t irqindex = -1;
+
+    irqindex = pin;
+
+    level = rt_hw_interrupt_disable();
+    if(am_pin_irq_hdr_tab[irqindex].pin == -1)
+    {
+        rt_hw_interrupt_enable(level);
+        return RT_EOK;
+    }
+    am_pin_irq_hdr_tab[irqindex].pin = -1;
+    am_pin_irq_hdr_tab[irqindex].hdr = RT_NULL;
+    am_pin_irq_hdr_tab[irqindex].mode = 0;
+    am_pin_irq_hdr_tab[irqindex].args = RT_NULL;
+    rt_hw_interrupt_enable(level);
+
+    return RT_EOK;
+}
+
+rt_err_t am_pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled)
+{
+    rt_base_t level;
+    rt_int32_t irqindex = -1;
+
+    irqindex = pin;
+
+    if (enabled == PIN_IRQ_ENABLE)
+    {
+        level = rt_hw_interrupt_disable();
+
+        /* Configure the GPIO/button interrupt polarity */
+        if (am_pin_irq_hdr_tab[irqindex].mode == PIN_IRQ_MODE_RISING)
+        {
+            am_hal_gpio_int_polarity_bit_set(am_pin_irq_hdr_tab[irqindex].pin, AM_HAL_GPIO_RISING);
+        }
+        else if (am_pin_irq_hdr_tab[irqindex].mode == PIN_IRQ_MODE_FALLING)
+        {
+            am_hal_gpio_int_polarity_bit_set(am_pin_irq_hdr_tab[irqindex].pin, AM_HAL_GPIO_FALLING);
+        }
+
+        /* Clear the GPIO Interrupt (write to clear) */
+        am_hal_gpio_int_clear(AM_HAL_GPIO_BIT(am_pin_irq_hdr_tab[irqindex].pin));
+
+        /* Enable the GPIO/button interrupt */
+        am_hal_gpio_int_enable(AM_HAL_GPIO_BIT(am_pin_irq_hdr_tab[irqindex].pin));
+
+        rt_hw_interrupt_enable(level);
+    }
+    else if (enabled == PIN_IRQ_DISABLE)
+    {
+        if (am_hal_gpio_int_enable_get() != AM_HAL_GPIO_BIT(am_pin_irq_hdr_tab[irqindex].pin))
+        {
+            return RT_ENOSYS;
+        }
+
+        /* Disable the GPIO/button interrupt */
+        am_hal_gpio_int_disable(AM_HAL_GPIO_BIT(am_pin_irq_hdr_tab[irqindex].pin));
+    }
+    else
+    {
+        return RT_ENOSYS;
+    }
+
+    return RT_EOK;
+}
+
+const static struct rt_pin_ops am_pin_ops =
 {
     am_pin_mode,
     am_pin_write,
     am_pin_read,
+    am_pin_attach_irq,
+    am_pin_dettach_irq,
+    am_pin_irq_enable,
 };
 
 int rt_hw_pin_init(void)
 {
-    rt_device_pin_register("pin", &_am_pin_ops, RT_NULL);
+    rt_device_pin_register("pin", &am_pin_ops, RT_NULL);
 
-    rt_kprintf("pin_init!\n");
+    //rt_device_pin_irq_register("pin", &am_pin_ops, RT_NULL);
+    //rt_kprintf("pin_init!\n");
 
     return 0;
 }

+ 34 - 10
bsp/apollo2/board/i2c.c

@@ -25,7 +25,6 @@
 #include <rtthread.h>
 #include <rtdevice.h>
 #include "am_mcu_apollo.h"
-#include "board.h"
 
 /* I2C0 */
 #define AM_I2C0_IOM_INST    0
@@ -43,6 +42,14 @@
 #define I2C2_GPIO_SDA       25
 #define I2C2_GPIO_CFG_SDA   AM_HAL_PIN_25_M2SDA
 
+/* I2C3 */
+#define AM_I2C3_IOM_INST    3
+
+#define I2C3_GPIO_SCL       42
+#define I2C3_GPIO_CFG_SCK   AM_HAL_PIN_42_M3SCL
+#define I2C3_GPIO_SDA       43
+#define I2C3_GPIO_CFG_SDA   AM_HAL_PIN_43_M3SDA
+
 /* I2C4 */
 #define AM_I2C4_IOM_INST    4
 
@@ -76,7 +83,7 @@ rt_size_t rt_i2c_master_xfer(struct rt_i2c_bus_device *bus,
     struct am_i2c_bus * am_i2c_bus = (struct am_i2c_bus *)bus;
     struct rt_i2c_msg *msg;
     int i;
-    rt_int32_t ret = RT_EOK;
+    rt_uint32_t msg_len = 0;
 
     for (i = 0; i < num; i++)
     {
@@ -84,16 +91,16 @@ rt_size_t rt_i2c_master_xfer(struct rt_i2c_bus_device *bus,
         if (msg->flags == RT_I2C_RD)
         {
             am_hal_iom_i2c_read(am_i2c_bus->u32Module, msg->addr, (uint32_t *)msg->buf, msg->len, AM_HAL_IOM_RAW);
+            msg_len += msg->len;
         }
         else if(msg->flags == RT_I2C_WR)
         {
             am_hal_iom_i2c_write(am_i2c_bus->u32Module, msg->addr, (uint32_t *)msg->buf, msg->len, AM_HAL_IOM_RAW);
+            msg_len += (msg->len - 1);
         }
-
-        ret++;
     }
 
-    return ret;
+    return msg_len;
 }
 
 rt_err_t rt_i2c_bus_control(struct rt_i2c_bus_device *bus,
@@ -136,7 +143,7 @@ static struct am_i2c_bus am_i2c_bus_0 =
 #ifdef RT_USING_I2C1
 static struct am_i2c_bus am_i2c_bus_1 = 
 {
-    {0},
+    {1},
     AM_I2C1_IOM_INST
 };
 #endif
@@ -144,7 +151,7 @@ static struct am_i2c_bus am_i2c_bus_1 =
 #ifdef RT_USING_I2C2
 static struct am_i2c_bus am_i2c_bus_2 = 
 {
-    {1},
+    {2},
     AM_I2C2_IOM_INST
 };
 #endif
@@ -152,7 +159,7 @@ static struct am_i2c_bus am_i2c_bus_2 =
 #ifdef RT_USING_I2C3
 static struct am_i2c_bus am_i2c_bus_3 = 
 {
-    {2},
+    {3},
     AM_I2C3_IOM_INST
 };
 #endif
@@ -160,7 +167,7 @@ static struct am_i2c_bus am_i2c_bus_3 =
 #ifdef RT_USING_I2C4
 static struct am_i2c_bus am_i2c_bus_4 = 
 {
-    {3},
+    {4},
     AM_I2C4_IOM_INST
 };
 #endif
@@ -203,6 +210,23 @@ int rt_i2c_init(void)
     rt_i2c_bus_device_register(&am_i2c->parent, "i2c2");
 #endif
 
+#ifdef RT_USING_I2C3
+    /* init i2c gpio */
+    am_hal_gpio_pin_config(I2C3_GPIO_SCL, I2C3_GPIO_CFG_SCK | AM_HAL_GPIO_PULL6K);
+    am_hal_gpio_pin_config(I2C3_GPIO_SDA, I2C3_GPIO_CFG_SDA | AM_HAL_GPIO_PULL6K);
+
+    /* Initialize IOM 3 in I2C mode at 400KHz */
+    am_hal_iom_pwrctrl_enable(AM_I2C3_IOM_INST);
+    g_sIOMConfig.ui32ClockFrequency = AM_HAL_IOM_400KHZ;
+    am_hal_iom_config(AM_I2C3_IOM_INST, &g_sIOMConfig);
+    am_hal_iom_enable(AM_I2C3_IOM_INST);
+
+    /* init i2c bus device */
+    am_i2c = &am_i2c_bus_3;
+    am_i2c->parent.ops = &am_i2c_ops;
+    rt_i2c_bus_device_register(&am_i2c->parent, "i2c3");
+#endif
+
 #ifdef RT_USING_I2C4
     /* init i2c gpio */
     am_hal_gpio_pin_config(I2C4_GPIO_SCL, I2C4_GPIO_CFG_SCK | AM_HAL_GPIO_PULL6K);
@@ -220,7 +244,7 @@ int rt_i2c_init(void)
     rt_i2c_bus_device_register(&am_i2c->parent, "i2c4");
 #endif
 
-    rt_kprintf("i2c_init!\n");
+    //rt_kprintf("i2c_init!\n");
 
     return 0;
 }

+ 33 - 68
bsp/apollo2/board/pdm.c

@@ -25,15 +25,15 @@
 #include <rtthread.h>
 #include <rtdevice.h>
 #include "am_mcu_apollo.h"
-#include "board.h"
 
 #ifdef RT_USING_PDM
 
-/* sem define */
-rt_sem_t pdmsem = RT_NULL;
+/* messagequeue define */
+struct rt_messagequeue pdm_mq;
 
-#define NWA_FRAME_MS 10
-#define NWA_FRAME_SAMPLES (16*NWA_FRAME_MS)    /* 16k, 16bit, mono audio data */
+static rt_uint8_t am_pdm_buffer_pool[1024];
+
+#define NWA_FRAME_SAMPLES   160    /* 8k, 16bit, mono audio data */
 #define PDM_FIFO_THRESHOLD  NWA_FRAME_SAMPLES
 
 #define PDM_GPIO_CLK        22
@@ -41,23 +41,16 @@ rt_sem_t pdmsem = RT_NULL;
 #define PDM_GPIO_DATA       23
 #define PDM_GPIO_CFG_DATA   AM_HAL_PIN_23_PDM_DATA
 
-#define PING_PONG_BUF_SIZE	8000*NWA_FRAME_MS
-static rt_uint16_t am_pdm_buffer_pool[PING_PONG_BUF_SIZE];
-static rt_uint8_t pdm_flag = 0;
-static rt_uint16_t pdm_cnt = 0;
-
-
 static am_hal_pdm_config_t g_sPDMConfig =
 {
-    AM_HAL_PDM_PCFG_LRSWAP_DISABLE | AM_HAL_PDM_PCFG_RIGHT_PGA_P105DB | AM_HAL_PDM_PCFG_LEFT_PGA_P105DB
-           | AM_HAL_PDM_PCFG_MCLKDIV_DIV1 | AM_HAL_PDM_PCFG_SINC_RATE(48) | AM_HAL_PDM_PCFG_ADCHPD_ENABLE
-           | AM_HAL_PDM_PCFG_HPCUTOFF(0xB) | AM_HAL_PDM_PCFG_CYCLES(0x1) | AM_HAL_PDM_PCFG_SOFTMUTE_DISABLE
-           | AM_HAL_PDM_PCFG_PDMCORE_ENABLE, /* Set the PDM configuration */
-    AM_REG_PDM_VCFG_IOCLKEN_EN | AM_HAL_PDM_VCFG_RSTB_NORMAL | AM_REG_PDM_VCFG_PDMCLKSEL_750KHz
-           | AM_HAL_PDM_VCFG_PDMCLK_ENABLE | AM_HAL_PDM_VCFG_I2SMODE_DISABLE | AM_HAL_PDM_VCFG_BCLKINV_DISABLE
-           | AM_HAL_PDM_VCFG_DMICDEL_DISABLE | AM_HAL_PDM_VCFG_SELAP_INTERNAL | AM_HAL_PDM_VCFG_PACK_DISABLE
-           | AM_HAL_PDM_VCFG_CHANNEL_RIGHT, /* Set the Voice Configuration */
-    PDM_FIFO_THRESHOLD, /* Select the FIFO PCM sample threshold */
+    AM_HAL_PDM_PCFG_LRSWAP_DISABLE | AM_HAL_PDM_PCFG_RIGHT_PGA_0DB | AM_HAL_PDM_PCFG_LEFT_PGA_0DB
+            | AM_HAL_PDM_PCFG_MCLKDIV_DIV1 | AM_HAL_PDM_PCFG_SINC_RATE(48) | AM_HAL_PDM_PCFG_ADCHPD_ENABLE
+            | AM_HAL_PDM_PCFG_HPCUTOFF(0x1) | AM_HAL_PDM_PCFG_CYCLES(0x1) | AM_HAL_PDM_PCFG_SOFTMUTE_DISABLE
+            | AM_HAL_PDM_PCFG_PDMCORE_ENABLE, /* Set the PDM configuration */
+    AM_HAL_PDM_IOCLK_750KHZ | AM_HAL_PDM_VCFG_RSTB_NORMAL | AM_HAL_PDM_VCFG_PDMCLK_ENABLE
+            | AM_HAL_PDM_VCFG_I2SMODE_DISABLE | AM_HAL_PDM_VCFG_BCLKINV_DISABLE | AM_HAL_PDM_VCFG_DMICDEL_DISABLE
+            | AM_HAL_PDM_VCFG_SELAP_INTERNAL | AM_HAL_PDM_VCFG_PACK_DISABLE | AM_HAL_PDM_VCFG_CHANNEL_LEFT, /* Set the Voice Configuration */
+    PDM_FIFO_THRESHOLD, /* Select the FIFO PCM sample threshold 0~256 */
 };
 
 /**
@@ -71,28 +64,13 @@ static am_hal_pdm_config_t g_sPDMConfig =
  */
 rt_uint8_t am_pdm_data_get(rt_uint8_t *buff, rt_uint16_t size)
 {
-    uint8_t temp;
-    int i;
-
-    /* wait adc interrupt release sem forever */
-    rt_sem_take(pdmsem, RT_WAITING_FOREVER);
+    rt_uint8_t pdm_rbufftemp[340];
 
-    for(i = 0; i < PING_PONG_BUF_SIZE; i++)
-    {
-        temp = (uint8_t)(am_pdm_buffer_pool[i] & 0xFF);
-        /* lower byte */
-        while ( AM_BFRn(UART, 0, FR, TXFF) );
-        AM_REGn(UART, 0, DR) = temp;
+    /* wait pdm message forever */	
+    rt_mq_recv(&pdm_mq, pdm_rbufftemp, 340, RT_WAITING_FOREVER);
 
-        temp = (uint8_t)((am_pdm_buffer_pool[i] & 0xFF00)>>8);
-        /* higher byte */
-        while ( AM_BFRn(UART, 0, FR, TXFF) );
-        AM_REGn(UART, 0, DR) = temp;
-    }
     /* copy the data */
-    //rt_memcpy(buff, am_pdm_buffer_pool, size*sizeof(rt_uint16_t));
-
-    pdm_flag = 0;
+    rt_memcpy(buff, (char *)pdm_rbufftemp, size);
 
     return 0;
 }
@@ -108,12 +86,9 @@ rt_uint8_t am_pdm_data_get(rt_uint8_t *buff, rt_uint16_t size)
  */
 void am_pdm_start(void)
 {
-    /* adcsem create */
-    pdmsem = rt_sem_create("pdmsem", 0, RT_IPC_FLAG_FIFO);
-
     /* Enable PDM */
-    am_hal_pdm_enable();
     am_hal_interrupt_enable(AM_HAL_INTERRUPT_PDM);
+    am_hal_pdm_enable();
 }
 
 /**
@@ -128,11 +103,8 @@ void am_pdm_start(void)
 void am_pdm_stop(void)
 {
     /* Disable PDM */
-    am_hal_pdm_disable();
     am_hal_interrupt_disable(AM_HAL_INTERRUPT_PDM);
-
-    /* adcsem delete */
-    rt_sem_delete(pdmsem);
+    am_hal_pdm_disable();
 }
 
 /**
@@ -153,7 +125,7 @@ uint8_t am_pdm_left_gain_get(void)
 /**
  * @brief Set the pdm left gain.
  *
- * @param None.
+ * @param gain_val.
  *
  * This function Set the pdm left gain.
  *
@@ -183,7 +155,7 @@ uint8_t am_pdm_right_gain_get(void)
 /**
  * @brief Set the pdm right gain.
  *
- * @param None.
+ * @param gain_val.
  *
  * This function Set the pdm right gain.
  *
@@ -204,33 +176,19 @@ void am_pdm_right_gain_set(uint8_t gain_val)
  */
 void am_pdm_isr (void)
 {
-    uint32_t ui32FifoData;
     int i;
+    rt_int16_t pdm_sbufftemp[160];
 
     /* Clear the PDM interrupt */
     am_hal_pdm_int_clear(AM_HAL_PDM_INT_UNDFL | AM_HAL_PDM_INT_OVF | AM_HAL_PDM_INT_FIFO);
 
     for (i = 0; i < PDM_FIFO_THRESHOLD; i++)  /* adjust as needed */
     {
-        ui32FifoData = am_hal_pdm_fifo_data_read();
-
-        if(pdm_flag == 0)
-        {
-            am_pdm_buffer_pool[pdm_cnt * PDM_FIFO_THRESHOLD + i] = (uint16_t)ui32FifoData;
-        }
+        pdm_sbufftemp[i] = (rt_int16_t)am_hal_pdm_fifo_data_read();
     }
 
-    if(pdm_flag == 0)
-        pdm_cnt ++;
-
-    if(pdm_cnt == PING_PONG_BUF_SIZE/PDM_FIFO_THRESHOLD)	/* 500 means 10 second logging under 8k sampling rate */
-    {
-        pdm_cnt = 0;
-        pdm_flag = 1;
-
-        /* release pdmsem */
-        rt_sem_release(pdmsem);
-    }
+    /* send the message */
+    rt_mq_send(&pdm_mq, pdm_sbufftemp, PDM_FIFO_THRESHOLD*sizeof(rt_int16_t));
 }
 
 /**
@@ -258,7 +216,14 @@ int rt_hw_pdm_init(void)
     /* Clear PDM interrupts */
     am_hal_pdm_int_clear(AM_HAL_PDM_INT_UNDFL | AM_HAL_PDM_INT_OVF | AM_HAL_PDM_INT_FIFO);
 
-    rt_kprintf("pdm_init!\n");
+    /* messagequeue init */
+    rt_mq_init(&pdm_mq, "mq_pdm",
+            &am_pdm_buffer_pool[0],
+            340 - sizeof(void*),
+            sizeof(am_pdm_buffer_pool),
+            RT_IPC_FLAG_FIFO);
+
+    //rt_kprintf("pdm_init!\n");
 
     return 0;
 }

+ 1 - 1
bsp/apollo2/board/pdm.h

@@ -31,7 +31,7 @@
  * @brief External function definitions
  *
  */
-int rt_hw_pdm_init(void);
+int rt_pdm_init(void);
 rt_uint8_t am_pdm_data_get(rt_uint8_t *buff, rt_uint16_t size);
 void am_pdm_start(void);
 void am_pdm_stop(void);

+ 2 - 0
bsp/apollo2/board/pwm.h

@@ -32,5 +32,7 @@
  *
  */
 int rt_hw_pwm_init(void);
+void am_pwm_start(int led);
+void am_pwm_stop(int led);
 
 #endif // __PWM_H_

+ 0 - 1
bsp/apollo2/board/rtc.c

@@ -118,7 +118,6 @@ int rt_hw_rtc_init(void)
   
 #if RTC_CLK_SRC == XT
     /* Enable the XT for the RTC */
-    //am_hal_clkgen_osc_start(AM_HAL_CLKGEN_OSC_LFRC);
     am_hal_clkgen_osc_start(AM_HAL_CLKGEN_OSC_XT);
 
     /* Select XT for RTC clock source */

+ 8 - 9
bsp/apollo2/board/smbus.c

@@ -25,23 +25,22 @@
 #include <rtthread.h>
 #include <rtdevice.h>
 #include "am_mcu_apollo.h"
-#include "board.h"
 
 #ifdef RT_USING_SMBUS
 
 #define SMBUS_GPIO_SDA    5
 #define SMBUS_GPIO_SCL    6
 
-#define mSDA_LOW()        am_hal_gpio_out_bit_clear(SMBUS_GPIO_SCL)    /* Clear SDA line */
-#define mSDA_HIGH()       am_hal_gpio_out_bit_set(SMBUS_GPIO_SCL)      /* Set SDA line */
-#define mSCL_LOW()        am_hal_gpio_out_bit_clear(SMBUS_GPIO_SDA)    /* Clear SCL line */
-#define mSCL_HIGH()       am_hal_gpio_out_bit_set(SMBUS_GPIO_SDA)      /* Set SCL line */
+#define mSDA_LOW()        am_hal_gpio_out_bit_clear(SMBUS_GPIO_SDA)    /* Clear SDA line */
+#define mSDA_HIGH()       am_hal_gpio_out_bit_set(SMBUS_GPIO_SDA)      /* Set SDA line */
+#define mSCL_LOW()        am_hal_gpio_out_bit_clear(SMBUS_GPIO_SCL)    /* Clear SCL line */
+#define mSCL_HIGH()       am_hal_gpio_out_bit_set(SMBUS_GPIO_SCL)      /* Set SCL line */
 
-#define mSDA_READ()       am_hal_gpio_input_bit_read(SMBUS_GPIO_SCL)   /* Read SCL line */
+#define mSDA_READ()       am_hal_gpio_input_bit_read(SMBUS_GPIO_SDA)   /* Read SDA line */
 
-#define mSDA_IN()         am_hal_gpio_pin_config(SMBUS_GPIO_SCL, AM_HAL_GPIO_INPUT | AM_HAL_GPIO_PULL6K)  /* Set SDA as Input */
-#define mSDA_OUT()        am_hal_gpio_pin_config(SMBUS_GPIO_SCL, AM_HAL_GPIO_OUTPUT)                      /* Set SDA as Output */
-#define mSCL_OUT()        am_hal_gpio_pin_config(SMBUS_GPIO_SDA, AM_HAL_GPIO_OUTPUT)                      /* Set SCL as Output */
+#define mSDA_IN()         am_hal_gpio_pin_config(SMBUS_GPIO_SDA, AM_HAL_GPIO_INPUT | AM_HAL_GPIO_PULL6K)  /* Set SDA as Input */
+#define mSDA_OUT()        am_hal_gpio_pin_config(SMBUS_GPIO_SDA, AM_HAL_GPIO_OUTPUT)                      /* Set SDA as Output */
+#define mSCL_OUT()        am_hal_gpio_pin_config(SMBUS_GPIO_SCL, AM_HAL_GPIO_OUTPUT)                      /* Set SCL as Output */
 
 #define ACK	      0
 #define	NACK      1

+ 49 - 43
bsp/apollo2/board/spi.c

@@ -25,10 +25,9 @@
 #include <rtthread.h>
 #include <rtdevice.h>
 #include "am_mcu_apollo.h"
-#include "board.h"
 #include "spi.h"
 
-/* SPI1 */
+/* SPI0 */
 #define AM_SPI0_IOM_INST    0
 
 #define SPI0_GPIO_SCK       5
@@ -38,17 +37,17 @@
 #define SPI0_GPIO_MOSI      7
 #define SPI0_GPIO_CFG_MOSI  AM_HAL_PIN_7_M0MOSI
 
-/* SPI2 */
+/* SPI1 */
 #define AM_SPI1_IOM_INST    1
 
 static am_hal_iom_config_t g_sIOMConfig =
 {
     AM_HAL_IOM_SPIMODE, // ui32InterfaceMode
-    AM_HAL_IOM_8MHZ, // ui32ClockFrequency
+    AM_HAL_IOM_400KHZ, // ui32ClockFrequency
     0, // bSPHA
     0, // bSPOL
-    4, // ui8WriteThreshold
-    60, // ui8ReadThreshold
+    80, // ui8WriteThreshold
+    80, // ui8ReadThreshold
 };
 
 /* AM spi driver */
@@ -64,7 +63,19 @@ static rt_err_t configure(struct rt_spi_device* device, struct rt_spi_configurat
     struct am_spi_bus * am_spi_bus = (struct am_spi_bus *)device->bus;
     rt_uint32_t max_hz = configuration->max_hz;
 
-    if(max_hz >= 8000000)
+    if(max_hz >= 24000000)
+    {
+        g_sIOMConfig.ui32ClockFrequency = AM_HAL_IOM_24MHZ;
+    }
+    else if(max_hz >= 16000000)
+    {
+        g_sIOMConfig.ui32ClockFrequency = AM_HAL_IOM_16MHZ;
+    }
+    else if(max_hz >= 12000000)
+    {
+        g_sIOMConfig.ui32ClockFrequency = AM_HAL_IOM_12MHZ;
+    }
+    else if(max_hz >= 8000000)
     {
         g_sIOMConfig.ui32ClockFrequency = AM_HAL_IOM_8MHZ;
     }
@@ -147,7 +158,6 @@ static rt_err_t configure(struct rt_spi_device* device, struct rt_spi_configurat
 
     /* init SPI */
     am_hal_iom_disable(am_spi_bus->u32Module);
-    am_hal_iom_pwrctrl_enable(am_spi_bus->u32Module);
     am_hal_iom_config(am_spi_bus->u32Module, &g_sIOMConfig);
     am_hal_iom_enable(am_spi_bus->u32Module);
 
@@ -167,14 +177,12 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message* mes
     /* take CS */
     if (message->cs_take)
     {
-        ;
+        am_hal_gpio_out_bit_clear(am_spi_cs->chip_select);
     }
 
     // ¶ÁÊý¾Ý
     if (recv_ptr != RT_NULL)
     {
-        u32TransferSize = u32BytesRemaining;
-
         while (u32BytesRemaining)
         {
             /* Set the transfer size to either 64, or the number of remaining
@@ -182,22 +190,21 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message* mes
             if (u32BytesRemaining > 64)
             {
                 u32TransferSize = 64;
+                am_hal_gpio_pin_config(SPI0_GPIO_MOSI, AM_HAL_GPIO_OUTPUT | AM_HAL_GPIO_PULL6K);
+                am_hal_gpio_out_bit_set(SPI0_GPIO_MOSI);
                 am_hal_iom_spi_read(am_spi_bus->u32Module, am_spi_cs->chip_select,
-                                   (uint32_t *)recv_ptr, u32TransferSize, AM_HAL_IOM_CS_LOW | AM_HAL_IOM_RAW);
+                                   (uint32_t *)recv_ptr, u32TransferSize, AM_HAL_IOM_RAW);
+                am_hal_gpio_pin_config(SPI0_GPIO_MOSI, SPI0_GPIO_CFG_MOSI | AM_HAL_GPIO_PULL6K);
             }
             else
             {
                 u32TransferSize = u32BytesRemaining;
-                /* release CS */
-                if(message->cs_release)
                 {
+                    am_hal_gpio_pin_config(SPI0_GPIO_MOSI, AM_HAL_GPIO_OUTPUT | AM_HAL_GPIO_PULL6K);
+                    am_hal_gpio_out_bit_set(SPI0_GPIO_MOSI);
                     am_hal_iom_spi_read(am_spi_bus->u32Module, am_spi_cs->chip_select,
                                    (uint32_t *)recv_ptr, u32TransferSize, AM_HAL_IOM_RAW);
-                }
-                else
-                {
-                    am_hal_iom_spi_read(am_spi_bus->u32Module, am_spi_cs->chip_select,
-                                   (uint32_t *)recv_ptr, u32TransferSize, AM_HAL_IOM_CS_LOW | AM_HAL_IOM_RAW);
+                    am_hal_gpio_pin_config(SPI0_GPIO_MOSI, SPI0_GPIO_CFG_MOSI | AM_HAL_GPIO_PULL6K);
                 }
             }
 
@@ -207,33 +214,26 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message* mes
     }
 
     // дÊý¾Ý
-    else if (send_ptr != RT_NULL)
+    else
     {
         while (u32BytesRemaining)
         {
             /* Set the transfer size to either 32, or the number of remaining
                bytes, whichever is smaller */
-            if (u32BytesRemaining > 32)
+            if (u32BytesRemaining > 64)
             {
-                u32TransferSize = 32;
+                u32TransferSize = 64;
                 am_hal_iom_spi_write(am_spi_bus->u32Module, am_spi_cs->chip_select,
-                                    (uint32_t *)send_ptr, u32TransferSize, AM_HAL_IOM_CS_LOW | AM_HAL_IOM_RAW);
+                                    (uint32_t *)send_ptr, u32TransferSize, AM_HAL_IOM_RAW);
         
             }
             else
             {
                 u32TransferSize = u32BytesRemaining;
-                /* release CS */
-                if (message->cs_release)
                 {
                     am_hal_iom_spi_write(am_spi_bus->u32Module, am_spi_cs->chip_select,
                               (uint32_t *)send_ptr, u32TransferSize, AM_HAL_IOM_RAW);
                 }
-                else
-                {
-                    am_hal_iom_spi_write(am_spi_bus->u32Module, am_spi_cs->chip_select,
-                              (uint32_t *)send_ptr, u32TransferSize, AM_HAL_IOM_CS_LOW | AM_HAL_IOM_RAW);
-                }
             }
 
             u32BytesRemaining -= u32TransferSize;
@@ -241,6 +241,12 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message* mes
         }
     }
 
+    /* release CS */
+    if(message->cs_release)
+    {
+        am_hal_gpio_out_bit_set(am_spi_cs->chip_select);
+    }
+
     return message->length;
 }
 
@@ -250,31 +256,31 @@ static const struct rt_spi_ops am_spi_ops =
     xfer
 };
 
-#ifdef RT_USING_SPI1
-static struct am_spi_bus am_spi_bus_1 = 
+#ifdef RT_USING_SPI0
+static struct am_spi_bus am_spi_bus_0 = 
 {
     {0},
     AM_SPI0_IOM_INST
 };
-#endif /* #ifdef RT_USING_SPI1 */
+#endif /* #ifdef RT_USING_SPI0 */
 
-#ifdef RT_USING_SPI2
-static struct ambiq_spi_bus ambiq_spi_bus_2 =
+#ifdef RT_USING_SPI1
+static struct am_spi_bus am_spi_bus_1 =
 {
-    {1},
+    {0},
     AM_SPI1_IOM_INST
 };
-#endif /* #ifdef RT_USING_SPI2 */
+#endif /* #ifdef RT_USING_SPI1 */
 
 int yr_hw_spi_init(void)
 {
     struct am_spi_bus* am_spi;
 
-#ifdef RT_USING_SPI1
+#ifdef RT_USING_SPI0
     /* init spi gpio */
     am_hal_gpio_pin_config(SPI0_GPIO_SCK, SPI0_GPIO_CFG_SCK);
-    am_hal_gpio_pin_config(SPI0_GPIO_MISO, SPI0_GPIO_CFG_MISO);
-    am_hal_gpio_pin_config(SPI0_GPIO_MOSI, SPI0_GPIO_CFG_MOSI);
+    am_hal_gpio_pin_config(SPI0_GPIO_MISO, SPI0_GPIO_CFG_MISO | AM_HAL_GPIO_PULL6K);
+    am_hal_gpio_pin_config(SPI0_GPIO_MOSI, SPI0_GPIO_CFG_MOSI | AM_HAL_GPIO_PULL6K);
 
     /* Initialize IOM 0 in SPI mode at 100KHz */
     am_hal_iom_pwrctrl_enable(AM_SPI0_IOM_INST);
@@ -282,11 +288,11 @@ int yr_hw_spi_init(void)
     am_hal_iom_enable(AM_SPI0_IOM_INST);
 
     //init spi bus device
-    am_spi = &am_spi_bus_1;
-    rt_spi_bus_register(&am_spi->parent, "spi1", &am_spi_ops);
+    am_spi = &am_spi_bus_0;
+    rt_spi_bus_register(&am_spi->parent, "spi0", &am_spi_ops);
 #endif
 
-    rt_kprintf("spi init!\n");
+    //rt_kprintf("spi init!\n");
 
     return 0;
 }

+ 10 - 11
bsp/apollo2/board/uart.c

@@ -25,7 +25,6 @@
 #include <rtthread.h>
 #include <rtdevice.h>
 #include "am_mcu_apollo.h"
-#include "board.h"
 
 /* USART0 */
 #define AM_UART0_INST         0
@@ -165,8 +164,14 @@ static rt_err_t am_configure(struct rt_serial_device *serial, struct serial_conf
     else if (cfg->stop_bits == STOP_BITS_2)
         uart_cfg.bTwoStopBits = true;
 
-    uart_cfg.ui32Parity = cfg->parity;
-    uart_cfg.ui32FlowCtrl = AM_HAL_UART_PARITY_NONE;
+    if (cfg->parity == PARITY_NONE)    
+        uart_cfg.ui32Parity = AM_HAL_UART_PARITY_NONE;
+    else if (cfg->parity == PARITY_ODD)    
+        uart_cfg.ui32Parity = AM_HAL_UART_PARITY_ODD;
+    else if (cfg->parity == PARITY_EVEN)    
+        uart_cfg.ui32Parity = AM_HAL_UART_PARITY_EVEN;
+
+    uart_cfg.ui32FlowCtrl = AM_HAL_UART_FLOW_CTRL_NONE;
 
     /* UART Config */
     am_hal_uart_config(uart->uart_device, &uart_cfg);
@@ -181,7 +186,7 @@ static rt_err_t am_configure(struct rt_serial_device *serial, struct serial_conf
     am_hal_uart_enable(uart->uart_device);
 
     /* Enable interrupts */
-    am_hal_uart_int_enable(uart->uart_device, AM_HAL_UART_INT_RX_TMOUT | AM_HAL_UART_INT_RX | AM_HAL_UART_INT_TX);
+    am_hal_uart_int_enable(uart->uart_device, AM_HAL_UART_INT_RX_TMOUT | AM_HAL_UART_INT_RX);
 
     /* Enable the uart interrupt in the NVIC */
     am_hal_interrupt_enable(uart->uart_interrupt);
@@ -231,7 +236,7 @@ static int am_putc(struct rt_serial_device *serial, char c)
     //if (txsize > 0)
     {
         am_hal_uart_char_transmit_buffered(uart->uart_device, c);
-		}
+    }
 
     /* Wait until busy bit clears to make sure UART fully transmitted last byte */
     while ( am_hal_uart_flags_get(uart->uart_device) & AM_HAL_UART_FR_BUSY );
@@ -400,9 +405,6 @@ int rt_hw_uart_init(void)
 #if defined(RT_USING_UART0)
     uart = &uart0;
     config.baud_rate = BAUD_RATE_115200;
-    config.data_bits = DATA_BITS_8;
-    config.stop_bits = STOP_BITS_1;
-    config.parity = PARITY_NONE;
 
     RCC_Configuration(uart);
 
@@ -418,9 +420,6 @@ int rt_hw_uart_init(void)
 #if defined(RT_USING_UART1)
     uart = &uart1;
     config.baud_rate = BAUD_RATE_115200;
-    config.data_bits = DATA_BITS_8;
-    config.stop_bits = STOP_BITS_1;
-    config.parity = PARITY_NONE;
 
     RCC_Configuration(uart);
 

+ 1 - 0
bsp/apollo2/libraries/drivers/SConscript

@@ -10,6 +10,7 @@ hal/am_hal_clkgen.c
 hal/am_hal_debug.c
 hal/am_hal_cachectrl.c
 hal/am_hal_pwrctrl.c
+hal/am_hal_mcuctrl.c
 hal/am_hal_sysctrl.c
 hal/am_hal_reset.c
 hal/am_hal_stimer.c

+ 1 - 1
bsp/apollo2/libraries/drivers/am_mcu_apollo.h

@@ -44,7 +44,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 #ifndef AM_MCU_APOLLO_H

+ 1 - 1
bsp/apollo2/libraries/drivers/hal/am_hal_adc.c

@@ -42,7 +42,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 

+ 6 - 6
bsp/apollo2/libraries/drivers/hal/am_hal_adc.h

@@ -42,17 +42,12 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 #ifndef AM_HAL_ADC_H
 #define AM_HAL_ADC_H
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 //*****************************************************************************
 //
 //! @name Clock Selection
@@ -309,6 +304,11 @@ am_hal_adc_config_t;
     (((value) & AM_REG_ADC_FIFO_COUNT_M) >> AM_REG_ADC_FIFO_COUNT_S)
 //! @}
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 //*****************************************************************************
 //
 // External function definitions

+ 1 - 1
bsp/apollo2/libraries/drivers/hal/am_hal_cachectrl.c

@@ -42,7 +42,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 

+ 6 - 6
bsp/apollo2/libraries/drivers/hal/am_hal_cachectrl.h

@@ -38,17 +38,12 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 #ifndef AM_HAL_CACHECTRL_H
 #define AM_HAL_CACHECTRL_H
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 //*****************************************************************************
 //
 // Cache configuration structure
@@ -186,6 +181,11 @@ extern const am_hal_cachectrl_config_t am_hal_cachectrl_defaults;
      AM_HAL_CACHECTRL_CACHECFG_DATA_CLKGATE_ENABLE |                          \
      AM_HAL_CACHECTRL_CACHECFG_CONFIG_2WAY_512)
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 //*****************************************************************************
 //
 // External function definitions

+ 18 - 10
bsp/apollo2/libraries/drivers/hal/am_hal_clkgen.c

@@ -42,7 +42,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 
@@ -287,16 +287,20 @@ am_hal_clkgen_int_clear(uint32_t ui32Interrupt)
 //!     AM_HAL_CLKGEN_OSC_LFRC
 //!     AM_HAL_CLKGEN_OSC_XT
 //!
-//! @return 0 None.
+//! @return None.
 //
 //*****************************************************************************
 void
 am_hal_clkgen_osc_start(uint32_t ui32OscFlags)
 {
-    //
-    // Start the oscillator(s).
-    //
-    AM_REG(CLKGEN, OCTRL) &= ~ui32OscFlags;
+    if ( ui32OscFlags & (AM_HAL_CLKGEN_OSC_LFRC | AM_HAL_CLKGEN_OSC_XT) )
+    {
+        //
+        // Start the oscillator(s).
+        // Note that these bits are cleared in order to enable the oscillator.
+        //
+        AM_REG(CLKGEN, OCTRL) &= ~ui32OscFlags;
+    }
 }
 
 //*****************************************************************************
@@ -318,10 +322,14 @@ am_hal_clkgen_osc_start(uint32_t ui32OscFlags)
 void
 am_hal_clkgen_osc_stop(uint32_t ui32OscFlags)
 {
-    //
-    // Stop the oscillator(s).
-    //
-    AM_REG(CLKGEN, OCTRL) |= ui32OscFlags;
+    if ( ui32OscFlags & (AM_HAL_CLKGEN_OSC_LFRC | AM_HAL_CLKGEN_OSC_XT) )
+    {
+        //
+        // Stop the oscillator(s).
+        // Note that these bits are set in order to stop the oscillator.
+        //
+        AM_REG(CLKGEN, OCTRL) |= ui32OscFlags;
+    }
 }
 
 //*****************************************************************************

+ 6 - 6
bsp/apollo2/libraries/drivers/hal/am_hal_clkgen.h

@@ -38,17 +38,12 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 #ifndef AM_HAL_CLKGEN_H
 #define AM_HAL_CLKGEN_H
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 //*****************************************************************************
 //
 //! @name System Clock max frequency
@@ -178,6 +173,11 @@ extern "C"
         (AM_REG_CLKGEN_UARTEN_UART0EN_##entype <<                               \
          AM_HAL_CLKGEN_UARTEN_UARTENn_S(module))
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 //*****************************************************************************
 //
 // External function definitions

+ 11 - 10
bsp/apollo2/libraries/drivers/hal/am_hal_ctimer.c

@@ -42,7 +42,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 
@@ -68,11 +68,12 @@
 // still pass in the event of a timer rollover.
 //
 //*****************************************************************************
+//! Timer read workaround: Do count values differ by one tick or less.
 #define adjacent(A, B)      (((A) == (B)) || (((A) + 1) == (B)) || ((B) == 0))
 
 //*****************************************************************************
 //
-// Array of function pointers for handling CTimer interrupts.
+//! Array of function pointers for handling CTimer interrupts.
 //
 //*****************************************************************************
 am_hal_ctimer_handler_t am_hal_ctimer_ppfnHandlers[16];
@@ -162,10 +163,10 @@ back2back_reads( uint32_t u32TimerAddr, uint32_t u32Data[])
 
 //*****************************************************************************
 //
-// @brief Check to see if the given CTimer is using the HFRC
-//
-//  Note - Calls to this function should be from inside a critical section.
-//
+//! @brief Check to see if the given CTimer is using the HFRC
+//!
+//! @note Calls to this function should be from inside a critical section.
+//!
 //! @return None.
 //
 //*****************************************************************************
@@ -501,7 +502,7 @@ am_hal_ctimer_config(uint32_t ui32TimerNumber,
 //! @param ui32TimerSegment specifies which segment of the timer should be
 //! enabled.
 //!
-//! @param ui32Configval specifies the configuration options for the selected
+//! @param ui32ConfigVal specifies the configuration options for the selected
 //! timer.
 //!
 //! This function should be used to perform the initial set-up of the
@@ -823,7 +824,7 @@ uint32_t
 am_hal_ctimer_read(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment)
 {
     volatile uint32_t ui32Value = 0;
-    uint32_t ui32Values[3] = {0};
+    uint32_t ui32Values[4] = {0, };
     uint32_t ui32TimerAddrTbl[4] =
     {
         REG_CTIMER_BASEADDR + AM_REG_CTIMER_TMR0_O,
@@ -1023,7 +1024,7 @@ am_hal_ctimer_pin_disable(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment)
 //!
 //! @param ui32TimerSegment specifies which segment of the timer to use.
 //!
-//! @param bInvertOutpt determines whether the output should be inverted. If
+//! @param bInvertOutput determines whether the output should be inverted. If
 //! true, the timer output pin for the selected timer segment will be
 //! inverted.
 //!
@@ -1131,7 +1132,7 @@ am_hal_ctimer_compare_set(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment,
     pui32CmprRegA = (uint32_t *)(AM_REG_CTIMERn(0) +
                                  AM_REG_CTIMER_CMPRA0_O +
                                  (ui32TimerNumber * TIMER_OFFSET));
-    pui32CmprRegB = pui32CmprRegA + CTIMER_CMPR_OFFSET;
+    pui32CmprRegB = pui32CmprRegA + CTIMER_CMPR_OFFSET / 4;
 
     //
     // Write the compare register with the selected value.

+ 7 - 7
bsp/apollo2/libraries/drivers/hal/am_hal_ctimer.h

@@ -42,17 +42,12 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 #ifndef AM_HAL_CTIMER_H
 #define AM_HAL_CTIMER_H
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 //*****************************************************************************
 //
 //! Number of timers
@@ -114,7 +109,7 @@ extern "C"
 //!
 //! These options are to be used with the \e am_hal_ctimer_config_t structure
 //! used by \e am_hal_ctimer_config
-//!  @{
+//! @{
 //
 //*****************************************************************************
 #define AM_HAL_CTIMER_CLK_PIN               AM_REG_CTIMER_CTRL0_TMRA0CLK(0x0)
@@ -208,6 +203,11 @@ am_hal_ctimer_config_t;
 //*****************************************************************************
 typedef void (*am_hal_ctimer_handler_t)(void);
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 //*****************************************************************************
 //
 // External function definitions

+ 1 - 1
bsp/apollo2/libraries/drivers/hal/am_hal_debug.c

@@ -42,7 +42,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 

+ 6 - 6
bsp/apollo2/libraries/drivers/hal/am_hal_debug.h

@@ -42,17 +42,12 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 #ifndef AM_HAL_DEBUG_H
 #define AM_HAL_DEBUG_H
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 //*****************************************************************************
 //
 // Debug assert macros.
@@ -73,6 +68,11 @@ extern "C"
 
 #endif // AM_DEBUG_ASSERT
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 //*****************************************************************************
 //
 // External function prototypes.

+ 42 - 1
bsp/apollo2/libraries/drivers/hal/am_hal_flash.c

@@ -54,7 +54,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 
@@ -428,6 +428,47 @@ am_hal_flash_delay(uint32_t ui32Iterations)
     g_am_hal_flash.delay_cycles(ui32Iterations);
 }
 
+//*****************************************************************************
+//
+//! @brief Delays for a desired amount of cycles while also waiting for a
+//! status change.
+//!
+//! @param ui32usMaxDelay - Maximum number of ~1uS delay loops.
+//! @param ui32Address    - Address of the register for the status change.
+//! @param ui32Mask       - Mask for the status change.
+//! @param ui32Value      - Target value for the status change.
+//!
+//! This function will delay for approximately the given number of microseconds
+//! while checking for a status change, exiting when either the given time has
+//! expired or the status change is detected.
+//!
+//! @returns 0 = timeout.
+//!          1 = status change detected.
+//
+//*****************************************************************************
+uint32_t
+am_hal_flash_delay_status_change(uint32_t ui32usMaxDelay, uint32_t ui32Address,
+                                 uint32_t ui32Mask, uint32_t ui32Value)
+{
+    while ( ui32usMaxDelay-- )
+    {
+        //
+        // Check the status
+        //
+        if ( ( AM_REGVAL(ui32Address) & ui32Mask ) == ui32Value )
+        {
+            return 1;
+        }
+
+        //
+        // Call the BOOTROM cycle function to delay for about 1 microsecond.
+        //
+        am_hal_flash_delay( FLASH_CYCLES_US(1) );
+    }
+
+    return 0;
+} // am_hal_flash_delay_status_change()
+
 //*****************************************************************************
 //
 //! @brief Static Helper Function to check customer info valid bits erasure.

+ 19 - 9
bsp/apollo2/libraries/drivers/hal/am_hal_flash.h

@@ -42,17 +42,12 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 #ifndef AM_HAL_FLASH_H
 #define AM_HAL_FLASH_H
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 #include <stdint.h>
 #include <stdbool.h>
 
@@ -94,13 +89,19 @@ extern "C"
 //
 #define AM_HAL_FLASH_ADDR2ABSPAGE(addr)     ( addr >> 13 )
 
+//*****************************************************************************
+//
+// Given an integer number of microseconds, convert to a value representing the
+// number of am_hal_flash_delay() cycles that will provide that amount of delay.
+// This macro is designed to take into account some of the call overhead.
 //
-// Given a number of microseconds, convert to a value representing the number of
-// cycles that will give that delay. This macro is basically taking into account
-// some of the call overhead.
 // e.g. To provide a 2us delay:
 //  am_hal_flash_delay( FLASH_CYCLES_US(2) );
 //
+// IMPORTANT - Apollo2 is spec'ed for only 48MHz operation, so this macro
+// assumes that.
+//
+//*****************************************************************************
 #define FLASH_CYCLES_US(n)      ((n * (AM_HAL_CLKGEN_FREQ_MAX_MHZ / 3)) - 4)
 
 //
@@ -223,6 +224,11 @@ extern g_am_hal_flash_t g_am_hal_flash;
 #define AM_HAL_FLASH_INFO_CHUNK2INST(n)     ((n >> 5) & 1
 #define AM_HAL_FLASH_INFO_ADDR2CHUNK(n)     ((n) >> 14)
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 //*****************************************************************************
 //
 // Function prototypes for the helper functions
@@ -254,6 +260,10 @@ extern void     am_hal_flash_recovery(uint32_t ui32RecoveryKey);
 extern uint32_t am_hal_flash_load_ui32(uint32_t ui32Address);
 extern void     am_hal_flash_store_ui32(uint32_t ui32Address, uint32_t ui32Data);
 extern void     am_hal_flash_delay(uint32_t ui32Iterations);
+extern uint32_t am_hal_flash_delay_status_change(uint32_t ui32Iterations,
+                                                 uint32_t ui32Address,
+                                                 uint32_t ui32Mask,
+                                                 uint32_t ui32Value);
 
 //
 // These functions update security/protection bits in the customer INFO blOCK.

+ 1 - 1
bsp/apollo2/libraries/drivers/hal/am_hal_global.c

@@ -43,7 +43,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 

+ 6 - 6
bsp/apollo2/libraries/drivers/hal/am_hal_global.h

@@ -42,17 +42,12 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 #ifndef AM_HAL_GLOBAL_H
 #define AM_HAL_GLOBAL_H
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 //*****************************************************************************
 //
 // Macro definitions
@@ -107,6 +102,11 @@ extern "C"
 //*****************************************************************************
 extern volatile uint32_t g_ui32HALflags;
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 #ifdef __cplusplus
 }
 #endif

+ 2 - 2
bsp/apollo2/libraries/drivers/hal/am_hal_gpio.c

@@ -42,7 +42,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 
@@ -479,7 +479,7 @@ am_hal_gpio_int_register(uint32_t ui32GPIONumber,
 //!
 //! This function gets the state of one GPIO polarity bit.
 //!
-//! @note When the bit is a one the interrupt polarity is rising edge.
+//! @note When the bit is a zero the interrupt polarity is rising edge.
 //!
 //! @return the current polarity.
 //

+ 14 - 5
bsp/apollo2/libraries/drivers/hal/am_hal_gpio.h

@@ -42,7 +42,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 
@@ -119,7 +119,7 @@
 
 //*****************************************************************************
 //
-// Output options
+// Output options (OUTCFG)
 //
 //*****************************************************************************
 #define AM_HAL_GPIO_OUT_DISABLE     ((0x0 << 1) << CFGVAL_GPIOCFG_S)
@@ -127,6 +127,15 @@
 #define AM_HAL_GPIO_OUT_OPENDRAIN   ((0x2 << 1) << CFGVAL_GPIOCFG_S)
 #define AM_HAL_GPIO_OUT_3STATE      ((0x3 << 1) << CFGVAL_GPIOCFG_S)
 
+//*****************************************************************************
+//
+// Special options for IOM0 and IOM4 clocks.
+// For 24MHz operation, a special enable must be selected. The 24MHZ select is
+// selected via bit0 of OUTCFG (which is, in a way,an alias of OUT_PUSHPULL).
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_24MHZ_ENABLE    ((0x1 << 1) << CFGVAL_GPIOCFG_S)
+
 //*****************************************************************************
 //
 // Pad configuration options.
@@ -498,13 +507,13 @@
 //! @return None.
 //
 //*****************************************************************************
-#define am_hal_gpio_int_polarity_bit_set(ui32PinNumber, ui32Polarity)         \
-    if ( (uint32_t)(ui32PinNumber) < AM_HAL_GPIO_MAX_PADS )                   \
+#define am_hal_gpio_int_polarity_bit_set(ui32BitNum, ui32Polarity)            \
+    if ( (uint32_t)(ui32BitNum) < AM_HAL_GPIO_MAX_PADS )                      \
     {                                                                         \
         AM_CRITICAL_BEGIN_ASM                                                 \
                                                                               \
         AM_REGn(GPIO, 0, PADKEY) = AM_REG_GPIO_PADKEY_KEYVAL;                 \
-        AM_HAL_GPIO_POL_W(ui32PinNumber, ui32Polarity);                       \
+        AM_HAL_GPIO_POL_W(ui32BitNum, ui32Polarity);                          \
         AM_REGn(GPIO, 0, PADKEY) = 0;                                         \
                                                                               \
         AM_CRITICAL_END_ASM                                                   \

+ 11 - 11
bsp/apollo2/libraries/drivers/hal/am_hal_i2c_bit_bang.c

@@ -41,7 +41,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 
@@ -133,7 +133,7 @@ static am_hal_i2c_bit_bang_priv_t am_hal_i2c_bit_bang_priv;
 // Wait for any stretched clock to go high
 // If it times out - return failure
 //
-static bool
+static __inline bool
 i2c_pull_and_wait_scl_hi(void)
 {
     // Maximum time to wait for clock stretching
@@ -165,7 +165,7 @@ i2c_pull_and_wait_scl_hi(void)
 //! returns None.
 //
 //*****************************************************************************
-am_hal_i2c_bit_bang_enum_t
+am_hal_i2c_bit_bang_enum_e
 am_hal_i2c_bit_bang_init(uint32_t sck_gpio_number,
                          uint32_t sda_gpio_number)
 {
@@ -192,7 +192,7 @@ am_hal_i2c_bit_bang_init(uint32_t sck_gpio_number,
     //
     // Set up SCK GPIO configuration bi-direction, input
     //
-    am_hal_gpio_pin_config(sck_gpio_number, AM_HAL_PIN_OPENDRAIN);
+    am_hal_gpio_pin_config(sck_gpio_number, AM_HAL_PIN_OPENDRAIN | AM_HAL_GPIO_INPEN);
 
     //
     // Set SDA GPIO data bit high so we aren't pulling down the data line
@@ -201,7 +201,7 @@ am_hal_i2c_bit_bang_init(uint32_t sck_gpio_number,
     //
     // Set up SDA GPIO configuration bi-direction, input
     //
-    am_hal_gpio_pin_config(sda_gpio_number, AM_HAL_PIN_OPENDRAIN);
+    am_hal_gpio_pin_config(sda_gpio_number, AM_HAL_PIN_OPENDRAIN | AM_HAL_GPIO_INPEN);
 
     // Now make sure we have control of the clock line
     //
@@ -284,7 +284,7 @@ am_hal_i2c_bit_bang_init(uint32_t sck_gpio_number,
 //! returns the byte received
 //
 //*****************************************************************************
-static am_hal_i2c_bit_bang_enum_t
+static __inline am_hal_i2c_bit_bang_enum_e
 i2c_receive_byte(uint8_t *pRxByte, bool bNack)
 {
     int i;
@@ -389,7 +389,7 @@ i2c_receive_byte(uint8_t *pRxByte, bool bNack)
 //!     }
 //
 //*****************************************************************************
-static am_hal_i2c_bit_bang_enum_t
+static __inline am_hal_i2c_bit_bang_enum_e
 i2c_send_byte(uint8_t one_byte)
 {
     int i;
@@ -478,13 +478,13 @@ i2c_send_byte(uint8_t one_byte)
 //! returns ENUM{AM_HAL_I2C_BIT_BANG_SUCCESS,AM_HAL_I2C_BIT_BANG_ADDRESS_NAKED}
 //
 //*****************************************************************************
-am_hal_i2c_bit_bang_enum_t
+am_hal_i2c_bit_bang_enum_e
 am_hal_i2c_bit_bang_receive(uint8_t address, uint32_t number_of_bytes,
                             uint8_t *pData, uint8_t ui8Offset,
                             bool bUseOffset, bool bNoStop)
 {
     uint32_t ui32I;
-    am_hal_i2c_bit_bang_enum_t status = AM_HAL_I2C_BIT_BANG_SUCCESS;
+    am_hal_i2c_bit_bang_enum_e status = AM_HAL_I2C_BIT_BANG_SUCCESS;
 
 
     if (i2c_pull_and_wait_scl_hi())
@@ -617,13 +617,13 @@ am_hal_i2c_bit_bang_receive(uint8_t address, uint32_t number_of_bytes,
 //!               AM_HAL_I2C_BIT_BANG_ADDRESS_NAKED}
 //
 //*****************************************************************************
-am_hal_i2c_bit_bang_enum_t
+am_hal_i2c_bit_bang_enum_e
 am_hal_i2c_bit_bang_send(uint8_t address, uint32_t number_of_bytes,
                          uint8_t *pData, uint8_t ui8Offset,
                          bool bUseOffset, bool bNoStop)
 {
     uint32_t ui32I;
-    am_hal_i2c_bit_bang_enum_t status;
+    am_hal_i2c_bit_bang_enum_e status;
     bool data_naked = false;
 
     if (i2c_pull_and_wait_scl_hi())

+ 11 - 10
bsp/apollo2/libraries/drivers/hal/am_hal_i2c_bit_bang.h

@@ -40,17 +40,12 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 #ifndef AM_HAL_I2C_BIT_BANG_H
 #define AM_HAL_I2C_BIT_BANG_H
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 //*****************************************************************************
 //
 // Enumerated return constants
@@ -63,24 +58,30 @@ typedef enum
     AM_HAL_I2C_BIT_BANG_DATA_NAKED,
     AM_HAL_I2C_BIT_BANG_CLOCK_TIMEOUT,
     AM_HAL_I2C_BIT_BANG_DATA_TIMEOUT,
-}am_hal_i2c_bit_bang_enum_t;
+    AM_HAL_I2C_BIT_BANG_STATUS_MAX,
+}am_hal_i2c_bit_bang_enum_e;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
 
 //*****************************************************************************
 //
 // External function definitions
 //
 //*****************************************************************************
-extern am_hal_i2c_bit_bang_enum_t am_hal_i2c_bit_bang_init(uint32_t sck_gpio_number,
+extern am_hal_i2c_bit_bang_enum_e am_hal_i2c_bit_bang_init(uint32_t sck_gpio_number,
                                      uint32_t sda_gpio_number);
 
-extern am_hal_i2c_bit_bang_enum_t am_hal_i2c_bit_bang_send(uint8_t address,
+extern am_hal_i2c_bit_bang_enum_e am_hal_i2c_bit_bang_send(uint8_t address,
                                                     uint32_t number_of_bytes,
                                                     uint8_t *pData,
                                                     uint8_t ui8Offset,
                                                     bool bUseOffset,
                                                     bool bNoStop);
 
-extern am_hal_i2c_bit_bang_enum_t am_hal_i2c_bit_bang_receive(uint8_t address,
+extern am_hal_i2c_bit_bang_enum_e am_hal_i2c_bit_bang_receive(uint8_t address,
                                                     uint32_t number_of_bytes,
                                                     uint8_t *pData,
                                                     uint8_t ui8Offset,

+ 4 - 4
bsp/apollo2/libraries/drivers/hal/am_hal_interrupt.c

@@ -44,7 +44,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 
@@ -190,7 +190,7 @@ am_hal_interrupt_priority_set(uint32_t ui32Interrupt, uint32_t ui32Priority)
     //
     // OR in the new priority.
     //
-    *pui32PriorityReg |= (ui32Priority << ui32Shift);
+    *pui32PriorityReg = ui32OldPriority | (ui32Priority << ui32Shift);
 }
 
 //*****************************************************************************
@@ -210,7 +210,7 @@ void am_hal_interrupt_pend_set(uint32_t ui32Interrupt)
     //
     // Check to see if the specified interrupt is valid for this MCU
     //
-    if ( ui32Interrupt > 47 )
+    if ( ui32Interrupt > AM_HAL_INTERRUPT_MAX )
     {
         return;
     }
@@ -247,7 +247,7 @@ void am_hal_interrupt_pend_clear(uint32_t ui32Interrupt)
     //
     // Check to see if the specified interrupt is valid for this MCU
     //
-    if ( ui32Interrupt > 47 )
+    if ( ui32Interrupt > AM_HAL_INTERRUPT_MAX )
     {
         return;
     }

+ 6 - 5
bsp/apollo2/libraries/drivers/hal/am_hal_interrupt.h

@@ -44,16 +44,12 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 #ifndef AM_HAL_INTERRUPT_H
 #define AM_HAL_INTERRUPT_H
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
 //*****************************************************************************
 //
 //! @name ISR number macros.
@@ -66,6 +62,7 @@ extern "C"
 //
 // Hardware interrupts
 //
+#define AM_HAL_INTERRUPT_MAX                (47)    //AM_HAL_INTERRUPT_SOFTWARE3
 #define AM_HAL_INTERRUPT_RESET              1
 #define AM_HAL_INTERRUPT_NMI                2
 #define AM_HAL_INTERRUPT_HARDFAULT          3
@@ -130,6 +127,10 @@ extern "C"
 //*****************************************************************************
 #define AM_HAL_INTERRUPT_PRIORITY(n)        (((uint32_t)(n) & 0x7) << 5)
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
 //*****************************************************************************
 //
 // External function definitions

File diff suppressed because it is too large
+ 571 - 158
bsp/apollo2/libraries/drivers/hal/am_hal_iom.c


+ 84 - 32
bsp/apollo2/libraries/drivers/hal/am_hal_iom.h

@@ -42,7 +42,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 
@@ -79,11 +79,13 @@
 #define AM_HAL_IOM_2MHZ      2000000
 #define AM_HAL_IOM_1_5MHZ    1500000
 #define AM_HAL_IOM_1MHZ      1000000
+#define AM_HAL_IOM_800KHZ     800000
 #define AM_HAL_IOM_750KHZ     750000
 #define AM_HAL_IOM_500KHZ     500000
 #define AM_HAL_IOM_400KHZ     400000
 #define AM_HAL_IOM_375KHZ     375000
 #define AM_HAL_IOM_250KHZ     250000
+#define AM_HAL_IOM_200KHZ     200000
 #define AM_HAL_IOM_125KHZ     125000
 #define AM_HAL_IOM_100KHZ     100000
 #define AM_HAL_IOM_50KHZ       50000
@@ -176,32 +178,69 @@
 #define AM_HAL_IOM_INT_FUNDFL               AM_REG_IOMSTR_INTEN_FUNDFL_M
 #define AM_HAL_IOM_INT_THR                  AM_REG_IOMSTR_INTEN_THR_M
 #define AM_HAL_IOM_INT_CMDCMP               AM_REG_IOMSTR_INTEN_CMDCMP_M
+
+#define AM_HAL_IOM_INT_ALL          (   \
+            AM_HAL_IOM_INT_ARB      |   \
+            AM_HAL_IOM_INT_STOP     |   \
+            AM_HAL_IOM_INT_START    |   \
+            AM_HAL_IOM_INT_ICMD     |   \
+            AM_HAL_IOM_INT_IACC     |   \
+            AM_HAL_IOM_INT_WTLEN    |   \
+            AM_HAL_IOM_INT_NAK      |   \
+            AM_HAL_IOM_INT_FOVFL    |   \
+            AM_HAL_IOM_INT_FUNDFL   |   \
+            AM_HAL_IOM_INT_THR      |   \
+            AM_HAL_IOM_INT_CMDCMP)
+
+#define AM_HAL_IOM_INT_SWERR        (   \
+            AM_HAL_IOM_INT_ICMD     |   \
+            AM_HAL_IOM_INT_FOVFL    |   \
+            AM_HAL_IOM_INT_FUNDFL   |   \
+            AM_HAL_IOM_INT_IACC)
+
+#define AM_HAL_IOM_INT_I2CARBERR    (   \
+            AM_HAL_IOM_INT_ARB      |   \
+            AM_HAL_IOM_INT_START    |   \
+            AM_HAL_IOM_INT_STOP)
 //! @}
 
 //*****************************************************************************
 //
-//! @name IOM function errors
-//! @brief Return values for IOM HAL function errors, such as with the function
-//!        am_hal_iom_error_status_get().
+//! @name Software IOM modules
+//! @brief Macro definitions for using the software I2C interface.
+//!
+//! Use this macro as the module number for standard IOM functions to emulate
+//! them using the bit-banged i2c interface.
 //!
 //! @{
 //
 //*****************************************************************************
-#define AM_HAL_IOM_ERR_INVALID_MODULE       (1 << 30)
+#define AM_HAL_IOM_I2CBB_MODULE             AM_REG_IOMSTR_NUM_MODULES
 //! @}
 
 //*****************************************************************************
 //
-//! @name Software IOM modules
-//! @brief Macro definitions for using the software I2C interface.
+//! @name IOM Return Codes
+//! @brief Enum definitions for defining return values for IOM APIs
 //!
-//! Use this macro as the module number for standard IOM functions to emulate
-//! them using the bit-banged i2c interface.
+//! This enum defines possible values for non-void IOM APIs
 //!
 //! @{
 //
 //*****************************************************************************
-#define AM_HAL_IOM_I2CBB_MODULE             AM_REG_IOMSTR_NUM_MODULES
+typedef enum
+{
+    AM_HAL_IOM_SUCCESS = 0,
+    AM_HAL_IOM_ERR_TIMEOUT,
+    AM_HAL_IOM_ERR_INVALID_MODULE,
+    AM_HAL_IOM_ERR_INVALID_PARAM,
+    AM_HAL_IOM_ERR_INVALID_CFG,
+    AM_HAL_IOM_ERR_INVALID_OPER,
+    AM_HAL_IOM_ERR_I2C_NAK,
+    AM_HAL_IOM_ERR_I2C_ARB,
+    AM_HAL_IOM_ERR_RESOURCE_ERR,
+} am_hal_iom_status_e ;
+
 //! @}
 
 //*****************************************************************************
@@ -271,7 +310,7 @@ typedef struct
     //! Select the SPI clock polarity (unused in I2C mode).
     //
     bool bSPOL;
-
+    
     //
     //! @brief Select the FIFO write threshold.
     //!
@@ -404,7 +443,11 @@ am_hal_iom_pwrsave_t;
 //
 //*****************************************************************************
 extern am_hal_iom_pwrsave_t am_hal_iom_pwrsave[AM_REG_IOMSTR_NUM_MODULES];
-extern uint32_t g_iom_error_status;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
 
 //*****************************************************************************
 //
@@ -420,23 +463,30 @@ extern void     am_hal_iom_config(uint32_t ui32Module,
 extern uint32_t am_hal_iom_frequency_get(uint32_t ui32Module);
 extern void     am_hal_iom_enable(uint32_t ui32Module);
 extern void     am_hal_iom_disable(uint32_t ui32Module);
-extern void     am_hal_iom_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
+extern am_hal_iom_status_e am_hal_iom_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
                                      uint32_t *pui32Data, uint32_t ui32NumBytes,
                                      uint32_t ui32Options);
-extern void     am_hal_iom_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
+extern am_hal_iom_status_e am_hal_iom_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
                                     uint32_t *pui32Data, uint32_t ui32NumBytes,
                                     uint32_t ui32Options);
-extern uint32_t am_hal_iom_spi_write_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
+extern am_hal_iom_status_e am_hal_iom_spi_fullduplex(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                                                     uint32_t *pui32TxData, uint32_t *pui32RxData, 
+                                                     uint32_t ui32NumBytes, uint32_t ui32Options);
+
+extern am_hal_iom_status_e am_hal_iom_spi_write_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
                                         uint32_t *pui32Data, uint32_t ui32NumBytes,
                                         uint32_t ui32Options);
-extern uint32_t am_hal_iom_spi_read_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
+extern am_hal_iom_status_e am_hal_iom_spi_read_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
                                        uint32_t *pui32Data, uint32_t ui32NumBytes,
                                        uint32_t ui32Options);
-extern void     am_hal_iom_spi_write_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
+extern am_hal_iom_status_e am_hal_iom_spi_fullduplex_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                                                        uint32_t *pui32TxData, uint32_t *pui32RxData, 
+                                                        uint32_t ui32NumBytes, uint32_t ui32Options);
+extern am_hal_iom_status_e am_hal_iom_spi_write_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
                                         uint32_t *pui32Data, uint32_t ui32NumBytes,
                                         uint32_t ui32Options,
                                         am_hal_iom_callback_t pfnCallback);
-extern uint32_t am_hal_iom_spi_read_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
+extern am_hal_iom_status_e am_hal_iom_spi_read_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
                                        uint32_t *pui32Data, uint32_t ui32NumBytes,
                                        uint32_t ui32Options,
                                        am_hal_iom_callback_t pfnCallback);
@@ -445,39 +495,39 @@ extern void     am_hal_iom_spi_cmd_run(uint32_t ui32Operation,
                                        uint32_t ui32ChipSelect,
                                        uint32_t ui32NumBytes,
                                        uint32_t ui32Options);
-extern void     am_hal_iom_i2c_write(uint32_t ui32Module,
+extern am_hal_iom_status_e am_hal_iom_i2c_write(uint32_t ui32Module,
                                      uint32_t ui32BusAddress,
                                      uint32_t *pui32Data,
                                      uint32_t ui32NumBytes,
                                      uint32_t ui32Options);
-extern void     am_hal_iom_i2c_read(uint32_t ui32Module,
+extern am_hal_iom_status_e am_hal_iom_i2c_read(uint32_t ui32Module,
                                     uint32_t ui32BusAddress,
                                     uint32_t *pui32Data,
                                     uint32_t ui32NumBytes,
                                     uint32_t ui32Options);
-extern uint32_t am_hal_iom_i2c_write_nq(uint32_t ui32Module,
+extern am_hal_iom_status_e am_hal_iom_i2c_write_nq(uint32_t ui32Module,
                                         uint32_t ui32BusAddress,
                                         uint32_t *pui32Data,
                                         uint32_t ui32NumBytes,
                                         uint32_t ui32Options);
-extern uint32_t am_hal_iom_i2c_read_nq(uint32_t ui32Module,
+extern am_hal_iom_status_e am_hal_iom_i2c_read_nq(uint32_t ui32Module,
                                        uint32_t ui32BusAddress,
                                        uint32_t *pui32Data,
                                        uint32_t ui32NumBytes,
                                        uint32_t ui32Options);
-extern void     am_hal_iom_i2c_write_nb(uint32_t ui32Module,
+extern am_hal_iom_status_e am_hal_iom_i2c_write_nb(uint32_t ui32Module,
                                         uint32_t ui32BusAddress,
                                         uint32_t *pui32Data,
                                         uint32_t ui32NumBytes,
                                         uint32_t ui32Options,
                                         am_hal_iom_callback_t pfnCallback);
-extern void     am_hal_iom_i2c_read_nb(uint32_t ui32Module,
+extern am_hal_iom_status_e am_hal_iom_i2c_read_nb(uint32_t ui32Module,
                                        uint32_t ui32BusAddress,
                                        uint32_t *pui32Data,
                                        uint32_t ui32NumBytes,
                                        uint32_t ui32Options,
                                        am_hal_iom_callback_t pfnCallback);
-extern void     am_hal_iom_i2c_cmd_run(uint32_t ui32Operation,
+extern am_hal_iom_status_e am_hal_iom_i2c_cmd_run(uint32_t ui32Operation,
                                        uint32_t ui32Module,
                                        uint32_t ui32BusAddress,
                                        uint32_t ui32NumBytes,
@@ -485,7 +535,7 @@ extern void     am_hal_iom_i2c_cmd_run(uint32_t ui32Operation,
 extern void     am_hal_iom_command_repeat_set(uint32_t ui32Module,
                                               uint32_t ui32CmdCount);
 extern uint32_t am_hal_iom_status_get(uint32_t ui32Module);
-extern uint32_t am_hal_iom_error_status_get(uint32_t ui32Module);
+extern am_hal_iom_status_e am_hal_iom_error_status_get(uint32_t ui32Module);
 extern uint32_t am_hal_iom_fifo_write(uint32_t ui32Module, uint32_t *pui32Data,
                                       uint32_t ui32NumBytes);
 extern uint32_t am_hal_iom_fifo_read(uint32_t ui32Module, uint32_t *pui32Data,
@@ -505,19 +555,19 @@ extern void     am_hal_iom_queue_init(uint32_t ui32ModuleNum,
                                       uint32_t ui32QueueMemSize);
 extern uint32_t am_hal_iom_queue_length_get(uint32_t ui32Module);
 extern void     am_hal_iom_sleeping_queue_flush(uint32_t ui32Module);
-extern void     am_hal_iom_queue_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
+extern am_hal_iom_status_e am_hal_iom_queue_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
                                            uint32_t *pui32Data, uint32_t ui32NumBytes,
                                            uint32_t ui32Options,
                                            am_hal_iom_callback_t pfnCallback);
-extern void     am_hal_iom_queue_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
+extern am_hal_iom_status_e am_hal_iom_queue_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
                                           uint32_t *pui32Data, uint32_t ui32NumBytes,
                                           uint32_t ui32Options,
                                           am_hal_iom_callback_t pfnCallback);
-extern void     am_hal_iom_queue_i2c_write(uint32_t ui32Module, uint32_t ui32BusAddress,
+extern am_hal_iom_status_e am_hal_iom_queue_i2c_write(uint32_t ui32Module, uint32_t ui32BusAddress,
                                            uint32_t *pui32Data, uint32_t ui32NumBytes,
                                            uint32_t ui32Options,
                                            am_hal_iom_callback_t pfnCallback);
-extern void     am_hal_iom_queue_i2c_read(uint32_t ui32Module, uint32_t ui32BusAddress,
+extern am_hal_iom_status_e am_hal_iom_queue_i2c_read(uint32_t ui32Module, uint32_t ui32BusAddress,
                                           uint32_t *pui32Data, uint32_t ui32NumBytes,
                                           uint32_t ui32Options,
                                           am_hal_iom_callback_t pfnCallback);
@@ -533,7 +583,6 @@ extern void     am_hal_iom_queue_service(uint32_t ui32Module, uint32_t ui32Statu
 void am_iomaster##x##_isr(void)                             \
 {                                                           \
     uint32_t ui32IntStatus;                                 \
-    g_iom_error_status = am_hal_iom_error_status_get(x);    \
     ui32IntStatus = am_hal_iom_int_status_get(x, false);    \
     am_hal_iom_int_clear(x, ui32IntStatus);                 \
     am_hal_iom_queue_service(x, ui32IntStatus);             \
@@ -543,12 +592,15 @@ void am_iomaster##x##_isr(void)                             \
 void am_iomaster##x##_isr(void)                             \
 {                                                           \
     uint32_t ui32IntStatus;                                 \
-    g_iom_error_status = am_hal_iom_error_status_get(x);    \
     ui32IntStatus = am_hal_iom_int_status_get(x, false);    \
     am_hal_iom_int_clear(x, ui32IntStatus);                 \
     am_hal_iom_int_service(x, ui32IntStatus);               \
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif // AM_HAL_IOM_H
 
 //*****************************************************************************

+ 45 - 11
bsp/apollo2/libraries/drivers/hal/am_hal_ios.c

@@ -42,7 +42,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 
@@ -61,6 +61,7 @@ typedef struct
     volatile uint32_t ui32WriteIndex;
     volatile uint32_t ui32ReadIndex;
     volatile uint32_t ui32Length;
+    uint32_t          ui32FifoInc;
     uint32_t          ui32Capacity;
 }
 am_hal_ios_buffer_t;
@@ -103,6 +104,23 @@ uint8_t *g_pui8FIFOPtr = (uint8_t *) REG_IOSLAVE_BASEADDR;
 uint8_t g_ui32HwFifoSize = 0;
 uint32_t g_ui32FifoBaseOffset = 0;
 
+//*****************************************************************************
+//
+// Checks to see if this processor is a Rev B2 device.
+//
+// This is needed to disable SHELBY-1654 workaround.
+//
+//*****************************************************************************
+bool
+isRevB2(void)
+{
+    //
+    // Check to make sure the major rev is B and the minor rev is 2.
+    //
+    return ( (AM_REG(MCUCTRL, CHIPREV) & 0xFF) ==   \
+        (AM_REG_MCUCTRL_CHIPREV_REVMAJ_B | (AM_REG_MCUCTRL_CHIPREV_REVMIN_REV0 + 2)) );
+}
+
 //*****************************************************************************
 //
 //! @brief Enable the IOS in the power control block.
@@ -957,7 +975,10 @@ am_hal_ios_fifo_service(uint32_t ui32Status)
                     }
                 }
             }
-            resync_fifoSize();
+            if (!isRevB2())
+            {
+                resync_fifoSize();
+            }
 
             //
             // Need to retake the FIFO space, after Threshold interrupt has been reenabled
@@ -1041,7 +1062,10 @@ am_hal_ios_fifo_write(uint8_t *pui8Data, uint32_t ui32NumBytes)
             ui32NumBytes -= ui32FIFOSpace;
             pui8Data += ui32FIFOSpace;
         };
-        resync_fifoSize();
+        if (!isRevB2())
+        {
+            resync_fifoSize();
+        }
     }
 
     //
@@ -1102,6 +1126,8 @@ am_hal_ios_fifo_write(uint8_t *pui8Data, uint32_t ui32NumBytes)
         }
     }
 
+    // Number of bytes written
+    g_sSRAMBuffer.ui32FifoInc += totalBytes - ui32NumBytes;
     return (totalBytes - ui32NumBytes);
 }
 
@@ -1114,7 +1140,7 @@ am_hal_ios_fifo_write(uint8_t *pui8Data, uint32_t ui32NumBytes)
 //!
 //! This function will write data from the caller-provided array to the IOS
 //! LRAM FIFO. This simple routine does not use SRAM buffering for large
-//! messages.
+//! messages. This function also updates the FIFOCTR.
 //!
 //! The maximum message size for the IO Slave is 128 bytes.
 //!
@@ -1140,6 +1166,8 @@ am_hal_ios_fifo_write_simple(uint8_t *pui8Data, uint32_t ui32NumBytes)
     if ( ui32NumBytes <= ui32FIFOSpace )
     {
         fifo_write(pui8Data, ui32NumBytes);
+        // Write FIFOINC
+        AM_BFW(IOSLAVE, FIFOINC, FIFOINC, ui32NumBytes);
     }
     else
     {
@@ -1209,6 +1237,7 @@ am_hal_ios_buffer_init(am_hal_ios_buffer_t *psBuffer, void *pvArray,
     psBuffer->ui32ReadIndex = 0;
     psBuffer->ui32Length = 0;
     psBuffer->ui32Capacity = ui32Bytes;
+    psBuffer->ui32FifoInc = 0;
     psBuffer->pui8Data = (uint8_t *)pvArray;
 }
 
@@ -1273,12 +1302,19 @@ am_hal_ios_fifo_buffer_init(uint8_t *pui8Buffer, uint32_t ui32NumBytes)
 //! @brief Update the FIFOCTR to inform host of available data to read.
 //!
 //! This function allows the application to indicate to HAL when it is safe to
-//! update the FIFOCTR.
+//! update the FIFOCTR. This function needs to be used in conjunction with
+//! am_hal_ios_fifo_write(), which itself does not update the FIFOCTR
 //!
+//! CAUTION:
 //! Application needs to implement some sort of
 //! synchronization with the host to make sure host is not reading FIFOCTR while
 //! it is being updated by the MCU, since the FIFOCTR read over
-//! IO is not an atomic operation.
+//! IO is not an atomic operation. Otherwise, some other logic could be implemented
+//! by the host to detect and disregard transient values of FIFOCTR (e.g. multiple
+//! reads till it gets a stable value).
+//! For Pre-B2 parts, it is necessary to have this synchronization guarantee that
+//! Host is not doing any READ operation - be it for FIFOCTR or FIFO itself when
+//! this call is made, as otherwise the FIFOCTR value may get corrupted.
 //!
 //!
 //! @return None.
@@ -1287,11 +1323,9 @@ am_hal_ios_fifo_buffer_init(uint8_t *pui8Buffer, uint32_t ui32NumBytes)
 void
 am_hal_ios_update_fifoctr(void)
 {
-    uint32_t ui32Val;
-    // Determine the available data
-    ui32Val = am_hal_ios_fifo_space_used();
-    // Update FIFOCTR
-    AM_BFW(IOSLAVE, FIFOCTR, FIFOCTR, ui32Val);
+    // Write FIFOINC
+    AM_BFW(IOSLAVE, FIFOINC, FIFOINC, g_sSRAMBuffer.ui32FifoInc);
+    g_sSRAMBuffer.ui32FifoInc = 0;
     return;
 }
 

+ 5 - 5
bsp/apollo2/libraries/drivers/hal/am_hal_ios.h

@@ -42,16 +42,12 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 #ifndef AM_HAL_IOS_H
 #define AM_HAL_IOS_H
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
 
 //*****************************************************************************
 //
@@ -300,6 +296,10 @@ typedef struct
 }
 am_hal_ios_config_t;
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
 //*****************************************************************************
 //
 // External function definitions

+ 4 - 27
bsp/apollo2/libraries/drivers/hal/am_hal_itm.c

@@ -42,7 +42,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 
@@ -56,30 +56,6 @@
 //
 //*****************************************************************************
 
-//*****************************************************************************
-//
-//! @brief Delays for a desired amount of microseconds.
-//!
-//! @note - This function is based on the similar function in am_util_delay.c,
-//! please see that module for implementation details. It was necessary to
-//! duplicate it here to avoid having to update every example to include the
-//! am_util_delay.c module in its build.
-//!
-//! @returns None
-//
-//*****************************************************************************
-void
-am_hal_itm_delay_us(uint32_t ui32MicroSeconds)
-{
-    uint32_t ui32Iterations = ui32MicroSeconds *
-                              (am_hal_clkgen_sysclk_get() / 3000000);
-
-    //
-    // Call the BOOTROM cycle delay function
-    //
-    am_hal_flash_delay(ui32Iterations);
-}
-
 //*****************************************************************************
 //
 //! @brief Enables the ITM
@@ -118,7 +94,7 @@ am_hal_itm_enable(void)
     AM_REGVAL(AM_REG_ITM_TER_O) = 0xffffffff;
 
     //
-    // Write to the ITM control and status register (don't enable yet).
+    // Write to the ITM control and status register.
     //
     AM_REGVAL(AM_REG_ITM_TCR_O) =
         AM_WRITE_SM(AM_REG_ITM_TCR_ATB_ID, 0x15)      |
@@ -129,6 +105,7 @@ am_hal_itm_enable(void)
         AM_WRITE_SM(AM_REG_ITM_TCR_SYNC_ENABLE, 0)    |
         AM_WRITE_SM(AM_REG_ITM_TCR_TS_ENABLE, 0)      |
         AM_WRITE_SM(AM_REG_ITM_TCR_ITM_ENABLE, 1);
+
 }
 
 //*****************************************************************************
@@ -203,7 +180,7 @@ am_hal_itm_not_busy(void)
     //
     // wait for 50us for the data to flush out
     //
-    am_hal_itm_delay_us(50);
+    am_hal_flash_delay(FLASH_CYCLES_US(50));
 }
 
 //*****************************************************************************

+ 6 - 7
bsp/apollo2/libraries/drivers/hal/am_hal_itm.h

@@ -42,18 +42,13 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 
 #ifndef AM_HAL_ITM_H
 #define AM_HAL_ITM_H
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 //*****************************************************************************
 //
 // Sync Packet Defines
@@ -71,12 +66,16 @@ extern "C"
 #define AM_HAL_ITM_PRINT_NUM_REGS       1
 extern uint32_t am_hal_itm_print_registers[AM_HAL_ITM_PRINT_NUM_REGS];
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 //*****************************************************************************
 //
 // External function definitions
 //
 //*****************************************************************************
-extern void am_hal_itm_delay_us(uint32_t ui32MicroSeconds);
 extern void am_hal_itm_enable(void);
 extern void am_hal_itm_disable(void);
 extern void am_hal_itm_not_busy(void);

+ 1 - 1
bsp/apollo2/libraries/drivers/hal/am_hal_mcuctrl.c

@@ -42,7 +42,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 

+ 6 - 6
bsp/apollo2/libraries/drivers/hal/am_hal_mcuctrl.h

@@ -42,17 +42,12 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 #ifndef AM_HAL_MCUCTRL_H
 #define AM_HAL_MCUCTRL_H
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 //
 // Deprecate the am_hal_mcuctrl_bucks_enable() and disable() functions.
 // This functionality is now handled in pwrctrl.
@@ -188,6 +183,11 @@ typedef struct
 }
 am_hal_mcuctrl_fault_t;
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 //*****************************************************************************
 //
 // External function definitions

+ 1 - 1
bsp/apollo2/libraries/drivers/hal/am_hal_otp.c

@@ -38,7 +38,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 #include "am_mcu_apollo.h"

+ 6 - 6
bsp/apollo2/libraries/drivers/hal/am_hal_otp.h

@@ -38,17 +38,12 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 #ifndef AM_HAL_OTP_H
 #define AM_HAL_OTP_H
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 //*****************************************************************************
 //
 // Define some OTP values and macros.
@@ -82,6 +77,11 @@ extern "C"
 #define AM_OTP_SRAM_LOCKOUT_S       (2)
 #define AM_OTP_SRAM_LOCKOUT_M       (0x1 << AM_OTP_SRAM_LOCKOUT_S)
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 //*****************************************************************************
 //
 // Function prototypes

+ 1 - 1
bsp/apollo2/libraries/drivers/hal/am_hal_pdm.c

@@ -42,7 +42,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 

+ 10 - 1
bsp/apollo2/libraries/drivers/hal/am_hal_pdm.h

@@ -42,13 +42,18 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 
 #ifndef AM_HAL_PDM_H
 #define AM_HAL_PDM_H
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 //*****************************************************************************
 //
 // Macro definitions
@@ -655,6 +660,10 @@ extern void am_hal_pdm_disable(void);
 
 extern uint32_t am_hal_pdm_int_status_get(bool bEnabledOnly);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif // AM_HAL_PDM_H
 
 //*****************************************************************************

+ 30 - 39
bsp/apollo2/libraries/drivers/hal/am_hal_pin.h

@@ -41,7 +41,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 
@@ -55,7 +55,7 @@
 //*****************************************************************************
 #define AM_HAL_PIN_DIR_INPUT      (AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_DIR_OUTPUT     (AM_HAL_GPIO_OUT_PUSHPULL)
-#define AM_HAL_PIN_DIR_OPENDRAIN  (AM_HAL_GPIO_OUT_OPENDRAIN | AM_HAL_GPIO_INPEN)
+#define AM_HAL_PIN_DIR_OPENDRAIN  (AM_HAL_GPIO_OUT_OPENDRAIN)
 #define AM_HAL_PIN_DIR_3STATE     (AM_HAL_GPIO_OUT_3STATE)
 
 //*****************************************************************************
@@ -81,25 +81,25 @@
 #define AM_HAL_PIN_0_MxSCKLB      (AM_HAL_GPIO_FUNC(4))
 #define AM_HAL_PIN_0_M2SCK        (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_0_MxSCLLB      (AM_HAL_GPIO_FUNC(6))
-#define AM_HAL_PIN_0_M2SCL        (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_0_M2SCL        (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
 
-#define AM_HAL_PIN_1_SLSDA        (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_1_SLSDA        (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_1_SLMISO       (AM_HAL_GPIO_FUNC(1))
 #define AM_HAL_PIN_1_UART0TX      (AM_HAL_GPIO_FUNC(2))
 #define AM_HAL_PIN_1_GPIO         (AM_HAL_GPIO_FUNC(3))
 #define AM_HAL_PIN_1_MxMISOLB     (AM_HAL_GPIO_FUNC(4))
 #define AM_HAL_PIN_1_M2MISO       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_1_MxSDALB      (AM_HAL_GPIO_FUNC(6))
-#define AM_HAL_PIN_1_M2SDA        (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_1_M2SDA        (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
 
-#define AM_HAL_PIN_2_SLWIR3       (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_2_SLWIR3       (AM_HAL_GPIO_FUNC(0) | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_2_SLMOSI       (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_2_UART0RX      (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_2_GPIO         (AM_HAL_GPIO_FUNC(3))
 #define AM_HAL_PIN_2_MxMOSILB     (AM_HAL_GPIO_FUNC(4))
 #define AM_HAL_PIN_2_M2MOSI       (AM_HAL_GPIO_FUNC(5))
 #define AM_HAL_PIN_2_MxWIR3LB     (AM_HAL_GPIO_FUNC(6))
-#define AM_HAL_PIN_2_M2WIR3       (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_2_M2WIR3       (AM_HAL_GPIO_FUNC(7) | AM_HAL_GPIO_INPEN)
 
 #define AM_HAL_PIN_3_UART0RTS     (AM_HAL_GPIO_FUNC(0))
 #define AM_HAL_PIN_3_SLnCE        (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
@@ -109,7 +109,6 @@
 #define AM_HAL_PIN_3_M2nCE0       (AM_HAL_GPIO_FUNC(5))
 #define AM_HAL_PIN_3_TRIG1        (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_3_I2S_WCLK     (AM_HAL_GPIO_FUNC(7))
-#define AM_HAL_PIN_3_PSOURCE      (AM_HAL_GPIO_FUNC(3) | AM_HAL_PIN_DIR_OUTPUT | AM_HAL_GPIO_POWER)
 
 #define AM_HAL_PIN_4_UART0CTS     (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_4_SLINT        (AM_HAL_GPIO_FUNC(1))
@@ -119,17 +118,18 @@
 #define AM_HAL_PIN_4_M2nCE5       (AM_HAL_GPIO_FUNC(5))
 #define AM_HAL_PIN_4_CLKOUT       (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_4_32KHZ_XT     (AM_HAL_GPIO_FUNC(7))
+// PSINK usage: GPIOWT=0 to activate the power switch, GPIOWT=1 to disable
+#define AM_HAL_PIN_4_PSINK        (AM_HAL_GPIO_FUNC(3) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_POWER)
 
-#define AM_HAL_PIN_5_M0SCL        (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_5_M0SCL        (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_5_M0SCK        (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_5_UART0RTS     (AM_HAL_GPIO_FUNC(2))
 #define AM_HAL_PIN_5_GPIO         (AM_HAL_GPIO_FUNC(3))
 #define AM_HAL_PIN_5_M0SCKLB      (AM_HAL_GPIO_FUNC(4))
-#define AM_HAL_PIN_5_EXTHFA       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_5_M0SCLLB      (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_5_M1nCE2       (AM_HAL_GPIO_FUNC(7))
 
-#define AM_HAL_PIN_6_M0SDA        (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_6_M0SDA        (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_6_M0MISO       (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_6_UART0CTS     (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_6_GPIO         (AM_HAL_GPIO_FUNC(3))
@@ -138,7 +138,7 @@
 #define AM_HAL_PIN_6_SLSDALB      (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_6_I2S_DAT      (AM_HAL_GPIO_FUNC(7))
 
-#define AM_HAL_PIN_7_M0WIR3       (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_7_M0WIR3       (AM_HAL_GPIO_FUNC(0) | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_7_M0MOSI       (AM_HAL_GPIO_FUNC(1))
 #define AM_HAL_PIN_7_CLKOUT       (AM_HAL_GPIO_FUNC(2))
 #define AM_HAL_PIN_7_GPIO         (AM_HAL_GPIO_FUNC(3))
@@ -147,7 +147,7 @@
 #define AM_HAL_PIN_7_SLWIR3LB     (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_7_M1nCE1       (AM_HAL_GPIO_FUNC(7))
 
-#define AM_HAL_PIN_8_M1SCL        (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_8_M1SCL        (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_8_M1SCK        (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_8_M0nCE4       (AM_HAL_GPIO_FUNC(2))
 #define AM_HAL_PIN_8_GPIO         (AM_HAL_GPIO_FUNC(3))
@@ -156,7 +156,7 @@
 #define AM_HAL_PIN_8_UART1TX      (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_8_M1SCLLB      (AM_HAL_GPIO_FUNC(7))
 
-#define AM_HAL_PIN_9_M1SDA        (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_9_M1SDA        (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_9_M1MISO       (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_9_M0nCE5       (AM_HAL_GPIO_FUNC(2))
 #define AM_HAL_PIN_9_GPIO         (AM_HAL_GPIO_FUNC(3))
@@ -165,7 +165,7 @@
 #define AM_HAL_PIN_9_UART1RX      (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_9_SLSDALB      (AM_HAL_GPIO_FUNC(7))
 
-#define AM_HAL_PIN_10_M1WIR3      (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_10_M1WIR3      (AM_HAL_GPIO_FUNC(0) | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_10_M1MOSI      (AM_HAL_GPIO_FUNC(1))
 #define AM_HAL_PIN_10_M0nCE6      (AM_HAL_GPIO_FUNC(2))
 #define AM_HAL_PIN_10_GPIO        (AM_HAL_GPIO_FUNC(3))
@@ -182,7 +182,6 @@
 #define AM_HAL_PIN_11_UART1CTS    (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_11_UART0RX     (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_11_PDM_DATA    (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_INPUT)
-#define AM_HAL_PIN_11_PSINK       (AM_HAL_GPIO_FUNC(3))
 
 #define AM_HAL_PIN_12_ADCD0NSE9   (AM_HAL_GPIO_FUNC(0))
 #define AM_HAL_PIN_12_M1nCE0      (AM_HAL_GPIO_FUNC(1))
@@ -198,7 +197,6 @@
 #define AM_HAL_PIN_13_TCTB0       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_13_GPIO        (AM_HAL_GPIO_FUNC(3))
 #define AM_HAL_PIN_13_M2nCE3      (AM_HAL_GPIO_FUNC(4))
-#define AM_HAL_PIN_13_EXTHFB      (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_13_UART0RTS    (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_13_UART1RX     (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_INPUT)
 
@@ -207,7 +205,6 @@
 #define AM_HAL_PIN_14_UART1TX     (AM_HAL_GPIO_FUNC(2))
 #define AM_HAL_PIN_14_GPIO        (AM_HAL_GPIO_FUNC(3))
 #define AM_HAL_PIN_14_M2nCE1      (AM_HAL_GPIO_FUNC(4))
-#define AM_HAL_PIN_14_EXTHFS      (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_14_SWDCK       (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_14_32KHZ_XT    (AM_HAL_GPIO_FUNC(7))
 
@@ -216,7 +213,6 @@
 #define AM_HAL_PIN_15_UART1RX     (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_15_GPIO        (AM_HAL_GPIO_FUNC(3))
 #define AM_HAL_PIN_15_M2nCE2      (AM_HAL_GPIO_FUNC(4))
-#define AM_HAL_PIN_15_EXTXT       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_15_SWDIO       (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_15_SWO         (AM_HAL_GPIO_FUNC(7))
 
@@ -234,7 +230,6 @@
 #define AM_HAL_PIN_17_TRIG1       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_17_GPIO        (AM_HAL_GPIO_FUNC(3))
 #define AM_HAL_PIN_17_M4nCE3      (AM_HAL_GPIO_FUNC(4))
-#define AM_HAL_PIN_17_EXTLF       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_17_UART0RX     (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_17_UART1CTS    (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_INPUT)
 
@@ -243,7 +238,6 @@
 #define AM_HAL_PIN_18_TCTA1       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_18_GPIO        (AM_HAL_GPIO_FUNC(3))
 #define AM_HAL_PIN_18_M4nCE1      (AM_HAL_GPIO_FUNC(4))
-#define AM_HAL_PIN_18_ANATEST2    (AM_HAL_GPIO_FUNC(5))
 #define AM_HAL_PIN_18_UART1TX     (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_18_32KHZ_XT    (AM_HAL_GPIO_FUNC(7))
 
@@ -252,7 +246,6 @@
 #define AM_HAL_PIN_19_TCTB1       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_19_GPIO        (AM_HAL_GPIO_FUNC(3))
 #define AM_HAL_PIN_19_TCTA1       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_INPUT)
-#define AM_HAL_PIN_19_ANATEST1    (AM_HAL_GPIO_FUNC(5))
 #define AM_HAL_PIN_19_UART1RX     (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_19_I2S_BCLK    (AM_HAL_GPIO_FUNC(7))
 
@@ -277,6 +270,7 @@
 #define AM_HAL_PIN_22_PDM_CLK     (AM_HAL_GPIO_FUNC(4))
 #define AM_HAL_PIN_22_TCTB1       (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_22_SWO         (AM_HAL_GPIO_FUNC(7))
+// PSOURCE usage in pushpull: GPIOWT=1 to activate the power switch, GPIOWT=0 to disable
 #define AM_HAL_PIN_22_PSOURCE     (AM_HAL_GPIO_FUNC(3) | AM_HAL_PIN_DIR_OUTPUT | AM_HAL_GPIO_POWER)
 
 #define AM_HAL_PIN_23_UART0RX     (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
@@ -299,17 +293,15 @@
 #endif // defined (AM_PACKAGE_BGA)
 
 #if defined (AM_PACKAGE_BGA)
-#define AM_HAL_PIN_25_EXTXT       (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_25_M0nCE2      (AM_HAL_GPIO_FUNC(1))
 #define AM_HAL_PIN_25_TCTA0       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_25_GPIO        (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_25_M2SDA       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_25_M2SDA       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_25_M2MISO      (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_25_SLMISOLB    (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_25_SLSDALB     (AM_HAL_GPIO_FUNC(7))
 #endif // defined (AM_PACKAGE_BGA)
 
-#define AM_HAL_PIN_26_EXTLF       (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_26_M0nCE3      (AM_HAL_GPIO_FUNC(1))
 #define AM_HAL_PIN_26_TCTB0       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_26_GPIO        (AM_HAL_GPIO_FUNC(3))
@@ -319,11 +311,10 @@
 #define AM_HAL_PIN_26_M3nCE0      (AM_HAL_GPIO_FUNC(7))
 
 #if defined (AM_PACKAGE_BGA)
-#define AM_HAL_PIN_27_EXTHF       (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_27_M1nCE4      (AM_HAL_GPIO_FUNC(1))
 #define AM_HAL_PIN_27_TCTA1       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_27_GPIO        (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_27_M2SCL       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_27_M2SCL       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_27_M2SCK       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_27_M2SCKLB     (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_27_M2SCLLB     (AM_HAL_GPIO_FUNC(7))
@@ -333,7 +324,7 @@
 #define AM_HAL_PIN_28_M1nCE5      (AM_HAL_GPIO_FUNC(1))
 #define AM_HAL_PIN_28_TCTB1       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_28_GPIO        (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_28_M2WIR3      (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_28_M2WIR3      (AM_HAL_GPIO_FUNC(4) | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_28_M2MOSI      (AM_HAL_GPIO_FUNC(5))
 #define AM_HAL_PIN_28_M5nCE3      (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_28_SLWIR3LB    (AM_HAL_GPIO_FUNC(7))
@@ -353,7 +344,6 @@
 #define AM_HAL_PIN_30_GPIO        (AM_HAL_GPIO_FUNC(3))
 #define AM_HAL_PIN_30_UART0TX     (AM_HAL_GPIO_FUNC(4))
 #define AM_HAL_PIN_30_UART1RTS    (AM_HAL_GPIO_FUNC(5))
-#define AM_HAL_PIN_30_SWO         (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_30_I2S_DAT     (AM_HAL_GPIO_FUNC(7))
 #endif // defined (AM_PACKAGE_BGA)
 
@@ -433,7 +423,7 @@
 #define AM_HAL_PIN_38_M1nCE3      (AM_HAL_GPIO_FUNC(1))
 #define AM_HAL_PIN_38_UART0CTS    (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_38_GPIO        (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_38_M3WIR3      (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_38_M3WIR3      (AM_HAL_GPIO_FUNC(4) | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_38_M3MOSI      (AM_HAL_GPIO_FUNC(5))
 #define AM_HAL_PIN_38_M4nCE7      (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_38_SLWIR3LB    (AM_HAL_GPIO_FUNC(7))
@@ -443,7 +433,7 @@
 #define AM_HAL_PIN_39_UART1TX     (AM_HAL_GPIO_FUNC(1))
 #define AM_HAL_PIN_39_CLKOUT      (AM_HAL_GPIO_FUNC(2))
 #define AM_HAL_PIN_39_GPIO        (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_39_M4SCL       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_39_M4SCL       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_39_M4SCK       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_39_M4SCKLB     (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_39_M4SCLLB     (AM_HAL_GPIO_FUNC(7))
@@ -452,7 +442,7 @@
 #define AM_HAL_PIN_40_UART1RX     (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_40_TRIG0       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_40_GPIO        (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_40_M4SDA       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_40_M4SDA       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_40_M4MISO      (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_40_SLMISOLB    (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_40_SLSDALB     (AM_HAL_GPIO_FUNC(7))
@@ -465,6 +455,7 @@
 #define AM_HAL_PIN_41_M5nCE7      (AM_HAL_GPIO_FUNC(5))
 #define AM_HAL_PIN_41_M4nCE2      (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_41_UART0RTS    (AM_HAL_GPIO_FUNC(7))
+// PSOURCE usage in pushpull: GPIOWT=1 to activate the power switch, GPIOWT=0 to disable
 #define AM_HAL_PIN_41_PSOURCE     (AM_HAL_GPIO_FUNC(3) | AM_HAL_PIN_DIR_OUTPUT | AM_HAL_GPIO_POWER)
 
 #if defined (AM_PACKAGE_BGA)
@@ -472,7 +463,7 @@
 #define AM_HAL_PIN_42_M0nCE0      (AM_HAL_GPIO_FUNC(1))
 #define AM_HAL_PIN_42_TCTA0       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_42_GPIO        (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_42_M3SCL       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_42_M3SCL       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_42_M3SCK       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_42_M3SCKLB     (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_42_M3SCLLB     (AM_HAL_GPIO_FUNC(7))
@@ -483,7 +474,7 @@
 #define AM_HAL_PIN_43_M0nCE1      (AM_HAL_GPIO_FUNC(1))
 #define AM_HAL_PIN_43_TCTB0       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_43_GPIO        (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_43_M3SDA       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_43_M3SDA       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_43_M3MISO      (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_43_SLMISOLB    (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_43_SLSDALB     (AM_HAL_GPIO_FUNC(7))
@@ -493,7 +484,7 @@
 #define AM_HAL_PIN_44_M0nCE2      (AM_HAL_GPIO_FUNC(1))
 #define AM_HAL_PIN_44_TCTA1       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_44_GPIO        (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_44_M4WIR3      (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_44_M4WIR3      (AM_HAL_GPIO_FUNC(4) | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_44_M4MOSI      (AM_HAL_GPIO_FUNC(5))
 #define AM_HAL_PIN_44_M5nCE6      (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_44_SLWIR3LB    (AM_HAL_GPIO_FUNC(7))
@@ -506,7 +497,7 @@
 #define AM_HAL_PIN_45_M4nCE3      (AM_HAL_GPIO_FUNC(4))
 #define AM_HAL_PIN_45_M3nCE6      (AM_HAL_GPIO_FUNC(5))
 #define AM_HAL_PIN_45_M5nCE5      (AM_HAL_GPIO_FUNC(6))
-#define AM_HAL_PIN_45_TCTA1       (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_45_SWO         (AM_HAL_GPIO_FUNC(7))
 #endif // defined (AM_PACKAGE_BGA)
 
 #if defined (AM_PACKAGE_BGA)
@@ -524,7 +515,7 @@
 #define AM_HAL_PIN_47_M0nCE5      (AM_HAL_GPIO_FUNC(1))
 #define AM_HAL_PIN_47_TCTB2       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_47_GPIO        (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_47_M5WIR3      (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_47_M5WIR3      (AM_HAL_GPIO_FUNC(4) | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_47_M5MOSI      (AM_HAL_GPIO_FUNC(5))
 #define AM_HAL_PIN_47_M4nCE5      (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_47_SLWIR3LB    (AM_HAL_GPIO_FUNC(7))
@@ -533,7 +524,7 @@
 #define AM_HAL_PIN_48_M0nCE6      (AM_HAL_GPIO_FUNC(1))
 #define AM_HAL_PIN_48_TCTA3       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_48_GPIO        (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_48_M5SCL       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_48_M5SCL       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_48_M5SCK       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_48_M5SCKLB     (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_48_M5SCLLB     (AM_HAL_GPIO_FUNC(7))
@@ -542,7 +533,7 @@
 #define AM_HAL_PIN_49_M0nCE7      (AM_HAL_GPIO_FUNC(1))
 #define AM_HAL_PIN_49_TCTB3       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_49_GPIO        (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_49_M5SDA       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_49_M5SDA       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
 #define AM_HAL_PIN_49_M5MISO      (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
 #define AM_HAL_PIN_49_SLMISOLB    (AM_HAL_GPIO_FUNC(6))
 #define AM_HAL_PIN_49_SLSDALB     (AM_HAL_GPIO_FUNC(7))

+ 1 - 1
bsp/apollo2/libraries/drivers/hal/am_hal_pwrctrl.c

@@ -42,7 +42,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 

+ 10 - 1
bsp/apollo2/libraries/drivers/hal/am_hal_pwrctrl.h

@@ -42,7 +42,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 
@@ -319,6 +319,11 @@
 #define AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_ALL                 \
         AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_256K
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 //*****************************************************************************
 //
 // Function prototypes
@@ -332,6 +337,10 @@ extern void am_hal_pwrctrl_bucks_enable(void);
 extern void am_hal_pwrctrl_bucks_disable(void);
 extern void am_hal_pwrctrl_low_power_init(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif // AM_HAL_PWRCTRL_H
 
 //*****************************************************************************

+ 1 - 1
bsp/apollo2/libraries/drivers/hal/am_hal_queue.c

@@ -42,7 +42,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 //
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
 //
 //*****************************************************************************
 

Some files were not shown because too many files changed in this diff