Mercurial > pub > halpp
changeset 6:ca42336826bd default tip
working on clock sources
author | cin |
---|---|
date | Mon, 23 Jan 2017 02:40:17 +0300 |
parents | 0d3eea2dd7ea |
children | |
files | f103c8/.settings/language.settings.xml halpp/.settings/language.settings.xml l476rg-hal-test/.settings/language.settings.xml l476rg-hal-test/src/main.cpp l476rg/.settings/language.settings.xml |
diffstat | 5 files changed, 88 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/f103c8/.settings/language.settings.xml Fri Jan 20 03:40:30 2017 +0300 +++ b/f103c8/.settings/language.settings.xml Mon Jan 23 02:40:17 2017 +0300 @@ -4,7 +4,7 @@ <extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> - <provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="1787897757412856079" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> + <provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="159508458968366191" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> <language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.g++"/> </provider>
--- a/halpp/.settings/language.settings.xml Fri Jan 20 03:40:30 2017 +0300 +++ b/halpp/.settings/language.settings.xml Mon Jan 23 02:40:17 2017 +0300 @@ -4,7 +4,7 @@ <extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> - <provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="1863699703399830157" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> + <provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="225691922737705197" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> <language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.g++"/> </provider> @@ -14,7 +14,7 @@ <extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> - <provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="1863699703399830157" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> + <provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="225691922737705197" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> <language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.g++"/> </provider>
--- a/l476rg-hal-test/.settings/language.settings.xml Fri Jan 20 03:40:30 2017 +0300 +++ b/l476rg-hal-test/.settings/language.settings.xml Mon Jan 23 02:40:17 2017 +0300 @@ -4,7 +4,7 @@ <extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> - <provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="940512069781223905" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> + <provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="221387415398126765" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> <language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.g++"/> </provider> @@ -14,7 +14,7 @@ <extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> - <provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="940512069781223905" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> + <provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="221387415398126765" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> <language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.g++"/> </provider>
--- a/l476rg-hal-test/src/main.cpp Fri Jan 20 03:40:30 2017 +0300 +++ b/l476rg-hal-test/src/main.cpp Mon Jan 23 02:40:17 2017 +0300 @@ -49,7 +49,7 @@ public: typedef TCounter counter_t; - static void Init() { + static void init() { TDev::instance()->EGR = TIM_EGR_UG; } @@ -111,32 +111,38 @@ class AHB2Bus { public: - static void Enable(unsigned int flag) { + static void enable(unsigned int flag) { RCC->AHB2ENR |= flag; } + + static uint32_t clock() { + + } }; class APB1Bus { public: - static void Enable(unsigned int flag) { + static void enable(unsigned int flag) { RCC->APB1ENR1 |= flag; } }; class APB1Bus2 { - static void Enable(uint32_t flag) { + static void enable(uint32_t flag) { RCC->APB1ENR2 |= flag; } }; -template<typename TRegs, typename TBus, uint32_t BASE, uint32_t ENF> class TDevice { +template <typename TRegs, typename TBus, uint32_t BASE, uint32_t ENF> class TDevice { public: + typedef TBus bus_t; + static TRegs* instance() { return (TRegs*) BASE; } - static void Enable() { - TBus::Enable(ENF); + static void enable() { + TBus::enable(ENF); } static uint32_t frequency() { @@ -144,6 +150,75 @@ } }; +class OscMsi { +}; + +class OscHsi { +}; + +class OscHse { +}; + +class OscLsi { +}; + +class OscLse { +}; + +class Pll { +}; + +class Pclk1 { +public: + uint32_t clock() { + return APB1Bus::clock(); + } +}; + +class Rcc { +public: + typedef enum { + PClk1, + Apb1TimerClk, + PClk2, + Apb2TimerClk, + HClk, + SysClk, + HsiClk, + HseClk, + LsiClk, + LseClk, + MsiClk, + PllClk, + PllQClk, + PllPClk, + PllSai1P, + PllSai1Q, + PllSai1R, + PllSai2P, + PllSai2R + } ClockSource; + + template <ClockSource clk> unit32_t clock(); +}; + +class SysClk { +public: + uint32_t clock() { + } +}; + +class UartClockMux { +public: + template <typename TClk> void select_clock_source(); +}; + +template<> void UartClockMux::select_clock_source<Pclk1>() { +} + +template<> void UartClockMux::select_clock_source<SysClk>() { +} + class Hardware { public: typedef TDevice<GPIO_TypeDef, GPIOA_BASE, AHB2Bus, RCC_AHB2ENR_GPIOAEN> GpioA;
--- a/l476rg/.settings/language.settings.xml Fri Jan 20 03:40:30 2017 +0300 +++ b/l476rg/.settings/language.settings.xml Mon Jan 23 02:40:17 2017 +0300 @@ -4,7 +4,7 @@ <extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> - <provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="922121010244122911" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> + <provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="202996355861025771" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> <language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.g++"/> </provider>