Skip to content

Commit

Permalink
Generalized generic HW and interrupt handlers for all components
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshLafleur committed Feb 18, 2025
1 parent b6bff39 commit bb29915
Show file tree
Hide file tree
Showing 21 changed files with 38 additions and 637 deletions.
91 changes: 0 additions & 91 deletions components/bms_boss/HW/HW.c

This file was deleted.

34 changes: 0 additions & 34 deletions components/bms_boss/HW/include/HW.h

This file was deleted.

2 changes: 1 addition & 1 deletion components/bms_boss/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ project_source_files = [
]

project_hw_files = [
HW_DIR.File("HW.c"),
SHARED_HW.File("HW.c"),
HW_DIR.File("HW_adc.c"),
HW_DIR.File("HW_can_componentSpecific.c"),
HW_DIR.File("HW_gpio_componentSpecific.c"),
Expand Down
71 changes: 0 additions & 71 deletions components/bms_worker/HW/HW.c

This file was deleted.

34 changes: 0 additions & 34 deletions components/bms_worker/HW/include/HW.h

This file was deleted.

30 changes: 0 additions & 30 deletions components/bms_worker/HW/include/HW_intc.h

This file was deleted.

2 changes: 1 addition & 1 deletion components/bms_worker/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ src_files = [
]

hw_files = [
HW_DIR.File("HW.c"),
SHARED_HW.File("HW.c"),
HW_DIR.File("HW_adc.c"),
HW_DIR.File("HW_can_componentSpecific.c"),
HW_DIR.File("HW_dma.c"),
Expand Down
16 changes: 14 additions & 2 deletions components/vc/front/src/HW/HW.c → components/shared/code/HW/HW.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
#include "stm32f1xx.h"
#include "HW_tim.h"

#include "FeatureDefines_generated.h"

#if (MCU_STM32_PN == FDEFS_STM32_PN_STM32F105) || \
(MCU_STM32_PN == FDEFS_STM32_PN_STM32F103XB)
typedef struct
{
volatile uint32_t const CPUID;
Expand All @@ -38,6 +42,9 @@ typedef struct

#define AIRCR_RESET (0x05FA0000UL)
#define AIRCR_RESET_REQ (AIRCR_RESET | 0x04UL)
#else
#error "Chipset not supported"
#endif

/******************************************************************************
* P U B L I C F U N C T I O N P R O T O T Y P E S
Expand All @@ -48,9 +55,9 @@ typedef struct
*
* @retval Always true
*/
bool HW_init(void)
HW_StatusTypeDef_E HW_init(void)
{
return HAL_Init() == HAL_OK;
return HAL_Init() == HAL_OK ? HW_OK : HW_ERROR;
}

/**
Expand Down Expand Up @@ -87,5 +94,10 @@ void HW_usDelay(uint8_t us)

void HW_systemHardReset(void)
{
#if (MCU_STM32_PN == FDEFS_STM32_PN_STM32F105) || \
(MCU_STM32_PN == FDEFS_STM32_PN_STM32F103XB)
pSCB->AIRCR = AIRCR_RESET_REQ;
#else
#error "Chipset not supported"
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ typedef enum
* P U B L I C F U N C T I O N P R O T O T Y P E S
******************************************************************************/

bool HW_init(void);
uint32_t HW_getTick(void);
void HW_delay(uint32_t delay);
void HW_usDelay(uint8_t us);
void HW_systemHardReset(void);
void Error_Handler(void);
HW_StatusTypeDef_E HW_init(void);
uint32_t HW_getTick(void);
void HW_delay(uint32_t delay);
void HW_usDelay(uint8_t us);
void HW_systemHardReset(void);
void Error_Handler(void);
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
* P U B L I C F U N C T I O N P R O T O T Y P E S
******************************************************************************/

#include "FeatureDefines_generated.h"

#if FEATURE_IS_ENABLED(MCU_STM32_USE_HAL)
#include "stm32f1xx.h"
#endif

void NMI_Handler(void);
void HardFault_Handler(void);
Expand All @@ -19,17 +23,21 @@ void UsageFault_Handler(void);
void DebugMon_Handler(void);

void DMA1_Channel1_IRQHandler(void);

void ADC1_2_IRQHandler(void);

void TIM1_CC_IRQHandler(void);
void TIM1_TRG_COM_IRQHandler(void);
void TIM2_IRQHandler(void);
void TIM1_CC_IRQHandler(void);
void TIM3_IRQHandler(void);
void TIM4_IRQHandler(void);

void CAN1_SCE_IRQHandler(void);
void CAN1_TX_IRQHandler(void);
void CAN1_RX0_IRQHandler(void);
void CAN1_RX1_IRQHandler(void);

#if BMSB_CONFIG_ID == 1U
#if (MCU_STM32_PN == FDEFS_STM32_PN_STM32F105)
void CAN2_SCE_IRQHandler(void);
void CAN2_TX_IRQHandler(void);
void CAN2_RX0_IRQHandler(void);
Expand Down
4 changes: 2 additions & 2 deletions components/vc/front/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ link_flags = [
"-Wl,--print-memory-usage",
# "-Wl,--print-gc-sections",
"--specs=nano.specs",
"-Icomponents/vc/pdu/include/HW"
"-Icomponents/vc/front/include/HW"
]

as_flags = ["-xassembler-with-cpp"]
Expand Down Expand Up @@ -149,7 +149,7 @@ project_source_files = [
]

project_hw_files = [
HW_DIR.File("HW.c"),
SHARED_HW.File("HW.c"),
HW_DIR.File("HW_adc.c"),
HW_DIR.File("HW_can_componentSpecific.c"),
HW_DIR.File("HW_gpio_componentSpecific.c"),
Expand Down
Loading

0 comments on commit bb29915

Please sign in to comment.