Procházet zdrojové kódy

Put FORCE_INLINE before static

Scott Lahteine před 7 roky
rodič
revize
de3d3b9cb1

+ 4
- 4
Marlin/src/HAL/HAL_AVR/MarlinSerial.h Zobrazit soubor

121
         FORCE_INLINE static ring_buffer_pos_t rxMaxEnqueued() { return rx_max_enqueued; }
121
         FORCE_INLINE static ring_buffer_pos_t rxMaxEnqueued() { return rx_max_enqueued; }
122
       #endif
122
       #endif
123
 
123
 
124
-      static FORCE_INLINE void write(const char* str) { while (*str) write(*str++); }
125
-      static FORCE_INLINE void write(const uint8_t* buffer, size_t size) { while (size--) write(*buffer++); }
126
-      static FORCE_INLINE void print(const String& s) { for (int i = 0; i < (int)s.length(); i++) write(s[i]); }
127
-      static FORCE_INLINE void print(const char* str) { write(str); }
124
+      FORCE_INLINE static void write(const char* str) { while (*str) write(*str++); }
125
+      FORCE_INLINE static void write(const uint8_t* buffer, size_t size) { while (size--) write(*buffer++); }
126
+      FORCE_INLINE static void print(const String& s) { for (int i = 0; i < (int)s.length(); i++) write(s[i]); }
127
+      FORCE_INLINE static void print(const char* str) { write(str); }
128
 
128
 
129
       static void print(char, int = BYTE);
129
       static void print(char, int = BYTE);
130
       static void print(unsigned char, int = BYTE);
130
       static void print(unsigned char, int = BYTE);

+ 4
- 4
Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h Zobrazit soubor

87
 
87
 
88
 void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);
88
 void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);
89
 
89
 
90
-static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const uint32_t count) {
90
+FORCE_INLINE static void HAL_timer_set_count(const uint8_t timer_num, const uint32_t count) {
91
   const tTimerConfig *pConfig = &TimerConfig[timer_num];
91
   const tTimerConfig *pConfig = &TimerConfig[timer_num];
92
   pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC = count;
92
   pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC = count;
93
 }
93
 }
94
 
94
 
95
-static FORCE_INLINE hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
95
+FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
96
   const tTimerConfig *pConfig = &TimerConfig[timer_num];
96
   const tTimerConfig *pConfig = &TimerConfig[timer_num];
97
   return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC;
97
   return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC;
98
 }
98
 }
99
 
99
 
100
-static FORCE_INLINE uint32_t HAL_timer_get_current_count(const uint8_t timer_num) {
100
+FORCE_INLINE static uint32_t HAL_timer_get_current_count(const uint8_t timer_num) {
101
   const tTimerConfig *pConfig = &TimerConfig[timer_num];
101
   const tTimerConfig *pConfig = &TimerConfig[timer_num];
102
   return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_CV;
102
   return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_CV;
103
 }
103
 }
107
 
107
 
108
 //void HAL_timer_isr_prologue(const uint8_t timer_num);
108
 //void HAL_timer_isr_prologue(const uint8_t timer_num);
109
 
109
 
