ceedling 0.9.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1282) hide show
  1. checksums.yaml +7 -0
  2. data/GIT_COMMIT_SHA +1 -0
  3. data/Gemfile +23 -2
  4. data/Gemfile.lock +50 -0
  5. data/README.md +728 -42
  6. data/Rakefile +21 -75
  7. data/assets/ceedling +9 -0
  8. data/assets/ceedling.cmd +1 -0
  9. data/assets/default_gitignore +7 -0
  10. data/assets/example_file.c +16 -0
  11. data/assets/example_file.h +15 -0
  12. data/assets/example_file_call.c +13 -0
  13. data/assets/example_file_call.h +13 -0
  14. data/assets/project.yml +402 -0
  15. data/assets/test_example_file.c +20 -0
  16. data/assets/test_example_file_boom.c +20 -0
  17. data/assets/test_example_file_crash.c +25 -0
  18. data/assets/test_example_file_success.c +21 -0
  19. data/assets/test_example_file_unity_printf.c +19 -0
  20. data/assets/test_example_file_verbose.c +19 -0
  21. data/assets/test_example_file_with_mock.c +20 -0
  22. data/assets/test_example_with_parameterized_tests.c +28 -0
  23. data/assets/tests_with_defines/src/adc_hardware.c +18 -0
  24. data/assets/tests_with_defines/src/adc_hardware.h +13 -0
  25. data/assets/tests_with_defines/src/adc_hardware_configurator.c +18 -0
  26. data/assets/tests_with_defines/src/adc_hardware_configurator.h +17 -0
  27. data/assets/tests_with_defines/test/test_adc_hardware.c +28 -0
  28. data/assets/tests_with_defines/test/test_adc_hardware_special.c +28 -0
  29. data/assets/tests_with_preprocessing/src/adc_hardwareA.c +17 -0
  30. data/assets/tests_with_preprocessing/src/adc_hardwareA.h +13 -0
  31. data/assets/tests_with_preprocessing/src/adc_hardwareB.c +14 -0
  32. data/assets/tests_with_preprocessing/src/adc_hardwareB.h +13 -0
  33. data/assets/tests_with_preprocessing/src/adc_hardwareC.c +14 -0
  34. data/assets/tests_with_preprocessing/src/adc_hardwareC.h +13 -0
  35. data/assets/tests_with_preprocessing/src/adc_hardware_configuratorA.h +13 -0
  36. data/assets/tests_with_preprocessing/src/adc_hardware_configuratorB.h +15 -0
  37. data/assets/tests_with_preprocessing/src/adc_hardware_configuratorC.h +15 -0
  38. data/assets/tests_with_preprocessing/test/test_adc_hardwareA.c +41 -0
  39. data/assets/tests_with_preprocessing/test/test_adc_hardwareB.c +25 -0
  40. data/assets/tests_with_preprocessing/test/test_adc_hardwareC.c +29 -0
  41. data/assets/uncovered_example_file.c +12 -0
  42. data/bin/actions_wrapper.rb +50 -0
  43. data/bin/app_cfg.rb +134 -0
  44. data/bin/ceedling +146 -57
  45. data/bin/cli.rb +542 -0
  46. data/bin/cli_handler.rb +480 -0
  47. data/bin/cli_helper.rb +512 -0
  48. data/bin/configinator.rb +111 -0
  49. data/bin/mixinator.rb +136 -0
  50. data/bin/mixins.rb +12 -0
  51. data/bin/objects.yml +80 -0
  52. data/bin/path_validator.rb +54 -0
  53. data/bin/projectinator.rb +244 -0
  54. data/bin/versionator.rb +81 -0
  55. data/ceedling.gemspec +54 -14
  56. data/config/test_environment.rb +14 -0
  57. data/docs/BreakingChanges.md +260 -0
  58. data/docs/CODE_OF_CONDUCT.md +138 -0
  59. data/docs/CONTRIBUTING.md +240 -0
  60. data/docs/Ceedling Basic Porting.pdf +0 -0
  61. data/docs/Ceedling Managing Release Code.pdf +0 -0
  62. data/docs/Ceedling Working with IDEs.pdf +0 -0
  63. data/docs/CeedlingPacket.md +5651 -0
  64. data/docs/CeedlingPullRequestChecklist.md +24 -0
  65. data/docs/CeedlingUpgrade.md +83 -0
  66. data/docs/Changelog.md +493 -0
  67. data/docs/PluginDevelopmentGuide.md +764 -0
  68. data/docs/ReleaseNotes.md +353 -0
  69. data/docs/SECURITY.md +41 -0
  70. data/docs/ThrowTheSwitchCodingStandard.md +207 -0
  71. data/examples/temp_sensor/README.md +18 -0
  72. data/examples/temp_sensor/mixin/add_gcov.yml +51 -0
  73. data/examples/temp_sensor/mixin/add_unity_helper.yml +26 -0
  74. data/examples/temp_sensor/project.yml +355 -70
  75. data/examples/temp_sensor/src/AdcConductor.c +49 -42
  76. data/examples/temp_sensor/src/AdcConductor.h +20 -11
  77. data/examples/temp_sensor/src/AdcHardware.c +34 -27
  78. data/examples/temp_sensor/src/AdcHardware.h +18 -11
  79. data/examples/temp_sensor/src/AdcHardwareConfigurator.c +25 -18
  80. data/examples/temp_sensor/src/AdcHardwareConfigurator.h +17 -10
  81. data/examples/temp_sensor/src/AdcModel.c +40 -33
  82. data/examples/temp_sensor/src/AdcModel.h +20 -13
  83. data/examples/temp_sensor/src/AdcTemperatureSensor.c +58 -51
  84. data/examples/temp_sensor/src/AdcTemperatureSensor.h +17 -10
  85. data/examples/temp_sensor/src/Executor.c +32 -25
  86. data/examples/temp_sensor/src/Executor.h +16 -9
  87. data/examples/temp_sensor/src/IntrinsicsWrapper.c +25 -18
  88. data/examples/temp_sensor/src/IntrinsicsWrapper.h +14 -7
  89. data/examples/temp_sensor/src/Main.c +53 -46
  90. data/examples/temp_sensor/src/Main.h +14 -7
  91. data/examples/temp_sensor/src/Model.c +17 -10
  92. data/examples/temp_sensor/src/Model.h +15 -8
  93. data/examples/temp_sensor/src/ModelConfig.h +14 -7
  94. data/examples/temp_sensor/src/TaskScheduler.c +79 -72
  95. data/examples/temp_sensor/src/TaskScheduler.h +18 -11
  96. data/examples/temp_sensor/src/TemperatureCalculator.c +38 -27
  97. data/examples/temp_sensor/src/TemperatureCalculator.h +15 -6
  98. data/examples/temp_sensor/src/TemperatureFilter.c +45 -39
  99. data/examples/temp_sensor/src/TemperatureFilter.h +17 -10
  100. data/examples/temp_sensor/src/TimerConductor.c +22 -15
  101. data/examples/temp_sensor/src/TimerConductor.h +16 -9
  102. data/examples/temp_sensor/src/TimerConfigurator.c +58 -51
  103. data/examples/temp_sensor/src/TimerConfigurator.h +22 -15
  104. data/examples/temp_sensor/src/TimerHardware.c +22 -15
  105. data/examples/temp_sensor/src/TimerHardware.h +15 -8
  106. data/examples/temp_sensor/src/TimerInterruptConfigurator.c +62 -55
  107. data/examples/temp_sensor/src/TimerInterruptConfigurator.h +20 -13
  108. data/examples/temp_sensor/src/TimerInterruptHandler.c +32 -25
  109. data/examples/temp_sensor/src/TimerInterruptHandler.h +17 -10
  110. data/examples/temp_sensor/src/TimerModel.c +16 -9
  111. data/examples/temp_sensor/src/TimerModel.h +15 -8
  112. data/examples/temp_sensor/src/Types.h +97 -103
  113. data/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.c +25 -18
  114. data/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.h +15 -6
  115. data/examples/temp_sensor/src/UsartConductor.c +28 -21
  116. data/examples/temp_sensor/src/UsartConductor.h +14 -7
  117. data/examples/temp_sensor/src/UsartConfigurator.c +46 -39
  118. data/examples/temp_sensor/src/UsartConfigurator.h +20 -13
  119. data/examples/temp_sensor/src/UsartHardware.c +29 -34
  120. data/examples/temp_sensor/src/UsartHardware.h +16 -10
  121. data/examples/temp_sensor/src/UsartModel.c +41 -34
  122. data/examples/temp_sensor/src/UsartModel.h +17 -10
  123. data/examples/temp_sensor/src/UsartPutChar.c +23 -16
  124. data/examples/temp_sensor/src/UsartPutChar.h +15 -8
  125. data/examples/temp_sensor/src/UsartTransmitBufferStatus.c +14 -7
  126. data/examples/temp_sensor/src/UsartTransmitBufferStatus.h +15 -8
  127. data/examples/temp_sensor/test/TestExecutor.c +43 -0
  128. data/examples/temp_sensor/test/TestMain.c +31 -0
  129. data/examples/temp_sensor/test/TestModel.c +27 -0
  130. data/examples/temp_sensor/test/TestTaskScheduler.c +111 -0
  131. data/examples/temp_sensor/test/TestTemperatureCalculator.c +43 -0
  132. data/examples/temp_sensor/test/TestTemperatureFilter.c +86 -0
  133. data/examples/temp_sensor/test/TestTimerConductor.c +39 -0
  134. data/examples/temp_sensor/test/TestTimerHardware.c +33 -0
  135. data/examples/temp_sensor/test/TestTimerIntegrated.c +53 -0
  136. data/examples/temp_sensor/test/TestTimerModel.c +25 -0
  137. data/examples/temp_sensor/test/TestUsartBaudRateRegisterCalculator.c +28 -0
  138. data/examples/temp_sensor/test/TestUsartConductor.c +47 -0
  139. data/examples/temp_sensor/test/TestUsartHardware.c +43 -0
  140. data/examples/temp_sensor/test/TestUsartIntegrated.c +63 -0
  141. data/examples/temp_sensor/test/TestUsartModel.c +47 -0
  142. data/examples/temp_sensor/test/adc/TestAdcConductor.c +128 -0
  143. data/examples/temp_sensor/test/adc/TestAdcHardware.c +51 -0
  144. data/examples/temp_sensor/test/adc/TestAdcModel.c +40 -0
  145. data/examples/temp_sensor/test/support/UnityHelper.c +19 -10
  146. data/examples/temp_sensor/test/support/UnityHelper.h +17 -12
  147. data/lib/ceedling/application.rb +26 -0
  148. data/lib/ceedling/backtrace.gdb +5 -0
  149. data/lib/ceedling/build_batchinator.rb +113 -0
  150. data/lib/ceedling/cacheinator.rb +53 -0
  151. data/lib/ceedling/cacheinator_helper.rb +41 -0
  152. data/lib/ceedling/config_matchinator.rb +192 -0
  153. data/lib/ceedling/config_walkinator.rb +35 -0
  154. data/lib/ceedling/configurator.rb +735 -0
  155. data/lib/ceedling/configurator_builder.rb +558 -0
  156. data/lib/ceedling/configurator_plugins.rb +165 -0
  157. data/lib/ceedling/configurator_setup.rb +799 -0
  158. data/lib/ceedling/configurator_validator.rb +203 -0
  159. data/lib/ceedling/constants.rb +160 -0
  160. data/lib/ceedling/defaults.rb +477 -0
  161. data/lib/ceedling/defineinator.rb +90 -0
  162. data/lib/ceedling/dependinator.rb +31 -0
  163. data/lib/ceedling/encodinator.rb +26 -0
  164. data/lib/ceedling/erb_wrapper.rb +16 -0
  165. data/lib/ceedling/exceptions.rb +47 -0
  166. data/lib/ceedling/file_finder.rb +183 -0
  167. data/lib/ceedling/file_finder_helper.rb +116 -0
  168. data/lib/ceedling/file_path_collection_utils.rb +137 -0
  169. data/lib/ceedling/file_path_utils.rb +190 -0
  170. data/lib/ceedling/file_system_wrapper.rb +16 -0
  171. data/lib/ceedling/file_wrapper.rb +122 -0
  172. data/lib/ceedling/flaginator.rb +65 -0
  173. data/lib/ceedling/generator.rb +365 -0
  174. data/lib/ceedling/generator_helper.rb +78 -0
  175. data/lib/ceedling/generator_mocks.rb +41 -0
  176. data/lib/ceedling/generator_test_results.rb +270 -0
  177. data/lib/ceedling/generator_test_results_backtrace.rb +215 -0
  178. data/lib/ceedling/generator_test_results_sanity_checker.rb +70 -0
  179. data/lib/ceedling/generator_test_runner.rb +84 -0
  180. data/lib/ceedling/include_pathinator.rb +83 -0
  181. data/lib/ceedling/loginator.rb +326 -0
  182. data/lib/ceedling/makefile.rb +52 -0
  183. data/lib/ceedling/objects.yml +352 -0
  184. data/lib/ceedling/parsing_parcels.rb +77 -0
  185. data/lib/ceedling/plugin.rb +30 -0
  186. data/lib/ceedling/plugin_manager.rb +133 -0
  187. data/lib/ceedling/plugin_manager_helper.rb +25 -0
  188. data/lib/ceedling/plugin_reportinator.rb +139 -0
  189. data/lib/ceedling/plugin_reportinator_helper.rb +84 -0
  190. data/lib/ceedling/preprocessinator.rb +239 -0
  191. data/lib/ceedling/preprocessinator_extractor.rb +257 -0
  192. data/lib/ceedling/preprocessinator_file_handler.rb +229 -0
  193. data/lib/ceedling/preprocessinator_includes_handler.rb +382 -0
  194. data/lib/ceedling/rake_utils.rb +23 -0
  195. data/lib/ceedling/rake_wrapper.rb +40 -0
  196. data/lib/ceedling/rakefile.rb +145 -0
  197. data/lib/ceedling/release_invoker.rb +68 -0
  198. data/lib/ceedling/release_invoker_helper.rb +12 -0
  199. data/lib/ceedling/reportinator.rb +124 -0
  200. data/lib/ceedling/rules_release.rake +107 -0
  201. data/lib/ceedling/rules_tests.rake +62 -0
  202. data/lib/ceedling/setupinator.rb +199 -0
  203. data/lib/ceedling/stream_wrapper.rb +51 -0
  204. data/lib/ceedling/system_utils.rb +43 -0
  205. data/lib/ceedling/system_wrapper.rb +150 -0
  206. data/lib/ceedling/task_invoker.rb +70 -0
  207. data/lib/ceedling/tasks_base.rake +39 -0
  208. data/lib/ceedling/tasks_filesystem.rake +99 -0
  209. data/lib/ceedling/tasks_release.rake +43 -0
  210. data/lib/ceedling/tasks_tests.rake +71 -0
  211. data/lib/ceedling/test_context_extractor.rb +379 -0
  212. data/lib/ceedling/test_invoker.rb +506 -0
  213. data/lib/ceedling/test_invoker_helper.rb +347 -0
  214. data/lib/ceedling/test_runner_manager.rb +47 -0
  215. data/lib/ceedling/tool_executor.rb +233 -0
  216. data/lib/ceedling/tool_executor_helper.rb +107 -0
  217. data/lib/ceedling/tool_validator.rb +149 -0
  218. data/lib/ceedling/verbosinator.rb +22 -0
  219. data/lib/ceedling/yaml_wrapper.rb +37 -0
  220. data/lib/ceedling.rb +12 -4
  221. data/lib/version.rb +24 -0
  222. data/license.txt +24 -0
  223. data/plugins/beep/README.md +133 -0
  224. data/plugins/beep/config/defaults.yml +12 -0
  225. data/plugins/beep/config/defaults_beep.rb +67 -0
  226. data/plugins/beep/lib/beep.rb +85 -0
  227. data/plugins/bullseye/README.md +81 -0
  228. data/plugins/bullseye/bullseye.rake +180 -0
  229. data/plugins/bullseye/config/defaults.yml +66 -0
  230. data/plugins/bullseye/lib/bullseye.rb +203 -0
  231. data/plugins/command_hooks/README.md +241 -0
  232. data/plugins/command_hooks/lib/command_hooks.rb +231 -0
  233. data/plugins/compile_commands_json_db/README.md +40 -0
  234. data/plugins/compile_commands_json_db/lib/compile_commands_json_db.rb +51 -0
  235. data/plugins/dependencies/README.md +321 -0
  236. data/plugins/dependencies/Rakefile +188 -0
  237. data/plugins/dependencies/config/defaults.yml +78 -0
  238. data/plugins/dependencies/dependencies.rake +157 -0
  239. data/plugins/dependencies/example/boss/project.yml +231 -0
  240. data/plugins/dependencies/example/boss/src/boss.c +80 -0
  241. data/plugins/dependencies/example/boss/src/boss.h +16 -0
  242. data/plugins/dependencies/example/boss/src/main.c +45 -0
  243. data/plugins/dependencies/example/boss/test/test_boss.c +118 -0
  244. data/plugins/dependencies/example/supervisor/project.yml +165 -0
  245. data/plugins/dependencies/example/supervisor/src/supervisor.c +45 -0
  246. data/plugins/dependencies/example/supervisor/src/supervisor.h +14 -0
  247. data/plugins/dependencies/example/supervisor/test/test_supervisor.c +58 -0
  248. data/plugins/dependencies/example/version.tar.gzip +0 -0
  249. data/plugins/dependencies/example/workerbees.zip +0 -0
  250. data/plugins/dependencies/lib/dependencies.rb +531 -0
  251. data/plugins/fff/README.md +242 -0
  252. data/plugins/fff/Rakefile +26 -0
  253. data/plugins/fff/config/fff.yml +13 -0
  254. data/plugins/fff/examples/fff_example/project.yml +145 -0
  255. data/plugins/fff/examples/fff_example/src/bar.c +8 -0
  256. data/plugins/fff/examples/fff_example/src/bar.h +21 -0
  257. data/plugins/fff/examples/fff_example/src/custom_types.h +13 -0
  258. data/plugins/fff/examples/fff_example/src/display.c +14 -0
  259. data/plugins/fff/examples/fff_example/src/display.h +23 -0
  260. data/plugins/fff/examples/fff_example/src/event_processor.c +100 -0
  261. data/plugins/fff/examples/fff_example/src/event_processor.h +18 -0
  262. data/plugins/fff/examples/fff_example/src/foo.c +23 -0
  263. data/plugins/fff/examples/fff_example/src/foo.h +15 -0
  264. data/plugins/fff/examples/fff_example/src/subfolder/zzz.c +8 -0
  265. data/plugins/fff/examples/fff_example/src/subfolder/zzz.h +13 -0
  266. data/plugins/fff/examples/fff_example/test/test_event_processor.c +160 -0
  267. data/plugins/fff/examples/fff_example/test/test_foo.c +54 -0
  268. data/plugins/fff/lib/fff.rb +90 -0
  269. data/plugins/fff/lib/fff_mock_generator.rb +172 -0
  270. data/plugins/fff/spec/fff_mock_header_generator_spec.rb +311 -0
  271. data/plugins/fff/spec/fff_mock_source_generator_spec.rb +156 -0
  272. data/plugins/fff/spec/header_generator.rb +58 -0
  273. data/plugins/fff/spec/spec_helper.rb +103 -0
  274. data/plugins/fff/src/fff_unity_helper.h +40 -0
  275. data/plugins/fff/vendor/fff/LICENSE +25 -0
  276. data/plugins/fff/vendor/fff/Makefile +10 -0
  277. data/plugins/fff/vendor/fff/README.md +454 -0
  278. data/plugins/fff/vendor/fff/buildandtest +15 -0
  279. data/plugins/fff/vendor/fff/examples/Makefile +7 -0
  280. data/plugins/fff/vendor/fff/examples/driver_testing/Makefile +64 -0
  281. data/plugins/fff/vendor/fff/examples/driver_testing/driver.c +32 -0
  282. data/plugins/fff/vendor/fff/examples/driver_testing/driver.h +21 -0
  283. data/plugins/fff/vendor/fff/examples/driver_testing/driver.test.cpp +58 -0
  284. data/plugins/fff/vendor/fff/examples/driver_testing/driver.test.fff.cpp +70 -0
  285. data/plugins/fff/vendor/fff/examples/driver_testing/hardware_abstraction.h +25 -0
  286. data/plugins/fff/vendor/fff/examples/driver_testing/registers.h +23 -0
  287. data/plugins/fff/vendor/fff/examples/embedded_ui/DISPLAY.h +27 -0
  288. data/plugins/fff/vendor/fff/examples/embedded_ui/Kata.txt +25 -0
  289. data/plugins/fff/vendor/fff/examples/embedded_ui/Makefile +67 -0
  290. data/plugins/fff/vendor/fff/examples/embedded_ui/SYSTEM.h +31 -0
  291. data/plugins/fff/vendor/fff/examples/embedded_ui/UI.c +56 -0
  292. data/plugins/fff/vendor/fff/examples/embedded_ui/UI.h +22 -0
  293. data/plugins/fff/vendor/fff/examples/embedded_ui/UI_test_ansic.c +191 -0
  294. data/plugins/fff/vendor/fff/examples/embedded_ui/UI_test_cpp.cpp +144 -0
  295. data/plugins/fff/vendor/fff/examples/embedded_ui/test_suite_template.c +42 -0
  296. data/plugins/fff/vendor/fff/fakegen.rb +428 -0
  297. data/plugins/fff/vendor/fff/fff.h +5122 -0
  298. data/plugins/fff/vendor/fff/gtest/Makefile +22 -0
  299. data/plugins/fff/vendor/fff/gtest/gtest-all.cc +9118 -0
  300. data/plugins/fff/vendor/fff/gtest/gtest-main.cc +6 -0
  301. data/plugins/fff/vendor/fff/gtest/gtest.h +19547 -0
  302. data/plugins/fff/vendor/fff/test/Makefile +81 -0
  303. data/plugins/fff/vendor/fff/test/c_test_framework.h +25 -0
  304. data/plugins/fff/vendor/fff/test/fff_test_c.c +116 -0
  305. data/plugins/fff/vendor/fff/test/fff_test_cpp.cpp +53 -0
  306. data/plugins/fff/vendor/fff/test/fff_test_global_c.c +84 -0
  307. data/plugins/fff/vendor/fff/test/fff_test_global_cpp.cpp +31 -0
  308. data/plugins/fff/vendor/fff/test/global_fakes.c +21 -0
  309. data/plugins/fff/vendor/fff/test/global_fakes.h +47 -0
  310. data/plugins/fff/vendor/fff/test/test_cases.include +276 -0
  311. data/plugins/gcov/README.md +893 -0
  312. data/plugins/gcov/config/defaults.yml +30 -0
  313. data/plugins/gcov/config/defaults_gcov.rb +109 -0
  314. data/plugins/gcov/gcov.rake +100 -0
  315. data/plugins/gcov/lib/gcov.rb +282 -0
  316. data/plugins/gcov/lib/gcov_constants.rb +63 -0
  317. data/plugins/gcov/lib/gcovr_reportinator.rb +425 -0
  318. data/plugins/gcov/lib/reportgenerator_reportinator.rb +220 -0
  319. data/plugins/gcov/lib/reportinator_helper.rb +30 -0
  320. data/plugins/module_generator/README.md +267 -0
  321. data/plugins/module_generator/Rakefile +232 -0
  322. data/plugins/module_generator/assets/stubby1.h +13 -0
  323. data/plugins/module_generator/assets/stubby2.h +15 -0
  324. data/plugins/module_generator/config/module_generator.yml +13 -0
  325. data/plugins/module_generator/example/project.yml +174 -0
  326. data/plugins/module_generator/lib/module_generator.rb +122 -0
  327. data/plugins/module_generator/module_generator.rake +69 -0
  328. data/plugins/report_build_warnings_log/README.md +40 -0
  329. data/plugins/report_build_warnings_log/config/defaults.yml +12 -0
  330. data/plugins/report_build_warnings_log/lib/report_build_warnings_log.rb +143 -0
  331. data/plugins/report_tests_gtestlike_stdout/README.md +96 -0
  332. data/plugins/report_tests_gtestlike_stdout/assets/template.erb +83 -0
  333. data/plugins/report_tests_gtestlike_stdout/config/report_tests_gtestlike_stdout.yml +11 -0
  334. data/plugins/report_tests_gtestlike_stdout/lib/report_tests_gtestlike_stdout.rb +69 -0
  335. data/plugins/report_tests_ide_stdout/README.md +62 -0
  336. data/plugins/report_tests_ide_stdout/config/report_tests_ide_stdout.yml +11 -0
  337. data/plugins/report_tests_ide_stdout/lib/report_tests_ide_stdout.rb +72 -0
  338. data/plugins/report_tests_log_factory/README.md +446 -0
  339. data/plugins/report_tests_log_factory/config/defaults.yml +11 -0
  340. data/plugins/report_tests_log_factory/lib/cppunit_tests_reporter.rb +100 -0
  341. data/plugins/report_tests_log_factory/lib/html_tests_reporter.rb +181 -0
  342. data/plugins/report_tests_log_factory/lib/json_tests_reporter.rb +72 -0
  343. data/plugins/report_tests_log_factory/lib/junit_tests_reporter.rb +197 -0
  344. data/plugins/report_tests_log_factory/lib/report_tests_log_factory.rb +135 -0
  345. data/plugins/report_tests_log_factory/lib/tests_reporter.rb +70 -0
  346. data/plugins/report_tests_log_factory/sample_html_report.png +0 -0
  347. data/plugins/report_tests_pretty_stdout/README.md +54 -0
  348. data/plugins/report_tests_pretty_stdout/assets/template.erb +63 -0
  349. data/plugins/report_tests_pretty_stdout/config/report_tests_pretty_stdout.yml +11 -0
  350. data/plugins/report_tests_pretty_stdout/lib/report_tests_pretty_stdout.rb +73 -0
  351. data/plugins/report_tests_raw_output_log/README.md +50 -0
  352. data/plugins/report_tests_raw_output_log/lib/report_tests_raw_output_log.rb +129 -0
  353. data/plugins/report_tests_teamcity_stdout/README.md +94 -0
  354. data/plugins/report_tests_teamcity_stdout/config/defaults.yml +12 -0
  355. data/plugins/report_tests_teamcity_stdout/config/report_tests_teamcity_stdout.yml +11 -0
  356. data/plugins/report_tests_teamcity_stdout/lib/report_tests_teamcity_stdout.rb +163 -0
  357. data/spec/config_walkinator_spec.rb +62 -0
  358. data/spec/configurator_builder_spec.rb +16 -0
  359. data/spec/configurator_helper_spec.rb +12 -0
  360. data/spec/configurator_spec.rb +18 -0
  361. data/spec/file_finder_helper_spec.rb +73 -0
  362. data/spec/gcov/gcov_deployment_spec.rb +135 -0
  363. data/spec/gcov/gcov_test_cases_spec.rb +344 -0
  364. data/spec/generator_test_results_sanity_checker_spec.rb +104 -0
  365. data/spec/generator_test_results_spec.rb +131 -0
  366. data/spec/manual/stress_test.rb +31 -0
  367. data/spec/parsing_parcels_spec.rb +66 -0
  368. data/spec/preprocessinator_extractor_spec.rb +408 -0
  369. data/spec/preprocessinator_includes_handler_spec.rb +289 -0
  370. data/spec/reportinator_spec.rb +26 -0
  371. data/spec/spec_helper.rb +31 -0
  372. data/spec/spec_system_helper.rb +994 -0
  373. data/spec/support/other_target.yml +7 -0
  374. data/spec/support/target.yml +7 -0
  375. data/spec/support/test_example.fail +25 -0
  376. data/spec/support/test_example.pass +25 -0
  377. data/spec/support/test_example_empty.pass +15 -0
  378. data/spec/support/test_example_ignore.pass +25 -0
  379. data/spec/support/test_example_mangled.pass +22 -0
  380. data/spec/support/test_example_with_time.pass +25 -0
  381. data/spec/system/deployment_as_gem_spec.rb +76 -0
  382. data/spec/system/deployment_as_vendor_spec.rb +123 -0
  383. data/spec/system/example_temp_sensor_spec.rb +264 -0
  384. data/spec/system/upgrade_as_vendor_spec.rb +68 -0
  385. data/spec/system_utils_spec.rb +65 -0
  386. data/spec/test_context_extractor_spec.rb +328 -0
  387. data/spec/tool_executor_helper_spec.rb +219 -0
  388. data/spec/uncategorized_specs_spec.rb +15 -0
  389. data/vendor/c_exception/README.md +236 -0
  390. data/vendor/c_exception/docs/CException.md +289 -0
  391. data/vendor/c_exception/docs/CODE_OF_CONDUCT.md +138 -0
  392. data/vendor/c_exception/docs/CONTRIBUTING.md +238 -0
  393. data/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -0
  394. data/vendor/c_exception/lib/CException.c +59 -0
  395. data/vendor/c_exception/lib/CException.h +122 -0
  396. data/vendor/c_exception/lib/meson.build +11 -0
  397. data/vendor/c_exception/license.txt +22 -0
  398. data/vendor/c_exception/meson.build +14 -0
  399. data/vendor/c_exception/project.yml +263 -0
  400. data/vendor/c_exception/test/TestException.c +398 -0
  401. data/vendor/c_exception/test/support/CExceptionConfig.h +53 -0
  402. data/vendor/cmock/Gemfile +1 -0
  403. data/vendor/cmock/LICENSE.txt +21 -0
  404. data/vendor/cmock/README.md +55 -0
  405. data/vendor/cmock/cmock.gemspec +34 -0
  406. data/vendor/cmock/config/production_environment.rb +13 -0
  407. data/vendor/cmock/config/test_environment.rb +17 -0
  408. data/vendor/cmock/docs/CMockChangeLog.md +166 -0
  409. data/vendor/cmock/docs/CMockKnownIssues.md +13 -0
  410. data/vendor/cmock/docs/CMock_ArgumentValidation.md +274 -0
  411. data/vendor/cmock/docs/CMock_Summary.md +866 -0
  412. data/vendor/cmock/docs/CODE_OF_CONDUCT.md +138 -0
  413. data/vendor/cmock/docs/CONTRIBUTING.md +238 -0
  414. data/vendor/cmock/docs/ThrowTheSwitchCodingStandard.md +207 -0
  415. data/vendor/cmock/examples/make_example/Makefile +30 -0
  416. data/vendor/cmock/examples/make_example/src/foo.c +12 -0
  417. data/vendor/cmock/examples/make_example/src/foo.h +12 -0
  418. data/vendor/cmock/examples/make_example/src/main.c +22 -0
  419. data/vendor/cmock/examples/make_example/test/test_foo.c +24 -0
  420. data/vendor/cmock/examples/make_example/test/test_main.c +22 -0
  421. data/vendor/cmock/examples/temp_sensor/rakefile.rb +49 -0
  422. data/vendor/cmock/examples/temp_sensor/rakefile_helper.rb +280 -0
  423. data/vendor/cmock/examples/temp_sensor/src/AT91SAM7X256.h +2564 -0
  424. data/vendor/cmock/examples/temp_sensor/src/AdcConductor.c +49 -0
  425. data/vendor/cmock/examples/temp_sensor/src/AdcConductor.h +18 -0
  426. data/vendor/cmock/examples/temp_sensor/src/AdcHardware.c +34 -0
  427. data/vendor/cmock/examples/temp_sensor/src/AdcHardware.h +16 -0
  428. data/vendor/cmock/examples/temp_sensor/src/AdcHardwareConfigurator.c +25 -0
  429. data/vendor/cmock/examples/temp_sensor/src/AdcHardwareConfigurator.h +17 -0
  430. data/vendor/cmock/examples/temp_sensor/src/AdcModel.c +40 -0
  431. data/vendor/cmock/examples/temp_sensor/src/AdcModel.h +20 -0
  432. data/vendor/cmock/examples/temp_sensor/src/AdcTemperatureSensor.c +58 -0
  433. data/vendor/cmock/examples/temp_sensor/src/AdcTemperatureSensor.h +17 -0
  434. data/vendor/cmock/examples/temp_sensor/src/Executor.c +32 -0
  435. data/vendor/cmock/examples/temp_sensor/src/Executor.h +16 -0
  436. data/vendor/cmock/examples/temp_sensor/src/IntrinsicsWrapper.c +25 -0
  437. data/vendor/cmock/examples/temp_sensor/src/IntrinsicsWrapper.h +14 -0
  438. data/vendor/cmock/examples/temp_sensor/src/Main.c +53 -0
  439. data/vendor/cmock/examples/temp_sensor/src/Main.h +14 -0
  440. data/vendor/cmock/examples/temp_sensor/src/Model.c +17 -0
  441. data/vendor/cmock/examples/temp_sensor/src/Model.h +15 -0
  442. data/vendor/cmock/examples/temp_sensor/src/ModelConfig.h +14 -0
  443. data/vendor/cmock/examples/temp_sensor/src/TaskScheduler.c +79 -0
  444. data/vendor/cmock/examples/temp_sensor/src/TaskScheduler.h +18 -0
  445. data/vendor/cmock/examples/temp_sensor/src/TemperatureCalculator.c +34 -0
  446. data/vendor/cmock/examples/temp_sensor/src/TemperatureCalculator.h +13 -0
  447. data/vendor/cmock/examples/temp_sensor/src/TemperatureFilter.c +49 -0
  448. data/vendor/cmock/examples/temp_sensor/src/TemperatureFilter.h +17 -0
  449. data/vendor/cmock/examples/temp_sensor/src/TimerConductor.c +22 -0
  450. data/vendor/cmock/examples/temp_sensor/src/TimerConductor.h +16 -0
  451. data/vendor/cmock/examples/temp_sensor/src/TimerConfigurator.c +58 -0
  452. data/vendor/cmock/examples/temp_sensor/src/TimerConfigurator.h +22 -0
  453. data/vendor/cmock/examples/temp_sensor/src/TimerHardware.c +22 -0
  454. data/vendor/cmock/examples/temp_sensor/src/TimerHardware.h +15 -0
  455. data/vendor/cmock/examples/temp_sensor/src/TimerInterruptConfigurator.c +62 -0
  456. data/vendor/cmock/examples/temp_sensor/src/TimerInterruptConfigurator.h +20 -0
  457. data/vendor/cmock/examples/temp_sensor/src/TimerInterruptHandler.c +32 -0
  458. data/vendor/cmock/examples/temp_sensor/src/TimerInterruptHandler.h +17 -0
  459. data/vendor/cmock/examples/temp_sensor/src/TimerModel.c +16 -0
  460. data/vendor/cmock/examples/temp_sensor/src/TimerModel.h +15 -0
  461. data/vendor/cmock/examples/temp_sensor/src/Types.h +110 -0
  462. data/vendor/cmock/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.c +25 -0
  463. data/vendor/cmock/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.h +13 -0
  464. data/vendor/cmock/examples/temp_sensor/src/UsartConductor.c +28 -0
  465. data/vendor/cmock/examples/temp_sensor/src/UsartConductor.h +14 -0
  466. data/vendor/cmock/examples/temp_sensor/src/UsartConfigurator.c +46 -0
  467. data/vendor/cmock/examples/temp_sensor/src/UsartConfigurator.h +20 -0
  468. data/vendor/cmock/examples/temp_sensor/src/UsartHardware.c +29 -0
  469. data/vendor/cmock/examples/temp_sensor/src/UsartHardware.h +16 -0
  470. data/vendor/cmock/examples/temp_sensor/src/UsartModel.c +41 -0
  471. data/vendor/cmock/examples/temp_sensor/src/UsartModel.h +17 -0
  472. data/vendor/cmock/examples/temp_sensor/src/UsartPutChar.c +23 -0
  473. data/vendor/cmock/examples/temp_sensor/src/UsartPutChar.h +15 -0
  474. data/vendor/cmock/examples/temp_sensor/src/UsartTransmitBufferStatus.c +14 -0
  475. data/vendor/cmock/examples/temp_sensor/src/UsartTransmitBufferStatus.h +15 -0
  476. data/vendor/cmock/examples/temp_sensor/targets/gcc.yml +97 -0
  477. data/vendor/cmock/examples/temp_sensor/targets/iar_v4.yml +143 -0
  478. data/vendor/cmock/examples/temp_sensor/targets/iar_v5.yml +132 -0
  479. data/vendor/cmock/examples/temp_sensor/test/TestAdcConductor.c +128 -0
  480. data/vendor/cmock/examples/temp_sensor/test/TestAdcHardware.c +51 -0
  481. data/vendor/cmock/examples/temp_sensor/test/TestAdcHardwareConfigurator.c +50 -0
  482. data/vendor/cmock/examples/temp_sensor/test/TestAdcModel.c +40 -0
  483. data/vendor/cmock/examples/temp_sensor/test/TestAdcTemperatureSensor.c +54 -0
  484. data/vendor/cmock/examples/temp_sensor/test/TestExecutor.c +43 -0
  485. data/vendor/cmock/examples/temp_sensor/test/TestMain.c +31 -0
  486. data/vendor/cmock/examples/temp_sensor/test/TestModel.c +27 -0
  487. data/vendor/cmock/examples/temp_sensor/test/TestTaskScheduler.c +111 -0
  488. data/vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c +40 -0
  489. data/vendor/cmock/examples/temp_sensor/test/TestTemperatureFilter.c +76 -0
  490. data/vendor/cmock/examples/temp_sensor/test/TestTimerConductor.c +39 -0
  491. data/vendor/cmock/examples/temp_sensor/test/TestTimerConfigurator.c +119 -0
  492. data/vendor/cmock/examples/temp_sensor/test/TestTimerHardware.c +33 -0
  493. data/vendor/cmock/examples/temp_sensor/test/TestTimerInterruptConfigurator.c +85 -0
  494. data/vendor/cmock/examples/temp_sensor/test/TestTimerInterruptHandler.c +73 -0
  495. data/vendor/cmock/examples/temp_sensor/test/TestTimerModel.c +25 -0
  496. data/vendor/cmock/examples/temp_sensor/test/TestUsartBaudRateRegisterCalculator.c +28 -0
  497. data/vendor/cmock/examples/temp_sensor/test/TestUsartConductor.c +47 -0
  498. data/vendor/cmock/examples/temp_sensor/test/TestUsartConfigurator.c +84 -0
  499. data/vendor/cmock/examples/temp_sensor/test/TestUsartHardware.c +44 -0
  500. data/vendor/cmock/examples/temp_sensor/test/TestUsartModel.c +47 -0
  501. data/vendor/cmock/examples/temp_sensor/test/TestUsartPutChar.c +50 -0
  502. data/vendor/cmock/examples/temp_sensor/test/TestUsartTransmitBufferStatus.c +29 -0
  503. data/vendor/cmock/lib/cmock.rb +127 -0
  504. data/vendor/cmock/lib/cmock_config.rb +184 -0
  505. data/vendor/cmock/lib/cmock_file_writer.rb +48 -0
  506. data/vendor/cmock/lib/cmock_generator.rb +379 -0
  507. data/vendor/cmock/lib/cmock_generator_plugin_array.rb +68 -0
  508. data/vendor/cmock/lib/cmock_generator_plugin_callback.rb +88 -0
  509. data/vendor/cmock/lib/cmock_generator_plugin_cexception.rb +50 -0
  510. data/vendor/cmock/lib/cmock_generator_plugin_expect.rb +105 -0
  511. data/vendor/cmock/lib/cmock_generator_plugin_expect_any_args.rb +52 -0
  512. data/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +90 -0
  513. data/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +49 -0
  514. data/vendor/cmock/lib/cmock_generator_plugin_ignore_stateless.rb +87 -0
  515. data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +102 -0
  516. data/vendor/cmock/lib/cmock_generator_utils.rb +251 -0
  517. data/vendor/cmock/lib/cmock_header_parser.rb +629 -0
  518. data/vendor/cmock/lib/cmock_plugin_manager.rb +51 -0
  519. data/vendor/cmock/lib/cmock_unityhelper_parser.rb +82 -0
  520. data/vendor/cmock/lib/cmock_version.rb +29 -0
  521. data/vendor/cmock/meson.build +17 -0
  522. data/vendor/cmock/scripts/create_makefile.rb +210 -0
  523. data/vendor/cmock/scripts/create_mock.rb +15 -0
  524. data/vendor/cmock/scripts/create_runner.rb +25 -0
  525. data/vendor/cmock/scripts/test_summary.rb +25 -0
  526. data/vendor/cmock/src/cmock.c +238 -0
  527. data/vendor/cmock/src/cmock.h +54 -0
  528. data/vendor/cmock/src/cmock_internals.h +98 -0
  529. data/vendor/cmock/src/meson.build +12 -0
  530. data/vendor/cmock/test/c/TestCMockC.c +340 -0
  531. data/vendor/cmock/test/c/TestCMockC.yml +21 -0
  532. data/vendor/cmock/test/c/TestCMockCDynamic.c +193 -0
  533. data/vendor/cmock/test/c/TestCMockCDynamic.yml +19 -0
  534. data/vendor/cmock/test/c/TestCMockCDynamic_Runner.c +43 -0
  535. data/vendor/cmock/test/c/TestCMockC_Runner.c +48 -0
  536. data/vendor/cmock/test/iar/iar_v4/Resource/SAM7_FLASH.mac +71 -0
  537. data/vendor/cmock/test/iar/iar_v4/Resource/SAM7_RAM.mac +94 -0
  538. data/vendor/cmock/test/iar/iar_v4/Resource/SAM7_SIM.mac +67 -0
  539. data/vendor/cmock/test/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl +185 -0
  540. data/vendor/cmock/test/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl +185 -0
  541. data/vendor/cmock/test/iar/iar_v4/Resource/ioat91sam7x256.ddf +2259 -0
  542. data/vendor/cmock/test/iar/iar_v4/cmock_demo.dep +3691 -0
  543. data/vendor/cmock/test/iar/iar_v4/cmock_demo.ewd +1696 -0
  544. data/vendor/cmock/test/iar/iar_v4/cmock_demo.ewp +2581 -0
  545. data/vendor/cmock/test/iar/iar_v4/cmock_demo.eww +10 -0
  546. data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X-EK.h +68 -0
  547. data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X256.inc +2314 -0
  548. data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X256.rdf +4704 -0
  549. data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X256.tcl +3407 -0
  550. data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X256_inc.h +2275 -0
  551. data/vendor/cmock/test/iar/iar_v4/incIAR/ioat91sam7x256.h +4387 -0
  552. data/vendor/cmock/test/iar/iar_v4/incIAR/lib_AT91SAM7X256.h +4211 -0
  553. data/vendor/cmock/test/iar/iar_v4/settings/cmock_demo.cspy.bat +32 -0
  554. data/vendor/cmock/test/iar/iar_v4/settings/cmock_demo.dbgdt +86 -0
  555. data/vendor/cmock/test/iar/iar_v4/settings/cmock_demo.dni +42 -0
  556. data/vendor/cmock/test/iar/iar_v4/settings/cmock_demo.wsdt +76 -0
  557. data/vendor/cmock/test/iar/iar_v4/srcIAR/Cstartup.s79 +266 -0
  558. data/vendor/cmock/test/iar/iar_v4/srcIAR/Cstartup_SAM7.c +105 -0
  559. data/vendor/cmock/test/iar/iar_v5/Resource/SAM7_FLASH.mac +71 -0
  560. data/vendor/cmock/test/iar/iar_v5/Resource/SAM7_RAM.mac +94 -0
  561. data/vendor/cmock/test/iar/iar_v5/Resource/SAM7_SIM.mac +67 -0
  562. data/vendor/cmock/test/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf +43 -0
  563. data/vendor/cmock/test/iar/iar_v5/Resource/at91SAM7X256_RAM.icf +42 -0
  564. data/vendor/cmock/test/iar/iar_v5/cmock_demo.dep +4204 -0
  565. data/vendor/cmock/test/iar/iar_v5/cmock_demo.ewd +1906 -0
  566. data/vendor/cmock/test/iar/iar_v5/cmock_demo.ewp +2426 -0
  567. data/vendor/cmock/test/iar/iar_v5/cmock_demo.eww +26 -0
  568. data/vendor/cmock/test/iar/iar_v5/incIAR/AT91SAM7X-EK.h +68 -0
  569. data/vendor/cmock/test/iar/iar_v5/incIAR/AT91SAM7X256_inc.h +2275 -0
  570. data/vendor/cmock/test/iar/iar_v5/incIAR/lib_AT91SAM7X256.h +4211 -0
  571. data/vendor/cmock/test/iar/iar_v5/incIAR/project.h +37 -0
  572. data/vendor/cmock/test/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +33 -0
  573. data/vendor/cmock/test/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt +5 -0
  574. data/vendor/cmock/test/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni +18 -0
  575. data/vendor/cmock/test/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt +74 -0
  576. data/vendor/cmock/test/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +12 -0
  577. data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo.cspy.bat +33 -0
  578. data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo.dbgdt +85 -0
  579. data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo.dni +44 -0
  580. data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo.wsdt +73 -0
  581. data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo_Binary.jlink +12 -0
  582. data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +12 -0
  583. data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink +12 -0
  584. data/vendor/cmock/test/iar/iar_v5/srcIAR/Cstartup.s +299 -0
  585. data/vendor/cmock/test/iar/iar_v5/srcIAR/Cstartup_SAM7.c +105 -0
  586. data/vendor/cmock/test/rakefile +150 -0
  587. data/vendor/cmock/test/rakefile_helper.rb +417 -0
  588. data/vendor/cmock/test/system/systest_generator.rb +206 -0
  589. data/vendor/cmock/test/system/test_compilation/callingconv.h +18 -0
  590. data/vendor/cmock/test/system/test_compilation/config.yml +17 -0
  591. data/vendor/cmock/test/system/test_compilation/const.h +44 -0
  592. data/vendor/cmock/test/system/test_compilation/inline.h +30 -0
  593. data/vendor/cmock/test/system/test_compilation/osek.h +282 -0
  594. data/vendor/cmock/test/system/test_compilation/parsing.h +99 -0
  595. data/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml +382 -0
  596. data/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml +467 -0
  597. data/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml +453 -0
  598. data/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml +131 -0
  599. data/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml +94 -0
  600. data/vendor/cmock/test/system/test_interactions/doesnt_leave_details_behind.yml +315 -0
  601. data/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml +254 -0
  602. data/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml +115 -0
  603. data/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml +180 -0
  604. data/vendor/cmock/test/system/test_interactions/expect_and_throw.yml +177 -0
  605. data/vendor/cmock/test/system/test_interactions/expect_any_args.yml +245 -0
  606. data/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml +217 -0
  607. data/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml +90 -0
  608. data/vendor/cmock/test/system/test_interactions/ignore_and_return.yml +336 -0
  609. data/vendor/cmock/test/system/test_interactions/ignore_and_return_stateless.yml +332 -0
  610. data/vendor/cmock/test/system/test_interactions/ignore_strict_mock_calling.yml +44 -0
  611. data/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml +59 -0
  612. data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml +98 -0
  613. data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml +66 -0
  614. data/vendor/cmock/test/system/test_interactions/out_of_memory.yml +72 -0
  615. data/vendor/cmock/test/system/test_interactions/parsing_challenges.yml +249 -0
  616. data/vendor/cmock/test/system/test_interactions/return_thru_ptr_and_expect_any_args.yml +242 -0
  617. data/vendor/cmock/test/system/test_interactions/return_thru_ptr_ignore_arg.yml +238 -0
  618. data/vendor/cmock/test/system/test_interactions/skeleton.yml +62 -0
  619. data/vendor/cmock/test/system/test_interactions/skeleton_update.yml +83 -0
  620. data/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml +284 -0
  621. data/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return_with_plugins.yml +287 -0
  622. data/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml +228 -0
  623. data/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml +84 -0
  624. data/vendor/cmock/test/system/test_interactions/unity_ignores.yml +146 -0
  625. data/vendor/cmock/test/system/test_interactions/unity_void_pointer_compare.yml +98 -0
  626. data/vendor/cmock/test/system/test_interactions/wrong_expect_and_return.yml +149 -0
  627. data/vendor/cmock/test/targets/clang_strict.yml +97 -0
  628. data/vendor/cmock/test/targets/gcc.yml +65 -0
  629. data/vendor/cmock/test/targets/gcc_64.yml +65 -0
  630. data/vendor/cmock/test/targets/gcc_tiny.yml +87 -0
  631. data/vendor/cmock/test/targets/iar_arm_v4.yml +117 -0
  632. data/vendor/cmock/test/targets/iar_arm_v5.yml +102 -0
  633. data/vendor/cmock/test/test_helper.rb +45 -0
  634. data/vendor/cmock/test/unit/cmock_config_test.rb +127 -0
  635. data/vendor/cmock/test/unit/cmock_config_test.yml +14 -0
  636. data/vendor/cmock/test/unit/cmock_file_writer_test.rb +28 -0
  637. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +706 -0
  638. data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +145 -0
  639. data/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb +282 -0
  640. data/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb +109 -0
  641. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_a_test.rb +189 -0
  642. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_any_args_test.rb +71 -0
  643. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_b_test.rb +205 -0
  644. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +117 -0
  645. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_stateless_test.rb +121 -0
  646. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +124 -0
  647. data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +209 -0
  648. data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +404 -0
  649. data/vendor/cmock/test/unit/cmock_header_parser_test.rb +2886 -0
  650. data/vendor/cmock/test/unit/cmock_plugin_manager_test.rb +102 -0
  651. data/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb +224 -0
  652. data/vendor/cmock/vendor/behaviors/Manifest.txt +9 -0
  653. data/vendor/cmock/vendor/behaviors/Rakefile +19 -0
  654. data/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb +158 -0
  655. data/vendor/cmock/vendor/behaviors/lib/behaviors.rb +76 -0
  656. data/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb +73 -0
  657. data/vendor/cmock/vendor/behaviors/test/behaviors_test.rb +50 -0
  658. data/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile +19 -0
  659. data/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb +2 -0
  660. data/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb +17 -0
  661. data/vendor/cmock/vendor/c_exception/README.md +236 -0
  662. data/vendor/cmock/vendor/c_exception/docs/CException.md +289 -0
  663. data/vendor/cmock/vendor/c_exception/docs/CODE_OF_CONDUCT.md +138 -0
  664. data/vendor/cmock/vendor/c_exception/docs/CONTRIBUTING.md +238 -0
  665. data/vendor/cmock/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -0
  666. data/vendor/cmock/vendor/c_exception/lib/CException.c +59 -0
  667. data/vendor/cmock/vendor/c_exception/lib/CException.h +122 -0
  668. data/vendor/cmock/vendor/c_exception/lib/meson.build +11 -0
  669. data/vendor/cmock/vendor/c_exception/license.txt +22 -0
  670. data/vendor/cmock/vendor/c_exception/meson.build +14 -0
  671. data/vendor/cmock/vendor/c_exception/project.yml +263 -0
  672. data/vendor/cmock/vendor/c_exception/test/TestException.c +398 -0
  673. data/vendor/cmock/vendor/c_exception/test/support/CExceptionConfig.h +53 -0
  674. data/vendor/cmock/vendor/unity/CMakeLists.txt +172 -0
  675. data/vendor/cmock/vendor/unity/LICENSE.txt +21 -0
  676. data/vendor/cmock/vendor/unity/README.md +234 -0
  677. data/vendor/cmock/vendor/unity/auto/__init__.py +7 -0
  678. data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +120 -0
  679. data/vendor/cmock/vendor/unity/auto/colour_reporter.rb +40 -0
  680. data/vendor/cmock/vendor/unity/auto/extract_version.py +22 -0
  681. data/vendor/cmock/vendor/unity/auto/generate_config.yml +43 -0
  682. data/vendor/cmock/vendor/unity/auto/generate_module.rb +318 -0
  683. data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +547 -0
  684. data/vendor/cmock/vendor/unity/auto/parse_output.rb +390 -0
  685. data/vendor/cmock/vendor/unity/auto/run_test.erb +37 -0
  686. data/vendor/cmock/vendor/unity/auto/stylize_as_junit.py +161 -0
  687. data/vendor/cmock/vendor/unity/auto/stylize_as_junit.rb +253 -0
  688. data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +28 -0
  689. data/vendor/cmock/vendor/unity/auto/type_sanitizer.rb +13 -0
  690. data/vendor/cmock/vendor/unity/auto/unity_test_summary.py +140 -0
  691. data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +140 -0
  692. data/vendor/cmock/vendor/unity/auto/yaml_helper.rb +23 -0
  693. data/vendor/cmock/vendor/unity/docs/CODE_OF_CONDUCT.md +138 -0
  694. data/vendor/cmock/vendor/unity/docs/CONTRIBUTING.md +238 -0
  695. data/vendor/cmock/vendor/unity/docs/MesonGeneratorRunner.md +18 -0
  696. data/vendor/cmock/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +187 -0
  697. data/vendor/cmock/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  698. data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.md +860 -0
  699. data/vendor/cmock/vendor/unity/docs/UnityChangeLog.md +110 -0
  700. data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.md +654 -0
  701. data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.md +242 -0
  702. data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.md +533 -0
  703. data/vendor/cmock/vendor/unity/docs/UnityKnownIssues.md +13 -0
  704. data/vendor/cmock/vendor/unity/examples/example_1/makefile +73 -0
  705. data/vendor/cmock/vendor/unity/examples/example_1/meson.build +48 -0
  706. data/vendor/cmock/vendor/unity/examples/example_1/readme.txt +12 -0
  707. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.c +30 -0
  708. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.h +9 -0
  709. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.c +17 -0
  710. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.h +8 -0
  711. data/vendor/cmock/vendor/unity/examples/example_1/subprojects/unity.wrap +3 -0
  712. data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode.c +68 -0
  713. data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode2.c +37 -0
  714. data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -0
  715. data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -0
  716. data/vendor/cmock/vendor/unity/examples/example_2/makefile +72 -0
  717. data/vendor/cmock/vendor/unity/examples/example_2/readme.txt +5 -0
  718. data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.c +30 -0
  719. data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.h +9 -0
  720. data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.c +17 -0
  721. data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.h +8 -0
  722. data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode.c +71 -0
  723. data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode2.c +40 -0
  724. data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +16 -0
  725. data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +18 -0
  726. data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/all_tests.c +19 -0
  727. data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.c +17 -0
  728. data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.h +19 -0
  729. data/vendor/cmock/vendor/unity/examples/example_3/rakefile.rb +45 -0
  730. data/vendor/cmock/vendor/unity/examples/example_3/rakefile_helper.rb +255 -0
  731. data/vendor/cmock/vendor/unity/examples/example_3/readme.txt +13 -0
  732. data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.c +30 -0
  733. data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.h +9 -0
  734. data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.c +17 -0
  735. data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.h +8 -0
  736. data/vendor/cmock/vendor/unity/examples/example_3/target_gcc_32.yml +54 -0
  737. data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode.c +68 -0
  738. data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode2.c +37 -0
  739. data/vendor/cmock/vendor/unity/examples/example_4/meson.build +12 -0
  740. data/vendor/cmock/vendor/unity/examples/example_4/readme.txt +15 -0
  741. data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode.c +30 -0
  742. data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode.h +9 -0
  743. data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode2.c +17 -0
  744. data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode2.h +8 -0
  745. data/vendor/cmock/vendor/unity/examples/example_4/src/meson.build +16 -0
  746. data/vendor/cmock/vendor/unity/examples/example_4/subprojects/unity.wrap +6 -0
  747. data/vendor/cmock/vendor/unity/examples/example_4/test/TestProductionCode.c +69 -0
  748. data/vendor/cmock/vendor/unity/examples/example_4/test/TestProductionCode2.c +41 -0
  749. data/vendor/cmock/vendor/unity/examples/example_4/test/meson.build +7 -0
  750. data/vendor/cmock/vendor/unity/examples/example_4/test/test_runners/TestProductionCode2_Runner.c +53 -0
  751. data/vendor/cmock/vendor/unity/examples/example_4/test/test_runners/TestProductionCode_Runner.c +57 -0
  752. data/vendor/cmock/vendor/unity/examples/example_4/test/test_runners/meson.build +13 -0
  753. data/vendor/cmock/vendor/unity/examples/unity_config.h +251 -0
  754. data/vendor/cmock/vendor/unity/extras/bdd/readme.md +40 -0
  755. data/vendor/cmock/vendor/unity/extras/bdd/src/unity_bdd.h +44 -0
  756. data/vendor/cmock/vendor/unity/extras/bdd/test/meson.build +9 -0
  757. data/vendor/cmock/vendor/unity/extras/bdd/test/test_bdd.c +129 -0
  758. data/vendor/cmock/vendor/unity/extras/eclipse/error_parsers.txt +26 -0
  759. data/vendor/cmock/vendor/unity/extras/fixture/readme.md +26 -0
  760. data/vendor/cmock/vendor/unity/extras/fixture/src/meson.build +10 -0
  761. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +310 -0
  762. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +94 -0
  763. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +50 -0
  764. data/vendor/cmock/vendor/unity/extras/fixture/test/Makefile +72 -0
  765. data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +20 -0
  766. data/vendor/cmock/vendor/unity/extras/fixture/test/template_fixture_tests.c +39 -0
  767. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +245 -0
  768. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +32 -0
  769. data/vendor/cmock/vendor/unity/extras/memory/readme.md +42 -0
  770. data/vendor/cmock/vendor/unity/extras/memory/src/meson.build +9 -0
  771. data/vendor/cmock/vendor/unity/extras/memory/src/unity_memory.c +203 -0
  772. data/vendor/cmock/vendor/unity/extras/memory/src/unity_memory.h +61 -0
  773. data/vendor/cmock/vendor/unity/extras/memory/test/Makefile +85 -0
  774. data/vendor/cmock/vendor/unity/extras/memory/test/unity_memory_Test.c +326 -0
  775. data/vendor/cmock/vendor/unity/extras/memory/test/unity_memory_TestRunner.c +50 -0
  776. data/vendor/cmock/vendor/unity/extras/memory/test/unity_output_Spy.c +57 -0
  777. data/vendor/cmock/vendor/unity/extras/memory/test/unity_output_Spy.h +17 -0
  778. data/vendor/cmock/vendor/unity/library.json +25 -0
  779. data/vendor/cmock/vendor/unity/meson.build +80 -0
  780. data/vendor/cmock/vendor/unity/meson_options.txt +3 -0
  781. data/vendor/cmock/vendor/unity/platformio-build.py +24 -0
  782. data/vendor/cmock/vendor/unity/src/meson.build +17 -0
  783. data/vendor/cmock/vendor/unity/src/unity.c +2501 -0
  784. data/vendor/cmock/vendor/unity/src/unity.h +698 -0
  785. data/vendor/cmock/vendor/unity/src/unity_internals.h +1183 -0
  786. data/vendor/cmock/vendor/unity/test/Makefile +167 -0
  787. data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +61 -0
  788. data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +57 -0
  789. data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.c +55 -0
  790. data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.h +15 -0
  791. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c +80 -0
  792. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c +76 -0
  793. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -0
  794. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -0
  795. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c +89 -0
  796. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c +89 -0
  797. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c +77 -0
  798. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c +89 -0
  799. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c +89 -0
  800. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c +90 -0
  801. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +67 -0
  802. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +70 -0
  803. data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +58 -0
  804. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +67 -0
  805. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +70 -0
  806. data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +71 -0
  807. data/vendor/cmock/vendor/unity/test/rakefile +164 -0
  808. data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +316 -0
  809. data/vendor/cmock/vendor/unity/test/spec/generate_module_existing_file_spec.rb +164 -0
  810. data/vendor/cmock/vendor/unity/test/targets/ansi.yml +51 -0
  811. data/vendor/cmock/vendor/unity/test/targets/clang_file.yml +79 -0
  812. data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +79 -0
  813. data/vendor/cmock/vendor/unity/test/targets/gcc_32.yml +52 -0
  814. data/vendor/cmock/vendor/unity/test/targets/gcc_64.yml +53 -0
  815. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_limits.yml +50 -0
  816. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_stdint.yml +62 -0
  817. data/vendor/cmock/vendor/unity/test/targets/gcc_manual_math.yml +50 -0
  818. data/vendor/cmock/vendor/unity/test/targets/hitech_picc18.yml +98 -0
  819. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v4.yml +105 -0
  820. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5.yml +99 -0
  821. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5_3.yml +99 -0
  822. data/vendor/cmock/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +97 -0
  823. data/vendor/cmock/vendor/unity/test/targets/iar_cortexm3_v5.yml +101 -0
  824. data/vendor/cmock/vendor/unity/test/targets/iar_msp430.yml +119 -0
  825. data/vendor/cmock/vendor/unity/test/targets/iar_sh2a_v6.yml +106 -0
  826. data/vendor/cmock/vendor/unity/test/testdata/CException.h +18 -0
  827. data/vendor/cmock/vendor/unity/test/testdata/Defs.h +16 -0
  828. data/vendor/cmock/vendor/unity/test/testdata/cmock.h +21 -0
  829. data/vendor/cmock/vendor/unity/test/testdata/mockMock.h +20 -0
  830. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGenerator.c +204 -0
  831. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +73 -0
  832. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +200 -0
  833. data/vendor/cmock/vendor/unity/test/tests/self_assessment_utils.h +151 -0
  834. data/vendor/cmock/vendor/unity/test/tests/test_generate_test_runner.rb +1341 -0
  835. data/vendor/cmock/vendor/unity/test/tests/test_unity_arrays.c +2941 -0
  836. data/vendor/cmock/vendor/unity/test/tests/test_unity_core.c +375 -0
  837. data/vendor/cmock/vendor/unity/test/tests/test_unity_doubles.c +1285 -0
  838. data/vendor/cmock/vendor/unity/test/tests/test_unity_floats.c +1395 -0
  839. data/vendor/cmock/vendor/unity/test/tests/test_unity_integers.c +2863 -0
  840. data/vendor/cmock/vendor/unity/test/tests/test_unity_integers_64.c +783 -0
  841. data/vendor/cmock/vendor/unity/test/tests/test_unity_memory.c +82 -0
  842. data/vendor/cmock/vendor/unity/test/tests/test_unity_parameterized.c +309 -0
  843. data/vendor/cmock/vendor/unity/test/tests/test_unity_parameterizedDemo.c +28 -0
  844. data/vendor/cmock/vendor/unity/test/tests/test_unity_strings.c +330 -0
  845. data/vendor/cmock/vendor/unity/test/tests/types_for_test.h +21 -0
  846. data/vendor/cmock/vendor/unity/unityConfig.cmake +1 -0
  847. data/vendor/diy/History.txt +28 -0
  848. data/vendor/diy/LICENSE.txt +7 -0
  849. data/vendor/diy/README.rdoc +215 -0
  850. data/vendor/diy/Rakefile +33 -0
  851. data/vendor/diy/TODO.txt +9 -0
  852. data/vendor/diy/diy.gemspec +131 -0
  853. data/vendor/diy/lib/diy/factory.rb +44 -0
  854. data/vendor/diy/lib/diy.rb +411 -0
  855. data/vendor/diy/sample_code/car.rb +15 -0
  856. data/vendor/diy/sample_code/chassis.rb +13 -0
  857. data/vendor/diy/sample_code/diy_example.rb +34 -0
  858. data/vendor/diy/sample_code/engine.rb +13 -0
  859. data/vendor/diy/sample_code/objects.yml +18 -0
  860. data/vendor/diy/test/constructor.rb +127 -0
  861. data/vendor/diy/test/diy_test.rb +616 -0
  862. data/vendor/diy/test/factory_test.rb +87 -0
  863. data/vendor/diy/test/files/broken_construction.yml +15 -0
  864. data/vendor/diy/test/files/cat/cat.rb +11 -0
  865. data/vendor/diy/test/files/cat/extra_conflict.yml +13 -0
  866. data/vendor/diy/test/files/cat/heritage.rb +10 -0
  867. data/vendor/diy/test/files/cat/needs_input.yml +11 -0
  868. data/vendor/diy/test/files/cat/the_cat_lineage.rb +9 -0
  869. data/vendor/diy/test/files/dog/dog_model.rb +11 -0
  870. data/vendor/diy/test/files/dog/dog_presenter.rb +11 -0
  871. data/vendor/diy/test/files/dog/dog_view.rb +10 -0
  872. data/vendor/diy/test/files/dog/file_resolver.rb +10 -0
  873. data/vendor/diy/test/files/dog/other_thing.rb +10 -0
  874. data/vendor/diy/test/files/dog/simple.yml +19 -0
  875. data/vendor/diy/test/files/donkey/foo/bar/qux.rb +15 -0
  876. data/vendor/diy/test/files/donkey/foo.rb +16 -0
  877. data/vendor/diy/test/files/factory/beef.rb +13 -0
  878. data/vendor/diy/test/files/factory/dog.rb +14 -0
  879. data/vendor/diy/test/files/factory/factory.yml +27 -0
  880. data/vendor/diy/test/files/factory/farm/llama.rb +15 -0
  881. data/vendor/diy/test/files/factory/farm/pork.rb +15 -0
  882. data/vendor/diy/test/files/factory/kitten.rb +21 -0
  883. data/vendor/diy/test/files/fud/objects.yml +21 -0
  884. data/vendor/diy/test/files/fud/toy.rb +22 -0
  885. data/vendor/diy/test/files/functions/attached_things_builder.rb +10 -0
  886. data/vendor/diy/test/files/functions/invalid_method.yml +13 -0
  887. data/vendor/diy/test/files/functions/method_extractor.rb +11 -0
  888. data/vendor/diy/test/files/functions/nonsingleton_objects.yml +14 -0
  889. data/vendor/diy/test/files/functions/objects.yml +30 -0
  890. data/vendor/diy/test/files/functions/thing.rb +11 -0
  891. data/vendor/diy/test/files/functions/thing_builder.rb +33 -0
  892. data/vendor/diy/test/files/functions/things_builder.rb +11 -0
  893. data/vendor/diy/test/files/gnu/objects.yml +22 -0
  894. data/vendor/diy/test/files/gnu/thinger.rb +15 -0
  895. data/vendor/diy/test/files/goat/base.rb +16 -0
  896. data/vendor/diy/test/files/goat/can.rb +14 -0
  897. data/vendor/diy/test/files/goat/goat.rb +14 -0
  898. data/vendor/diy/test/files/goat/objects.yml +20 -0
  899. data/vendor/diy/test/files/goat/paper.rb +14 -0
  900. data/vendor/diy/test/files/goat/plane.rb +15 -0
  901. data/vendor/diy/test/files/goat/shirt.rb +14 -0
  902. data/vendor/diy/test/files/goat/wings.rb +16 -0
  903. data/vendor/diy/test/files/horse/holder_thing.rb +11 -0
  904. data/vendor/diy/test/files/horse/objects.yml +15 -0
  905. data/vendor/diy/test/files/namespace/animal/bird.rb +13 -0
  906. data/vendor/diy/test/files/namespace/animal/cat.rb +13 -0
  907. data/vendor/diy/test/files/namespace/animal/reptile/hardshell/turtle.rb +16 -0
  908. data/vendor/diy/test/files/namespace/animal/reptile/lizard.rb +15 -0
  909. data/vendor/diy/test/files/namespace/bad_module_specified.yml +16 -0
  910. data/vendor/diy/test/files/namespace/class_name_combine.yml +16 -0
  911. data/vendor/diy/test/files/namespace/hello.txt +1 -0
  912. data/vendor/diy/test/files/namespace/no_module_specified.yml +16 -0
  913. data/vendor/diy/test/files/namespace/objects.yml +29 -0
  914. data/vendor/diy/test/files/namespace/road.rb +10 -0
  915. data/vendor/diy/test/files/namespace/sky.rb +10 -0
  916. data/vendor/diy/test/files/namespace/subcontext.yml +30 -0
  917. data/vendor/diy/test/files/non_singleton/air.rb +10 -0
  918. data/vendor/diy/test/files/non_singleton/fat_cat.rb +11 -0
  919. data/vendor/diy/test/files/non_singleton/objects.yml +27 -0
  920. data/vendor/diy/test/files/non_singleton/pig.rb +11 -0
  921. data/vendor/diy/test/files/non_singleton/thread_spinner.rb +11 -0
  922. data/vendor/diy/test/files/non_singleton/tick.rb +11 -0
  923. data/vendor/diy/test/files/non_singleton/yard.rb +10 -0
  924. data/vendor/diy/test/files/yak/core_model.rb +11 -0
  925. data/vendor/diy/test/files/yak/core_presenter.rb +11 -0
  926. data/vendor/diy/test/files/yak/core_view.rb +9 -0
  927. data/vendor/diy/test/files/yak/data_source.rb +9 -0
  928. data/vendor/diy/test/files/yak/fringe_model.rb +11 -0
  929. data/vendor/diy/test/files/yak/fringe_presenter.rb +11 -0
  930. data/vendor/diy/test/files/yak/fringe_view.rb +9 -0
  931. data/vendor/diy/test/files/yak/giant_squid.rb +11 -0
  932. data/vendor/diy/test/files/yak/krill.rb +10 -0
  933. data/vendor/diy/test/files/yak/my_objects.yml +29 -0
  934. data/vendor/diy/test/files/yak/sub_sub_context_test.yml +35 -0
  935. data/vendor/diy/test/test_helper.rb +63 -0
  936. data/vendor/unity/CMakeLists.txt +172 -0
  937. data/vendor/unity/LICENSE.txt +21 -0
  938. data/vendor/unity/README.md +234 -0
  939. data/vendor/unity/auto/__init__.py +7 -0
  940. data/vendor/unity/auto/colour_prompt.rb +120 -0
  941. data/vendor/unity/auto/colour_reporter.rb +40 -0
  942. data/vendor/unity/auto/extract_version.py +22 -0
  943. data/vendor/unity/auto/generate_config.yml +43 -0
  944. data/vendor/unity/auto/generate_module.rb +318 -0
  945. data/vendor/unity/auto/generate_test_runner.rb +547 -0
  946. data/vendor/unity/auto/parse_output.rb +390 -0
  947. data/vendor/unity/auto/run_test.erb +37 -0
  948. data/vendor/unity/auto/stylize_as_junit.py +161 -0
  949. data/vendor/unity/auto/stylize_as_junit.rb +253 -0
  950. data/vendor/unity/auto/test_file_filter.rb +28 -0
  951. data/vendor/unity/auto/type_sanitizer.rb +13 -0
  952. data/vendor/unity/auto/unity_test_summary.py +140 -0
  953. data/vendor/unity/auto/unity_test_summary.rb +140 -0
  954. data/vendor/unity/auto/yaml_helper.rb +23 -0
  955. data/vendor/unity/docs/CODE_OF_CONDUCT.md +138 -0
  956. data/vendor/unity/docs/CONTRIBUTING.md +238 -0
  957. data/vendor/unity/docs/MesonGeneratorRunner.md +18 -0
  958. data/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +187 -0
  959. data/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  960. data/vendor/unity/docs/UnityAssertionsReference.md +860 -0
  961. data/vendor/unity/docs/UnityChangeLog.md +110 -0
  962. data/vendor/unity/docs/UnityConfigurationGuide.md +654 -0
  963. data/vendor/unity/docs/UnityGettingStartedGuide.md +242 -0
  964. data/vendor/unity/docs/UnityHelperScriptsGuide.md +533 -0
  965. data/vendor/unity/docs/UnityKnownIssues.md +13 -0
  966. data/vendor/unity/examples/example_1/makefile +73 -0
  967. data/vendor/unity/examples/example_1/meson.build +48 -0
  968. data/vendor/unity/examples/example_1/readme.txt +12 -0
  969. data/vendor/unity/examples/example_1/src/ProductionCode.c +30 -0
  970. data/vendor/unity/examples/example_1/src/ProductionCode.h +9 -0
  971. data/vendor/unity/examples/example_1/src/ProductionCode2.c +17 -0
  972. data/vendor/unity/examples/example_1/src/ProductionCode2.h +8 -0
  973. data/vendor/unity/examples/example_1/subprojects/unity.wrap +3 -0
  974. data/vendor/unity/examples/example_1/test/TestProductionCode.c +68 -0
  975. data/vendor/unity/examples/example_1/test/TestProductionCode2.c +37 -0
  976. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -0
  977. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -0
  978. data/vendor/unity/examples/example_2/makefile +72 -0
  979. data/vendor/unity/examples/example_2/readme.txt +5 -0
  980. data/vendor/unity/examples/example_2/src/ProductionCode.c +30 -0
  981. data/vendor/unity/examples/example_2/src/ProductionCode.h +9 -0
  982. data/vendor/unity/examples/example_2/src/ProductionCode2.c +17 -0
  983. data/vendor/unity/examples/example_2/src/ProductionCode2.h +8 -0
  984. data/vendor/unity/examples/example_2/test/TestProductionCode.c +71 -0
  985. data/vendor/unity/examples/example_2/test/TestProductionCode2.c +40 -0
  986. data/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +16 -0
  987. data/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +18 -0
  988. data/vendor/unity/examples/example_2/test/test_runners/all_tests.c +19 -0
  989. data/vendor/unity/examples/example_3/helper/UnityHelper.c +17 -0
  990. data/vendor/unity/examples/example_3/helper/UnityHelper.h +19 -0
  991. data/vendor/unity/examples/example_3/rakefile.rb +45 -0
  992. data/vendor/unity/examples/example_3/rakefile_helper.rb +255 -0
  993. data/vendor/unity/examples/example_3/readme.txt +13 -0
  994. data/vendor/unity/examples/example_3/src/ProductionCode.c +30 -0
  995. data/vendor/unity/examples/example_3/src/ProductionCode.h +9 -0
  996. data/vendor/unity/examples/example_3/src/ProductionCode2.c +17 -0
  997. data/vendor/unity/examples/example_3/src/ProductionCode2.h +8 -0
  998. data/vendor/unity/examples/example_3/target_gcc_32.yml +54 -0
  999. data/vendor/unity/examples/example_3/test/TestProductionCode.c +68 -0
  1000. data/vendor/unity/examples/example_3/test/TestProductionCode2.c +37 -0
  1001. data/vendor/unity/examples/example_4/meson.build +12 -0
  1002. data/vendor/unity/examples/example_4/readme.txt +15 -0
  1003. data/vendor/unity/examples/example_4/src/ProductionCode.c +30 -0
  1004. data/vendor/unity/examples/example_4/src/ProductionCode.h +9 -0
  1005. data/vendor/unity/examples/example_4/src/ProductionCode2.c +17 -0
  1006. data/vendor/unity/examples/example_4/src/ProductionCode2.h +8 -0
  1007. data/vendor/unity/examples/example_4/src/meson.build +16 -0
  1008. data/vendor/unity/examples/example_4/subprojects/unity.wrap +6 -0
  1009. data/vendor/unity/examples/example_4/test/TestProductionCode.c +69 -0
  1010. data/vendor/unity/examples/example_4/test/TestProductionCode2.c +41 -0
  1011. data/vendor/unity/examples/example_4/test/meson.build +7 -0
  1012. data/vendor/unity/examples/example_4/test/test_runners/TestProductionCode2_Runner.c +53 -0
  1013. data/vendor/unity/examples/example_4/test/test_runners/TestProductionCode_Runner.c +57 -0
  1014. data/vendor/unity/examples/example_4/test/test_runners/meson.build +13 -0
  1015. data/vendor/unity/examples/unity_config.h +251 -0
  1016. data/vendor/unity/extras/bdd/readme.md +40 -0
  1017. data/vendor/unity/extras/bdd/src/unity_bdd.h +44 -0
  1018. data/vendor/unity/extras/bdd/test/meson.build +9 -0
  1019. data/vendor/unity/extras/bdd/test/test_bdd.c +129 -0
  1020. data/vendor/unity/extras/eclipse/error_parsers.txt +26 -0
  1021. data/vendor/unity/extras/fixture/readme.md +26 -0
  1022. data/vendor/unity/extras/fixture/src/meson.build +10 -0
  1023. data/vendor/unity/extras/fixture/src/unity_fixture.c +310 -0
  1024. data/vendor/unity/extras/fixture/src/unity_fixture.h +94 -0
  1025. data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +50 -0
  1026. data/vendor/unity/extras/fixture/test/Makefile +72 -0
  1027. data/vendor/unity/extras/fixture/test/main/AllTests.c +20 -0
  1028. data/vendor/unity/extras/fixture/test/template_fixture_tests.c +39 -0
  1029. data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +245 -0
  1030. data/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +32 -0
  1031. data/vendor/unity/extras/memory/readme.md +42 -0
  1032. data/vendor/unity/extras/memory/src/meson.build +9 -0
  1033. data/vendor/unity/extras/memory/src/unity_memory.c +203 -0
  1034. data/vendor/unity/extras/memory/src/unity_memory.h +61 -0
  1035. data/vendor/unity/extras/memory/test/Makefile +85 -0
  1036. data/vendor/unity/extras/memory/test/unity_memory_Test.c +326 -0
  1037. data/vendor/unity/extras/memory/test/unity_memory_TestRunner.c +50 -0
  1038. data/vendor/unity/extras/memory/test/unity_output_Spy.c +57 -0
  1039. data/vendor/unity/extras/memory/test/unity_output_Spy.h +17 -0
  1040. data/vendor/unity/library.json +25 -0
  1041. data/vendor/unity/meson.build +80 -0
  1042. data/vendor/unity/meson_options.txt +3 -0
  1043. data/vendor/unity/platformio-build.py +24 -0
  1044. data/vendor/unity/src/meson.build +17 -0
  1045. data/vendor/unity/src/unity.c +2501 -0
  1046. data/vendor/unity/src/unity.h +698 -0
  1047. data/vendor/unity/src/unity_internals.h +1183 -0
  1048. data/vendor/unity/test/Makefile +167 -0
  1049. data/vendor/unity/test/expectdata/testsample_cmd.c +61 -0
  1050. data/vendor/unity/test/expectdata/testsample_def.c +57 -0
  1051. data/vendor/unity/test/expectdata/testsample_head1.c +55 -0
  1052. data/vendor/unity/test/expectdata/testsample_head1.h +15 -0
  1053. data/vendor/unity/test/expectdata/testsample_mock_cmd.c +80 -0
  1054. data/vendor/unity/test/expectdata/testsample_mock_def.c +76 -0
  1055. data/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -0
  1056. data/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -0
  1057. data/vendor/unity/test/expectdata/testsample_mock_new1.c +89 -0
  1058. data/vendor/unity/test/expectdata/testsample_mock_new2.c +89 -0
  1059. data/vendor/unity/test/expectdata/testsample_mock_param.c +77 -0
  1060. data/vendor/unity/test/expectdata/testsample_mock_run1.c +89 -0
  1061. data/vendor/unity/test/expectdata/testsample_mock_run2.c +89 -0
  1062. data/vendor/unity/test/expectdata/testsample_mock_yaml.c +90 -0
  1063. data/vendor/unity/test/expectdata/testsample_new1.c +67 -0
  1064. data/vendor/unity/test/expectdata/testsample_new2.c +70 -0
  1065. data/vendor/unity/test/expectdata/testsample_param.c +58 -0
  1066. data/vendor/unity/test/expectdata/testsample_run1.c +67 -0
  1067. data/vendor/unity/test/expectdata/testsample_run2.c +70 -0
  1068. data/vendor/unity/test/expectdata/testsample_yaml.c +71 -0
  1069. data/vendor/unity/test/rakefile +164 -0
  1070. data/vendor/unity/test/rakefile_helper.rb +316 -0
  1071. data/vendor/unity/test/spec/generate_module_existing_file_spec.rb +164 -0
  1072. data/vendor/unity/test/targets/ansi.yml +51 -0
  1073. data/vendor/unity/test/targets/clang_file.yml +79 -0
  1074. data/vendor/unity/test/targets/clang_strict.yml +79 -0
  1075. data/vendor/unity/test/targets/gcc_32.yml +52 -0
  1076. data/vendor/unity/test/targets/gcc_64.yml +53 -0
  1077. data/vendor/unity/test/targets/gcc_auto_limits.yml +50 -0
  1078. data/vendor/unity/test/targets/gcc_auto_stdint.yml +62 -0
  1079. data/vendor/unity/test/targets/gcc_manual_math.yml +50 -0
  1080. data/vendor/unity/test/targets/hitech_picc18.yml +98 -0
  1081. data/vendor/unity/test/targets/iar_arm_v4.yml +105 -0
  1082. data/vendor/unity/test/targets/iar_arm_v5.yml +99 -0
  1083. data/vendor/unity/test/targets/iar_arm_v5_3.yml +99 -0
  1084. data/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +97 -0
  1085. data/vendor/unity/test/targets/iar_cortexm3_v5.yml +101 -0
  1086. data/vendor/unity/test/targets/iar_msp430.yml +119 -0
  1087. data/vendor/unity/test/targets/iar_sh2a_v6.yml +106 -0
  1088. data/vendor/unity/test/testdata/CException.h +18 -0
  1089. data/vendor/unity/test/testdata/Defs.h +16 -0
  1090. data/vendor/unity/test/testdata/cmock.h +21 -0
  1091. data/vendor/unity/test/testdata/mockMock.h +20 -0
  1092. data/vendor/unity/test/testdata/testRunnerGenerator.c +204 -0
  1093. data/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +73 -0
  1094. data/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +200 -0
  1095. data/vendor/unity/test/tests/self_assessment_utils.h +151 -0
  1096. data/vendor/unity/test/tests/test_generate_test_runner.rb +1341 -0
  1097. data/vendor/unity/test/tests/test_unity_arrays.c +2941 -0
  1098. data/vendor/unity/test/tests/test_unity_core.c +375 -0
  1099. data/vendor/unity/test/tests/test_unity_doubles.c +1285 -0
  1100. data/vendor/unity/test/tests/test_unity_floats.c +1395 -0
  1101. data/vendor/unity/test/tests/test_unity_integers.c +2863 -0
  1102. data/vendor/unity/test/tests/test_unity_integers_64.c +783 -0
  1103. data/vendor/unity/test/tests/test_unity_memory.c +82 -0
  1104. data/vendor/unity/test/tests/test_unity_parameterized.c +309 -0
  1105. data/vendor/unity/test/tests/test_unity_parameterizedDemo.c +28 -0
  1106. data/vendor/unity/test/tests/test_unity_strings.c +330 -0
  1107. data/vendor/unity/test/tests/types_for_test.h +21 -0
  1108. data/vendor/unity/unityConfig.cmake +1 -0
  1109. metadata +1211 -251
  1110. data/.gitignore +0 -14
  1111. data/.vim +0 -1
  1112. data/.yardopts +0 -1
  1113. data/LICENSE +0 -19
  1114. data/ceedling-gem.sublime-project +0 -575
  1115. data/examples/temp_sensor/rakefile.rb +0 -4
  1116. data/examples/temp_sensor/src/AT91SAM7X256.h +0 -2556
  1117. data/examples/temp_sensor/src/UsartGetChar.c +0 -6
  1118. data/examples/temp_sensor/src/UsartGetChar.h +0 -8
  1119. data/examples/temp_sensor/test/test_AdcConductor.c +0 -121
  1120. data/examples/temp_sensor/test/test_AdcHardware.c +0 -44
  1121. data/examples/temp_sensor/test/test_AdcHardwareConfigurator.c +0 -43
  1122. data/examples/temp_sensor/test/test_AdcModel.c +0 -33
  1123. data/examples/temp_sensor/test/test_AdcTemperatureSensor.c +0 -47
  1124. data/examples/temp_sensor/test/test_Executor.c +0 -36
  1125. data/examples/temp_sensor/test/test_Main.c +0 -24
  1126. data/examples/temp_sensor/test/test_Model.c +0 -20
  1127. data/examples/temp_sensor/test/test_TaskScheduler.c +0 -104
  1128. data/examples/temp_sensor/test/test_TemperatureCalculator.c +0 -33
  1129. data/examples/temp_sensor/test/test_TemperatureFilter.c +0 -71
  1130. data/examples/temp_sensor/test/test_TimerConductor.c +0 -32
  1131. data/examples/temp_sensor/test/test_TimerConfigurator.c +0 -112
  1132. data/examples/temp_sensor/test/test_TimerHardware.c +0 -26
  1133. data/examples/temp_sensor/test/test_TimerInterruptConfigurator.c +0 -78
  1134. data/examples/temp_sensor/test/test_TimerInterruptHandler.c +0 -66
  1135. data/examples/temp_sensor/test/test_TimerModel.c +0 -18
  1136. data/examples/temp_sensor/test/test_UsartBaudRateRegisterCalculator.c +0 -21
  1137. data/examples/temp_sensor/test/test_UsartConductor.c +0 -40
  1138. data/examples/temp_sensor/test/test_UsartConfigurator.c +0 -77
  1139. data/examples/temp_sensor/test/test_UsartGetChar.c +0 -17
  1140. data/examples/temp_sensor/test/test_UsartHardware.c +0 -56
  1141. data/examples/temp_sensor/test/test_UsartModel.c +0 -40
  1142. data/examples/temp_sensor/test/test_UsartPutChar.c +0 -43
  1143. data/examples/temp_sensor/test/test_UsartTransmitBufferStatus.c +0 -22
  1144. data/lib/ceedling/version.rb +0 -16
  1145. data/lib/ceedling/version.rb.erb +0 -16
  1146. data/new_project_template/build/.gitkeep +0 -0
  1147. data/new_project_template/project.yml +0 -65
  1148. data/new_project_template/rakefile.rb +0 -4
  1149. data/new_project_template/src/.gitkeep +0 -0
  1150. data/new_project_template/test/.gitkeep +0 -0
  1151. data/new_project_template/test/support/.gitkeep +0 -0
  1152. data/new_project_template/vendor/ceedling/docs/CExceptionSummary.pdf +0 -0
  1153. data/new_project_template/vendor/ceedling/docs/CMock Summary.pdf +0 -0
  1154. data/new_project_template/vendor/ceedling/docs/Ceedling Packet.pdf +0 -0
  1155. data/new_project_template/vendor/ceedling/docs/Unity Summary.pdf +0 -0
  1156. data/new_project_template/vendor/ceedling/lib/build_invoker_utils.rb +0 -27
  1157. data/new_project_template/vendor/ceedling/lib/cacheinator.rb +0 -42
  1158. data/new_project_template/vendor/ceedling/lib/cacheinator_helper.rb +0 -12
  1159. data/new_project_template/vendor/ceedling/lib/cmock_builder.rb +0 -15
  1160. data/new_project_template/vendor/ceedling/lib/configurator.rb +0 -329
  1161. data/new_project_template/vendor/ceedling/lib/configurator_builder.rb +0 -419
  1162. data/new_project_template/vendor/ceedling/lib/configurator_plugins.rb +0 -93
  1163. data/new_project_template/vendor/ceedling/lib/configurator_setup.rb +0 -123
  1164. data/new_project_template/vendor/ceedling/lib/configurator_validator.rb +0 -184
  1165. data/new_project_template/vendor/ceedling/lib/constants.rb +0 -91
  1166. data/new_project_template/vendor/ceedling/lib/defaults.rb +0 -378
  1167. data/new_project_template/vendor/ceedling/lib/dependinator.rb +0 -92
  1168. data/new_project_template/vendor/ceedling/lib/file_finder.rb +0 -132
  1169. data/new_project_template/vendor/ceedling/lib/file_finder_helper.rb +0 -54
  1170. data/new_project_template/vendor/ceedling/lib/file_path_utils.rb +0 -189
  1171. data/new_project_template/vendor/ceedling/lib/file_system_utils.rb +0 -69
  1172. data/new_project_template/vendor/ceedling/lib/file_wrapper.rb +0 -74
  1173. data/new_project_template/vendor/ceedling/lib/flaginator.rb +0 -54
  1174. data/new_project_template/vendor/ceedling/lib/generator.rb +0 -162
  1175. data/new_project_template/vendor/ceedling/lib/generator_helper.rb +0 -40
  1176. data/new_project_template/vendor/ceedling/lib/generator_test_results.rb +0 -89
  1177. data/new_project_template/vendor/ceedling/lib/generator_test_results_sanity_checker.rb +0 -62
  1178. data/new_project_template/vendor/ceedling/lib/generator_test_runner.rb +0 -63
  1179. data/new_project_template/vendor/ceedling/lib/loginator.rb +0 -31
  1180. data/new_project_template/vendor/ceedling/lib/makefile.rb +0 -46
  1181. data/new_project_template/vendor/ceedling/lib/objects.yml +0 -301
  1182. data/new_project_template/vendor/ceedling/lib/plugin.rb +0 -79
  1183. data/new_project_template/vendor/ceedling/lib/plugin_manager.rb +0 -95
  1184. data/new_project_template/vendor/ceedling/lib/plugin_manager_helper.rb +0 -19
  1185. data/new_project_template/vendor/ceedling/lib/plugin_reportinator.rb +0 -75
  1186. data/new_project_template/vendor/ceedling/lib/plugin_reportinator_helper.rb +0 -52
  1187. data/new_project_template/vendor/ceedling/lib/preprocessinator.rb +0 -43
  1188. data/new_project_template/vendor/ceedling/lib/preprocessinator_extractor.rb +0 -36
  1189. data/new_project_template/vendor/ceedling/lib/preprocessinator_file_handler.rb +0 -21
  1190. data/new_project_template/vendor/ceedling/lib/preprocessinator_helper.rb +0 -46
  1191. data/new_project_template/vendor/ceedling/lib/preprocessinator_includes_handler.rb +0 -55
  1192. data/new_project_template/vendor/ceedling/lib/project_config_manager.rb +0 -38
  1193. data/new_project_template/vendor/ceedling/lib/project_file_loader.rb +0 -64
  1194. data/new_project_template/vendor/ceedling/lib/rake_utils.rb +0 -17
  1195. data/new_project_template/vendor/ceedling/lib/rake_wrapper.rb +0 -31
  1196. data/new_project_template/vendor/ceedling/lib/rakefile.rb +0 -61
  1197. data/new_project_template/vendor/ceedling/lib/release_invoker.rb +0 -58
  1198. data/new_project_template/vendor/ceedling/lib/release_invoker_helper.rb +0 -16
  1199. data/new_project_template/vendor/ceedling/lib/reportinator.rb +0 -9
  1200. data/new_project_template/vendor/ceedling/lib/rules_cmock.rake +0 -9
  1201. data/new_project_template/vendor/ceedling/lib/rules_preprocess.rake +0 -26
  1202. data/new_project_template/vendor/ceedling/lib/rules_release.rake +0 -79
  1203. data/new_project_template/vendor/ceedling/lib/rules_release_deep_dependencies.rake +0 -15
  1204. data/new_project_template/vendor/ceedling/lib/rules_tests.rake +0 -59
  1205. data/new_project_template/vendor/ceedling/lib/rules_tests_deep_dependencies.rake +0 -15
  1206. data/new_project_template/vendor/ceedling/lib/setupinator.rb +0 -51
  1207. data/new_project_template/vendor/ceedling/lib/stream_wrapper.rb +0 -20
  1208. data/new_project_template/vendor/ceedling/lib/streaminator.rb +0 -41
  1209. data/new_project_template/vendor/ceedling/lib/streaminator_helper.rb +0 -15
  1210. data/new_project_template/vendor/ceedling/lib/system_utils.rb +0 -32
  1211. data/new_project_template/vendor/ceedling/lib/system_wrapper.rb +0 -75
  1212. data/new_project_template/vendor/ceedling/lib/task_invoker.rb +0 -85
  1213. data/new_project_template/vendor/ceedling/lib/tasks_base.rake +0 -104
  1214. data/new_project_template/vendor/ceedling/lib/tasks_filesystem.rake +0 -91
  1215. data/new_project_template/vendor/ceedling/lib/tasks_release.rake +0 -28
  1216. data/new_project_template/vendor/ceedling/lib/tasks_release_deep_dependencies.rake +0 -9
  1217. data/new_project_template/vendor/ceedling/lib/tasks_tests.rake +0 -52
  1218. data/new_project_template/vendor/ceedling/lib/tasks_tests_deep_dependencies.rake +0 -9
  1219. data/new_project_template/vendor/ceedling/lib/tasks_vendor.rake +0 -36
  1220. data/new_project_template/vendor/ceedling/lib/test_includes_extractor.rb +0 -81
  1221. data/new_project_template/vendor/ceedling/lib/test_invoker.rb +0 -97
  1222. data/new_project_template/vendor/ceedling/lib/test_invoker_helper.rb +0 -28
  1223. data/new_project_template/vendor/ceedling/lib/tool_executor.rb +0 -212
  1224. data/new_project_template/vendor/ceedling/lib/tool_executor_helper.rb +0 -115
  1225. data/new_project_template/vendor/ceedling/lib/verbosinator.rb +0 -10
  1226. data/new_project_template/vendor/ceedling/lib/yaml_wrapper.rb +0 -16
  1227. data/new_project_template/vendor/ceedling/plugins/bullseye/bullseye.rake +0 -162
  1228. data/new_project_template/vendor/ceedling/plugins/bullseye/bullseye.rb +0 -173
  1229. data/new_project_template/vendor/ceedling/plugins/bullseye/defaults.yml +0 -53
  1230. data/new_project_template/vendor/ceedling/plugins/bullseye/readme.txt +0 -0
  1231. data/new_project_template/vendor/ceedling/plugins/gcov/defaults.yml +0 -34
  1232. data/new_project_template/vendor/ceedling/plugins/gcov/gcov.rake +0 -152
  1233. data/new_project_template/vendor/ceedling/plugins/gcov/gcov.rb +0 -128
  1234. data/new_project_template/vendor/ceedling/plugins/gcov/readme.txt +0 -0
  1235. data/new_project_template/vendor/ceedling/plugins/gcov/template.erb +0 -15
  1236. data/new_project_template/vendor/ceedling/plugins/module_generator/module_generator.rake +0 -14
  1237. data/new_project_template/vendor/ceedling/plugins/module_generator/module_generator.rb +0 -218
  1238. data/new_project_template/vendor/ceedling/plugins/module_generator/module_generator.yml +0 -4
  1239. data/new_project_template/vendor/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.rb +0 -44
  1240. data/new_project_template/vendor/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.yml +0 -4
  1241. data/new_project_template/vendor/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.rb +0 -48
  1242. data/new_project_template/vendor/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.yml +0 -4
  1243. data/new_project_template/vendor/ceedling/plugins/stdout_pretty_tests_report/template.erb +0 -59
  1244. data/new_project_template/vendor/ceedling/plugins/warnings_report/warnings_report.rb +0 -71
  1245. data/new_project_template/vendor/ceedling/plugins/xml_tests_report/xml_tests_report.rb +0 -110
  1246. data/new_project_template/vendor/ceedling/release/build.info +0 -1
  1247. data/new_project_template/vendor/ceedling/release/version.info +0 -1
  1248. data/new_project_template/vendor/ceedling/vendor/c_exception/lib/CException.c +0 -39
  1249. data/new_project_template/vendor/ceedling/vendor/c_exception/lib/CException.h +0 -70
  1250. data/new_project_template/vendor/ceedling/vendor/c_exception/release/build.info +0 -1
  1251. data/new_project_template/vendor/ceedling/vendor/c_exception/release/version.info +0 -2
  1252. data/new_project_template/vendor/ceedling/vendor/cmock/config/production_environment.rb +0 -14
  1253. data/new_project_template/vendor/ceedling/vendor/cmock/config/test_environment.rb +0 -16
  1254. data/new_project_template/vendor/ceedling/vendor/cmock/lib/cmock.rb +0 -65
  1255. data/new_project_template/vendor/ceedling/vendor/cmock/lib/cmock_config.rb +0 -129
  1256. data/new_project_template/vendor/ceedling/vendor/cmock/lib/cmock_file_writer.rb +0 -33
  1257. data/new_project_template/vendor/ceedling/vendor/cmock/lib/cmock_generator.rb +0 -194
  1258. data/new_project_template/vendor/ceedling/vendor/cmock/lib/cmock_generator_plugin_array.rb +0 -57
  1259. data/new_project_template/vendor/ceedling/vendor/cmock/lib/cmock_generator_plugin_callback.rb +0 -78
  1260. data/new_project_template/vendor/ceedling/vendor/cmock/lib/cmock_generator_plugin_cexception.rb +0 -51
  1261. data/new_project_template/vendor/ceedling/vendor/cmock/lib/cmock_generator_plugin_expect.rb +0 -86
  1262. data/new_project_template/vendor/ceedling/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +0 -85
  1263. data/new_project_template/vendor/ceedling/vendor/cmock/lib/cmock_generator_utils.rb +0 -177
  1264. data/new_project_template/vendor/ceedling/vendor/cmock/lib/cmock_header_parser.rb +0 -273
  1265. data/new_project_template/vendor/ceedling/vendor/cmock/lib/cmock_plugin_manager.rb +0 -40
  1266. data/new_project_template/vendor/ceedling/vendor/cmock/lib/cmock_unityhelper_parser.rb +0 -74
  1267. data/new_project_template/vendor/ceedling/vendor/cmock/release/build.info +0 -1
  1268. data/new_project_template/vendor/ceedling/vendor/cmock/release/version.info +0 -2
  1269. data/new_project_template/vendor/ceedling/vendor/cmock/src/cmock.c +0 -186
  1270. data/new_project_template/vendor/ceedling/vendor/cmock/src/cmock.h +0 -30
  1271. data/new_project_template/vendor/ceedling/vendor/constructor/lib/constructor.rb +0 -127
  1272. data/new_project_template/vendor/ceedling/vendor/constructor/lib/constructor_struct.rb +0 -33
  1273. data/new_project_template/vendor/ceedling/vendor/deep_merge/lib/deep_merge.rb +0 -211
  1274. data/new_project_template/vendor/ceedling/vendor/diy/lib/diy/factory.rb +0 -36
  1275. data/new_project_template/vendor/ceedling/vendor/diy/lib/diy.rb +0 -403
  1276. data/new_project_template/vendor/ceedling/vendor/unity/auto/generate_test_runner.rb +0 -308
  1277. data/new_project_template/vendor/ceedling/vendor/unity/release/build.info +0 -1
  1278. data/new_project_template/vendor/ceedling/vendor/unity/release/version.info +0 -2
  1279. data/new_project_template/vendor/ceedling/vendor/unity/src/unity.c +0 -960
  1280. data/new_project_template/vendor/ceedling/vendor/unity/src/unity.h +0 -232
  1281. data/new_project_template/vendor/ceedling/vendor/unity/src/unity_internals.h +0 -414
  1282. /data/{new_project_template/vendor/ceedling/plugins/bullseye → plugins/bullseye/assets}/template.erb +0 -0
