From 57e77a69ba8785023633ec190cd06f73ebaf399a Mon Sep 17 00:00:00 2001 From: Filipe Carvalho <34546039+filcarv@users.noreply.github.com> Date: Sun, 12 Jul 2020 17:03:44 +0100 Subject: [PATCH] Added the Starter Kit for the current Harp implementation. --- DeviceStarterKit/StarterKit.atsln | 20 ++ DeviceStarterKit/StarterKit/Debug/Makefile | 158 +++++++++++++++ DeviceStarterKit/StarterKit/Debug/makedep.mk | 14 ++ DeviceStarterKit/StarterKit/Device.cproj | 134 +++++++++++++ DeviceStarterKit/StarterKit/app.c | 165 ++++++++++++++++ DeviceStarterKit/StarterKit/app.h | 18 ++ DeviceStarterKit/StarterKit/app_funcs.c | 56 ++++++ DeviceStarterKit/StarterKit/app_funcs.h | 30 +++ .../StarterKit/app_ios_and_regs.c | 40 ++++ .../StarterKit/app_ios_and_regs.h | 63 ++++++ DeviceStarterKit/StarterKit/cpu.h | 180 +++++++++++++++++ DeviceStarterKit/StarterKit/hwbp_core.h | 123 ++++++++++++ DeviceStarterKit/StarterKit/hwbp_core_com.h | 182 ++++++++++++++++++ DeviceStarterKit/StarterKit/hwbp_core_regs.h | 50 +++++ DeviceStarterKit/StarterKit/hwbp_core_types.h | 34 ++++ DeviceStarterKit/StarterKit/hwbp_sync.h | 44 +++++ DeviceStarterKit/StarterKit/interrupts.c | 36 ++++ DeviceStarterKit/StarterKit/main.c | 17 ++ DeviceStarterKit/StarterKit/registers.xls | Bin 0 -> 80896 bytes 19 files changed, 1364 insertions(+) create mode 100644 DeviceStarterKit/StarterKit.atsln create mode 100644 DeviceStarterKit/StarterKit/Debug/Makefile create mode 100644 DeviceStarterKit/StarterKit/Debug/makedep.mk create mode 100644 DeviceStarterKit/StarterKit/Device.cproj create mode 100644 DeviceStarterKit/StarterKit/app.c create mode 100644 DeviceStarterKit/StarterKit/app.h create mode 100644 DeviceStarterKit/StarterKit/app_funcs.c create mode 100644 DeviceStarterKit/StarterKit/app_funcs.h create mode 100644 DeviceStarterKit/StarterKit/app_ios_and_regs.c create mode 100644 DeviceStarterKit/StarterKit/app_ios_and_regs.h create mode 100644 DeviceStarterKit/StarterKit/cpu.h create mode 100644 DeviceStarterKit/StarterKit/hwbp_core.h create mode 100644 DeviceStarterKit/StarterKit/hwbp_core_com.h create mode 100644 DeviceStarterKit/StarterKit/hwbp_core_regs.h create mode 100644 DeviceStarterKit/StarterKit/hwbp_core_types.h create mode 100644 DeviceStarterKit/StarterKit/hwbp_sync.h create mode 100644 DeviceStarterKit/StarterKit/interrupts.c create mode 100644 DeviceStarterKit/StarterKit/main.c create mode 100644 DeviceStarterKit/StarterKit/registers.xls diff --git a/DeviceStarterKit/StarterKit.atsln b/DeviceStarterKit/StarterKit.atsln new file mode 100644 index 0000000..edfbfda --- /dev/null +++ b/DeviceStarterKit/StarterKit.atsln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Atmel Studio Solution File, Format Version 11.00 +Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "Device", "StarterKit\Device.cproj", "{D4CC7258-F73C-4625-A4DA-7BA2E029F314}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|AVR = Debug|AVR + Release|AVR = Release|AVR + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D4CC7258-F73C-4625-A4DA-7BA2E029F314}.Debug|AVR.ActiveCfg = Debug|AVR + {D4CC7258-F73C-4625-A4DA-7BA2E029F314}.Debug|AVR.Build.0 = Debug|AVR + {D4CC7258-F73C-4625-A4DA-7BA2E029F314}.Release|AVR.ActiveCfg = Release|AVR + {D4CC7258-F73C-4625-A4DA-7BA2E029F314}.Release|AVR.Build.0 = Release|AVR + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DeviceStarterKit/StarterKit/Debug/Makefile b/DeviceStarterKit/StarterKit/Debug/Makefile new file mode 100644 index 0000000..927bfe8 --- /dev/null +++ b/DeviceStarterKit/StarterKit/Debug/Makefile @@ -0,0 +1,158 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +SHELL := cmd.exe +RM := rm -rf + +USER_OBJS := + +LIBS := +PROJ := + +O_SRCS := +C_SRCS := +S_SRCS := +S_UPPER_SRCS := +OBJ_SRCS := +ASM_SRCS := +PREPROCESSING_SRCS := +OBJS := +OBJS_AS_ARGS := +C_DEPS := +C_DEPS_AS_ARGS := +EXECUTABLES := +OUTPUT_FILE_PATH := +OUTPUT_FILE_PATH_AS_ARGS := +AVR_APP_PATH :=$$$AVR_APP_PATH$$$ +QUOTE := " +ADDITIONAL_DEPENDENCIES:= +OUTPUT_FILE_DEP:= +LIB_DEP:= +LINKER_SCRIPT_DEP:= + +# Every subdirectory with source files must be described here +SUBDIRS := + + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../app.c \ +../app_funcs.c \ +../app_ios_and_regs.c \ +../interrupts.c \ +../main.c + + +PREPROCESSING_SRCS += + + +ASM_SRCS += + + +OBJS += \ +app.o \ +app_funcs.o \ +app_ios_and_regs.o \ +interrupts.o \ +main.o + +OBJS_AS_ARGS += \ +app.o \ +app_funcs.o \ +app_ios_and_regs.o \ +interrupts.o \ +main.o + +C_DEPS += \ +app.d \ +app_funcs.d \ +app_ios_and_regs.d \ +interrupts.d \ +main.d + +C_DEPS_AS_ARGS += \ +app.d \ +app_funcs.d \ +app_ios_and_regs.d \ +interrupts.d \ +main.d + +OUTPUT_FILE_PATH +=Device.elf + +OUTPUT_FILE_PATH_AS_ARGS +=Device.elf + +ADDITIONAL_DEPENDENCIES:= + +OUTPUT_FILE_DEP:= ./makedep.mk + +LIB_DEP+= \ +C:/Users/Filipe\ Carvalho/Documents/BitBucket.FilCarvalho/Harp/Corelibrary.Atxmega/DeviceStarterKit\ -\ Copy_/StarterKit/libATxmega128A1U-1.6.a + +LINKER_SCRIPT_DEP+= + + +# AVR32/GNU C Compiler + + + + + + + + + + + +./%.o: .././%.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 4.8.1 + $(QUOTE)C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -O3 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega128a1u -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + + + +# AVR32/GNU Preprocessing Assembler + + + +# AVR32/GNU Assembler + + + + +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(strip $(C_DEPS)),) +-include $(C_DEPS) +endif +endif + +# Add inputs and outputs from these tool invocations to the build variables + +# All Target +all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES) + +$(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP) $(LIB_DEP) $(LINKER_SCRIPT_DEP) + @echo Building target: $@ + @echo Invoking: AVR/GNU Linker : 4.8.1 + $(QUOTE)C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="Device.map" -Wl,--start-group -Wl,-lm -Wl,-lATxmega128A1U-1.6 -Wl,--end-group -Wl,-L"C:\Users\Filipe Carvalho\Documents\BitBucket.FilCarvalho\Harp\Corelibrary.Atxmega\DeviceStarterKit_Filipe\StarterKit" -Wl,-L"C:\Users\FILIPE~1\DOCUME~1\BITBUC~1.FIL\Harp\CORELI~1.ATX\DEVICE~2\STARTE~1" -Wl,-L"C:\Users\FILIPE~1\DOCUME~1\BITBUC~1.FIL\Harp\CORELI~1.ATX\DEVICE~1\STARTE~1" -Wl,--gc-sections -mrelax -mmcu=atxmega128a1u + @echo Finished building target: $@ + "C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "Device.elf" "Device.hex" + "C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "Device.elf" "Device.eep" || exit 0 + "C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "Device.elf" > "Device.lss" + "C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "Device.elf" "Device.srec" + "C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin\avr-size.exe" "Device.elf" + + + + + + + +# Other Targets +clean: + -$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES) + -$(RM) $(C_DEPS_AS_ARGS) + rm -rf "Device.elf" "Device.a" "Device.hex" "Device.lss" "Device.eep" "Device.map" "Device.srec" "Device.usersignatures" + \ No newline at end of file diff --git a/DeviceStarterKit/StarterKit/Debug/makedep.mk b/DeviceStarterKit/StarterKit/Debug/makedep.mk new file mode 100644 index 0000000..b203181 --- /dev/null +++ b/DeviceStarterKit/StarterKit/Debug/makedep.mk @@ -0,0 +1,14 @@ +################################################################################ +# Automatically-generated file. Do not edit or delete the file +################################################################################ + +app.c + +app_funcs.c + +app_ios_and_regs.c + +interrupts.c + +main.c + diff --git a/DeviceStarterKit/StarterKit/Device.cproj b/DeviceStarterKit/StarterKit/Device.cproj new file mode 100644 index 0000000..3150c7c --- /dev/null +++ b/DeviceStarterKit/StarterKit/Device.cproj @@ -0,0 +1,134 @@ + + + + 2.0 + 6.2 + com.Atmel.AVRGCC8.C + {d4cc7258-f73c-4625-a4da-7ba2e029f314} + ATxmega128A1U + none + Executable + C + $(MSBuildProjectName) + .elf + $(MSBuildProjectDirectory)\$(Configuration) + StarterKit + Device + StarterKit + Native + true + false + true + true + + + true + + 2 + 1 + + + + + + + + + + + + + + + + + True + True + True + True + True + False + True + True + + + NDEBUG + + + Optimize for size (-Os) + True + True + True + + + libm + libATxmega128A1U-1.6.a + + + + + C:\Users\Filipe Carvalho\Documents\BitBucket.FilCarvalho\Harp\Corelibrary.Atxmega\DeviceStarterKit_Filipe\StarterKit + C:\Users\Filipe Carvalho\Documents\BitBucket.FilCarvalho\Harp\Corelibrary.Atxmega\DeviceStarterKit - Copy_\StarterKit + C:\Users\Filipe Carvalho\Documents\BitBucket.FilCarvalho\Harp\Corelibrary.Atxmega\DeviceStarterKit\StarterKit + + + + + + + + + True + True + True + True + True + False + True + True + + + DEBUG + + + Optimize most (-O3) + True + True + Default (-g2) + True + + + libm + libATxmega128A1U-1.6.a + + + + + C:\Users\Filipe Carvalho\Documents\BitBucket.FilCarvalho\Harp\Corelibrary.Atxmega\DeviceStarterKit_Filipe\StarterKit + C:\Users\Filipe Carvalho\Documents\BitBucket.FilCarvalho\Harp\Corelibrary.Atxmega\DeviceStarterKit - Copy_\StarterKit + C:\Users\Filipe Carvalho\Documents\BitBucket.FilCarvalho\Harp\Corelibrary.Atxmega\DeviceStarterKit\StarterKit + + + Default (-Wa,-g) + + + + + + compile + + + compile + + + compile + + + compile + + + compile + + + + \ No newline at end of file diff --git a/DeviceStarterKit/StarterKit/app.c b/DeviceStarterKit/StarterKit/app.c new file mode 100644 index 0000000..dbfbcbf --- /dev/null +++ b/DeviceStarterKit/StarterKit/app.c @@ -0,0 +1,165 @@ +#include "hwbp_core.h" +#include "hwbp_core_regs.h" +#include "hwbp_core_types.h" + +#include "app.h" +#include "app_funcs.h" +#include "app_ios_and_regs.h" + +/************************************************************************/ +/* Declare application registers */ +/************************************************************************/ +extern AppRegs app_regs; +extern uint8_t app_regs_type[]; +extern uint16_t app_regs_n_elements[]; +extern uint8_t *app_regs_pointer[]; +extern void (*app_func_rd_pointer[])(void); +extern bool (*app_func_wr_pointer[])(void*); + +/************************************************************************/ +/* Initialize app */ +/************************************************************************/ +static const uint8_t default_device_name[] = "MyHarpDevice"; + +void hwbp_app_initialize(void) +{ + /* Define versions */ + uint8_t hwH = 1; + uint8_t hwL = 0; + uint8_t fwH = 1; + uint8_t fwL = 0; + uint8_t ass = 0; + + /* Start core */ + core_func_start_core( + 12345, + hwH, hwL, + fwH, fwL, + ass, + (uint8_t*)(&app_regs), + APP_NBYTES_OF_REG_BANK, + APP_REGS_ADD_MAX - APP_REGS_ADD_MIN + 1, + default_device_name + ); +} + +/************************************************************************/ +/* Handle if a catastrophic error occur */ +/************************************************************************/ +void core_callback_catastrophic_error_detected(void) +{ + +} + +/************************************************************************/ +/* User functions */ +/************************************************************************/ +/* Add your functions here or load external functions if needed */ + +/************************************************************************/ +/* Initialization Callbacks */ +/************************************************************************/ +void core_callback_1st_config_hw_after_boot(void) +{ + /* Initialize IOs */ + /* Don't delete this function!!! */ + init_ios(); + + /* Initialize hardware */ + +} + +void core_callback_reset_registers(void) +{ + /* Initialize registers */ + +} + +void core_callback_registers_were_reinitialized(void) +{ + /* Update registers if needed */ + +} + +/************************************************************************/ +/* Callbacks: Visualization */ +/************************************************************************/ +void core_callback_visualen_to_on(void) +{ + /* Update visual indicators */ + +} + +void core_callback_visualen_to_off(void) +{ + /* Clear all the enabled indicators */ + +} + +/************************************************************************/ +/* Callbacks: Change on the operation mode */ +/************************************************************************/ +void core_callback_device_to_standby(void) {} +void core_callback_device_to_active(void) {} +void core_callback_device_to_enchanced_active(void) {} +void core_callback_device_to_speed(void) {} + +/************************************************************************/ +/* Callbacks: 1 ms timer */ +/************************************************************************/ +void core_callback_t_before_exec(void) {} +void core_callback_t_after_exec(void) {} +void core_callback_t_new_second(void) {} +void core_callback_t_500us(void) {} +void core_callback_t_1ms(void) {} + +/************************************************************************/ +/* Callbacks: uart control */ +/************************************************************************/ +void core_callback_uart_rx_before_exec(void) {} +void core_callback_uart_rx_after_exec(void) {} +void core_callback_uart_tx_before_exec(void) {} +void core_callback_uart_tx_after_exec(void) {} +void core_callback_uart_cts_before_exec(void) {} +void core_callback_uart_cts_after_exec(void) {} + +/************************************************************************/ +/* Callbacks: Read app register */ +/************************************************************************/ +bool core_read_app_register(uint8_t add, uint8_t type) +{ + /* Check if it will not access forbidden memory */ + if (add < APP_REGS_ADD_MIN || add > APP_REGS_ADD_MAX) + return false; + + /* Check if type matches */ + if (app_regs_type[add-APP_REGS_ADD_MIN] != type) + return false; + + /* Receive data */ + (*app_func_rd_pointer[add-APP_REGS_ADD_MIN])(); + + /* Return success */ + return true; +} + +/************************************************************************/ +/* Callbacks: Write app register */ +/************************************************************************/ +bool core_write_app_register(uint8_t add, uint8_t type, uint8_t * content, uint16_t n_elements) +{ + /* Check if it will not access forbidden memory */ + if (add < APP_REGS_ADD_MIN || add > APP_REGS_ADD_MAX) + return false; + + /* Check if type matches */ + if (app_regs_type[add-APP_REGS_ADD_MIN] != type) + return false; + + /* Check if the number of elements matches */ + if (app_regs_n_elements[add-APP_REGS_ADD_MIN] != n_elements) + return false; + + /* Process data and return false if write is not allowed or contains errors */ + return (*app_func_wr_pointer[add-APP_REGS_ADD_MIN])(content); +} \ No newline at end of file diff --git a/DeviceStarterKit/StarterKit/app.h b/DeviceStarterKit/StarterKit/app.h new file mode 100644 index 0000000..f6dbf9a --- /dev/null +++ b/DeviceStarterKit/StarterKit/app.h @@ -0,0 +1,18 @@ +#ifndef _APP_H_ +#define _APP_H_ +#include + + +/************************************************************************/ +/* Enable the interrupts */ +/************************************************************************/ +#define hwbp_app_enable_interrupts PMIC_CTRL = PMIC_CTRL | PMIC_RREN_bm | PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm; __asm volatile("sei"); + + +/************************************************************************/ +/* Initialize the application */ +/************************************************************************/ +void hwbp_app_initialize(void); + + +#endif /* _APP_H_ */ \ No newline at end of file diff --git a/DeviceStarterKit/StarterKit/app_funcs.c b/DeviceStarterKit/StarterKit/app_funcs.c new file mode 100644 index 0000000..ce8e424 --- /dev/null +++ b/DeviceStarterKit/StarterKit/app_funcs.c @@ -0,0 +1,56 @@ +#include "app_funcs.h" +#include "app_ios_and_regs.h" +#include "hwbp_core.h" + + +/************************************************************************/ +/* Create pointers to functions */ +/************************************************************************/ +extern AppRegs app_regs; + +void (*app_func_rd_pointer[])(void) = { + &app_read_REG_DUMMY0, + &app_read_REG_DUMMY1 +}; + +bool (*app_func_wr_pointer[])(void*) = { + &app_write_REG_DUMMY0, + &app_write_REG_DUMMY1 +}; + + +/************************************************************************/ +/* REG_DUMMY0 */ +/************************************************************************/ +void app_read_REG_DUMMY0(void) +{ + //app_regs.REG_DUMMY0 = 0; + +} + +bool app_write_REG_DUMMY0(void *a) +{ + uint8_t reg = *((uint8_t*)a); + + app_regs.REG_DUMMY0 = reg; + return true; +} + + +/************************************************************************/ +/* REG_DUMMY1 */ +/************************************************************************/ +// This register is an array with 16 positions +void app_read_REG_DUMMY1(void) +{ + //app_regs.REG_DUMMY1[0] = 0; + +} + +bool app_write_REG_DUMMY1(void *a) +{ + int16_t *reg = ((int16_t*)a); + + app_regs.REG_DUMMY1[0] = reg[0]; + return true; +} \ No newline at end of file diff --git a/DeviceStarterKit/StarterKit/app_funcs.h b/DeviceStarterKit/StarterKit/app_funcs.h new file mode 100644 index 0000000..4fd0af7 --- /dev/null +++ b/DeviceStarterKit/StarterKit/app_funcs.h @@ -0,0 +1,30 @@ +#ifndef _APP_FUNCTIONS_H_ +#define _APP_FUNCTIONS_H_ +#include + + +/************************************************************************/ +/* Define if not defined */ +/************************************************************************/ +#ifndef bool + #define bool uint8_t +#endif +#ifndef true + #define true 1 +#endif +#ifndef false + #define false 0 +#endif + + +/************************************************************************/ +/* Prototypes */ +/************************************************************************/ +void app_read_REG_DUMMY0(void); +void app_read_REG_DUMMY1(void); + +bool app_write_REG_DUMMY0(void *a); +bool app_write_REG_DUMMY1(void *a); + + +#endif /* _APP_FUNCTIONS_H_ */ \ No newline at end of file diff --git a/DeviceStarterKit/StarterKit/app_ios_and_regs.c b/DeviceStarterKit/StarterKit/app_ios_and_regs.c new file mode 100644 index 0000000..c6b6521 --- /dev/null +++ b/DeviceStarterKit/StarterKit/app_ios_and_regs.c @@ -0,0 +1,40 @@ +#include +#include "hwbp_core_types.h" +#include "app_ios_and_regs.h" + +/************************************************************************/ +/* Configure and initialize IOs */ +/************************************************************************/ +void init_ios(void) +{ /* Configure input pins */ + io_pin2in(&PORTB, 1, PULL_IO_UP, SENSE_IO_EDGES_BOTH); // INPUT + + /* Configure input interrupts */ + io_set_int(&PORTB, INT_LEVEL_LOW, 0, (1<<1), false); // INPUT + + /* Configure output pins */ + io_pin2out(&PORTB, 0, OUT_IO_DIGITAL, IN_EN_IO_EN); // OUTPUT + + /* Initialize output pins */ + clr_OUTPUT; +} + +/************************************************************************/ +/* Registers' stuff */ +/************************************************************************/ +AppRegs app_regs; + +uint8_t app_regs_type[] = { + TYPE_U8, + TYPE_I16 +}; + +uint16_t app_regs_n_elements[] = { + 1, + 16 +}; + +uint8_t *app_regs_pointer[] = { + (uint8_t*)(&app_regs.REG_DUMMY0), + (uint8_t*)(app_regs.REG_DUMMY1) +}; \ No newline at end of file diff --git a/DeviceStarterKit/StarterKit/app_ios_and_regs.h b/DeviceStarterKit/StarterKit/app_ios_and_regs.h new file mode 100644 index 0000000..3b50217 --- /dev/null +++ b/DeviceStarterKit/StarterKit/app_ios_and_regs.h @@ -0,0 +1,63 @@ +#ifndef _APP_IOS_AND_REGS_H_ +#define _APP_IOS_AND_REGS_H_ +#include "cpu.h" + +void init_ios(void); +/************************************************************************/ +/* Definition of input pins */ +/************************************************************************/ +// INPUT Description: Digital input 0 + +#define read_INPUT read_io(PORTB, 1) // INPUT + +/************************************************************************/ +/* Definition of output pins */ +/************************************************************************/ +// OUTPUT Description: Digital output 0 + +/* OUTPUT */ +#define set_OUTPUT set_io(PORTB, 0) +#define clr_OUTPUT clear_io(PORTB, 0) +#define tgl_OUTPUT toggle_io(PORTB, 0) +#define read_OUTPUT read_io(PORTB, 0) + + +/************************************************************************/ +/* Registers' structure */ +/************************************************************************/ +typedef struct +{ + uint8_t REG_DUMMY0; + int16_t REG_DUMMY1[16]; +} AppRegs; + +/************************************************************************/ +/* Registers' address */ +/************************************************************************/ +/* Registers */ +#define ADD_REG_DUMMY0 32 // U8 A register without any usefull description +#define ADD_REG_DUMMY1 33 // I16 A register without any usefull description + +/************************************************************************/ +/* PWM Generator registers' memory limits */ +/* */ +/* DON'T change the APP_REGS_ADD_MIN value !!! */ +/* DON'T change these names !!! */ +/************************************************************************/ +/* Memory limits */ +#define APP_REGS_ADD_MIN 0x20 +#define APP_REGS_ADD_MAX 0x21 +#define APP_NBYTES_OF_REG_BANK 33 + +/************************************************************************/ +/* Registers' bits */ +/************************************************************************/ +#define B_DI0 (1<<0) // Digital input 0 +#define B_DI1 (1<<1) // Digital input 1 +#define B_DI2 (1<<2) // Digital input 2 +#define MSK_ADC_SAMPLE_RATE 0x03 // +#define GM_ADC_1KHz (0<<0) // ADC samples each 1 ms +#define GM_ADC_500Hz (1<<0) // ADC samples each 2 ms +#define GM_ADC_250Hz (2<<0) // ADC samples each 4 ms + +#endif /* _APP_REGS_H_ */ \ No newline at end of file diff --git a/DeviceStarterKit/StarterKit/cpu.h b/DeviceStarterKit/StarterKit/cpu.h new file mode 100644 index 0000000..430888b --- /dev/null +++ b/DeviceStarterKit/StarterKit/cpu.h @@ -0,0 +1,180 @@ +// Author: Filipe Carvalho +#ifndef _CPU_1V1_H_ +#define _CPU_1V1_H_ + +/************************************************************************/ +/* Include external libraries */ +/************************************************************************/ +#include +#include + +/************************************************************************/ +/* Define if not defined */ +/************************************************************************/ +#ifndef bool + #define bool uint8_t +#endif +#ifndef true + #define true 1 +#endif +#ifndef false + #define false 0 +#endif + +/************************************************************************/ +/* Common defines */ +/************************************************************************/ +#define INT_LEVEL_OFF 0 +#define INT_LEVEL_LOW 1 +#define INT_LEVEL_MED 2 +#define INT_LEVEL_HIGH 3 + +/************************************************************************/ +/* CPU */ +/************************************************************************/ +#define PRESCALER_CPU_1 CLK_PSADIV_1_gc +#define PRESCALER_CPU_2 CLK_PSADIV_2_gc +#define PRESCALER_CPU_4 CLK_PSADIV_4_gc +#define PRESCALER_CPU_8 CLK_PSADIV_8_gc +#define PRESCALER_CPU_16 CLK_PSADIV_16_gc +#define PRESCALER_CPU_32 CLK_PSADIV_32_gc +#define PRESCALER_CPU_64 CLK_PSADIV_64_gc +#define PRESCALER_CPU_128 CLK_PSADIV_128_gc +#define PRESCALER_CPU_256 CLK_PSADIV_256_gc +#define PRESCALER_CPU_512 CLK_PSADIV_512_gc + +#define OUT_PORT_CLK_PORTC 0 +#define OUT_PORT_CLK_PORTD 1 + +bool cpu_config_clock(uint32_t cpu_freq, bool lock_clock, bool external_clock); +void cpu_config_clock_32Khz(uint8_t prescaler, bool lock_clock); +bool cpu_change_clock(uint32_t cpu_freq, bool lock_clock); + +void cpu_clk_output(bool stay_on_loop, bool pin4_instead_of_7, uint8_t out_port); + +void cpu_enable_int_level(uint8_t int_level); +void cpu_disable_int_level(uint8_t int_level); + +/************************************************************************/ +/* Watchdog */ +/************************************************************************/ +#define PER_WDT_8ms WDT_PER_8CLK_gc +#define PER_WDT_16ms WDT_PER_16CLK_gc +#define PER_WDT_32ms WDT_PER_32CLK_gc +#define PER_WDT_64ms WDT_PER_64CLK_gc +#define PER_WDT_125ms WDT_PER_125CLK_gc +#define PER_WDT_250ms WDT_PER_250CLK_gc +#define PER_WDT_500ms WDT_PER_500CLK_gc +#define PER_WDT_1s WDT_PER_1KCLK_gc +#define PER_WDT_2s WDT_PER_2KCLK_gc +#define PER_WDT_4s WDT_PER_4KCLK_gc +#define PER_WDT_8s WDT_PER_8KCLK_gc + +void wdt_enable(uint8_t per); +void wdt_disable(void); +void wdt_reset_device(void); + +/************************************************************************/ +/* IO */ +/************************************************************************/ +#define PULL_IO_TRISTATE (0x0 << 3) +#define PULL_IO_BUSHOLDER (0x1 << 3) +#define PULL_IO_DOWN (0x2 << 3) +#define PULL_IO_UP (0x3 << 3) + +#define SENSE_IO_EDGES_BOTH 0 +#define SENSE_IO_EDGE_RISING 1 +#define SENSE_IO_EDGE_FALLING 2 +#define SENSE_IO_LOW_LEVEL 3 +#define SENSE_IO_NO_INT_USED 0 + +#define OUT_IO_DIGITAL (0x0 << 3) +#define OUT_IO_WIREDOR (0x4 << 3) +#define OUT_IO_WIREDAND (0x5 << 3) +#define OUT_IO_WIREDORPULL (0x6 << 3) +#define OUT_IO_WIREDANDPULL (0x7 << 3) + +#define IN_EN_IO_EN 1 +#define IN_EN_IO_DIS 0 + +#define set_io(port, pin) port.OUTSET = 1 << pin +#define clear_io(port, pin) port.OUTCLR = 1 << pin +#define toggle_io(port, pin) port.OUTTGL = 1 << pin +#define read_io(port, pin) (*(&port.IN) & (1 << pin)) +#define set_io_mask(port, mask) port.OUTSET = mask +#define clear_io_mask(port, mask) port.OUTCLR = mask +#define toggle_io_mask(port, mask) port.OUTTGL = mask + +void io_pin2in(PORT_t* port, uint8_t pin, uint8_t pull, uint8_t sense); +void io_pin2out(PORT_t* port, uint8_t pin, uint8_t out, bool input_en); +void io_pin2out_with_interrupt(PORT_t* port, uint8_t pin, uint8_t out, uint8_t sense); +void io_set_int(PORT_t* port, uint8_t int_level, uint8_t int_n, uint8_t mask, bool reset_mask); + +/************************************************************************/ +/* Timer */ +/************************************************************************/ +#define TIMER_PRESCALER_DIV1 1 +#define TIMER_PRESCALER_DIV2 2 +#define TIMER_PRESCALER_DIV4 3 +#define TIMER_PRESCALER_DIV8 4 +#define TIMER_PRESCALER_DIV64 5 +#define TIMER_PRESCALER_DIV256 6 +#define TIMER_PRESCALER_DIV1024 7 + +void timer_type0_enable(TC0_t* timer, uint8_t prescaler, uint16_t target_count, uint8_t int_level); +void timer_type0_pwm(TC0_t* timer, uint8_t prescaler, uint16_t target_count, uint16_t duty_cycle_count, uint8_t int_level_ovf, uint8_t int_level_cca); +void timer_type0_set_target(TC0_t* timer, uint16_t target_count); +bool timer_type0_get_flag(TC0_t* timer); +void timer_type0_reset_flag(TC0_t* timer); +void timer_type0_stop(TC0_t* timer); +void timer_type0_set_counter(TC0_t* timer, uint16_t counter); +void timer_type0_wait(TC0_t* timer, uint8_t prescaler, uint16_t target_count); +bool calculate_timer_16bits(uint32_t f_cpu, float freq, uint8_t * timer_prescaler, uint16_t * timer_target_count); + +void timer_type1_enable(TC1_t* timer, uint8_t prescaler, uint16_t target_count, uint8_t int_level); +void timer_type1_set_target(TC1_t* timer, uint16_t target_count); +bool timer_type1_get_flag(TC1_t* timer); +void timer_type1_reset_flag(TC1_t* timer); +void timer_type1_stop(TC1_t* timer); +void timer_type1_set_counter(TC1_t* timer, uint16_t counter); +void timer_type1_wait(TC1_t* timer, uint8_t prescaler, uint16_t target_count); + +/************************************************************************/ +/* EEPROM */ +/************************************************************************/ +uint8_t eeprom_rd_byte(uint16_t addr); +void eeprom_wr_byte(uint16_t addr, uint8_t byte); + +void eeprom_wr_i16(uint16_t addr, int16_t _16b); +void eeprom_wr_i32(uint16_t addr, int32_t _32b); +int16_t eeprom_rd_i16(uint16_t addr); +int32_t eeprom_rd_i32(uint16_t addr); + +/************************************************************************/ +/* ADC */ +/************************************************************************/ +#define RES_ADC_8BITS ADC_RESOLUTION_8BIT_gc +#define RES_ADC_12BITS ADC_RESOLUTION_12BIT_gc + +#define REF_ADC_1V ADC_REFSEL_INT1V_gc | ADC_BANDGAP_bm // 10/11 +#define REF_ADC_VCC ADC_REFSEL_INTVCC_gc // VCC/1.6 +#define REF_ADC_PORTA ADC_REFSEL_AREFA_gc // +#define REF_ADC_PORTB ADC_REFSEL_AREFB_gc // +#define REF_ADC_VCCDIV2 ADC_REFSEL_INTVCC2_gc // VCC/2 + +#define PRESCALER_ADC_DIV4 ADC_PRESCALER_DIV4_gc +#define PRESCALER_ADC_DIV8 ADC_PRESCALER_DIV8_gc +#define PRESCALER_ADC_DIV16 ADC_PRESCALER_DIV16_gc +#define PRESCALER_ADC_DIV32 ADC_PRESCALER_DIV32_gc +#define PRESCALER_ADC_DIV64 ADC_PRESCALER_DIV64_gc +#define PRESCALER_ADC_DIV128 ADC_PRESCALER_DIV128_gc +#define PRESCALER_ADC_DIV256 ADC_PRESCALER_DIV256_gc +#define PRESCALER_ADC_DIV512 ADC_PRESCALER_DIV512_gc + +void adc_A_initialize_single_ended(uint8_t analog_reference); +int16_t adc_A_read_channel(uint8_t index); +void adc_A_calibrate_offset(uint8_t index); + +uint16_t adcA_unsigned_single_ended(ADC_t* adc, uint8_t res, uint8_t ref , uint8_t prescaler, uint8_t adc_pin, TC0_t* timer); + +#endif /* _CPU_1V1_H_ */ \ No newline at end of file diff --git a/DeviceStarterKit/StarterKit/hwbp_core.h b/DeviceStarterKit/StarterKit/hwbp_core.h new file mode 100644 index 0000000..2c16d3d --- /dev/null +++ b/DeviceStarterKit/StarterKit/hwbp_core.h @@ -0,0 +1,123 @@ +#ifndef _HWBP_CORE_H_ +#define _HWBP_CORE_H_ +#include + + + +// Define if not defined +#ifndef bool + #define bool uint8_t +#endif +#ifndef true + #define true 1 + #define false 0 +#endif + +typedef struct { + uint32_t second; + uint16_t usecond; +} timestamp_t; + +// It's the first callback used, right after booting the core. +// The pins, ports and external hardware should be initialized. +void core_callback_1st_config_hw_after_boot(void); + +// Used to initialize the registers. +// All registers should be written to their default state. +void core_callback_reset_registers(void); + +// Call right after load the register with default or EEPROM values. +// The state registers and external hardware should be configured according the value of the registers. +void core_callback_registers_were_reinitialized(void); + +// Called when the application must turn off all the visual indicators. +void core_callback_visualen_to_on(void); +// Called when the application can turn on the visual indicators. +void core_callback_visualen_to_off(void); + +// When the device goes to Standby Mode. +void core_callback_device_to_standby(void); +// When the device goes to Active Mode. +void core_callback_device_to_active(void); +// When the device goes to Speed Mode. +void core_callback_device_to_speed(void); + + + +// Called before execute the timer interrupts +void core_callback_t_before_exec(void); +// Called after execute the timer interrupts +void core_callback_t_after_exec(void); + +// Called every millisecond. +void core_callback_t_1ms(void); +// Called 500 microseconds after the "void core_callback_t_1ms(void)". +void core_callback_t_500us(void); +// Called every time a new second starts. +void core_callback_t_new_second(void); + + + +// Read from an application register. +bool core_read_app_register(uint8_t add, uint8_t type); +// Write to an application register. +bool core_write_app_register(uint8_t add, uint8_t type, uint8_t * content, uint16_t n_elements); +// Read from a common register. +bool hwbp_read_common_reg(uint8_t add, uint8_t type); +// Write to an common register. +bool hwbp_write_common_reg(uint8_t add, uint8_t type, uint8_t * content, uint16_t n_elements); + + + + +// It is mandatory that this function is the first of the application code. +void core_func_start_core ( + const uint16_t who_am_i, + const uint8_t hwH, + const uint8_t hwL, + const uint8_t fwH, + const uint8_t fwL, + const uint8_t assembly, + uint8_t *pointer_to_app_regs, + const uint16_t app_mem_size_to_save, + const uint8_t num_of_app_registers, + const uint8_t *device_name); + +// Call this function in case of error +// A power up or reset must be performed to remove the device from this state +void core_func_catastrophic_error_detected(void); +// When a catastrophic error is detected (last callback before go into error state) +// User should shutdown all the peripherals +void core_callback_catastrophic_error_detected(void); + +// Used to leave the speed mode. +void core_func_leave_speed_mode_and_go_to_standby_mode(void); + + +// Used to create a specific timestamp that can be used when sending Events +void core_func_update_user_timestamp(uint32_t seconds, uint16_t useconds); + +// Used to read the current user timestamps +void core_func_read_user_timestamp(uint32_t *seconds, uint16_t *useconds); + +// Used to save the current timestamp +void core_func_mark_user_timestamp(void); + +// Used to send an Event +void core_func_send_event(uint8_t add, bool use_core_timestamp); + +// Used to get the content of register R_TIMESTAMP_SECOND. +uint32_t core_func_read_R_TIMESTAMP_SECOND(void); +// Used to get the content of register R_TIMESTAMP_MICRO. +uint16_t core_func_read_R_TIMESTAMP_MICRO(void); + + + +// Return "true" if the LEDs can be ON. +bool core_bool_is_visual_enabled(void); +// Return "true" if the device is in Speed Mode. +bool core_bool_speed_mode_is_in_use(void); + + + +#endif /* _HWBP_CORE_H_ */ \ No newline at end of file diff --git a/DeviceStarterKit/StarterKit/hwbp_core_com.h b/DeviceStarterKit/StarterKit/hwbp_core_com.h new file mode 100644 index 0000000..851fcda --- /dev/null +++ b/DeviceStarterKit/StarterKit/hwbp_core_com.h @@ -0,0 +1,182 @@ +#ifndef _HWBP_CORE_COM_H_ +#define _HWBP_CORE_COM_H_ + +#include +#include "cpu.h" +#include "hwbp_core_types.h" + +// com_mode +#define COM_MODE_USB 0 +#define COM_MODE_UART 1 + +// rx_timeout +#define RX_TIMEOUT_MS 50 + + +/************************************************************************/ +/* UART definitions */ +/************************************************************************/ +#define HWBP_UART_RX_INT_LEVEL INT_LEVEL_HIGH +#define HWBP_UART_TX_INT_LEVEL INT_LEVEL_HIGH +#define HWBP_UART_CTS_INT_LEVEL INT_LEVEL_HIGH + +#define HWBP_UART_RXBUFSIZ MAX_PACKET_SIZE + +#if defined(__AVR_ATxmega16A4U__) + #define HWBP_UART_UART USARTE0 + #define HWBP_UART_PORT PORTE + #define HWBP_UART_RX_pin 2 + #define HWBP_UART_TX_pin 3 + + #define HWBP_UART_RX_ROUTINE_ ISR(USARTE0_RXC_vect/*, ISR_NAKED*/) + #define HWBP_UART_TX_ROUTINE_ ISR(USARTE0_DRE_vect/*, ISR_NAKED*/) + + + #define HWBP_UART_USE_FLOW_CONTROL // comment this line if don't use + #define HWBP_UART_RTS_PORT PORTE + #define HWBP_UART_RTS_pin 1 + #define HWBP_UART_CTS_PORT PORTE + #define HWBP_UART_CTS_pin 0 + + #define HWBP_UART_CTS_ROUTINE_ ISR(PORTE_INT0_vect/*, ISR_NAKED*/) + #define HWBP_UART_CTS_INT_N 0 + + #define hwbp_uart_leave_interrupt return/*reti();*/ + + /* Use as much as possible */ + #define HWBP_UART_TXBUFSIZ 512 +#endif + +#if defined(__AVR_ATxmega32A4U__) + #define HWBP_UART_UART USARTE0 + #define HWBP_UART_PORT PORTE + #define HWBP_UART_RX_pin 2 + #define HWBP_UART_TX_pin 3 + + #define HWBP_UART_RX_ROUTINE_ ISR(USARTE0_RXC_vect/*, ISR_NAKED*/) + #define HWBP_UART_TX_ROUTINE_ ISR(USARTE0_DRE_vect/*, ISR_NAKED*/) + + + #define HWBP_UART_USE_FLOW_CONTROL // comment this line if don't use + #define HWBP_UART_RTS_PORT PORTE + #define HWBP_UART_RTS_pin 1 + #define HWBP_UART_CTS_PORT PORTE + #define HWBP_UART_CTS_pin 0 + + #define HWBP_UART_CTS_ROUTINE_ ISR(PORTE_INT0_vect/*, ISR_NAKED*/) + #define HWBP_UART_CTS_INT_N 0 + + #define hwbp_uart_leave_interrupt return/*reti();*/ + + /* Use as much as possible */ + #define HWBP_UART_TXBUFSIZ 2048 +#endif + +#if defined(__AVR_ATxmega64A4U__) + #define HWBP_UART_UART USARTE0 + #define HWBP_UART_PORT PORTE + #define HWBP_UART_RX_pin 2 + #define HWBP_UART_TX_pin 3 + + #define HWBP_UART_RX_ROUTINE_ ISR(USARTE0_RXC_vect/*, ISR_NAKED*/) + #define HWBP_UART_TX_ROUTINE_ ISR(USARTE0_DRE_vect/*, ISR_NAKED*/) + + + #define HWBP_UART_USE_FLOW_CONTROL // comment this line if don't use + #define HWBP_UART_RTS_PORT PORTE + #define HWBP_UART_RTS_pin 1 + #define HWBP_UART_CTS_PORT PORTE + #define HWBP_UART_CTS_pin 0 + + #define HWBP_UART_CTS_ROUTINE_ ISR(PORTE_INT0_vect/*, ISR_NAKED*/) + #define HWBP_UART_CTS_INT_N 0 + + #define hwbp_uart_leave_interrupt return/*reti();*/ + + /* Use as much as possible */ + #define HWBP_UART_TXBUFSIZ 2048 +#endif + +#if defined(__AVR_ATxmega128A4U__) + #define HWBP_UART_UART USARTE0 + #define HWBP_UART_PORT PORTE + #define HWBP_UART_RX_pin 2 + #define HWBP_UART_TX_pin 3 + + #define HWBP_UART_RX_ROUTINE_ ISR(USARTE0_RXC_vect/*, ISR_NAKED*/) + #define HWBP_UART_TX_ROUTINE_ ISR(USARTE0_DRE_vect/*, ISR_NAKED*/) + + + #define HWBP_UART_USE_FLOW_CONTROL // comment this line if don't use + #define HWBP_UART_RTS_PORT PORTE + #define HWBP_UART_RTS_pin 1 + #define HWBP_UART_CTS_PORT PORTE + #define HWBP_UART_CTS_pin 0 + + #define HWBP_UART_CTS_ROUTINE_ ISR(PORTE_INT0_vect/*, ISR_NAKED*/) + #define HWBP_UART_CTS_INT_N 0 + + #define hwbp_uart_leave_interrupt return/*reti();*/ + + /* Use as much as possible */ + #define HWBP_UART_TXBUFSIZ 6144 +#endif + +#if defined(__AVR_ATxmega128A1U__) + #define HWBP_UART_UART USARTF0 + #define HWBP_UART_PORT PORTF + #define HWBP_UART_RX_pin 2 + #define HWBP_UART_TX_pin 3 + + #define HWBP_UART_RX_ROUTINE_ ISR(USARTF0_RXC_vect/*, ISR_NAKED*/) + #define HWBP_UART_TX_ROUTINE_ ISR(USARTF0_DRE_vect/*, ISR_NAKED*/) + + + #define HWBP_UART_USE_FLOW_CONTROL // comment this line if don't use + #define HWBP_UART_RTS_PORT PORTK + #define HWBP_UART_RTS_pin 0 + #define HWBP_UART_CTS_PORT PORTJ + #define HWBP_UART_CTS_pin 6 + + #define HWBP_UART_CTS_ROUTINE_ ISR(PORTJ_INT0_vect/*, ISR_NAKED*/) + #define HWBP_UART_CTS_INT_N 0 + + #define hwbp_uart_leave_interrupt return/*reti();*/ + + /* Use as much as possible */ + #define HWBP_UART_TXBUFSIZ 6144 +#endif + + +/************************************************************************/ +/* Prototypes */ +/************************************************************************/ +#define disable_hwbp_uart_rx set_io(HWBP_UART_RTS_PORT, HWBP_UART_RTS_pin); +#define enable_hwbp_uart_rx clear_io(HWBP_UART_RTS_PORT, HWBP_UART_RTS_pin); + +void hwbp_com_uart_init(uint16_t BSEL, int8_t BSCALE, bool use_clk2x); +void hwbp_com_uart_enable(void); +void hwbp_com_uart_disable(); // Not used + +void hwbp_uart_xmit_now(const uint8_t *dataIn0, uint8_t siz); // Not used +void hwbp_uart_xmit_now_byte(const uint8_t byte); // Not used +void hwbp_uart_xmit(const uint8_t *dataIn0, uint8_t siz); + +bool hwbp_uart_rcv_now(uint8_t * byte); // Not used + + +// Called before execute the uart rRX interrupt +void core_callback_uart_rx_before_exec(void); +// Called after execute the uart RX interrupt +void core_callback_uart_rx_after_exec(void); +// Called before execute the uart Tx interrupt +void core_callback_uart_tx_before_exec(void); +// Called after execute the uart TX interrupt +void core_callback_uart_tx_after_exec(void); +// Called before execute the uart CTS interrupt +void core_callback_uart_cts_before_exec(void); +// Called after execute the uart CTS interrupt +void core_callback_uart_cts_after_exec(void); + + +#endif /* _HWBP_CORE_COM_H_ */ diff --git a/DeviceStarterKit/StarterKit/hwbp_core_regs.h b/DeviceStarterKit/StarterKit/hwbp_core_regs.h new file mode 100644 index 0000000..c20e892 --- /dev/null +++ b/DeviceStarterKit/StarterKit/hwbp_core_regs.h @@ -0,0 +1,50 @@ +#ifndef _HWBP_CORE_REGS_H_ +#define _HWBP_CORE_REGS_H_ + + +/************************************************************************/ +/* Common Bank Registers */ +/************************************************************************/ +/* Registers */ +#define ADD_R_WHO_AM_I 0x00 // U16 +#define ADD_R_HW_VERSION_H 0x01 // U8 +#define ADD_R_HW_VERSION_L 0x02 // U8 +#define ADD_R_ASSEMBLY_VERSION 0x03 // U8 +#define ADD_R_HARP_VERSION_H 0x04 // U8 +#define ADD_R_HARP_VERSION_L 0x05 // U8 +#define ADD_R_FW_VERSION_H 0x06 // U8 +#define ADD_R_FW_VERSION_L 0x07 // U8 +#define ADD_R_TIMESTAMP_SECOND 0x08 // U32 +#define ADD_R_TIMESTAMP_MICRO 0x09 // U16 +#define ADD_R_OPERATION_CTRL 0x0A // U8 +#define ADD_R_RESET_DEV 0x0B // U8 +#define ADD_R_DEVICE_NAME 0x0C // U8 + +/* Memory limits */ +#define COMMON_BANK_ADD_MAX 0x0C +#define COMMON_BANK_ABSOLUTE_ADD_MAX 0x1C + +/* R_OPERATION_CTRL */ +#define MSK_OP_MODE (3<<0) + +#define GM_OP_MODE_STANDBY (0<<0) +#define GM_OP_MODE_ACTIVE (1<<0) +#define GM_OP_MODE_SPEED (3<<0) + +#define B_DUMP (1<<3) +#define B_MUTE_RPL (1<<4) +#define B_VISUALEN (1<<5) +#define B_OPLEDEN (1<<6) +#define B_ALIVE_EN (1<<7) + +/* ADD_R_MEMORY */ +#define B_RST_DEF (1<<0) +#define B_RST_EE (1<<1) + +#define B_SAVE (1<<2) + +#define B_BOOT_DEF (1<<6) +#define B_BOOT_EE (1<<7) + + +#endif /* _HWBP_CORE_REGS_H_ */ \ No newline at end of file diff --git a/DeviceStarterKit/StarterKit/hwbp_core_types.h b/DeviceStarterKit/StarterKit/hwbp_core_types.h new file mode 100644 index 0000000..fc29bac --- /dev/null +++ b/DeviceStarterKit/StarterKit/hwbp_core_types.h @@ -0,0 +1,34 @@ +#ifndef _HWBP_CORE_TYPES_H_ +#define _HWBP_CORE_TYPES_H_ + +/************************************************************************/ +/* Definition of available types */ +/************************************************************************/ +/* Int |float | nbytes */ +/* | | */ +#define TYPE_U8 (0x00 | 0x00 | 1) +#define TYPE_I8 (0x80 | 0x00 | 1) +#define TYPE_U16 (0x00 | 0x00 | 2) +#define TYPE_I16 (0x80 | 0x00 | 2) +#define TYPE_U32 (0x00 | 0x00 | 4) +#define TYPE_I32 (0x80 | 0x00 | 4) +#define TYPE_U64 (0x00 | 0x00 | 8) +#define TYPE_I64 (0x80 | 0x00 | 8) +#define TYPE_FLOAT (0x00 | 0x40 | 4) + +/************************************************************************/ +/* Definition of masks for available types */ +/************************************************************************/ +#define MSK_TYPE_INTEGER 0x80 +#define MSK_TYPE_FLOAT 0x40 +#define MSK_TYPE_LEN 0x0F + +#define MSK_TIMESTAMP_AT_PAYLOAD 0x10 + +/************************************************************************/ +/* Maximum size of an entire packet (header to chksum) */ +/************************************************************************/ +#define MAX_PACKET_SIZE 256 + + +#endif /* _HWBP_CORE_TYPES_H_ */ \ No newline at end of file diff --git a/DeviceStarterKit/StarterKit/hwbp_sync.h b/DeviceStarterKit/StarterKit/hwbp_sync.h new file mode 100644 index 0000000..403bc62 --- /dev/null +++ b/DeviceStarterKit/StarterKit/hwbp_sync.h @@ -0,0 +1,44 @@ +#ifndef _HWBP_SYNC_H_ +#define _HWBP_SYNC_H_ +#include + + +/************************************************************************/ +/* Prototypes */ +/************************************************************************/ +void initialize_timestamp_uart (uint32_t * timestamp_pointer); +void reset_sync_counter (void); +void trigger_sync_timer (void); + + +/************************************************************************/ +/* Reset sync counter */ +/************************************************************************/ +#if defined(__AVR_ATxmega16A4U__) + #define RESET_TIMESTAMP_COUNTER reset_sync_counter() +#else + #define RESET_TIMESTAMP_COUNTER +#endif + + +/************************************************************************/ +/* Trigger timer */ +/************************************************************************/ +#if defined(__AVR_ATxmega16A4U__) + #define SYNC_TRIGGER_TIMER trigger_sync_timer() +#else + #define SYNC_TRIGGER_TIMER +#endif + + +/************************************************************************/ +/* Control when the device lost sync */ +/************************************************************************/ +#if defined(__AVR_ATxmega16A4U__) + #define INCREASE_LOST_SYNC_COUNTER +#else + #define INCREASE_LOST_SYNC_COUNTER device_lost_sync_counter++ +#endif + + +#endif /* _HWBP_SYNC_H_ */ \ No newline at end of file diff --git a/DeviceStarterKit/StarterKit/interrupts.c b/DeviceStarterKit/StarterKit/interrupts.c new file mode 100644 index 0000000..007768b --- /dev/null +++ b/DeviceStarterKit/StarterKit/interrupts.c @@ -0,0 +1,36 @@ +#include "cpu.h" +#include "hwbp_core_types.h" +#include "app_ios_and_regs.h" +#include "app_funcs.h" +#include "hwbp_core.h" + +/************************************************************************/ +/* Declare application registers */ +/************************************************************************/ +extern AppRegs app_regs; + +/************************************************************************/ +/* Interrupts from Timers */ +/************************************************************************/ +// ISR(TCC0_OVF_vect, ISR_NAKED) +// ISR(TCD0_OVF_vect, ISR_NAKED) +// ISR(TCE0_OVF_vect, ISR_NAKED) +// ISR(TCF0_OVF_vect, ISR_NAKED) +// +// ISR(TCC0_CCA_vect, ISR_NAKED) +// ISR(TCD0_CCA_vect, ISR_NAKED) +// ISR(TCE0_CCA_vect, ISR_NAKED) +// ISR(TCF0_CCA_vect, ISR_NAKED) +// +// ISR(TCD1_OVF_vect, ISR_NAKED) +// +// ISR(TCD1_CCA_vect, ISR_NAKED) + +/************************************************************************/ +/* INPUT */ +/************************************************************************/ +ISR(PORTB_INT0_vect, ISR_NAKED) +{ + reti(); +} + diff --git a/DeviceStarterKit/StarterKit/main.c b/DeviceStarterKit/StarterKit/main.c new file mode 100644 index 0000000..8e9f81f --- /dev/null +++ b/DeviceStarterKit/StarterKit/main.c @@ -0,0 +1,17 @@ +#include + +#include "app.h" +#include "app_ios_and_regs.h" + +int main(void) +{ + /* Initialize device */ + hwbp_app_initialize(); + + /* Enable interrupts */ + hwbp_app_enable_interrupts; + + /* Infinite loop */ + while(1); + //__asm volatile("sleep"); +} \ No newline at end of file diff --git a/DeviceStarterKit/StarterKit/registers.xls b/DeviceStarterKit/StarterKit/registers.xls new file mode 100644 index 0000000000000000000000000000000000000000..41d98da0412658e49f9f95d808fac8e00acb884a GIT binary patch literal 80896 zcmeHw2UrwI*KW;_hA4`n7;r>TR7A3caaDkw%I3<3g!1TmqgxF*(|#jLAq&bsCt zR?Io)oORVTa?j~zhUuDumH+PdJm0|NY#qIsdeOqzgCh#pH+qgW} zIK+`yk{ggyLMB1E0O{(9d`S#RAxR{bWWe`-8$TI^9w`2pZC= zd=X{UL|s@v(ip5r6b(n*7&O2-YE0vGQa(c=!wUFTD*EK}Bz$L(gKBPisFVtQ?_9hN2{Z(V%a=l@t)9KOKpgkgx`uv3?@xLiws4V z3NNj_`jN9(>pR+%NyNPl~vX2LD&}fVveyFH&w|O3#~1Qncp^%T?m*%D~5#fzK%eUr+|V zvJ8B68F*RsnNbFRRT+3$@_9a9*>Lu$)C12~$NBoG<9vP8@v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