110
-static FORCE_INLINE void HAL_timer_isr_prologue(const uint8_t timer_num) {
110
+FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) {
111
   const tTimerConfig *pConfig = &TimerConfig[timer_num];
111
   const tTimerConfig *pConfig = &TimerConfig[timer_num];
112
   // Reading the status register clears the interrupt flag
112
   // Reading the status register clears the interrupt flag
113
   pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_SR;
113
   pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_SR;

+ 4
- 4
Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h Zobrazit soubor

107
     FORCE_INLINE static ring_buffer_pos_t rxMaxEnqueued() { return rx_max_enqueued; }
107
     FORCE_INLINE static ring_buffer_pos_t rxMaxEnqueued() { return rx_max_enqueued; }
108
   #endif
108
   #endif
109
 
109
 
110
-  static FORCE_INLINE void write(const char* str) { while (*str) write(*str++); }
111
-  static FORCE_INLINE void write(const uint8_t* buffer, size_t size) { while (size--) write(*buffer++); }
112
-  static FORCE_INLINE void print(const String& s) { for (int i = 0; i < (int)s.length(); i++) write(s[i]); }
113
-  static FORCE_INLINE void print(const char* str) { write(str); }
110
+  FORCE_INLINE static void write(const char* str) { while (*str) write(*str++); }
111
+  FORCE_INLINE static void write(const uint8_t* buffer, size_t size) { while (size--) write(*buffer++); }
112
+  FORCE_INLINE static void print(const String& s) { for (int i = 0; i < (int)s.length(); i++) write(s[i]); }
113
+  FORCE_INLINE static void print(const char* str) { write(str); }
114
 
114
 
115
   static void print(char, int = BYTE);
115
   static void print(char, int = BYTE);
116
   static void print(unsigned char, int = BYTE);
116
   static void print(unsigned char, int = BYTE);

+ 3
- 3
Marlin/src/HAL/HAL_LPC1768/HAL_timers.h Zobrazit soubor

77
 void HAL_timer_init(void);
77
 void HAL_timer_init(void);
78
 void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);
78
 void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);
79
 
79
 
80
-static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const hal_timer_t count) {
80
+FORCE_INLINE static void HAL_timer_set_count(const uint8_t timer_num, const hal_timer_t count) {
81
   switch (timer_num) {
81
   switch (timer_num) {
82
     case 0:
82
     case 0:
83
       LPC_TIM0->MR0 = count;
83
       LPC_TIM0->MR0 = count;
92
   }
92
   }
93
 }
93
 }
94
 
94
 
95
-static FORCE_INLINE hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
95
+FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
96
   switch (timer_num) {
96
   switch (timer_num) {
97
     case 0: return LPC_TIM0->MR0;
97
     case 0: return LPC_TIM0->MR0;
98
     case 1: return LPC_TIM1->MR0;
98
     case 1: return LPC_TIM1->MR0;
100
   return 0;
100
   return 0;
101
 }
101
 }
102
 
102
 
