Browse Source

Make HAL ISR macros function-like

pull/1/head
Scott Lahteine 6 years ago
parent
commit
1f7e220387
  1. 4
      Marlin/src/HAL/HAL_AVR/HAL.h
  2. 6
      Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h
  3. 2
      Marlin/src/HAL/HAL_DUE/Tone.cpp
  4. 4
      Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h
  5. 4
      Marlin/src/HAL/HAL_LINUX/HAL_timers.cpp
  6. 6
      Marlin/src/HAL/HAL_LINUX/HAL_timers.h
  7. 4
      Marlin/src/HAL/HAL_LPC1768/HAL_timers.h
  8. 4
      Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h
  9. 5
      Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.h
  10. 8
      Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h
  11. 4
      Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h
  12. 4
      Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h
  13. 4
      Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h
  14. 2
      Marlin/src/module/stepper.cpp
  15. 2
      Marlin/src/module/temperature.cpp

4
Marlin/src/HAL/HAL_AVR/HAL.h

@ -197,7 +197,7 @@ FORCE_INLINE void HAL_timer_start(const uint8_t timer_num, const uint32_t freque
#define HAL_timer_isr_epilogue(TIMER_NUM)
/* 18 cycles maximum latency */
#define HAL_STEP_TIMER_ISR \
#define HAL_STEP_TIMER_ISR() \
extern "C" void TIMER1_COMPA_vect (void) __attribute__ ((signal, naked, used, externally_visible)); \
extern "C" void TIMER1_COMPA_vect_bottom (void) asm ("TIMER1_COMPA_vect_bottom") __attribute__ ((used, externally_visible, noinline)); \
void TIMER1_COMPA_vect (void) { \
@ -270,7 +270,7 @@ void TIMER1_COMPA_vect (void) { \
void TIMER1_COMPA_vect_bottom(void)
/* 14 cycles maximum latency */
#define HAL_TEMP_TIMER_ISR \
#define HAL_TEMP_TIMER_ISR() \
extern "C" void TIMER0_COMPB_vect (void) __attribute__ ((signal, naked, used, externally_visible)); \
extern "C" void TIMER0_COMPB_vect_bottom(void) asm ("TIMER0_COMPB_vect_bottom") __attribute__ ((used, externally_visible, noinline)); \
void TIMER0_COMPB_vect (void) { \

6
Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h

@ -65,9 +65,9 @@ typedef uint32_t hal_timer_t;
#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
#define HAL_STEP_TIMER_ISR void TC3_Handler()
#define HAL_TEMP_TIMER_ISR void TC4_Handler()
#define HAL_TONE_TIMER_ISR void TC6_Handler()
#define HAL_STEP_TIMER_ISR() void TC3_Handler()
#define HAL_TEMP_TIMER_ISR() void TC4_Handler()
#define HAL_TONE_TIMER_ISR() void TC6_Handler()
// --------------------------------------------------------------------------
// Types

2
Marlin/src/HAL/HAL_DUE/Tone.cpp

@ -45,7 +45,7 @@ void noTone(const pin_t _pin) {
extDigitalWrite(_pin, LOW);
}
HAL_TONE_TIMER_ISR {
HAL_TONE_TIMER_ISR() {
static uint8_t pin_state = 0;
HAL_timer_isr_prologue(TONE_TIMER_NUM);

4
Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h

@ -69,8 +69,8 @@ typedef uint64_t hal_timer_t;
#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
#define HAL_TEMP_TIMER_ISR extern "C" void tempTC_Handler(void)
#define HAL_STEP_TIMER_ISR extern "C" void stepTC_Handler(void)
#define HAL_TEMP_TIMER_ISR() extern "C" void tempTC_Handler(void)
#define HAL_STEP_TIMER_ISR() extern "C" void stepTC_Handler(void)
extern "C" void tempTC_Handler(void);
extern "C" void stepTC_Handler(void);

4
Marlin/src/HAL/HAL_LINUX/HAL_timers.cpp

@ -32,8 +32,8 @@
* This has many limitations and is not fit for the purpose
*/
HAL_STEP_TIMER_ISR;
HAL_TEMP_TIMER_ISR;
HAL_STEP_TIMER_ISR();
HAL_TEMP_TIMER_ISR();
Timer timers[2];

6
Marlin/src/HAL/HAL_LINUX/HAL_timers.h

@ -63,12 +63,12 @@ typedef uint32_t hal_timer_t;
#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
#define HAL_STEP_TIMER_ISR extern "C" void TIMER0_IRQHandler(void)
#define HAL_TEMP_TIMER_ISR extern "C" void TIMER1_IRQHandler(void)
#define HAL_STEP_TIMER_ISR() extern "C" void TIMER0_IRQHandler(void)
#define HAL_TEMP_TIMER_ISR() extern "C" void TIMER1_IRQHandler(void)
// PWM timer
#define HAL_PWM_TIMER
#define HAL_PWM_TIMER_ISR extern "C" void TIMER3_IRQHandler(void)
#define HAL_PWM_TIMER_ISR() extern "C" void TIMER3_IRQHandler(void)
#define HAL_PWM_TIMER_IRQn

4
Marlin/src/HAL/HAL_LPC1768/HAL_timers.h

@ -88,8 +88,8 @@ typedef uint32_t hal_timer_t;
#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
#define HAL_STEP_TIMER_ISR _HAL_TIMER_ISR(STEP_TIMER_NUM)
#define HAL_TEMP_TIMER_ISR _HAL_TIMER_ISR(TEMP_TIMER_NUM)
#define HAL_STEP_TIMER_ISR() _HAL_TIMER_ISR(STEP_TIMER_NUM)
#define HAL_TEMP_TIMER_ISR() _HAL_TIMER_ISR(TEMP_TIMER_NUM)
// Timer references by index
#define STEP_TIMER _HAL_TIMER(STEP_TIMER_NUM)

4
Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h

@ -137,8 +137,8 @@
extern void Step_Handler(stimer_t *htim);
extern void Temp_Handler(stimer_t *htim);
#define HAL_STEP_TIMER_ISR void Step_Handler(stimer_t *htim)
#define HAL_TEMP_TIMER_ISR void Temp_Handler(stimer_t *htim)
#define HAL_STEP_TIMER_ISR() void Step_Handler(stimer_t *htim)
#define HAL_TEMP_TIMER_ISR() void Temp_Handler(stimer_t *htim)
// --------------------------------------------------------------------------
// Types

5
Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.h

@ -85,9 +85,8 @@ timer_dev* get_timer_dev(int number);
// TODO change this
#define HAL_TEMP_TIMER_ISR extern "C" void tempTC_Handler(void)
#define HAL_STEP_TIMER_ISR extern "C" void stepTC_Handler(void)
#define HAL_TEMP_TIMER_ISR() extern "C" void tempTC_Handler(void)
#define HAL_STEP_TIMER_ISR() extern "C" void stepTC_Handler(void)
extern "C" void tempTC_Handler(void);
extern "C" void stepTC_Handler(void);

8
Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h

@ -65,13 +65,13 @@
#ifdef STM32GENERIC
extern void TC5_Handler();
extern void TC7_Handler();
#define HAL_STEP_TIMER_ISR void TC5_Handler()
#define HAL_TEMP_TIMER_ISR void TC7_Handler()
#define HAL_STEP_TIMER_ISR() void TC5_Handler()
#define HAL_TEMP_TIMER_ISR() void TC7_Handler()
#else
extern void TC5_Handler(stimer_t *htim);
extern void TC7_Handler(stimer_t *htim);
#define HAL_STEP_TIMER_ISR void TC5_Handler(stimer_t *htim)
#define HAL_TEMP_TIMER_ISR void TC7_Handler(stimer_t *htim)
#define HAL_STEP_TIMER_ISR() void TC5_Handler(stimer_t *htim)
#define HAL_TEMP_TIMER_ISR() void TC7_Handler(stimer_t *htim)
#endif

4
Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h

@ -66,8 +66,8 @@
extern void TC5_Handler();
extern void TC7_Handler();
#define HAL_STEP_TIMER_ISR void TC5_Handler()
#define HAL_TEMP_TIMER_ISR void TC7_Handler()
#define HAL_STEP_TIMER_ISR() void TC5_Handler()
#define HAL_TEMP_TIMER_ISR() void TC7_Handler()
// --------------------------------------------------------------------------
// Types

4
Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h

@ -72,8 +72,8 @@ typedef uint32_t hal_timer_t;
#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
#define HAL_STEP_TIMER_ISR extern "C" void ftm0_isr(void) //void TC3_Handler()
#define HAL_TEMP_TIMER_ISR extern "C" void ftm1_isr(void) //void TC4_Handler()
#define HAL_STEP_TIMER_ISR() extern "C" void ftm0_isr(void) //void TC3_Handler()
#define HAL_TEMP_TIMER_ISR() extern "C" void ftm1_isr(void) //void TC4_Handler()
void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);

4
Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h

@ -71,8 +71,8 @@ typedef uint32_t hal_timer_t;
#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
#define HAL_STEP_TIMER_ISR extern "C" void ftm0_isr(void) //void TC3_Handler()
#define HAL_TEMP_TIMER_ISR extern "C" void ftm1_isr(void) //void TC4_Handler()
#define HAL_STEP_TIMER_ISR() extern "C" void ftm0_isr(void) //void TC3_Handler()
#define HAL_TEMP_TIMER_ISR() extern "C" void ftm1_isr(void) //void TC4_Handler()
void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);

2
Marlin/src/module/stepper.cpp

@ -1246,7 +1246,7 @@ void Stepper::set_directions() {
* Directly pulses the stepper motors at high frequency.
*/
HAL_STEP_TIMER_ISR {
HAL_STEP_TIMER_ISR() {
HAL_timer_isr_prologue(STEP_TIMER_NUM);
Stepper::isr();

2
Marlin/src/module/temperature.cpp

@ -2295,7 +2295,7 @@ void Temperature::readings_ready() {
* - For ENDSTOP_INTERRUPTS_FEATURE check endstops if flagged
* - Call planner.tick to count down its "ignore" time
*/
HAL_TEMP_TIMER_ISR {
HAL_TEMP_TIMER_ISR() {
HAL_timer_isr_prologue(TEMP_TIMER_NUM);
Temperature::isr();

Loading…
Cancel
Save