├── Src ├── Appl │ └── main.c ├── Config │ ├── IntCtrl_Lcfg.c │ └── IntCtrl_Cfg.h ├── Mcal │ ├── Inc │ │ ├── IntCtrl_Types.h │ │ └── IntCtrl.h │ └── IntCtrl.c └── Common │ ├── Std_Types.h │ ├── Mcu_Hw.h │ ├── Compiler.h │ └── Platform_Types.h └── Doc ├── Naming_Conventions.doc ├── HeaderFileTemplate.h └── SourceFileTemplate.c /Src/Appl/main.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Doc/Naming_Conventions.doc: -------------------------------------------------------------------------------- 1 | ProjectName : Sprints_ARM_MC01 2 | 3 | FolderName 4 | ModuleName_FileName 5 | 6 | ModuleName_FunctionName(parameterName) 7 | localVariable (init with lower case) 8 | 9 | MODULENAME_MACRO_OBJECT 10 | ModuleName_MacroFunctionName(Parameter) 11 | 12 | 13 | typedef ModuleName_TypeNameType; (postfix with "Type") 14 | 15 | 16 | struct 17 | { 18 | firstMember; 19 | secondMember; 20 | thirdMember; 21 | fourthMember; 22 | } 23 | 24 | enum 25 | { 26 | MODULENAME_FIRST_MEMBER = 0, 27 | MODULENAME_SECOND_MEMBER, 28 | MODULENAME_THIRD_MEMBER 29 | } 30 | 31 | 32 | -------------------------------------------------------------------------------- /Src/Config/IntCtrl_Lcfg.c: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************** 2 | * FILE DESCRIPTION 3 | * -----------------------------------------------------------------------------------------------------------------*/ 4 | /** \file IntCtrl_Lcfg.c 5 | * \brief 6 | * 7 | * \details 8 | * 9 | * 10 | *********************************************************************************************************************/ 11 | 12 | /********************************************************************************************************************** 13 | * INCLUDES 14 | *********************************************************************************************************************/ 15 | #include "Std_Types.h" 16 | 17 | /********************************************************************************************************************** 18 | * LOCAL MACROS CONSTANT\FUNCTION 19 | *********************************************************************************************************************/ 20 | 21 | /********************************************************************************************************************** 22 | * LOCAL DATA 23 | *********************************************************************************************************************/ 24 | 25 | /********************************************************************************************************************** 26 | * GLOBAL DATA 27 | *********************************************************************************************************************/ 28 | 29 | 30 | 31 | /********************************************************************************************************************** 32 | * END OF FILE: IntCtrl_Lcfg.c 33 | *********************************************************************************************************************/ 34 | -------------------------------------------------------------------------------- /Src/Config/IntCtrl_Cfg.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************** 2 | 3 | * FILE DESCRIPTION 4 | * ------------------------------------------------------------------------------------------------------------------- 5 | * File: IntCtrl_Cfg.h 6 | * Module: - 7 | * 8 | * Description: 9 | * 10 | *********************************************************************************************************************/ 11 | #ifndef INTCTRL_CFG_H 12 | #define INTCTRL_CFG_H 13 | 14 | /********************************************************************************************************************** 15 | * INCLUDES 16 | *********************************************************************************************************************/ 17 | 18 | 19 | /********************************************************************************************************************** 20 | * GLOBAL CONSTANT MACROS 21 | *********************************************************************************************************************/ 22 | 23 | 24 | /********************************************************************************************************************** 25 | * GLOBAL FUNCTION MACROS 26 | *********************************************************************************************************************/ 27 | 28 | 29 | /********************************************************************************************************************** 30 | * GLOBAL DATA TYPES AND STRUCTURES 31 | *********************************************************************************************************************/ 32 | 33 | 34 | 35 | #endif /* INTCTRL_CFG_H */ 36 | 37 | /********************************************************************************************************************** 38 | * END OF FILE: IntCtrl_Cfg.h 39 | *********************************************************************************************************************/ 40 | -------------------------------------------------------------------------------- /Src/Mcal/Inc/IntCtrl_Types.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************** 2 | 3 | * FILE DESCRIPTION 4 | * ------------------------------------------------------------------------------------------------------------------- 5 | * File: IntCtrl_Types.h 6 | * Module: - 7 | * 8 | * Description: 9 | * 10 | *********************************************************************************************************************/ 11 | #ifndef INTCTRL_TYPES_H 12 | #define INTCTRL_TYPES_H 13 | 14 | /********************************************************************************************************************** 15 | * INCLUDES 16 | *********************************************************************************************************************/ 17 | #include "Std_Types.h" 18 | 19 | /********************************************************************************************************************** 20 | * GLOBAL CONSTANT MACROS 21 | *********************************************************************************************************************/ 22 | 23 | 24 | /********************************************************************************************************************** 25 | * GLOBAL FUNCTION MACROS 26 | *********************************************************************************************************************/ 27 | 28 | 29 | /********************************************************************************************************************** 30 | * GLOBAL DATA TYPES AND STRUCTURES 31 | *********************************************************************************************************************/ 32 | typedef enum 33 | { 34 | 35 | 36 | 37 | }IntCtrl_InterruptType; 38 | 39 | 40 | #endif /* INTCTRL_TYPES_H */ 41 | 42 | /********************************************************************************************************************** 43 | * END OF FILE: IntCtrl_Types.h 44 | *********************************************************************************************************************/ 45 | -------------------------------------------------------------------------------- /Doc/HeaderFileTemplate.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************** 2 | 3 | * FILE DESCRIPTION 4 | * ------------------------------------------------------------------------------------------------------------------- 5 | * File: 6 | * Module: - 7 | * 8 | * Description: 9 | * 10 | *********************************************************************************************************************/ 11 | #ifndef 12 | #define 13 | 14 | /********************************************************************************************************************** 15 | * INCLUDES 16 | *********************************************************************************************************************/ 17 | 18 | 19 | /********************************************************************************************************************** 20 | * GLOBAL CONSTANT MACROS 21 | *********************************************************************************************************************/ 22 | 23 | 24 | /********************************************************************************************************************** 25 | * GLOBAL FUNCTION MACROS 26 | *********************************************************************************************************************/ 27 | 28 | 29 | /********************************************************************************************************************** 30 | * GLOBAL DATA TYPES AND STRUCTURES 31 | *********************************************************************************************************************/ 32 | 33 | 34 | /********************************************************************************************************************** 35 | * GLOBAL DATA PROTOTYPES 36 | *********************************************************************************************************************/ 37 | 38 | 39 | /********************************************************************************************************************** 40 | * GLOBAL FUNCTION PROTOTYPES 41 | *********************************************************************************************************************/ 42 | 43 | 44 | #endif /* FILE_NAME_H */ 45 | 46 | /********************************************************************************************************************** 47 | * END OF FILE: Std_Types.h 48 | *********************************************************************************************************************/ 49 | -------------------------------------------------------------------------------- /Src/Common/Std_Types.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************** 2 | * FILE DESCRIPTION 3 | * ------------------------------------------------------------------------------------------------------------------- 4 | * File: Std_Types.h 5 | * Component: - 6 | * Module: - 7 | * 8 | * Description: Provision of Standard Types 9 | * 10 | *********************************************************************************************************************/ 11 | 12 | 13 | 14 | #ifndef STD_TYPES_H 15 | #define STD_TYPES_H 16 | 17 | /********************************************************************************************************************** 18 | * INCLUDES 19 | *********************************************************************************************************************/ 20 | 21 | # include "Platform_Types.h" 22 | # include "Compiler.h" 23 | 24 | /********************************************************************************************************************** 25 | * GLOBAL CONSTANT MACROS 26 | *********************************************************************************************************************/ 27 | 28 | # define STD_HIGH 1u /* Physical state 5V or 3.3V */ 29 | # define STD_LOW 0u /* Physical state 0V */ 30 | 31 | # define STD_ACTIVE 1u /* Logical state active */ 32 | # define STD_IDLE 0u /* Logical state idle */ 33 | 34 | # define STD_ON 1u 35 | # define STD_OFF 0u 36 | 37 | /********************************************************************************************************************** 38 | * GLOBAL DATA TYPES AND STRUCTURES 39 | *********************************************************************************************************************/ 40 | 41 | typedef uint8 Std_ReturnType; 42 | #define E_OK 0u 43 | #define E_NOT_OK 1u 44 | 45 | /********************************************************************************************************************** 46 | * GLOBAL DATA PROTOTYPES 47 | *********************************************************************************************************************/ 48 | 49 | 50 | /********************************************************************************************************************** 51 | * GLOBAL FUNCTION PROTOTYPES 52 | *********************************************************************************************************************/ 53 | 54 | 55 | #endif /* STD_TYPES_H */ 56 | /********************************************************************************************************************** 57 | * END OF FILE: Std_Types.h 58 | *********************************************************************************************************************/ 59 | -------------------------------------------------------------------------------- /Src/Common/Mcu_Hw.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************** 2 | 3 | * FILE DESCRIPTION 4 | * ------------------------------------------------------------------------------------------------------------------- 5 | * File: Mcu_Hw.h 6 | * Module: Mcu_Hw 7 | * 8 | * Description: header file for Registers definition 9 | * 10 | *********************************************************************************************************************/ 11 | #ifndef MCU_HW_H 12 | #define MCU_HW_H 13 | 14 | /********************************************************************************************************************** 15 | * INCLUDES 16 | *********************************************************************************************************************/ 17 | #include "Std_Types.h" 18 | 19 | /********************************************************************************************************************** 20 | * GLOBAL DATA TYPES AND STRUCTURES 21 | *********************************************************************************************************************/ 22 | typedef struct 23 | { 24 | uint32 VECACT :8; 25 | uint32 :3; 26 | uint32 RETBASE :1; 27 | uint32 VECPEND :3; 28 | uint32 VECPEND :4; 29 | uint32 :2; 30 | uint32 ISRPEND :1; 31 | uint32 ISRPRE :1; 32 | uint32 :1; 33 | uint32 PENDSTCLR:1; 34 | uint32 PENDSTSET:1; 35 | uint32 UNPENDSV :1; 36 | uint32 PENDSV :1; 37 | uint32 :2; 38 | uint32 NMISET :1; 39 | }INTCTRL_BF; 40 | typedef union 41 | { 42 | uint32 R; 43 | INTCTRL_BF B; 44 | }INTCTRL_Tag; 45 | 46 | 47 | 48 | /********************************************************************************************************************** 49 | * GLOBAL CONSTANT MACROS 50 | *********************************************************************************************************************/ 51 | #define CORTEXM4_PERI_BASE_ADDRESS 0xE000E000 52 | #define APINT *((volatile uint32*)(CORTEXM4_PERI_BASE_ADDRESS+0xD0C)) 53 | #define INTCTRL *((volatile INTCTRL_Tag*)(CORTEXM4_PERI_BASE_ADDRESS+0xD04)) 54 | 55 | /********************************************************************************************************************** 56 | * GLOBAL DATA PROTOTYPES 57 | *********************************************************************************************************************/ 58 | 59 | 60 | 61 | 62 | #endif /* MCU_HW_H */ 63 | 64 | /********************************************************************************************************************** 65 | * END OF FILE: Mcu_Hw.h 66 | *********************************************************************************************************************/ 67 | -------------------------------------------------------------------------------- /Src/Common/Compiler.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************** 2 | 3 | * FILE DESCRIPTION 4 | * ------------------------------------------------------------------------------------------------------------------- 5 | * File: Compiler.h 6 | * Module: - 7 | * 8 | * Description: Contains Compiler Dependent MACRO Definition 9 | * 10 | *********************************************************************************************************************/ 11 | #ifndef COMPILER_H 12 | #define COMPILER_H 13 | 14 | /********************************************************************************************************************** 15 | * INCLUDES 16 | *********************************************************************************************************************/ 17 | 18 | 19 | /********************************************************************************************************************** 20 | * GLOBAL CONSTANT MACROS 21 | *********************************************************************************************************************/ 22 | /* NULL_PTR define with a void pointer to zero definition*/ 23 | #define NULL_PTR ((void *)0) 24 | 25 | /* INLINE define for abstraction of the keyword inline*/ 26 | #define INLINE inline 27 | 28 | /* LOCAL_INLINE define for abstraction of the keyword inline in functions with "static" scope. 29 | Different compilers may require a different sequence of the keywords "static" and "inline" 30 | if this is supported at all. */ 31 | #define LOCAL_INLINE static inline 32 | 33 | /********************************************************************************************************************** 34 | * GLOBAL FUNCTION MACROS 35 | *********************************************************************************************************************/ 36 | 37 | 38 | /********************************************************************************************************************** 39 | * GLOBAL DATA TYPES AND STRUCTURES 40 | *********************************************************************************************************************/ 41 | 42 | 43 | /********************************************************************************************************************** 44 | * GLOBAL DATA PROTOTYPES 45 | *********************************************************************************************************************/ 46 | 47 | 48 | /********************************************************************************************************************** 49 | * GLOBAL FUNCTION PROTOTYPES 50 | *********************************************************************************************************************/ 51 | 52 | 53 | #endif /* COMPILER_H */ 54 | 55 | /********************************************************************************************************************** 56 | * END OF FILE: Std_Types.h 57 | *********************************************************************************************************************/ 58 | -------------------------------------------------------------------------------- /Src/Mcal/Inc/IntCtrl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************** 2 | 3 | * FILE DESCRIPTION 4 | * ------------------------------------------------------------------------------------------------------------------- 5 | * File: IntCrtl.h 6 | * Module: IntCrtl 7 | * 8 | * Description: header file for IntCrtl Module 9 | * 10 | *********************************************************************************************************************/ 11 | #ifndef IntCrtl_H 12 | #define IntCrtl_H 13 | 14 | /********************************************************************************************************************** 15 | * INCLUDES 16 | *********************************************************************************************************************/ 17 | #include "Std_Types.h" 18 | #include "IntCrtl_Cfg.h" 19 | 20 | /********************************************************************************************************************** 21 | * GLOBAL CONSTANT MACROS 22 | *********************************************************************************************************************/ 23 | 24 | 25 | /********************************************************************************************************************** 26 | * GLOBAL FUNCTION MACROS 27 | *********************************************************************************************************************/ 28 | 29 | 30 | /********************************************************************************************************************** 31 | * GLOBAL DATA TYPES AND STRUCTURES 32 | *********************************************************************************************************************/ 33 | 34 | 35 | /********************************************************************************************************************** 36 | * GLOBAL DATA PROTOTYPES 37 | *********************************************************************************************************************/ 38 | 39 | 40 | /********************************************************************************************************************** 41 | * GLOBAL FUNCTION PROTOTYPES 42 | *********************************************************************************************************************/ 43 | 44 | /****************************************************************************** 45 | * \Syntax : void IntCrtl_Init(void) 46 | * \Description : initialize Nvic\SCB Module by parsing the Configuration 47 | * into Nvic\SCB registers 48 | * 49 | * \Sync\Async : Synchronous 50 | * \Reentrancy : Non Reentrant 51 | * \Parameters (in) : None 52 | * \Parameters (out): None 53 | * \Return value: : None 54 | *******************************************************************************/ 55 | void IntCrtl_Init(void); 56 | 57 | #endif /* IntCrtl_H */ 58 | 59 | /********************************************************************************************************************** 60 | * END OF FILE: IntCrtl.h 61 | *********************************************************************************************************************/ 62 | -------------------------------------------------------------------------------- /Doc/SourceFileTemplate.c: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************** 2 | * FILE DESCRIPTION 3 | * -----------------------------------------------------------------------------------------------------------------*/ 4 | /** \file FileName.c 5 | * \brief 6 | * 7 | * \details 8 | * 9 | * 10 | *********************************************************************************************************************/ 11 | 12 | /********************************************************************************************************************** 13 | * INCLUDES 14 | *********************************************************************************************************************/ 15 | #include "Std_Types.h" 16 | 17 | /********************************************************************************************************************** 18 | * LOCAL MACROS CONSTANT\FUNCTION 19 | *********************************************************************************************************************/ 20 | 21 | /********************************************************************************************************************** 22 | * LOCAL DATA 23 | *********************************************************************************************************************/ 24 | 25 | /********************************************************************************************************************** 26 | * GLOBAL DATA 27 | *********************************************************************************************************************/ 28 | 29 | /********************************************************************************************************************** 30 | * LOCAL FUNCTION PROTOTYPES 31 | *********************************************************************************************************************/ 32 | 33 | /********************************************************************************************************************** 34 | * LOCAL FUNCTIONS 35 | *********************************************************************************************************************/ 36 | 37 | /********************************************************************************************************************** 38 | * GLOBAL FUNCTIONS 39 | *********************************************************************************************************************/ 40 | 41 | 42 | /****************************************************************************** 43 | * \Syntax : Std_ReturnType FunctionName(AnyType parameterName) 44 | * \Description : Describe this service 45 | * 46 | * \Sync\Async : Synchronous 47 | * \Reentrancy : Non Reentrant 48 | * \Parameters (in) : parameterName Parameter Describtion 49 | * \Parameters (out): None 50 | * \Return value: : Std_ReturnType E_OK 51 | * E_NOT_OK 52 | *******************************************************************************/ 53 | Std_ReturnType FunctionName(AnyType parameterName) 54 | { 55 | 56 | 57 | } 58 | 59 | /********************************************************************************************************************** 60 | * END OF FILE: FileName.c 61 | *********************************************************************************************************************/ 62 | -------------------------------------------------------------------------------- /Src/Mcal/IntCtrl.c: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************** 2 | * FILE DESCRIPTION 3 | * -----------------------------------------------------------------------------------------------------------------*/ 4 | /** \file IntCrtl.c 5 | * \brief Nested Vector Interrupt Controller Driver 6 | * 7 | * \details The Driver Configure All MCU interrupts Priority into gorups and subgroups 8 | * Enable NVIC Interrupt Gate for Peripherals 9 | * 10 | *********************************************************************************************************************/ 11 | 12 | /********************************************************************************************************************** 13 | * INCLUDES 14 | *********************************************************************************************************************/ 15 | #include "Std_Types.h" 16 | #include "IntCrtl.h" 17 | #include "Mcu_Hw.h" 18 | 19 | /********************************************************************************************************************** 20 | * LOCAL MACROS CONSTANT\FUNCTION 21 | *********************************************************************************************************************/ 22 | 23 | /********************************************************************************************************************** 24 | * LOCAL DATA 25 | *********************************************************************************************************************/ 26 | 27 | /********************************************************************************************************************** 28 | * GLOBAL DATA 29 | *********************************************************************************************************************/ 30 | 31 | /********************************************************************************************************************** 32 | * LOCAL FUNCTION PROTOTYPES 33 | *********************************************************************************************************************/ 34 | 35 | /********************************************************************************************************************** 36 | * LOCAL FUNCTIONS 37 | *********************************************************************************************************************/ 38 | 39 | /********************************************************************************************************************** 40 | * GLOBAL FUNCTIONS 41 | *********************************************************************************************************************/ 42 | 43 | 44 | /****************************************************************************** 45 | * \Syntax : void IntCrtl_Init(void) 46 | * \Description : initialize Nvic\SCB Module by parsing the Configuration 47 | * into Nvic\SCB registers 48 | * 49 | * \Sync\Async : Synchronous 50 | * \Reentrancy : Non Reentrant 51 | * \Parameters (in) : None 52 | * \Parameters (out): None 53 | * \Return value: : None 54 | *******************************************************************************/ 55 | void IntCrtl_Init(void) 56 | { 57 | 58 | /*TODO Configure Grouping\SubGrouping System in APINT register in SCB*/ 59 | APINT = 0xFA05|0x00001234; 60 | 61 | /*TODO : Assign Group\Subgroup priority in NVIC_PRIx Nvic and SCB_SYSPRIx Registers*/ 62 | 63 | 64 | /*TODO : Enable\Disable based on user configurations in NVIC_ENx and SCB_Sys Registers */ 65 | 66 | 67 | 68 | 69 | } 70 | 71 | /********************************************************************************************************************** 72 | * END OF FILE: IntCrtl.c 73 | *********************************************************************************************************************/ 74 | -------------------------------------------------------------------------------- /Src/Common/Platform_Types.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************** 2 | 3 | * FILE DESCRIPTION 4 | * ------------------------------------------------------------------------------------------------------------------- 5 | * File: Platform_Types.h 6 | * Module: - 7 | * 8 | * Description: Contains types that dependent on platform - CortexM4 9 | * 10 | *********************************************************************************************************************/ 11 | #ifndef PLATFORM_TYPES_H 12 | #define PLATFORM_TYPES_H 13 | 14 | /********************************************************************************************************************** 15 | * INCLUDES 16 | *********************************************************************************************************************/ 17 | 18 | 19 | /********************************************************************************************************************** 20 | * GLOBAL CONSTANT MACROS 21 | *********************************************************************************************************************/ 22 | #define WORD_LENGTH_BITS 32u 23 | #define WORD_LENGTH_BYTES 4u 24 | #define MSB_FIRST 0u /* big endian bit ordering */ 25 | #define LSB_FIRST 1u /* little endian bit ordering */ 26 | 27 | #define HIGH_BYTE_FIRST 0u /* big endian byte ordering */ 28 | #define LOW_BYTE_FIRST 1u /* little endian byte ordering */ 29 | 30 | #ifndef TRUE 31 | #define TRUE 1u 32 | #endif 33 | 34 | #ifndef FALSE 35 | #define FALSE 0u 36 | #endif 37 | 38 | #define ENABLE 1u 39 | #define DISABLE 0u 40 | 41 | #define CPU_BIT_ORDER LSB_FIRST /*little endian bit ordering*/ 42 | #define CPU_BYTE_ORDER LOW_BYTE_FIRST /*little endian byte ordering*/ 43 | 44 | /********************************************************************************************************************** 45 | * GLOBAL FUNCTION MACROS 46 | *********************************************************************************************************************/ 47 | 48 | 49 | /********************************************************************************************************************** 50 | * GLOBAL DATA TYPES AND STRUCTURES 51 | *********************************************************************************************************************/ 52 | typedef unsigned char boolean; /* TRUE .. FALSE */ 53 | 54 | typedef signed char sint8; /* -128 .. +127 */ 55 | typedef unsigned char uint8; /* 0 .. 255 */ 56 | typedef signed short sint16; /* -32768 .. +32767 */ 57 | typedef unsigned short uint16; /* 0 .. 65535 */ 58 | typedef signed long sint32; /* -2147483648 .. +2147483647 */ 59 | typedef unsigned long uint32; /* 0 .. 4294967295 */ 60 | 61 | typedef float float32; 62 | typedef double float64; 63 | 64 | #ifdef PLATFORM_SUPPORT_SINT64_UINT64 /*Valid only for gnu and C99 */ 65 | typedef signed long long sint64; /* -9223372036854775808 .. 9223372036854775807 */ 66 | typedef unsigned long long uint64; /* 0 .. 18446744073709551615 */ 67 | #endif 68 | 69 | /********************************************************************************************************************** 70 | * GLOBAL DATA PROTOTYPES 71 | *********************************************************************************************************************/ 72 | 73 | 74 | /********************************************************************************************************************** 75 | * GLOBAL FUNCTION PROTOTYPES 76 | *********************************************************************************************************************/ 77 | 78 | 79 | #endif /* PLATFORM_TYPES_H */ 80 | 81 | /********************************************************************************************************************** 82 | * END OF FILE: Std_Types.h 83 | *********************************************************************************************************************/ 84 | --------------------------------------------------------------------------------