103
-static FORCE_INLINE hal_timer_t HAL_timer_get_current_count(const uint8_t timer_num) {
103
+FORCE_INLINE static hal_timer_t HAL_timer_get_current_count(const uint8_t timer_num) {
104
   switch (timer_num) {
104
   switch (timer_num) {
105
     case 0: return LPC_TIM0->TC;
105
     case 0: return LPC_TIM0->TC;
106
     case 1: return LPC_TIM1->TC;
106
     case 1: return LPC_TIM1->TC;

+ 4
- 4
Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h Zobrazit soubor

107
  * Todo: Look at that possibility later.
107
  * Todo: Look at that possibility later.
108
  */
108
  */
109
 
109
 
110
-static FORCE_INLINE void HAL_timer_set_count (uint8_t timer_num, uint32_t count) {
110
+FORCE_INLINE static void HAL_timer_set_count (uint8_t timer_num, uint32_t count) {
111
   switch (timer_num) {
111
   switch (timer_num) {
112
   case STEP_TIMER_NUM:
112
   case STEP_TIMER_NUM:
113
     StepperTimer.pause();
113
     StepperTimer.pause();
126
   }
126
   }
127
 }
127
 }
128
 
128
 
129
-static FORCE_INLINE hal_timer_t HAL_timer_get_count (uint8_t timer_num) {
129
+FORCE_INLINE static hal_timer_t HAL_timer_get_count (uint8_t timer_num) {
130
   hal_timer_t temp;
130
   hal_timer_t temp;
131
   switch (timer_num) {
131
   switch (timer_num) {
132
   case STEP_TIMER_NUM:
132
   case STEP_TIMER_NUM:
142
   return temp;
142
   return temp;
143
 }
143
 }
144
 
144
 
145
-static FORCE_INLINE hal_timer_t HAL_timer_get_current_count(uint8_t timer_num) {
145
+FORCE_INLINE static hal_timer_t HAL_timer_get_current_count(uint8_t timer_num) {
146
   hal_timer_t temp;
146
   hal_timer_t temp;
147
   switch (timer_num) {
147
   switch (timer_num) {
148
   case STEP_TIMER_NUM:
148
   case STEP_TIMER_NUM:
161
 
161
 
162
 //void HAL_timer_isr_prologue (uint8_t timer_num);
162
 //void HAL_timer_isr_prologue (uint8_t timer_num);
163
 
163
 
164
-static FORCE_INLINE void HAL_timer_isr_prologue(uint8_t timer_num) {
164
+FORCE_INLINE static void HAL_timer_isr_prologue(uint8_t timer_num) {
165
   switch (timer_num) {
165
   switch (timer_num) {
166
   case STEP_TIMER_NUM:
166
   case STEP_TIMER_NUM:
167
     StepperTimer.pause();
167
     StepperTimer.pause();

+ 3
- 3
Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h Zobrazit soubor

75
 
75
 
76
 void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);
76
 void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);
77
 
77
 
78
-static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const uint32_t count) {
78
+FORCE_INLINE static void HAL_timer_set_count(const uint8_t timer_num, const uint32_t count) {
79
   switch(timer_num) {
79
   switch(timer_num) {
80
     case 0: FTM0_C0V = count; break;
80
     case 0: FTM0_C0V = count; break;
81
     case 1: FTM1_C0V = count; break;
81
     case 1: FTM1_C0V = count; break;
82
   }
82
   }
83
 }
83
 }
84
 
84
 
85
-static FORCE_INLINE hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
85
+FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
86
   switch(timer_num) {
86
   switch(timer_num) {
87
     case 0: return FTM0_C0V;
87
     case 0: return FTM0_C0V;
88
     case 1: return FTM1_C0V;
88
     case 1: return FTM1_C0V;
90
   return 0;
90
   return 0;
91
 }
91
 }
92
 
92
 
93
-static FORCE_INLINE uint32_t HAL_timer_get_current_count(const uint8_t timer_num) {
93
+FORCE_INLINE static uint32_t HAL_timer_get_current_count(const uint8_t timer_num) {
94
   switch(timer_num) {
94
   switch(timer_num) {
95
     case 0: return FTM0_CNT;
95
     case 0: return FTM0_CNT;
96
     case 1: return FTM1_CNT;
96
     case 1: return FTM1_CNT;

+ 1
- 1
Marlin/src/gcode/gcode.h Zobrazit soubor

282
   static void process_parsed_command();
282
   static void process_parsed_command();
283
   static void process_next_command();
283
   static void process_next_command();
284
 
284
 
285
-  static FORCE_INLINE void home_all_axes() { G28(true); }
285
+  FORCE_INLINE static void home_all_axes() { G28(true); }
286
 
286
 
287
   /**
287
   /**
288
    * Multi-stepper support for M92, M201, M203
288
    * Multi-stepper support for M92, M201, M203

+ 5
- 5
Marlin/src/module/planner.h Zobrazit soubor

392
      *  fr_mm_s      - (target) speed of the move (mm/s)
392
      *  fr_mm_s      - (target) speed of the move (mm/s)
393
      *  extruder     - target extruder
393
      *  extruder     - target extruder
394
      */
394
      */
395
-    static FORCE_INLINE void buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, const float &fr_mm_s, const uint8_t extruder) {
395
+    FORCE_INLINE static void buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, const float &fr_mm_s, const uint8_t extruder) {
396
       #if PLANNER_LEVELING && IS_CARTESIAN
396
       #if PLANNER_LEVELING && IS_CARTESIAN
397
         apply_leveling(rx, ry, rz);
397
         apply_leveling(rx, ry, rz);
398
       #endif
398
       #endif
408
      *  fr_mm_s  - (target) speed of the move (mm/s)
408
      *  fr_mm_s  - (target) speed of the move (mm/s)
409
      *  extruder - target extruder
409
      *  extruder - target extruder
410
      */
410
      */
411
-    static FORCE_INLINE void buffer_line_kinematic(const float cart[XYZE], const float &fr_mm_s, const uint8_t extruder) {
411
+    FORCE_INLINE static void buffer_line_kinematic(const float cart[XYZE], const float &fr_mm_s, const uint8_t extruder) {
412
       #if PLANNER_LEVELING
412
       #if PLANNER_LEVELING
413
         float raw[XYZ] = { cart[X_AXIS], cart[Y_AXIS], cart[Z_AXIS] };
413
         float raw[XYZ] = { cart[X_AXIS], cart[Y_AXIS], cart[Z_AXIS] };
414
         apply_leveling(raw);
414
         apply_leveling(raw);
432
      *
432
      *
433
      * Clears previous speed values.
433
      * Clears previous speed values.
434
      */
434
      */
435
-    static FORCE_INLINE void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) {
435
+    FORCE_INLINE static void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) {
436
       #if PLANNER_LEVELING && IS_CARTESIAN
436
       #if PLANNER_LEVELING && IS_CARTESIAN
437
         apply_leveling(rx, ry, rz);
437
         apply_leveling(rx, ry, rz);
438
       #endif
438
       #endif
440
     }
440
     }
441
     static void set_position_mm_kinematic(const float position[NUM_AXIS]);
441
     static void set_position_mm_kinematic(const float position[NUM_AXIS]);
442
     static void set_position_mm(const AxisEnum axis, const float &v);
442
     static void set_position_mm(const AxisEnum axis, const float &v);
443
-    static FORCE_INLINE void set_z_position_mm(const float &z) { set_position_mm(Z_AXIS, z); }
444
-    static FORCE_INLINE void set_e_position_mm(const float &e) { set_position_mm(AxisEnum(E_AXIS), e); }
443
+    FORCE_INLINE static void set_z_position_mm(const float &z) { set_position_mm(Z_AXIS, z); }
444
+    FORCE_INLINE static void set_e_position_mm(const float &e) { set_position_mm(AxisEnum(E_AXIS), e); }
445
 
445
 
446
     /**
446
     /**
447
      * Sync from the stepper positions. (e.g., after an interrupted move)
447
      * Sync from the stepper positions. (e.g., after an interrupted move)

+ 14
- 14
Marlin/src/module/stepper.h Zobrazit soubor

199
     // SCARA AB axes are in degrees, not mm
199
     // SCARA AB axes are in degrees, not mm
200
     //
200
     //
201
     #if IS_SCARA
201
     #if IS_SCARA
202
-      static FORCE_INLINE float get_axis_position_degrees(AxisEnum axis) { return get_axis_position_mm(axis); }
202
+      FORCE_INLINE static float get_axis_position_degrees(AxisEnum axis) { return get_axis_position_mm(axis); }
203
     #endif
203
     #endif
204
 
204
 
205
     //
205
     //
221
     //
221
     //
222
     // The direction of a single motor
222
     // The direction of a single motor
223
     //
223
     //
224
-    static FORCE_INLINE bool motor_direction(AxisEnum axis) { return TEST(last_direction_bits, axis); }
224
+    FORCE_INLINE static bool motor_direction(AxisEnum axis) { return TEST(last_direction_bits, axis); }
225
 
225
 
226
     #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM
226
     #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM
227
       static void digitalPotWrite(const int16_t address, const int16_t value);
227
       static void digitalPotWrite(const int16_t address, const int16_t value);
235
     #endif
235
     #endif
236
 
236
 
237
     #if ENABLED(X_DUAL_ENDSTOPS)
237
     #if ENABLED(X_DUAL_ENDSTOPS)
238
-      static FORCE_INLINE void set_homing_flag_x(const bool state) { performing_homing = state; }
239
-      static FORCE_INLINE void set_x_lock(const bool state) { locked_x_motor = state; }
240
-      static FORCE_INLINE void set_x2_lock(const bool state) { locked_x2_motor = state; }
238
+      FORCE_INLINE static void set_homing_flag_x(const bool state) { performing_homing = state; }
239
+      FORCE_INLINE static void set_x_lock(const bool state) { locked_x_motor = state; }
240
+      FORCE_INLINE static void set_x2_lock(const bool state) { locked_x2_motor = state; }
241
     #endif
241
     #endif
242
 
242
 
243
     #if ENABLED(Y_DUAL_ENDSTOPS)
243
     #if ENABLED(Y_DUAL_ENDSTOPS)
244
-      static FORCE_INLINE void set_homing_flag_y(const bool state) { performing_homing = state; }
245
-      static FORCE_INLINE void set_y_lock(const bool state) { locked_y_motor = state; }
246
-      static FORCE_INLINE void set_y2_lock(const bool state) { locked_y2_motor = state; }
244
+      FORCE_INLINE static void set_homing_flag_y(const bool state) { performing_homing = state; }
245
+      FORCE_INLINE static void set_y_lock(const bool state) { locked_y_motor = state; }
246
+      FORCE_INLINE static void set_y2_lock(const bool state) { locked_y2_motor = state; }
247
     #endif
247
     #endif
248
 
248
 
249
     #if ENABLED(Z_DUAL_ENDSTOPS)
249
     #if ENABLED(Z_DUAL_ENDSTOPS)
250
-      static FORCE_INLINE void set_homing_flag_z(const bool state) { performing_homing = state; }
251
-      static FORCE_INLINE void set_z_lock(const bool state) { locked_z_motor = state; }
252
-      static FORCE_INLINE void set_z2_lock(const bool state) { locked_z2_motor = state; }
250
+      FORCE_INLINE static void set_homing_flag_z(const bool state) { performing_homing = state; }
251
+      FORCE_INLINE static void set_z_lock(const bool state) { locked_z_motor = state; }
252
+      FORCE_INLINE static void set_z2_lock(const bool state) { locked_z2_motor = state; }
253
     #endif
253
     #endif
254
 
254
 
255
     #if ENABLED(BABYSTEPPING)
255
     #if ENABLED(BABYSTEPPING)
268
     //
268
     //
269
     // Triggered position of an axis in mm (not core-savvy)
269
     // Triggered position of an axis in mm (not core-savvy)
270
     //
270
     //
271
-    static FORCE_INLINE float triggered_position_mm(AxisEnum axis) {
271
+    FORCE_INLINE static float triggered_position_mm(AxisEnum axis) {
272
       return endstops_trigsteps[axis] * planner.steps_to_mm[axis];
272
       return endstops_trigsteps[axis] * planner.steps_to_mm[axis];
273
     }
273
     }
274
 
274
 
278
 
278
 
279
   private:
279
   private:
280
 
280
 
281
-    static FORCE_INLINE hal_timer_t calc_timer(hal_timer_t step_rate) {
281
+    FORCE_INLINE static hal_timer_t calc_timer(hal_timer_t step_rate) {
282
       hal_timer_t timer;
282
       hal_timer_t timer;
283
 
283
 
284
       NOMORE(step_rate, MAX_STEP_FREQUENCY);
284
       NOMORE(step_rate, MAX_STEP_FREQUENCY);
347
 
347
 
348
     // Initialize the trapezoid generator from the current block.
348
     // Initialize the trapezoid generator from the current block.
349
     // Called whenever a new block begins.
349
     // Called whenever a new block begins.
350
-    static FORCE_INLINE void trapezoid_generator_reset() {
350
+    FORCE_INLINE static void trapezoid_generator_reset() {
351
 
351
 
352
       static int8_t last_extruder = -1;
352
       static int8_t last_extruder = -1;
353
 
353
 

Loading…
Zrušit
Uložit