@@ -0,0 +1,4211 @@
1
+ //* ----------------------------------------------------------------------------
2
+ //* ATMEL Microcontroller Software Support - ROUSSET -
3
+ //* ----------------------------------------------------------------------------
4
+ //* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
5
+ //* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
6
+ //* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
7
+ //* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
8
+ //* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
+ //* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
10
+ //* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
11
+ //* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
12
+ //* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
13
+ //* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
+ //* ----------------------------------------------------------------------------
15
+ //* File Name : lib_AT91SAM7X256.h
16
+ //* Object : AT91SAM7X256 inlined functions
17
+ //* Generated : AT91 SW Application Group 01/16/2006 (16:36:21)
18
+ //*
19
+ //* CVS Reference : /lib_MC_SAM7X.h/1.1/Thu Mar 25 15:19:14 2004//
20
+ //* CVS Reference : /lib_pdc.h/1.2/Tue Jul 2 13:29:40 2002//
21
+ //* CVS Reference : /lib_dbgu.h/1.1/Thu Aug 25 12:56:22 2005//
22
+ //* CVS Reference : /lib_VREG_6085B.h/1.1/Tue Feb 1 16:20:47 2005//
23
+ //* CVS Reference : /lib_ssc.h/1.4/Fri Jan 31 12:19:20 2003//
24
+ //* CVS Reference : /lib_spi2.h/1.2/Tue Aug 23 15:37:28 2005//
25
+ //* CVS Reference : /lib_PWM_SAM.h/1.3/Thu Jan 22 10:10:50 2004//
26
+ //* CVS Reference : /lib_tc_1753b.h/1.1/Fri Jan 31 12:20:02 2003//
27
+ //* CVS Reference : /lib_pitc_6079A.h/1.2/Tue Nov 9 14:43:56 2004//
28
+ //* CVS Reference : /lib_adc.h/1.6/Fri Oct 17 09:12:38 2003//
29
+ //* CVS Reference : /lib_pmc_SAM7X.h/1.5/Fri Nov 4 09:41:32 2005//
30
+ //* CVS Reference : /lib_rstc_6098A.h/1.1/Wed Oct 6 10:39:20 2004//
31
+ //* CVS Reference : /lib_rttc_6081A.h/1.1/Wed Oct 6 10:39:38 2004//
32
+ //* CVS Reference : /lib_pio.h/1.3/Fri Jan 31 12:18:56 2003//
33
+ //* CVS Reference : /lib_twi.h/1.3/Mon Jul 19 14:27:58 2004//
34
+ //* CVS Reference : /lib_wdtc_6080A.h/1.1/Wed Oct 6 10:38:30 2004//
35
+ //* CVS Reference : /lib_usart.h/1.5/Thu Nov 21 16:01:54 2002//
36
+ //* CVS Reference : /lib_udp.h/1.5/Tue Aug 30 12:13:47 2005//
37
+ //* CVS Reference : /lib_aic_6075b.h/1.2/Thu Jul 7 07:48:22 2005//
38
+ //* CVS Reference : /lib_can_AT91.h/1.5/Tue Aug 23 15:37:07 2005//
39
+ //* ----------------------------------------------------------------------------
40
+
41
+ #ifndef lib_AT91SAM7X256_H
42
+ #define lib_AT91SAM7X256_H
43
+
44
+ /* *****************************************************************************
45
+ SOFTWARE API FOR AIC
46
+ ***************************************************************************** */
47
+ #define AT91C_AIC_BRANCH_OPCODE ((void (*) ()) 0xE51FFF20) // ldr, pc, [pc, #-&F20]
48
+
49
+ //*----------------------------------------------------------------------------
50
+ //* \fn AT91F_AIC_ConfigureIt
51
+ //* \brief Interrupt Handler Initialization
52
+ //*----------------------------------------------------------------------------
53
+ __inline unsigned int AT91F_AIC_ConfigureIt (
54
+ AT91PS_AIC pAic, // \arg pointer to the AIC registers
55
+ unsigned int irq_id, // \arg interrupt number to initialize
56
+ unsigned int priority, // \arg priority to give to the interrupt
57
+ unsigned int src_type, // \arg activation and sense of activation
58
+ void (*newHandler) () ) // \arg address of the interrupt handler
59
+ {
60
+ unsigned int oldHandler;
61
+ unsigned int mask ;
62
+
63
+ oldHandler = pAic->AIC_SVR[irq_id];
64
+
65
+ mask = 0x1 << irq_id ;
66
+ //* Disable the interrupt on the interrupt controller
67
+ pAic->AIC_IDCR = mask ;
68
+ //* Save the interrupt handler routine pointer and the interrupt priority
69
+ pAic->AIC_SVR[irq_id] = (unsigned int) newHandler ;
70
+ //* Store the Source Mode Register
71
+ pAic->AIC_SMR[irq_id] = src_type | priority ;
72
+ //* Clear the interrupt on the interrupt controller
73
+ pAic->AIC_ICCR = mask ;
74
+
75
+ return oldHandler;
76
+ }
77
+
78
+ //*----------------------------------------------------------------------------
79
+ //* \fn AT91F_AIC_EnableIt
80
+ //* \brief Enable corresponding IT number
81
+ //*----------------------------------------------------------------------------
82
+ __inline void AT91F_AIC_EnableIt (
83
+ AT91PS_AIC pAic, // \arg pointer to the AIC registers
84
+ unsigned int irq_id ) // \arg interrupt number to initialize
85
+ {
86
+ //* Enable the interrupt on the interrupt controller
87
+ pAic->AIC_IECR = 0x1 << irq_id ;
88
+ }
89
+
90
+ //*----------------------------------------------------------------------------
91
+ //* \fn AT91F_AIC_DisableIt
92
+ //* \brief Disable corresponding IT number
93
+ //*----------------------------------------------------------------------------
94
+ __inline void AT91F_AIC_DisableIt (
95
+ AT91PS_AIC pAic, // \arg pointer to the AIC registers
96
+ unsigned int irq_id ) // \arg interrupt number to initialize
97
+ {
98
+ unsigned int mask = 0x1 << irq_id;
99
+ //* Disable the interrupt on the interrupt controller
100
+ pAic->AIC_IDCR = mask ;
101
+ //* Clear the interrupt on the Interrupt Controller ( if one is pending )
102
+ pAic->AIC_ICCR = mask ;
103
+ }
104
+
105
+ //*----------------------------------------------------------------------------
106
+ //* \fn AT91F_AIC_ClearIt
107
+ //* \brief Clear corresponding IT number
108
+ //*----------------------------------------------------------------------------
109
+ __inline void AT91F_AIC_ClearIt (
110
+ AT91PS_AIC pAic, // \arg pointer to the AIC registers
111
+ unsigned int irq_id) // \arg interrupt number to initialize
112
+ {
113
+ //* Clear the interrupt on the Interrupt Controller ( if one is pending )
114
+ pAic->AIC_ICCR = (0x1 << irq_id);
115
+ }
116
+
117
+ //*----------------------------------------------------------------------------
118
+ //* \fn AT91F_AIC_AcknowledgeIt
119
+ //* \brief Acknowledge corresponding IT number
120
+ //*----------------------------------------------------------------------------
121
+ __inline void AT91F_AIC_AcknowledgeIt (
122
+ AT91PS_AIC pAic) // \arg pointer to the AIC registers
123
+ {
124
+ pAic->AIC_EOICR = pAic->AIC_EOICR;
125
+ }
126
+
127
+ //*----------------------------------------------------------------------------
128
+ //* \fn AT91F_AIC_SetExceptionVector
129
+ //* \brief Configure vector handler
130
+ //*----------------------------------------------------------------------------
131
+ __inline unsigned int AT91F_AIC_SetExceptionVector (
132
+ unsigned int *pVector, // \arg pointer to the AIC registers
133
+ void (*Handler) () ) // \arg Interrupt Handler
134
+ {
135
+ unsigned int oldVector = *pVector;
136
+
137
+ if ((unsigned int) Handler == (unsigned int) AT91C_AIC_BRANCH_OPCODE)
138
+ *pVector = (unsigned int) AT91C_AIC_BRANCH_OPCODE;
139
+ else
140
+ *pVector = (((((unsigned int) Handler) - ((unsigned int) pVector) - 0x8) >> 2) & 0x00FFFFFF) | 0xEA000000;
141
+
142
+ return oldVector;
143
+ }
144
+
145
+ //*----------------------------------------------------------------------------
146
+ //* \fn AT91F_AIC_Trig
147
+ //* \brief Trig an IT
148
+ //*----------------------------------------------------------------------------
149
+ __inline void AT91F_AIC_Trig (
150
+ AT91PS_AIC pAic, // \arg pointer to the AIC registers
151
+ unsigned int irq_id) // \arg interrupt number
152
+ {
153
+ pAic->AIC_ISCR = (0x1 << irq_id) ;
154
+ }
155
+
156
+ //*----------------------------------------------------------------------------
157
+ //* \fn AT91F_AIC_IsActive
158
+ //* \brief Test if an IT is active
159
+ //*----------------------------------------------------------------------------
160
+ __inline unsigned int AT91F_AIC_IsActive (
161
+ AT91PS_AIC pAic, // \arg pointer to the AIC registers
162
+ unsigned int irq_id) // \arg Interrupt Number
163
+ {
164
+ return (pAic->AIC_ISR & (0x1 << irq_id));
165
+ }
166
+
167
+ //*----------------------------------------------------------------------------
168
+ //* \fn AT91F_AIC_IsPending
169
+ //* \brief Test if an IT is pending
170
+ //*----------------------------------------------------------------------------
171
+ __inline unsigned int AT91F_AIC_IsPending (
172
+ AT91PS_AIC pAic, // \arg pointer to the AIC registers
173
+ unsigned int irq_id) // \arg Interrupt Number
174
+ {
175
+ return (pAic->AIC_IPR & (0x1 << irq_id));
176
+ }
177
+
178
+ //*----------------------------------------------------------------------------
179
+ //* \fn AT91F_AIC_Open
180
+ //* \brief Set exception vectors and AIC registers to default values
181
+ //*----------------------------------------------------------------------------
182
+ __inline void AT91F_AIC_Open(
183
+ AT91PS_AIC pAic, // \arg pointer to the AIC registers
184
+ void (*IrqHandler) (), // \arg Default IRQ vector exception
185
+ void (*FiqHandler) (), // \arg Default FIQ vector exception
186
+ void (*DefaultHandler) (), // \arg Default Handler set in ISR
187
+ void (*SpuriousHandler) (), // \arg Default Spurious Handler
188
+ unsigned int protectMode) // \arg Debug Control Register
189
+ {
190
+ int i;
191
+
192
+ // Disable all interrupts and set IVR to the default handler
193
+ for (i = 0; i < 32; ++i) {
194
+ AT91F_AIC_DisableIt(pAic, i);
195
+ AT91F_AIC_ConfigureIt(pAic, i, AT91C_AIC_PRIOR_LOWEST, AT91C_AIC_SRCTYPE_HIGH_LEVEL, DefaultHandler);
196
+ }
197
+
198
+ // Set the IRQ exception vector
199
+ AT91F_AIC_SetExceptionVector((unsigned int *) 0x18, IrqHandler);
200
+ // Set the Fast Interrupt exception vector
201
+ AT91F_AIC_SetExceptionVector((unsigned int *) 0x1C, FiqHandler);
202
+
203
+ pAic->AIC_SPU = (unsigned int) SpuriousHandler;
204
+ pAic->AIC_DCR = protectMode;
205
+ }
206
+ /* *****************************************************************************
207
+ SOFTWARE API FOR PDC
208
+ ***************************************************************************** */
209
+ //*----------------------------------------------------------------------------
210
+ //* \fn AT91F_PDC_SetNextRx
211
+ //* \brief Set the next receive transfer descriptor
212
+ //*----------------------------------------------------------------------------
213
+ __inline void AT91F_PDC_SetNextRx (
214
+ AT91PS_PDC pPDC, // \arg pointer to a PDC controller
215
+ char *address, // \arg address to the next bloc to be received
216
+ unsigned int bytes) // \arg number of bytes to be received
217
+ {
218
+ pPDC->PDC_RNPR = (unsigned int) address;
219
+ pPDC->PDC_RNCR = bytes;
220
+ }
221
+
222
+ //*----------------------------------------------------------------------------
223
+ //* \fn AT91F_PDC_SetNextTx
224
+ //* \brief Set the next transmit transfer descriptor
225
+ //*----------------------------------------------------------------------------
226
+ __inline void AT91F_PDC_SetNextTx (
227
+ AT91PS_PDC pPDC, // \arg pointer to a PDC controller
228
+ char *address, // \arg address to the next bloc to be transmitted
229
+ unsigned int bytes) // \arg number of bytes to be transmitted
230
+ {
231
+ pPDC->PDC_TNPR = (unsigned int) address;
232
+ pPDC->PDC_TNCR = bytes;
233
+ }
234
+
235
+ //*----------------------------------------------------------------------------
236
+ //* \fn AT91F_PDC_SetRx
237
+ //* \brief Set the receive transfer descriptor
238
+ //*----------------------------------------------------------------------------
239
+ __inline void AT91F_PDC_SetRx (
240
+ AT91PS_PDC pPDC, // \arg pointer to a PDC controller
241
+ char *address, // \arg address to the next bloc to be received
242
+ unsigned int bytes) // \arg number of bytes to be received
243
+ {
244
+ pPDC->PDC_RPR = (unsigned int) address;
245
+ pPDC->PDC_RCR = bytes;
246
+ }
247
+
248
+ //*----------------------------------------------------------------------------
249
+ //* \fn AT91F_PDC_SetTx
250
+ //* \brief Set the transmit transfer descriptor
251
+ //*----------------------------------------------------------------------------
252
+ __inline void AT91F_PDC_SetTx (
253
+ AT91PS_PDC pPDC, // \arg pointer to a PDC controller
254
+ char *address, // \arg address to the next bloc to be transmitted
255
+ unsigned int bytes) // \arg number of bytes to be transmitted
256
+ {
257
+ pPDC->PDC_TPR = (unsigned int) address;
258
+ pPDC->PDC_TCR = bytes;
259
+ }
260
+
261
+ //*----------------------------------------------------------------------------
262
+ //* \fn AT91F_PDC_EnableTx
263
+ //* \brief Enable transmit
264
+ //*----------------------------------------------------------------------------
265
+ __inline void AT91F_PDC_EnableTx (
266
+ AT91PS_PDC pPDC ) // \arg pointer to a PDC controller
267
+ {
268
+ pPDC->PDC_PTCR = AT91C_PDC_TXTEN;
269
+ }
270
+
271
+ //*----------------------------------------------------------------------------
272
+ //* \fn AT91F_PDC_EnableRx
273
+ //* \brief Enable receive
274
+ //*----------------------------------------------------------------------------
275
+ __inline void AT91F_PDC_EnableRx (
276
+ AT91PS_PDC pPDC ) // \arg pointer to a PDC controller
277
+ {
278
+ pPDC->PDC_PTCR = AT91C_PDC_RXTEN;
279
+ }
280
+
281
+ //*----------------------------------------------------------------------------
282
+ //* \fn AT91F_PDC_DisableTx
283
+ //* \brief Disable transmit
284
+ //*----------------------------------------------------------------------------
285
+ __inline void AT91F_PDC_DisableTx (
286
+ AT91PS_PDC pPDC ) // \arg pointer to a PDC controller
287
+ {
288
+ pPDC->PDC_PTCR = AT91C_PDC_TXTDIS;
289
+ }
290
+
291
+ //*----------------------------------------------------------------------------
292
+ //* \fn AT91F_PDC_DisableRx
293
+ //* \brief Disable receive
294
+ //*----------------------------------------------------------------------------
295
+ __inline void AT91F_PDC_DisableRx (
296
+ AT91PS_PDC pPDC ) // \arg pointer to a PDC controller
297
+ {
298
+ pPDC->PDC_PTCR = AT91C_PDC_RXTDIS;
299
+ }
300
+
301
+ //*----------------------------------------------------------------------------
302
+ //* \fn AT91F_PDC_IsTxEmpty
303
+ //* \brief Test if the current transfer descriptor has been sent
304
+ //*----------------------------------------------------------------------------
305
+ __inline int AT91F_PDC_IsTxEmpty ( // \return return 1 if transfer is complete
306
+ AT91PS_PDC pPDC ) // \arg pointer to a PDC controller
307
+ {
308
+ return !(pPDC->PDC_TCR);
309
+ }
310
+
311
+ //*----------------------------------------------------------------------------
312
+ //* \fn AT91F_PDC_IsNextTxEmpty
313
+ //* \brief Test if the next transfer descriptor has been moved to the current td
314
+ //*----------------------------------------------------------------------------
315
+ __inline int AT91F_PDC_IsNextTxEmpty ( // \return return 1 if transfer is complete
316
+ AT91PS_PDC pPDC ) // \arg pointer to a PDC controller
317
+ {
318
+ return !(pPDC->PDC_TNCR);
319
+ }
320
+
321
+ //*----------------------------------------------------------------------------
322
+ //* \fn AT91F_PDC_IsRxEmpty
323
+ //* \brief Test if the current transfer descriptor has been filled
324
+ //*----------------------------------------------------------------------------
325
+ __inline int AT91F_PDC_IsRxEmpty ( // \return return 1 if transfer is complete
326
+ AT91PS_PDC pPDC ) // \arg pointer to a PDC controller
327
+ {
328
+ return !(pPDC->PDC_RCR);
329
+ }
330
+
331
+ //*----------------------------------------------------------------------------
332
+ //* \fn AT91F_PDC_IsNextRxEmpty
333
+ //* \brief Test if the next transfer descriptor has been moved to the current td
334
+ //*----------------------------------------------------------------------------
335
+ __inline int AT91F_PDC_IsNextRxEmpty ( // \return return 1 if transfer is complete
336
+ AT91PS_PDC pPDC ) // \arg pointer to a PDC controller
337
+ {
338
+ return !(pPDC->PDC_RNCR);
339
+ }
340
+
341
+ //*----------------------------------------------------------------------------
342
+ //* \fn AT91F_PDC_Open
343
+ //* \brief Open PDC: disable TX and RX reset transfer descriptors, re-enable RX and TX
344
+ //*----------------------------------------------------------------------------
345
+ __inline void AT91F_PDC_Open (
346
+ AT91PS_PDC pPDC) // \arg pointer to a PDC controller
347
+ {
348
+ //* Disable the RX and TX PDC transfer requests
349
+ AT91F_PDC_DisableRx(pPDC);
350
+ AT91F_PDC_DisableTx(pPDC);
351
+
352
+ //* Reset all Counter register Next buffer first
353
+ AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0);
354
+ AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0);
355
+ AT91F_PDC_SetTx(pPDC, (char *) 0, 0);
356
+ AT91F_PDC_SetRx(pPDC, (char *) 0, 0);
357
+
358
+ //* Enable the RX and TX PDC transfer requests
359
+ AT91F_PDC_EnableRx(pPDC);
360
+ AT91F_PDC_EnableTx(pPDC);
361
+ }
362
+
363
+ //*----------------------------------------------------------------------------
364
+ //* \fn AT91F_PDC_Close
365
+ //* \brief Close PDC: disable TX and RX reset transfer descriptors
366
+ //*----------------------------------------------------------------------------
367
+ __inline void AT91F_PDC_Close (
368
+ AT91PS_PDC pPDC) // \arg pointer to a PDC controller
369
+ {
370
+ //* Disable the RX and TX PDC transfer requests
371
+ AT91F_PDC_DisableRx(pPDC);
372
+ AT91F_PDC_DisableTx(pPDC);
373
+
374
+ //* Reset all Counter register Next buffer first
375
+ AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0);
376
+ AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0);
377
+ AT91F_PDC_SetTx(pPDC, (char *) 0, 0);
378
+ AT91F_PDC_SetRx(pPDC, (char *) 0, 0);
379
+
380
+ }
381
+
382
+ //*----------------------------------------------------------------------------
383
+ //* \fn AT91F_PDC_SendFrame
384
+ //* \brief Close PDC: disable TX and RX reset transfer descriptors
385
+ //*----------------------------------------------------------------------------
386
+ __inline unsigned int AT91F_PDC_SendFrame(
387
+ AT91PS_PDC pPDC,
388
+ char *pBuffer,
389
+ unsigned int szBuffer,
390
+ char *pNextBuffer,
391
+ unsigned int szNextBuffer )
392
+ {
393
+ if (AT91F_PDC_IsTxEmpty(pPDC)) {
394
+ //* Buffer and next buffer can be initialized
395
+ AT91F_PDC_SetTx(pPDC, pBuffer, szBuffer);
396
+ AT91F_PDC_SetNextTx(pPDC, pNextBuffer, szNextBuffer);
397
+ return 2;
398
+ }
399
+ else if (AT91F_PDC_IsNextTxEmpty(pPDC)) {
400
+ //* Only one buffer can be initialized
401
+ AT91F_PDC_SetNextTx(pPDC, pBuffer, szBuffer);
402
+ return 1;
403
+ }
404
+ else {
405
+ //* All buffer are in use...
406
+ return 0;
407
+ }
408
+ }
409
+
410
+ //*----------------------------------------------------------------------------
411
+ //* \fn AT91F_PDC_ReceiveFrame
412
+ //* \brief Close PDC: disable TX and RX reset transfer descriptors
413
+ //*----------------------------------------------------------------------------
414
+ __inline unsigned int AT91F_PDC_ReceiveFrame (
415
+ AT91PS_PDC pPDC,
416
+ char *pBuffer,
417
+ unsigned int szBuffer,
418
+ char *pNextBuffer,
419
+ unsigned int szNextBuffer )
420
+ {
421
+ if (AT91F_PDC_IsRxEmpty(pPDC)) {
422
+ //* Buffer and next buffer can be initialized
423
+ AT91F_PDC_SetRx(pPDC, pBuffer, szBuffer);
424
+ AT91F_PDC_SetNextRx(pPDC, pNextBuffer, szNextBuffer);
425
+ return 2;
426
+ }
427
+ else if (AT91F_PDC_IsNextRxEmpty(pPDC)) {
428
+ //* Only one buffer can be initialized
429
+ AT91F_PDC_SetNextRx(pPDC, pBuffer, szBuffer);
430
+ return 1;
431
+ }
432
+ else {
433
+ //* All buffer are in use...
434
+ return 0;
435
+ }
436
+ }
437
+ /* *****************************************************************************
438
+ SOFTWARE API FOR DBGU
439
+ ***************************************************************************** */
440
+ //*----------------------------------------------------------------------------
441
+ //* \fn AT91F_DBGU_InterruptEnable
442
+ //* \brief Enable DBGU Interrupt
443
+ //*----------------------------------------------------------------------------
444
+ __inline void AT91F_DBGU_InterruptEnable(
445
+ AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller
446
+ unsigned int flag) // \arg dbgu interrupt to be enabled
447
+ {
448
+ pDbgu->DBGU_IER = flag;
449
+ }
450
+
451
+ //*----------------------------------------------------------------------------
452
+ //* \fn AT91F_DBGU_InterruptDisable
453
+ //* \brief Disable DBGU Interrupt
454
+ //*----------------------------------------------------------------------------
455
+ __inline void AT91F_DBGU_InterruptDisable(
456
+ AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller
457
+ unsigned int flag) // \arg dbgu interrupt to be disabled
458
+ {
459
+ pDbgu->DBGU_IDR = flag;
460
+ }
461
+
462
+ //*----------------------------------------------------------------------------
463
+ //* \fn AT91F_DBGU_GetInterruptMaskStatus
464
+ //* \brief Return DBGU Interrupt Mask Status
465
+ //*----------------------------------------------------------------------------
466
+ __inline unsigned int AT91F_DBGU_GetInterruptMaskStatus( // \return DBGU Interrupt Mask Status
467
+ AT91PS_DBGU pDbgu) // \arg pointer to a DBGU controller
468
+ {
469
+ return pDbgu->DBGU_IMR;
470
+ }
471
+
472
+ //*----------------------------------------------------------------------------
473
+ //* \fn AT91F_DBGU_IsInterruptMasked
474
+ //* \brief Test if DBGU Interrupt is Masked
475
+ //*----------------------------------------------------------------------------
476
+ __inline int AT91F_DBGU_IsInterruptMasked(
477
+ AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller
478
+ unsigned int flag) // \arg flag to be tested
479
+ {
480
+ return (AT91F_DBGU_GetInterruptMaskStatus(pDbgu) & flag);
481
+ }
482
+
483
+ /* *****************************************************************************
484
+ SOFTWARE API FOR PIO
485
+ ***************************************************************************** */
486
+ //*----------------------------------------------------------------------------
487
+ //* \fn AT91F_PIO_CfgPeriph
488
+ //* \brief Enable pins to be drived by peripheral
489
+ //*----------------------------------------------------------------------------
490
+ __inline void AT91F_PIO_CfgPeriph(
491
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
492
+ unsigned int periphAEnable, // \arg PERIPH A to enable
493
+ unsigned int periphBEnable) // \arg PERIPH B to enable
494
+
495
+ {
496
+ pPio->PIO_ASR = periphAEnable;
497
+ pPio->PIO_BSR = periphBEnable;
498
+ pPio->PIO_PDR = (periphAEnable | periphBEnable); // Set in Periph mode
499
+ }
500
+
501
+ //*----------------------------------------------------------------------------
502
+ //* \fn AT91F_PIO_CfgOutput
503
+ //* \brief Enable PIO in output mode
504
+ //*----------------------------------------------------------------------------
505
+ __inline void AT91F_PIO_CfgOutput(
506
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
507
+ unsigned int pioEnable) // \arg PIO to be enabled
508
+ {
509
+ pPio->PIO_PER = pioEnable; // Set in PIO mode
510
+ pPio->PIO_OER = pioEnable; // Configure in Output
511
+ }
512
+
513
+ //*----------------------------------------------------------------------------
514
+ //* \fn AT91F_PIO_CfgInput
515
+ //* \brief Enable PIO in input mode
516
+ //*----------------------------------------------------------------------------
517
+ __inline void AT91F_PIO_CfgInput(
518
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
519
+ unsigned int inputEnable) // \arg PIO to be enabled
520
+ {
521
+ // Disable output
522
+ pPio->PIO_ODR = inputEnable;
523
+ pPio->PIO_PER = inputEnable;
524
+ }
525
+
526
+ //*----------------------------------------------------------------------------
527
+ //* \fn AT91F_PIO_CfgOpendrain
528
+ //* \brief Configure PIO in open drain
529
+ //*----------------------------------------------------------------------------
530
+ __inline void AT91F_PIO_CfgOpendrain(
531
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
532
+ unsigned int multiDrvEnable) // \arg pio to be configured in open drain
533
+ {
534
+ // Configure the multi-drive option
535
+ pPio->PIO_MDDR = ~multiDrvEnable;
536
+ pPio->PIO_MDER = multiDrvEnable;
537
+ }
538
+
539
+ //*----------------------------------------------------------------------------
540
+ //* \fn AT91F_PIO_CfgPullup
541
+ //* \brief Enable pullup on PIO
542
+ //*----------------------------------------------------------------------------
543
+ __inline void AT91F_PIO_CfgPullup(
544
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
545
+ unsigned int pullupEnable) // \arg enable pullup on PIO
546
+ {
547
+ // Connect or not Pullup
548
+ pPio->PIO_PPUDR = ~pullupEnable;
549
+ pPio->PIO_PPUER = pullupEnable;
550
+ }
551
+
552
+ //*----------------------------------------------------------------------------
553
+ //* \fn AT91F_PIO_CfgDirectDrive
554
+ //* \brief Enable direct drive on PIO
555
+ //*----------------------------------------------------------------------------
556
+ __inline void AT91F_PIO_CfgDirectDrive(
557
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
558
+ unsigned int directDrive) // \arg PIO to be configured with direct drive
559
+
560
+ {
561
+ // Configure the Direct Drive
562
+ pPio->PIO_OWDR = ~directDrive;
563
+ pPio->PIO_OWER = directDrive;
564
+ }
565
+
566
+ //*----------------------------------------------------------------------------
567
+ //* \fn AT91F_PIO_CfgInputFilter
568
+ //* \brief Enable input filter on input PIO
569
+ //*----------------------------------------------------------------------------
570
+ __inline void AT91F_PIO_CfgInputFilter(
571
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
572
+ unsigned int inputFilter) // \arg PIO to be configured with input filter
573
+
574
+ {
575
+ // Configure the Direct Drive
576
+ pPio->PIO_IFDR = ~inputFilter;
577
+ pPio->PIO_IFER = inputFilter;
578
+ }
579
+
580
+ //*----------------------------------------------------------------------------
581
+ //* \fn AT91F_PIO_GetInput
582
+ //* \brief Return PIO input value
583
+ //*----------------------------------------------------------------------------
584
+ __inline unsigned int AT91F_PIO_GetInput( // \return PIO input
585
+ AT91PS_PIO pPio) // \arg pointer to a PIO controller
586
+ {
587
+ return pPio->PIO_PDSR;
588
+ }
589
+
590
+ //*----------------------------------------------------------------------------
591
+ //* \fn AT91F_PIO_IsInputSet
592
+ //* \brief Test if PIO is input flag is active
593
+ //*----------------------------------------------------------------------------
594
+ __inline int AT91F_PIO_IsInputSet(
595
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
596
+ unsigned int flag) // \arg flag to be tested
597
+ {
598
+ return (AT91F_PIO_GetInput(pPio) & flag);
599
+ }
600
+
601
+
602
+ //*----------------------------------------------------------------------------
603
+ //* \fn AT91F_PIO_SetOutput
604
+ //* \brief Set to 1 output PIO
605
+ //*----------------------------------------------------------------------------
606
+ __inline void AT91F_PIO_SetOutput(
607
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
608
+ unsigned int flag) // \arg output to be set
609
+ {
610
+ pPio->PIO_SODR = flag;
611
+ }
612
+
613
+ //*----------------------------------------------------------------------------
614
+ //* \fn AT91F_PIO_ClearOutput
615
+ //* \brief Set to 0 output PIO
616
+ //*----------------------------------------------------------------------------
617
+ __inline void AT91F_PIO_ClearOutput(
618
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
619
+ unsigned int flag) // \arg output to be cleared
620
+ {
621
+ pPio->PIO_CODR = flag;
622
+ }
623
+
624
+ //*----------------------------------------------------------------------------
625
+ //* \fn AT91F_PIO_ForceOutput
626
+ //* \brief Force output when Direct drive option is enabled
627
+ //*----------------------------------------------------------------------------
628
+ __inline void AT91F_PIO_ForceOutput(
629
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
630
+ unsigned int flag) // \arg output to be forced
631
+ {
632
+ pPio->PIO_ODSR = flag;
633
+ }
634
+
635
+ //*----------------------------------------------------------------------------
636
+ //* \fn AT91F_PIO_Enable
637
+ //* \brief Enable PIO
638
+ //*----------------------------------------------------------------------------
639
+ __inline void AT91F_PIO_Enable(
640
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
641
+ unsigned int flag) // \arg pio to be enabled
642
+ {
643
+ pPio->PIO_PER = flag;
644
+ }
645
+
646
+ //*----------------------------------------------------------------------------
647
+ //* \fn AT91F_PIO_Disable
648
+ //* \brief Disable PIO
649
+ //*----------------------------------------------------------------------------
650
+ __inline void AT91F_PIO_Disable(
651
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
652
+ unsigned int flag) // \arg pio to be disabled
653
+ {
654
+ pPio->PIO_PDR = flag;
655
+ }
656
+
657
+ //*----------------------------------------------------------------------------
658
+ //* \fn AT91F_PIO_GetStatus
659
+ //* \brief Return PIO Status
660
+ //*----------------------------------------------------------------------------
661
+ __inline unsigned int AT91F_PIO_GetStatus( // \return PIO Status
662
+ AT91PS_PIO pPio) // \arg pointer to a PIO controller
663
+ {
664
+ return pPio->PIO_PSR;
665
+ }
666
+
667
+ //*----------------------------------------------------------------------------
668
+ //* \fn AT91F_PIO_IsSet
669
+ //* \brief Test if PIO is Set
670
+ //*----------------------------------------------------------------------------
671
+ __inline int AT91F_PIO_IsSet(
672
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
673
+ unsigned int flag) // \arg flag to be tested
674
+ {
675
+ return (AT91F_PIO_GetStatus(pPio) & flag);
676
+ }
677
+
678
+ //*----------------------------------------------------------------------------
679
+ //* \fn AT91F_PIO_OutputEnable
680
+ //* \brief Output Enable PIO
681
+ //*----------------------------------------------------------------------------
682
+ __inline void AT91F_PIO_OutputEnable(
683
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
684
+ unsigned int flag) // \arg pio output to be enabled
685
+ {
686
+ pPio->PIO_OER = flag;
687
+ }
688
+
689
+ //*----------------------------------------------------------------------------
690
+ //* \fn AT91F_PIO_OutputDisable
691
+ //* \brief Output Enable PIO
692
+ //*----------------------------------------------------------------------------
693
+ __inline void AT91F_PIO_OutputDisable(
694
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
695
+ unsigned int flag) // \arg pio output to be disabled
696
+ {
697
+ pPio->PIO_ODR = flag;
698
+ }
699
+
700
+ //*----------------------------------------------------------------------------
701
+ //* \fn AT91F_PIO_GetOutputStatus
702
+ //* \brief Return PIO Output Status
703
+ //*----------------------------------------------------------------------------
704
+ __inline unsigned int AT91F_PIO_GetOutputStatus( // \return PIO Output Status
705
+ AT91PS_PIO pPio) // \arg pointer to a PIO controller
706
+ {
707
+ return pPio->PIO_OSR;
708
+ }
709
+
710
+ //*----------------------------------------------------------------------------
711
+ //* \fn AT91F_PIO_IsOuputSet
712
+ //* \brief Test if PIO Output is Set
713
+ //*----------------------------------------------------------------------------
714
+ __inline int AT91F_PIO_IsOutputSet(
715
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
716
+ unsigned int flag) // \arg flag to be tested
717
+ {
718
+ return (AT91F_PIO_GetOutputStatus(pPio) & flag);
719
+ }
720
+
721
+ //*----------------------------------------------------------------------------
722
+ //* \fn AT91F_PIO_InputFilterEnable
723
+ //* \brief Input Filter Enable PIO
724
+ //*----------------------------------------------------------------------------
725
+ __inline void AT91F_PIO_InputFilterEnable(
726
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
727
+ unsigned int flag) // \arg pio input filter to be enabled
728
+ {
729
+ pPio->PIO_IFER = flag;
730
+ }
731
+
732
+ //*----------------------------------------------------------------------------
733
+ //* \fn AT91F_PIO_InputFilterDisable
734
+ //* \brief Input Filter Disable PIO
735
+ //*----------------------------------------------------------------------------
736
+ __inline void AT91F_PIO_InputFilterDisable(
737
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
738
+ unsigned int flag) // \arg pio input filter to be disabled
739
+ {
740
+ pPio->PIO_IFDR = flag;
741
+ }
742
+
743
+ //*----------------------------------------------------------------------------
744
+ //* \fn AT91F_PIO_GetInputFilterStatus
745
+ //* \brief Return PIO Input Filter Status
746
+ //*----------------------------------------------------------------------------
747
+ __inline unsigned int AT91F_PIO_GetInputFilterStatus( // \return PIO Input Filter Status
748
+ AT91PS_PIO pPio) // \arg pointer to a PIO controller
749
+ {
750
+ return pPio->PIO_IFSR;
751
+ }
752
+
753
+ //*----------------------------------------------------------------------------
754
+ //* \fn AT91F_PIO_IsInputFilterSet
755
+ //* \brief Test if PIO Input filter is Set
756
+ //*----------------------------------------------------------------------------
757
+ __inline int AT91F_PIO_IsInputFilterSet(
758
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
759
+ unsigned int flag) // \arg flag to be tested
760
+ {
761
+ return (AT91F_PIO_GetInputFilterStatus(pPio) & flag);
762
+ }
763
+
764
+ //*----------------------------------------------------------------------------
765
+ //* \fn AT91F_PIO_GetOutputDataStatus
766
+ //* \brief Return PIO Output Data Status
767
+ //*----------------------------------------------------------------------------
768
+ __inline unsigned int AT91F_PIO_GetOutputDataStatus( // \return PIO Output Data Status
769
+ AT91PS_PIO pPio) // \arg pointer to a PIO controller
770
+ {
771
+ return pPio->PIO_ODSR;
772
+ }
773
+
774
+ //*----------------------------------------------------------------------------
775
+ //* \fn AT91F_PIO_InterruptEnable
776
+ //* \brief Enable PIO Interrupt
777
+ //*----------------------------------------------------------------------------
778
+ __inline void AT91F_PIO_InterruptEnable(
779
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
780
+ unsigned int flag) // \arg pio interrupt to be enabled
781
+ {
782
+ pPio->PIO_IER = flag;
783
+ }
784
+
785
+ //*----------------------------------------------------------------------------
786
+ //* \fn AT91F_PIO_InterruptDisable
787
+ //* \brief Disable PIO Interrupt
788
+ //*----------------------------------------------------------------------------
789
+ __inline void AT91F_PIO_InterruptDisable(
790
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
791
+ unsigned int flag) // \arg pio interrupt to be disabled
792
+ {
793
+ pPio->PIO_IDR = flag;
794
+ }
795
+
796
+ //*----------------------------------------------------------------------------
797
+ //* \fn AT91F_PIO_GetInterruptMaskStatus
798
+ //* \brief Return PIO Interrupt Mask Status
799
+ //*----------------------------------------------------------------------------
800
+ __inline unsigned int AT91F_PIO_GetInterruptMaskStatus( // \return PIO Interrupt Mask Status
801
+ AT91PS_PIO pPio) // \arg pointer to a PIO controller
802
+ {
803
+ return pPio->PIO_IMR;
804
+ }
805
+
806
+ //*----------------------------------------------------------------------------
807
+ //* \fn AT91F_PIO_GetInterruptStatus
808
+ //* \brief Return PIO Interrupt Status
809
+ //*----------------------------------------------------------------------------
810
+ __inline unsigned int AT91F_PIO_GetInterruptStatus( // \return PIO Interrupt Status
811
+ AT91PS_PIO pPio) // \arg pointer to a PIO controller
812
+ {
813
+ return pPio->PIO_ISR;
814
+ }
815
+
816
+ //*----------------------------------------------------------------------------
817
+ //* \fn AT91F_PIO_IsInterruptMasked
818
+ //* \brief Test if PIO Interrupt is Masked
819
+ //*----------------------------------------------------------------------------
820
+ __inline int AT91F_PIO_IsInterruptMasked(
821
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
822
+ unsigned int flag) // \arg flag to be tested
823
+ {
824
+ return (AT91F_PIO_GetInterruptMaskStatus(pPio) & flag);
825
+ }
826
+
827
+ //*----------------------------------------------------------------------------
828
+ //* \fn AT91F_PIO_IsInterruptSet
829
+ //* \brief Test if PIO Interrupt is Set
830
+ //*----------------------------------------------------------------------------
831
+ __inline int AT91F_PIO_IsInterruptSet(
832
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
833
+ unsigned int flag) // \arg flag to be tested
834
+ {
835
+ return (AT91F_PIO_GetInterruptStatus(pPio) & flag);
836
+ }
837
+
838
+ //*----------------------------------------------------------------------------
839
+ //* \fn AT91F_PIO_MultiDriverEnable
840
+ //* \brief Multi Driver Enable PIO
841
+ //*----------------------------------------------------------------------------
842
+ __inline void AT91F_PIO_MultiDriverEnable(
843
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
844
+ unsigned int flag) // \arg pio to be enabled
845
+ {
846
+ pPio->PIO_MDER = flag;
847
+ }
848
+
849
+ //*----------------------------------------------------------------------------
850
+ //* \fn AT91F_PIO_MultiDriverDisable
851
+ //* \brief Multi Driver Disable PIO
852
+ //*----------------------------------------------------------------------------
853
+ __inline void AT91F_PIO_MultiDriverDisable(
854
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
855
+ unsigned int flag) // \arg pio to be disabled
856
+ {
857
+ pPio->PIO_MDDR = flag;
858
+ }
859
+
860
+ //*----------------------------------------------------------------------------
861
+ //* \fn AT91F_PIO_GetMultiDriverStatus
862
+ //* \brief Return PIO Multi Driver Status
863
+ //*----------------------------------------------------------------------------
864
+ __inline unsigned int AT91F_PIO_GetMultiDriverStatus( // \return PIO Multi Driver Status
865
+ AT91PS_PIO pPio) // \arg pointer to a PIO controller
866
+ {
867
+ return pPio->PIO_MDSR;
868
+ }
869
+
870
+ //*----------------------------------------------------------------------------
871
+ //* \fn AT91F_PIO_IsMultiDriverSet
872
+ //* \brief Test if PIO MultiDriver is Set
873
+ //*----------------------------------------------------------------------------
874
+ __inline int AT91F_PIO_IsMultiDriverSet(
875
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
876
+ unsigned int flag) // \arg flag to be tested
877
+ {
878
+ return (AT91F_PIO_GetMultiDriverStatus(pPio) & flag);
879
+ }
880
+
881
+ //*----------------------------------------------------------------------------
882
+ //* \fn AT91F_PIO_A_RegisterSelection
883
+ //* \brief PIO A Register Selection
884
+ //*----------------------------------------------------------------------------
885
+ __inline void AT91F_PIO_A_RegisterSelection(
886
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
887
+ unsigned int flag) // \arg pio A register selection
888
+ {
889
+ pPio->PIO_ASR = flag;
890
+ }
891
+
892
+ //*----------------------------------------------------------------------------
893
+ //* \fn AT91F_PIO_B_RegisterSelection
894
+ //* \brief PIO B Register Selection
895
+ //*----------------------------------------------------------------------------
896
+ __inline void AT91F_PIO_B_RegisterSelection(
897
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
898
+ unsigned int flag) // \arg pio B register selection
899
+ {
900
+ pPio->PIO_BSR = flag;
901
+ }
902
+
903
+ //*----------------------------------------------------------------------------
904
+ //* \fn AT91F_PIO_Get_AB_RegisterStatus
905
+ //* \brief Return PIO Interrupt Status
906
+ //*----------------------------------------------------------------------------
907
+ __inline unsigned int AT91F_PIO_Get_AB_RegisterStatus( // \return PIO AB Register Status
908
+ AT91PS_PIO pPio) // \arg pointer to a PIO controller
909
+ {
910
+ return pPio->PIO_ABSR;
911
+ }
912
+
913
+ //*----------------------------------------------------------------------------
914
+ //* \fn AT91F_PIO_IsAB_RegisterSet
915
+ //* \brief Test if PIO AB Register is Set
916
+ //*----------------------------------------------------------------------------
917
+ __inline int AT91F_PIO_IsAB_RegisterSet(
918
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
919
+ unsigned int flag) // \arg flag to be tested
920
+ {
921
+ return (AT91F_PIO_Get_AB_RegisterStatus(pPio) & flag);
922
+ }
923
+
924
+ //*----------------------------------------------------------------------------
925
+ //* \fn AT91F_PIO_OutputWriteEnable
926
+ //* \brief Output Write Enable PIO
927
+ //*----------------------------------------------------------------------------
928
+ __inline void AT91F_PIO_OutputWriteEnable(
929
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
930
+ unsigned int flag) // \arg pio output write to be enabled
931
+ {
932
+ pPio->PIO_OWER = flag;
933
+ }
934
+
935
+ //*----------------------------------------------------------------------------
936
+ //* \fn AT91F_PIO_OutputWriteDisable
937
+ //* \brief Output Write Disable PIO
938
+ //*----------------------------------------------------------------------------
939
+ __inline void AT91F_PIO_OutputWriteDisable(
940
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
941
+ unsigned int flag) // \arg pio output write to be disabled
942
+ {
943
+ pPio->PIO_OWDR = flag;
944
+ }
945
+
946
+ //*----------------------------------------------------------------------------
947
+ //* \fn AT91F_PIO_GetOutputWriteStatus
948
+ //* \brief Return PIO Output Write Status
949
+ //*----------------------------------------------------------------------------
950
+ __inline unsigned int AT91F_PIO_GetOutputWriteStatus( // \return PIO Output Write Status
951
+ AT91PS_PIO pPio) // \arg pointer to a PIO controller
952
+ {
953
+ return pPio->PIO_OWSR;
954
+ }
955
+
956
+ //*----------------------------------------------------------------------------
957
+ //* \fn AT91F_PIO_IsOutputWriteSet
958
+ //* \brief Test if PIO OutputWrite is Set
959
+ //*----------------------------------------------------------------------------
960
+ __inline int AT91F_PIO_IsOutputWriteSet(
961
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
962
+ unsigned int flag) // \arg flag to be tested
963
+ {
964
+ return (AT91F_PIO_GetOutputWriteStatus(pPio) & flag);
965
+ }
966
+
967
+ //*----------------------------------------------------------------------------
968
+ //* \fn AT91F_PIO_GetCfgPullup
969
+ //* \brief Return PIO Configuration Pullup
970
+ //*----------------------------------------------------------------------------
971
+ __inline unsigned int AT91F_PIO_GetCfgPullup( // \return PIO Configuration Pullup
972
+ AT91PS_PIO pPio) // \arg pointer to a PIO controller
973
+ {
974
+ return pPio->PIO_PPUSR;
975
+ }
976
+
977
+ //*----------------------------------------------------------------------------
978
+ //* \fn AT91F_PIO_IsOutputDataStatusSet
979
+ //* \brief Test if PIO Output Data Status is Set
980
+ //*----------------------------------------------------------------------------
981
+ __inline int AT91F_PIO_IsOutputDataStatusSet(
982
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
983
+ unsigned int flag) // \arg flag to be tested
984
+ {
985
+ return (AT91F_PIO_GetOutputDataStatus(pPio) & flag);
986
+ }
987
+
988
+ //*----------------------------------------------------------------------------
989
+ //* \fn AT91F_PIO_IsCfgPullupStatusSet
990
+ //* \brief Test if PIO Configuration Pullup Status is Set
991
+ //*----------------------------------------------------------------------------
992
+ __inline int AT91F_PIO_IsCfgPullupStatusSet(
993
+ AT91PS_PIO pPio, // \arg pointer to a PIO controller
994
+ unsigned int flag) // \arg flag to be tested
995
+ {
996
+ return (~AT91F_PIO_GetCfgPullup(pPio) & flag);
997
+ }
998
+
999
+ /* *****************************************************************************
1000
+ SOFTWARE API FOR PMC
1001
+ ***************************************************************************** */
1002
+ //*----------------------------------------------------------------------------
1003
+ //* \fn AT91F_PMC_CfgSysClkEnableReg
1004
+ //* \brief Configure the System Clock Enable Register of the PMC controller
1005
+ //*----------------------------------------------------------------------------
1006
+ __inline void AT91F_PMC_CfgSysClkEnableReg (
1007
+ AT91PS_PMC pPMC, // \arg pointer to PMC controller
1008
+ unsigned int mode)
1009
+ {
1010
+ //* Write to the SCER register
1011
+ pPMC->PMC_SCER = mode;
1012
+ }
1013
+
1014
+ //*----------------------------------------------------------------------------
1015
+ //* \fn AT91F_PMC_CfgSysClkDisableReg
1016
+ //* \brief Configure the System Clock Disable Register of the PMC controller
1017
+ //*----------------------------------------------------------------------------
1018
+ __inline void AT91F_PMC_CfgSysClkDisableReg (
1019
+ AT91PS_PMC pPMC, // \arg pointer to PMC controller
1020
+ unsigned int mode)
1021
+ {
1022
+ //* Write to the SCDR register
1023
+ pPMC->PMC_SCDR = mode;
1024
+ }
1025
+
1026
+ //*----------------------------------------------------------------------------
1027
+ //* \fn AT91F_PMC_GetSysClkStatusReg
1028
+ //* \brief Return the System Clock Status Register of the PMC controller
1029
+ //*----------------------------------------------------------------------------
1030
+ __inline unsigned int AT91F_PMC_GetSysClkStatusReg (
1031
+ AT91PS_PMC pPMC // pointer to a CAN controller
1032
+ )
1033
+ {
1034
+ return pPMC->PMC_SCSR;
1035
+ }
1036
+
1037
+ //*----------------------------------------------------------------------------
1038
+ //* \fn AT91F_PMC_EnablePeriphClock
1039
+ //* \brief Enable peripheral clock
1040
+ //*----------------------------------------------------------------------------
1041
+ __inline void AT91F_PMC_EnablePeriphClock (
1042
+ AT91PS_PMC pPMC, // \arg pointer to PMC controller
1043
+ unsigned int periphIds) // \arg IDs of peripherals
1044
+ {
1045
+ pPMC->PMC_PCER = periphIds;
1046
+ }
1047
+
1048
+ //*----------------------------------------------------------------------------
1049
+ //* \fn AT91F_PMC_DisablePeriphClock
1050
+ //* \brief Disable peripheral clock
1051
+ //*----------------------------------------------------------------------------
1052
+ __inline void AT91F_PMC_DisablePeriphClock (
1053
+ AT91PS_PMC pPMC, // \arg pointer to PMC controller
1054
+ unsigned int periphIds) // \arg IDs of peripherals
1055
+ {
1056
+ pPMC->PMC_PCDR = periphIds;
1057
+ }
1058
+
1059
+ //*----------------------------------------------------------------------------
1060
+ //* \fn AT91F_PMC_GetPeriphClock
1061
+ //* \brief Get peripheral clock status
1062
+ //*----------------------------------------------------------------------------
1063
+ __inline unsigned int AT91F_PMC_GetPeriphClock (
1064
+ AT91PS_PMC pPMC) // \arg pointer to PMC controller
1065
+ {
1066
+ return pPMC->PMC_PCSR;
1067
+ }
1068
+
1069
+ //*----------------------------------------------------------------------------
1070
+ //* \fn AT91F_CKGR_CfgMainOscillatorReg
1071
+ //* \brief Cfg the main oscillator
1072
+ //*----------------------------------------------------------------------------
1073
+ __inline void AT91F_CKGR_CfgMainOscillatorReg (
1074
+ AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller
1075
+ unsigned int mode)
1076
+ {
1077
+ pCKGR->CKGR_MOR = mode;
1078
+ }
1079
+
1080
+ //*----------------------------------------------------------------------------
1081
+ //* \fn AT91F_CKGR_GetMainOscillatorReg
1082
+ //* \brief Cfg the main oscillator
1083
+ //*----------------------------------------------------------------------------
1084
+ __inline unsigned int AT91F_CKGR_GetMainOscillatorReg (
1085
+ AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller
1086
+ {
1087
+ return pCKGR->CKGR_MOR;
1088
+ }
1089
+
1090
+ //*----------------------------------------------------------------------------
1091
+ //* \fn AT91F_CKGR_EnableMainOscillator
1092
+ //* \brief Enable the main oscillator
1093
+ //*----------------------------------------------------------------------------
1094
+ __inline void AT91F_CKGR_EnableMainOscillator(
1095
+ AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller
1096
+ {
1097
+ pCKGR->CKGR_MOR |= AT91C_CKGR_MOSCEN;
1098
+ }
1099
+
1100
+ //*----------------------------------------------------------------------------
1101
+ //* \fn AT91F_CKGR_DisableMainOscillator
1102
+ //* \brief Disable the main oscillator
1103
+ //*----------------------------------------------------------------------------
1104
+ __inline void AT91F_CKGR_DisableMainOscillator (
1105
+ AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller
1106
+ {
1107
+ pCKGR->CKGR_MOR &= ~AT91C_CKGR_MOSCEN;
1108
+ }
1109
+
1110
+ //*----------------------------------------------------------------------------
1111
+ //* \fn AT91F_CKGR_CfgMainOscStartUpTime
1112
+ //* \brief Cfg MOR Register according to the main osc startup time
1113
+ //*----------------------------------------------------------------------------
1114
+ __inline void AT91F_CKGR_CfgMainOscStartUpTime (
1115
+ AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller
1116
+ unsigned int startup_time, // \arg main osc startup time in microsecond (us)
1117
+ unsigned int slowClock) // \arg slowClock in Hz
1118
+ {
1119
+ pCKGR->CKGR_MOR &= ~AT91C_CKGR_OSCOUNT;
1120
+ pCKGR->CKGR_MOR |= ((slowClock * startup_time)/(8*1000000)) << 8;
1121
+ }
1122
+
1123
+ //*----------------------------------------------------------------------------
1124
+ //* \fn AT91F_CKGR_GetMainClockFreqReg
1125
+ //* \brief Cfg the main oscillator
1126
+ //*----------------------------------------------------------------------------
1127
+ __inline unsigned int AT91F_CKGR_GetMainClockFreqReg (
1128
+ AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller
1129
+ {
1130
+ return pCKGR->CKGR_MCFR;
1131
+ }
1132
+
1133
+ //*----------------------------------------------------------------------------
1134
+ //* \fn AT91F_CKGR_GetMainClock
1135
+ //* \brief Return Main clock in Hz
1136
+ //*----------------------------------------------------------------------------
1137
+ __inline unsigned int AT91F_CKGR_GetMainClock (
1138
+ AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller
1139
+ unsigned int slowClock) // \arg slowClock in Hz
1140
+ {
1141
+ return ((pCKGR->CKGR_MCFR & AT91C_CKGR_MAINF) * slowClock) >> 4;
1142
+ }
1143
+
1144
+ //*----------------------------------------------------------------------------
1145
+ //* \fn AT91F_PMC_CfgMCKReg
1146
+ //* \brief Cfg Master Clock Register
1147
+ //*----------------------------------------------------------------------------
1148
+ __inline void AT91F_PMC_CfgMCKReg (
1149
+ AT91PS_PMC pPMC, // \arg pointer to PMC controller
1150
+ unsigned int mode)
1151
+ {
1152
+ pPMC->PMC_MCKR = mode;
1153
+ }
1154
+
1155
+ //*----------------------------------------------------------------------------
1156
+ //* \fn AT91F_PMC_GetMCKReg
1157
+ //* \brief Return Master Clock Register
1158
+ //*----------------------------------------------------------------------------
1159
+ __inline unsigned int AT91F_PMC_GetMCKReg(
1160
+ AT91PS_PMC pPMC) // \arg pointer to PMC controller
1161
+ {
1162
+ return pPMC->PMC_MCKR;
1163
+ }
1164
+
1165
+ //*------------------------------------------------------------------------------
1166
+ //* \fn AT91F_PMC_GetMasterClock
1167
+ //* \brief Return master clock in Hz which correponds to processor clock for ARM7
1168
+ //*------------------------------------------------------------------------------
1169
+ __inline unsigned int AT91F_PMC_GetMasterClock (
1170
+ AT91PS_PMC pPMC, // \arg pointer to PMC controller
1171
+ AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller
1172
+ unsigned int slowClock) // \arg slowClock in Hz
1173
+ {
1174
+ unsigned int reg = pPMC->PMC_MCKR;
1175
+ unsigned int prescaler = (1 << ((reg & AT91C_PMC_PRES) >> 2));
1176
+ unsigned int pllDivider, pllMultiplier;
1177
+
1178
+ switch (reg & AT91C_PMC_CSS) {
1179
+ case AT91C_PMC_CSS_SLOW_CLK: // Slow clock selected
1180
+ return slowClock / prescaler;
1181
+ case AT91C_PMC_CSS_MAIN_CLK: // Main clock is selected
1182
+ return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / prescaler;
1183
+ case AT91C_PMC_CSS_PLL_CLK: // PLLB clock is selected
1184
+ reg = pCKGR->CKGR_PLLR;
1185
+ pllDivider = (reg & AT91C_CKGR_DIV);
1186
+ pllMultiplier = ((reg & AT91C_CKGR_MUL) >> 16) + 1;
1187
+ return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / pllDivider * pllMultiplier / prescaler;
1188
+ }
1189
+ return 0;
1190
+ }
1191
+
1192
+ //*----------------------------------------------------------------------------
1193
+ //* \fn AT91F_PMC_EnablePCK
1194
+ //* \brief Enable Programmable Clock x Output
1195
+ //*----------------------------------------------------------------------------
1196
+ __inline void AT91F_PMC_EnablePCK (
1197
+ AT91PS_PMC pPMC, // \arg pointer to PMC controller
1198
+ unsigned int pck, // \arg Programmable Clock x Output
1199
+ unsigned int mode)
1200
+ {
1201
+ pPMC->PMC_PCKR[pck] = mode;
1202
+ pPMC->PMC_SCER = (1 << pck) << 8;
1203
+ }
1204
+
1205
+ //*----------------------------------------------------------------------------
1206
+ //* \fn AT91F_PMC_DisablePCK
1207
+ //* \brief Disable Programmable Clock x Output
1208
+ //*----------------------------------------------------------------------------
1209
+ __inline void AT91F_PMC_DisablePCK (
1210
+ AT91PS_PMC pPMC, // \arg pointer to PMC controller
1211
+ unsigned int pck) // \arg Programmable Clock x Output
1212
+ {
1213
+ pPMC->PMC_SCDR = (1 << pck) << 8;
1214
+ }
1215
+
1216
+ //*----------------------------------------------------------------------------
1217
+ //* \fn AT91F_PMC_EnableIt
1218
+ //* \brief Enable PMC interrupt
1219
+ //*----------------------------------------------------------------------------
1220
+ __inline void AT91F_PMC_EnableIt (
1221
+ AT91PS_PMC pPMC, // pointer to a PMC controller
1222
+ unsigned int flag) // IT to be enabled
1223
+ {
1224
+ //* Write to the IER register
1225
+ pPMC->PMC_IER = flag;
1226
+ }
1227
+
1228
+ //*----------------------------------------------------------------------------
1229
+ //* \fn AT91F_PMC_DisableIt
1230
+ //* \brief Disable PMC interrupt
1231
+ //*----------------------------------------------------------------------------
1232
+ __inline void AT91F_PMC_DisableIt (
1233
+ AT91PS_PMC pPMC, // pointer to a PMC controller
1234
+ unsigned int flag) // IT to be disabled
1235
+ {
1236
+ //* Write to the IDR register
1237
+ pPMC->PMC_IDR = flag;
1238
+ }
1239
+
1240
+ //*----------------------------------------------------------------------------
1241
+ //* \fn AT91F_PMC_GetStatus
1242
+ //* \brief Return PMC Interrupt Status
1243
+ //*----------------------------------------------------------------------------
1244
+ __inline unsigned int AT91F_PMC_GetStatus( // \return PMC Interrupt Status
1245
+ AT91PS_PMC pPMC) // pointer to a PMC controller
1246
+ {
1247
+ return pPMC->PMC_SR;
1248
+ }
1249
+
1250
+ //*----------------------------------------------------------------------------
1251
+ //* \fn AT91F_PMC_GetInterruptMaskStatus
1252
+ //* \brief Return PMC Interrupt Mask Status
1253
+ //*----------------------------------------------------------------------------
1254
+ __inline unsigned int AT91F_PMC_GetInterruptMaskStatus( // \return PMC Interrupt Mask Status
1255
+ AT91PS_PMC pPMC) // pointer to a PMC controller
1256
+ {
1257
+ return pPMC->PMC_IMR;
1258
+ }
1259
+
1260
+ //*----------------------------------------------------------------------------
1261
+ //* \fn AT91F_PMC_IsInterruptMasked
1262
+ //* \brief Test if PMC Interrupt is Masked
1263
+ //*----------------------------------------------------------------------------
1264
+ __inline unsigned int AT91F_PMC_IsInterruptMasked(
1265
+ AT91PS_PMC pPMC, // \arg pointer to a PMC controller
1266
+ unsigned int flag) // \arg flag to be tested
1267
+ {
1268
+ return (AT91F_PMC_GetInterruptMaskStatus(pPMC) & flag);
1269
+ }
1270
+
1271
+ //*----------------------------------------------------------------------------
1272
+ //* \fn AT91F_PMC_IsStatusSet
1273
+ //* \brief Test if PMC Status is Set
1274
+ //*----------------------------------------------------------------------------
1275
+ __inline unsigned int AT91F_PMC_IsStatusSet(
1276
+ AT91PS_PMC pPMC, // \arg pointer to a PMC controller
1277
+ unsigned int flag) // \arg flag to be tested
1278
+ {
1279
+ return (AT91F_PMC_GetStatus(pPMC) & flag);
1280
+ }
1281
+
1282
+ // ----------------------------------------------------------------------------
1283
+ // \fn AT91F_CKGR_CfgPLLReg
1284
+ // \brief Cfg the PLL Register
1285
+ // ----------------------------------------------------------------------------
1286
+ __inline void AT91F_CKGR_CfgPLLReg (
1287
+ AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller
1288
+ unsigned int mode)
1289
+ {
1290
+ pCKGR->CKGR_PLLR = mode;
1291
+ }
1292
+
1293
+ // ----------------------------------------------------------------------------
1294
+ // \fn AT91F_CKGR_GetPLLReg
1295
+ // \brief Get the PLL Register
1296
+ // ----------------------------------------------------------------------------
1297
+ __inline unsigned int AT91F_CKGR_GetPLLReg (
1298
+ AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller
1299
+ {
1300
+ return pCKGR->CKGR_PLLR;
1301
+ }
1302
+
1303
+
1304
+ /* *****************************************************************************
1305
+ SOFTWARE API FOR RSTC
1306
+ ***************************************************************************** */
1307
+ //*----------------------------------------------------------------------------
1308
+ //* \fn AT91F_RSTSoftReset
1309
+ //* \brief Start Software Reset
1310
+ //*----------------------------------------------------------------------------
1311
+ __inline void AT91F_RSTSoftReset(
1312
+ AT91PS_RSTC pRSTC,
1313
+ unsigned int reset)
1314
+ {
1315
+ pRSTC->RSTC_RCR = (0xA5000000 | reset);
1316
+ }
1317
+
1318
+ //*----------------------------------------------------------------------------
1319
+ //* \fn AT91F_RSTSetMode
1320
+ //* \brief Set Reset Mode
1321
+ //*----------------------------------------------------------------------------
1322
+ __inline void AT91F_RSTSetMode(
1323
+ AT91PS_RSTC pRSTC,
1324
+ unsigned int mode)
1325
+ {
1326
+ pRSTC->RSTC_RMR = (0xA5000000 | mode);
1327
+ }
1328
+
1329
+ //*----------------------------------------------------------------------------
1330
+ //* \fn AT91F_RSTGetMode
1331
+ //* \brief Get Reset Mode
1332
+ //*----------------------------------------------------------------------------
1333
+ __inline unsigned int AT91F_RSTGetMode(
1334
+ AT91PS_RSTC pRSTC)
1335
+ {
1336
+ return (pRSTC->RSTC_RMR);
1337
+ }
1338
+
1339
+ //*----------------------------------------------------------------------------
1340
+ //* \fn AT91F_RSTGetStatus
1341
+ //* \brief Get Reset Status
1342
+ //*----------------------------------------------------------------------------
1343
+ __inline unsigned int AT91F_RSTGetStatus(
1344
+ AT91PS_RSTC pRSTC)
1345
+ {
1346
+ return (pRSTC->RSTC_RSR);
1347
+ }
1348
+
1349
+ //*----------------------------------------------------------------------------
1350
+ //* \fn AT91F_RSTIsSoftRstActive
1351
+ //* \brief Return !=0 if software reset is still not completed
1352
+ //*----------------------------------------------------------------------------
1353
+ __inline unsigned int AT91F_RSTIsSoftRstActive(
1354
+ AT91PS_RSTC pRSTC)
1355
+ {
1356
+ return ((pRSTC->RSTC_RSR) & AT91C_RSTC_SRCMP);
1357
+ }
1358
+ /* *****************************************************************************
1359
+ SOFTWARE API FOR RTTC
1360
+ ***************************************************************************** */
1361
+ //*--------------------------------------------------------------------------------------
1362
+ //* \fn AT91F_SetRTT_TimeBase()
1363
+ //* \brief Set the RTT prescaler according to the TimeBase in ms
1364
+ //*--------------------------------------------------------------------------------------
1365
+ __inline unsigned int AT91F_RTTSetTimeBase(
1366
+ AT91PS_RTTC pRTTC,
1367
+ unsigned int ms)
1368
+ {
1369
+ if (ms > 2000)
1370
+ return 1; // AT91C_TIME_OUT_OF_RANGE
1371
+ pRTTC->RTTC_RTMR &= ~0xFFFF;
1372
+ pRTTC->RTTC_RTMR |= (((ms << 15) /1000) & 0xFFFF);
1373
+ return 0;
1374
+ }
1375
+
1376
+ //*--------------------------------------------------------------------------------------
1377
+ //* \fn AT91F_RTTSetPrescaler()
1378
+ //* \brief Set the new prescaler value
1379
+ //*--------------------------------------------------------------------------------------
1380
+ __inline unsigned int AT91F_RTTSetPrescaler(
1381
+ AT91PS_RTTC pRTTC,
1382
+ unsigned int rtpres)
1383
+ {
1384
+ pRTTC->RTTC_RTMR &= ~0xFFFF;
1385
+ pRTTC->RTTC_RTMR |= (rtpres & 0xFFFF);
1386
+ return (pRTTC->RTTC_RTMR);
1387
+ }
1388
+
1389
+ //*--------------------------------------------------------------------------------------
1390
+ //* \fn AT91F_RTTRestart()
1391
+ //* \brief Restart the RTT prescaler
1392
+ //*--------------------------------------------------------------------------------------
1393
+ __inline void AT91F_RTTRestart(
1394
+ AT91PS_RTTC pRTTC)
1395
+ {
1396
+ pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTRST;
1397
+ }
1398
+
1399
+
1400
+ //*--------------------------------------------------------------------------------------
1401
+ //* \fn AT91F_RTT_SetAlarmINT()
1402
+ //* \brief Enable RTT Alarm Interrupt
1403
+ //*--------------------------------------------------------------------------------------
1404
+ __inline void AT91F_RTTSetAlarmINT(
1405
+ AT91PS_RTTC pRTTC)
1406
+ {
1407
+ pRTTC->RTTC_RTMR |= AT91C_RTTC_ALMIEN;
1408
+ }
1409
+
1410
+ //*--------------------------------------------------------------------------------------
1411
+ //* \fn AT91F_RTT_ClearAlarmINT()
1412
+ //* \brief Disable RTT Alarm Interrupt
1413
+ //*--------------------------------------------------------------------------------------
1414
+ __inline void AT91F_RTTClearAlarmINT(
1415
+ AT91PS_RTTC pRTTC)
1416
+ {
1417
+ pRTTC->RTTC_RTMR &= ~AT91C_RTTC_ALMIEN;
1418
+ }
1419
+
1420
+ //*--------------------------------------------------------------------------------------
1421
+ //* \fn AT91F_RTT_SetRttIncINT()
1422
+ //* \brief Enable RTT INC Interrupt
1423
+ //*--------------------------------------------------------------------------------------
1424
+ __inline void AT91F_RTTSetRttIncINT(
1425
+ AT91PS_RTTC pRTTC)
1426
+ {
1427
+ pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTINCIEN;
1428
+ }
1429
+
1430
+ //*--------------------------------------------------------------------------------------
1431
+ //* \fn AT91F_RTT_ClearRttIncINT()
1432
+ //* \brief Disable RTT INC Interrupt
1433
+ //*--------------------------------------------------------------------------------------
1434
+ __inline void AT91F_RTTClearRttIncINT(
1435
+ AT91PS_RTTC pRTTC)
1436
+ {
1437
+ pRTTC->RTTC_RTMR &= ~AT91C_RTTC_RTTINCIEN;
1438
+ }
1439
+
1440
+ //*--------------------------------------------------------------------------------------
1441
+ //* \fn AT91F_RTT_SetAlarmValue()
1442
+ //* \brief Set RTT Alarm Value
1443
+ //*--------------------------------------------------------------------------------------
1444
+ __inline void AT91F_RTTSetAlarmValue(
1445
+ AT91PS_RTTC pRTTC, unsigned int alarm)
1446
+ {
1447
+ pRTTC->RTTC_RTAR = alarm;
1448
+ }
1449
+
1450
+ //*--------------------------------------------------------------------------------------
1451
+ //* \fn AT91F_RTT_GetAlarmValue()
1452
+ //* \brief Get RTT Alarm Value
1453
+ //*--------------------------------------------------------------------------------------
1454
+ __inline unsigned int AT91F_RTTGetAlarmValue(
1455
+ AT91PS_RTTC pRTTC)
1456
+ {
1457
+ return(pRTTC->RTTC_RTAR);
1458
+ }
1459
+
1460
+ //*--------------------------------------------------------------------------------------
1461
+ //* \fn AT91F_RTTGetStatus()
1462
+ //* \brief Read the RTT status
1463
+ //*--------------------------------------------------------------------------------------
1464
+ __inline unsigned int AT91F_RTTGetStatus(
1465
+ AT91PS_RTTC pRTTC)
1466
+ {
1467
+ return(pRTTC->RTTC_RTSR);
1468
+ }
1469
+
1470
+ //*--------------------------------------------------------------------------------------
1471
+ //* \fn AT91F_RTT_ReadValue()
1472
+ //* \brief Read the RTT value
1473
+ //*--------------------------------------------------------------------------------------
1474
+ __inline unsigned int AT91F_RTTReadValue(
1475
+ AT91PS_RTTC pRTTC)
1476
+ {
1477
+ register volatile unsigned int val1,val2;
1478
+ do
1479
+ {
1480
+ val1 = pRTTC->RTTC_RTVR;
1481
+ val2 = pRTTC->RTTC_RTVR;
1482
+ }
1483
+ while(val1 != val2);
1484
+ return(val1);
1485
+ }
1486
+ /* *****************************************************************************
1487
+ SOFTWARE API FOR PITC
1488
+ ***************************************************************************** */
1489
+ //*----------------------------------------------------------------------------
1490
+ //* \fn AT91F_PITInit
1491
+ //* \brief System timer init : period in �second, system clock freq in MHz
1492
+ //*----------------------------------------------------------------------------
1493
+ __inline void AT91F_PITInit(
1494
+ AT91PS_PITC pPITC,
1495
+ unsigned int period,
1496
+ unsigned int pit_frequency)
1497
+ {
1498
+ pPITC->PITC_PIMR = period? (period * pit_frequency + 8) >> 4 : 0; // +8 to avoid %10 and /10
1499
+ pPITC->PITC_PIMR |= AT91C_PITC_PITEN;
1500
+ }
1501
+
1502
+ //*----------------------------------------------------------------------------
1503
+ //* \fn AT91F_PITSetPIV
1504
+ //* \brief Set the PIT Periodic Interval Value
1505
+ //*----------------------------------------------------------------------------
1506
+ __inline void AT91F_PITSetPIV(
1507
+ AT91PS_PITC pPITC,
1508
+ unsigned int piv)
1509
+ {
1510
+ pPITC->PITC_PIMR = piv | (pPITC->PITC_PIMR & (AT91C_PITC_PITEN | AT91C_PITC_PITIEN));
1511
+ }
1512
+
1513
+ //*----------------------------------------------------------------------------
1514
+ //* \fn AT91F_PITEnableInt
1515
+ //* \brief Enable PIT periodic interrupt
1516
+ //*----------------------------------------------------------------------------
1517
+ __inline void AT91F_PITEnableInt(
1518
+ AT91PS_PITC pPITC)
1519
+ {
1520
+ pPITC->PITC_PIMR |= AT91C_PITC_PITIEN;
1521
+ }
1522
+
1523
+ //*----------------------------------------------------------------------------
1524
+ //* \fn AT91F_PITDisableInt
1525
+ //* \brief Disable PIT periodic interrupt
1526
+ //*----------------------------------------------------------------------------
1527
+ __inline void AT91F_PITDisableInt(
1528
+ AT91PS_PITC pPITC)
1529
+ {
1530
+ pPITC->PITC_PIMR &= ~AT91C_PITC_PITIEN;
1531
+ }
1532
+
1533
+ //*----------------------------------------------------------------------------
1534
+ //* \fn AT91F_PITGetMode
1535
+ //* \brief Read PIT mode register
1536
+ //*----------------------------------------------------------------------------
1537
+ __inline unsigned int AT91F_PITGetMode(
1538
+ AT91PS_PITC pPITC)
1539
+ {
1540
+ return(pPITC->PITC_PIMR);
1541
+ }
1542
+
1543
+ //*----------------------------------------------------------------------------
1544
+ //* \fn AT91F_PITGetStatus
1545
+ //* \brief Read PIT status register
1546
+ //*----------------------------------------------------------------------------
1547
+ __inline unsigned int AT91F_PITGetStatus(
1548
+ AT91PS_PITC pPITC)
1549
+ {
1550
+ return(pPITC->PITC_PISR);
1551
+ }
1552
+
1553
+ //*----------------------------------------------------------------------------
1554
+ //* \fn AT91F_PITGetPIIR
1555
+ //* \brief Read PIT CPIV and PICNT without ressetting the counters
1556
+ //*----------------------------------------------------------------------------
1557
+ __inline unsigned int AT91F_PITGetPIIR(
1558
+ AT91PS_PITC pPITC)
1559
+ {
1560
+ return(pPITC->PITC_PIIR);
1561
+ }
1562
+
1563
+ //*----------------------------------------------------------------------------
1564
+ //* \fn AT91F_PITGetPIVR
1565
+ //* \brief Read System timer CPIV and PICNT without ressetting the counters
1566
+ //*----------------------------------------------------------------------------
1567
+ __inline unsigned int AT91F_PITGetPIVR(
1568
+ AT91PS_PITC pPITC)
1569
+ {
1570
+ return(pPITC->PITC_PIVR);
1571
+ }
1572
+ /* *****************************************************************************
1573
+ SOFTWARE API FOR WDTC
1574
+ ***************************************************************************** */
1575
+ //*----------------------------------------------------------------------------
1576
+ //* \fn AT91F_WDTSetMode
1577
+ //* \brief Set Watchdog Mode Register
1578
+ //*----------------------------------------------------------------------------
1579
+ __inline void AT91F_WDTSetMode(
1580
+ AT91PS_WDTC pWDTC,
1581
+ unsigned int Mode)
1582
+ {
1583
+ pWDTC->WDTC_WDMR = Mode;
1584
+ }
1585
+
1586
+ //*----------------------------------------------------------------------------
1587
+ //* \fn AT91F_WDTRestart
1588
+ //* \brief Restart Watchdog
1589
+ //*----------------------------------------------------------------------------
1590
+ __inline void AT91F_WDTRestart(
1591
+ AT91PS_WDTC pWDTC)
1592
+ {
1593
+ pWDTC->WDTC_WDCR = 0xA5000001;
1594
+ }
1595
+
1596
+ //*----------------------------------------------------------------------------
1597
+ //* \fn AT91F_WDTSGettatus
1598
+ //* \brief Get Watchdog Status
1599
+ //*----------------------------------------------------------------------------
1600
+ __inline unsigned int AT91F_WDTSGettatus(
1601
+ AT91PS_WDTC pWDTC)
1602
+ {
1603
+ return(pWDTC->WDTC_WDSR & 0x3);
1604
+ }
1605
+
1606
+ //*----------------------------------------------------------------------------
1607
+ //* \fn AT91F_WDTGetPeriod
1608
+ //* \brief Translate ms into Watchdog Compatible value
1609
+ //*----------------------------------------------------------------------------
1610
+ __inline unsigned int AT91F_WDTGetPeriod(unsigned int ms)
1611
+ {
1612
+ if ((ms < 4) || (ms > 16000))
1613
+ return 0;
1614
+ return((ms << 8) / 1000);
1615
+ }
1616
+ /* *****************************************************************************
1617
+ SOFTWARE API FOR VREG
1618
+ ***************************************************************************** */
1619
+ //*----------------------------------------------------------------------------
1620
+ //* \fn AT91F_VREG_Enable_LowPowerMode
1621
+ //* \brief Enable VREG Low Power Mode
1622
+ //*----------------------------------------------------------------------------
1623
+ __inline void AT91F_VREG_Enable_LowPowerMode(
1624
+ AT91PS_VREG pVREG)
1625
+ {
1626
+ pVREG->VREG_MR |= AT91C_VREG_PSTDBY;
1627
+ }
1628
+
1629
+ //*----------------------------------------------------------------------------
1630
+ //* \fn AT91F_VREG_Disable_LowPowerMode
1631
+ //* \brief Disable VREG Low Power Mode
1632
+ //*----------------------------------------------------------------------------
1633
+ __inline void AT91F_VREG_Disable_LowPowerMode(
1634
+ AT91PS_VREG pVREG)
1635
+ {
1636
+ pVREG->VREG_MR &= ~AT91C_VREG_PSTDBY;
1637
+ }/* *****************************************************************************
1638
+ SOFTWARE API FOR MC
1639
+ ***************************************************************************** */
1640
+
1641
+ #define AT91C_MC_CORRECT_KEY ((unsigned int) 0x5A << 24) // (MC) Correct Protect Key
1642
+
1643
+ //*----------------------------------------------------------------------------
1644
+ //* \fn AT91F_MC_Remap
1645
+ //* \brief Make Remap
1646
+ //*----------------------------------------------------------------------------
1647
+ __inline void AT91F_MC_Remap (void) //
1648
+ {
1649
+ AT91PS_MC pMC = (AT91PS_MC) AT91C_BASE_MC;
1650
+
1651
+ pMC->MC_RCR = AT91C_MC_RCB;
1652
+ }
1653
+
1654
+ //*----------------------------------------------------------------------------
1655
+ //* \fn AT91F_MC_EFC_CfgModeReg
1656
+ //* \brief Configure the EFC Mode Register of the MC controller
1657
+ //*----------------------------------------------------------------------------
1658
+ __inline void AT91F_MC_EFC_CfgModeReg (
1659
+ AT91PS_MC pMC, // pointer to a MC controller
1660
+ unsigned int mode) // mode register
1661
+ {
1662
+ // Write to the FMR register
1663
+ pMC->MC_FMR = mode;
1664
+ }
1665
+
1666
+ //*----------------------------------------------------------------------------
1667
+ //* \fn AT91F_MC_EFC_GetModeReg
1668
+ //* \brief Return MC EFC Mode Regsiter
1669
+ //*----------------------------------------------------------------------------
1670
+ __inline unsigned int AT91F_MC_EFC_GetModeReg(
1671
+ AT91PS_MC pMC) // pointer to a MC controller
1672
+ {
1673
+ return pMC->MC_FMR;
1674
+ }
1675
+
1676
+ //*----------------------------------------------------------------------------
1677
+ //* \fn AT91F_MC_EFC_ComputeFMCN
1678
+ //* \brief Return MC EFC Mode Regsiter
1679
+ //*----------------------------------------------------------------------------
1680
+ __inline unsigned int AT91F_MC_EFC_ComputeFMCN(
1681
+ int master_clock) // master clock in Hz
1682
+ {
1683
+ return (master_clock/1000000 +2);
1684
+ }
1685
+
1686
+ //*----------------------------------------------------------------------------
1687
+ //* \fn AT91F_MC_EFC_PerformCmd
1688
+ //* \brief Perform EFC Command
1689
+ //*----------------------------------------------------------------------------
1690
+ __inline void AT91F_MC_EFC_PerformCmd (
1691
+ AT91PS_MC pMC, // pointer to a MC controller
1692
+ unsigned int transfer_cmd)
1693
+ {
1694
+ pMC->MC_FCR = transfer_cmd;
1695
+ }
1696
+
1697
+ //*----------------------------------------------------------------------------
1698
+ //* \fn AT91F_MC_EFC_GetStatus
1699
+ //* \brief Return MC EFC Status
1700
+ //*----------------------------------------------------------------------------
1701
+ __inline unsigned int AT91F_MC_EFC_GetStatus(
1702
+ AT91PS_MC pMC) // pointer to a MC controller
1703
+ {
1704
+ return pMC->MC_FSR;
1705
+ }
1706
+
1707
+ //*----------------------------------------------------------------------------
1708
+ //* \fn AT91F_MC_EFC_IsInterruptMasked
1709
+ //* \brief Test if EFC MC Interrupt is Masked
1710
+ //*----------------------------------------------------------------------------
1711
+ __inline unsigned int AT91F_MC_EFC_IsInterruptMasked(
1712
+ AT91PS_MC pMC, // \arg pointer to a MC controller
1713
+ unsigned int flag) // \arg flag to be tested
1714
+ {
1715
+ return (AT91F_MC_EFC_GetModeReg(pMC) & flag);
1716
+ }
1717
+
1718
+ //*----------------------------------------------------------------------------
1719
+ //* \fn AT91F_MC_EFC_IsInterruptSet
1720
+ //* \brief Test if EFC MC Interrupt is Set
1721
+ //*----------------------------------------------------------------------------
1722
+ __inline unsigned int AT91F_MC_EFC_IsInterruptSet(
1723
+ AT91PS_MC pMC, // \arg pointer to a MC controller
1724
+ unsigned int flag) // \arg flag to be tested
1725
+ {
1726
+ return (AT91F_MC_EFC_GetStatus(pMC) & flag);
1727
+ }
1728
+
1729
+ /* *****************************************************************************
1730
+ SOFTWARE API FOR SPI
1731
+ ***************************************************************************** */
1732
+ //*----------------------------------------------------------------------------
1733
+ //* \fn AT91F_SPI_CfgCs
1734
+ //* \brief Configure SPI chip select register
1735
+ //*----------------------------------------------------------------------------
1736
+ __inline void AT91F_SPI_CfgCs (
1737
+ AT91PS_SPI pSPI, // pointer to a SPI controller
1738
+ int cs, // SPI cs number (0 to 3)
1739
+ int val) // chip select register
1740
+ {
1741
+ //* Write to the CSR register
1742
+ *(pSPI->SPI_CSR + cs) = val;
1743
+ }
1744
+
1745
+ //*----------------------------------------------------------------------------
1746
+ //* \fn AT91F_SPI_EnableIt
1747
+ //* \brief Enable SPI interrupt
1748
+ //*----------------------------------------------------------------------------
1749
+ __inline void AT91F_SPI_EnableIt (
1750
+ AT91PS_SPI pSPI, // pointer to a SPI controller
1751
+ unsigned int flag) // IT to be enabled
1752
+ {
1753
+ //* Write to the IER register
1754
+ pSPI->SPI_IER = flag;
1755
+ }
1756
+
1757
+ //*----------------------------------------------------------------------------
1758
+ //* \fn AT91F_SPI_DisableIt
1759
+ //* \brief Disable SPI interrupt
1760
+ //*----------------------------------------------------------------------------
1761
+ __inline void AT91F_SPI_DisableIt (
1762
+ AT91PS_SPI pSPI, // pointer to a SPI controller
1763
+ unsigned int flag) // IT to be disabled
1764
+ {
1765
+ //* Write to the IDR register
1766
+ pSPI->SPI_IDR = flag;
1767
+ }
1768
+
1769
+ //*----------------------------------------------------------------------------
1770
+ //* \fn AT91F_SPI_Reset
1771
+ //* \brief Reset the SPI controller
1772
+ //*----------------------------------------------------------------------------
1773
+ __inline void AT91F_SPI_Reset (
1774
+ AT91PS_SPI pSPI // pointer to a SPI controller
1775
+ )
1776
+ {
1777
+ //* Write to the CR register
1778
+ pSPI->SPI_CR = AT91C_SPI_SWRST;
1779
+ }
1780
+
1781
+ //*----------------------------------------------------------------------------
1782
+ //* \fn AT91F_SPI_Enable
1783
+ //* \brief Enable the SPI controller
1784
+ //*----------------------------------------------------------------------------
1785
+ __inline void AT91F_SPI_Enable (
1786
+ AT91PS_SPI pSPI // pointer to a SPI controller
1787
+ )
1788
+ {
1789
+ //* Write to the CR register
1790
+ pSPI->SPI_CR = AT91C_SPI_SPIEN;
1791
+ }
1792
+
1793
+ //*----------------------------------------------------------------------------
1794
+ //* \fn AT91F_SPI_Disable
1795
+ //* \brief Disable the SPI controller
1796
+ //*----------------------------------------------------------------------------
1797
+ __inline void AT91F_SPI_Disable (
1798
+ AT91PS_SPI pSPI // pointer to a SPI controller
1799
+ )
1800
+ {
1801
+ //* Write to the CR register
1802
+ pSPI->SPI_CR = AT91C_SPI_SPIDIS;
1803
+ }
1804
+
1805
+ //*----------------------------------------------------------------------------
1806
+ //* \fn AT91F_SPI_CfgMode
1807
+ //* \brief Enable the SPI controller
1808
+ //*----------------------------------------------------------------------------
1809
+ __inline void AT91F_SPI_CfgMode (
1810
+ AT91PS_SPI pSPI, // pointer to a SPI controller
1811
+ int mode) // mode register
1812
+ {
1813
+ //* Write to the MR register
1814
+ pSPI->SPI_MR = mode;
1815
+ }
1816
+
1817
+ //*----------------------------------------------------------------------------
1818
+ //* \fn AT91F_SPI_CfgPCS
1819
+ //* \brief Switch to the correct PCS of SPI Mode Register : Fixed Peripheral Selected
1820
+ //*----------------------------------------------------------------------------
1821
+ __inline void AT91F_SPI_CfgPCS (
1822
+ AT91PS_SPI pSPI, // pointer to a SPI controller
1823
+ char PCS_Device) // PCS of the Device
1824
+ {
1825
+ //* Write to the MR register
1826
+ pSPI->SPI_MR &= 0xFFF0FFFF;
1827
+ pSPI->SPI_MR |= ( (PCS_Device<<16) & AT91C_SPI_PCS );
1828
+ }
1829
+
1830
+ //*----------------------------------------------------------------------------
1831
+ //* \fn AT91F_SPI_ReceiveFrame
1832
+ //* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy
1833
+ //*----------------------------------------------------------------------------
1834
+ __inline unsigned int AT91F_SPI_ReceiveFrame (
1835
+ AT91PS_SPI pSPI,
1836
+ char *pBuffer,
1837
+ unsigned int szBuffer,
1838
+ char *pNextBuffer,
1839
+ unsigned int szNextBuffer )
1840
+ {
1841
+ return AT91F_PDC_ReceiveFrame(
1842
+ (AT91PS_PDC) &(pSPI->SPI_RPR),
1843
+ pBuffer,
1844
+ szBuffer,
1845
+ pNextBuffer,
1846
+ szNextBuffer);
1847
+ }
1848
+
1849
+ //*----------------------------------------------------------------------------
1850
+ //* \fn AT91F_SPI_SendFrame
1851
+ //* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is bSPIy
1852
+ //*----------------------------------------------------------------------------
1853
+ __inline unsigned int AT91F_SPI_SendFrame(
1854
+ AT91PS_SPI pSPI,
1855
+ char *pBuffer,
1856
+ unsigned int szBuffer,
1857
+ char *pNextBuffer,
1858
+ unsigned int szNextBuffer )
1859
+ {
1860
+ return AT91F_PDC_SendFrame(
1861
+ (AT91PS_PDC) &(pSPI->SPI_RPR),
1862
+ pBuffer,
1863
+ szBuffer,
1864
+ pNextBuffer,
1865
+ szNextBuffer);
1866
+ }
1867
+
1868
+ //*----------------------------------------------------------------------------
1869
+ //* \fn AT91F_SPI_Close
1870
+ //* \brief Close SPI: disable IT disable transfert, close PDC
1871
+ //*----------------------------------------------------------------------------
1872
+ __inline void AT91F_SPI_Close (
1873
+ AT91PS_SPI pSPI) // \arg pointer to a SPI controller
1874
+ {
1875
+ //* Reset all the Chip Select register
1876
+ pSPI->SPI_CSR[0] = 0 ;
1877
+ pSPI->SPI_CSR[1] = 0 ;
1878
+ pSPI->SPI_CSR[2] = 0 ;
1879
+ pSPI->SPI_CSR[3] = 0 ;
1880
+
1881
+ //* Reset the SPI mode
1882
+ pSPI->SPI_MR = 0 ;
1883
+
1884
+ //* Disable all interrupts
1885
+ pSPI->SPI_IDR = 0xFFFFFFFF ;
1886
+
1887
+ //* Abort the Peripheral Data Transfers
1888
+ AT91F_PDC_Close((AT91PS_PDC) &(pSPI->SPI_RPR));
1889
+
1890
+ //* Disable receiver and transmitter and stop any activity immediately
1891
+ pSPI->SPI_CR = AT91C_SPI_SPIDIS;
1892
+ }
1893
+
1894
+ //*----------------------------------------------------------------------------
1895
+ //* \fn AT91F_SPI_PutChar
1896
+ //* \brief Send a character,does not check if ready to send
1897
+ //*----------------------------------------------------------------------------
1898
+ __inline void AT91F_SPI_PutChar (
1899
+ AT91PS_SPI pSPI,
1900
+ unsigned int character,
1901
+ unsigned int cs_number )
1902
+ {
1903
+ unsigned int value_for_cs;
1904
+ value_for_cs = (~(1 << cs_number)) & 0xF; //Place a zero among a 4 ONEs number
1905
+ pSPI->SPI_TDR = (character & 0xFFFF) | (value_for_cs << 16);
1906
+ }
1907
+
1908
+ //*----------------------------------------------------------------------------
1909
+ //* \fn AT91F_SPI_GetChar
1910
+ //* \brief Receive a character,does not check if a character is available
1911
+ //*----------------------------------------------------------------------------
1912
+ __inline int AT91F_SPI_GetChar (
1913
+ const AT91PS_SPI pSPI)
1914
+ {
1915
+ return((pSPI->SPI_RDR) & 0xFFFF);
1916
+ }
1917
+
1918
+ //*----------------------------------------------------------------------------
1919
+ //* \fn AT91F_SPI_GetInterruptMaskStatus
1920
+ //* \brief Return SPI Interrupt Mask Status
1921
+ //*----------------------------------------------------------------------------
1922
+ __inline unsigned int AT91F_SPI_GetInterruptMaskStatus( // \return SPI Interrupt Mask Status
1923
+ AT91PS_SPI pSpi) // \arg pointer to a SPI controller
1924
+ {
1925
+ return pSpi->SPI_IMR;
1926
+ }
1927
+
1928
+ //*----------------------------------------------------------------------------
1929
+ //* \fn AT91F_SPI_IsInterruptMasked
1930
+ //* \brief Test if SPI Interrupt is Masked
1931
+ //*----------------------------------------------------------------------------
1932
+ __inline int AT91F_SPI_IsInterruptMasked(
1933
+ AT91PS_SPI pSpi, // \arg pointer to a SPI controller
1934
+ unsigned int flag) // \arg flag to be tested
1935
+ {
1936
+ return (AT91F_SPI_GetInterruptMaskStatus(pSpi) & flag);
1937
+ }
1938
+
1939
+ /* *****************************************************************************
1940
+ SOFTWARE API FOR USART
1941
+ ***************************************************************************** */
1942
+ //*----------------------------------------------------------------------------
1943
+ //* \fn AT91F_US_Baudrate
1944
+ //* \brief Calculate the baudrate
1945
+ //* Standard Asynchronous Mode : 8 bits , 1 stop , no parity
1946
+ #define AT91C_US_ASYNC_MODE ( AT91C_US_USMODE_NORMAL + \
1947
+ AT91C_US_NBSTOP_1_BIT + \
1948
+ AT91C_US_PAR_NONE + \
1949
+ AT91C_US_CHRL_8_BITS + \
1950
+ AT91C_US_CLKS_CLOCK )
1951
+
1952
+ //* Standard External Asynchronous Mode : 8 bits , 1 stop , no parity
1953
+ #define AT91C_US_ASYNC_SCK_MODE ( AT91C_US_USMODE_NORMAL + \
1954
+ AT91C_US_NBSTOP_1_BIT + \
1955
+ AT91C_US_PAR_NONE + \
1956
+ AT91C_US_CHRL_8_BITS + \
1957
+ AT91C_US_CLKS_EXT )
1958
+
1959
+ //* Standard Synchronous Mode : 8 bits , 1 stop , no parity
1960
+ #define AT91C_US_SYNC_MODE ( AT91C_US_SYNC + \
1961
+ AT91C_US_USMODE_NORMAL + \
1962
+ AT91C_US_NBSTOP_1_BIT + \
1963
+ AT91C_US_PAR_NONE + \
1964
+ AT91C_US_CHRL_8_BITS + \
1965
+ AT91C_US_CLKS_CLOCK )
1966
+
1967
+ //* SCK used Label
1968
+ #define AT91C_US_SCK_USED (AT91C_US_CKLO | AT91C_US_CLKS_EXT)
1969
+
1970
+ //* Standard ISO T=0 Mode : 8 bits , 1 stop , parity
1971
+ #define AT91C_US_ISO_READER_MODE ( AT91C_US_USMODE_ISO7816_0 + \
1972
+ AT91C_US_CLKS_CLOCK +\
1973
+ AT91C_US_NBSTOP_1_BIT + \
1974
+ AT91C_US_PAR_EVEN + \
1975
+ AT91C_US_CHRL_8_BITS + \
1976
+ AT91C_US_CKLO +\
1977
+ AT91C_US_OVER)
1978
+
1979
+ //* Standard IRDA mode
1980
+ #define AT91C_US_ASYNC_IRDA_MODE ( AT91C_US_USMODE_IRDA + \
1981
+ AT91C_US_NBSTOP_1_BIT + \
1982
+ AT91C_US_PAR_NONE + \
1983
+ AT91C_US_CHRL_8_BITS + \
1984
+ AT91C_US_CLKS_CLOCK )
1985
+
1986
+ //*----------------------------------------------------------------------------
1987
+ //* \fn AT91F_US_Baudrate
1988
+ //* \brief Caluculate baud_value according to the main clock and the baud rate
1989
+ //*----------------------------------------------------------------------------
1990
+ __inline unsigned int AT91F_US_Baudrate (
1991
+ const unsigned int main_clock, // \arg peripheral clock
1992
+ const unsigned int baud_rate) // \arg UART baudrate
1993
+ {
1994
+ unsigned int baud_value = ((main_clock*10)/(baud_rate * 16));
1995
+ if ((baud_value % 10) >= 5)
1996
+ baud_value = (baud_value / 10) + 1;
1997
+ else
1998
+ baud_value /= 10;
1999
+ return baud_value;
2000
+ }
2001
+
2002
+ //*----------------------------------------------------------------------------
2003
+ //* \fn AT91F_US_SetBaudrate
2004
+ //* \brief Set the baudrate according to the CPU clock
2005
+ //*----------------------------------------------------------------------------
2006
+ __inline void AT91F_US_SetBaudrate (
2007
+ AT91PS_USART pUSART, // \arg pointer to a USART controller
2008
+ unsigned int mainClock, // \arg peripheral clock
2009
+ unsigned int speed) // \arg UART baudrate
2010
+ {
2011
+ //* Define the baud rate divisor register
2012
+ pUSART->US_BRGR = AT91F_US_Baudrate(mainClock, speed);
2013
+ }
2014
+
2015
+ //*----------------------------------------------------------------------------
2016
+ //* \fn AT91F_US_SetTimeguard
2017
+ //* \brief Set USART timeguard
2018
+ //*----------------------------------------------------------------------------
2019
+ __inline void AT91F_US_SetTimeguard (
2020
+ AT91PS_USART pUSART, // \arg pointer to a USART controller
2021
+ unsigned int timeguard) // \arg timeguard value
2022
+ {
2023
+ //* Write the Timeguard Register
2024
+ pUSART->US_TTGR = timeguard ;
2025
+ }
2026
+
2027
+ //*----------------------------------------------------------------------------
2028
+ //* \fn AT91F_US_EnableIt
2029
+ //* \brief Enable USART IT
2030
+ //*----------------------------------------------------------------------------
2031
+ __inline void AT91F_US_EnableIt (
2032
+ AT91PS_USART pUSART, // \arg pointer to a USART controller
2033
+ unsigned int flag) // \arg IT to be enabled
2034
+ {
2035
+ //* Write to the IER register
2036
+ pUSART->US_IER = flag;
2037
+ }
2038
+
2039
+ //*----------------------------------------------------------------------------
2040
+ //* \fn AT91F_US_DisableIt
2041
+ //* \brief Disable USART IT
2042
+ //*----------------------------------------------------------------------------
2043
+ __inline void AT91F_US_DisableIt (
2044
+ AT91PS_USART pUSART, // \arg pointer to a USART controller
2045
+ unsigned int flag) // \arg IT to be disabled
2046
+ {
2047
+ //* Write to the IER register
2048
+ pUSART->US_IDR = flag;
2049
+ }
2050
+
2051
+ //*----------------------------------------------------------------------------
2052
+ //* \fn AT91F_US_Configure
2053
+ //* \brief Configure USART
2054
+ //*----------------------------------------------------------------------------
2055
+ __inline void AT91F_US_Configure (
2056
+ AT91PS_USART pUSART, // \arg pointer to a USART controller
2057
+ unsigned int mainClock, // \arg peripheral clock
2058
+ unsigned int mode , // \arg mode Register to be programmed
2059
+ unsigned int baudRate , // \arg baudrate to be programmed
2060
+ unsigned int timeguard ) // \arg timeguard to be programmed
2061
+ {
2062
+ //* Disable interrupts
2063
+ pUSART->US_IDR = (unsigned int) -1;
2064
+
2065
+ //* Reset receiver and transmitter
2066
+ pUSART->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS ;
2067
+
2068
+ //* Define the baud rate divisor register
2069
+ AT91F_US_SetBaudrate(pUSART, mainClock, baudRate);
2070
+
2071
+ //* Write the Timeguard Register
2072
+ AT91F_US_SetTimeguard(pUSART, timeguard);
2073
+
2074
+ //* Clear Transmit and Receive Counters
2075
+ AT91F_PDC_Open((AT91PS_PDC) &(pUSART->US_RPR));
2076
+
2077
+ //* Define the USART mode
2078
+ pUSART->US_MR = mode ;
2079
+
2080
+ }
2081
+
2082
+ //*----------------------------------------------------------------------------
2083
+ //* \fn AT91F_US_EnableRx
2084
+ //* \brief Enable receiving characters
2085
+ //*----------------------------------------------------------------------------
2086
+ __inline void AT91F_US_EnableRx (
2087
+ AT91PS_USART pUSART) // \arg pointer to a USART controller
2088
+ {
2089
+ //* Enable receiver
2090
+ pUSART->US_CR = AT91C_US_RXEN;
2091
+ }
2092
+
2093
+ //*----------------------------------------------------------------------------
2094
+ //* \fn AT91F_US_EnableTx
2095
+ //* \brief Enable sending characters
2096
+ //*----------------------------------------------------------------------------
2097
+ __inline void AT91F_US_EnableTx (
2098
+ AT91PS_USART pUSART) // \arg pointer to a USART controller
2099
+ {
2100
+ //* Enable transmitter
2101
+ pUSART->US_CR = AT91C_US_TXEN;
2102
+ }
2103
+
2104
+ //*----------------------------------------------------------------------------
2105
+ //* \fn AT91F_US_ResetRx
2106
+ //* \brief Reset Receiver and re-enable it
2107
+ //*----------------------------------------------------------------------------
2108
+ __inline void AT91F_US_ResetRx (
2109
+ AT91PS_USART pUSART) // \arg pointer to a USART controller
2110
+ {
2111
+ //* Reset receiver
2112
+ pUSART->US_CR = AT91C_US_RSTRX;
2113
+ //* Re-Enable receiver
2114
+ pUSART->US_CR = AT91C_US_RXEN;
2115
+ }
2116
+
2117
+ //*----------------------------------------------------------------------------
2118
+ //* \fn AT91F_US_ResetTx
2119
+ //* \brief Reset Transmitter and re-enable it
2120
+ //*----------------------------------------------------------------------------
2121
+ __inline void AT91F_US_ResetTx (
2122
+ AT91PS_USART pUSART) // \arg pointer to a USART controller
2123
+ {
2124
+ //* Reset transmitter
2125
+ pUSART->US_CR = AT91C_US_RSTTX;
2126
+ //* Enable transmitter
2127
+ pUSART->US_CR = AT91C_US_TXEN;
2128
+ }
2129
+
2130
+ //*----------------------------------------------------------------------------
2131
+ //* \fn AT91F_US_DisableRx
2132
+ //* \brief Disable Receiver
2133
+ //*----------------------------------------------------------------------------
2134
+ __inline void AT91F_US_DisableRx (
2135
+ AT91PS_USART pUSART) // \arg pointer to a USART controller
2136
+ {
2137
+ //* Disable receiver
2138
+ pUSART->US_CR = AT91C_US_RXDIS;
2139
+ }
2140
+
2141
+ //*----------------------------------------------------------------------------
2142
+ //* \fn AT91F_US_DisableTx
2143
+ //* \brief Disable Transmitter
2144
+ //*----------------------------------------------------------------------------
2145
+ __inline void AT91F_US_DisableTx (
2146
+ AT91PS_USART pUSART) // \arg pointer to a USART controller
2147
+ {
2148
+ //* Disable transmitter
2149
+ pUSART->US_CR = AT91C_US_TXDIS;
2150
+ }
2151
+
2152
+ //*----------------------------------------------------------------------------
2153
+ //* \fn AT91F_US_Close
2154
+ //* \brief Close USART: disable IT disable receiver and transmitter, close PDC
2155
+ //*----------------------------------------------------------------------------
2156
+ __inline void AT91F_US_Close (
2157
+ AT91PS_USART pUSART) // \arg pointer to a USART controller
2158
+ {
2159
+ //* Reset the baud rate divisor register
2160
+ pUSART->US_BRGR = 0 ;
2161
+
2162
+ //* Reset the USART mode
2163
+ pUSART->US_MR = 0 ;
2164
+
2165
+ //* Reset the Timeguard Register
2166
+ pUSART->US_TTGR = 0;
2167
+
2168
+ //* Disable all interrupts
2169
+ pUSART->US_IDR = 0xFFFFFFFF ;
2170
+
2171
+ //* Abort the Peripheral Data Transfers
2172
+ AT91F_PDC_Close((AT91PS_PDC) &(pUSART->US_RPR));
2173
+
2174
+ //* Disable receiver and transmitter and stop any activity immediately
2175
+ pUSART->US_CR = AT91C_US_TXDIS | AT91C_US_RXDIS | AT91C_US_RSTTX | AT91C_US_RSTRX ;
2176
+ }
2177
+
2178
+ //*----------------------------------------------------------------------------
2179
+ //* \fn AT91F_US_TxReady
2180
+ //* \brief Return 1 if a character can be written in US_THR
2181
+ //*----------------------------------------------------------------------------
2182
+ __inline unsigned int AT91F_US_TxReady (
2183
+ AT91PS_USART pUSART ) // \arg pointer to a USART controller
2184
+ {
2185
+ return (pUSART->US_CSR & AT91C_US_TXRDY);
2186
+ }
2187
+
2188
+ //*----------------------------------------------------------------------------
2189
+ //* \fn AT91F_US_RxReady
2190
+ //* \brief Return 1 if a character can be read in US_RHR
2191
+ //*----------------------------------------------------------------------------
2192
+ __inline unsigned int AT91F_US_RxReady (
2193
+ AT91PS_USART pUSART ) // \arg pointer to a USART controller
2194
+ {
2195
+ return (pUSART->US_CSR & AT91C_US_RXRDY);
2196
+ }
2197
+
2198
+ //*----------------------------------------------------------------------------
2199
+ //* \fn AT91F_US_Error
2200
+ //* \brief Return the error flag
2201
+ //*----------------------------------------------------------------------------
2202
+ __inline unsigned int AT91F_US_Error (
2203
+ AT91PS_USART pUSART ) // \arg pointer to a USART controller
2204
+ {
2205
+ return (pUSART->US_CSR &
2206
+ (AT91C_US_OVRE | // Overrun error
2207
+ AT91C_US_FRAME | // Framing error
2208
+ AT91C_US_PARE)); // Parity error
2209
+ }
2210
+
2211
+ //*----------------------------------------------------------------------------
2212
+ //* \fn AT91F_US_PutChar
2213
+ //* \brief Send a character,does not check if ready to send
2214
+ //*----------------------------------------------------------------------------
2215
+ __inline void AT91F_US_PutChar (
2216
+ AT91PS_USART pUSART,
2217
+ int character )
2218
+ {
2219
+ pUSART->US_THR = (character & 0x1FF);
2220
+ }
2221
+
2222
+ //*----------------------------------------------------------------------------
2223
+ //* \fn AT91F_US_GetChar
2224
+ //* \brief Receive a character,does not check if a character is available
2225
+ //*----------------------------------------------------------------------------
2226
+ __inline int AT91F_US_GetChar (
2227
+ const AT91PS_USART pUSART)
2228
+ {
2229
+ return((pUSART->US_RHR) & 0x1FF);
2230
+ }
2231
+
2232
+ //*----------------------------------------------------------------------------
2233
+ //* \fn AT91F_US_SendFrame
2234
+ //* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy
2235
+ //*----------------------------------------------------------------------------
2236
+ __inline unsigned int AT91F_US_SendFrame(
2237
+ AT91PS_USART pUSART,
2238
+ char *pBuffer,
2239
+ unsigned int szBuffer,
2240
+ char *pNextBuffer,
2241
+ unsigned int szNextBuffer )
2242
+ {
2243
+ return AT91F_PDC_SendFrame(
2244
+ (AT91PS_PDC) &(pUSART->US_RPR),
2245
+ pBuffer,
2246
+ szBuffer,
2247
+ pNextBuffer,
2248
+ szNextBuffer);
2249
+ }
2250
+
2251
+ //*----------------------------------------------------------------------------
2252
+ //* \fn AT91F_US_ReceiveFrame
2253
+ //* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy
2254
+ //*----------------------------------------------------------------------------
2255
+ __inline unsigned int AT91F_US_ReceiveFrame (
2256
+ AT91PS_USART pUSART,
2257
+ char *pBuffer,
2258
+ unsigned int szBuffer,
2259
+ char *pNextBuffer,
2260
+ unsigned int szNextBuffer )
2261
+ {
2262
+ return AT91F_PDC_ReceiveFrame(
2263
+ (AT91PS_PDC) &(pUSART->US_RPR),
2264
+ pBuffer,
2265
+ szBuffer,
2266
+ pNextBuffer,
2267
+ szNextBuffer);
2268
+ }
2269
+
2270
+ //*----------------------------------------------------------------------------
2271
+ //* \fn AT91F_US_SetIrdaFilter
2272
+ //* \brief Set the value of IrDa filter tregister
2273
+ //*----------------------------------------------------------------------------
2274
+ __inline void AT91F_US_SetIrdaFilter (
2275
+ AT91PS_USART pUSART,
2276
+ unsigned char value
2277
+ )
2278
+ {
2279
+ pUSART->US_IF = value;
2280
+ }
2281
+
2282
+ /* *****************************************************************************
2283
+ SOFTWARE API FOR SSC
2284
+ ***************************************************************************** */
2285
+ //* Define the standard I2S mode configuration
2286
+
2287
+ //* Configuration to set in the SSC Transmit Clock Mode Register
2288
+ //* Parameters : nb_bit_by_slot : 8, 16 or 32 bits
2289
+ //* nb_slot_by_frame : number of channels
2290
+ #define AT91C_I2S_ASY_MASTER_TX_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\
2291
+ AT91C_SSC_CKS_DIV +\
2292
+ AT91C_SSC_CKO_CONTINOUS +\
2293
+ AT91C_SSC_CKG_NONE +\
2294
+ AT91C_SSC_START_FALL_RF +\
2295
+ AT91C_SSC_STTOUT +\
2296
+ ((1<<16) & AT91C_SSC_STTDLY) +\
2297
+ ((((nb_bit_by_slot*nb_slot_by_frame)/2)-1) <<24))
2298
+
2299
+
2300
+ //* Configuration to set in the SSC Transmit Frame Mode Register
2301
+ //* Parameters : nb_bit_by_slot : 8, 16 or 32 bits
2302
+ //* nb_slot_by_frame : number of channels
2303
+ #define AT91C_I2S_ASY_TX_FRAME_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\
2304
+ (nb_bit_by_slot-1) +\
2305
+ AT91C_SSC_MSBF +\
2306
+ (((nb_slot_by_frame-1)<<8) & AT91C_SSC_DATNB) +\
2307
+ (((nb_bit_by_slot-1)<<16) & AT91C_SSC_FSLEN) +\
2308
+ AT91C_SSC_FSOS_NEGATIVE)
2309
+
2310
+
2311
+ //*----------------------------------------------------------------------------
2312
+ //* \fn AT91F_SSC_SetBaudrate
2313
+ //* \brief Set the baudrate according to the CPU clock
2314
+ //*----------------------------------------------------------------------------
2315
+ __inline void AT91F_SSC_SetBaudrate (
2316
+ AT91PS_SSC pSSC, // \arg pointer to a SSC controller
2317
+ unsigned int mainClock, // \arg peripheral clock
2318
+ unsigned int speed) // \arg SSC baudrate
2319
+ {
2320
+ unsigned int baud_value;
2321
+ //* Define the baud rate divisor register
2322
+ if (speed == 0)
2323
+ baud_value = 0;
2324
+ else
2325
+ {
2326
+ baud_value = (unsigned int) (mainClock * 10)/(2*speed);
2327
+ if ((baud_value % 10) >= 5)
2328
+ baud_value = (baud_value / 10) + 1;
2329
+ else
2330
+ baud_value /= 10;
2331
+ }
2332
+
2333
+ pSSC->SSC_CMR = baud_value;
2334
+ }
2335
+
2336
+ //*----------------------------------------------------------------------------
2337
+ //* \fn AT91F_SSC_Configure
2338
+ //* \brief Configure SSC
2339
+ //*----------------------------------------------------------------------------
2340
+ __inline void AT91F_SSC_Configure (
2341
+ AT91PS_SSC pSSC, // \arg pointer to a SSC controller
2342
+ unsigned int syst_clock, // \arg System Clock Frequency
2343
+ unsigned int baud_rate, // \arg Expected Baud Rate Frequency
2344
+ unsigned int clock_rx, // \arg Receiver Clock Parameters
2345
+ unsigned int mode_rx, // \arg mode Register to be programmed
2346
+ unsigned int clock_tx, // \arg Transmitter Clock Parameters
2347
+ unsigned int mode_tx) // \arg mode Register to be programmed
2348
+ {
2349
+ //* Disable interrupts
2350
+ pSSC->SSC_IDR = (unsigned int) -1;
2351
+
2352
+ //* Reset receiver and transmitter
2353
+ pSSC->SSC_CR = AT91C_SSC_SWRST | AT91C_SSC_RXDIS | AT91C_SSC_TXDIS ;
2354
+
2355
+ //* Define the Clock Mode Register
2356
+ AT91F_SSC_SetBaudrate(pSSC, syst_clock, baud_rate);
2357
+
2358
+ //* Write the Receive Clock Mode Register
2359
+ pSSC->SSC_RCMR = clock_rx;
2360
+
2361
+ //* Write the Transmit Clock Mode Register
2362
+ pSSC->SSC_TCMR = clock_tx;
2363
+
2364
+ //* Write the Receive Frame Mode Register
2365
+ pSSC->SSC_RFMR = mode_rx;
2366
+
2367
+ //* Write the Transmit Frame Mode Register
2368
+ pSSC->SSC_TFMR = mode_tx;
2369
+
2370
+ //* Clear Transmit and Receive Counters
2371
+ AT91F_PDC_Open((AT91PS_PDC) &(pSSC->SSC_RPR));
2372
+
2373
+
2374
+ }
2375
+
2376
+ //*----------------------------------------------------------------------------
2377
+ //* \fn AT91F_SSC_EnableRx
2378
+ //* \brief Enable receiving datas
2379
+ //*----------------------------------------------------------------------------
2380
+ __inline void AT91F_SSC_EnableRx (
2381
+ AT91PS_SSC pSSC) // \arg pointer to a SSC controller
2382
+ {
2383
+ //* Enable receiver
2384
+ pSSC->SSC_CR = AT91C_SSC_RXEN;
2385
+ }
2386
+
2387
+ //*----------------------------------------------------------------------------
2388
+ //* \fn AT91F_SSC_DisableRx
2389
+ //* \brief Disable receiving datas
2390
+ //*----------------------------------------------------------------------------
2391
+ __inline void AT91F_SSC_DisableRx (
2392
+ AT91PS_SSC pSSC) // \arg pointer to a SSC controller
2393
+ {
2394
+ //* Disable receiver
2395
+ pSSC->SSC_CR = AT91C_SSC_RXDIS;
2396
+ }
2397
+
2398
+ //*----------------------------------------------------------------------------
2399
+ //* \fn AT91F_SSC_EnableTx
2400
+ //* \brief Enable sending datas
2401
+ //*----------------------------------------------------------------------------
2402
+ __inline void AT91F_SSC_EnableTx (
2403
+ AT91PS_SSC pSSC) // \arg pointer to a SSC controller
2404
+ {
2405
+ //* Enable transmitter
2406
+ pSSC->SSC_CR = AT91C_SSC_TXEN;
2407
+ }
2408
+
2409
+ //*----------------------------------------------------------------------------
2410
+ //* \fn AT91F_SSC_DisableTx
2411
+ //* \brief Disable sending datas
2412
+ //*----------------------------------------------------------------------------
2413
+ __inline void AT91F_SSC_DisableTx (
2414
+ AT91PS_SSC pSSC) // \arg pointer to a SSC controller
2415
+ {
2416
+ //* Disable transmitter
2417
+ pSSC->SSC_CR = AT91C_SSC_TXDIS;
2418
+ }
2419
+
2420
+ //*----------------------------------------------------------------------------
2421
+ //* \fn AT91F_SSC_EnableIt
2422
+ //* \brief Enable SSC IT
2423
+ //*----------------------------------------------------------------------------
2424
+ __inline void AT91F_SSC_EnableIt (
2425
+ AT91PS_SSC pSSC, // \arg pointer to a SSC controller
2426
+ unsigned int flag) // \arg IT to be enabled
2427
+ {
2428
+ //* Write to the IER register
2429
+ pSSC->SSC_IER = flag;
2430
+ }
2431
+
2432
+ //*----------------------------------------------------------------------------
2433
+ //* \fn AT91F_SSC_DisableIt
2434
+ //* \brief Disable SSC IT
2435
+ //*----------------------------------------------------------------------------
2436
+ __inline void AT91F_SSC_DisableIt (
2437
+ AT91PS_SSC pSSC, // \arg pointer to a SSC controller
2438
+ unsigned int flag) // \arg IT to be disabled
2439
+ {
2440
+ //* Write to the IDR register
2441
+ pSSC->SSC_IDR = flag;
2442
+ }
2443
+
2444
+ //*----------------------------------------------------------------------------
2445
+ //* \fn AT91F_SSC_ReceiveFrame
2446
+ //* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy
2447
+ //*----------------------------------------------------------------------------
2448
+ __inline unsigned int AT91F_SSC_ReceiveFrame (
2449
+ AT91PS_SSC pSSC,
2450
+ char *pBuffer,
2451
+ unsigned int szBuffer,
2452
+ char *pNextBuffer,
2453
+ unsigned int szNextBuffer )
2454
+ {
2455
+ return AT91F_PDC_ReceiveFrame(
2456
+ (AT91PS_PDC) &(pSSC->SSC_RPR),
2457
+ pBuffer,
2458
+ szBuffer,
2459
+ pNextBuffer,
2460
+ szNextBuffer);
2461
+ }
2462
+
2463
+ //*----------------------------------------------------------------------------
2464
+ //* \fn AT91F_SSC_SendFrame
2465
+ //* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy
2466
+ //*----------------------------------------------------------------------------
2467
+ __inline unsigned int AT91F_SSC_SendFrame(
2468
+ AT91PS_SSC pSSC,
2469
+ char *pBuffer,
2470
+ unsigned int szBuffer,
2471
+ char *pNextBuffer,
2472
+ unsigned int szNextBuffer )
2473
+ {
2474
+ return AT91F_PDC_SendFrame(
2475
+ (AT91PS_PDC) &(pSSC->SSC_RPR),
2476
+ pBuffer,
2477
+ szBuffer,
2478
+ pNextBuffer,
2479
+ szNextBuffer);
2480
+ }
2481
+
2482
+ //*----------------------------------------------------------------------------
2483
+ //* \fn AT91F_SSC_GetInterruptMaskStatus
2484
+ //* \brief Return SSC Interrupt Mask Status
2485
+ //*----------------------------------------------------------------------------
2486
+ __inline unsigned int AT91F_SSC_GetInterruptMaskStatus( // \return SSC Interrupt Mask Status
2487
+ AT91PS_SSC pSsc) // \arg pointer to a SSC controller
2488
+ {
2489
+ return pSsc->SSC_IMR;
2490
+ }
2491
+
2492
+ //*----------------------------------------------------------------------------
2493
+ //* \fn AT91F_SSC_IsInterruptMasked
2494
+ //* \brief Test if SSC Interrupt is Masked
2495
+ //*----------------------------------------------------------------------------
2496
+ __inline int AT91F_SSC_IsInterruptMasked(
2497
+ AT91PS_SSC pSsc, // \arg pointer to a SSC controller
2498
+ unsigned int flag) // \arg flag to be tested
2499
+ {
2500
+ return (AT91F_SSC_GetInterruptMaskStatus(pSsc) & flag);
2501
+ }
2502
+
2503
+ /* *****************************************************************************
2504
+ SOFTWARE API FOR TWI
2505
+ ***************************************************************************** */
2506
+ //*----------------------------------------------------------------------------
2507
+ //* \fn AT91F_TWI_EnableIt
2508
+ //* \brief Enable TWI IT
2509
+ //*----------------------------------------------------------------------------
2510
+ __inline void AT91F_TWI_EnableIt (
2511
+ AT91PS_TWI pTWI, // \arg pointer to a TWI controller
2512
+ unsigned int flag) // \arg IT to be enabled
2513
+ {
2514
+ //* Write to the IER register
2515
+ pTWI->TWI_IER = flag;
2516
+ }
2517
+
2518
+ //*----------------------------------------------------------------------------
2519
+ //* \fn AT91F_TWI_DisableIt
2520
+ //* \brief Disable TWI IT
2521
+ //*----------------------------------------------------------------------------
2522
+ __inline void AT91F_TWI_DisableIt (
2523
+ AT91PS_TWI pTWI, // \arg pointer to a TWI controller
2524
+ unsigned int flag) // \arg IT to be disabled
2525
+ {
2526
+ //* Write to the IDR register
2527
+ pTWI->TWI_IDR = flag;
2528
+ }
2529
+
2530
+ //*----------------------------------------------------------------------------
2531
+ //* \fn AT91F_TWI_Configure
2532
+ //* \brief Configure TWI in master mode
2533
+ //*----------------------------------------------------------------------------
2534
+ __inline void AT91F_TWI_Configure ( AT91PS_TWI pTWI ) // \arg pointer to a TWI controller
2535
+ {
2536
+ //* Disable interrupts
2537
+ pTWI->TWI_IDR = (unsigned int) -1;
2538
+
2539
+ //* Reset peripheral
2540
+ pTWI->TWI_CR = AT91C_TWI_SWRST;
2541
+
2542
+ //* Set Master mode
2543
+ pTWI->TWI_CR = AT91C_TWI_MSEN;
2544
+
2545
+ }
2546
+
2547
+ //*----------------------------------------------------------------------------
2548
+ //* \fn AT91F_TWI_GetInterruptMaskStatus
2549
+ //* \brief Return TWI Interrupt Mask Status
2550
+ //*----------------------------------------------------------------------------
2551
+ __inline unsigned int AT91F_TWI_GetInterruptMaskStatus( // \return TWI Interrupt Mask Status
2552
+ AT91PS_TWI pTwi) // \arg pointer to a TWI controller
2553
+ {
2554
+ return pTwi->TWI_IMR;
2555
+ }
2556
+
2557
+ //*----------------------------------------------------------------------------
2558
+ //* \fn AT91F_TWI_IsInterruptMasked
2559
+ //* \brief Test if TWI Interrupt is Masked
2560
+ //*----------------------------------------------------------------------------
2561
+ __inline int AT91F_TWI_IsInterruptMasked(
2562
+ AT91PS_TWI pTwi, // \arg pointer to a TWI controller
2563
+ unsigned int flag) // \arg flag to be tested
2564
+ {
2565
+ return (AT91F_TWI_GetInterruptMaskStatus(pTwi) & flag);
2566
+ }
2567
+
2568
+ /* *****************************************************************************
2569
+ SOFTWARE API FOR PWMC
2570
+ ***************************************************************************** */
2571
+ //*----------------------------------------------------------------------------
2572
+ //* \fn AT91F_PWM_GetStatus
2573
+ //* \brief Return PWM Interrupt Status
2574
+ //*----------------------------------------------------------------------------
2575
+ __inline unsigned int AT91F_PWMC_GetStatus( // \return PWM Interrupt Status
2576
+ AT91PS_PWMC pPWM) // pointer to a PWM controller
2577
+ {
2578
+ return pPWM->PWMC_SR;
2579
+ }
2580
+
2581
+ //*----------------------------------------------------------------------------
2582
+ //* \fn AT91F_PWM_InterruptEnable
2583
+ //* \brief Enable PWM Interrupt
2584
+ //*----------------------------------------------------------------------------
2585
+ __inline void AT91F_PWMC_InterruptEnable(
2586
+ AT91PS_PWMC pPwm, // \arg pointer to a PWM controller
2587
+ unsigned int flag) // \arg PWM interrupt to be enabled
2588
+ {
2589
+ pPwm->PWMC_IER = flag;
2590
+ }
2591
+
2592
+ //*----------------------------------------------------------------------------
2593
+ //* \fn AT91F_PWM_InterruptDisable
2594
+ //* \brief Disable PWM Interrupt
2595
+ //*----------------------------------------------------------------------------
2596
+ __inline void AT91F_PWMC_InterruptDisable(
2597
+ AT91PS_PWMC pPwm, // \arg pointer to a PWM controller
2598
+ unsigned int flag) // \arg PWM interrupt to be disabled
2599
+ {
2600
+ pPwm->PWMC_IDR = flag;
2601
+ }
2602
+
2603
+ //*----------------------------------------------------------------------------
2604
+ //* \fn AT91F_PWM_GetInterruptMaskStatus
2605
+ //* \brief Return PWM Interrupt Mask Status
2606
+ //*----------------------------------------------------------------------------
2607
+ __inline unsigned int AT91F_PWMC_GetInterruptMaskStatus( // \return PWM Interrupt Mask Status
2608
+ AT91PS_PWMC pPwm) // \arg pointer to a PWM controller
2609
+ {
2610
+ return pPwm->PWMC_IMR;
2611
+ }
2612
+
2613
+ //*----------------------------------------------------------------------------
2614
+ //* \fn AT91F_PWM_IsInterruptMasked
2615
+ //* \brief Test if PWM Interrupt is Masked
2616
+ //*----------------------------------------------------------------------------
2617
+ __inline unsigned int AT91F_PWMC_IsInterruptMasked(
2618
+ AT91PS_PWMC pPWM, // \arg pointer to a PWM controller
2619
+ unsigned int flag) // \arg flag to be tested
2620
+ {
2621
+ return (AT91F_PWMC_GetInterruptMaskStatus(pPWM) & flag);
2622
+ }
2623
+
2624
+ //*----------------------------------------------------------------------------
2625
+ //* \fn AT91F_PWM_IsStatusSet
2626
+ //* \brief Test if PWM Interrupt is Set
2627
+ //*----------------------------------------------------------------------------
2628
+ __inline unsigned int AT91F_PWMC_IsStatusSet(
2629
+ AT91PS_PWMC pPWM, // \arg pointer to a PWM controller
2630
+ unsigned int flag) // \arg flag to be tested
2631
+ {
2632
+ return (AT91F_PWMC_GetStatus(pPWM) & flag);
2633
+ }
2634
+
2635
+ //*----------------------------------------------------------------------------
2636
+ //* \fn AT91F_PWM_CfgChannel
2637
+ //* \brief Test if PWM Interrupt is Set
2638
+ //*----------------------------------------------------------------------------
2639
+ __inline void AT91F_PWMC_CfgChannel(
2640
+ AT91PS_PWMC pPWM, // \arg pointer to a PWM controller
2641
+ unsigned int channelId, // \arg PWM channel ID
2642
+ unsigned int mode, // \arg PWM mode
2643
+ unsigned int period, // \arg PWM period
2644
+ unsigned int duty) // \arg PWM duty cycle
2645
+ {
2646
+ pPWM->PWMC_CH[channelId].PWMC_CMR = mode;
2647
+ pPWM->PWMC_CH[channelId].PWMC_CDTYR = duty;
2648
+ pPWM->PWMC_CH[channelId].PWMC_CPRDR = period;
2649
+ }
2650
+
2651
+ //*----------------------------------------------------------------------------
2652
+ //* \fn AT91F_PWM_StartChannel
2653
+ //* \brief Enable channel
2654
+ //*----------------------------------------------------------------------------
2655
+ __inline void AT91F_PWMC_StartChannel(
2656
+ AT91PS_PWMC pPWM, // \arg pointer to a PWM controller
2657
+ unsigned int flag) // \arg Channels IDs to be enabled
2658
+ {
2659
+ pPWM->PWMC_ENA = flag;
2660
+ }
2661
+
2662
+ //*----------------------------------------------------------------------------
2663
+ //* \fn AT91F_PWM_StopChannel
2664
+ //* \brief Disable channel
2665
+ //*----------------------------------------------------------------------------
2666
+ __inline void AT91F_PWMC_StopChannel(
2667
+ AT91PS_PWMC pPWM, // \arg pointer to a PWM controller
2668
+ unsigned int flag) // \arg Channels IDs to be enabled
2669
+ {
2670
+ pPWM->PWMC_DIS = flag;
2671
+ }
2672
+
2673
+ //*----------------------------------------------------------------------------
2674
+ //* \fn AT91F_PWM_UpdateChannel
2675
+ //* \brief Update Period or Duty Cycle
2676
+ //*----------------------------------------------------------------------------
2677
+ __inline void AT91F_PWMC_UpdateChannel(
2678
+ AT91PS_PWMC pPWM, // \arg pointer to a PWM controller
2679
+ unsigned int channelId, // \arg PWM channel ID
2680
+ unsigned int update) // \arg Channels IDs to be enabled
2681
+ {
2682
+ pPWM->PWMC_CH[channelId].PWMC_CUPDR = update;
2683
+ }
2684
+
2685
+ /* *****************************************************************************
2686
+ SOFTWARE API FOR UDP
2687
+ ***************************************************************************** */
2688
+ //*----------------------------------------------------------------------------
2689
+ //* \fn AT91F_UDP_EnableIt
2690
+ //* \brief Enable UDP IT
2691
+ //*----------------------------------------------------------------------------
2692
+ __inline void AT91F_UDP_EnableIt (
2693
+ AT91PS_UDP pUDP, // \arg pointer to a UDP controller
2694
+ unsigned int flag) // \arg IT to be enabled
2695
+ {
2696
+ //* Write to the IER register
2697
+ pUDP->UDP_IER = flag;
2698
+ }
2699
+
2700
+ //*----------------------------------------------------------------------------
2701
+ //* \fn AT91F_UDP_DisableIt
2702
+ //* \brief Disable UDP IT
2703
+ //*----------------------------------------------------------------------------
2704
+ __inline void AT91F_UDP_DisableIt (
2705
+ AT91PS_UDP pUDP, // \arg pointer to a UDP controller
2706
+ unsigned int flag) // \arg IT to be disabled
2707
+ {
2708
+ //* Write to the IDR register
2709
+ pUDP->UDP_IDR = flag;
2710
+ }
2711
+
2712
+ //*----------------------------------------------------------------------------
2713
+ //* \fn AT91F_UDP_SetAddress
2714
+ //* \brief Set UDP functional address
2715
+ //*----------------------------------------------------------------------------
2716
+ __inline void AT91F_UDP_SetAddress (
2717
+ AT91PS_UDP pUDP, // \arg pointer to a UDP controller
2718
+ unsigned char address) // \arg new UDP address
2719
+ {
2720
+ pUDP->UDP_FADDR = (AT91C_UDP_FEN | address);
2721
+ }
2722
+
2723
+ //*----------------------------------------------------------------------------
2724
+ //* \fn AT91F_UDP_EnableEp
2725
+ //* \brief Enable Endpoint
2726
+ //*----------------------------------------------------------------------------
2727
+ __inline void AT91F_UDP_EnableEp (
2728
+ AT91PS_UDP pUDP, // \arg pointer to a UDP controller
2729
+ unsigned char endpoint) // \arg endpoint number
2730
+ {
2731
+ pUDP->UDP_CSR[endpoint] |= AT91C_UDP_EPEDS;
2732
+ }
2733
+
2734
+ //*----------------------------------------------------------------------------
2735
+ //* \fn AT91F_UDP_DisableEp
2736
+ //* \brief Enable Endpoint
2737
+ //*----------------------------------------------------------------------------
2738
+ __inline void AT91F_UDP_DisableEp (
2739
+ AT91PS_UDP pUDP, // \arg pointer to a UDP controller
2740
+ unsigned char endpoint) // \arg endpoint number
2741
+ {
2742
+ pUDP->UDP_CSR[endpoint] &= ~AT91C_UDP_EPEDS;
2743
+ }
2744
+
2745
+ //*----------------------------------------------------------------------------
2746
+ //* \fn AT91F_UDP_SetState
2747
+ //* \brief Set UDP Device state
2748
+ //*----------------------------------------------------------------------------
2749
+ __inline void AT91F_UDP_SetState (
2750
+ AT91PS_UDP pUDP, // \arg pointer to a UDP controller
2751
+ unsigned int flag) // \arg new UDP address
2752
+ {
2753
+ pUDP->UDP_GLBSTATE &= ~(AT91C_UDP_FADDEN | AT91C_UDP_CONFG);
2754
+ pUDP->UDP_GLBSTATE |= flag;
2755
+ }
2756
+
2757
+ //*----------------------------------------------------------------------------
2758
+ //* \fn AT91F_UDP_GetState
2759
+ //* \brief return UDP Device state
2760
+ //*----------------------------------------------------------------------------
2761
+ __inline unsigned int AT91F_UDP_GetState ( // \return the UDP device state
2762
+ AT91PS_UDP pUDP) // \arg pointer to a UDP controller
2763
+ {
2764
+ return (pUDP->UDP_GLBSTATE & (AT91C_UDP_FADDEN | AT91C_UDP_CONFG));
2765
+ }
2766
+
2767
+ //*----------------------------------------------------------------------------
2768
+ //* \fn AT91F_UDP_ResetEp
2769
+ //* \brief Reset UDP endpoint
2770
+ //*----------------------------------------------------------------------------
2771
+ __inline void AT91F_UDP_ResetEp ( // \return the UDP device state
2772
+ AT91PS_UDP pUDP, // \arg pointer to a UDP controller
2773
+ unsigned int flag) // \arg Endpoints to be reset
2774
+ {
2775
+ pUDP->UDP_RSTEP = flag;
2776
+ pUDP->UDP_RSTEP = 0;
2777
+ }
2778
+
2779
+ //*----------------------------------------------------------------------------
2780
+ //* \fn AT91F_UDP_EpStall
2781
+ //* \brief Endpoint will STALL requests
2782
+ //*----------------------------------------------------------------------------
2783
+ __inline void AT91F_UDP_EpStall(
2784
+ AT91PS_UDP pUDP, // \arg pointer to a UDP controller
2785
+ unsigned char endpoint) // \arg endpoint number
2786
+ {
2787
+ pUDP->UDP_CSR[endpoint] |= AT91C_UDP_FORCESTALL;
2788
+ }
2789
+
2790
+ //*----------------------------------------------------------------------------
2791
+ //* \fn AT91F_UDP_EpWrite
2792
+ //* \brief Write value in the DPR
2793
+ //*----------------------------------------------------------------------------
2794
+ __inline void AT91F_UDP_EpWrite(
2795
+ AT91PS_UDP pUDP, // \arg pointer to a UDP controller
2796
+ unsigned char endpoint, // \arg endpoint number
2797
+ unsigned char value) // \arg value to be written in the DPR
2798
+ {
2799
+ pUDP->UDP_FDR[endpoint] = value;
2800
+ }
2801
+
2802
+ //*----------------------------------------------------------------------------
2803
+ //* \fn AT91F_UDP_EpRead
2804
+ //* \brief Return value from the DPR
2805
+ //*----------------------------------------------------------------------------
2806
+ __inline unsigned int AT91F_UDP_EpRead(
2807
+ AT91PS_UDP pUDP, // \arg pointer to a UDP controller
2808
+ unsigned char endpoint) // \arg endpoint number
2809
+ {
2810
+ return pUDP->UDP_FDR[endpoint];
2811
+ }
2812
+
2813
+ //*----------------------------------------------------------------------------
2814
+ //* \fn AT91F_UDP_EpEndOfWr
2815
+ //* \brief Notify the UDP that values in DPR are ready to be sent
2816
+ //*----------------------------------------------------------------------------
2817
+ __inline void AT91F_UDP_EpEndOfWr(
2818
+ AT91PS_UDP pUDP, // \arg pointer to a UDP controller
2819
+ unsigned char endpoint) // \arg endpoint number
2820
+ {
2821
+ pUDP->UDP_CSR[endpoint] |= AT91C_UDP_TXPKTRDY;
2822
+ }
2823
+
2824
+ //*----------------------------------------------------------------------------
2825
+ //* \fn AT91F_UDP_EpClear
2826
+ //* \brief Clear flag in the endpoint CSR register
2827
+ //*----------------------------------------------------------------------------
2828
+ __inline void AT91F_UDP_EpClear(
2829
+ AT91PS_UDP pUDP, // \arg pointer to a UDP controller
2830
+ unsigned char endpoint, // \arg endpoint number
2831
+ unsigned int flag) // \arg flag to be cleared
2832
+ {
2833
+ pUDP->UDP_CSR[endpoint] &= ~(flag);
2834
+ }
2835
+
2836
+ //*----------------------------------------------------------------------------
2837
+ //* \fn AT91F_UDP_EpSet
2838
+ //* \brief Set flag in the endpoint CSR register
2839
+ //*----------------------------------------------------------------------------
2840
+ __inline void AT91F_UDP_EpSet(
2841
+ AT91PS_UDP pUDP, // \arg pointer to a UDP controller
2842
+ unsigned char endpoint, // \arg endpoint number
2843
+ unsigned int flag) // \arg flag to be cleared
2844
+ {
2845
+ pUDP->UDP_CSR[endpoint] |= flag;
2846
+ }
2847
+
2848
+ //*----------------------------------------------------------------------------
2849
+ //* \fn AT91F_UDP_EpStatus
2850
+ //* \brief Return the endpoint CSR register
2851
+ //*----------------------------------------------------------------------------
2852
+ __inline unsigned int AT91F_UDP_EpStatus(
2853
+ AT91PS_UDP pUDP, // \arg pointer to a UDP controller
2854
+ unsigned char endpoint) // \arg endpoint number
2855
+ {
2856
+ return pUDP->UDP_CSR[endpoint];
2857
+ }
2858
+
2859
+ //*----------------------------------------------------------------------------
2860
+ //* \fn AT91F_UDP_GetInterruptMaskStatus
2861
+ //* \brief Return UDP Interrupt Mask Status
2862
+ //*----------------------------------------------------------------------------
2863
+ __inline unsigned int AT91F_UDP_GetInterruptMaskStatus(
2864
+ AT91PS_UDP pUdp) // \arg pointer to a UDP controller
2865
+ {
2866
+ return pUdp->UDP_IMR;
2867
+ }
2868
+
2869
+ //*----------------------------------------------------------------------------
2870
+ //* \fn AT91F_UDP_IsInterruptMasked
2871
+ //* \brief Test if UDP Interrupt is Masked
2872
+ //*----------------------------------------------------------------------------
2873
+ __inline int AT91F_UDP_IsInterruptMasked(
2874
+ AT91PS_UDP pUdp, // \arg pointer to a UDP controller
2875
+ unsigned int flag) // \arg flag to be tested
2876
+ {
2877
+ return (AT91F_UDP_GetInterruptMaskStatus(pUdp) & flag);
2878
+ }
2879
+
2880
+ // ----------------------------------------------------------------------------
2881
+ // \fn AT91F_UDP_InterruptStatusRegister
2882
+ // \brief Return the Interrupt Status Register
2883
+ // ----------------------------------------------------------------------------
2884
+ __inline unsigned int AT91F_UDP_InterruptStatusRegister(
2885
+ AT91PS_UDP pUDP ) // \arg pointer to a UDP controller
2886
+ {
2887
+ return pUDP->UDP_ISR;
2888
+ }
2889
+
2890
+ // ----------------------------------------------------------------------------
2891
+ // \fn AT91F_UDP_InterruptClearRegister
2892
+ // \brief Clear Interrupt Register
2893
+ // ----------------------------------------------------------------------------
2894
+ __inline void AT91F_UDP_InterruptClearRegister (
2895
+ AT91PS_UDP pUDP, // \arg pointer to UDP controller
2896
+ unsigned int flag) // \arg IT to be cleat
2897
+ {
2898
+ pUDP->UDP_ICR = flag;
2899
+ }
2900
+
2901
+ // ----------------------------------------------------------------------------
2902
+ // \fn AT91F_UDP_EnableTransceiver
2903
+ // \brief Enable transceiver
2904
+ // ----------------------------------------------------------------------------
2905
+ __inline void AT91F_UDP_EnableTransceiver(
2906
+ AT91PS_UDP pUDP ) // \arg pointer to a UDP controller
2907
+ {
2908
+ pUDP->UDP_TXVC &= ~AT91C_UDP_TXVDIS;
2909
+ }
2910
+
2911
+ // ----------------------------------------------------------------------------
2912
+ // \fn AT91F_UDP_DisableTransceiver
2913
+ // \brief Disable transceiver
2914
+ // ----------------------------------------------------------------------------
2915
+ __inline void AT91F_UDP_DisableTransceiver(
2916
+ AT91PS_UDP pUDP ) // \arg pointer to a UDP controller
2917
+ {
2918
+ pUDP->UDP_TXVC = AT91C_UDP_TXVDIS;
2919
+ }
2920
+
2921
+ /* *****************************************************************************
2922
+ SOFTWARE API FOR TC
2923
+ ***************************************************************************** */
2924
+ //*----------------------------------------------------------------------------
2925
+ //* \fn AT91F_TC_InterruptEnable
2926
+ //* \brief Enable TC Interrupt
2927
+ //*----------------------------------------------------------------------------
2928
+ __inline void AT91F_TC_InterruptEnable(
2929
+ AT91PS_TC pTc, // \arg pointer to a TC controller
2930
+ unsigned int flag) // \arg TC interrupt to be enabled
2931
+ {
2932
+ pTc->TC_IER = flag;
2933
+ }
2934
+
2935
+ //*----------------------------------------------------------------------------
2936
+ //* \fn AT91F_TC_InterruptDisable
2937
+ //* \brief Disable TC Interrupt
2938
+ //*----------------------------------------------------------------------------
2939
+ __inline void AT91F_TC_InterruptDisable(
2940
+ AT91PS_TC pTc, // \arg pointer to a TC controller
2941
+ unsigned int flag) // \arg TC interrupt to be disabled
2942
+ {
2943
+ pTc->TC_IDR = flag;
2944
+ }
2945
+
2946
+ //*----------------------------------------------------------------------------
2947
+ //* \fn AT91F_TC_GetInterruptMaskStatus
2948
+ //* \brief Return TC Interrupt Mask Status
2949
+ //*----------------------------------------------------------------------------
2950
+ __inline unsigned int AT91F_TC_GetInterruptMaskStatus( // \return TC Interrupt Mask Status
2951
+ AT91PS_TC pTc) // \arg pointer to a TC controller
2952
+ {
2953
+ return pTc->TC_IMR;
2954
+ }
2955
+
2956
+ //*----------------------------------------------------------------------------
2957
+ //* \fn AT91F_TC_IsInterruptMasked
2958
+ //* \brief Test if TC Interrupt is Masked
2959
+ //*----------------------------------------------------------------------------
2960
+ __inline int AT91F_TC_IsInterruptMasked(
2961
+ AT91PS_TC pTc, // \arg pointer to a TC controller
2962
+ unsigned int flag) // \arg flag to be tested
2963
+ {
2964
+ return (AT91F_TC_GetInterruptMaskStatus(pTc) & flag);
2965
+ }
2966
+
2967
+ /* *****************************************************************************
2968
+ SOFTWARE API FOR CAN
2969
+ ***************************************************************************** */
2970
+ #define STANDARD_FORMAT 0
2971
+ #define EXTENDED_FORMAT 1
2972
+
2973
+ //*----------------------------------------------------------------------------
2974
+ //* \fn AT91F_InitMailboxRegisters()
2975
+ //* \brief Configure the corresponding mailbox
2976
+ //*----------------------------------------------------------------------------
2977
+ __inline void AT91F_InitMailboxRegisters(AT91PS_CAN_MB CAN_Mailbox,
2978
+ int mode_reg,
2979
+ int acceptance_mask_reg,
2980
+ int id_reg,
2981
+ int data_low_reg,
2982
+ int data_high_reg,
2983
+ int control_reg)
2984
+ {
2985
+ CAN_Mailbox->CAN_MB_MCR = 0x0;
2986
+ CAN_Mailbox->CAN_MB_MMR = mode_reg;
2987
+ CAN_Mailbox->CAN_MB_MAM = acceptance_mask_reg;
2988
+ CAN_Mailbox->CAN_MB_MID = id_reg;
2989
+ CAN_Mailbox->CAN_MB_MDL = data_low_reg;
2990
+ CAN_Mailbox->CAN_MB_MDH = data_high_reg;
2991
+ CAN_Mailbox->CAN_MB_MCR = control_reg;
2992
+ }
2993
+
2994
+ //*----------------------------------------------------------------------------
2995
+ //* \fn AT91F_EnableCAN()
2996
+ //* \brief
2997
+ //*----------------------------------------------------------------------------
2998
+ __inline void AT91F_EnableCAN(
2999
+ AT91PS_CAN pCAN) // pointer to a CAN controller
3000
+ {
3001
+ pCAN->CAN_MR |= AT91C_CAN_CANEN;
3002
+
3003
+ // Wait for WAKEUP flag raising <=> 11-recessive-bit were scanned by the transceiver
3004
+ while( (pCAN->CAN_SR & AT91C_CAN_WAKEUP) != AT91C_CAN_WAKEUP );
3005
+ }
3006
+
3007
+ //*----------------------------------------------------------------------------
3008
+ //* \fn AT91F_DisableCAN()
3009
+ //* \brief
3010
+ //*----------------------------------------------------------------------------
3011
+ __inline void AT91F_DisableCAN(
3012
+ AT91PS_CAN pCAN) // pointer to a CAN controller
3013
+ {
3014
+ pCAN->CAN_MR &= ~AT91C_CAN_CANEN;
3015
+ }
3016
+
3017
+ //*----------------------------------------------------------------------------
3018
+ //* \fn AT91F_CAN_EnableIt
3019
+ //* \brief Enable CAN interrupt
3020
+ //*----------------------------------------------------------------------------
3021
+ __inline void AT91F_CAN_EnableIt (
3022
+ AT91PS_CAN pCAN, // pointer to a CAN controller
3023
+ unsigned int flag) // IT to be enabled
3024
+ {
3025
+ //* Write to the IER register
3026
+ pCAN->CAN_IER = flag;
3027
+ }
3028
+
3029
+ //*----------------------------------------------------------------------------
3030
+ //* \fn AT91F_CAN_DisableIt
3031
+ //* \brief Disable CAN interrupt
3032
+ //*----------------------------------------------------------------------------
3033
+ __inline void AT91F_CAN_DisableIt (
3034
+ AT91PS_CAN pCAN, // pointer to a CAN controller
3035
+ unsigned int flag) // IT to be disabled
3036
+ {
3037
+ //* Write to the IDR register
3038
+ pCAN->CAN_IDR = flag;
3039
+ }
3040
+
3041
+ //*----------------------------------------------------------------------------
3042
+ //* \fn AT91F_CAN_GetStatus
3043
+ //* \brief Return CAN Interrupt Status
3044
+ //*----------------------------------------------------------------------------
3045
+ __inline unsigned int AT91F_CAN_GetStatus( // \return CAN Interrupt Status
3046
+ AT91PS_CAN pCAN) // pointer to a CAN controller
3047
+ {
3048
+ return pCAN->CAN_SR;
3049
+ }
3050
+
3051
+ //*----------------------------------------------------------------------------
3052
+ //* \fn AT91F_CAN_GetInterruptMaskStatus
3053
+ //* \brief Return CAN Interrupt Mask Status
3054
+ //*----------------------------------------------------------------------------
3055
+ __inline unsigned int AT91F_CAN_GetInterruptMaskStatus( // \return CAN Interrupt Mask Status
3056
+ AT91PS_CAN pCAN) // pointer to a CAN controller
3057
+ {
3058
+ return pCAN->CAN_IMR;
3059
+ }
3060
+
3061
+ //*----------------------------------------------------------------------------
3062
+ //* \fn AT91F_CAN_IsInterruptMasked
3063
+ //* \brief Test if CAN Interrupt is Masked
3064
+ //*----------------------------------------------------------------------------
3065
+ __inline unsigned int AT91F_CAN_IsInterruptMasked(
3066
+ AT91PS_CAN pCAN, // \arg pointer to a CAN controller
3067
+ unsigned int flag) // \arg flag to be tested
3068
+ {
3069
+ return (AT91F_CAN_GetInterruptMaskStatus(pCAN) & flag);
3070
+ }
3071
+
3072
+ //*----------------------------------------------------------------------------
3073
+ //* \fn AT91F_CAN_IsStatusSet
3074
+ //* \brief Test if CAN Interrupt is Set
3075
+ //*----------------------------------------------------------------------------
3076
+ __inline unsigned int AT91F_CAN_IsStatusSet(
3077
+ AT91PS_CAN pCAN, // \arg pointer to a CAN controller
3078
+ unsigned int flag) // \arg flag to be tested
3079
+ {
3080
+ return (AT91F_CAN_GetStatus(pCAN) & flag);
3081
+ }
3082
+
3083
+ //*----------------------------------------------------------------------------
3084
+ //* \fn AT91F_CAN_CfgModeReg
3085
+ //* \brief Configure the Mode Register of the CAN controller
3086
+ //*----------------------------------------------------------------------------
3087
+ __inline void AT91F_CAN_CfgModeReg (
3088
+ AT91PS_CAN pCAN, // pointer to a CAN controller
3089
+ unsigned int mode) // mode register
3090
+ {
3091
+ //* Write to the MR register
3092
+ pCAN->CAN_MR = mode;
3093
+ }
3094
+
3095
+ //*----------------------------------------------------------------------------
3096
+ //* \fn AT91F_CAN_GetModeReg
3097
+ //* \brief Return the Mode Register of the CAN controller value
3098
+ //*----------------------------------------------------------------------------
3099
+ __inline unsigned int AT91F_CAN_GetModeReg (
3100
+ AT91PS_CAN pCAN // pointer to a CAN controller
3101
+ )
3102
+ {
3103
+ return pCAN->CAN_MR;
3104
+ }
3105
+
3106
+ //*----------------------------------------------------------------------------
3107
+ //* \fn AT91F_CAN_CfgBaudrateReg
3108
+ //* \brief Configure the Baudrate of the CAN controller for the network
3109
+ //*----------------------------------------------------------------------------
3110
+ __inline void AT91F_CAN_CfgBaudrateReg (
3111
+ AT91PS_CAN pCAN, // pointer to a CAN controller
3112
+ unsigned int baudrate_cfg)
3113
+ {
3114
+ //* Write to the BR register
3115
+ pCAN->CAN_BR = baudrate_cfg;
3116
+ }
3117
+
3118
+ //*----------------------------------------------------------------------------
3119
+ //* \fn AT91F_CAN_GetBaudrate
3120
+ //* \brief Return the Baudrate of the CAN controller for the network value
3121
+ //*----------------------------------------------------------------------------
3122
+ __inline unsigned int AT91F_CAN_GetBaudrate (
3123
+ AT91PS_CAN pCAN // pointer to a CAN controller
3124
+ )
3125
+ {
3126
+ return pCAN->CAN_BR;
3127
+ }
3128
+
3129
+ //*----------------------------------------------------------------------------
3130
+ //* \fn AT91F_CAN_GetInternalCounter
3131
+ //* \brief Return CAN Timer Regsiter Value
3132
+ //*----------------------------------------------------------------------------
3133
+ __inline unsigned int AT91F_CAN_GetInternalCounter (
3134
+ AT91PS_CAN pCAN // pointer to a CAN controller
3135
+ )
3136
+ {
3137
+ return pCAN->CAN_TIM;
3138
+ }
3139
+
3140
+ //*----------------------------------------------------------------------------
3141
+ //* \fn AT91F_CAN_GetTimestamp
3142
+ //* \brief Return CAN Timestamp Register Value
3143
+ //*----------------------------------------------------------------------------
3144
+ __inline unsigned int AT91F_CAN_GetTimestamp (
3145
+ AT91PS_CAN pCAN // pointer to a CAN controller
3146
+ )
3147
+ {
3148
+ return pCAN->CAN_TIMESTP;
3149
+ }
3150
+
3151
+ //*----------------------------------------------------------------------------
3152
+ //* \fn AT91F_CAN_GetErrorCounter
3153
+ //* \brief Return CAN Error Counter Register Value
3154
+ //*----------------------------------------------------------------------------
3155
+ __inline unsigned int AT91F_CAN_GetErrorCounter (
3156
+ AT91PS_CAN pCAN // pointer to a CAN controller
3157
+ )
3158
+ {
3159
+ return pCAN->CAN_ECR;
3160
+ }
3161
+
3162
+ //*----------------------------------------------------------------------------
3163
+ //* \fn AT91F_CAN_InitTransferRequest
3164
+ //* \brief Request for a transfer on the corresponding mailboxes
3165
+ //*----------------------------------------------------------------------------
3166
+ __inline void AT91F_CAN_InitTransferRequest (
3167
+ AT91PS_CAN pCAN, // pointer to a CAN controller
3168
+ unsigned int transfer_cmd)
3169
+ {
3170
+ pCAN->CAN_TCR = transfer_cmd;
3171
+ }
3172
+
3173
+ //*----------------------------------------------------------------------------
3174
+ //* \fn AT91F_CAN_InitAbortRequest
3175
+ //* \brief Abort the corresponding mailboxes
3176
+ //*----------------------------------------------------------------------------
3177
+ __inline void AT91F_CAN_InitAbortRequest (
3178
+ AT91PS_CAN pCAN, // pointer to a CAN controller
3179
+ unsigned int abort_cmd)
3180
+ {
3181
+ pCAN->CAN_ACR = abort_cmd;
3182
+ }
3183
+
3184
+ //*----------------------------------------------------------------------------
3185
+ //* \fn AT91F_CAN_CfgMessageModeReg
3186
+ //* \brief Program the Message Mode Register
3187
+ //*----------------------------------------------------------------------------
3188
+ __inline void AT91F_CAN_CfgMessageModeReg (
3189
+ AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox
3190
+ unsigned int mode)
3191
+ {
3192
+ CAN_Mailbox->CAN_MB_MMR = mode;
3193
+ }
3194
+
3195
+ //*----------------------------------------------------------------------------
3196
+ //* \fn AT91F_CAN_GetMessageModeReg
3197
+ //* \brief Return the Message Mode Register
3198
+ //*----------------------------------------------------------------------------
3199
+ __inline unsigned int AT91F_CAN_GetMessageModeReg (
3200
+ AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox
3201
+ {
3202
+ return CAN_Mailbox->CAN_MB_MMR;
3203
+ }
3204
+
3205
+ //*----------------------------------------------------------------------------
3206
+ //* \fn AT91F_CAN_CfgMessageIDReg
3207
+ //* \brief Program the Message ID Register
3208
+ //* \brief Version == 0 for Standard messsage, Version == 1 for Extended
3209
+ //*----------------------------------------------------------------------------
3210
+ __inline void AT91F_CAN_CfgMessageIDReg (
3211
+ AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox
3212
+ unsigned int id,
3213
+ unsigned char version)
3214
+ {
3215
+ if(version==0) // IDvA Standard Format
3216
+ CAN_Mailbox->CAN_MB_MID = id<<18;
3217
+ else // IDvB Extended Format
3218
+ CAN_Mailbox->CAN_MB_MID = id | (1<<29); // set MIDE bit
3219
+ }
3220
+
3221
+ //*----------------------------------------------------------------------------
3222
+ //* \fn AT91F_CAN_GetMessageIDReg
3223
+ //* \brief Return the Message ID Register
3224
+ //*----------------------------------------------------------------------------
3225
+ __inline unsigned int AT91F_CAN_GetMessageIDReg (
3226
+ AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox
3227
+ {
3228
+ return CAN_Mailbox->CAN_MB_MID;
3229
+ }
3230
+
3231
+ //*----------------------------------------------------------------------------
3232
+ //* \fn AT91F_CAN_CfgMessageAcceptanceMaskReg
3233
+ //* \brief Program the Message Acceptance Mask Register
3234
+ //*----------------------------------------------------------------------------
3235
+ __inline void AT91F_CAN_CfgMessageAcceptanceMaskReg (
3236
+ AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox
3237
+ unsigned int mask)
3238
+ {
3239
+ CAN_Mailbox->CAN_MB_MAM = mask;
3240
+ }
3241
+
3242
+ //*----------------------------------------------------------------------------
3243
+ //* \fn AT91F_CAN_GetMessageAcceptanceMaskReg
3244
+ //* \brief Return the Message Acceptance Mask Register
3245
+ //*----------------------------------------------------------------------------
3246
+ __inline unsigned int AT91F_CAN_GetMessageAcceptanceMaskReg (
3247
+ AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox
3248
+ {
3249
+ return CAN_Mailbox->CAN_MB_MAM;
3250
+ }
3251
+
3252
+ //*----------------------------------------------------------------------------
3253
+ //* \fn AT91F_CAN_GetFamilyID
3254
+ //* \brief Return the Message ID Register
3255
+ //*----------------------------------------------------------------------------
3256
+ __inline unsigned int AT91F_CAN_GetFamilyID (
3257
+ AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox
3258
+ {
3259
+ return CAN_Mailbox->CAN_MB_MFID;
3260
+ }
3261
+
3262
+ //*----------------------------------------------------------------------------
3263
+ //* \fn AT91F_CAN_CfgMessageCtrl
3264
+ //* \brief Request and config for a transfer on the corresponding mailbox
3265
+ //*----------------------------------------------------------------------------
3266
+ __inline void AT91F_CAN_CfgMessageCtrlReg (
3267
+ AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox
3268
+ unsigned int message_ctrl_cmd)
3269
+ {
3270
+ CAN_Mailbox->CAN_MB_MCR = message_ctrl_cmd;
3271
+ }
3272
+
3273
+ //*----------------------------------------------------------------------------
3274
+ //* \fn AT91F_CAN_GetMessageStatus
3275
+ //* \brief Return CAN Mailbox Status
3276
+ //*----------------------------------------------------------------------------
3277
+ __inline unsigned int AT91F_CAN_GetMessageStatus (
3278
+ AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox
3279
+ {
3280
+ return CAN_Mailbox->CAN_MB_MSR;
3281
+ }
3282
+
3283
+ //*----------------------------------------------------------------------------
3284
+ //* \fn AT91F_CAN_CfgMessageDataLow
3285
+ //* \brief Program data low value
3286
+ //*----------------------------------------------------------------------------
3287
+ __inline void AT91F_CAN_CfgMessageDataLow (
3288
+ AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox
3289
+ unsigned int data)
3290
+ {
3291
+ CAN_Mailbox->CAN_MB_MDL = data;
3292
+ }
3293
+
3294
+ //*----------------------------------------------------------------------------
3295
+ //* \fn AT91F_CAN_GetMessageDataLow
3296
+ //* \brief Return data low value
3297
+ //*----------------------------------------------------------------------------
3298
+ __inline unsigned int AT91F_CAN_GetMessageDataLow (
3299
+ AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox
3300
+ {
3301
+ return CAN_Mailbox->CAN_MB_MDL;
3302
+ }
3303
+
3304
+ //*----------------------------------------------------------------------------
3305
+ //* \fn AT91F_CAN_CfgMessageDataHigh
3306
+ //* \brief Program data high value
3307
+ //*----------------------------------------------------------------------------
3308
+ __inline void AT91F_CAN_CfgMessageDataHigh (
3309
+ AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox
3310
+ unsigned int data)
3311
+ {
3312
+ CAN_Mailbox->CAN_MB_MDH = data;
3313
+ }
3314
+
3315
+ //*----------------------------------------------------------------------------
3316
+ //* \fn AT91F_CAN_GetMessageDataHigh
3317
+ //* \brief Return data high value
3318
+ //*----------------------------------------------------------------------------
3319
+ __inline unsigned int AT91F_CAN_GetMessageDataHigh (
3320
+ AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox
3321
+ {
3322
+ return CAN_Mailbox->CAN_MB_MDH;
3323
+ }
3324
+
3325
+ /* *****************************************************************************
3326
+ SOFTWARE API FOR ADC
3327
+ ***************************************************************************** */
3328
+ //*----------------------------------------------------------------------------
3329
+ //* \fn AT91F_ADC_EnableIt
3330
+ //* \brief Enable ADC interrupt
3331
+ //*----------------------------------------------------------------------------
3332
+ __inline void AT91F_ADC_EnableIt (
3333
+ AT91PS_ADC pADC, // pointer to a ADC controller
3334
+ unsigned int flag) // IT to be enabled
3335
+ {
3336
+ //* Write to the IER register
3337
+ pADC->ADC_IER = flag;
3338
+ }
3339
+
3340
+ //*----------------------------------------------------------------------------
3341
+ //* \fn AT91F_ADC_DisableIt
3342
+ //* \brief Disable ADC interrupt
3343
+ //*----------------------------------------------------------------------------
3344
+ __inline void AT91F_ADC_DisableIt (
3345
+ AT91PS_ADC pADC, // pointer to a ADC controller
3346
+ unsigned int flag) // IT to be disabled
3347
+ {
3348
+ //* Write to the IDR register
3349
+ pADC->ADC_IDR = flag;
3350
+ }
3351
+
3352
+ //*----------------------------------------------------------------------------
3353
+ //* \fn AT91F_ADC_GetStatus
3354
+ //* \brief Return ADC Interrupt Status
3355
+ //*----------------------------------------------------------------------------
3356
+ __inline unsigned int AT91F_ADC_GetStatus( // \return ADC Interrupt Status
3357
+ AT91PS_ADC pADC) // pointer to a ADC controller
3358
+ {
3359
+ return pADC->ADC_SR;
3360
+ }
3361
+
3362
+ //*----------------------------------------------------------------------------
3363
+ //* \fn AT91F_ADC_GetInterruptMaskStatus
3364
+ //* \brief Return ADC Interrupt Mask Status
3365
+ //*----------------------------------------------------------------------------
3366
+ __inline unsigned int AT91F_ADC_GetInterruptMaskStatus( // \return ADC Interrupt Mask Status
3367
+ AT91PS_ADC pADC) // pointer to a ADC controller
3368
+ {
3369
+ return pADC->ADC_IMR;
3370
+ }
3371
+
3372
+ //*----------------------------------------------------------------------------
3373
+ //* \fn AT91F_ADC_IsInterruptMasked
3374
+ //* \brief Test if ADC Interrupt is Masked
3375
+ //*----------------------------------------------------------------------------
3376
+ __inline unsigned int AT91F_ADC_IsInterruptMasked(
3377
+ AT91PS_ADC pADC, // \arg pointer to a ADC controller
3378
+ unsigned int flag) // \arg flag to be tested
3379
+ {
3380
+ return (AT91F_ADC_GetInterruptMaskStatus(pADC) & flag);
3381
+ }
3382
+
3383
+ //*----------------------------------------------------------------------------
3384
+ //* \fn AT91F_ADC_IsStatusSet
3385
+ //* \brief Test if ADC Status is Set
3386
+ //*----------------------------------------------------------------------------
3387
+ __inline unsigned int AT91F_ADC_IsStatusSet(
3388
+ AT91PS_ADC pADC, // \arg pointer to a ADC controller
3389
+ unsigned int flag) // \arg flag to be tested
3390
+ {
3391
+ return (AT91F_ADC_GetStatus(pADC) & flag);
3392
+ }
3393
+
3394
+ //*----------------------------------------------------------------------------
3395
+ //* \fn AT91F_ADC_CfgModeReg
3396
+ //* \brief Configure the Mode Register of the ADC controller
3397
+ //*----------------------------------------------------------------------------
3398
+ __inline void AT91F_ADC_CfgModeReg (
3399
+ AT91PS_ADC pADC, // pointer to a ADC controller
3400
+ unsigned int mode) // mode register
3401
+ {
3402
+ //* Write to the MR register
3403
+ pADC->ADC_MR = mode;
3404
+ }
3405
+
3406
+ //*----------------------------------------------------------------------------
3407
+ //* \fn AT91F_ADC_GetModeReg
3408
+ //* \brief Return the Mode Register of the ADC controller value
3409
+ //*----------------------------------------------------------------------------
3410
+ __inline unsigned int AT91F_ADC_GetModeReg (
3411
+ AT91PS_ADC pADC // pointer to a ADC controller
3412
+ )
3413
+ {
3414
+ return pADC->ADC_MR;
3415
+ }
3416
+
3417
+ //*----------------------------------------------------------------------------
3418
+ //* \fn AT91F_ADC_CfgTimings
3419
+ //* \brief Configure the different necessary timings of the ADC controller
3420
+ //*----------------------------------------------------------------------------
3421
+ __inline void AT91F_ADC_CfgTimings (
3422
+ AT91PS_ADC pADC, // pointer to a ADC controller
3423
+ unsigned int mck_clock, // in MHz
3424
+ unsigned int adc_clock, // in MHz
3425
+ unsigned int startup_time, // in us
3426
+ unsigned int sample_and_hold_time) // in ns
3427
+ {
3428
+ unsigned int prescal,startup,shtim;
3429
+
3430
+ prescal = mck_clock/(2*adc_clock) - 1;
3431
+ startup = adc_clock*startup_time/8 - 1;
3432
+ shtim = adc_clock*sample_and_hold_time/1000 - 1;
3433
+
3434
+ //* Write to the MR register
3435
+ pADC->ADC_MR = ( (prescal<<8) & AT91C_ADC_PRESCAL) | ( (startup<<16) & AT91C_ADC_STARTUP) | ( (shtim<<24) & AT91C_ADC_SHTIM);
3436
+ }
3437
+
3438
+ //*----------------------------------------------------------------------------
3439
+ //* \fn AT91F_ADC_EnableChannel
3440
+ //* \brief Return ADC Timer Register Value
3441
+ //*----------------------------------------------------------------------------
3442
+ __inline void AT91F_ADC_EnableChannel (
3443
+ AT91PS_ADC pADC, // pointer to a ADC controller
3444
+ unsigned int channel) // mode register
3445
+ {
3446
+ //* Write to the CHER register
3447
+ pADC->ADC_CHER = channel;
3448
+ }
3449
+
3450
+ //*----------------------------------------------------------------------------
3451
+ //* \fn AT91F_ADC_DisableChannel
3452
+ //* \brief Return ADC Timer Register Value
3453
+ //*----------------------------------------------------------------------------
3454
+ __inline void AT91F_ADC_DisableChannel (
3455
+ AT91PS_ADC pADC, // pointer to a ADC controller
3456
+ unsigned int channel) // mode register
3457
+ {
3458
+ //* Write to the CHDR register
3459
+ pADC->ADC_CHDR = channel;
3460
+ }
3461
+
3462
+ //*----------------------------------------------------------------------------
3463
+ //* \fn AT91F_ADC_GetChannelStatus
3464
+ //* \brief Return ADC Timer Register Value
3465
+ //*----------------------------------------------------------------------------
3466
+ __inline unsigned int AT91F_ADC_GetChannelStatus (
3467
+ AT91PS_ADC pADC // pointer to a ADC controller
3468
+ )
3469
+ {
3470
+ return pADC->ADC_CHSR;
3471
+ }
3472
+
3473
+ //*----------------------------------------------------------------------------
3474
+ //* \fn AT91F_ADC_StartConversion
3475
+ //* \brief Software request for a analog to digital conversion
3476
+ //*----------------------------------------------------------------------------
3477
+ __inline void AT91F_ADC_StartConversion (
3478
+ AT91PS_ADC pADC // pointer to a ADC controller
3479
+ )
3480
+ {
3481
+ pADC->ADC_CR = AT91C_ADC_START;
3482
+ }
3483
+
3484
+ //*----------------------------------------------------------------------------
3485
+ //* \fn AT91F_ADC_SoftReset
3486
+ //* \brief Software reset
3487
+ //*----------------------------------------------------------------------------
3488
+ __inline void AT91F_ADC_SoftReset (
3489
+ AT91PS_ADC pADC // pointer to a ADC controller
3490
+ )
3491
+ {
3492
+ pADC->ADC_CR = AT91C_ADC_SWRST;
3493
+ }
3494
+
3495
+ //*----------------------------------------------------------------------------
3496
+ //* \fn AT91F_ADC_GetLastConvertedData
3497
+ //* \brief Return the Last Converted Data
3498
+ //*----------------------------------------------------------------------------
3499
+ __inline unsigned int AT91F_ADC_GetLastConvertedData (
3500
+ AT91PS_ADC pADC // pointer to a ADC controller
3501
+ )
3502
+ {
3503
+ return pADC->ADC_LCDR;
3504
+ }
3505
+
3506
+ //*----------------------------------------------------------------------------
3507
+ //* \fn AT91F_ADC_GetConvertedDataCH0
3508
+ //* \brief Return the Channel 0 Converted Data
3509
+ //*----------------------------------------------------------------------------
3510
+ __inline unsigned int AT91F_ADC_GetConvertedDataCH0 (
3511
+ AT91PS_ADC pADC // pointer to a ADC controller
3512
+ )
3513
+ {
3514
+ return pADC->ADC_CDR0;
3515
+ }
3516
+
3517
+ //*----------------------------------------------------------------------------
3518
+ //* \fn AT91F_ADC_GetConvertedDataCH1
3519
+ //* \brief Return the Channel 1 Converted Data
3520
+ //*----------------------------------------------------------------------------
3521
+ __inline unsigned int AT91F_ADC_GetConvertedDataCH1 (
3522
+ AT91PS_ADC pADC // pointer to a ADC controller
3523
+ )
3524
+ {
3525
+ return pADC->ADC_CDR1;
3526
+ }
3527
+
3528
+ //*----------------------------------------------------------------------------
3529
+ //* \fn AT91F_ADC_GetConvertedDataCH2
3530
+ //* \brief Return the Channel 2 Converted Data
3531
+ //*----------------------------------------------------------------------------
3532
+ __inline unsigned int AT91F_ADC_GetConvertedDataCH2 (
3533
+ AT91PS_ADC pADC // pointer to a ADC controller
3534
+ )
3535
+ {
3536
+ return pADC->ADC_CDR2;
3537
+ }
3538
+
3539
+ //*----------------------------------------------------------------------------
3540
+ //* \fn AT91F_ADC_GetConvertedDataCH3
3541
+ //* \brief Return the Channel 3 Converted Data
3542
+ //*----------------------------------------------------------------------------
3543
+ __inline unsigned int AT91F_ADC_GetConvertedDataCH3 (
3544
+ AT91PS_ADC pADC // pointer to a ADC controller
3545
+ )
3546
+ {
3547
+ return pADC->ADC_CDR3;
3548
+ }
3549
+
3550
+ //*----------------------------------------------------------------------------
3551
+ //* \fn AT91F_ADC_GetConvertedDataCH4
3552
+ //* \brief Return the Channel 4 Converted Data
3553
+ //*----------------------------------------------------------------------------
3554
+ __inline unsigned int AT91F_ADC_GetConvertedDataCH4 (
3555
+ AT91PS_ADC pADC // pointer to a ADC controller
3556
+ )
3557
+ {
3558
+ return pADC->ADC_CDR4;
3559
+ }
3560
+
3561
+ //*----------------------------------------------------------------------------
3562
+ //* \fn AT91F_ADC_GetConvertedDataCH5
3563
+ //* \brief Return the Channel 5 Converted Data
3564
+ //*----------------------------------------------------------------------------
3565
+ __inline unsigned int AT91F_ADC_GetConvertedDataCH5 (
3566
+ AT91PS_ADC pADC // pointer to a ADC controller
3567
+ )
3568
+ {
3569
+ return pADC->ADC_CDR5;
3570
+ }
3571
+
3572
+ //*----------------------------------------------------------------------------
3573
+ //* \fn AT91F_ADC_GetConvertedDataCH6
3574
+ //* \brief Return the Channel 6 Converted Data
3575
+ //*----------------------------------------------------------------------------
3576
+ __inline unsigned int AT91F_ADC_GetConvertedDataCH6 (
3577
+ AT91PS_ADC pADC // pointer to a ADC controller
3578
+ )
3579
+ {
3580
+ return pADC->ADC_CDR6;
3581
+ }
3582
+
3583
+ //*----------------------------------------------------------------------------
3584
+ //* \fn AT91F_ADC_GetConvertedDataCH7
3585
+ //* \brief Return the Channel 7 Converted Data
3586
+ //*----------------------------------------------------------------------------
3587
+ __inline unsigned int AT91F_ADC_GetConvertedDataCH7 (
3588
+ AT91PS_ADC pADC // pointer to a ADC controller
3589
+ )
3590
+ {
3591
+ return pADC->ADC_CDR7;
3592
+ }
3593
+
3594
+ //*----------------------------------------------------------------------------
3595
+ //* \fn AT91F_MC_CfgPMC
3596
+ //* \brief Enable Peripheral clock in PMC for MC
3597
+ //*----------------------------------------------------------------------------
3598
+ __inline void AT91F_MC_CfgPMC (void)
3599
+ {
3600
+ AT91F_PMC_EnablePeriphClock(
3601
+ AT91C_BASE_PMC, // PIO controller base address
3602
+ ((unsigned int) 1 << AT91C_ID_SYS));
3603
+ }
3604
+
3605
+ //*----------------------------------------------------------------------------
3606
+ //* \fn AT91F_DBGU_CfgPMC
3607
+ //* \brief Enable Peripheral clock in PMC for DBGU
3608
+ //*----------------------------------------------------------------------------
3609
+ __inline void AT91F_DBGU_CfgPMC (void)
3610
+ {
3611
+ AT91F_PMC_EnablePeriphClock(
3612
+ AT91C_BASE_PMC, // PIO controller base address
3613
+ ((unsigned int) 1 << AT91C_ID_SYS));
3614
+ }
3615
+
3616
+ //*----------------------------------------------------------------------------
3617
+ //* \fn AT91F_DBGU_CfgPIO
3618
+ //* \brief Configure PIO controllers to drive DBGU signals
3619
+ //*----------------------------------------------------------------------------
3620
+ __inline void AT91F_DBGU_CfgPIO (void)
3621
+ {
3622
+ // Configure PIO controllers to periph mode
3623
+ AT91F_PIO_CfgPeriph(
3624
+ AT91C_BASE_PIOA, // PIO controller base address
3625
+ ((unsigned int) AT91C_PA28_DTXD ) |
3626
+ ((unsigned int) AT91C_PA27_DRXD ), // Peripheral A
3627
+ 0); // Peripheral B
3628
+ }
3629
+
3630
+ //*----------------------------------------------------------------------------
3631
+ //* \fn AT91F_PWMC_CH3_CfgPIO
3632
+ //* \brief Configure PIO controllers to drive PWMC_CH3 signals
3633
+ //*----------------------------------------------------------------------------
3634
+ __inline void AT91F_PWMC_CH3_CfgPIO (void)
3635
+ {
3636
+ // Configure PIO controllers to periph mode
3637
+ AT91F_PIO_CfgPeriph(
3638
+ AT91C_BASE_PIOB, // PIO controller base address
3639
+ ((unsigned int) AT91C_PB22_PWM3 ), // Peripheral A
3640
+ ((unsigned int) AT91C_PB30_PWM3 )); // Peripheral B
3641
+ }
3642
+
3643
+ //*----------------------------------------------------------------------------
3644
+ //* \fn AT91F_PWMC_CH2_CfgPIO
3645
+ //* \brief Configure PIO controllers to drive PWMC_CH2 signals
3646
+ //*----------------------------------------------------------------------------
3647
+ __inline void AT91F_PWMC_CH2_CfgPIO (void)
3648
+ {
3649
+ // Configure PIO controllers to periph mode
3650
+ AT91F_PIO_CfgPeriph(
3651
+ AT91C_BASE_PIOB, // PIO controller base address
3652
+ ((unsigned int) AT91C_PB21_PWM2 ), // Peripheral A
3653
+ ((unsigned int) AT91C_PB29_PWM2 )); // Peripheral B
3654
+ }
3655
+
3656
+ //*----------------------------------------------------------------------------
3657
+ //* \fn AT91F_PWMC_CH1_CfgPIO
3658
+ //* \brief Configure PIO controllers to drive PWMC_CH1 signals
3659
+ //*----------------------------------------------------------------------------
3660
+ __inline void AT91F_PWMC_CH1_CfgPIO (void)
3661
+ {
3662
+ // Configure PIO controllers to periph mode
3663
+ AT91F_PIO_CfgPeriph(
3664
+ AT91C_BASE_PIOB, // PIO controller base address
3665
+ ((unsigned int) AT91C_PB20_PWM1 ), // Peripheral A
3666
+ ((unsigned int) AT91C_PB28_PWM1 )); // Peripheral B
3667
+ }
3668
+
3669
+ //*----------------------------------------------------------------------------
3670
+ //* \fn AT91F_PWMC_CH0_CfgPIO
3671
+ //* \brief Configure PIO controllers to drive PWMC_CH0 signals
3672
+ //*----------------------------------------------------------------------------
3673
+ __inline void AT91F_PWMC_CH0_CfgPIO (void)
3674
+ {
3675
+ // Configure PIO controllers to periph mode
3676
+ AT91F_PIO_CfgPeriph(
3677
+ AT91C_BASE_PIOB, // PIO controller base address
3678
+ ((unsigned int) AT91C_PB19_PWM0 ), // Peripheral A
3679
+ ((unsigned int) AT91C_PB27_PWM0 )); // Peripheral B
3680
+ }
3681
+
3682
+ //*----------------------------------------------------------------------------
3683
+ //* \fn AT91F_EMAC_CfgPMC
3684
+ //* \brief Enable Peripheral clock in PMC for EMAC
3685
+ //*----------------------------------------------------------------------------
3686
+ __inline void AT91F_EMAC_CfgPMC (void)
3687
+ {
3688
+ AT91F_PMC_EnablePeriphClock(
3689
+ AT91C_BASE_PMC, // PIO controller base address
3690
+ ((unsigned int) 1 << AT91C_ID_EMAC));
3691
+ }
3692
+
3693
+ //*----------------------------------------------------------------------------
3694
+ //* \fn AT91F_EMAC_CfgPIO
3695
+ //* \brief Configure PIO controllers to drive EMAC signals
3696
+ //*----------------------------------------------------------------------------
3697
+ __inline void AT91F_EMAC_CfgPIO (void)
3698
+ {
3699
+ // Configure PIO controllers to periph mode
3700
+ AT91F_PIO_CfgPeriph(
3701
+ AT91C_BASE_PIOB, // PIO controller base address
3702
+ ((unsigned int) AT91C_PB9_EMDIO ) |
3703
+ ((unsigned int) AT91C_PB17_ERXCK ) |
3704
+ ((unsigned int) AT91C_PB15_ERXDV_ECRSDV) |
3705
+ ((unsigned int) AT91C_PB8_EMDC ) |
3706
+ ((unsigned int) AT91C_PB16_ECOL ) |
3707
+ ((unsigned int) AT91C_PB7_ERXER ) |
3708
+ ((unsigned int) AT91C_PB5_ERX0 ) |
3709
+ ((unsigned int) AT91C_PB6_ERX1 ) |
3710
+ ((unsigned int) AT91C_PB13_ERX2 ) |
3711
+ ((unsigned int) AT91C_PB1_ETXEN ) |
3712
+ ((unsigned int) AT91C_PB14_ERX3 ) |
3713
+ ((unsigned int) AT91C_PB12_ETXER ) |
3714
+ ((unsigned int) AT91C_PB2_ETX0 ) |
3715
+ ((unsigned int) AT91C_PB3_ETX1 ) |
3716
+ ((unsigned int) AT91C_PB10_ETX2 ) |
3717
+ ((unsigned int) AT91C_PB18_EF100 ) |
3718
+ ((unsigned int) AT91C_PB11_ETX3 ) |
3719
+ ((unsigned int) AT91C_PB4_ECRS ) |
3720
+ ((unsigned int) AT91C_PB0_ETXCK_EREFCK), // Peripheral A
3721
+ 0); // Peripheral B
3722
+ }
3723
+
3724
+ //*----------------------------------------------------------------------------
3725
+ //* \fn AT91F_VREG_CfgPMC
3726
+ //* \brief Enable Peripheral clock in PMC for VREG
3727
+ //*----------------------------------------------------------------------------
3728
+ __inline void AT91F_VREG_CfgPMC (void)
3729
+ {
3730
+ AT91F_PMC_EnablePeriphClock(
3731
+ AT91C_BASE_PMC, // PIO controller base address
3732
+ ((unsigned int) 1 << AT91C_ID_SYS));
3733
+ }
3734
+
3735
+ //*----------------------------------------------------------------------------
3736
+ //* \fn AT91F_SSC_CfgPMC
3737
+ //* \brief Enable Peripheral clock in PMC for SSC
3738
+ //*----------------------------------------------------------------------------
3739
+ __inline void AT91F_SSC_CfgPMC (void)
3740
+ {
3741
+ AT91F_PMC_EnablePeriphClock(
3742
+ AT91C_BASE_PMC, // PIO controller base address
3743
+ ((unsigned int) 1 << AT91C_ID_SSC));
3744
+ }
3745
+
3746
+ //*----------------------------------------------------------------------------
3747
+ //* \fn AT91F_SSC_CfgPIO
3748
+ //* \brief Configure PIO controllers to drive SSC signals
3749
+ //*----------------------------------------------------------------------------
3750
+ __inline void AT91F_SSC_CfgPIO (void)
3751
+ {
3752
+ // Configure PIO controllers to periph mode
3753
+ AT91F_PIO_CfgPeriph(
3754
+ AT91C_BASE_PIOA, // PIO controller base address
3755
+ ((unsigned int) AT91C_PA23_TD ) |
3756
+ ((unsigned int) AT91C_PA21_TF ) |
3757
+ ((unsigned int) AT91C_PA25_RK ) |
3758
+ ((unsigned int) AT91C_PA24_RD ) |
3759
+ ((unsigned int) AT91C_PA26_RF ) |
3760
+ ((unsigned int) AT91C_PA22_TK ), // Peripheral A
3761
+ 0); // Peripheral B
3762
+ }
3763
+
3764
+ //*----------------------------------------------------------------------------
3765
+ //* \fn AT91F_SPI1_CfgPMC
3766
+ //* \brief Enable Peripheral clock in PMC for SPI1
3767
+ //*----------------------------------------------------------------------------
3768
+ __inline void AT91F_SPI1_CfgPMC (void)
3769
+ {
3770
+ AT91F_PMC_EnablePeriphClock(
3771
+ AT91C_BASE_PMC, // PIO controller base address
3772
+ ((unsigned int) 1 << AT91C_ID_SPI1));
3773
+ }
3774
+
3775
+ //*----------------------------------------------------------------------------
3776
+ //* \fn AT91F_SPI1_CfgPIO
3777
+ //* \brief Configure PIO controllers to drive SPI1 signals
3778
+ //*----------------------------------------------------------------------------
3779
+ __inline void AT91F_SPI1_CfgPIO (void)
3780
+ {
3781
+ // Configure PIO controllers to periph mode
3782
+ AT91F_PIO_CfgPeriph(
3783
+ AT91C_BASE_PIOA, // PIO controller base address
3784
+ 0, // Peripheral A
3785
+ ((unsigned int) AT91C_PA23_SPI1_MOSI) |
3786
+ ((unsigned int) AT91C_PA21_SPI1_NPCS0) |
3787
+ ((unsigned int) AT91C_PA25_SPI1_NPCS1) |
3788
+ ((unsigned int) AT91C_PA2_SPI1_NPCS1) |
3789
+ ((unsigned int) AT91C_PA24_SPI1_MISO) |
3790
+ ((unsigned int) AT91C_PA22_SPI1_SPCK) |
3791
+ ((unsigned int) AT91C_PA26_SPI1_NPCS2) |
3792
+ ((unsigned int) AT91C_PA3_SPI1_NPCS2) |
3793
+ ((unsigned int) AT91C_PA29_SPI1_NPCS3) |
3794
+ ((unsigned int) AT91C_PA4_SPI1_NPCS3)); // Peripheral B
3795
+ // Configure PIO controllers to periph mode
3796
+ AT91F_PIO_CfgPeriph(
3797
+ AT91C_BASE_PIOB, // PIO controller base address
3798
+ 0, // Peripheral A
3799
+ ((unsigned int) AT91C_PB10_SPI1_NPCS1) |
3800
+ ((unsigned int) AT91C_PB11_SPI1_NPCS2) |
3801
+ ((unsigned int) AT91C_PB16_SPI1_NPCS3)); // Peripheral B
3802
+ }
3803
+
3804
+ //*----------------------------------------------------------------------------
3805
+ //* \fn AT91F_SPI0_CfgPMC
3806
+ //* \brief Enable Peripheral clock in PMC for SPI0
3807
+ //*----------------------------------------------------------------------------
3808
+ __inline void AT91F_SPI0_CfgPMC (void)
3809
+ {
3810
+ AT91F_PMC_EnablePeriphClock(
3811
+ AT91C_BASE_PMC, // PIO controller base address
3812
+ ((unsigned int) 1 << AT91C_ID_SPI0));
3813
+ }
3814
+
3815
+ //*----------------------------------------------------------------------------
3816
+ //* \fn AT91F_SPI0_CfgPIO
3817
+ //* \brief Configure PIO controllers to drive SPI0 signals
3818
+ //*----------------------------------------------------------------------------
3819
+ __inline void AT91F_SPI0_CfgPIO (void)
3820
+ {
3821
+ // Configure PIO controllers to periph mode
3822
+ AT91F_PIO_CfgPeriph(
3823
+ AT91C_BASE_PIOA, // PIO controller base address
3824
+ ((unsigned int) AT91C_PA17_SPI0_MOSI) |
3825
+ ((unsigned int) AT91C_PA12_SPI0_NPCS0) |
3826
+ ((unsigned int) AT91C_PA13_SPI0_NPCS1) |
3827
+ ((unsigned int) AT91C_PA16_SPI0_MISO) |
3828
+ ((unsigned int) AT91C_PA14_SPI0_NPCS2) |
3829
+ ((unsigned int) AT91C_PA18_SPI0_SPCK) |
3830
+ ((unsigned int) AT91C_PA15_SPI0_NPCS3), // Peripheral A
3831
+ ((unsigned int) AT91C_PA7_SPI0_NPCS1) |
3832
+ ((unsigned int) AT91C_PA8_SPI0_NPCS2) |
3833
+ ((unsigned int) AT91C_PA9_SPI0_NPCS3)); // Peripheral B
3834
+ // Configure PIO controllers to periph mode
3835
+ AT91F_PIO_CfgPeriph(
3836
+ AT91C_BASE_PIOB, // PIO controller base address
3837
+ 0, // Peripheral A
3838
+ ((unsigned int) AT91C_PB13_SPI0_NPCS1) |
3839
+ ((unsigned int) AT91C_PB14_SPI0_NPCS2) |
3840
+ ((unsigned int) AT91C_PB17_SPI0_NPCS3)); // Peripheral B
3841
+ }
3842
+
3843
+ //*----------------------------------------------------------------------------
3844
+ //* \fn AT91F_PWMC_CfgPMC
3845
+ //* \brief Enable Peripheral clock in PMC for PWMC
3846
+ //*----------------------------------------------------------------------------
3847
+ __inline void AT91F_PWMC_CfgPMC (void)
3848
+ {
3849
+ AT91F_PMC_EnablePeriphClock(
3850
+ AT91C_BASE_PMC, // PIO controller base address
3851
+ ((unsigned int) 1 << AT91C_ID_PWMC));
3852
+ }
3853
+
3854
+ //*----------------------------------------------------------------------------
3855
+ //* \fn AT91F_TC0_CfgPMC
3856
+ //* \brief Enable Peripheral clock in PMC for TC0
3857
+ //*----------------------------------------------------------------------------
3858
+ __inline void AT91F_TC0_CfgPMC (void)
3859
+ {
3860
+ AT91F_PMC_EnablePeriphClock(
3861
+ AT91C_BASE_PMC, // PIO controller base address
3862
+ ((unsigned int) 1 << AT91C_ID_TC0));
3863
+ }
3864
+
3865
+ //*----------------------------------------------------------------------------
3866
+ //* \fn AT91F_TC0_CfgPIO
3867
+ //* \brief Configure PIO controllers to drive TC0 signals
3868
+ //*----------------------------------------------------------------------------
3869
+ __inline void AT91F_TC0_CfgPIO (void)
3870
+ {
3871
+ // Configure PIO controllers to periph mode
3872
+ AT91F_PIO_CfgPeriph(
3873
+ AT91C_BASE_PIOB, // PIO controller base address
3874
+ ((unsigned int) AT91C_PB23_TIOA0 ) |
3875
+ ((unsigned int) AT91C_PB24_TIOB0 ), // Peripheral A
3876
+ ((unsigned int) AT91C_PB12_TCLK0 )); // Peripheral B
3877
+ }
3878
+
3879
+ //*----------------------------------------------------------------------------
3880
+ //* \fn AT91F_TC1_CfgPMC
3881
+ //* \brief Enable Peripheral clock in PMC for TC1
3882
+ //*----------------------------------------------------------------------------
3883
+ __inline void AT91F_TC1_CfgPMC (void)
3884
+ {
3885
+ AT91F_PMC_EnablePeriphClock(
3886
+ AT91C_BASE_PMC, // PIO controller base address
3887
+ ((unsigned int) 1 << AT91C_ID_TC1));
3888
+ }
3889
+
3890
+ //*----------------------------------------------------------------------------
3891
+ //* \fn AT91F_TC1_CfgPIO
3892
+ //* \brief Configure PIO controllers to drive TC1 signals
3893
+ //*----------------------------------------------------------------------------
3894
+ __inline void AT91F_TC1_CfgPIO (void)
3895
+ {
3896
+ // Configure PIO controllers to periph mode
3897
+ AT91F_PIO_CfgPeriph(
3898
+ AT91C_BASE_PIOB, // PIO controller base address
3899
+ ((unsigned int) AT91C_PB25_TIOA1 ) |
3900
+ ((unsigned int) AT91C_PB26_TIOB1 ), // Peripheral A
3901
+ ((unsigned int) AT91C_PB19_TCLK1 )); // Peripheral B
3902
+ }
3903
+
3904
+ //*----------------------------------------------------------------------------
3905
+ //* \fn AT91F_TC2_CfgPMC
3906
+ //* \brief Enable Peripheral clock in PMC for TC2
3907
+ //*----------------------------------------------------------------------------
3908
+ __inline void AT91F_TC2_CfgPMC (void)
3909
+ {
3910
+ AT91F_PMC_EnablePeriphClock(
3911
+ AT91C_BASE_PMC, // PIO controller base address
3912
+ ((unsigned int) 1 << AT91C_ID_TC2));
3913
+ }
3914
+
3915
+ //*----------------------------------------------------------------------------
3916
+ //* \fn AT91F_TC2_CfgPIO
3917
+ //* \brief Configure PIO controllers to drive TC2 signals
3918
+ //*----------------------------------------------------------------------------
3919
+ __inline void AT91F_TC2_CfgPIO (void)
3920
+ {
3921
+ // Configure PIO controllers to periph mode
3922
+ AT91F_PIO_CfgPeriph(
3923
+ AT91C_BASE_PIOA, // PIO controller base address
3924
+ 0, // Peripheral A
3925
+ ((unsigned int) AT91C_PA15_TCLK2 )); // Peripheral B
3926
+ // Configure PIO controllers to periph mode
3927
+ AT91F_PIO_CfgPeriph(
3928
+ AT91C_BASE_PIOB, // PIO controller base address
3929
+ ((unsigned int) AT91C_PB27_TIOA2 ) |
3930
+ ((unsigned int) AT91C_PB28_TIOB2 ), // Peripheral A
3931
+ 0); // Peripheral B
3932
+ }
3933
+
3934
+ //*----------------------------------------------------------------------------
3935
+ //* \fn AT91F_PITC_CfgPMC
3936
+ //* \brief Enable Peripheral clock in PMC for PITC
3937
+ //*----------------------------------------------------------------------------
3938
+ __inline void AT91F_PITC_CfgPMC (void)
3939
+ {
3940
+ AT91F_PMC_EnablePeriphClock(
3941
+ AT91C_BASE_PMC, // PIO controller base address
3942
+ ((unsigned int) 1 << AT91C_ID_SYS));
3943
+ }
3944
+
3945
+ //*----------------------------------------------------------------------------
3946
+ //* \fn AT91F_ADC_CfgPMC
3947
+ //* \brief Enable Peripheral clock in PMC for ADC
3948
+ //*----------------------------------------------------------------------------
3949
+ __inline void AT91F_ADC_CfgPMC (void)
3950
+ {
3951
+ AT91F_PMC_EnablePeriphClock(
3952
+ AT91C_BASE_PMC, // PIO controller base address
3953
+ ((unsigned int) 1 << AT91C_ID_ADC));
3954
+ }
3955
+
3956
+ //*----------------------------------------------------------------------------
3957
+ //* \fn AT91F_ADC_CfgPIO
3958
+ //* \brief Configure PIO controllers to drive ADC signals
3959
+ //*----------------------------------------------------------------------------
3960
+ __inline void AT91F_ADC_CfgPIO (void)
3961
+ {
3962
+ // Configure PIO controllers to periph mode
3963
+ AT91F_PIO_CfgPeriph(
3964
+ AT91C_BASE_PIOB, // PIO controller base address
3965
+ 0, // Peripheral A
3966
+ ((unsigned int) AT91C_PB18_ADTRG )); // Peripheral B
3967
+ }
3968
+
3969
+ //*----------------------------------------------------------------------------
3970
+ //* \fn AT91F_PMC_CfgPMC
3971
+ //* \brief Enable Peripheral clock in PMC for PMC
3972
+ //*----------------------------------------------------------------------------
3973
+ __inline void AT91F_PMC_CfgPMC (void)
3974
+ {
3975
+ AT91F_PMC_EnablePeriphClock(
3976
+ AT91C_BASE_PMC, // PIO controller base address
3977
+ ((unsigned int) 1 << AT91C_ID_SYS));
3978
+ }
3979
+
3980
+ //*----------------------------------------------------------------------------
3981
+ //* \fn AT91F_PMC_CfgPIO
3982
+ //* \brief Configure PIO controllers to drive PMC signals
3983
+ //*----------------------------------------------------------------------------
3984
+ __inline void AT91F_PMC_CfgPIO (void)
3985
+ {
3986
+ // Configure PIO controllers to periph mode
3987
+ AT91F_PIO_CfgPeriph(
3988
+ AT91C_BASE_PIOA, // PIO controller base address
3989
+ 0, // Peripheral A
3990
+ ((unsigned int) AT91C_PA13_PCK1 ) |
3991
+ ((unsigned int) AT91C_PA30_PCK2 ) |
3992
+ ((unsigned int) AT91C_PA27_PCK3 )); // Peripheral B
3993
+ // Configure PIO controllers to periph mode
3994
+ AT91F_PIO_CfgPeriph(
3995
+ AT91C_BASE_PIOB, // PIO controller base address
3996
+ ((unsigned int) AT91C_PB29_PCK1 ) |
3997
+ ((unsigned int) AT91C_PB30_PCK2 ), // Peripheral A
3998
+ ((unsigned int) AT91C_PB21_PCK1 ) |
3999
+ ((unsigned int) AT91C_PB22_PCK2 ) |
4000
+ ((unsigned int) AT91C_PB20_PCK0 ) |
4001
+ ((unsigned int) AT91C_PB0_PCK0 )); // Peripheral B
4002
+ }
4003
+
4004
+ //*----------------------------------------------------------------------------
4005
+ //* \fn AT91F_RSTC_CfgPMC
4006
+ //* \brief Enable Peripheral clock in PMC for RSTC
4007
+ //*----------------------------------------------------------------------------
4008
+ __inline void AT91F_RSTC_CfgPMC (void)
4009
+ {
4010
+ AT91F_PMC_EnablePeriphClock(
4011
+ AT91C_BASE_PMC, // PIO controller base address
4012
+ ((unsigned int) 1 << AT91C_ID_SYS));
4013
+ }
4014
+
4015
+ //*----------------------------------------------------------------------------
4016
+ //* \fn AT91F_RTTC_CfgPMC
4017
+ //* \brief Enable Peripheral clock in PMC for RTTC
4018
+ //*----------------------------------------------------------------------------
4019
+ __inline void AT91F_RTTC_CfgPMC (void)
4020
+ {
4021
+ AT91F_PMC_EnablePeriphClock(
4022
+ AT91C_BASE_PMC, // PIO controller base address
4023
+ ((unsigned int) 1 << AT91C_ID_SYS));
4024
+ }
4025
+
4026
+ //*----------------------------------------------------------------------------
4027
+ //* \fn AT91F_PIOA_CfgPMC
4028
+ //* \brief Enable Peripheral clock in PMC for PIOA
4029
+ //*----------------------------------------------------------------------------
4030
+ __inline void AT91F_PIOA_CfgPMC (void)
4031
+ {
4032
+ AT91F_PMC_EnablePeriphClock(
4033
+ AT91C_BASE_PMC, // PIO controller base address
4034
+ ((unsigned int) 1 << AT91C_ID_PIOA));
4035
+ }
4036
+
4037
+ //*----------------------------------------------------------------------------
4038
+ //* \fn AT91F_PIOB_CfgPMC
4039
+ //* \brief Enable Peripheral clock in PMC for PIOB
4040
+ //*----------------------------------------------------------------------------
4041
+ __inline void AT91F_PIOB_CfgPMC (void)
4042
+ {
4043
+ AT91F_PMC_EnablePeriphClock(
4044
+ AT91C_BASE_PMC, // PIO controller base address
4045
+ ((unsigned int) 1 << AT91C_ID_PIOB));
4046
+ }
4047
+
4048
+ //*----------------------------------------------------------------------------
4049
+ //* \fn AT91F_TWI_CfgPMC
4050
+ //* \brief Enable Peripheral clock in PMC for TWI
4051
+ //*----------------------------------------------------------------------------
4052
+ __inline void AT91F_TWI_CfgPMC (void)
4053
+ {
4054
+ AT91F_PMC_EnablePeriphClock(
4055
+ AT91C_BASE_PMC, // PIO controller base address
4056
+ ((unsigned int) 1 << AT91C_ID_TWI));
4057
+ }
4058
+
4059
+ //*----------------------------------------------------------------------------
4060
+ //* \fn AT91F_TWI_CfgPIO
4061
+ //* \brief Configure PIO controllers to drive TWI signals
4062
+ //*----------------------------------------------------------------------------
4063
+ __inline void AT91F_TWI_CfgPIO (void)
4064
+ {
4065
+ // Configure PIO controllers to periph mode
4066
+ AT91F_PIO_CfgPeriph(
4067
+ AT91C_BASE_PIOA, // PIO controller base address
4068
+ ((unsigned int) AT91C_PA10_TWD ) |
4069
+ ((unsigned int) AT91C_PA11_TWCK ), // Peripheral A
4070
+ 0); // Peripheral B
4071
+ }
4072
+
4073
+ //*----------------------------------------------------------------------------
4074
+ //* \fn AT91F_WDTC_CfgPMC
4075
+ //* \brief Enable Peripheral clock in PMC for WDTC
4076
+ //*----------------------------------------------------------------------------
4077
+ __inline void AT91F_WDTC_CfgPMC (void)
4078
+ {
4079
+ AT91F_PMC_EnablePeriphClock(
4080
+ AT91C_BASE_PMC, // PIO controller base address
4081
+ ((unsigned int) 1 << AT91C_ID_SYS));
4082
+ }
4083
+
4084
+ //*----------------------------------------------------------------------------
4085
+ //* \fn AT91F_US1_CfgPMC
4086
+ //* \brief Enable Peripheral clock in PMC for US1
4087
+ //*----------------------------------------------------------------------------
4088
+ __inline void AT91F_US1_CfgPMC (void)
4089
+ {
4090
+ AT91F_PMC_EnablePeriphClock(
4091
+ AT91C_BASE_PMC, // PIO controller base address
4092
+ ((unsigned int) 1 << AT91C_ID_US1));
4093
+ }
4094
+
4095
+ //*----------------------------------------------------------------------------
4096
+ //* \fn AT91F_US1_CfgPIO
4097
+ //* \brief Configure PIO controllers to drive US1 signals
4098
+ //*----------------------------------------------------------------------------
4099
+ __inline void AT91F_US1_CfgPIO (void)
4100
+ {
4101
+ // Configure PIO controllers to periph mode
4102
+ AT91F_PIO_CfgPeriph(
4103
+ AT91C_BASE_PIOA, // PIO controller base address
4104
+ ((unsigned int) AT91C_PA5_RXD1 ) |
4105
+ ((unsigned int) AT91C_PA6_TXD1 ) |
4106
+ ((unsigned int) AT91C_PA8_RTS1 ) |
4107
+ ((unsigned int) AT91C_PA7_SCK1 ) |
4108
+ ((unsigned int) AT91C_PA9_CTS1 ), // Peripheral A
4109
+ 0); // Peripheral B
4110
+ // Configure PIO controllers to periph mode
4111
+ AT91F_PIO_CfgPeriph(
4112
+ AT91C_BASE_PIOB, // PIO controller base address
4113
+ 0, // Peripheral A
4114
+ ((unsigned int) AT91C_PB25_DTR1 ) |
4115
+ ((unsigned int) AT91C_PB23_DCD1 ) |
4116
+ ((unsigned int) AT91C_PB24_DSR1 ) |
4117
+ ((unsigned int) AT91C_PB26_RI1 )); // Peripheral B
4118
+ }
4119
+
4120
+ //*----------------------------------------------------------------------------
4121
+ //* \fn AT91F_US0_CfgPMC
4122
+ //* \brief Enable Peripheral clock in PMC for US0
4123
+ //*----------------------------------------------------------------------------
4124
+ __inline void AT91F_US0_CfgPMC (void)
4125
+ {
4126
+ AT91F_PMC_EnablePeriphClock(
4127
+ AT91C_BASE_PMC, // PIO controller base address
4128
+ ((unsigned int) 1 << AT91C_ID_US0));
4129
+ }
4130
+
4131
+ //*----------------------------------------------------------------------------
4132
+ //* \fn AT91F_US0_CfgPIO
4133
+ //* \brief Configure PIO controllers to drive US0 signals
4134
+ //*----------------------------------------------------------------------------
4135
+ __inline void AT91F_US0_CfgPIO (void)
4136
+ {
4137
+ // Configure PIO controllers to periph mode
4138
+ AT91F_PIO_CfgPeriph(
4139
+ AT91C_BASE_PIOA, // PIO controller base address
4140
+ ((unsigned int) AT91C_PA0_RXD0 ) |
4141
+ ((unsigned int) AT91C_PA1_TXD0 ) |
4142
+ ((unsigned int) AT91C_PA3_RTS0 ) |
4143
+ ((unsigned int) AT91C_PA2_SCK0 ) |
4144
+ ((unsigned int) AT91C_PA4_CTS0 ), // Peripheral A
4145
+ 0); // Peripheral B
4146
+ }
4147
+
4148
+ //*----------------------------------------------------------------------------
4149
+ //* \fn AT91F_UDP_CfgPMC
4150
+ //* \brief Enable Peripheral clock in PMC for UDP
4151
+ //*----------------------------------------------------------------------------
4152
+ __inline void AT91F_UDP_CfgPMC (void)
4153
+ {
4154
+ AT91F_PMC_EnablePeriphClock(
4155
+ AT91C_BASE_PMC, // PIO controller base address
4156
+ ((unsigned int) 1 << AT91C_ID_UDP));
4157
+ }
4158
+
4159
+ //*----------------------------------------------------------------------------
4160
+ //* \fn AT91F_AIC_CfgPMC
4161
+ //* \brief Enable Peripheral clock in PMC for AIC
4162
+ //*----------------------------------------------------------------------------
4163
+ __inline void AT91F_AIC_CfgPMC (void)
4164
+ {
4165
+ AT91F_PMC_EnablePeriphClock(
4166
+ AT91C_BASE_PMC, // PIO controller base address
4167
+ ((unsigned int) 1 << AT91C_ID_IRQ0) |
4168
+ ((unsigned int) 1 << AT91C_ID_FIQ) |
4169
+ ((unsigned int) 1 << AT91C_ID_IRQ1));
4170
+ }
4171
+
4172
+ //*----------------------------------------------------------------------------
4173
+ //* \fn AT91F_AIC_CfgPIO
4174
+ //* \brief Configure PIO controllers to drive AIC signals
4175
+ //*----------------------------------------------------------------------------
4176
+ __inline void AT91F_AIC_CfgPIO (void)
4177
+ {
4178
+ // Configure PIO controllers to periph mode
4179
+ AT91F_PIO_CfgPeriph(
4180
+ AT91C_BASE_PIOA, // PIO controller base address
4181
+ ((unsigned int) AT91C_PA30_IRQ0 ) |
4182
+ ((unsigned int) AT91C_PA29_FIQ ), // Peripheral A
4183
+ ((unsigned int) AT91C_PA14_IRQ1 )); // Peripheral B
4184
+ }
4185
+
4186
+ //*----------------------------------------------------------------------------
4187
+ //* \fn AT91F_CAN_CfgPMC
4188
+ //* \brief Enable Peripheral clock in PMC for CAN
4189
+ //*----------------------------------------------------------------------------
4190
+ __inline void AT91F_CAN_CfgPMC (void)
4191
+ {
4192
+ AT91F_PMC_EnablePeriphClock(
4193
+ AT91C_BASE_PMC, // PIO controller base address
4194
+ ((unsigned int) 1 << AT91C_ID_CAN));
4195
+ }
4196
+
4197
+ //*----------------------------------------------------------------------------
4198
+ //* \fn AT91F_CAN_CfgPIO
4199
+ //* \brief Configure PIO controllers to drive CAN signals
4200
+ //*----------------------------------------------------------------------------
4201
+ __inline void AT91F_CAN_CfgPIO (void)
4202
+ {
4203
+ // Configure PIO controllers to periph mode
4204
+ AT91F_PIO_CfgPeriph(
4205
+ AT91C_BASE_PIOA, // PIO controller base address
4206
+ ((unsigned int) AT91C_PA20_CANTX ) |
4207
+ ((unsigned int) AT91C_PA19_CANRX ), // Peripheral A
4208
+ 0); // Peripheral B
4209
+ }
4210
+
4211
+ #endif // lib_AT91SAM7X256_H