diff --git a/.gitmodules b/.gitmodules index f8b454d..65e8132 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "robot_tests"] path = robot_tests - url = git@github.com:Ell-i/ELL-i-PyBot-Tests.git + url = https://github.com/asifsardar26/ELL-i-PyBot-Tests.git diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8a4b9e5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,45 @@ +FROM 32bit/ubuntu:14.04 + +MAINTAINER Asif Sardar + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update && apt-get install -y \ + make \ + gcc \ + g++ \ + git \ + python2.7 \ + python2.7-dev \ + python-setuptools \ + wget \ + zip \ + unzip \ + bridge-utils \ + valgrind \ + nano + +ADD https://launchpad.net/gcc-arm-embedded/4.9/4.9-2014-q4-major/+download/gcc-arm-none-eabi-4_9-2014q4-20141203-linux.tar.bz2 /home/Downloads/ +WORKDIR /home/Downloads/ +RUN tar xvjf gcc-arm-none-eabi-4_9-2014q4-20141203-linux.tar.bz2 + +ENV PATH /home/Downloads/gcc-arm-none-eabi-4_9-2014q4/bin:$PATH + +RUN easy_install -Z robotframework +RUN easy_install -Z docutils + +RUN git clone https://github.com/asifsardar26/Runtime.git /home/Runtime +RUN git --git-dir /home/Runtime/.git --work-tree /home/Runtime checkout feature-encX24J600-wip + +RUN git clone https://github.com/asifsardar26/ELL-i-PyBot-Tests /home/Runtime/robot_tests/ + +RUN git clone git://github.com/RIOT-OS/RIOT /home/RIOT + +#WORKDIR /home/Runtime/stm32/tests/robot_library/ +#RUN make PLATFORM=emulator + +VOLUME ["/home"] + +WORKDIR /home + +CMD ["/bin/bash"] diff --git a/stm32/emulator/inc/FLASH.h b/stm32/emulator/inc/FLASH.h index 6744906..d41dd5f 100644 --- a/stm32/emulator/inc/FLASH.h +++ b/stm32/emulator/inc/FLASH.h @@ -17,22 +17,41 @@ * along with ELL-i software. If not, see . */ +/** + * @author Pekka Nikander 2014 + */ + #include +#include +#include +#include +#include +#include class Flash { public: - DEFINE_REGISTER(32, FLASH, ACR, 0x0000000); - DEFINE_REGISTER(32, FLASH, KEYR, 0x0000000); - DEFINE_REGISTER(32, FLASH, OPTKEYR, 0x0000000); - DEFINE_REGISTER(32, FLASH, SR, 0x0000000); - DEFINE_REGISTER(32, FLASH, CR, 0x0000080); + //DEFINE_REGISTER(32, FLASH, ACR, 0x0000000); + //DEFINE_REGISTER(32, FLASH, KEYR, 0x0000000); + //DEFINE_REGISTER(32, FLASH, OPTKEYR, 0x0000000); + //DEFINE_REGISTER(32, FLASH, SR, 0x0000000); + //DEFINE_REGISTER(32, FLASH, CR, 0x0000080); + Register_FLASH_ACR ACR; + Register_FLASH_KEYR KEYR; + Register_FLASH_OPTKEYR OPTKEYR; + Register_FLASH_SR SR; + Register_FLASH_CR CR; protected: Flash() - : ACR() - , CR() + : CR(0x0000080) {} public: static Flash FLASH; + + void FLASH_ACR_VALUES( Flash *const flash, CALLBACK(FLASH_ACR_CALLBACK) ); + void FLASH_KEYR_VALUES( Flash *const flash, CALLBACK(FLASH_KEYR_CALLBACK) ); + void FLASH_OPTKEYR_VALUES( Flash *const flash, CALLBACK(FLASH_OPTKEYR_CALLBACK) ); + void FLASH_SR_VALUES( Flash *const flash, CALLBACK(FLASH_SR_CALLBACK) ); + void FLASH_CR_VALUES( Flash *const flash, CALLBACK(FLASH_CR_CALLBACK) ); }; Flash *const FLASH = &Flash::FLASH; diff --git a/stm32/emulator/inc/GPIO.h b/stm32/emulator/inc/GPIO.h index 42596a7..cf42917 100644 --- a/stm32/emulator/inc/GPIO.h +++ b/stm32/emulator/inc/GPIO.h @@ -17,6 +17,10 @@ * along with ELL-i software. If not, see . */ +/** + * @author Pekka Nikander 2014 + */ + #include #include //#include @@ -72,6 +76,7 @@ class GeneralPurposeInputOutput { # error "Unknown MCU die. Please define." #endif {} + public: static GeneralPurposeInputOutput GPIOA; static GeneralPurposeInputOutput GPIOB; @@ -82,6 +87,23 @@ class GeneralPurposeInputOutput { static GeneralPurposeInputOutput GPIOG; static GeneralPurposeInputOutput GPIOH; static GeneralPurposeInputOutput GPIOI; + + void GPIO_MODER_VALUES( GeneralPurposeInputOutput *const gpioPort, CALLBACK(GPIO_MODER_CALLBACK) ); + void GPIO_PUPDR_VALUES( GeneralPurposeInputOutput *const gpioPort, CALLBACK(GPIO_PUPDR_CALLBACK) ); + void GPIO_ODR_VALUES( GeneralPurposeInputOutput *const gpioPort, CALLBACK(GPIO_ODR_CALLBACK) ); + void GPIO_IDR_VALUES( GeneralPurposeInputOutput *const gpioPort, CALLBACK(GPIO_IDR_CALLBACK) ); +#if defined(__STM32F407__) || defined(__STM32F334__) + void GPIO_BSRRL_VALUES( GeneralPurposeInputOutput *const gpioPort, CALLBACK(GPIO_BSRRL_CALLBACK) ); + void GPIO_AFR_VALUES( GeneralPurposeInputOutput *const gpioPort, CALLBACK(GPIO_AFR_CALLBACK) ); + void GPIO_BSRRH_VALUES( GeneralPurposeInputOutput *const gpioPort, CALLBACK(GPIO_BSRRH_CALLBACK) ); +#elif defined(__STM32F051__) + void GPIO_BSRR_VALUES( GeneralPurposeInputOutput *const gpioPort, CALLBACK(GPIO_BSRR_CALLBACK) ); + void GPIO_AFR_VALUES( GeneralPurposeInputOutput *const gpioPort, CALLBACK(GPIO_AFR_CALLBACK) ); + void GPIO_BRR_VALUES( GeneralPurposeInputOutput *const gpioPort, CALLBACK(GPIO_BRR_CALLBACK) ); +#else +# error "Unknown MCU die. Please define." +#endif + }; GeneralPurposeInputOutput *const GPIOA = &GeneralPurposeInputOutput::GPIOA; @@ -93,3 +115,24 @@ GeneralPurposeInputOutput *const GPIOF = &GeneralPurposeInputOutput::GPIOF; GeneralPurposeInputOutput *const GPIOG = &GeneralPurposeInputOutput::GPIOG; GeneralPurposeInputOutput *const GPIOH = &GeneralPurposeInputOutput::GPIOH; GeneralPurposeInputOutput *const GPIOI = &GeneralPurposeInputOutput::GPIOI; + +/* + * Define macro for GPIO array index calculation from const char* string + * for table based approach and code readability + */ +#define IDX(port) (port[0] - 'A') + +/* + * An array of GPIO ports, the index of which is calculated according to + * the GPIO port for the board + */ +GeneralPurposeInputOutput *const GPIOPORT[] = { GPIOA + , GPIOB + , GPIOC + , GPIOD + , GPIOE + , GPIOF + , GPIOG + , GPIOH + , GPIOI +}; diff --git a/stm32/emulator/inc/PWR.h b/stm32/emulator/inc/PWR.h index 3cbd736..01ba750 100644 --- a/stm32/emulator/inc/PWR.h +++ b/stm32/emulator/inc/PWR.h @@ -17,20 +17,35 @@ * along with ELL-i software. If not, see . */ +/** + * @author Pekka Nikander 2014 + */ + #ifndef _PWR_H_ #define _PWR_H_ #include +#if defined(__STM32F407__) +# include +#endif class PowerController { public: #if defined(__STM32F407__) - DEFINE_REGISTER(32, PWR, CR, 0x00004000); // XXX Check, set to reset value + //DEFINE_REGISTER(32, PWR, CR, 0x00004000); // XXX Check, set to reset value + Register_PWR_CR CR; #endif protected: - PowerController() {} + PowerController() +#if defined(__STM32F407__) + : CR(0x00004000) +#endif + {} public: static PowerController PWR; +#if defined(__STM32F407__) + void PWR_CR_VALUES( PowerController *const pwr, CALLBACK(PWR_CR_CALLBACK) ); +#endif }; PowerController *const PWR = &PowerController::PWR; diff --git a/stm32/emulator/inc/RCC.h b/stm32/emulator/inc/RCC.h index f027530..842b2b5 100644 --- a/stm32/emulator/inc/RCC.h +++ b/stm32/emulator/inc/RCC.h @@ -17,54 +17,158 @@ * along with ELL-i software. If not, see . */ +/** + * @author Pekka Nikander 2014 + */ + #ifndef _RCC_H_ #define _RCC_H_ #include +#include +#if defined(__STM32F407__) +# include +#endif #include +#include +#include +#if defined(__STM32F407__) +# include +#elif defined(__STM32F051__) || defined(__STM32F334__) +# include +#else +# error "Unknown MCU die. Please define." +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include class ResetClockControl { public: +/* #if defined(__STM32F407__) || defined(__STM32F334__) - DEFINE_REGISTER(32, RCC, CR, 0x0202FF83); // HSERDY set for SetSysClock + //DEFINE_REGISTER(32, RCC, CR, 0x0202FF83); // HSERDY set for SetSysClock #elif defined(__STM32F051__) || defined(__STM32F334__) - DEFINE_REGISTER(32, RCC, CR, 0x0200FF83); // PLL set for SetSysClock + //DEFINE_REGISTER(32, RCC, CR, 0x0200FF83); // PLL set for SetSysClock #else # error "Unknown MCU die. Please define." #endif #if defined(__STM32F407__) - DEFINE_REGISTER(32, RCC, PLLCFGR, 0x24003010); // XXX Check, set to reset value + //DEFINE_REGISTER(32, RCC, PLLCFGR, 0x24003010); // XXX Check, set to reset value #endif #if defined(__STM32F407__) - Register_RCC_CFGR CFGR; + //Register_RCC_CFGR CFGR; #elif defined(__STM32F051__) || defined(__STM32F334__) - DEFINE_REGISTER(32, RCC, CFGR, 0x00000008); // PLL set for SetSysClock + //DEFINE_REGISTER(32, RCC, CFGR, 0x00000008); // PLL set for SetSysClock #else # error "Unknown MCU die. Please define." #endif - DEFINE_REGISTER(32, RCC, CIR, 0x00000000); - DEFINE_REGISTER(32, RCC, APB1RSTR, 0x00000000); + //DEFINE_REGISTER(32, RCC, CIR, 0x00000000); + //DEFINE_REGISTER(32, RCC, APB1RSTR, 0x00000000); #if defined(__STM32F407__) - DEFINE_REGISTER(32, RCC, AHB1ENR, 0x00000014 /* XXX CHECK ME */); + //DEFINE_REGISTER(32, RCC, AHB1ENR, 0x00000014 /* XXX CHECK ME /); #elif defined(__STM32F051__) || defined(__STM32F334__) - DEFINE_REGISTER(32, RCC, AHBENR, 0x00000014); + //DEFINE_REGISTER(32, RCC, AHBENR, 0x00000014); #else # error "Unknown MCU die. Please define." #endif - DEFINE_REGISTER(32, RCC, APB2ENR, 0x00000000); - DEFINE_REGISTER(32, RCC, APB1ENR, 0x00000000); - DEFINE_REGISTER(32, RCC, APB2RSTR, 0x00000000); - DEFINE_REGISTER(32, RCC, BDCR, 0x00000018); - DEFINE_REGISTER(32, RCC, CSR, 0x0C000000); - DEFINE_REGISTER(32, RCC, AHBRSTR, 0x00000000); - DEFINE_REGISTER(32, RCC, CFGR2, 0x00000000); - DEFINE_REGISTER(32, RCC, CFGR3, 0x00000000); - DEFINE_REGISTER(32, RCC, CR2, 0x0000FF80); + //DEFINE_REGISTER(32, RCC, APB2ENR, 0x00000000); + //DEFINE_REGISTER(32, RCC, APB1ENR, 0x00000000); + //DEFINE_REGISTER(32, RCC, APB2RSTR, 0x00000000); + //DEFINE_REGISTER(32, RCC, BDCR, 0x00000018); + //DEFINE_REGISTER(32, RCC, CSR, 0x0C000000); + //DEFINE_REGISTER(32, RCC, AHBRSTR, 0x00000000); + //DEFINE_REGISTER(32, RCC, CFGR2, 0x00000000); + //DEFINE_REGISTER(32, RCC, CFGR3, 0x00000000); + //DEFINE_REGISTER(32, RCC, CR2, 0x0000FF80); +//######################################## +*/ + Register_RCC_CR CR; +#if defined(__STM32F407__) + Register_RCC_PLLCFGR PLLCFGR; +#endif + Register_RCC_CFGR CFGR; + Register_RCC_CIR CIR; + Register_RCC_APB1RSTR APB1RSTR; +#if defined(__STM32F407__) + Register_RCC_AHB1ENR AHB1ENR; +#elif defined(__STM32F051__) || defined(__STM32F334__) + Register_RCC_AHBENR AHBENR; +#else +# error "Unknown MCU die. Please define." +#endif + Register_RCC_APB2ENR APB2ENR; + Register_RCC_APB1ENR APB1ENR; + Register_RCC_APB2RSTR APB2RSTR; + Register_RCC_BDCR BDCR; + Register_RCC_CSR CSR; + Register_RCC_AHBRSTR AHBRSTR; + Register_RCC_CFGR2 CFGR2; + Register_RCC_CFGR3 CFGR3; + Register_RCC_CR2 CR2; protected: - ResetClockControl() {} + ResetClockControl() +#if defined(__STM32F407__) || defined(__STM32F334__) + : CR(0x0202FF83) // HSERDY set for SetSysClock +#elif defined(__STM32F051__) || defined(__STM32F334__) + : CR(0x0200FF83) // PLL set for SetSysClock +#else +# error "Unknown MCU die. Please define." +#endif +#if defined(__STM32F407__) + , PLLCFGR(0x24003010) // XXX Check, set to reset value +#endif +#if defined(__STM32F407__) + , CFGR(0) +#elif defined(__STM32F051__) || defined(__STM32F334__) + , CFGR(0x00000008) // PLL set for SetSysClock +#else +# error "Unknown MCU die. Please define." +#endif +#if defined(__STM32F407__) + , AHB1ENR(0x00000014 /* XXX CHECK ME */) +#elif defined(__STM32F051__) || defined(__STM32F334__) + , AHBENR(0x00000014) +#else +# error "Unknown MCU die. Please define." +#endif + , BDCR(0x0C000000) + , CSR(0x0C000000) + , CR2(0x0000FF80) + {} public: static ResetClockControl RCC; + + void RCC_CR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_CR_CALLBACK) ); +#if defined(__STM32F407__) + void RCC_PLLCFGR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_PLLCFGR_CALLBACK) ); +#endif + void RCC_CFGR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_CFGR_CALLBACK) ); + void RCC_CIR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_CIR_CALLBACK) ); + void RCC_APB1RSTR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_APB1RSTR_CALLBACK) ); +#if defined(__STM32F407__) + void RCC_AHB1ENR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_AHB1ENR_CALLBACK) ); +#elif defined(__STM32F051__) || defined(__STM32F334__) + void RCC_AHBENR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_AHBENR_CALLBACK) ); +#else +# error "Unknown MCU die. Please define." +#endif + void RCC_APB2ENR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_APB2ENR_CALLBACK) ); + void RCC_APB1ENR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_APB1ENR_CALLBACK) ); + void RCC_APB2RSTR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_APB2RSTR_CALLBACK) ); + void RCC_BDCR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_BDCR_CALLBACK) ); + void RCC_CSR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_CSR_CALLBACK) ); + void RCC_AHBRSTR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_AHBRSTR_CALLBACK) ); + void RCC_CFGR2_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_CFGR2_CALLBACK) ); + void RCC_CFGR3_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_CFGR3_CALLBACK) ); + void RCC_CR2_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_CR2_CALLBACK) ); }; ResetClockControl *const RCC = &ResetClockControl::RCC; diff --git a/stm32/emulator/inc/Register.h b/stm32/emulator/inc/Register.h index 40d33f5..aa60465 100644 --- a/stm32/emulator/inc/Register.h +++ b/stm32/emulator/inc/Register.h @@ -25,12 +25,15 @@ #include #include +#define CALLBACK(register) void (*register)(const char* periph, const char* name, uint32_t value, const char* opStr) + class Register { protected: uint32_t value_; const std::string periph_; const std::string name_; uint8_t size_; + std::string opStr_; Register(std::string periph, std::string name, uint8_t size, uint32_t value) @@ -45,12 +48,17 @@ class Register { uint32_t operator &= (uint32_t); uint32_t operator = (uint32_t); uint32_t operator = (uint32_t) volatile; - uint32_t operator & (uint32_t) const; - uint16_t operator & (uint16_t) const; // Used by SPI, Serial, ... + uint32_t operator & (uint32_t); + uint16_t operator & (uint16_t); // Used by SPI, Serial, ... operator uint32_t () volatile { return value_; } + uint32_t registerValue() const; + const std::string registerPeriph() const; + const std::string registerName() const; + std::string registerOpStr() const; + protected: - void printout(const std::string opStr, uint32_t result) const; + void printout(const std::string opStr, uint32_t result); }; #define DEFINE_REGISTER(size, periph, name, value) \ diff --git a/stm32/emulator/inc/Register_FLASH_ACR.h b/stm32/emulator/inc/Register_FLASH_ACR.h new file mode 100644 index 0000000..31c214a --- /dev/null +++ b/stm32/emulator/inc/Register_FLASH_ACR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_FLASH_ACR_H_ +#define _Register_FLASH_ACR_H_ + +#include + +class Register_FLASH_ACR : public Register { +public: + Register_FLASH_ACR() : Register("FLASH", "ACR", 32, 0) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_FLASH_ACR_H_ diff --git a/stm32/emulator/inc/Register_FLASH_CR.h b/stm32/emulator/inc/Register_FLASH_CR.h new file mode 100644 index 0000000..76fbbe8 --- /dev/null +++ b/stm32/emulator/inc/Register_FLASH_CR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_FLASH_CR_H_ +#define _Register_FLASH_CR_H_ + +#include + +class Register_FLASH_CR : public Register { +public: + Register_FLASH_CR(uint32_t val) : Register("FLASH", "CR", 32, val) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_FLASH_CR_H_ diff --git a/stm32/emulator/inc/Register_FLASH_KEYR.h b/stm32/emulator/inc/Register_FLASH_KEYR.h new file mode 100644 index 0000000..4c39cae --- /dev/null +++ b/stm32/emulator/inc/Register_FLASH_KEYR.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_FLASH_KEYR_H_ +#define _Register_FLASH_KEYR_H_ + +#include + +class Register_FLASH_KEYR : public Register { +public: + Register_FLASH_KEYR() : Register("FLASH", "KEYR", 32, 0) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_FLASH_KEYR_H_ + diff --git a/stm32/emulator/inc/Register_FLASH_OPTKEYR.h b/stm32/emulator/inc/Register_FLASH_OPTKEYR.h new file mode 100644 index 0000000..a6540ea --- /dev/null +++ b/stm32/emulator/inc/Register_FLASH_OPTKEYR.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_FLASH_OPTKEYR_H_ +#define _Register_FLASH_OPTKEYR_H_ + +#include + +class Register_FLASH_OPTKEYR : public Register { +public: + Register_FLASH_OPTKEYR() : Register("FLASH", "OPTKEYR", 32, 0) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_FLASH_OPTKEYR_H_ + diff --git a/stm32/emulator/inc/Register_FLASH_SR.h b/stm32/emulator/inc/Register_FLASH_SR.h new file mode 100644 index 0000000..d848283 --- /dev/null +++ b/stm32/emulator/inc/Register_FLASH_SR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_FLASH_SR_H_ +#define _Register_FLASH_SR_H_ + +#include + +class Register_FLASH_SR : public Register { +public: + Register_FLASH_SR() : Register("FLASH", "SR", 32, 0) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_FLASH_SR_H_ diff --git a/stm32/emulator/inc/Register_PWR_CR.h b/stm32/emulator/inc/Register_PWR_CR.h new file mode 100644 index 0000000..df0c840 --- /dev/null +++ b/stm32/emulator/inc/Register_PWR_CR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_PWR_CR_H_ +#define _REGISTER_PWR_CR_H_ + +#include + +class Register_PWR_CR : public Register { +public: + Register_PWR_CR(uint32_t val) : Register("PWR", "CR", 32, val) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_REGISTER_PWR_CR_H_ diff --git a/stm32/emulator/inc/Register_RCC_AHB1ENR.h b/stm32/emulator/inc/Register_RCC_AHB1ENR.h new file mode 100644 index 0000000..66a4d39 --- /dev/null +++ b/stm32/emulator/inc/Register_RCC_AHB1ENR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_RCC_AHB1ENR_H_ +#define _Register_RCC_AHB1ENR_H_ + +#include + +class Register_RCC_AHB1ENR : public Register { +public: + Register_RCC_AHB1ENR(uint32_t val) : Register("RCC", "AHB1ENR", 32, val) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_RCC_AHB1ENR_H_ diff --git a/stm32/emulator/inc/Register_RCC_AHBENR.h b/stm32/emulator/inc/Register_RCC_AHBENR.h new file mode 100644 index 0000000..9101a24 --- /dev/null +++ b/stm32/emulator/inc/Register_RCC_AHBENR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_RCC_AHBENR_H_ +#define _Register_RCC_AHBENR_H_ + +#include + +class Register_RCC_AHBENR : public Register { +public: + Register_RCC_AHBENR(uint32_t val) : Register("RCC", "AHBENR", 32, val) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_RCC_AHBENR_H_ diff --git a/stm32/emulator/inc/Register_RCC_AHBRSTR.h b/stm32/emulator/inc/Register_RCC_AHBRSTR.h new file mode 100644 index 0000000..db602c0 --- /dev/null +++ b/stm32/emulator/inc/Register_RCC_AHBRSTR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_RCC_AHBRSTR_H_ +#define _Register_RCC_AHBRSTR_H_ + +#include + +class Register_RCC_AHBRSTR : public Register { +public: + Register_RCC_AHBRSTR() : Register("RCC", "AHBRSTR", 32, 0) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_RCC_AHBRSTR_H_ diff --git a/stm32/emulator/inc/Register_RCC_APB1ENR.h b/stm32/emulator/inc/Register_RCC_APB1ENR.h new file mode 100644 index 0000000..17e1954 --- /dev/null +++ b/stm32/emulator/inc/Register_RCC_APB1ENR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_RCC_APB1ENR_H_ +#define _Register_RCC_APB1ENR_H_ + +#include + +class Register_RCC_APB1ENR : public Register { +public: + Register_RCC_APB1ENR() : Register("RCC", "APB1ENR", 32, 0) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_RCC_APB1ENR_H_ diff --git a/stm32/emulator/inc/Register_RCC_APB1RSTR.h b/stm32/emulator/inc/Register_RCC_APB1RSTR.h new file mode 100644 index 0000000..96dc526 --- /dev/null +++ b/stm32/emulator/inc/Register_RCC_APB1RSTR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_RCC_APB1RSTR_H_ +#define _Register_RCC_APB1RSTR_H_ + +#include + +class Register_RCC_APB1RSTR : public Register { +public: + Register_RCC_APB1RSTR() : Register("RCC", "APB1RSTR", 32, 0) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_RCC_APB1RSTR_H_ diff --git a/stm32/emulator/inc/Register_RCC_APB2ENR.h b/stm32/emulator/inc/Register_RCC_APB2ENR.h new file mode 100644 index 0000000..2931f39 --- /dev/null +++ b/stm32/emulator/inc/Register_RCC_APB2ENR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_RCC_APB2ENR_H_ +#define _Register_RCC_APB2ENR_H_ + +#include + +class Register_RCC_APB2ENR : public Register { +public: + Register_RCC_APB2ENR() : Register("RCC", "APB2ENR", 32, 0) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_RCC_APB2ENR_H_ diff --git a/stm32/emulator/inc/Register_RCC_APB2RSTR.h b/stm32/emulator/inc/Register_RCC_APB2RSTR.h new file mode 100644 index 0000000..844fdae --- /dev/null +++ b/stm32/emulator/inc/Register_RCC_APB2RSTR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_RCC_APB2RSTR_H_ +#define _Register_RCC_APB2RSTR_H_ + +#include + +class Register_RCC_APB2RSTR : public Register { +public: + Register_RCC_APB2RSTR() : Register("RCC", "APB2RSTR", 32, 0) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_RCC_APB2RSTR_H_ diff --git a/stm32/emulator/inc/Register_RCC_BDCR.h b/stm32/emulator/inc/Register_RCC_BDCR.h new file mode 100644 index 0000000..113bfe7 --- /dev/null +++ b/stm32/emulator/inc/Register_RCC_BDCR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_RCC_BDCR_H_ +#define _Register_RCC_BDCR_H_ + +#include + +class Register_RCC_BDCR : public Register { +public: + Register_RCC_BDCR(uint32_t val) : Register("RCC", "BDCR", 32, val) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_RCC_BDCR_H_ diff --git a/stm32/emulator/inc/Register_RCC_CFGR.h b/stm32/emulator/inc/Register_RCC_CFGR.h index 9f1cc97..b716f28 100644 --- a/stm32/emulator/inc/Register_RCC_CFGR.h +++ b/stm32/emulator/inc/Register_RCC_CFGR.h @@ -17,6 +17,10 @@ * along with ELL-i software. If not, see . */ +/** + * @author Pekka Nikander 2014 + */ + #ifndef _REGISTER_RCC_CFGR_H_ #define _REGISTER_RCC_CFGR_H_ @@ -24,7 +28,7 @@ class Register_RCC_CFGR : public Register { public: - Register_RCC_CFGR() : Register("RCC", "CFGR", 32, 0) {} + Register_RCC_CFGR(uint32_t val) : Register("RCC", "CFGR", 32, val) {} uint32_t operator = (uint32_t arg); }; diff --git a/stm32/emulator/inc/Register_RCC_CFGR2.h b/stm32/emulator/inc/Register_RCC_CFGR2.h new file mode 100644 index 0000000..4f8299a --- /dev/null +++ b/stm32/emulator/inc/Register_RCC_CFGR2.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_RCC_CFGR2_H_ +#define _Register_RCC_CFGR2_H_ + +#include + +class Register_RCC_CFGR2 : public Register { +public: + Register_RCC_CFGR2() : Register("RCC", "CFGR2", 32, 0) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_RCC_CFGR2_H_ diff --git a/stm32/emulator/inc/Register_RCC_CFGR3.h b/stm32/emulator/inc/Register_RCC_CFGR3.h new file mode 100644 index 0000000..ecf19db --- /dev/null +++ b/stm32/emulator/inc/Register_RCC_CFGR3.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_RCC_CFGR3_H_ +#define _Register_RCC_CFGR3_H_ + +#include + +class Register_RCC_CFGR3 : public Register { +public: + Register_RCC_CFGR3() : Register("RCC", "CFGR3", 32, 0) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_RCC_CFGR3_H_ diff --git a/stm32/emulator/inc/Register_RCC_CIR.h b/stm32/emulator/inc/Register_RCC_CIR.h new file mode 100644 index 0000000..d57f806 --- /dev/null +++ b/stm32/emulator/inc/Register_RCC_CIR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_RCC_CIR_H_ +#define _Register_RCC_CIR_H_ + +#include + +class Register_RCC_CIR : public Register { +public: + Register_RCC_CIR() : Register("RCC", "CIR", 32, 0) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_RCC_CIR_H_ diff --git a/stm32/emulator/inc/Register_RCC_CR.h b/stm32/emulator/inc/Register_RCC_CR.h new file mode 100644 index 0000000..3a030b9 --- /dev/null +++ b/stm32/emulator/inc/Register_RCC_CR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_RCC_CR_H_ +#define _Register_RCC_CR_H_ + +#include + +class Register_RCC_CR : public Register { +public: + Register_RCC_CR(uint32_t val) : Register("RCC", "CR", 32, val) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_RCC_CR_H_ diff --git a/stm32/emulator/inc/Register_RCC_CR2.h b/stm32/emulator/inc/Register_RCC_CR2.h new file mode 100644 index 0000000..75a567b --- /dev/null +++ b/stm32/emulator/inc/Register_RCC_CR2.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_RCC_CR2_H_ +#define _Register_RCC_CR2_H_ + +#include + +class Register_RCC_CR2 : public Register { +public: + Register_RCC_CR2(uint32_t val) : Register("RCC", "CR2", 32, val) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_RCC_CR2_H_ diff --git a/stm32/emulator/inc/Register_RCC_CSR.h b/stm32/emulator/inc/Register_RCC_CSR.h new file mode 100644 index 0000000..91ca6ce --- /dev/null +++ b/stm32/emulator/inc/Register_RCC_CSR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_RCC_CSR_H_ +#define _Register_RCC_CSR_H_ + +#include + +class Register_RCC_CSR : public Register { +public: + Register_RCC_CSR(uint32_t val) : Register("RCC", "CSR", 32, val) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_RCC_CSR_H_ diff --git a/stm32/emulator/inc/Register_RCC_PLLCFGR.h b/stm32/emulator/inc/Register_RCC_PLLCFGR.h new file mode 100644 index 0000000..290da8d --- /dev/null +++ b/stm32/emulator/inc/Register_RCC_PLLCFGR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_RCC_PLLCFGR_H_ +#define _Register_RCC_PLLCFGR_H_ + +#include + +class Register_RCC_PLLCFGR : public Register { +public: + Register_RCC_PLLCFGR(uint32_t val) : Register("RCC", "PLLCFGR", 32, val) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_RCC_PLLCFGR_H_ diff --git a/stm32/emulator/inc/Register_SCB_CPUID.h b/stm32/emulator/inc/Register_SCB_CPUID.h new file mode 100644 index 0000000..7e27f7c --- /dev/null +++ b/stm32/emulator/inc/Register_SCB_CPUID.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_SCB_CPUID_H_ +#define _Register_SCB_CPUID_H_ + +#include + +class Register_SCB_CPUID : public Register { +public: + Register_SCB_CPUID(uint32_t val) : Register("SCB", "CPUID", 32, val) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_SCB_CPUID_H_ diff --git a/stm32/emulator/inc/Register_SCB_ICSR.h b/stm32/emulator/inc/Register_SCB_ICSR.h new file mode 100644 index 0000000..d7ad3ee --- /dev/null +++ b/stm32/emulator/inc/Register_SCB_ICSR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_SCB_ICSR_H_ +#define _Register_SCB_ICSR_H_ + +#include + +class Register_SCB_ICSR : public Register { +public: + Register_SCB_ICSR(uint32_t val) : Register("SCB", "ICSR", 32, val) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_SCB_ICSR_H_ diff --git a/stm32/emulator/inc/Register_SCB_VTOR.h b/stm32/emulator/inc/Register_SCB_VTOR.h new file mode 100644 index 0000000..0bfff69 --- /dev/null +++ b/stm32/emulator/inc/Register_SCB_VTOR.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _Register_SCB_VTOR_H_ +#define _Register_SCB_VTOR_H_ + +#include + +class Register_SCB_VTOR : public Register { +public: + Register_SCB_VTOR(uint32_t val) : Register("SCB", "VTOR", 32, val) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_Register_SCB_VTOR_H_ diff --git a/stm32/emulator/inc/Register_SPI_CR1.h b/stm32/emulator/inc/Register_SPI_CR1.h new file mode 100644 index 0000000..8a9d9ca --- /dev/null +++ b/stm32/emulator/inc/Register_SPI_CR1.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_SPI_CR1_H_ +#define _REGISTER_SPI_CR1_H_ + +#include + +class Register_SPI_CR1 : public Register { +public: + Register_SPI_CR1() : Register("SPI", "CR1", 16, 0) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_REGISTER_SPI_CR1_H_ diff --git a/stm32/emulator/inc/Register_SPI_CR2.h b/stm32/emulator/inc/Register_SPI_CR2.h new file mode 100644 index 0000000..a0c3c2d --- /dev/null +++ b/stm32/emulator/inc/Register_SPI_CR2.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_SPI_CR2_H_ +#define _REGISTER_SPI_CR2_H_ + +#include + +class Register_SPI_CR2 : public Register { +public: + Register_SPI_CR2() : Register("SPI", "CR2", 16, 0) {} + + uint32_t operator = (uint32_t arg); +}; + +#endif //_REGISTER_SPI_CR2_H_ diff --git a/stm32/emulator/inc/Register_SPI_DR.h b/stm32/emulator/inc/Register_SPI_DR.h index 1cc160a..929a5e4 100644 --- a/stm32/emulator/inc/Register_SPI_DR.h +++ b/stm32/emulator/inc/Register_SPI_DR.h @@ -17,6 +17,10 @@ * along with ELL-i software. If not, see . */ +/** + * @author Pekka Nikander 2014 + */ + #ifndef _REGISTER_SPI_DR_H_ #define _REGISTER_SPI_DR_H_ diff --git a/stm32/emulator/inc/Register_SPI_SR.h b/stm32/emulator/inc/Register_SPI_SR.h index daf26b2..b93d6f7 100644 --- a/stm32/emulator/inc/Register_SPI_SR.h +++ b/stm32/emulator/inc/Register_SPI_SR.h @@ -17,12 +17,17 @@ * along with ELL-i software. If not, see . */ +/** + * @author Pekka Nikander 2014 + */ + #ifndef _REGISTER_SPI_SR_H_ # define _REGISTER_SPI_SR_H_ # include # include + class Register_SPI_SR : public Register { Register_SPI_DR & dr_; public: @@ -31,8 +36,8 @@ class Register_SPI_SR : public Register { , dr_(dr) {} uint32_t operator = (uint32_t arg); - uint16_t operator & (uint16_t) const; - uint16_t operator & (uint32_t) const; + uint16_t operator & (uint16_t); + uint16_t operator & (uint32_t); }; #endif //_REGISTER_SPI_SR_H_ diff --git a/stm32/emulator/inc/Register_TIM_ARR.h b/stm32/emulator/inc/Register_TIM_ARR.h new file mode 100644 index 0000000..ee181fd --- /dev/null +++ b/stm32/emulator/inc/Register_TIM_ARR.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_TIM_ARR_H_ +#define _REGISTER_TIM_ARR_H_ + +#include + +class Register_TIM_ARR : public Register { +public: + Register_TIM_ARR() + : Register("TIM", "ARR", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_TIM_ARR_H_ diff --git a/stm32/emulator/inc/Register_TIM_BDTR.h b/stm32/emulator/inc/Register_TIM_BDTR.h new file mode 100644 index 0000000..182575b --- /dev/null +++ b/stm32/emulator/inc/Register_TIM_BDTR.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_TIM_BDTR_H_ +#define _REGISTER_TIM_BDTR_H_ + +#include + +class Register_TIM_BDTR : public Register { +public: + Register_TIM_BDTR() + : Register("TIM", "BDTR", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_TIM_BDTR_H_ diff --git a/stm32/emulator/inc/Register_TIM_CCER.h b/stm32/emulator/inc/Register_TIM_CCER.h new file mode 100644 index 0000000..d0d85a0 --- /dev/null +++ b/stm32/emulator/inc/Register_TIM_CCER.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_TIM_CCER_H_ +#define _REGISTER_TIM_CCER_H_ + +#include + +class Register_TIM_CCER : public Register { +public: + Register_TIM_CCER() + : Register("TIM", "CCER", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_TIM_CCER_H_ diff --git a/stm32/emulator/inc/Register_TIM_CCMR1.h b/stm32/emulator/inc/Register_TIM_CCMR1.h new file mode 100644 index 0000000..4848f78 --- /dev/null +++ b/stm32/emulator/inc/Register_TIM_CCMR1.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_TIM_CCMR1_H_ +#define _REGISTER_TIM_CCMR1_H_ + +#include + +class Register_TIM_CCMR1 : public Register { +public: + Register_TIM_CCMR1() + : Register("TIM", "CCMR1", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_TIM_CCMR1_H_ diff --git a/stm32/emulator/inc/Register_TIM_CCMR2.h b/stm32/emulator/inc/Register_TIM_CCMR2.h new file mode 100644 index 0000000..6f8b036 --- /dev/null +++ b/stm32/emulator/inc/Register_TIM_CCMR2.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_TIM_CCMR2_H_ +#define _REGISTER_TIM_CCMR2_H_ + +#include + +class Register_TIM_CCMR2 : public Register { +public: + Register_TIM_CCMR2() + : Register("TIM", "CCMR2", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_TIM_CCMR2_H_ diff --git a/stm32/emulator/inc/Register_TIM_CCR1.h b/stm32/emulator/inc/Register_TIM_CCR1.h new file mode 100644 index 0000000..99545bd --- /dev/null +++ b/stm32/emulator/inc/Register_TIM_CCR1.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_TIM_CCR1_H_ +#define _REGISTER_TIM_CCR1_H_ + +#include + +class Register_TIM_CCR1 : public Register { +public: + Register_TIM_CCR1() + : Register("TIM", "CCR1", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_TIM_CCR1_H_ diff --git a/stm32/emulator/inc/Register_TIM_CCR2.h b/stm32/emulator/inc/Register_TIM_CCR2.h new file mode 100644 index 0000000..59a3a09 --- /dev/null +++ b/stm32/emulator/inc/Register_TIM_CCR2.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_TIM_CCR2_H_ +#define _REGISTER_TIM_CCR2_H_ + +#include + +class Register_TIM_CCR2 : public Register { +public: + Register_TIM_CCR2() + : Register("TIM", "CCR2", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_TIM_CCR2_H_ diff --git a/stm32/emulator/inc/Register_TIM_CCR3.h b/stm32/emulator/inc/Register_TIM_CCR3.h new file mode 100644 index 0000000..a514360 --- /dev/null +++ b/stm32/emulator/inc/Register_TIM_CCR3.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_TIM_CCR3_H_ +#define _REGISTER_TIM_CCR3_H_ + +#include + +class Register_TIM_CCR3 : public Register { +public: + Register_TIM_CCR3() + : Register("TIM", "CCR3", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_TIM_CCR3_H_ diff --git a/stm32/emulator/inc/Register_TIM_CCR4.h b/stm32/emulator/inc/Register_TIM_CCR4.h new file mode 100644 index 0000000..e76f39b --- /dev/null +++ b/stm32/emulator/inc/Register_TIM_CCR4.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_TIM_CCR4_H_ +#define _REGISTER_TIM_CCR4_H_ + +#include + +class Register_TIM_CCR4 : public Register { +public: + Register_TIM_CCR4() + : Register("TIM", "CCR4", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_TIM_CCR4_H_ diff --git a/stm32/emulator/inc/Register_TIM_CR1.h b/stm32/emulator/inc/Register_TIM_CR1.h new file mode 100644 index 0000000..5cd7f10 --- /dev/null +++ b/stm32/emulator/inc/Register_TIM_CR1.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_TIM_CR1_H_ +#define _REGISTER_TIM_CR1_H_ + +#include + +class Register_TIM_CR1 : public Register { +public: + Register_TIM_CR1() + : Register("TIM", "CR1", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_TIM_CR1_H_ diff --git a/stm32/emulator/inc/Register_TIM_CR2.h b/stm32/emulator/inc/Register_TIM_CR2.h new file mode 100644 index 0000000..44b09d8 --- /dev/null +++ b/stm32/emulator/inc/Register_TIM_CR2.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_TIM_CR2_H_ +#define _REGISTER_TIM_CR2_H_ + +#include + +class Register_TIM_CR2 : public Register { +public: + Register_TIM_CR2() + : Register("TIM", "CR2", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_TIM_CR2_H_ diff --git a/stm32/emulator/inc/Register_TIM_DIER.h b/stm32/emulator/inc/Register_TIM_DIER.h new file mode 100644 index 0000000..4ac2c23 --- /dev/null +++ b/stm32/emulator/inc/Register_TIM_DIER.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_TIM_DIER_H_ +#define _REGISTER_TIM_DIER_H_ + +#include + +class Register_TIM_DIER : public Register { +public: + Register_TIM_DIER() + : Register("TIM", "DIER", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_TIM_DIER_H_ diff --git a/stm32/emulator/inc/Register_TIM_PSC.h b/stm32/emulator/inc/Register_TIM_PSC.h new file mode 100644 index 0000000..378a879 --- /dev/null +++ b/stm32/emulator/inc/Register_TIM_PSC.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_TIM_PSC_H_ +#define _REGISTER_TIM_PSC_H_ + +#include + +class Register_TIM_PSC : public Register { +public: + Register_TIM_PSC() + : Register("TIM", "PSC", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_TIM_PSC_H_ diff --git a/stm32/emulator/inc/Register_TIM_SMCR.h b/stm32/emulator/inc/Register_TIM_SMCR.h new file mode 100644 index 0000000..b5e48b0 --- /dev/null +++ b/stm32/emulator/inc/Register_TIM_SMCR.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_TIM_SMCR_H_ +#define _REGISTER_TIM_SMCR_H_ + +#include + +class Register_TIM_SMCR : public Register { +public: + Register_TIM_SMCR() + : Register("TIM", "SMCR", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_TIM_SMCR_H_ diff --git a/stm32/emulator/inc/Register_USART_BRR.h b/stm32/emulator/inc/Register_USART_BRR.h new file mode 100644 index 0000000..334e83a --- /dev/null +++ b/stm32/emulator/inc/Register_USART_BRR.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_USART_BRR_H_ +#define _REGISTER_USART_BRR_H_ + +#include + +class Register_USART_BRR : public Register { +public: + Register_USART_BRR(uint8_t val) + : Register("USART", "BRR", val, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_USART_BRR_H_ diff --git a/stm32/emulator/inc/Register_USART_CR1.h b/stm32/emulator/inc/Register_USART_CR1.h new file mode 100644 index 0000000..7169b4b --- /dev/null +++ b/stm32/emulator/inc/Register_USART_CR1.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_USART_CR1_H_ +#define _REGISTER_USART_CR1_H_ + +#include + +class Register_USART_CR1 : public Register { +public: + Register_USART_CR1(uint8_t val) + : Register("USART", "CR1", val, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_USART_CR1_H_ diff --git a/stm32/emulator/inc/Register_USART_CR2.h b/stm32/emulator/inc/Register_USART_CR2.h new file mode 100644 index 0000000..a694965 --- /dev/null +++ b/stm32/emulator/inc/Register_USART_CR2.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_USART_CR2_H_ +#define _REGISTER_USART_CR2_H_ + +#include + +class Register_USART_CR2 : public Register { +public: + Register_USART_CR2(uint8_t val) + : Register("USART", "CR2", val, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_USART_CR2_H_ diff --git a/stm32/emulator/inc/Register_USART_CR3.h b/stm32/emulator/inc/Register_USART_CR3.h new file mode 100644 index 0000000..be7d4c0 --- /dev/null +++ b/stm32/emulator/inc/Register_USART_CR3.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_USART_CR3_H_ +#define _REGISTER_USART_CR3_H_ + +#include + +class Register_USART_CR3 : public Register { +public: + Register_USART_CR3(uint8_t val) + : Register("USART", "CR3", val, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_USART_CR3_H_ diff --git a/stm32/emulator/inc/Register_USART_DR.h b/stm32/emulator/inc/Register_USART_DR.h new file mode 100644 index 0000000..ea083b8 --- /dev/null +++ b/stm32/emulator/inc/Register_USART_DR.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_USART_DR_H_ +#define _REGISTER_USART_DR_H_ + +#include + +class Register_USART_DR : public Register { +public: + Register_USART_DR() + : Register("USART", "DR", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif \ No newline at end of file diff --git a/stm32/emulator/inc/Register_USART_GTPR.h b/stm32/emulator/inc/Register_USART_GTPR.h new file mode 100644 index 0000000..daa6e8c --- /dev/null +++ b/stm32/emulator/inc/Register_USART_GTPR.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_USART_GTPR_H_ +#define _REGISTER_USART_GTPR_H_ + +#include + +class Register_USART_GTPR : public Register { +public: + Register_USART_GTPR(uint8_t val) + : Register("USART", "GTPR", val, 0) + {} + uint32_t operator = (uint32_t arg); + +}; + +#endif//_REGISTER_USART_GTPR_H_ diff --git a/stm32/emulator/inc/Register_USART_ICR.h b/stm32/emulator/inc/Register_USART_ICR.h new file mode 100644 index 0000000..8328502 --- /dev/null +++ b/stm32/emulator/inc/Register_USART_ICR.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_USART_ICR_H_ +#define _REGISTER_USART_ICR_H_ + +#include + +class Register_USART_ICR : public Register { +public: + Register_USART_ICR() + : Register("USART", "ICR", 32, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_USART_ICR_H_ diff --git a/stm32/emulator/inc/Register_USART_ISR.h b/stm32/emulator/inc/Register_USART_ISR.h new file mode 100644 index 0000000..47408e9 --- /dev/null +++ b/stm32/emulator/inc/Register_USART_ISR.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_USART_ISR_H_ +#define _REGISTER_USART_ISR_H_ + +#include + +class Register_USART_ISR : public Register { +public: + Register_USART_ISR(uint32_t val) + : Register("USART", "ISR", 32, val) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_USART_ISR_H_ diff --git a/stm32/emulator/inc/Register_USART_RDR.h b/stm32/emulator/inc/Register_USART_RDR.h new file mode 100644 index 0000000..f8ad9e1 --- /dev/null +++ b/stm32/emulator/inc/Register_USART_RDR.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_USART_RDR_H_ +#define _REGISTER_USART_RDR_H_ + +#include + +class Register_USART_RDR : public Register { +public: + Register_USART_RDR() + : Register("USART", "RDR", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_USART_RDR_H_ diff --git a/stm32/emulator/inc/Register_USART_RQR.h b/stm32/emulator/inc/Register_USART_RQR.h new file mode 100644 index 0000000..4eb88ba --- /dev/null +++ b/stm32/emulator/inc/Register_USART_RQR.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_USART_RQR_H_ +#define _REGISTER_USART_RQR_H_ + +#include + +class Register_USART_RQR : public Register { +public: + Register_USART_RQR() + : Register("USART", "RQR", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_USART_RQR_H_ diff --git a/stm32/emulator/inc/Register_USART_RTOR.h b/stm32/emulator/inc/Register_USART_RTOR.h new file mode 100644 index 0000000..5006075 --- /dev/null +++ b/stm32/emulator/inc/Register_USART_RTOR.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_USART_RTOR_H_ +#define _REGISTER_USART_RTOR_H_ + +#include + +class Register_USART_RTOR : public Register { +public: + Register_USART_RTOR() + : Register("USART", "RTOR", 32, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_USART_RTOR_H_ diff --git a/stm32/emulator/inc/Register_USART_SR.h b/stm32/emulator/inc/Register_USART_SR.h new file mode 100644 index 0000000..81aff21 --- /dev/null +++ b/stm32/emulator/inc/Register_USART_SR.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_USART_SR_H_ +#define _REGISTER_USART_SR_H_ + +#include + +class Register_USART_SR : public Register { +public: + Register_USART_SR(uint16_t val) + : Register("USART", "SR", 16, val) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_USART_SR_H_ diff --git a/stm32/emulator/inc/Register_USART_TDR.h b/stm32/emulator/inc/Register_USART_TDR.h new file mode 100644 index 0000000..db5dec0 --- /dev/null +++ b/stm32/emulator/inc/Register_USART_TDR.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#ifndef _REGISTER_USART_TDR_H_ +#define _REGISTER_USART_TDR_H_ + +#include + +class Register_USART_TDR : public Register { +public: + Register_USART_TDR() + : Register("USART", "TDR", 16, 0) + {} + uint32_t operator = (uint32_t arg); +}; + +#endif//_REGISTER_USART_TDR_H_ diff --git a/stm32/emulator/inc/SCB.h b/stm32/emulator/inc/SCB.h index c226f24..197fd32 100644 --- a/stm32/emulator/inc/SCB.h +++ b/stm32/emulator/inc/SCB.h @@ -17,23 +17,46 @@ * along with ELL-i software. If not, see . */ +/** + * @author Pekka Nikander 2014 + */ + #ifndef _SCB_H_ #define _SCB_H_ #include +#if defined(__STM32F407__) || defined(__STM32F334__) +# include +# include +# include +#endif class SystemControlBlock { public: #if defined(__STM32F407__) || defined(__STM32F334__) /* XXX Set to reset value */ - DEFINE_REGISTER(32, SCB, CPUID, 0x410FC241); - DEFINE_REGISTER(32, SCB, ICSR, 0x00000000); - DEFINE_REGISTER(32, SCB, VTOR, 0x00000000); + //DEFINE_REGISTER(32, SCB, CPUID, 0x410FC241); + //DEFINE_REGISTER(32, SCB, ICSR, 0x00000000); + //DEFINE_REGISTER(32, SCB, VTOR, 0x00000000); + Register_SCB_CPUID CPUID; + Register_SCB_ICSR ICSR; + Register_SCB_VTOR VTOR; #endif protected: - SystemControlBlock() {} + SystemControlBlock() +#if defined(__STM32F407__) || defined(__STM32F334__) + : CPUID(0x410FC241) + , ICSR(0x00000000) + , VTOR(0x00000000) +#endif + {} public: static SystemControlBlock SCB; +#if defined(__STM32F407__) || defined(__STM32F334__) + void SCB_CPUID_VALUES( SystemControlBlock *const scb, CALLBACK(SCB_CPUID_CALLBACK) ); + void SCB_ICSR_VALUES( SystemControlBlock *const scb, CALLBACK(SCB_ICSR_CALLBACK) ); + void SCB_VTOR_VALUES( SystemControlBlock *const scb, CALLBACK(SCB_VTOR_CALLBACK) ); +#endif }; SystemControlBlock *const SCB = &SystemControlBlock::SCB; diff --git a/stm32/emulator/inc/SPIemu.h b/stm32/emulator/inc/SPIemu.h index b5bf4c7..ec3b47c 100644 --- a/stm32/emulator/inc/SPIemu.h +++ b/stm32/emulator/inc/SPIemu.h @@ -24,14 +24,18 @@ #ifndef _SPI_H_ # define _SPI_H_ -# include -# include -# include +#include +#include +#include +#include +#include class SerialPeripheralInterface { public: - DEFINE_REGISTER(16, SPI, CR1, 0); - DEFINE_REGISTER(16, SPI, CR2, 0); + //DEFINE_REGISTER(16, SPI, CR1, 0); + //DEFINE_REGISTER(16, SPI, CR2, 0); + Register_SPI_CR1 CR1; + Register_SPI_CR2 CR2; Register_SPI_SR SR; Register_SPI_DR DR; protected: diff --git a/stm32/emulator/inc/TIM.h b/stm32/emulator/inc/TIM.h index 8b05222..0699867 100644 --- a/stm32/emulator/inc/TIM.h +++ b/stm32/emulator/inc/TIM.h @@ -21,23 +21,52 @@ #define _TIM_H_ #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include class Timer { public: - DEFINE_REGISTER(16, TIM, CR1, 0x00000000); - DEFINE_REGISTER(16, TIM, CR2, 0x00000000); - DEFINE_REGISTER(16, TIM, SMCR, 0x00000000); - DEFINE_REGISTER(16, TIM, DIER, 0x00000000); - DEFINE_REGISTER(16, TIM, CCMR1, 0x00000000); - DEFINE_REGISTER(16, TIM, CCMR2, 0x00000000); - DEFINE_REGISTER(16, TIM, CCER, 0x00000000); - DEFINE_REGISTER(16, TIM, BDTR, 0x00000000); - DEFINE_REGISTER(16, TIM, PSC, 0x00000000); - DEFINE_REGISTER(32, TIM, ARR, 0x00000000); - DEFINE_REGISTER(32, TIM, CCR1, 0x00000000); - DEFINE_REGISTER(32, TIM, CCR2, 0x00000000); - DEFINE_REGISTER(32, TIM, CCR3, 0x00000000); - DEFINE_REGISTER(32, TIM, CCR4, 0x00000000); + //DEFINE_REGISTER(16, TIM, CR1, 0x00000000); + //DEFINE_REGISTER(16, TIM, CR2, 0x00000000); + //DEFINE_REGISTER(16, TIM, SMCR, 0x00000000); + //DEFINE_REGISTER(16, TIM, DIER, 0x00000000); + //DEFINE_REGISTER(16, TIM, CCMR1, 0x00000000); + //DEFINE_REGISTER(16, TIM, CCMR2, 0x00000000); + //DEFINE_REGISTER(16, TIM, CCER, 0x00000000); + //DEFINE_REGISTER(16, TIM, BDTR, 0x00000000); + //DEFINE_REGISTER(16, TIM, PSC, 0x00000000); + //DEFINE_REGISTER(32, TIM, ARR, 0x00000000); + //DEFINE_REGISTER(32, TIM, CCR1, 0x00000000); + //DEFINE_REGISTER(32, TIM, CCR2, 0x00000000); + //DEFINE_REGISTER(32, TIM, CCR3, 0x00000000); + //DEFINE_REGISTER(32, TIM, CCR4, 0x00000000); + Register_TIM_CR1 CR1; + Register_TIM_CR2 CR2; + Register_TIM_SMCR SMCR; + Register_TIM_DIER DIER; + Register_TIM_CCMR1 CCMR1; + Register_TIM_CCMR2 CCMR2; + Register_TIM_CCER CCER; + Register_TIM_BDTR BDTR; + Register_TIM_PSC PSC; + Register_TIM_ARR ARR; + Register_TIM_CCR1 CCR1; + Register_TIM_CCR2 CCR2; + Register_TIM_CCR3 CCR3; + Register_TIM_CCR4 CCR4; + protected: Timer() {} public: @@ -58,6 +87,21 @@ class Timer { static Timer TIM15; static Timer TIM16; static Timer TIM17; + + void TIM_CR1_VALUES( Timer *const tim, CALLBACK(TIM_CR1_CALLBACK) ); + void TIM_CR2_VALUES( Timer *const tim, CALLBACK(TIM_CR2_CALLBACK) ); + void TIM_SMCR_VALUES( Timer *const tim, CALLBACK(TIM_SMCR_CALLBACK) ); + void TIM_DIER_VALUES( Timer *const tim, CALLBACK(TIM_DIER_CALLBACK) ); + void TIM_CCMR1_VALUES( Timer *const tim, CALLBACK(TIM_CCMR1_CALLBACK) ); + void TIM_CCMR2_VALUES( Timer *const tim, CALLBACK(TIM_CCMR2_CALLBACK) ); + void TIM_CCER_VALUES( Timer *const tim, CALLBACK(TIM_CCER_CALLBACK) ); + void TIM_BDTR_VALUES( Timer *const tim, CALLBACK(TIM_BDTR_CALLBACK) ); + void TIM_PSC_VALUES( Timer *const tim, CALLBACK(TIM_PSC_CALLBACK) ); + void TIM_ARR_VALUES( Timer *const tim, CALLBACK(TIM_ARR_CALLBACK) ); + void TIM_CCR1_VALUES( Timer *const tim, CALLBACK(TIM_CCR1_CALLBACK) ); + void TIM_CCR2_VALUES( Timer *const tim, CALLBACK(TIM_CCR2_CALLBACK) ); + void TIM_CCR3_VALUES( Timer *const tim, CALLBACK(TIM_CCR3_CALLBACK) ); + void TIM_CCR4_VALUES( Timer *const tim, CALLBACK(TIM_CCR4_CALLBACK) ); }; Timer *const TIM1 = &Timer::TIM1; @@ -78,4 +122,24 @@ Timer *const TIM15 = &Timer::TIM15; Timer *const TIM16 = &Timer::TIM16; Timer *const TIM17 = &Timer::TIM17; +Timer *const TIM[] = { TIM1 + , TIM2 + , TIM3 + , TIM4 + , TIM5 + , TIM6 + , TIM7 + , TIM8 + , TIM9 + , TIM10 + , TIM11 + , TIM12 + , TIM13 + , TIM14 + , TIM15 + , TIM16 + , TIM17 +}; + + #endif //_TIM_H_ diff --git a/stm32/emulator/inc/USART.h b/stm32/emulator/inc/USART.h index 264af75..f0315ae 100644 --- a/stm32/emulator/inc/USART.h +++ b/stm32/emulator/inc/USART.h @@ -25,6 +25,29 @@ #define _USART_H_ #include +#if defined(__STM32F407__) +# include +# include +# include +# include +# include +# include +# include +#elif defined(__STM32F051__) || defined(__STM32F334__) +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +#else +# error "Unknown MCU die. Please define." +#endif #if defined(__STM32F051__) # include @@ -39,34 +62,76 @@ class UniversalSynchronousAsynchronousReceiverTransmitter { public: #if defined(__STM32F407__) - DEFINE_REGISTER(16, USART, SR, USART_SR_TXE); - DEFINE_REGISTER(16, USART, DR, 0); - DEFINE_REGISTER(16, USART, BRR, 0); - DEFINE_REGISTER(16, USART, CR1, 0); - DEFINE_REGISTER(16, USART, CR2, 0); - DEFINE_REGISTER(16, USART, CR3, 0); - DEFINE_REGISTER(16, USART, GTPR, 0); + Register_USART_SR SR; + Register_USART_DR DR; + Register_USART_BRR BRR; + Register_USART_CR1 CR1; + Register_USART_CR2 CR2; + Register_USART_CR3 CR3; + Register_USART_GTPR GTPR; #elif defined(__STM32F051__) || defined(__STM32F334__) - DEFINE_REGISTER(32, USART, CR1, 0); - DEFINE_REGISTER(32, USART, CR2, 0); - DEFINE_REGISTER(32, USART, CR3, 0); - DEFINE_REGISTER(16, USART, BRR, 0); - DEFINE_REGISTER(16, USART, GTPR, 0); - DEFINE_REGISTER(32, USART, RTOR, 0); - DEFINE_REGISTER(16, USART, RQR, 0); - DEFINE_REGISTER(32, USART, ISR, USART_ISR_TXE); - DEFINE_REGISTER(32, USART, ICR, 0); - DEFINE_REGISTER(16, USART, RDR, 0); - DEFINE_REGISTER(16, USART, TDR, 0); + Register_USART_CR1 CR1; + Register_USART_CR2 CR2; + Register_USART_CR3 CR3; + Register_USART_BRR BRR; + Register_USART_GTPR GTPR; + Register_USART_RTOR RTOR; + Register_USART_RQR RQR; + Register_USART_ISR ISR; + Register_USART_ICR ICR; + Register_USART_RDR RDR; + Register_USART_TDR TDR; #else # error "Unknown MCU die. Please define." #endif protected: - UniversalSynchronousAsynchronousReceiverTransmitter() {} + UniversalSynchronousAsynchronousReceiverTransmitter() +#if defined(__STM32F407__) + : SR(USART_SR_TXE) + , BRR(16) + , CR1(16) + , CR2(16) + , CR3(16) + , GTPR(16) +#elif defined(__STM32F051__) || defined(__STM32F334__) + : CR1(32) + , CR2(32) + , CR3(32) + , BRR(32) + , GTPR(32) + , ISR(0x00000080) +#else +# error "Unknown MCU die. Please define." +#endif + {} public: static UniversalSynchronousAsynchronousReceiverTransmitter USART1; static UniversalSynchronousAsynchronousReceiverTransmitter USART2; static UniversalSynchronousAsynchronousReceiverTransmitter USART3; + +#if defined(__STM32F407__) + void USART_SR_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_SR_CALLBACK) ); + void USART_DR_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_DR_CALLBACK) ); + void USART_BRR_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_BRR_CALLBACK) ); + void USART_CR1_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_CR1_CALLBACK) ); + void USART_CR2_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_CR2_CALLBACK) ); + void USART_CR3_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_CR3_CALLBACK) ); + void USART_GTPR_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_GTPR_CALLBACK) ); +#elif defined(__STM32F051__) || defined(__STM32F334__) + void USART_BRR_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_BRR_CALLBACK) ); + void USART_CR1_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_CR1_CALLBACK) ); + void USART_CR2_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_CR2_CALLBACK) ); + void USART_CR3_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_CR3_CALLBACK) ); + void USART_GTPR_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_GTPR_CALLBACK) ); + void USART_RTOR_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_RTOR_CALLBACK) ); + void USART_RQR_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_RQR_CALLBACK) ); + void USART_ISR_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_ISR_CALLBACK) ); + void USART_ICR_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_ICR_CALLBACK) ); + void USART_RDR_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_RDR_CALLBACK) ); + void USART_TDR_VALUES( UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_TDR_CALLBACK) ); +#else +# error "Unknown MCU die. Please define." +#endif }; UniversalSynchronousAsynchronousReceiverTransmitter *const USART1 = @@ -75,5 +140,14 @@ UniversalSynchronousAsynchronousReceiverTransmitter *const USART2 = &UniversalSynchronousAsynchronousReceiverTransmitter::USART2; UniversalSynchronousAsynchronousReceiverTransmitter *const USART3 = &UniversalSynchronousAsynchronousReceiverTransmitter::USART2; +#if defined(__STM32F407__) + UniversalSynchronousAsynchronousReceiverTransmitter *const STM32F4DiscoveryUsartArray[] = { USART1, USART2 }; +#elif defined(__STM32F334__) + UniversalSynchronousAsynchronousReceiverTransmitter *const STM32F334NucleoUsartArray[] = { USART1, USART2, USART3 }; +#elif defined(__STM32F051__) + UniversalSynchronousAsynchronousReceiverTransmitter *const EllduinoUsartArray[] = { USART2, USART1 }; +#else +# error "Unknown MCU die. Please define." +#endif #endif //_USART_H_ diff --git a/stm32/emulator/src/FLASH.cpp b/stm32/emulator/src/FLASH.cpp index 22b3a4c..3e5d38f 100644 --- a/stm32/emulator/src/FLASH.cpp +++ b/stm32/emulator/src/FLASH.cpp @@ -17,7 +17,50 @@ * along with ELL-i software. If not, see . */ +/** + * @author Asif Sardar 2014 + */ + #include Flash Flash::FLASH; +void Flash::FLASH_ACR_VALUES( Flash *const flash, CALLBACK(FLASH_ACR_CALLBACK) ) { + FLASH_ACR_CALLBACK( flash->ACR.registerPeriph().c_str() + , flash->ACR.registerName().c_str() + , flash->ACR.registerValue() + , flash->ACR.registerOpStr().c_str() + ); +} + +void Flash::FLASH_KEYR_VALUES( Flash *const flash, CALLBACK(FLASH_KEYR_CALLBACK) ) { + FLASH_KEYR_CALLBACK( flash->KEYR.registerPeriph().c_str() + , flash->KEYR.registerName().c_str() + , flash->KEYR.registerValue() + , flash->KEYR.registerOpStr().c_str() + ); +} + +void Flash::FLASH_OPTKEYR_VALUES( Flash *const flash, CALLBACK(FLASH_OPTKEYR_CALLBACK) ) { + FLASH_OPTKEYR_CALLBACK( flash->OPTKEYR.registerPeriph().c_str() + , flash->OPTKEYR.registerName().c_str() + , flash->OPTKEYR.registerValue() + , flash->OPTKEYR.registerOpStr().c_str() + ); +} + +void Flash::FLASH_SR_VALUES( Flash *const flash, CALLBACK(FLASH_SR_CALLBACK) ) { + FLASH_SR_CALLBACK( flash->SR.registerPeriph().c_str() + , flash->SR.registerName().c_str() + , flash->SR.registerValue() + , flash->SR.registerOpStr().c_str() + ); +} + +void Flash::FLASH_CR_VALUES( Flash *const flash, CALLBACK(FLASH_CR_CALLBACK) ) { + FLASH_CR_CALLBACK( flash->CR.registerPeriph().c_str() + , flash->CR.registerName().c_str() + , flash->CR.registerValue() + , flash->CR.registerOpStr().c_str() + ); +} diff --git a/stm32/emulator/src/GPIO.cpp b/stm32/emulator/src/GPIO.cpp index a0fbda7..1a5ef6d 100644 --- a/stm32/emulator/src/GPIO.cpp +++ b/stm32/emulator/src/GPIO.cpp @@ -35,3 +35,105 @@ GeneralPurposeInputOutput GeneralPurposeInputOutput::GPIOG; GeneralPurposeInputOutput GeneralPurposeInputOutput::GPIOH; GeneralPurposeInputOutput GeneralPurposeInputOutput::GPIOI; +void GeneralPurposeInputOutput::GPIO_MODER_VALUES( GeneralPurposeInputOutput *const gpioPort + , CALLBACK(GPIO_MODER_CALLBACK) ) { + GPIO_MODER_CALLBACK( gpioPort->MODER.registerPeriph().c_str() + , gpioPort->MODER.registerName().c_str() + , gpioPort->MODER.registerValue() + , gpioPort->MODER.registerOpStr().c_str() + ); +} + +void GeneralPurposeInputOutput::GPIO_PUPDR_VALUES( GeneralPurposeInputOutput *const gpioPort + , CALLBACK(GPIO_PUPDR_CALLBACK) ) { + GPIO_PUPDR_CALLBACK( gpioPort->PUPDR.registerPeriph().c_str() + , gpioPort->PUPDR.registerName().c_str() + , gpioPort->PUPDR.registerValue() + , gpioPort->PUPDR.registerOpStr().c_str() + ); +} + +void GeneralPurposeInputOutput::GPIO_ODR_VALUES( GeneralPurposeInputOutput *const gpioPort + , CALLBACK(GPIO_ODR_CALLBACK) ) { + GPIO_ODR_CALLBACK( gpioPort->ODR.registerPeriph().c_str() + , gpioPort->ODR.registerName().c_str() + , gpioPort->ODR.registerValue() + , gpioPort->ODR.registerOpStr().c_str() + ); +} + +void GeneralPurposeInputOutput::GPIO_IDR_VALUES( GeneralPurposeInputOutput *const gpioPort + , CALLBACK(GPIO_IDR_CALLBACK) ) { + GPIO_IDR_CALLBACK( gpioPort->IDR.registerPeriph().c_str() + , gpioPort->IDR.registerName().c_str() + , gpioPort->IDR.registerValue() + , gpioPort->IDR.registerOpStr().c_str() + ); +} +#if defined(__STM32F407__) || defined(__STM32F334__) +void GeneralPurposeInputOutput::GPIO_BSRRL_VALUES( GeneralPurposeInputOutput *const gpioPort + , CALLBACK(GPIO_BSRRL_CALLBACK) ) { + GPIO_BSRRL_CALLBACK( gpioPort->BSRRL.registerPeriph().c_str() + , gpioPort->BSRRL.registerName().c_str() + , gpioPort->BSRRL.registerValue() + , gpioPort->BSRRL.registerOpStr().c_str() + ); +} + +void GeneralPurposeInputOutput::GPIO_AFR_VALUES( GeneralPurposeInputOutput *const gpioPort + , CALLBACK(GPIO_AFR_CALLBACK) ) { + GPIO_AFR_CALLBACK( gpioPort->AFR[0].registerPeriph().c_str() + , gpioPort->AFR[0].registerName().c_str() + , gpioPort->AFR[0].registerValue() + , gpioPort->AFR[0].registerOpStr().c_str() + ); + GPIO_AFR_CALLBACK( gpioPort->AFR[1].registerPeriph().c_str() + , gpioPort->AFR[1].registerName().c_str() + , gpioPort->AFR[1].registerValue() + , gpioPort->AFR[1].registerOpStr().c_str() + ); +} + +void GeneralPurposeInputOutput::GPIO_BSRRH_VALUES( GeneralPurposeInputOutput *const gpioPort + , CALLBACK(GPIO_BSRRH_CALLBACK) ) { + GPIO_BSRRH_CALLBACK( gpioPort->BSRRH.registerPeriph().c_str() + , gpioPort->BSRRH.registerName().c_str() + , gpioPort->BSRRH.registerValue() + , gpioPort->BSRRH.registerOpStr().c_str() + ); +} +#elif defined(__STM32F051__) +void GeneralPurposeInputOutput::GPIO_BSRR_VALUES( GeneralPurposeInputOutput *const gpioPort + , CALLBACK(GPIO_BSRR_CALLBACK) ) { + GPIO_BSRR_CALLBACK( gpioPort->BSRR.registerPeriph().c_str() + , gpioPort->BSRR.registerName().c_str() + , gpioPort->BSRR.registerValue() + , gpioPort->BSRR.registerOpStr().c_str() + ); +} + +void GeneralPurposeInputOutput::GPIO_AFR_VALUES( GeneralPurposeInputOutput *const gpioPort + , CALLBACK(GPIO_AFR_CALLBACK) ) { + GPIO_AFR_CALLBACK( gpioPort->AFR[0].registerPeriph().c_str() + , gpioPort->AFR[0].registerName().c_str() + , gpioPort->AFR[0].registerValue() + , gpioPort->AFR[0].registerOpStr().c_str() + ); + GPIO_AFR_CALLBACK( gpioPort->AFR[1].registerPeriph().c_str() + , gpioPort->AFR[1].registerName().c_str() + , gpioPort->AFR[1].registerValue() + , gpioPort->AFR[1].registerOpStr().c_str() + ); +} + +void GeneralPurposeInputOutput::GPIO_BRR_VALUES( GeneralPurposeInputOutput *const gpioPort + , CALLBACK(GPIO_BRR_CALLBACK) ) { + GPIO_BRR_CALLBACK( gpioPort->BRR.registerPeriph().c_str() + , gpioPort->BRR.registerName().c_str() + , gpioPort->BRR.registerValue() + , gpioPort->BRR.registerOpStr().c_str() + ); +} +#else +# error "Unknown MCU die. Please define." +#endif diff --git a/stm32/emulator/src/PWR.cpp b/stm32/emulator/src/PWR.cpp index 91712ff..360744a 100644 --- a/stm32/emulator/src/PWR.cpp +++ b/stm32/emulator/src/PWR.cpp @@ -17,7 +17,20 @@ * along with ELL-i software. If not, see . */ +/** + * @author Asif Sardar 2014 + */ + #include PowerController PowerController::PWR; +#if defined(__STM32F407__) +void PowerController::PWR_CR_VALUES( PowerController *const pwr, CALLBACK(PWR_CR_CALLBACK) ) { + PWR_CR_CALLBACK( pwr->CR.registerPeriph().c_str() + , pwr->CR.registerName().c_str() + , pwr->CR.registerValue() + , pwr->CR.registerOpStr().c_str() + ); +} +#endif \ No newline at end of file diff --git a/stm32/emulator/src/RCC.cpp b/stm32/emulator/src/RCC.cpp index e0b5efb..51ac6a8 100644 --- a/stm32/emulator/src/RCC.cpp +++ b/stm32/emulator/src/RCC.cpp @@ -17,7 +17,144 @@ * along with ELL-i software. If not, see . */ +/** + * @author Asif Sardar 2014 + */ + #include ResetClockControl ResetClockControl::RCC; +void ResetClockControl::RCC_CR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_CR_CALLBACK) ) { + RCC_CR_CALLBACK( rcc->CR.registerPeriph().c_str() + , rcc->CR.registerName().c_str() + , rcc->CR.registerValue() + , rcc->CR.registerOpStr().c_str() + ); +} + +#if defined(__STM32F407__) +void ResetClockControl::RCC_PLLCFGR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_PLLCFGR_CALLBACK) ) { + RCC_PLLCFGR_CALLBACK( rcc->PLLCFGR.registerPeriph().c_str() + , rcc->PLLCFGR.registerName().c_str() + , rcc->PLLCFGR.registerValue() + , rcc->PLLCFGR.registerOpStr().c_str() + ); +} +#endif + +void ResetClockControl::RCC_CFGR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_CFGR_CALLBACK) ) { + RCC_CFGR_CALLBACK( rcc->CFGR.registerPeriph().c_str() + , rcc->CFGR.registerName().c_str() + , rcc->CFGR.registerValue() + , rcc->CFGR.registerOpStr().c_str() + ); +} + +void ResetClockControl::RCC_CIR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_CIR_CALLBACK) ) { + RCC_CIR_CALLBACK( rcc->CIR.registerPeriph().c_str() + , rcc->CIR.registerName().c_str() + , rcc->CIR.registerValue() + , rcc->CIR.registerOpStr().c_str() + ); +} + +void ResetClockControl::RCC_APB1RSTR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_APB1RSTR_CALLBACK) ) { + RCC_APB1RSTR_CALLBACK( rcc->APB1RSTR.registerPeriph().c_str() + , rcc->APB1RSTR.registerName().c_str() + , rcc->APB1RSTR.registerValue() + , rcc->APB1RSTR.registerOpStr().c_str() + ); +} + +#if defined(__STM32F407__) +void ResetClockControl::RCC_AHB1ENR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_AHB1ENR_CALLBACK) ) { + RCC_AHB1ENR_CALLBACK( rcc->AHB1ENR.registerPeriph().c_str() + , rcc->AHB1ENR.registerName().c_str() + , rcc->AHB1ENR.registerValue() + , rcc->AHB1ENR.registerOpStr().c_str() + ); +} +#elif defined(__STM32F051__) || defined(__STM32F334__) +void ResetClockControl::RCC_AHBENR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_AHBENR_CALLBACK) ) { + RCC_AHBENR_CALLBACK( rcc->AHBENR.registerPeriph().c_str() + , rcc->AHBENR.registerName().c_str() + , rcc->AHBENR.registerValue() + , rcc->AHBENR.registerOpStr().c_str() + ); +} +#else +# error "Unknown MCU die. Please define." +#endif + +void ResetClockControl::RCC_APB2ENR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_APB2ENR_CALLBACK) ) { + RCC_APB2ENR_CALLBACK( rcc->APB2ENR.registerPeriph().c_str() + , rcc->APB2ENR.registerName().c_str() + , rcc->APB2ENR.registerValue() + , rcc->APB2ENR.registerOpStr().c_str() + ); +} + +void ResetClockControl::RCC_APB1ENR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_APB1ENR_CALLBACK) ) { + RCC_APB1ENR_CALLBACK( rcc->APB1ENR.registerPeriph().c_str() + , rcc->APB1ENR.registerName().c_str() + , rcc->APB1ENR.registerValue() + , rcc->APB1ENR.registerOpStr().c_str() + ); +} + +void ResetClockControl::RCC_APB2RSTR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_APB2RSTR_CALLBACK) ) { + RCC_APB2RSTR_CALLBACK( rcc->APB2RSTR.registerPeriph().c_str() + , rcc->APB2RSTR.registerName().c_str() + , rcc->APB2RSTR.registerValue() + , rcc->APB2RSTR.registerOpStr().c_str() + ); +} + +void ResetClockControl::RCC_BDCR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_BDCR_CALLBACK) ) { + RCC_BDCR_CALLBACK( rcc->BDCR.registerPeriph().c_str() + , rcc->BDCR.registerName().c_str() + , rcc->BDCR.registerValue() + , rcc->BDCR.registerOpStr().c_str() + ); +} + +void ResetClockControl::RCC_CSR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_CSR_CALLBACK) ) { + RCC_CSR_CALLBACK( rcc->CSR.registerPeriph().c_str() + , rcc->CSR.registerName().c_str() + , rcc->CSR.registerValue() + , rcc->CSR.registerOpStr().c_str() + ); +} + +void ResetClockControl::RCC_AHBRSTR_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_AHBRSTR_CALLBACK) ) { + RCC_AHBRSTR_CALLBACK( rcc->AHBRSTR.registerPeriph().c_str() + , rcc->AHBRSTR.registerName().c_str() + , rcc->AHBRSTR.registerValue() + , rcc->AHBRSTR.registerOpStr().c_str() + ); +} + +void ResetClockControl::RCC_CFGR2_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_CFGR2_CALLBACK) ) { + RCC_CFGR2_CALLBACK( rcc->CFGR2.registerPeriph().c_str() + , rcc->CFGR2.registerName().c_str() + , rcc->CFGR2.registerValue() + , rcc->CFGR2.registerOpStr().c_str() + ); +} + +void ResetClockControl::RCC_CFGR3_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_CFGR3_CALLBACK) ) { + RCC_CFGR3_CALLBACK( rcc->CFGR3.registerPeriph().c_str() + , rcc->CFGR3.registerName().c_str() + , rcc->CFGR3.registerValue() + , rcc->CFGR3.registerOpStr().c_str() + ); +} + +void ResetClockControl::RCC_CR2_VALUES( ResetClockControl *const rcc, CALLBACK(RCC_CR2_CALLBACK) ) { + RCC_CR2_CALLBACK( rcc->CR2.registerPeriph().c_str() + , rcc->CR2.registerName().c_str() + , rcc->CR2.registerValue() + , rcc->CR2.registerOpStr().c_str() + ); +} diff --git a/stm32/emulator/src/Register.cpp b/stm32/emulator/src/Register.cpp index 9da652c..427730b 100644 --- a/stm32/emulator/src/Register.cpp +++ b/stm32/emulator/src/Register.cpp @@ -17,15 +17,25 @@ * along with ELL-i software. If not, see . */ +#include "pythonCallback.c" + #include -void Register::printout(const std::string opStr, uint32_t result) const { +void Register::printout(const std::string opStr, uint32_t result) { + opStr_ = opStr; std::cout << std::setbase(16) << periph_ << ':' << name_ << ':' << "value=" << value_ << " -> " << opStr << result << std::endl; + + PyGILState_STATE gilState = PyGILState_Ensure(); + PyObject *mod = PyImport_ImportModule("pythonCallback"); + PyObject *func = PyObject_GetAttrString(mod, (char*)"callback_python"); + PyObject *arglist = Py_BuildValue("ssiis", periph_.c_str(), name_.c_str(), value_, result, opStr.c_str()); + PyObject_CallObject(func, arglist); + PyGILState_Release(gilState); } uint32_t Register::operator = (uint32_t arg) volatile { @@ -48,12 +58,28 @@ uint32_t Register::operator &= (uint32_t arg) { return value_ &= arg; } -uint32_t Register::operator & (uint32_t arg) const { +uint32_t Register::operator & (uint32_t arg) { printout("&", value_ & arg); return value_ & arg; } -uint16_t Register::operator & (uint16_t arg) const { +uint16_t Register::operator & (uint16_t arg) { printout("&(16b)", value_ & arg); return value_ & arg; } + +uint32_t Register::registerValue() const { + return value_; +} + +const std::string Register::registerPeriph() const { + return periph_; +} + +const std::string Register::registerName() const { + return name_; +} + +std::string Register::registerOpStr() const { + return opStr_; +} diff --git a/stm32/emulator/src/Register_FLASH_ACR.cpp b/stm32/emulator/src/Register_FLASH_ACR.cpp new file mode 100644 index 0000000..2b0d498 --- /dev/null +++ b/stm32/emulator/src/Register_FLASH_ACR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_FLASH_ACR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_FLASH_CR.cpp b/stm32/emulator/src/Register_FLASH_CR.cpp new file mode 100644 index 0000000..ca42c2c --- /dev/null +++ b/stm32/emulator/src/Register_FLASH_CR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_FLASH_CR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_FLASH_KEYR.cpp b/stm32/emulator/src/Register_FLASH_KEYR.cpp new file mode 100644 index 0000000..0d20b51 --- /dev/null +++ b/stm32/emulator/src/Register_FLASH_KEYR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_FLASH_KEYR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_FLASH_OPTKEYR.cpp b/stm32/emulator/src/Register_FLASH_OPTKEYR.cpp new file mode 100644 index 0000000..c067e8c --- /dev/null +++ b/stm32/emulator/src/Register_FLASH_OPTKEYR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_FLASH_OPTKEYR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_FLASH_SR.cpp b/stm32/emulator/src/Register_FLASH_SR.cpp new file mode 100644 index 0000000..8c0b25c --- /dev/null +++ b/stm32/emulator/src/Register_FLASH_SR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_FLASH_SR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_PWR_CR.cpp b/stm32/emulator/src/Register_PWR_CR.cpp new file mode 100644 index 0000000..701c929 --- /dev/null +++ b/stm32/emulator/src/Register_PWR_CR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_PWR_CR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_RCC_AHB1ENR.cpp b/stm32/emulator/src/Register_RCC_AHB1ENR.cpp new file mode 100644 index 0000000..2fc7938 --- /dev/null +++ b/stm32/emulator/src/Register_RCC_AHB1ENR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_RCC_AHB1ENR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_RCC_AHBENR.cpp b/stm32/emulator/src/Register_RCC_AHBENR.cpp new file mode 100644 index 0000000..0c937e6 --- /dev/null +++ b/stm32/emulator/src/Register_RCC_AHBENR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_RCC_AHBENR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_RCC_AHBRSTR.cpp b/stm32/emulator/src/Register_RCC_AHBRSTR.cpp new file mode 100644 index 0000000..c11fe1d --- /dev/null +++ b/stm32/emulator/src/Register_RCC_AHBRSTR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_RCC_AHBRSTR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_RCC_APB1ENR.cpp b/stm32/emulator/src/Register_RCC_APB1ENR.cpp new file mode 100644 index 0000000..a352d6e --- /dev/null +++ b/stm32/emulator/src/Register_RCC_APB1ENR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_RCC_APB1ENR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_RCC_APB1RSTR.cpp b/stm32/emulator/src/Register_RCC_APB1RSTR.cpp new file mode 100644 index 0000000..29c771e --- /dev/null +++ b/stm32/emulator/src/Register_RCC_APB1RSTR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_RCC_APB1RSTR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_RCC_APB2ENR.cpp b/stm32/emulator/src/Register_RCC_APB2ENR.cpp new file mode 100644 index 0000000..26ab6b0 --- /dev/null +++ b/stm32/emulator/src/Register_RCC_APB2ENR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_RCC_APB2ENR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_RCC_APB2RSTR.cpp b/stm32/emulator/src/Register_RCC_APB2RSTR.cpp new file mode 100644 index 0000000..3a896e4 --- /dev/null +++ b/stm32/emulator/src/Register_RCC_APB2RSTR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_RCC_APB2RSTR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_RCC_BDCR.cpp b/stm32/emulator/src/Register_RCC_BDCR.cpp new file mode 100644 index 0000000..4f9b437 --- /dev/null +++ b/stm32/emulator/src/Register_RCC_BDCR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_RCC_BDCR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_RCC_CFGR2.cpp b/stm32/emulator/src/Register_RCC_CFGR2.cpp new file mode 100644 index 0000000..790c602 --- /dev/null +++ b/stm32/emulator/src/Register_RCC_CFGR2.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_RCC_CFGR2::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_RCC_CFGR3.cpp b/stm32/emulator/src/Register_RCC_CFGR3.cpp new file mode 100644 index 0000000..50be9a9 --- /dev/null +++ b/stm32/emulator/src/Register_RCC_CFGR3.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_RCC_CFGR3::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_RCC_CIR.cpp b/stm32/emulator/src/Register_RCC_CIR.cpp new file mode 100644 index 0000000..e571f96 --- /dev/null +++ b/stm32/emulator/src/Register_RCC_CIR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_RCC_CIR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_RCC_CR.cpp b/stm32/emulator/src/Register_RCC_CR.cpp new file mode 100644 index 0000000..ea4e481 --- /dev/null +++ b/stm32/emulator/src/Register_RCC_CR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_RCC_CR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_RCC_CR2.cpp b/stm32/emulator/src/Register_RCC_CR2.cpp new file mode 100644 index 0000000..a997f3c --- /dev/null +++ b/stm32/emulator/src/Register_RCC_CR2.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_RCC_CR2::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_RCC_CSR.cpp b/stm32/emulator/src/Register_RCC_CSR.cpp new file mode 100644 index 0000000..c133b4c --- /dev/null +++ b/stm32/emulator/src/Register_RCC_CSR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_RCC_CSR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_RCC_PLLCFGR.cpp b/stm32/emulator/src/Register_RCC_PLLCFGR.cpp new file mode 100644 index 0000000..8ae0da3 --- /dev/null +++ b/stm32/emulator/src/Register_RCC_PLLCFGR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_RCC_PLLCFGR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_SCB_CPUID.cpp b/stm32/emulator/src/Register_SCB_CPUID.cpp new file mode 100644 index 0000000..78701b7 --- /dev/null +++ b/stm32/emulator/src/Register_SCB_CPUID.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_SCB_CPUID::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_SCB_ICSR.cpp b/stm32/emulator/src/Register_SCB_ICSR.cpp new file mode 100644 index 0000000..1665f5f --- /dev/null +++ b/stm32/emulator/src/Register_SCB_ICSR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_SCB_ICSR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_SCB_VTOR.cpp b/stm32/emulator/src/Register_SCB_VTOR.cpp new file mode 100644 index 0000000..827e02c --- /dev/null +++ b/stm32/emulator/src/Register_SCB_VTOR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_SCB_VTOR::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_SPI_CR1.cpp b/stm32/emulator/src/Register_SPI_CR1.cpp new file mode 100644 index 0000000..ca9de7b --- /dev/null +++ b/stm32/emulator/src/Register_SPI_CR1.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_SPI_CR1::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_SPI_CR2.cpp b/stm32/emulator/src/Register_SPI_CR2.cpp new file mode 100644 index 0000000..d09486d --- /dev/null +++ b/stm32/emulator/src/Register_SPI_CR2.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_SPI_CR2::operator = (uint32_t arg) { + printout("=", arg); + return value_; +} diff --git a/stm32/emulator/src/Register_SPI_SR.cpp b/stm32/emulator/src/Register_SPI_SR.cpp index 435b2f0..03edb7b 100644 --- a/stm32/emulator/src/Register_SPI_SR.cpp +++ b/stm32/emulator/src/Register_SPI_SR.cpp @@ -34,7 +34,7 @@ uint32_t Register_SPI_SR::operator = (uint32_t arg) { return value_; } -uint16_t Register_SPI_SR::operator & (uint16_t arg) const { +uint16_t Register_SPI_SR::operator & (uint16_t arg) { dr_.printout("=", dr_.value_); printout("&(16b)", value_ & arg); // XXX SPI_SR_FRLVL should probably be part of value_, @@ -47,7 +47,7 @@ uint16_t Register_SPI_SR::operator & (uint16_t arg) const { return v & arg; } -uint16_t Register_SPI_SR::operator & (uint32_t arg) const { +uint16_t Register_SPI_SR::operator & (uint32_t arg) { dr_.printout("=", dr_.value_); printout("&", value_ & arg); // XXX SPI_SR_FRLVL should probably be part of value_, diff --git a/stm32/emulator/src/Register_TIM_ARR.cpp b/stm32/emulator/src/Register_TIM_ARR.cpp new file mode 100644 index 0000000..76dd42f --- /dev/null +++ b/stm32/emulator/src/Register_TIM_ARR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_TIM_ARR::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_TIM_BDTR.cpp b/stm32/emulator/src/Register_TIM_BDTR.cpp new file mode 100644 index 0000000..2096b4b --- /dev/null +++ b/stm32/emulator/src/Register_TIM_BDTR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_TIM_BDTR::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_TIM_CCER.cpp b/stm32/emulator/src/Register_TIM_CCER.cpp new file mode 100644 index 0000000..8b62133 --- /dev/null +++ b/stm32/emulator/src/Register_TIM_CCER.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_TIM_CCER::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_TIM_CCMR1.cpp b/stm32/emulator/src/Register_TIM_CCMR1.cpp new file mode 100644 index 0000000..c7c0745 --- /dev/null +++ b/stm32/emulator/src/Register_TIM_CCMR1.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_TIM_CCMR1::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_TIM_CCMR2.cpp b/stm32/emulator/src/Register_TIM_CCMR2.cpp new file mode 100644 index 0000000..50bba10 --- /dev/null +++ b/stm32/emulator/src/Register_TIM_CCMR2.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_TIM_CCMR2::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_TIM_CCR1.cpp b/stm32/emulator/src/Register_TIM_CCR1.cpp new file mode 100644 index 0000000..15c3f3d --- /dev/null +++ b/stm32/emulator/src/Register_TIM_CCR1.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_TIM_CCR1::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_TIM_CCR2.cpp b/stm32/emulator/src/Register_TIM_CCR2.cpp new file mode 100644 index 0000000..46ecd4f --- /dev/null +++ b/stm32/emulator/src/Register_TIM_CCR2.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_TIM_CCR2::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_TIM_CCR3.cpp b/stm32/emulator/src/Register_TIM_CCR3.cpp new file mode 100644 index 0000000..b0a2f59 --- /dev/null +++ b/stm32/emulator/src/Register_TIM_CCR3.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_TIM_CCR3::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_TIM_CCR4.cpp b/stm32/emulator/src/Register_TIM_CCR4.cpp new file mode 100644 index 0000000..9112c0b --- /dev/null +++ b/stm32/emulator/src/Register_TIM_CCR4.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_TIM_CCR4::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_TIM_CR1.cpp b/stm32/emulator/src/Register_TIM_CR1.cpp new file mode 100644 index 0000000..362efe8 --- /dev/null +++ b/stm32/emulator/src/Register_TIM_CR1.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_TIM_CR1::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_TIM_CR2.cpp b/stm32/emulator/src/Register_TIM_CR2.cpp new file mode 100644 index 0000000..67a523f --- /dev/null +++ b/stm32/emulator/src/Register_TIM_CR2.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_TIM_CR2::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_TIM_DIER.cpp b/stm32/emulator/src/Register_TIM_DIER.cpp new file mode 100644 index 0000000..fee2466 --- /dev/null +++ b/stm32/emulator/src/Register_TIM_DIER.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_TIM_DIER::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_TIM_PSC.cpp b/stm32/emulator/src/Register_TIM_PSC.cpp new file mode 100644 index 0000000..eceb48c --- /dev/null +++ b/stm32/emulator/src/Register_TIM_PSC.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_TIM_PSC::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_TIM_SMCR.cpp b/stm32/emulator/src/Register_TIM_SMCR.cpp new file mode 100644 index 0000000..0c86d9b --- /dev/null +++ b/stm32/emulator/src/Register_TIM_SMCR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013-2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_TIM_SMCR::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_USART_BRR.cpp b/stm32/emulator/src/Register_USART_BRR.cpp new file mode 100644 index 0000000..5ae7ca0 --- /dev/null +++ b/stm32/emulator/src/Register_USART_BRR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_USART_BRR::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_USART_CR1.cpp b/stm32/emulator/src/Register_USART_CR1.cpp new file mode 100644 index 0000000..8bda506 --- /dev/null +++ b/stm32/emulator/src/Register_USART_CR1.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_USART_CR1::operator = (uint32_t arg) { + printout("=", arg); + return value_= arg; +} diff --git a/stm32/emulator/src/Register_USART_CR2.cpp b/stm32/emulator/src/Register_USART_CR2.cpp new file mode 100644 index 0000000..40409a2 --- /dev/null +++ b/stm32/emulator/src/Register_USART_CR2.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_USART_CR2::operator = (uint32_t arg) { + printout("=", arg); + return value_= arg; +} diff --git a/stm32/emulator/src/Register_USART_CR3.cpp b/stm32/emulator/src/Register_USART_CR3.cpp new file mode 100644 index 0000000..20eeed9 --- /dev/null +++ b/stm32/emulator/src/Register_USART_CR3.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_USART_CR3::operator = (uint32_t arg) { + printout("=", arg); + return value_= arg; +} diff --git a/stm32/emulator/src/Register_USART_DR.cpp b/stm32/emulator/src/Register_USART_DR.cpp new file mode 100644 index 0000000..f11cb11 --- /dev/null +++ b/stm32/emulator/src/Register_USART_DR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_USART_DR::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_USART_GTPR.cpp b/stm32/emulator/src/Register_USART_GTPR.cpp new file mode 100644 index 0000000..03ce9aa --- /dev/null +++ b/stm32/emulator/src/Register_USART_GTPR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_USART_GTPR::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_USART_ICR.cpp b/stm32/emulator/src/Register_USART_ICR.cpp new file mode 100644 index 0000000..5b4d932 --- /dev/null +++ b/stm32/emulator/src/Register_USART_ICR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_USART_ICR::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_USART_ISR.cpp b/stm32/emulator/src/Register_USART_ISR.cpp new file mode 100644 index 0000000..f68843e --- /dev/null +++ b/stm32/emulator/src/Register_USART_ISR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_USART_ISR::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_USART_RDR.cpp b/stm32/emulator/src/Register_USART_RDR.cpp new file mode 100644 index 0000000..b4cfba2 --- /dev/null +++ b/stm32/emulator/src/Register_USART_RDR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_USART_RDR::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_USART_RQR.cpp b/stm32/emulator/src/Register_USART_RQR.cpp new file mode 100644 index 0000000..41326a5 --- /dev/null +++ b/stm32/emulator/src/Register_USART_RQR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_USART_RQR::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_USART_RTOR.cpp b/stm32/emulator/src/Register_USART_RTOR.cpp new file mode 100644 index 0000000..c87364e --- /dev/null +++ b/stm32/emulator/src/Register_USART_RTOR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_USART_RTOR::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_USART_SR.cpp b/stm32/emulator/src/Register_USART_SR.cpp new file mode 100644 index 0000000..1a62bf0 --- /dev/null +++ b/stm32/emulator/src/Register_USART_SR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_USART_SR::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} diff --git a/stm32/emulator/src/Register_USART_TDR.cpp b/stm32/emulator/src/Register_USART_TDR.cpp new file mode 100644 index 0000000..aebbc4c --- /dev/null +++ b/stm32/emulator/src/Register_USART_TDR.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 ELL-i co-operative. + * + * This is part of ELL-i software. + * + * ELL-i software is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ELL-i software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ELL-i software. If not, see . + */ + +/** + * @author Asif Sardar 2014 + */ + +#include + +uint32_t Register_USART_TDR::operator = (uint32_t arg) { + printout("=", arg); + return value_ = arg; +} \ No newline at end of file diff --git a/stm32/emulator/src/SCB.cpp b/stm32/emulator/src/SCB.cpp index c4f0086..21e1e57 100644 --- a/stm32/emulator/src/SCB.cpp +++ b/stm32/emulator/src/SCB.cpp @@ -17,7 +17,36 @@ * along with ELL-i software. If not, see . */ +/** + * @author Asif Sardar 2014 + */ + #include SystemControlBlock SystemControlBlock::SCB; +#if defined(__STM32F407__) || defined(__STM32F334__) +void SystemControlBlock::SCB_CPUID_VALUES( SystemControlBlock *const scb, CALLBACK(SCB_CPUID_CALLBACK) ) { + SCB_CPUID_CALLBACK( scb->CPUID.registerPeriph().c_str() + , scb->CPUID.registerName().c_str() + , scb->CPUID.registerValue() + , scb->CPUID.registerOpStr().c_str() + ); +} + +void SystemControlBlock::SCB_ICSR_VALUES( SystemControlBlock *const scb, CALLBACK(SCB_ICSR_CALLBACK) ) { + SCB_ICSR_CALLBACK( scb->ICSR.registerPeriph().c_str() + , scb->ICSR.registerName().c_str() + , scb->ICSR.registerValue() + , scb->ICSR.registerOpStr().c_str() + ); +} + +void SystemControlBlock::SCB_VTOR_VALUES( SystemControlBlock *const scb, CALLBACK(SCB_VTOR_CALLBACK) ) { + SCB_VTOR_CALLBACK( scb->VTOR.registerPeriph().c_str() + , scb->VTOR.registerName().c_str() + , scb->VTOR.registerValue() + , scb->VTOR.registerOpStr().c_str() + ); +} +#endif diff --git a/stm32/emulator/src/SPI.cpp b/stm32/emulator/src/SPI.cpp index cb8c03d..723a432 100644 --- a/stm32/emulator/src/SPI.cpp +++ b/stm32/emulator/src/SPI.cpp @@ -17,8 +17,11 @@ * along with ELL-i software. If not, see . */ +/** + * @author Pekka Nikander 2014 + */ + #include SerialPeripheralInterface SerialPeripheralInterface::SPI1; SerialPeripheralInterface SerialPeripheralInterface::SPI2; - diff --git a/stm32/emulator/src/TIM.cpp b/stm32/emulator/src/TIM.cpp index 46895b3..cda62d8 100644 --- a/stm32/emulator/src/TIM.cpp +++ b/stm32/emulator/src/TIM.cpp @@ -37,3 +37,114 @@ Timer Timer::TIM15; Timer Timer::TIM16; Timer Timer::TIM17; +void Timer::TIM_CR1_VALUES( Timer *const tim, CALLBACK(TIM_CR1_CALLBACK) ) { + TIM_CR1_CALLBACK( tim->CR1.registerPeriph().c_str() + , tim->CR1.registerName().c_str() + , tim->CR1.registerValue() + , tim->CR1.registerOpStr().c_str() + ); +} + +void Timer::TIM_CR2_VALUES( Timer *const tim, CALLBACK(TIM_CR2_CALLBACK) ) { + TIM_CR2_CALLBACK( tim->CR2.registerPeriph().c_str() + , tim->CR2.registerName().c_str() + , tim->CR2.registerValue() + , tim->CR2.registerOpStr().c_str() + ); +} + +void Timer::TIM_SMCR_VALUES( Timer *const tim, CALLBACK(TIM_SMCR_CALLBACK) ) { + TIM_SMCR_CALLBACK( tim->SMCR.registerPeriph().c_str() + , tim->SMCR.registerName().c_str() + , tim->SMCR.registerValue() + , tim->SMCR.registerOpStr().c_str() + ); +} + +void Timer::TIM_DIER_VALUES( Timer *const tim, CALLBACK(TIM_DIER_CALLBACK) ) { + TIM_DIER_CALLBACK( tim->DIER.registerPeriph().c_str() + , tim->DIER.registerName().c_str() + , tim->DIER.registerValue() + , tim->DIER.registerOpStr().c_str() + ); +} + +void Timer::TIM_CCMR1_VALUES( Timer *const tim, CALLBACK(TIM_CCMR1_CALLBACK) ) { + TIM_CCMR1_CALLBACK( tim->CCMR1.registerPeriph().c_str() + , tim->CCMR1.registerName().c_str() + , tim->CCMR1.registerValue() + , tim->CCMR1.registerOpStr().c_str() + ); +} + +void Timer::TIM_CCMR2_VALUES( Timer *const tim, CALLBACK(TIM_CCMR2_CALLBACK) ) { + TIM_CCMR2_CALLBACK( tim->CCMR2.registerPeriph().c_str() + , tim->CCMR2.registerName().c_str() + , tim->CCMR2.registerValue() + , tim->CCMR2.registerOpStr().c_str() + ); +} + +void Timer::TIM_CCER_VALUES( Timer *const tim, CALLBACK(TIM_CCER_CALLBACK) ) { + TIM_CCER_CALLBACK( tim->CCER.registerPeriph().c_str() + , tim->CCER.registerName().c_str() + , tim->CCER.registerValue() + , tim->CCER.registerOpStr().c_str() + ); +} + +void Timer::TIM_BDTR_VALUES( Timer *const tim, CALLBACK(TIM_BDTR_CALLBACK) ) { + TIM_BDTR_CALLBACK( tim->BDTR.registerPeriph().c_str() + , tim->BDTR.registerName().c_str() + , tim->BDTR.registerValue() + , tim->BDTR.registerOpStr().c_str() + ); +} + +void Timer::TIM_PSC_VALUES( Timer *const tim, CALLBACK(TIM_PSC_CALLBACK) ) { + TIM_PSC_CALLBACK( tim->PSC.registerPeriph().c_str() + , tim->PSC.registerName().c_str() + , tim->PSC.registerValue() + , tim->PSC.registerOpStr().c_str() + ); +} + +void Timer::TIM_ARR_VALUES( Timer *const tim, CALLBACK(TIM_ARR_CALLBACK) ) { + TIM_ARR_CALLBACK( tim->ARR.registerPeriph().c_str() + , tim->ARR.registerName().c_str() + , tim->ARR.registerValue() + , tim->ARR.registerOpStr().c_str() + ); +} + +void Timer::TIM_CCR1_VALUES( Timer *const tim, CALLBACK(TIM_CCR1_CALLBACK) ) { + TIM_CCR1_CALLBACK( tim->CCR1.registerPeriph().c_str() + , tim->CCR1.registerName().c_str() + , tim->CCR1.registerValue() + , tim->CCR1.registerOpStr().c_str() + ); +} + +void Timer::TIM_CCR2_VALUES( Timer *const tim, CALLBACK(TIM_CCR2_CALLBACK) ) { + TIM_CCR2_CALLBACK( tim->CCR2.registerPeriph().c_str() + , tim->CCR2.registerName().c_str() + , tim->CCR2.registerValue() + , tim->CCR2.registerOpStr().c_str() + ); +} + +void Timer::TIM_CCR3_VALUES( Timer *const tim, CALLBACK(TIM_CCR3_CALLBACK) ) { + TIM_CCR3_CALLBACK( tim->CCR3.registerPeriph().c_str() + , tim->CCR3.registerName().c_str() + , tim->CCR3.registerValue() + , tim->CCR3.registerOpStr().c_str() + ); +} + +void Timer::TIM_CCR4_VALUES( Timer *const tim, CALLBACK(TIM_CCR4_CALLBACK) ) { + TIM_CCR4_CALLBACK( tim->CCR4.registerPeriph().c_str() + , tim->CCR4.registerName().c_str() + , tim->CCR4.registerValue() + , tim->CCR4.registerOpStr().c_str() + ); +} diff --git a/stm32/emulator/src/USART.cpp b/stm32/emulator/src/USART.cpp index eade775..3e2db60 100644 --- a/stm32/emulator/src/USART.cpp +++ b/stm32/emulator/src/USART.cpp @@ -17,6 +17,10 @@ * along with ELL-i software. If not, see . */ +/** + * @author Asif Sardar 2014 + */ + #include UniversalSynchronousAsynchronousReceiverTransmitter @@ -26,3 +30,168 @@ UniversalSynchronousAsynchronousReceiverTransmitter::USART2; UniversalSynchronousAsynchronousReceiverTransmitter UniversalSynchronousAsynchronousReceiverTransmitter::USART3; +#if defined(__STM32F407__) +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_SR_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_SR_CALLBACK) ) { + USART_SR_CALLBACK( usartPort->SR.registerPeriph().c_str() + , usartPort->SR.registerName().c_str() + , usartPort->SR.registerValue() + , usartPort->SR.registerOpStr().c_str() + ); +} + +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_DR_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_DR_CALLBACK) ) { + USART_DR_CALLBACK( usartPort->DR.registerPeriph().c_str() + , usartPort->DR.registerName().c_str() + , usartPort->DR.registerValue() + , usartPort->DR.registerOpStr().c_str() + ); +} + +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_BRR_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_BRR_CALLBACK) ) { + USART_BRR_CALLBACK( usartPort->BRR.registerPeriph().c_str() + , usartPort->BRR.registerName().c_str() + , usartPort->BRR.registerValue() + , usartPort->BRR.registerOpStr().c_str() + ); +} + +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_CR1_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_CR1_CALLBACK) ) { + USART_CR1_CALLBACK( usartPort->CR1.registerPeriph().c_str() + , usartPort->CR1.registerName().c_str() + , usartPort->CR1.registerValue() + , usartPort->CR1.registerOpStr().c_str() + ); +} + +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_CR2_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_CR2_CALLBACK) ) { + USART_CR2_CALLBACK( usartPort->CR2.registerPeriph().c_str() + , usartPort->CR2.registerName().c_str() + , usartPort->CR2.registerValue() + , usartPort->CR2.registerOpStr().c_str() + ); +} + +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_CR3_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_CR3_CALLBACK) ) { + USART_CR3_CALLBACK( usartPort->CR3.registerPeriph().c_str() + , usartPort->CR3.registerName().c_str() + , usartPort->CR3.registerValue() + , usartPort->CR3.registerOpStr().c_str() + ); +} + +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_GTPR_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_GTPR_CALLBACK) ) { + USART_GTPR_CALLBACK( usartPort->GTPR.registerPeriph().c_str() + , usartPort->GTPR.registerName().c_str() + , usartPort->GTPR.registerValue() + , usartPort->GTPR.registerOpStr().c_str() + ); +} +#elif defined(__STM32F051__) || defined(__STM32F334__) +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_BRR_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_BRR_CALLBACK) ) { + USART_BRR_CALLBACK( usartPort->BRR.registerPeriph().c_str() + , usartPort->BRR.registerName().c_str() + , usartPort->BRR.registerValue() + , usartPort->BRR.registerOpStr().c_str() + ); +} + +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_CR1_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_CR1_CALLBACK) ) { + USART_CR1_CALLBACK( usartPort->CR1.registerPeriph().c_str() + , usartPort->CR1.registerName().c_str() + , usartPort->CR1.registerValue() + , usartPort->CR1.registerOpStr().c_str() + ); +} + +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_CR2_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_CR2_CALLBACK) ) { + USART_CR2_CALLBACK( usartPort->CR2.registerPeriph().c_str() + , usartPort->CR2.registerName().c_str() + , usartPort->CR2.registerValue() + , usartPort->CR2.registerOpStr().c_str() + ); +} + +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_CR3_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_CR3_CALLBACK) ) { + USART_CR3_CALLBACK( usartPort->CR3.registerPeriph().c_str() + , usartPort->CR3.registerName().c_str() + , usartPort->CR3.registerValue() + , usartPort->CR3.registerOpStr().c_str() + ); +} + +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_GTPR_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_GTPR_CALLBACK) ) { + USART_GTPR_CALLBACK( usartPort->GTPR.registerPeriph().c_str() + , usartPort->GTPR.registerName().c_str() + , usartPort->GTPR.registerValue() + , usartPort->GTPR.registerOpStr().c_str() + ); +} + +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_RTOR_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_RTOR_CALLBACK) ) { + USART_RTOR_CALLBACK( usartPort->RTOR.registerPeriph().c_str() + , usartPort->RTOR.registerName().c_str() + , usartPort->RTOR.registerValue() + , usartPort->RTOR.registerOpStr().c_str() + ); +} + +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_RQR_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_RQR_CALLBACK) ) { + USART_RQR_CALLBACK( usartPort->RQR.registerPeriph().c_str() + , usartPort->RQR.registerName().c_str() + , usartPort->RQR.registerValue() + , usartPort->RQR.registerOpStr().c_str() + ); +} + +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_ISR_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_ISR_CALLBACK) ) { + USART_ISR_CALLBACK( usartPort->ISR.registerPeriph().c_str() + , usartPort->ISR.registerName().c_str() + , usartPort->ISR.registerValue() + , usartPort->ISR.registerOpStr().c_str() + ); +} + +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_ICR_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_ICR_CALLBACK) ) { + USART_ICR_CALLBACK( usartPort->ICR.registerPeriph().c_str() + , usartPort->ICR.registerName().c_str() + , usartPort->ICR.registerValue() + , usartPort->ICR.registerOpStr().c_str() + ); +} + +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_RDR_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_RDR_CALLBACK) ) { + USART_RDR_CALLBACK( usartPort->RDR.registerPeriph().c_str() + , usartPort->RDR.registerName().c_str() + , usartPort->RDR.registerValue() + , usartPort->RDR.registerOpStr().c_str() + ); +} + +void UniversalSynchronousAsynchronousReceiverTransmitter::USART_TDR_VALUES( + UniversalSynchronousAsynchronousReceiverTransmitter *const usartPort, CALLBACK(USART_TDR_CALLBACK) ) { + USART_TDR_CALLBACK( usartPort->TDR.registerPeriph().c_str() + , usartPort->TDR.registerName().c_str() + , usartPort->TDR.registerValue() + , usartPort->TDR.registerOpStr().c_str() + ); +} +#else +# error "Unknown MCU die. Please define." +#endif diff --git a/stm32/emulator/src/pythonCallback.c b/stm32/emulator/src/pythonCallback.c new file mode 100644 index 0000000..20378f8 --- /dev/null +++ b/stm32/emulator/src/pythonCallback.c @@ -0,0 +1,52 @@ +#include + +//#include + +static PyObject *my_callback = NULL; + +static PyObject *set_python_callback_reference(PyObject *dummy, PyObject *args) +{ + PyObject *result = NULL; + PyObject *temp; + + if (PyArg_ParseTuple(args, "O:REGISTER_VALUES_CALLBACK", &temp)) { + if (!PyCallable_Check(temp)) { + PyErr_SetString(PyExc_TypeError, "parameter must be callable"); + return NULL; + } + Py_XINCREF(temp); + Py_XDECREF(my_callback); + my_callback = temp; + Py_INCREF(Py_None); + result = Py_None; + } + return result; +} + +static PyObject *callback_python(PyObject *dummy, PyObject *arglist) { + PyObject *result = PyObject_CallObject(my_callback, arglist); + Py_DECREF(arglist); + if (result == NULL) { + return NULL; + } + Py_DECREF(result); + Py_INCREF(Py_None); + result = Py_None; + return result; +} + +static char set_python_callback_reference_docs[] = "Set python callback function reference from python to C call."; +static char callback_python_docs[] = "Call python callback function from C to python through python callback reference."; + +static PyMethodDef pythonCallback_methods[] = { + {"set_python_callback_reference", (PyCFunction)set_python_callback_reference, METH_VARARGS, \ + set_python_callback_reference_docs}, + {"callback_python", (PyCFunction)callback_python, METH_VARARGS, callback_python_docs}, + {NULL, NULL, 0, NULL} +}; + +PyMODINIT_FUNC +initpythonCallback(void) +{ + (void) Py_InitModule3("pythonCallback", pythonCallback_methods, "Extension module for C-to-from-python callbacks"); +} diff --git a/stm32/make/app.mk b/stm32/make/app.mk index 63e8b70..d1562ce 100644 --- a/stm32/make/app.mk +++ b/stm32/make/app.mk @@ -72,12 +72,13 @@ endif ifeq ($(PLATFORM),emulator) -all: $(APP) lib$(APP).so +all: $(APP) lib$(APP).so pythonCallback.so clean:: rm -f $(PRE_OBJS) rm -f $(POST_OBJS) rm -f lib$(APP).so + rm -f pythonCallback.so $(APP): $(APP_OBJS) libsystem_$(VARIANT).a $(LIBES_LIBS) $(PRE_OBJS) $(POST_OBJS) $(LD) $(LDFLAGS) -o $@ $(PRE_OBJS) $(APP_OBJS) $(LIBS) $(POST_OBJS) @@ -86,6 +87,10 @@ lib$(APP).so: $(APP_OBJS) libsystem_$(VARIANT).a $(LIBES_LIBS) $(PRE_OBJS) $(POS $(LD) $(LDFLAGS) $(SHAREDFLAGS) -o $@ $(PRE_OBJS) $(APP_OBJS) $(LIB_OBJS) \ $(LIBS) $(POST_OBJS) $(HOST_LIBS) +pythonCallback.so: $(APP_OBJS) libsystem_$(VARIANT).a $(LIBES_LIBS) $(PRE_OBJS) $(POST_OBJS) + $(LD) $(LDFLAGS) $(SHAREDFLAGS) -o $@ $(PRE_OBJS) $(APP_OBJS) $(LIB_OBJS) \ + $(LIBS) $(POST_OBJS) $(HOST_LIBS) + libsystem_$(VARIANT).a: @make TOP=$(TOP) -f $(TOP)make/system_lib.mk all diff --git a/stm32/make/emulator.mk b/stm32/make/emulator.mk index 1aa927f..ead9051 100644 --- a/stm32/make/emulator.mk +++ b/stm32/make/emulator.mk @@ -61,6 +61,20 @@ $(eval LIBS := \ $(subst -lstm32f3,-lsystem_$(VARIANT), \ $(call expand,compiler.cmd.ld.libs))))) + + +#The Cflags and LIBS are used for cpython extension module and cpython API in emulator +#Currently, the support is added for Linux only. +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) +#EXTRA_CFLAGS += -I/opt/pym32/include/python2.7/ -I/lib/i386-linux-gnu/ +EXTRA_CFLAGS += $(shell pkg-config --cflags python2) +EXTRA_CFLAGS += -pthread -fno-strict-aliasing -fwrapv -Wall -fPIC +LIBS += $(shell pkg-config --libs python2) -lpthread -ldl -lutil -lm +#LIBS += -L/opt/pym32/lib/ -L/lib/i386-linux-gnu/ -L/lib32 -L/usr/lib32 +#LIBS += -lpython2.7 -lpthread -ldl -lutil -lm +endif + CFLAGS += $(EXTRA_CFLAGS) CXXFLAGS += $(EXTRA_CFLAGS) @@ -74,11 +88,13 @@ POST_OBJS := emulator_post.o SHAREDFLAGS := -Wl,-dylib -Wl,-macosx_version_min -Wl,10.8 LDFLAGS := -m32 -Wl,-arch -Wl,i386 $(LD_SCRIPT) else -LDFLAGS := -m32 -march=i386 $(LD_SCRIPT) +LDFLAGS := -m32 -march=i386 $(LD_SCRIPT) SHAREDFLAGS := -shared -Xlinker --export-dynamic DYLD = $(LD) endif + + # # C++ standard library # @@ -89,11 +105,61 @@ LIBS += -lstdc++ # Additional system objects # -SYSTEM_OBJS := emulator.o Register.o GPIO.o TIM.o USART.o SPI.o -SYSTEM_OBJS += PWR.o SCB.o RCC.o FLASH.o -SYSTEM_OBJS += Register_RCC_CFGR.o +#Emulator Object File +SYSTEM_OBJS := emulator.o + +#Emulator Python Callback Module Object File +SYSTEM_OBJS += pythonCallback.o + +#Emulator Register Object File +SYSTEM_OBJS += Register.o + +#Emulator FLASH Object Files +SYSTEM_OBJS += FLASH.o +SYSTEM_OBJS += Register_FLASH_ACR.o Register_FLASH_KEYR.o Register_FLASH_OPTKEYR.o +SYSTEM_OBJS += Register_FLASH_SR.o Register_FLASH_CR.o + +#Emulator PWR Object Files +SYSTEM_OBJS += PWR.o +SYSTEM_OBJS += Register_PWR_CR.o + +#Emulator SCB Object Files +SYSTEM_OBJS += SCB.o +SYSTEM_OBJS += Register_SCB_CPUID.o Register_SCB_ICSR.o Register_SCB_VTOR.o + +#Emulator TIM Object Files +SYSTEM_OBJS += TIM.o +SYSTEM_OBJS += Register_TIM_CR1.o Register_TIM_CR2.o Register_TIM_SMCR.o +SYSTEM_OBJS += Register_TIM_DIER.o Register_TIM_CCMR1.o Register_TIM_CCMR2.o +SYSTEM_OBJS += Register_TIM_CCER.o Register_TIM_BDTR.o Register_TIM_PSC.o +SYSTEM_OBJS += Register_TIM_ARR.o Register_TIM_CCR1.o Register_TIM_CCR2.o +SYSTEM_OBJS += Register_TIM_CCR3.o Register_TIM_CCR4.o + +#Emulator RCC Object Files +SYSTEM_OBJS += RCC.o +SYSTEM_OBJS += Register_RCC_CR.o Register_RCC_PLLCFGR.o Register_RCC_CFGR.o +SYSTEM_OBJS += Register_RCC_CFGR.o Register_RCC_CIR.o Register_RCC_APB1RSTR.o +SYSTEM_OBJS += Register_RCC_AHB1ENR.o Register_RCC_AHBENR.o +SYSTEM_OBJS += Register_RCC_APB2ENR.o Register_RCC_APB1ENR.o +SYSTEM_OBJS += Register_RCC_APB2RSTR.o Register_RCC_BDCR.o +SYSTEM_OBJS += Register_RCC_CSR.o Register_RCC_AHBRSTR.o +SYSTEM_OBJS += Register_RCC_CFGR2.o Register_RCC_CFGR3.o Register_RCC_CR2.o + +#Emulator GPIO Object Files +SYSTEM_OBJS += GPIO.o SYSTEM_OBJS += Register_GPIO_PUPDR.o Register_GPIO_MODER.o Register_GPIO_IDR.o SYSTEM_OBJS += Register_GPIO_ODR.o Register_GPIO_BSRR.o Register_GPIO_AFR.o Register_GPIO_BRR.o SYSTEM_OBJS += Register_GPIO_BSRRL.o Register_GPIO_BSRRH.o -SYSTEM_OBJS += Register_SPI_SR.o Register_SPI_DR.o + +#Emulator USART Object Files +SYSTEM_OBJS += USART.o +SYSTEM_OBJS += Register_USART_BRR.o Register_USART_CR1.o Register_USART_CR2.o Register_USART_CR3.o +SYSTEM_OBJS += Register_USART_GTPR.o Register_USART_SR.o Register_USART_DR.o +SYSTEM_OBJS += Register_USART_ICR.o Register_USART_RTOR.o Register_USART_RQR.o +SYSTEM_OBJS += Register_USART_ISR.o Register_USART_RDR.o Register_USART_TDR.o + +#Emulator SPI Object Files +SYSTEM_OBJS += SPI.o +SYSTEM_OBJS += Register_SPI_CR1.o Register_SPI_CR2.o Register_SPI_SR.o Register_SPI_DR.o + VPATH += $(TOP)emulator/src diff --git a/stm32/tests/robot_library/robot_library.cpp b/stm32/tests/robot_library/robot_library.cpp index e93f505..750a4cf 100644 --- a/stm32/tests/robot_library/robot_library.cpp +++ b/stm32/tests/robot_library/robot_library.cpp @@ -17,8 +17,15 @@ * along with ELL-i software. If not, see . */ +/** + * @author Asif Sardar 2014 + */ + #include #include +//#include +//#include +//#include /** * C test wrappers for calling our APIs from Robot Framework Python code @@ -42,6 +49,9 @@ extern "C" { return 0; } +//######################################################################################################// +// Arduino Fuctions Interface +//-------------------------------------------------------------------------------------------------------- /* * C interface for the Arduino Digital API calls */ @@ -54,7 +64,9 @@ extern "C" { void t_digitalWrite(pin_t pin, uint32_t val) { digitalWrite(pin, val); } +//-------------------------------------------------------------------------------------------------------- +//-------------------------------------------------------------------------------------------------------- /* * C interface for the Arduino Analog API calls */ @@ -64,19 +76,49 @@ extern "C" { void t_noAnalogWrite(pin_t pin) { noAnalogWrite(pin); } +//-------------------------------------------------------------------------------------------------------- +//-------------------------------------------------------------------------------------------------------- /* - * C interface for the Arduino Serial object + * C interface for the Arduino Serial API calls */ - void t_SerialBegin(uint32_t baudrate) { - Serial.begin(baudrate); +#if defined(__STM32F407__) + ARDUINO_GLOBAL_IMMUTABLE class SerialClass STM32F4DiscoverySerialArray[] = { Serial1, Serial2 }; +#elif defined(__STM32F334__) + ARDUINO_GLOBAL_IMMUTABLE class SerialClass STM32F334NucleoSerialArray[] = { Serial1, Serial2, Serial3 }; +#elif defined(__STM32F051__) + ARDUINO_GLOBAL_IMMUTABLE class SerialClass EllduinoSerialArray[] = { Serial1, Serial }; +#else +# error "Unknown MCU die. Please define." +#endif + + void t_SerialBegin(uint32_t baudrate, int usartNum) { +#if defined(__STM32F407__) + STM32F4DiscoverySerialArray[usartNum-1].begin(baudrate); +#elif defined(__STM32F334__) + STM32F334NucleoSerialArray[usartNum-1].begin(baudrate); +#elif defined(__STM32F051__) + EllduinoSerialArray[usartNum-1].begin(baudrate); +#else +# error "Unknown MCU die. Please define." +#endif } - void t_SerialWrite(uint8_t c) { - Serial.write(c); + void t_SerialWrite(uint8_t c, int usartNum) { +#if defined(__STM32F407__) + STM32F4DiscoverySerialArray[usartNum-1].write(c); +#elif defined(__STM32F334__) + STM32F334NucleoSerialArray[usartNum-1].write(c); +#elif defined(__STM32F051__) + EllduinoSerialArray[usartNum-1].write(c); +#else +# error "Unknown MCU die. Please define." +#endif } +//-------------------------------------------------------------------------------------------------------- +//-------------------------------------------------------------------------------------------------------- /* - * C interface for the Arduino SPI library + * C interface for the Arduino SPI library API calls */ void t_SPI_begin(const uint8_t ss_pin) { SPI.begin(ss_pin); @@ -99,4 +141,410 @@ extern "C" { uint8_t t_SPI_transfer(uint8_t ss_pin, uint8_t data) { return SPI.transfer(ss_pin, data); } +//-------------------------------------------------------------------------------------------------------- + +//######################################################################################################// + +//######################################################################################################// +// Callback Fuctions Interface +//-------------------------------------------------------------------------------------------------------- + /* + * C interface for General Purpose Input Output (GPIO) python callback functions + */ + void t_GPIO_MODER( const char *port, CALLBACK(GPIO_MODER_CALLBACK) ) { + GPIOPORT[IDX(port)]->GPIO_MODER_VALUES( GPIOPORT[IDX(port)], GPIO_MODER_CALLBACK ); + } + void t_GPIO_PUPDR( const char *port, CALLBACK(GPIO_PUPDR_CALLBACK) ) { + GPIOPORT[IDX(port)]->GPIO_PUPDR_VALUES( GPIOPORT[IDX(port)], GPIO_PUPDR_CALLBACK ); + } + void t_GPIO_ODR( const char *port, CALLBACK(GPIO_ODR_CALLBACK) ) { + GPIOPORT[IDX(port)]->GPIO_ODR_VALUES( GPIOPORT[IDX(port)], GPIO_ODR_CALLBACK ); + } + void t_GPIO_IDR( const char *port, CALLBACK(GPIO_IDR_CALLBACK) ) { + GPIOPORT[IDX(port)]->GPIO_IDR_VALUES( GPIOPORT[IDX(port)], GPIO_IDR_CALLBACK ); + + } +#if defined(__STM32F407__) || defined(__STM32F334__) + void t_GPIO_BSRRL( const char *port, CALLBACK(GPIO_BSRRL_CALLBACK) ) { + GPIOPORT[IDX(port)]->GPIO_BSRRL_VALUES( GPIOPORT[IDX(port)], GPIO_BSRRL_CALLBACK ); + } + void t_GPIO_AFR( const char *port, CALLBACK(GPIO_AFR_CALLBACK) ) { + GPIOPORT[IDX(port)]->GPIO_AFR_VALUES( GPIOPORT[IDX(port)], GPIO_AFR_CALLBACK ); + } + void t_GPIO_BSRRH( const char *port, CALLBACK(GPIO_BSRRH_CALLBACK) ) { + GPIOPORT[IDX(port)]->GPIO_BSRRH_VALUES( GPIOPORT[IDX(port)], GPIO_BSRRH_CALLBACK ); + } +#elif defined(__STM32F051__) + void t_GPIO_BSRR( const char *port, CALLBACK(GPIO_BSRR_CALLBACK) ) { + GPIOPORT[IDX(port)]->GPIO_BSRR_VALUES( GPIOPORT[IDX(port)], GPIO_BSRR_CALLBACK ); + } + void t_GPIO_AFR( const char *port, CALLBACK(GPIO_AFR_CALLBACK) ) { + GPIOPORT[IDX(port)]->GPIO_AFR_VALUES( GPIOPORT[IDX(port)], GPIO_AFR_CALLBACK ); + } + void t_GPIO_BRR( const char *port, CALLBACK(GPIO_BRR_CALLBACK) ) { + GPIOPORT[IDX(port)]->GPIO_BRR_VALUES( GPIOPORT[IDX(port)], GPIO_BRR_CALLBACK ); + } +#else +# error "Unknown MCU die. Please define." +#endif + +//-------------------------------------------------------------------------------------------------------- + +//-------------------------------------------------------------------------------------------------------- + /* + * C interface for Universal Synchronous Asynchronous Reciever Transmitter (USART) python + * callback functions + */ +#if defined(__STM32F407__) + void t_USART_SR( int usartNum, CALLBACK(USART_SR_CALLBACK) ) { + STM32F4DiscoveryUsartArray[usartNum-1]->USART_SR_VALUES + ( STM32F4DiscoveryUsartArray[usartNum-1] + , USART_SR_CALLBACK + ); + } + void t_USART_DR( int usartNum, CALLBACK(USART_DR_CALLBACK) ) { + STM32F4DiscoveryUsartArray[usartNum-1]->USART_DR_VALUES + ( STM32F4DiscoveryUsartArray[usartNum-1] + , USART_DR_CALLBACK + ); + } + void t_USART_BRR( int usartNum, CALLBACK(USART_BRR_CALLBACK) ) { + STM32F4DiscoveryUsartArray[usartNum-1]->USART_BRR_VALUES + ( STM32F4DiscoveryUsartArray[usartNum-1] + , USART_BRR_CALLBACK + ); + } + void t_USART_CR1( int usartNum, CALLBACK(USART_CR1_CALLBACK) ) { + STM32F4DiscoveryUsartArray[usartNum-1]->USART_CR1_VALUES + ( STM32F4DiscoveryUsartArray[usartNum-1] + , USART_CR1_CALLBACK + ); + } + void t_USART_CR2( int usartNum, CALLBACK(USART_CR2_CALLBACK) ) { + STM32F4DiscoveryUsartArray[usartNum-1]->USART_CR2_VALUES + ( STM32F4DiscoveryUsartArray[usartNum-1] + , USART_CR2_CALLBACK + ); + } + void t_USART_CR3( int usartNum, CALLBACK(USART_CR3_CALLBACK) ) { + STM32F4DiscoveryUsartArray[usartNum-1]->USART_CR3_VALUES + ( STM32F4DiscoveryUsartArray[usartNum-1] + , USART_CR3_CALLBACK + ); + } + void t_USART_GTPR( int usartNum, CALLBACK(USART_GTPR_CALLBACK) ) { + STM32F4DiscoveryUsartArray[usartNum-1]->USART_GTPR_VALUES + ( STM32F4DiscoveryUsartArray[usartNum-1] + , USART_GTPR_CALLBACK + ); + } +#elif defined(__STM32F051__) || defined(__STM32F334__) + void t_USART_BRR( int usartNum, CALLBACK(USART_BRR_CALLBACK) ) { +#if defined(__STM32F051__) + EllduinoSerialArray[usartNum-1].usart_.usart_->USART_BRR_VALUES + ( EllduinoSerialArray[usartNum-1].usart_.usart_ + , USART_BRR_CALLBACK + ); +#elif defined(__STM32F334__) + STM32F334NucleoSerialArray[usartNum-1].usart_.usart_->USART_BRR_VALUES + ( STM32F334NucleoSerialArray[usartNum-1].usart_.usart_ + , USART_BRR_CALLBACK + ); +#endif + } + void t_USART_CR1( int usartNum, CALLBACK(USART_CR1_CALLBACK) ) { +#if defined(__STM32F051__) + EllduinoSerialArray[usartNum-1].usart_.usart_->USART_CR1_VALUES + ( EllduinoSerialArray[usartNum-1].usart_.usart_ + , USART_CR1_CALLBACK + ); +#elif defined(__STM32F334__) + STM32F334NucleoSerialArray[usartNum-1].usart_.usart_->USART_CR1_VALUES + ( STM32F334NucleoSerialArray[usartNum-1].usart_.usart_ + , USART_CR1_CALLBACK + ); +#endif + } + void t_USART_CR2( int usartNum, CALLBACK(USART_CR2_CALLBACK) ) { +#if defined(__STM32F051__) + EllduinoSerialArray[usartNum-1].usart_.usart_->USART_CR2_VALUES + ( EllduinoSerialArray[usartNum-1].usart_.usart_ + , USART_CR2_CALLBACK + ); +#elif defined(__STM32F334__) + STM32F334NucleoSerialArray[usartNum-1].usart_.usart_->USART_CR2_VALUES + ( STM32F334NucleoSerialArray[usartNum-1].usart_.usart_ + , USART_CR2_CALLBACK + ); +#endif + } + void t_USART_CR3( int usartNum, CALLBACK(USART_CR3_CALLBACK) ) { +#if defined(__STM32F051__) + EllduinoSerialArray[usartNum-1].usart_.usart_->USART_CR3_VALUES + ( EllduinoSerialArray[usartNum-1].usart_.usart_ + , USART_CR3_CALLBACK + ); +#elif defined(__STM32F334__) + STM32F334NucleoSerialArray[usartNum-1].usart_.usart_->USART_CR3_VALUES + ( STM32F334NucleoSerialArray[usartNum-1].usart_.usart_ + , USART_CR3_CALLBACK + ); +#endif + } + void t_USART_GTPR( int usartNum, CALLBACK(USART_GTPR_CALLBACK) ) { +#if defined(__STM32F051__) + EllduinoSerialArray[usartNum-1].usart_.usart_->USART_GTPR_VALUES + ( EllduinoSerialArray[usartNum-1].usart_.usart_ + , USART_GTPR_CALLBACK + ); +#elif defined(__STM32F334__) + STM32F334NucleoSerialArray[usartNum-1].usart_.usart_->USART_GTPR_VALUES + ( STM32F334NucleoSerialArray[usartNum-1].usart_.usart_ + , USART_GTPR_CALLBACK + ); +#endif + } + void t_USART_RTOR( int usartNum, CALLBACK(USART_RTOR_CALLBACK) ) { +#if defined(__STM32F051__) + EllduinoSerialArray[usartNum-1].usart_.usart_->USART_RTOR_VALUES + ( EllduinoSerialArray[usartNum-1].usart_.usart_ + , USART_RTOR_CALLBACK + ); +#elif defined(__STM32F334__) + STM32F334NucleoSerialArray[usartNum-1].usart_.usart_->USART_RTOR_VALUES + ( STM32F334NucleoSerialArray[usartNum-1].usart_.usart_ + , USART_RTOR_CALLBACK + ); +#endif + } + void t_USART_RQR( int usartNum, CALLBACK(USART_RQR_CALLBACK) ) { +#if defined(__STM32F051__) + EllduinoSerialArray[usartNum-1].usart_.usart_->USART_RQR_VALUES + ( EllduinoSerialArray[usartNum-1].usart_.usart_ + , USART_RQR_CALLBACK + ); +#elif defined(__STM32F334__) + STM32F334NucleoSerialArray[usartNum-1].usart_.usart_->USART_RQR_VALUES + ( STM32F334NucleoSerialArray[usartNum-1].usart_.usart_ + , USART_RQR_CALLBACK + ); +#endif + } + void t_USART_ISR( int usartNum, CALLBACK(USART_ISR_CALLBACK) ) { +#if defined(__STM32F051__) + EllduinoSerialArray[usartNum-1].usart_.usart_->USART_ISR_VALUES + ( EllduinoSerialArray[usartNum-1].usart_.usart_ + , USART_ISR_CALLBACK + ); +#elif defined(__STM32F334__) + STM32F334NucleoSerialArray[usartNum-1].usart_.usart_->USART_ISR_VALUES + ( STM32F334NucleoSerialArray[usartNum-1].usart_.usart_ + , USART_ISR_CALLBACK + ); +#endif + } + void t_USART_ICR( int usartNum, CALLBACK(USART_ICR_CALLBACK) ) { +#if defined(__STM32F051__) + EllduinoSerialArray[usartNum-1].usart_.usart_->USART_ICR_VALUES + ( EllduinoSerialArray[usartNum-1].usart_.usart_ + , USART_ICR_CALLBACK + ); +#elif defined(__STM32F334__) + STM32F334NucleoSerialArray[usartNum-1].usart_.usart_->USART_ICR_VALUES + ( STM32F334NucleoSerialArray[usartNum-1].usart_.usart_ + , USART_ICR_CALLBACK + ); +#endif + } + void t_USART_RDR( int usartNum, CALLBACK(USART_RDR_CALLBACK) ) { +#if defined(__STM32F051__) + EllduinoSerialArray[usartNum-1].usart_.usart_->USART_RDR_VALUES + ( EllduinoSerialArray[usartNum-1].usart_.usart_ + , USART_RDR_CALLBACK + ); +#elif defined(__STM32F334__) + STM32F334NucleoSerialArray[usartNum-1].usart_.usart_->USART_RDR_VALUES + ( STM32F334NucleoSerialArray[usartNum-1].usart_.usart_ + , USART_RDR_CALLBACK + ); +#endif + } + void t_USART_TDR( int usartNum, CALLBACK(USART_TDR_CALLBACK) ) { +#if defined(__STM32F051__) + EllduinoSerialArray[usartNum-1].usart_.usart_->USART_TDR_VALUES + ( EllduinoSerialArray[usartNum-1].usart_.usart_ + , USART_TDR_CALLBACK + ); +#elif defined(__STM32F334__) + STM32F334NucleoSerialArray[usartNum-1].usart_.usart_->USART_TDR_VALUES + ( STM32F334NucleoSerialArray[usartNum-1].usart_.usart_ + , USART_TDR_CALLBACK + ); +#endif + } +#else +# error "Unknown MCU die. Please define." +#endif +//-------------------------------------------------------------------------------------------------------- + +//-------------------------------------------------------------------------------------------------------- + /* + * C interface for System Control Block (SCB) python callback functions + */ +#if defined(__STM32F407__) || defined(__STM32F334__) + void t_SCB_CPUID( CALLBACK(SCB_CPUID_CALLBACK) ) { + SCB->SCB_CPUID_VALUES(SCB, SCB_CPUID_CALLBACK); + } + void t_SCB_ICSR( CALLBACK(SCB_ICSR_CALLBACK) ) { + SCB->SCB_ICSR_VALUES(SCB, SCB_ICSR_CALLBACK); + } + void t_SCB_VTOR( CALLBACK(SCB_VTOR_CALLBACK) ) { + SCB->SCB_VTOR_VALUES(SCB, SCB_VTOR_CALLBACK); + } +#endif +//-------------------------------------------------------------------------------------------------------- + +//-------------------------------------------------------------------------------------------------------- + /* + * C interface for Power Control (PWR) python callback functions + */ +#if defined(__STM32F407__) + void t_PWR_CR( CALLBACK(PWR_CR_CALLBACK) ) { + PWR->PWR_CR_VALUES(PWR, PWR_CR_CALLBACK); + } +#endif +//-------------------------------------------------------------------------------------------------------- + +//-------------------------------------------------------------------------------------------------------- + /* + * C interface for Power Control (PWR) python callback functions + */ + void t_FLASH_ACR( CALLBACK(FLASH_ACR_CALLBACK) ) { + FLASH->FLASH_ACR_VALUES(FLASH, FLASH_ACR_CALLBACK); + } + void t_FLASH_KEYR( CALLBACK(FLASH_KEYR_CALLBACK) ) { + FLASH->FLASH_KEYR_VALUES(FLASH, FLASH_KEYR_CALLBACK); + } + void t_FLASH_OPTKEYR( CALLBACK(FLASH_OPTKEYR_CALLBACK) ) { + FLASH->FLASH_OPTKEYR_VALUES(FLASH, FLASH_OPTKEYR_CALLBACK); + } + void t_FLASH_SR( CALLBACK(FLASH_SR_CALLBACK) ) { + FLASH->FLASH_SR_VALUES(FLASH, FLASH_SR_CALLBACK); + } + void t_FLASH_CR( CALLBACK(FLASH_CR_CALLBACK) ) { + FLASH->FLASH_CR_VALUES(FLASH, FLASH_CR_CALLBACK); + } +//-------------------------------------------------------------------------------------------------------- + +//-------------------------------------------------------------------------------------------------------- + /* + * C interface for Reset Clock Control (RCC) python callback functions + */ + void t_RCC_CR( CALLBACK(RCC_CR_CALLBACK) ) { + RCC->RCC_CR_VALUES(RCC, RCC_CR_CALLBACK); + } +#if defined(__STM32F407__) + void t_RCC_PLLCFGR( CALLBACK(RCC_PLLCFGR_CALLBACK) ) { + RCC->RCC_PLLCFGR_VALUES(RCC, RCC_PLLCFGR_CALLBACK); + } +#endif + void t_RCC_CFGR( CALLBACK(RCC_CFGR_CALLBACK) ) { + RCC->RCC_CFGR_VALUES(RCC, RCC_CFGR_CALLBACK); + } + void t_RCC_CIR( CALLBACK(RCC_CIR_CALLBACK) ) { + RCC->RCC_CIR_VALUES(RCC, RCC_CIR_CALLBACK); + } + void t_RCC_APB1RSTR( CALLBACK(RCC_APB1RSTR_CALLBACK) ) { + RCC->RCC_APB1RSTR_VALUES(RCC, RCC_APB1RSTR_CALLBACK); + } +#if defined(__STM32F407__) + void t_RCC_AHB1ENR( CALLBACK(RCC_AHB1ENR_CALLBACK) ) { + RCC->RCC_AHB1ENR_VALUES(RCC, RCC_AHB1ENR_CALLBACK); + } +#elif defined(__STM32F051__) || defined(__STM32F334__) + void t_RCC_AHBENR( CALLBACK(RCC_AHBENR_CALLBACK) ) { + RCC->RCC_AHBENR_VALUES(RCC, RCC_AHBENR_CALLBACK); + } +#else +# error "Unknown MCU die. Please define." +#endif + void t_RCC_APB2ENR( CALLBACK(RCC_APB2ENR_CALLBACK) ) { + RCC->RCC_APB2ENR_VALUES(RCC, RCC_APB2ENR_CALLBACK); + } + void t_RCC_APB1ENR( CALLBACK(RCC_APB1ENR_CALLBACK) ) { + RCC->RCC_APB1ENR_VALUES(RCC, RCC_APB1ENR_CALLBACK); + } + void t_RCC_APB2RSTR( CALLBACK(RCC_APB2RSTR_CALLBACK) ) { + RCC->RCC_APB2RSTR_VALUES(RCC, RCC_APB2RSTR_CALLBACK); + } + void t_RCC_BDCR( CALLBACK(RCC_BDCR_CALLBACK) ) { + RCC->RCC_BDCR_VALUES(RCC, RCC_BDCR_CALLBACK); + } + void t_RCC_CSR( CALLBACK(RCC_CSR_CALLBACK) ) { + RCC->RCC_CSR_VALUES(RCC, RCC_CSR_CALLBACK); + } + void t_RCC_AHBRSTR( CALLBACK(RCC_AHBRSTR_CALLBACK) ) { + RCC->RCC_AHBRSTR_VALUES(RCC, RCC_AHBRSTR_CALLBACK); + } + void t_RCC_CFGR2( CALLBACK(RCC_CFGR2_CALLBACK) ) { + RCC->RCC_CFGR2_VALUES(RCC, RCC_CFGR2_CALLBACK); + } + void t_RCC_CFGR3( CALLBACK(RCC_CFGR3_CALLBACK) ) { + RCC->RCC_CFGR3_VALUES(RCC, RCC_CFGR3_CALLBACK); + } + void t_RCC_CR2( CALLBACK(RCC_CR2_CALLBACK) ) { + RCC->RCC_CR2_VALUES(RCC, RCC_CR2_CALLBACK); + } +//-------------------------------------------------------------------------------------------------------- + +//-------------------------------------------------------------------------------------------------------- + /* + * C interface for Timers (TIM) python callback functions + */ + void t_TIM_CR1( int timNum, CALLBACK(TIM_CR1_CALLBACK) ) { + TIM[timNum-1]->TIM_CR1_VALUES(TIM[timNum-1], TIM_CR1_CALLBACK); + } + void t_TIM_CR2( int timNum, CALLBACK(TIM_CR2_CALLBACK) ) { + TIM[timNum-1]->TIM_CR2_VALUES(TIM[timNum-1], TIM_CR2_CALLBACK); + } + void t_TIM_SMCR( int timNum, CALLBACK(TIM_SMCR_CALLBACK) ) { + TIM[timNum-1]->TIM_SMCR_VALUES(TIM[timNum-1], TIM_SMCR_CALLBACK); + } + void t_TIM_DIER( int timNum, CALLBACK(TIM_DIER_CALLBACK) ) { + TIM[timNum-1]->TIM_DIER_VALUES(TIM[timNum-1], TIM_DIER_CALLBACK); + } + void t_TIM_CCMR1( int timNum, CALLBACK(TIM_CCMR1_CALLBACK) ) { + TIM[timNum-1]->TIM_CCMR1_VALUES(TIM[timNum-1], TIM_CCMR1_CALLBACK); + } + void t_TIM_CCMR2( int timNum, CALLBACK(TIM_CCMR2_CALLBACK) ) { + TIM[timNum-1]->TIM_CCMR2_VALUES(TIM[timNum-1], TIM_CCMR2_CALLBACK); + } + void t_TIM_CCER( int timNum, CALLBACK(TIM_CCER_CALLBACK) ) { + TIM[timNum-1]->TIM_CCER_VALUES(TIM[timNum-1], TIM_CCER_CALLBACK); + } + void t_TIM_BDTR( int timNum, CALLBACK(TIM_BDTR_CALLBACK) ) { + TIM[timNum-1]->TIM_BDTR_VALUES(TIM[timNum-1], TIM_BDTR_CALLBACK); + } + void t_TIM_PSC( int timNum, CALLBACK(TIM_PSC_CALLBACK) ) { + TIM[timNum-1]->TIM_PSC_VALUES(TIM[timNum-1], TIM_PSC_CALLBACK); + } + void t_TIM_ARR( int timNum, CALLBACK(TIM_ARR_CALLBACK) ) { + TIM[timNum-1]->TIM_ARR_VALUES(TIM[timNum-1], TIM_ARR_CALLBACK); + } + void t_TIM_CCR1( int timNum, CALLBACK(TIM_CCR1_CALLBACK) ) { + TIM[timNum-1]->TIM_CCR1_VALUES(TIM[timNum-1], TIM_CCR1_CALLBACK); + } + void t_TIM_CCR2( int timNum, CALLBACK(TIM_CCR2_CALLBACK) ) { + TIM[timNum-1]->TIM_CCR2_VALUES(TIM[timNum-1], TIM_CCR2_CALLBACK); + } + void t_TIM_CCR3( int timNum, CALLBACK(TIM_CCR3_CALLBACK) ) { + TIM[timNum-1]->TIM_CCR3_VALUES(TIM[timNum-1], TIM_CCR3_CALLBACK); + } + void t_TIM_CCR4( int timNum, CALLBACK(TIM_CCR4_CALLBACK) ) { + TIM[timNum-1]->TIM_CCR4_VALUES(TIM[timNum-1], TIM_CCR4_CALLBACK); + } +//-------------------------------------------------------------------------------------------------------- + +//######################################################################################################// + };