commit bbab8bdaee0112f384f2057c23b478bc283547e1 Author: Penguin Date: Sun Jun 21 18:24:59 2020 -0500 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..5659db0d --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +GTAGS +GPATH +GRTAGS +.clang_complete + diff --git a/README.md b/README.md new file mode 100644 index 00000000..aac90175 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# ePenguin Software Framework diff --git a/arch/arm/SAM_D2X/hal/inc/hal_cache.h b/arch/arm/SAM_D2X/hal/inc/hal_cache.h new file mode 100644 index 00000000..8305bb9c --- /dev/null +++ b/arch/arm/SAM_D2X/hal/inc/hal_cache.h @@ -0,0 +1,18 @@ +#ifndef _HAL_CACHE_H_ +#define _HAL_CACHE_H_ + +#ifdef HAL_CACHE_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} +#endif + + +#endif + +#endif diff --git a/arch/arm/SAM_D2X/hal/inc/hal_clock.h b/arch/arm/SAM_D2X/hal/inc/hal_clock.h new file mode 100644 index 00000000..578d9722 --- /dev/null +++ b/arch/arm/SAM_D2X/hal/inc/hal_clock.h @@ -0,0 +1,13 @@ +#ifndef _HAL_CLOCK_H_ +#define _HAL_CLOCK_H_ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/arch/arm/SAM_D2X/hal/inc/hal_gpio.h b/arch/arm/SAM_D2X/hal/inc/hal_gpio.h new file mode 100644 index 00000000..a5f32aeb --- /dev/null +++ b/arch/arm/SAM_D2X/hal/inc/hal_gpio.h @@ -0,0 +1,14 @@ +#ifndef _HAL_GPIO_H_ +#define _HAL_GPIO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/arch/arm/SAM_D2X/hal/inc/hal_init.h b/arch/arm/SAM_D2X/hal/inc/hal_init.h new file mode 100644 index 00000000..95b72ed4 --- /dev/null +++ b/arch/arm/SAM_D2X/hal/inc/hal_init.h @@ -0,0 +1,9 @@ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} +#endif diff --git a/arch/arm/SAM_D2X/hal/inc/samd2x.hpp b/arch/arm/SAM_D2X/hal/inc/samd2x.hpp new file mode 100644 index 00000000..a59b9f9d --- /dev/null +++ b/arch/arm/SAM_D2X/hal/inc/samd2x.hpp @@ -0,0 +1,8 @@ +#ifndef _SAMD2X_HPP_ +#define _SAMD2X_HPP_ + + + + + +#endif diff --git a/arch/arm/common/inc/main.cpp b/arch/arm/common/inc/main.cpp new file mode 100644 index 00000000..c9a61fd9 --- /dev/null +++ b/arch/arm/common/inc/main.cpp @@ -0,0 +1,7 @@ +#include + +int main() +{ + USART_Async x; + +} diff --git a/arch/arm/common/inc/mcu.hpp b/arch/arm/common/inc/mcu.hpp new file mode 100644 index 00000000..a6d68a28 --- /dev/null +++ b/arch/arm/common/inc/mcu.hpp @@ -0,0 +1,20 @@ +#ifndef _MCU_H_ +#define _MCU_H_ + +#define MCU_ARCH_ARM (0) +#define MCU_ARCH_ARM64 (1) +#define MCU_ARCH_AVR (2) + +#define MCU_MANUF_MICROCHIP (0) + +#define MCU_TYPE atsamd2x + +#define MCU_ARCH MCU_ARCH_ARM +#define MCU_MANUF MCU_MANUF_MICROCHIP + + +#if MCU_ARCH == MCU_ARCH_ARM + typedef mcu +#elif + +#endif diff --git a/arch/arm/common/inc/notes.txt b/arch/arm/common/inc/notes.txt new file mode 100644 index 00000000..efb4050c --- /dev/null +++ b/arch/arm/common/inc/notes.txt @@ -0,0 +1,31 @@ +I2C - Software Addressed Protocol + Clocked Protocol +Pins: SDA = Serial Data + SCL = Serial Clock + +Speeds up to 400Khz, 1 Mhz + +SPI - Serial Protocol Interface + Hardware Addressed Protocol + Clocked Protocol + +Pins: MOSI (Master Out Slave In) + MISO (Master In Slave Out) + SCL Serial Clock + SS or nCS (Slave Select or not Chip Select) + +Up to 20Mhz + +USART Two Wire, Non Clocked Protocol + +Pins: +TX: Transmit +RX: Receive + +Baudrate = bits per second (sorta) + +frequency = 100 / 1 time in seconds + +9600 +115200 +38400 diff --git a/arch/arm/common/inc/usart.h b/arch/arm/common/inc/usart.h new file mode 100644 index 00000000..ce8e0898 --- /dev/null +++ b/arch/arm/common/inc/usart.h @@ -0,0 +1,18 @@ +#ifndef _USART_H_ +#define _USART_H_ + + +class Usart +{ + public: + Usart(); + ~Usart(); + + void Write(const char* arr); + void Read(char* arr, int max_len); + private: + hal_usart _usart; + +}; + +#endif \ No newline at end of file diff --git a/arch/arm/common/src/mcu.cpp b/arch/arm/common/src/mcu.cpp new file mode 100644 index 00000000..e69de29b diff --git a/conf/epenguin_conf.h b/conf/epenguin_conf.h new file mode 100644 index 00000000..13f2df11 --- /dev/null +++ b/conf/epenguin_conf.h @@ -0,0 +1,13 @@ +#ifndef _EPENGUIN_CONF_H_ +#define _EPENGUIN_CONF_H_ + +#include "epenguin_master.h" + +#define EP_UARCH __UARCH_ARM__ +#define EP_MCU_FAMILY __SAM_D2X__ +#define EP_MCU __ATSAMD21J18A__ + +#define EP_DRIVERS (0) + + +#endif diff --git a/conf/epenguin_master.h b/conf/epenguin_master.h new file mode 100644 index 00000000..e3d3c39b --- /dev/null +++ b/conf/epenguin_master.h @@ -0,0 +1,40 @@ +/* -- ePenguin Master -- + + This master file dictates all supported hardware. It lists supported + architectures, mcu families, and specific mcus. This software framework + targets hardware at the mcu level--not at the board level. Board layers can + be applied, but this framework targets the mcu and the mcu alone. + +*/ +#ifndef _EPENGUIN_MASTER_H_ +#define _EPENGUIN_MASTER_H_ + +#ifndef __UARCHITECTURES__ +#define __UARCHITECTURES__ + #define __UARCH_ARM__ (0) + #define __UARCH_ARM64__ (1) + #define __UARCH_AVR__ (2) + #define __UARCH_AVR32__ (3) + #define __UARCH_X86__ (4) + #define __UARCH_RISCV__ (5) +#endif + +#ifndef __UFAMILIES__ +#define __UFAMILIES__ + /* Support ARM MCU Families */ + + /* Microchip */ + #define __SAM_D1X__ (0) + #define __SAM_C1X__ (1) + #define __SAM_D2X__ (2) + #define __SAM_E_D5X__ (3) + #define __SAM_C2X__ (4) + #define __SAM_L2X__ (5) + + /* STMicroelectronics */ + + /* NXP */ + +#endif + +#endif diff --git a/epenguin.h b/epenguin.h new file mode 100644 index 00000000..64c0f3bd --- /dev/null +++ b/epenguin.h @@ -0,0 +1,7 @@ +#ifndef _EPENGUIN_H_ +#define _EPENGUIN_H_ + +#include "mcu.h" + + +#endif diff --git a/mcu.h b/mcu.h new file mode 100644 index 00000000..4ad39626 --- /dev/null +++ b/mcu.h @@ -0,0 +1,35 @@ +#ifndef __MCU_H__ +#define __MCU_H__ + +#include "epenguin_conf.h" + +#ifndef EP_UARCH + #error You must specify an architecture! +#elifndef EP_MCU_FAMILY + #error You must specify a mcu family! +#elifndef EP_MCU + #error You must specify a mcu! +#else + #if EP_UARCH == __UARCH_ARM__ + #if EP_MCU_FAMILY == __SAM_D2X__ + #if EP_MCU == __ATSAMD21J18A__ + #else + #endif + #elif EP_MCU + #endif + #elif EP_UARCH == __UARCH_ARM64__ + + #elif EP_UARCH == __UARCH_AVR__ + + #elif EP_UARCH == __UARCH_AVR32__ + + #elif EP_UARCH == __UARCH_RISCV__ + + #elif EP_UARCH == __UARCH_X86__ + + #else + #error Selected uarch not found! Try again =( + #endif +#endif + +#endif