Browse Source

Standardize some hexadecimals

Scott Lahteine 7 years ago
parent
commit
d1b619be52

+ 1
- 1
Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp View File

839
       REG_PMC_PCER0 = (1UL << ID_PIOA) | (1UL << ID_SPI0);
839
       REG_PMC_PCER0 = (1UL << ID_PIOA) | (1UL << ID_SPI0);
840
 
840
 
841
       // Disable PIO on A26 and A27
841
       // Disable PIO on A26 and A27
842
-      REG_PIOA_PDR = 0x0c000000;
842
+      REG_PIOA_PDR = 0x0C000000;
843
       OUT_WRITE(SDSS, 1);
843
       OUT_WRITE(SDSS, 1);
844
 
844
 
845
       // Reset SPI0 (from sam lib)
845
       // Reset SPI0 (from sam lib)

+ 3
- 3
Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp View File

122
 
122
 
123
     if ( rs == 0 )
123
     if ( rs == 0 )
124
       /* command */
124
       /* command */
125
-      spiSend_sw_DUE(0x0f8);
125
+      spiSend_sw_DUE(0x0F8);
126
     else
126
     else
127
        /* data */
127
        /* data */
128
-      spiSend_sw_DUE(0x0fa);
128
+      spiSend_sw_DUE(0x0FA);
129
 
129
 
130
     for (i = 0; i < 4; i++)   // give the controller some time to process the data
130
     for (i = 0; i < 4; i++)   // give the controller some time to process the data
131
       u8g_10MicroDelay();     // 2 is bad, 3 is OK, 4 is safe
131
       u8g_10MicroDelay();     // 2 is bad, 3 is OK, 4 is safe
132
   }
132
   }
133
 
133
 
134
-  spiSend_sw_DUE(val & 0x0f0);
134
+  spiSend_sw_DUE(val & 0x0F0);
135
   spiSend_sw_DUE(val << 4);
135
   spiSend_sw_DUE(val << 4);
136
 }
136
 }
137
 
137
 

+ 1
- 1
Marlin/src/HAL/HAL_DUE/usb/pll.h View File

74
 
74
 
75
 #define PLL_UPLL_HZ     480000000
75
 #define PLL_UPLL_HZ     480000000
76
 
76
 
77
-#define PLL_COUNT           0x3fU
77
+#define PLL_COUNT           0x3FU
78
 
78
 
79
 enum pll_source {
79
 enum pll_source {
80
 	PLL_SRC_MAINCK_4M_RC        = OSC_MAINCK_4M_RC,     //!< Internal 4MHz RC oscillator.
80
 	PLL_SRC_MAINCK_4M_RC        = OSC_MAINCK_4M_RC,     //!< Internal 4MHz RC oscillator.

+ 12
- 12
Marlin/src/HAL/HAL_DUE/usb/spc_protocol.h View File

96
 #define  SCSI_INQ_DT_CD_DVD      0x05   //!< CD/DVD device
96
 #define  SCSI_INQ_DT_CD_DVD      0x05   //!< CD/DVD device
97
 #define  SCSI_INQ_DT_OPTICAL     0x07   //!< Optical Memory
97
 #define  SCSI_INQ_DT_OPTICAL     0x07   //!< Optical Memory
98
 #define  SCSI_INQ_DT_MC          0x08   //!< Medium Changer
98
 #define  SCSI_INQ_DT_MC          0x08   //!< Medium Changer
99
-#define  SCSI_INQ_DT_ARRAY       0x0c   //!< Storage Array Controller
100
-#define  SCSI_INQ_DT_ENCLOSURE   0x0d   //!< Enclosure Services
101
-#define  SCSI_INQ_DT_RBC         0x0e   //!< Simplified Direct Access
102
-#define  SCSI_INQ_DT_OCRW        0x0f   //!< Optical card reader/writer
99
+#define  SCSI_INQ_DT_ARRAY       0x0C   //!< Storage Array Controller
100
+#define  SCSI_INQ_DT_ENCLOSURE   0x0D   //!< Enclosure Services
101
+#define  SCSI_INQ_DT_RBC         0x0E   //!< Simplified Direct Access
102
+#define  SCSI_INQ_DT_OCRW        0x0F   //!< Optical card reader/writer
103
 #define  SCSI_INQ_DT_BCC         0x10   //!< Bridge Controller Commands
103
 #define  SCSI_INQ_DT_BCC         0x10   //!< Bridge Controller Commands
104
 #define  SCSI_INQ_DT_OSD         0x11   //!< Object-based Storage
104
 #define  SCSI_INQ_DT_OSD         0x11   //!< Object-based Storage
105
-#define  SCSI_INQ_DT_NONE        0x1f   //!< No Peripheral
105
+#define  SCSI_INQ_DT_NONE        0x1F   //!< No Peripheral
106
 	uint8_t flags1; //!< Flags (byte 1)
106
 	uint8_t flags1; //!< Flags (byte 1)
107
 #define  SCSI_INQ_RMB            0x80   //!< Removable Medium
107
 #define  SCSI_INQ_RMB            0x80   //!< Removable Medium
108
 	uint8_t version; //!< Version
108
 	uint8_t version; //!< Version
213
 	SCSI_SK_DATA_PROTECT = 0x7,
213
 	SCSI_SK_DATA_PROTECT = 0x7,
214
 	SCSI_SK_BLANK_CHECK = 0x8,
214
 	SCSI_SK_BLANK_CHECK = 0x8,
215
 	SCSI_SK_VENDOR_SPECIFIC = 0x9,
215
 	SCSI_SK_VENDOR_SPECIFIC = 0x9,
216
-	SCSI_SK_COPY_ABORTED = 0xa,
217
-	SCSI_SK_ABORTED_COMMAND = 0xb,
218
-	SCSI_SK_VOLUME_OVERFLOW = 0xd,
219
-	SCSI_SK_MISCOMPARE = 0xe,
216
+	SCSI_SK_COPY_ABORTED = 0xA,
217
+	SCSI_SK_ABORTED_COMMAND = 0xB,
218
+	SCSI_SK_VOLUME_OVERFLOW = 0xD,
219
+	SCSI_SK_MISCOMPARE = 0xE,
220
 };
220
 };
221
 
221
 
222
 /* Additional Sense Code / Additional Sense Code Qualifier pairs */
222
 /* Additional Sense Code / Additional Sense Code Qualifier pairs */
223
 enum scsi_asc_ascq {
223
 enum scsi_asc_ascq {
224
 	SCSI_ASC_NO_ADDITIONAL_SENSE_INFO = 0x0000,
224
 	SCSI_ASC_NO_ADDITIONAL_SENSE_INFO = 0x0000,
225
 	SCSI_ASC_LU_NOT_READY_REBUILD_IN_PROGRESS = 0x0405,
225
 	SCSI_ASC_LU_NOT_READY_REBUILD_IN_PROGRESS = 0x0405,
226
-	SCSI_ASC_WRITE_ERROR = 0x0c00,
226
+	SCSI_ASC_WRITE_ERROR = 0x0C00,
227
 	SCSI_ASC_UNRECOVERED_READ_ERROR = 0x1100,
227
 	SCSI_ASC_UNRECOVERED_READ_ERROR = 0x1100,
228
 	SCSI_ASC_INVALID_COMMAND_OPERATION_CODE = 0x2000,
228
 	SCSI_ASC_INVALID_COMMAND_OPERATION_CODE = 0x2000,
229
 	SCSI_ASC_INVALID_FIELD_IN_CDB = 0x2400,
229
 	SCSI_ASC_INVALID_FIELD_IN_CDB = 0x2400,
242
 enum scsi_spc_mode {
242
 enum scsi_spc_mode {
243
 	SCSI_MS_MODE_VENDOR_SPEC = 0x00,
243
 	SCSI_MS_MODE_VENDOR_SPEC = 0x00,
244
 	SCSI_MS_MODE_INFEXP = 0x1C,    // Informational exceptions control page
244
 	SCSI_MS_MODE_INFEXP = 0x1C,    // Informational exceptions control page
245
-	SCSI_MS_MODE_ALL = 0x3f,
245
+	SCSI_MS_MODE_ALL = 0x3F,
246
 };
246
 };
247
 
247
 
248
 /**
248
 /**
289
 
289
 
290
 static inline uint8_t scsi_mode_sense_get_page_code(const uint8_t * cdb)
290
 static inline uint8_t scsi_mode_sense_get_page_code(const uint8_t * cdb)
291
 {
291
 {
292
-	return cdb[2] & 0x3f;
292
+	return cdb[2] & 0x3F;
293
 }
293
 }
294
 
294
 
295
 static inline uint8_t scsi_mode_sense_get_pc(const uint8_t * cdb)
295
 static inline uint8_t scsi_mode_sense_get_pc(const uint8_t * cdb)

+ 3
- 3
Marlin/src/HAL/HAL_DUE/usb/udc.c View File

527
 		if (!udd_is_high_speed()) {
527
 		if (!udd_is_high_speed()) {
528
 			break;
528
 			break;
529
 		}
529
 		}
530
-		if (udd_g_ctrlreq.req.wIndex & 0xff) {
530
+		if (udd_g_ctrlreq.req.wIndex & 0xFF) {
531
 			break;
531
 			break;
532
 		}
532
 		}
533
 		// Unconfigure the device, terminating all ongoing requests
533
 		// Unconfigure the device, terminating all ongoing requests
618
 	uint8_t str_length = 0;
618
 	uint8_t str_length = 0;
619
 
619
 
620
 	// Link payload pointer to the string corresponding at request
620
 	// Link payload pointer to the string corresponding at request
621
-	switch (udd_g_ctrlreq.req.wValue & 0xff) {
621
+	switch (udd_g_ctrlreq.req.wValue & 0xFF) {
622
 	case 0:
622
 	case 0:
623
 		udd_set_setup_payload((uint8_t *) &udc_string_desc_languageid,
623
 		udd_set_setup_payload((uint8_t *) &udc_string_desc_languageid,
624
 				sizeof(udc_string_desc_languageid));
624
 				sizeof(udc_string_desc_languageid));
674
 {
674
 {
675
 	uint8_t conf_num;
675
 	uint8_t conf_num;
676
 
676
 
677
-	conf_num = udd_g_ctrlreq.req.wValue & 0xff;
677
+	conf_num = udd_g_ctrlreq.req.wValue & 0xFF;
678
 
678
 
679
 	// Check descriptor ID
679
 	// Check descriptor ID
680
 	switch ((uint8_t) (udd_g_ctrlreq.req.wValue >> 8)) {
680
 	switch ((uint8_t) (udd_g_ctrlreq.req.wValue >> 8)) {

+ 1
- 1
Marlin/src/HAL/HAL_DUE/usb/usb_protocol.h View File

271
 /**
271
 /**
272
  * \brief Mask selecting the index part of an endpoint address
272
  * \brief Mask selecting the index part of an endpoint address
273
  */
273
  */
274
-#define  USB_EP_ADDR_MASK     0x0f
274
+#define  USB_EP_ADDR_MASK     0x0F
275
 
275
 
276
 //! \brief USB address identifier
276
 //! \brief USB address identifier
277
 typedef uint8_t usb_add_t;
277
 typedef uint8_t usb_add_t;

+ 1
- 1
Marlin/src/HAL/HAL_DUE/usb/usb_task.c View File

225
   uint8_t str_lgt = 0;
225
   uint8_t str_lgt = 0;
226
 
226
 
227
   // Link payload pointer to the string corresponding at request
227
   // Link payload pointer to the string corresponding at request
228
-  switch (udd_g_ctrlreq.req.wValue & 0xff) {
228
+  switch (udd_g_ctrlreq.req.wValue & 0xFF) {
229
   case UDI_CDC_IAD_STRING_ID:
229
   case UDI_CDC_IAD_STRING_ID:
230
     str_lgt = sizeof(udi_cdc_name) - 1;
230
     str_lgt = sizeof(udi_cdc_name) - 1;
231
     str = udi_cdc_name;
231
     str = udi_cdc_name;

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/HAL.cpp View File

247
     data = lowpass_filter[adc_channel].update(data);
247
     data = lowpass_filter[adc_channel].update(data);
248
   #endif
248
   #endif
249
 
249
 
250
-  return ((data >> 2) & 0x3ff);    // return 10bit value as Marlin expects
250
+  return ((data >> 2) & 0x3FF);    // return 10bit value as Marlin expects
251
 }
251
 }
252
 
252
 
253
 #define SBIT_CNTEN     0
253
 #define SBIT_CNTEN     0

+ 2
- 2
Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp View File

83
   }
83
   }
84
 
84
 
85
   uint8_t spiRec() {
85
   uint8_t spiRec() {
86
-    uint8_t b = spiTransfer(0xff);
86
+    uint8_t b = spiTransfer(0xFF);
87
     return b;
87
     return b;
88
   }
88
   }
89
 
89
 
90
   void spiRead(uint8_t*buf, uint16_t nbyte) {
90
   void spiRead(uint8_t*buf, uint16_t nbyte) {
91
     if (nbyte == 0) return;
91
     if (nbyte == 0) return;
92
     for (int i = 0; i < nbyte; i++) {
92
     for (int i = 0; i < nbyte; i++) {
93
-      buf[i] = spiTransfer(0xff);
93
+      buf[i] = spiTransfer(0xFF);
94
     }
94
     }
95
   }
95
   }
96
 
96
 

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp View File

213
   }
213
   }
214
 }
214
 }
215
 
215
 
216
-bool LPC1768_PWM_attach_pin(pin_t pin, uint32_t min /* = 1 */, uint32_t max /* = (LPC_PWM1_MR0 - 1) */, uint8_t servo_index /* = 0xff */) {
216
+bool LPC1768_PWM_attach_pin(pin_t pin, uint32_t min /* = 1 */, uint32_t max /* = (LPC_PWM1_MR0 - 1) */, uint8_t servo_index /* = 0xFF */) {
217
 
217
 
218
   pin = GET_PIN_MAP_PIN(GET_PIN_MAP_INDEX(pin & 0xFF));  // Sometimes the upper byte is garbled
218
   pin = GET_PIN_MAP_PIN(GET_PIN_MAP_INDEX(pin & 0xFF));  // Sometimes the upper byte is garbled
219
 
219
 

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp View File

79
 
79
 
80
   #include <U8glib.h>
80
   #include <U8glib.h>
81
 
81
 
82
-  #define I2C_SLA         (0x3c*2)
82
+  #define I2C_SLA         (0x3C*2)
83
   //#define I2C_CMD_MODE  0x080
83
   //#define I2C_CMD_MODE  0x080
84
   #define I2C_CMD_MODE    0x000
84
   #define I2C_CMD_MODE    0x000
85
   #define I2C_DATA_MODE   0x040
85
   #define I2C_DATA_MODE   0x040

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction View File

68
 //void digitalWrite(int16_t pin, uint8_t pin_status);
68
 //void digitalWrite(int16_t pin, uint8_t pin_status);
69
 
69
 
70
 
70
 
71
-  #define I2C_SLA         (0x3c*2)
71
+  #define I2C_SLA         (0x3C*2)
72
   //#define I2C_CMD_MODE  0x080
72
   //#define I2C_CMD_MODE  0x080
73
   #define I2C_CMD_MODE    0x000
73
   #define I2C_CMD_MODE    0x000
74
   #define I2C_DATA_MODE   0x040
74
   #define I2C_DATA_MODE   0x040

+ 3
- 3
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp View File

87
 
87
 
88
       if ( rs == 0 )
88
       if ( rs == 0 )
89
         /* command */
89
         /* command */
90
-        spiSend(0x0f8);
90
+        spiSend(0x0F8);
91
       else
91
       else
92
          /* data */
92
          /* data */
93
-        spiSend(0x0fa);
93
+        spiSend(0x0FA);
94
 
94
 
95
       for( i = 0; i < 4; i++ )   // give the controller some time to process the data
95
       for( i = 0; i < 4; i++ )   // give the controller some time to process the data
96
         u8g_10MicroDelay();      // 2 is bad, 3 is OK, 4 is safe
96
         u8g_10MicroDelay();      // 2 is bad, 3 is OK, 4 is safe
97
     }
97
     }
98
 
98
 
99
-    spiSend(val & 0x0f0);
99
+    spiSend(val & 0x0F0);
100
     spiSend(val << 4);
100
     spiSend(val << 4);
101
   }
101
   }
102
 
102
 

+ 3
- 3
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp View File

73
 
73
 
74
       if ( rs == 0 )
74
       if ( rs == 0 )
75
         /* command */
75
         /* command */
76
-        swSpiTransfer(0x0f8, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
76
+        swSpiTransfer(0x0F8, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
77
       else
77
       else
78
          /* data */
78
          /* data */
79
-         swSpiTransfer(0x0fa, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
79
+         swSpiTransfer(0x0FA, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
80
 
80
 
81
       for( i = 0; i < 4; i++ )   // give the controller some time to process the data
81
       for( i = 0; i < 4; i++ )   // give the controller some time to process the data
82
         u8g_10MicroDelay();      // 2 is bad, 3 is OK, 4 is safe
82
         u8g_10MicroDelay();      // 2 is bad, 3 is OK, 4 is safe
83
     }
83
     }
84
 
84
 
85
-    swSpiTransfer(val & 0x0f0, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
85
+    swSpiTransfer(val & 0x0F0, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
86
     swSpiTransfer(val << 4, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
86
     swSpiTransfer(val << 4, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
87
   }
87
   }
88
 
88
 

+ 2
- 2
Marlin/src/HAL/HAL_STM32F7/TMC2660.cpp View File

68
 //definitions for the chopper config register
68
 //definitions for the chopper config register
69
 #define CHOPPER_MODE_STANDARD 0x0ul
69
 #define CHOPPER_MODE_STANDARD 0x0ul
70
 #define CHOPPER_MODE_T_OFF_FAST_DECAY 0x4000ul
70
 #define CHOPPER_MODE_T_OFF_FAST_DECAY 0x4000ul
71
-#define T_OFF_PATTERN 0xful
71
+#define T_OFF_PATTERN 0xFul
72
 #define RANDOM_TOFF_TIME 0x2000ul
72
 #define RANDOM_TOFF_TIME 0x2000ul
73
 #define BLANK_TIMING_PATTERN 0x18000ul
73
 #define BLANK_TIMING_PATTERN 0x18000ul
74
 #define BLANK_TIMING_SHIFT 15
74
 #define BLANK_TIMING_SHIFT 15
85
 #define CURRENT_DOWN_STEP_SPEED_PATTERN 0x6000ul
85
 #define CURRENT_DOWN_STEP_SPEED_PATTERN 0x6000ul
86
 #define SE_MAX_PATTERN 0xF00ul
86
 #define SE_MAX_PATTERN 0xF00ul
87
 #define SE_CURRENT_STEP_WIDTH_PATTERN 0x60ul
87
 #define SE_CURRENT_STEP_WIDTH_PATTERN 0x60ul
88
-#define SE_MIN_PATTERN 0xful
88
+#define SE_MIN_PATTERN 0xFul
89
 
89
 
90
 //definitions for stall guard2 current register
90
 //definitions for stall guard2 current register
91
 #define STALL_GUARD_FILTER_ENABLED 0x10000ul
91
 #define STALL_GUARD_FILTER_ENABLED 0x10000ul

+ 1
- 1
Marlin/src/backtrace/unwarm.cpp View File

80
 // Detect if function names are available
80
 // Detect if function names are available
81
 static int __attribute__ ((noinline)) has_function_names(void) {
81
 static int __attribute__ ((noinline)) has_function_names(void) {
82
   uint32_t flag_word = ((uint32_t*)(((uint32_t)(&has_function_names)) & (-4))) [-1];
82
   uint32_t flag_word = ((uint32_t*)(((uint32_t)(&has_function_names)) & (-4))) [-1];
83
-  return ((flag_word & 0xff000000) == 0xff000000) ? 1 : 0;
83
+  return ((flag_word & 0xFF000000) == 0xFF000000) ? 1 : 0;
84
 }
84
 }
85
 
85
 
86
 /**
86
 /**

+ 1
- 1
Marlin/src/backtrace/unwarm.h View File

104
  *  Macros
104
  *  Macros
105
  **************************************************************************/
105
  **************************************************************************/
106
 
106
 
107
-#define M_IsOriginValid(v) (((v) & 0x7f) ? true : false)
107
+#define M_IsOriginValid(v) (((v) & 0x7F) ? true : false)
108
 #define M_Origin2Str(v)    ((v) ? "VALID" : "INVALID")
108
 #define M_Origin2Str(v)    ((v) ? "VALID" : "INVALID")
109
 
109
 
110
 #if defined(UNW_DEBUG)
110
 #if defined(UNW_DEBUG)

+ 57
- 57
Marlin/src/backtrace/unwarm_thumb.cpp View File

28
 static int32_t signExtend11(uint16_t value) {
28
 static int32_t signExtend11(uint16_t value) {
29
 
29
 
30
   if(value & 0x400) {
30
   if(value & 0x400) {
31
-    value |= 0xfffff800;
31
+    value |= 0xFFFFF800;
32
   }
32
   }
33
 
33
 
34
   return value;
34
   return value;
66
     /*
66
     /*
67
      * Detect 32bit thumb instructions
67
      * Detect 32bit thumb instructions
68
      */
68
      */
69
-    if ((instr & 0xe000) == 0xe000 && (instr & 0x1800) != 0) {
69
+    if ((instr & 0xE000) == 0xE000 && (instr & 0x1800) != 0) {
70
       uint16_t instr2;
70
       uint16_t instr2;
71
 
71
 
72
       /* Check next address */
72
       /* Check next address */
83
        * Load/Store multiple: Only interpret
83
        * Load/Store multiple: Only interpret
84
        *  PUSH and POP
84
        *  PUSH and POP
85
        */
85
        */
86
-      if ((instr & 0xfe6f) == 0xe82d) {
86
+      if ((instr & 0xFE6F) == 0xE82D) {
87
         bool     L     = (instr &  0x10) ? true : false;
87
         bool     L     = (instr &  0x10) ? true : false;
88
         uint16_t rList = instr2;
88
         uint16_t rList = instr2;
89
 
89
 
171
       /*
171
       /*
172
        * PUSH register
172
        * PUSH register
173
        */
173
        */
174
-      else if (instr == 0xf84d && (instr2 & 0x0fff) == 0x0d04) {
174
+      else if (instr == 0xF84D && (instr2 & 0x0FFF) == 0x0D04) {
175
         uint8_t r = instr2 >> 12;
175
         uint8_t r = instr2 >> 12;
176
 
176
 
177
         /* Store to memory: PUSH */
177
         /* Store to memory: PUSH */
187
       /*
187
       /*
188
        * POP register
188
        * POP register
189
        */
189
        */
190
-      else if (instr == 0xf85d && (instr2 & 0x0fff) == 0x0b04) {
190
+      else if (instr == 0xF85D && (instr2 & 0x0FFF) == 0x0B04) {
191
         uint8_t r = instr2 >> 12;
191
         uint8_t r = instr2 >> 12;
192
 
192
 
193
         /* Load from memory: POP */
193
         /* Load from memory: POP */
246
       /*
246
       /*
247
        * TBB / TBH
247
        * TBB / TBH
248
        */
248
        */
249
-      else if ((instr & 0xfff0) == 0xe8d0 && (instr2 & 0xffe0) == 0xf000) {
249
+      else if ((instr & 0xFFF0) == 0xE8D0 && (instr2 & 0xFFE0) == 0xF000) {
250
         /* We are only interested in
250
         /* We are only interested in
251
          * the forms
251
          * the forms
252
          *  TBB [PC, ...]
252
          *  TBB [PC, ...]
254
          * as those are used by the C compiler to implement
254
          * as those are used by the C compiler to implement
255
          * the switch clauses
255
          * the switch clauses
256
          */
256
          */
257
-        uint8_t rn = instr & 0xf;
258
-        uint8_t rm = instr2 & 0xf;
257
+        uint8_t rn = instr & 0xF;
258
+        uint8_t rm = instr2 & 0xF;
259
         bool H = (instr2 & 0x10) ? true : false;
259
         bool H = (instr2 & 0x10) ? true : false;
260
 
260
 
261
         UnwPrintd5("TB%c [r%d,r%d%s]\n", H ? 'H' : 'B', rn, rm, H ? ",LSL #1" : "");
261
         UnwPrintd5("TB%c [r%d,r%d%s]\n", H ? 'H' : 'B', rn, rm, H ? ",LSL #1" : "");
280
       /*
280
       /*
281
        * Unconditional branch
281
        * Unconditional branch
282
        */
282
        */
283
-      else if ((instr & 0xf800) == 0xf000 && (instr2 & 0xd000) == 0x9000) {
283
+      else if ((instr & 0xF800) == 0xF000 && (instr2 & 0xD000) == 0x9000) {
284
         uint32_t v;
284
         uint32_t v;
285
 
285
 
286
         uint8_t      S = (instr & 0x400) >> 10;
286
         uint8_t      S = (instr & 0x400) >> 10;
287
-        uint16_t imm10 = (instr & 0x3ff);
287
+        uint16_t imm10 = (instr & 0x3FF);
288
         uint8_t     J1 = (instr2 & 0x2000) >> 13;
288
         uint8_t     J1 = (instr2 & 0x2000) >> 13;
289
         uint8_t     J2 = (instr2 & 0x0800) >> 11;
289
         uint8_t     J2 = (instr2 & 0x0800) >> 11;
290
-        uint16_t imm11 = (instr2 & 0x7ff);
290
+        uint16_t imm11 = (instr2 & 0x7FF);
291
 
291
 
292
         uint8_t I1 = J1 ^ S ^ 1;
292
         uint8_t I1 = J1 ^ S ^ 1;
293
         uint8_t I2 = J2 ^ S ^ 1;
293
         uint8_t I2 = J2 ^ S ^ 1;
294
         uint32_t imm32 = (S << 24) | (I1 << 23) | (I2 << 22) |(imm10 << 12) | (imm11 << 1);
294
         uint32_t imm32 = (S << 24) | (I1 << 23) | (I2 << 22) |(imm10 << 12) | (imm11 << 1);
295
-        if (S) imm32 |= 0xfe000000;
295
+        if (S) imm32 |= 0xFE000000;
296
 
296
 
297
         UnwPrintd2("B %d \n", imm32);
297
         UnwPrintd2("B %d \n", imm32);
298
 
298
 
321
       /*
321
       /*
322
        * Branch with link
322
        * Branch with link
323
        */
323
        */
324
-      else if ((instr & 0xf800) == 0xf000 && (instr2 & 0xd000) == 0xd000) {
324
+      else if ((instr & 0xF800) == 0xF000 && (instr2 & 0xD000) == 0xD000) {
325
 
325
 
326
         uint8_t      S = (instr & 0x400) >> 10;
326
         uint8_t      S = (instr & 0x400) >> 10;
327
-        uint16_t imm10 = (instr & 0x3ff);
327
+        uint16_t imm10 = (instr & 0x3FF);
328
         uint8_t     J1 = (instr2 & 0x2000) >> 13;
328
         uint8_t     J1 = (instr2 & 0x2000) >> 13;
329
         uint8_t     J2 = (instr2 & 0x0800) >> 11;
329
         uint8_t     J2 = (instr2 & 0x0800) >> 11;
330
-        uint16_t imm11 = (instr2 & 0x7ff);
330
+        uint16_t imm11 = (instr2 & 0x7FF);
331
 
331
 
332
         uint8_t I1 = J1 ^ S ^ 1;
332
         uint8_t I1 = J1 ^ S ^ 1;
333
         uint8_t I2 = J2 ^ S ^ 1;
333
         uint8_t I2 = J2 ^ S ^ 1;
334
         uint32_t imm32 = (S << 24) | (I1 << 23) | (I2 << 22) |(imm10 << 12) | (imm11 << 1);
334
         uint32_t imm32 = (S << 24) | (I1 << 23) | (I2 << 22) |(imm10 << 12) | (imm11 << 1);
335
-        if (S) imm32 |= 0xfe000000;
335
+        if (S) imm32 |= 0xFE000000;
336
 
336
 
337
         UnwPrintd2("BL %d \n", imm32);
337
         UnwPrintd2("BL %d \n", imm32);
338
 
338
 
377
       /*
377
       /*
378
        * Conditional branches. Usually not taken, unless infinite loop is detected
378
        * Conditional branches. Usually not taken, unless infinite loop is detected
379
        */
379
        */
380
-      else if ((instr & 0xf800) == 0xf000 && (instr2 & 0xd000) == 0x8000) {
380
+      else if ((instr & 0xF800) == 0xF000 && (instr2 & 0xD000) == 0x8000) {
381
 
381
 
382
         uint8_t      S = (instr & 0x400) >> 10;
382
         uint8_t      S = (instr & 0x400) >> 10;
383
-        uint16_t  imm6 = (instr &  0x3f);
383
+        uint16_t  imm6 = (instr &  0x3F);
384
         uint8_t     J1 = (instr2 & 0x2000) >> 13;
384
         uint8_t     J1 = (instr2 & 0x2000) >> 13;
385
         uint8_t     J2 = (instr2 & 0x0800) >> 11;
385
         uint8_t     J2 = (instr2 & 0x0800) >> 11;
386
-        uint16_t imm11 = (instr2 & 0x7ff);
386
+        uint16_t imm11 = (instr2 & 0x7FF);
387
 
387
 
388
         uint8_t I1 = J1 ^ S ^ 1;
388
         uint8_t I1 = J1 ^ S ^ 1;
389
         uint8_t I2 = J2 ^ S ^ 1;
389
         uint8_t I2 = J2 ^ S ^ 1;
390
         uint32_t imm32 = (S << 20) | (I1 << 19) | (I2 << 18) |(imm6 << 12) | (imm11 << 1);
390
         uint32_t imm32 = (S << 20) | (I1 << 19) | (I2 << 18) |(imm6 << 12) | (imm11 << 1);
391
-        if (S) imm32 |= 0xffe00000;
391
+        if (S) imm32 |= 0xFFE00000;
392
 
392
 
393
         UnwPrintd2("Bcond %d\n", imm32);
393
         UnwPrintd2("Bcond %d\n", imm32);
394
 
394
 
412
        * PC-relative load
412
        * PC-relative load
413
        *  LDR Rd,[PC, #+/-imm]
413
        *  LDR Rd,[PC, #+/-imm]
414
        */
414
        */
415
-      else if((instr & 0xff7f) == 0xf85f) {
416
-        uint8_t  rt    = (instr2 & 0xf000) >> 12;
417
-        uint8_t  imm12 = (instr2 & 0x0fff);
415
+      else if((instr & 0xFF7F) == 0xF85F) {
416
+        uint8_t  rt    = (instr2 & 0xF000) >> 12;
417
+        uint8_t  imm12 = (instr2 & 0x0FFF);
418
         bool     A     = (instr  & 0x80) ? true : false;
418
         bool     A     = (instr  & 0x80) ? true : false;
419
         uint32_t address;
419
         uint32_t address;
420
 
420
 
434
        *  We are only interested when destination is PC.
434
        *  We are only interested when destination is PC.
435
        *  LDR Rt,[Rn , #n]
435
        *  LDR Rt,[Rn , #n]
436
        */
436
        */
437
-      else if ((instr & 0xfff0) == 0xf8d0) {
438
-        uint8_t     rn = (instr  & 0xf);
439
-        uint8_t     rt = (instr2 & 0xf000) >> 12;
440
-        uint16_t imm12 = (instr2 & 0xfff);
437
+      else if ((instr & 0xFFF0) == 0xF8D0) {
438
+        uint8_t     rn = (instr  & 0xF);
439
+        uint8_t     rt = (instr2 & 0xF000) >> 12;
440
+        uint16_t imm12 = (instr2 & 0xFFF);
441
 
441
 
442
         /* If destination is PC and we don't know the source value, then fail */
442
         /* If destination is PC and we don't know the source value, then fail */
443
         if (!M_IsOriginValid(state->regData[rn].o)) {
443
         if (!M_IsOriginValid(state->regData[rn].o)) {
456
        *  LDR Rt,[Rn], #+/-n]
456
        *  LDR Rt,[Rn], #+/-n]
457
        *  LDR Rt,[Rn, #+/-n]!
457
        *  LDR Rt,[Rn, #+/-n]!
458
        */
458
        */
459
-      else if ((instr & 0xfff0) == 0xf850 && (instr2 & 0x0800) == 0x0800) {
460
-        uint8_t     rn = (instr  & 0xf);
461
-        uint8_t     rt = (instr2 & 0xf000) >> 12;
462
-        uint16_t  imm8 = (instr2 & 0xff);
459
+      else if ((instr & 0xFFF0) == 0xF850 && (instr2 & 0x0800) == 0x0800) {
460
+        uint8_t     rn = (instr  & 0xF);
461
+        uint8_t     rt = (instr2 & 0xF000) >> 12;
462
+        uint16_t  imm8 = (instr2 & 0xFF);
463
         bool         P = (instr2 & 0x400) ? true : false;
463
         bool         P = (instr2 & 0x400) ? true : false;
464
         bool         U = (instr2 & 0x200) ? true : false;
464
         bool         U = (instr2 & 0x200) ? true : false;
465
         bool         W = (instr2 & 0x100) ? true : false;
465
         bool         W = (instr2 & 0x100) ? true : false;
493
        *   ldr  Rt, [Rn, Rm, lsl #x]
493
        *   ldr  Rt, [Rn, Rm, lsl #x]
494
        *  Where Rt is PC, Rn value is known, Rm is not known or unknown
494
        *  Where Rt is PC, Rn value is known, Rm is not known or unknown
495
        */
495
        */
496
-      else if ((instr & 0xfff0) == 0xf850 && (instr2 & 0x0fc0) == 0x0000) {
497
-        uint8_t   rn = (instr  & 0xf);
498
-        uint8_t   rt = (instr2 & 0xf000) >> 12;
499
-        uint8_t   rm = (instr2 & 0xf);
496
+      else if ((instr & 0xFFF0) == 0xF850 && (instr2 & 0x0FC0) == 0x0000) {
497
+        uint8_t   rn = (instr  & 0xF);
498
+        uint8_t   rt = (instr2 & 0xF000) >> 12;
499
+        uint8_t   rm = (instr2 & 0xF);
500
         uint8_t imm2 = (instr2 & 0x30) >> 4;
500
         uint8_t imm2 = (instr2 & 0x30) >> 4;
501
 
501
 
502
         if (!M_IsOriginValid(state->regData[rn].o) ||
502
         if (!M_IsOriginValid(state->regData[rn].o) ||
534
      *  LSR Rd, Rs, #Offset5
534
      *  LSR Rd, Rs, #Offset5
535
      *  ASR Rd, Rs, #Offset5
535
      *  ASR Rd, Rs, #Offset5
536
      */
536
      */
537
-    else if((instr & 0xe000) == 0x0000 && (instr & 0x1800) != 0x1800) {
537
+    else if((instr & 0xE000) == 0x0000 && (instr & 0x1800) != 0x1800) {
538
       bool signExtend;
538
       bool signExtend;
539
       uint8_t op      = (instr & 0x1800) >> 11;
539
       uint8_t op      = (instr & 0x1800) >> 11;
540
-      uint8_t offset5 = (instr & 0x07c0) >>  6;
540
+      uint8_t offset5 = (instr & 0x07C0) >>  6;
541
       uint8_t rs      = (instr & 0x0038) >>  3;
541
       uint8_t rs      = (instr & 0x0038) >>  3;
542
       uint8_t rd      = (instr & 0x0007);
542
       uint8_t rd      = (instr & 0x0007);
543
 
543
 
562
           signExtend = (state->regData[rs].v & 0x8000) ? true : false;
562
           signExtend = (state->regData[rs].v & 0x8000) ? true : false;
563
           state->regData[rd].v = state->regData[rs].v >> offset5;
563
           state->regData[rd].v = state->regData[rs].v >> offset5;
564
           if(signExtend) {
564
           if(signExtend) {
565
-            state->regData[rd].v |= 0xffffffff << (32 - offset5);
565
+            state->regData[rd].v |= 0xFFFFFFFF << (32 - offset5);
566
           }
566
           }
567
           state->regData[rd].o = state->regData[rs].o;
567
           state->regData[rd].o = state->regData[rs].o;
568
           state->regData[rd].o |= REG_VAL_ARITHMETIC;
568
           state->regData[rd].o |= REG_VAL_ARITHMETIC;
575
      *  SUB Rd, Rs, Rn
575
      *  SUB Rd, Rs, Rn
576
      *  SUB Rd, Rs, #Offset3
576
      *  SUB Rd, Rs, #Offset3
577
      */
577
      */
578
-    else if((instr & 0xf800) == 0x1800) {
578
+    else if((instr & 0xF800) == 0x1800) {
579
       bool    I  = (instr & 0x0400) ? true : false;
579
       bool    I  = (instr & 0x0400) ? true : false;
580
       bool    op = (instr & 0x0200) ? true : false;
580
       bool    op = (instr & 0x0200) ? true : false;
581
-      uint8_t rn = (instr & 0x01c0) >> 6;
581
+      uint8_t rn = (instr & 0x01C0) >> 6;
582
       uint8_t rs = (instr & 0x0038) >> 3;
582
       uint8_t rs = (instr & 0x0038) >> 3;
583
       uint8_t rd = (instr & 0x0007);
583
       uint8_t rd = (instr & 0x0007);
584
 
584
 
627
      *  ADD Rd, #Offset8
627
      *  ADD Rd, #Offset8
628
      *  SUB Rd, #Offset8
628
      *  SUB Rd, #Offset8
629
      */
629
      */
630
-    else if((instr & 0xe000) == 0x2000) {
630
+    else if((instr & 0xE000) == 0x2000) {
631
 
631
 
632
       uint8_t op      = (instr & 0x1800) >> 11;
632
       uint8_t op      = (instr & 0x1800) >> 11;
633
       uint8_t rd      = (instr & 0x0700) >>  8;
633
       uint8_t rd      = (instr & 0x0700) >>  8;
634
-      uint8_t offset8 = (instr & 0x00ff);
634
+      uint8_t offset8 = (instr & 0x00FF);
635
 
635
 
636
       switch(op) {
636
       switch(op) {
637
         case 0: /* MOV */
637
         case 0: /* MOV */
676
      *  BIC Rd, Rs
676
      *  BIC Rd, Rs
677
      *  MVN Rd, Rs
677
      *  MVN Rd, Rs
678
      */
678
      */
679
-    else if((instr & 0xfc00) == 0x4000) {
680
-      uint8_t op = (instr & 0x03c0) >> 6;
679
+    else if((instr & 0xFC00) == 0x4000) {
680
+      uint8_t op = (instr & 0x03C0) >> 6;
681
       uint8_t rs = (instr & 0x0038) >> 3;
681
       uint8_t rs = (instr & 0x0038) >> 3;
682
       uint8_t rd = (instr & 0x0007);
682
       uint8_t rd = (instr & 0x0007);
683
 
683
 
741
         case 4: /* ASR */
741
         case 4: /* ASR */
742
           if(state->regData[rd].v & 0x80000000) {
742
           if(state->regData[rd].v & 0x80000000) {
743
             state->regData[rd].v >>= state->regData[rs].v;
743
             state->regData[rd].v >>= state->regData[rs].v;
744
-            state->regData[rd].v |= 0xffffffff << (32 - state->regData[rs].v);
744
+            state->regData[rd].v |= 0xFFFFFFFF << (32 - state->regData[rs].v);
745
           }
745
           }
746
           else {
746
           else {
747
             state->regData[rd].v >>= state->regData[rs].v;
747
             state->regData[rd].v >>= state->regData[rs].v;
826
      *  CMP Hd, Rs
826
      *  CMP Hd, Rs
827
      *  MOV Hd, Hs
827
      *  MOV Hd, Hs
828
      */
828
      */
829
-    else if((instr & 0xfc00) == 0x4400) {
829
+    else if((instr & 0xFC00) == 0x4400) {
830
       uint8_t op  = (instr & 0x0300) >> 8;
830
       uint8_t op  = (instr & 0x0300) >> 8;
831
       bool    h1  = (instr & 0x0080) ? true: false;
831
       bool    h1  = (instr & 0x0080) ? true: false;
832
       bool    h2  = (instr & 0x0040) ? true: false;
832
       bool    h2  = (instr & 0x0040) ? true: false;
894
     /* Format 9: PC-relative load
894
     /* Format 9: PC-relative load
895
      *  LDR Rd,[PC, #imm]
895
      *  LDR Rd,[PC, #imm]
896
      */
896
      */
897
-    else if((instr & 0xf800) == 0x4800) {
897
+    else if((instr & 0xF800) == 0x4800) {
898
       uint8_t  rd    = (instr & 0x0700) >> 8;
898
       uint8_t  rd    = (instr & 0x0700) >> 8;
899
-      uint8_t  word8 = (instr & 0x00ff);
899
+      uint8_t  word8 = (instr & 0x00FF);
900
       uint32_t address;
900
       uint32_t address;
901
 
901
 
902
       /* Compute load address, adding a word to account for prefetch */
902
       /* Compute load address, adding a word to account for prefetch */
912
      *  ADD sp,#+imm
912
      *  ADD sp,#+imm
913
      *  ADD sp,#-imm
913
      *  ADD sp,#-imm
914
      */
914
      */
915
-    else if((instr & 0xff00) == 0xB000) {
916
-      uint8_t value = (instr & 0x7f) * 4;
915
+    else if((instr & 0xFF00) == 0xB000) {
916
+      uint8_t value = (instr & 0x7F) * 4;
917
 
917
 
918
       /* Check the negative bit */
918
       /* Check the negative bit */
919
       if((instr & 0x80) != 0) {
919
       if((instr & 0x80) != 0) {
931
      *  POP {Rlist}
931
      *  POP {Rlist}
932
      *  POP {Rlist, PC}
932
      *  POP {Rlist, PC}
933
      */
933
      */
934
-    else if((instr & 0xf600) == 0xb400) {
934
+    else if((instr & 0xF600) == 0xB400) {
935
       bool    L     = (instr & 0x0800) ? true : false;
935
       bool    L     = (instr & 0x0800) ? true : false;
936
       bool    R     = (instr & 0x0100) ? true : false;
936
       bool    R     = (instr & 0x0100) ? true : false;
937
-      uint8_t rList = (instr & 0x00ff);
937
+      uint8_t rList = (instr & 0x00FF);
938
 
938
 
939
       if(L) {
939
       if(L) {
940
         uint8_t r;
940
         uint8_t r;
1038
      * Conditional branches
1038
      * Conditional branches
1039
      * Bcond
1039
      * Bcond
1040
      */
1040
      */
1041
-    else if((instr & 0xf000) == 0xd000) {
1042
-      int32_t branchValue = (instr & 0xff);
1043
-      if (branchValue & 0x80) branchValue |= 0xffffff00;
1041
+    else if((instr & 0xF000) == 0xD000) {
1042
+      int32_t branchValue = (instr & 0xFF);
1043
+      if (branchValue & 0x80) branchValue |= 0xFFFFFF00;
1044
 
1044
 
1045
       /* Branch distance is twice that specified in the instruction. */
1045
       /* Branch distance is twice that specified in the instruction. */
1046
       branchValue *= 2;
1046
       branchValue *= 2;
1067
     /* Format 18: unconditional branch
1067
     /* Format 18: unconditional branch
1068
      *  B label
1068
      *  B label
1069
      */
1069
      */
1070
-    else if((instr & 0xf800) == 0xe000) {
1070
+    else if((instr & 0xF800) == 0xE000) {
1071
       uint32_t v;
1071
       uint32_t v;
1072
-      int32_t branchValue = signExtend11(instr & 0x07ff);
1072
+      int32_t branchValue = signExtend11(instr & 0x07FF);
1073
 
1073
 
1074
       /* Branch distance is twice that specified in the instruction. */
1074
       /* Branch distance is twice that specified in the instruction. */
1075
       branchValue *= 2;
1075
       branchValue *= 2;

+ 36
- 36
Marlin/src/backtrace/unwarmbytab.cpp View File

29
 
29
 
30
 static inline __attribute__((always_inline)) uint32_t prel31_to_addr(const uint32_t *prel31) {
30
 static inline __attribute__((always_inline)) uint32_t prel31_to_addr(const uint32_t *prel31) {
31
   uint32_t offset = (((uint32_t)(*prel31)) << 1) >> 1;
31
   uint32_t offset = (((uint32_t)(*prel31)) << 1) >> 1;
32
-  return ((uint32_t)prel31 + offset) & 0x7fffffff;
32
+  return ((uint32_t)prel31 + offset) & 0x7FFFFFFF;
33
 }
33
 }
34
 
34
 
35
 static const UnwTabEntry *UnwTabSearchIndex(const UnwTabEntry *start, const UnwTabEntry *end, uint32_t ip) {
35
 static const UnwTabEntry *UnwTabSearchIndex(const UnwTabEntry *start, const UnwTabEntry *end, uint32_t ip) {
54
   if (!cb->readW(address-4,&flag_word))
54
   if (!cb->readW(address-4,&flag_word))
55
     return NULL;
55
     return NULL;
56
 
56
 
57
-  if ((flag_word & 0xff000000) == 0xff000000) {
58
-    return (const char *)(address - 4 - (flag_word & 0x00ffffff));
57
+  if ((flag_word & 0xFF000000) == 0xFF000000) {
58
+    return (const char *)(address - 4 - (flag_word & 0x00FFFFFF));
59
   }
59
   }
60
   return NULL;
60
   return NULL;
61
 }
61
 }
77
   uint32_t v = 0;
77
   uint32_t v = 0;
78
   if (!cb->readW(ucb->current, &v))
78
   if (!cb->readW(ucb->current, &v))
79
     return -1;
79
     return -1;
80
-  instruction = (v >> (ucb->byte << 3)) & 0xff;
80
+  instruction = (v >> (ucb->byte << 3)) & 0xFF;
81
 
81
 
82
   /* Move the next byte */
82
   /* Move the next byte */
83
   --ucb->byte;
83
   --ucb->byte;
104
   if (!cb->readW(instructions, &v))
104
   if (!cb->readW(instructions, &v))
105
     return UNWIND_DREAD_W_FAIL;
105
     return UNWIND_DREAD_W_FAIL;
106
 
106
 
107
-  if ((v & 0xff000000) == 0x80000000) {
107
+  if ((v & 0xFF000000) == 0x80000000) {
108
     ucb->remaining = 3;
108
     ucb->remaining = 3;
109
     ucb->byte = 2;
109
     ucb->byte = 2;
110
   /* Is a long unwind description */
110
   /* Is a long unwind description */
111
-  } else if ((v & 0xff000000) == 0x81000000) {
112
-    ucb->remaining = ((v & 0x00ff0000) >> 14) + 2;
111
+  } else if ((v & 0xFF000000) == 0x81000000) {
112
+    ucb->remaining = ((v & 0x00FF0000) >> 14) + 2;
113
     ucb->byte = 1;
113
     ucb->byte = 1;
114
   } else
114
   } else
115
     return UNWIND_UNSUPPORTED_DWARF_PERSONALITY;
115
     return UNWIND_UNSUPPORTED_DWARF_PERSONALITY;
138
   /* Consume all instruction byte */
138
   /* Consume all instruction byte */
139
   while ((instruction = UnwTabGetNextInstruction(cb, ucb)) != -1) {
139
   while ((instruction = UnwTabGetNextInstruction(cb, ucb)) != -1) {
140
 
140
 
141
-    if ((instruction & 0xc0) == 0x00) { // ARM_EXIDX_CMD_DATA_POP
141
+    if ((instruction & 0xC0) == 0x00) { // ARM_EXIDX_CMD_DATA_POP
142
       /* vsp = vsp + (xxxxxx << 2) + 4 */
142
       /* vsp = vsp + (xxxxxx << 2) + 4 */
143
-      ucb->vrs[13] += ((instruction & 0x3f) << 2) + 4;
143
+      ucb->vrs[13] += ((instruction & 0x3F) << 2) + 4;
144
     } else
144
     } else
145
-    if ((instruction & 0xc0) == 0x40) { // ARM_EXIDX_CMD_DATA_PUSH
145
+    if ((instruction & 0xC0) == 0x40) { // ARM_EXIDX_CMD_DATA_PUSH
146
       /* vsp = vsp - (xxxxxx << 2) - 4 */
146
       /* vsp = vsp - (xxxxxx << 2) - 4 */
147
-      ucb->vrs[13] -= ((instruction & 0x3f) << 2) - 4;
147
+      ucb->vrs[13] -= ((instruction & 0x3F) << 2) - 4;
148
     } else
148
     } else
149
-    if ((instruction & 0xf0) == 0x80) {
149
+    if ((instruction & 0xF0) == 0x80) {
150
       /* pop under mask {r15-r12},{r11-r4} or refuse to unwind */
150
       /* pop under mask {r15-r12},{r11-r4} or refuse to unwind */
151
       instruction = instruction << 8 | UnwTabGetNextInstruction(cb, ucb);
151
       instruction = instruction << 8 | UnwTabGetNextInstruction(cb, ucb);
152
 
152
 
156
 
156
 
157
       /* Pop registers using mask */    // ARM_EXIDX_CMD_REG_POP
157
       /* Pop registers using mask */    // ARM_EXIDX_CMD_REG_POP
158
       vsp = ucb->vrs[13];
158
       vsp = ucb->vrs[13];
159
-      mask = instruction & 0xfff;
159
+      mask = instruction & 0xFFF;
160
 
160
 
161
       reg = 4;
161
       reg = 4;
162
       while (mask) {
162
       while (mask) {
176
         ucb->vrs[13] = vsp;
176
         ucb->vrs[13] = vsp;
177
 
177
 
178
     } else
178
     } else
179
-    if ((instruction & 0xf0) == 0x90 && // ARM_EXIDX_CMD_REG_TO_SP
180
-        instruction != 0x9d &&
181
-        instruction != 0x9f) {
179
+    if ((instruction & 0xF0) == 0x90 && // ARM_EXIDX_CMD_REG_TO_SP
180
+        instruction != 0x9D &&
181
+        instruction != 0x9F) {
182
       /* vsp = r[nnnn] */
182
       /* vsp = r[nnnn] */
183
-      ucb->vrs[13] = ucb->vrs[instruction & 0x0f];
183
+      ucb->vrs[13] = ucb->vrs[instruction & 0x0F];
184
     } else
184
     } else
185
-    if ((instruction & 0xf0) == 0xa0) { // ARM_EXIDX_CMD_REG_POP
185
+    if ((instruction & 0xF0) == 0xA0) { // ARM_EXIDX_CMD_REG_POP
186
       /* pop r4-r[4+nnn] or pop r4-r[4+nnn], r14*/
186
       /* pop r4-r[4+nnn] or pop r4-r[4+nnn], r14*/
187
       vsp = ucb->vrs[13];
187
       vsp = ucb->vrs[13];
188
 
188
 
206
       ucb->vrs[13] = vsp;
206
       ucb->vrs[13] = vsp;
207
 
207
 
208
     } else
208
     } else
209
-    if (instruction == 0xb0) { // ARM_EXIDX_CMD_FINISH
209
+    if (instruction == 0xB0) { // ARM_EXIDX_CMD_FINISH
210
       /* finished */
210
       /* finished */
211
       if (ucb->vrs[15] == 0)
211
       if (ucb->vrs[15] == 0)
212
         ucb->vrs[15] = ucb->vrs[14];
212
         ucb->vrs[15] = ucb->vrs[14];
215
       return UNWIND_SUCCESS;
215
       return UNWIND_SUCCESS;
216
 
216
 
217
     } else
217
     } else
218
-    if (instruction == 0xb1) { // ARM_EXIDX_CMD_REG_POP
218
+    if (instruction == 0xB1) { // ARM_EXIDX_CMD_REG_POP
219
       /* pop register under mask {r3,r2,r1,r0} */
219
       /* pop register under mask {r3,r2,r1,r0} */
220
       vsp = ucb->vrs[13];
220
       vsp = ucb->vrs[13];
221
       mask = UnwTabGetNextInstruction(cb, ucb);
221
       mask = UnwTabGetNextInstruction(cb, ucb);
236
       ucb->vrs[13] = (uint32_t)vsp;
236
       ucb->vrs[13] = (uint32_t)vsp;
237
 
237
 
238
     } else
238
     } else
239
-    if (instruction == 0xb2) { // ARM_EXIDX_CMD_DATA_POP
239
+    if (instruction == 0xB2) { // ARM_EXIDX_CMD_DATA_POP
240
       /* vps = vsp + 0x204 + (uleb128 << 2) */
240
       /* vps = vsp + 0x204 + (uleb128 << 2) */
241
       ucb->vrs[13] += 0x204 + (UnwTabGetNextInstruction(cb, ucb) << 2);
241
       ucb->vrs[13] += 0x204 + (UnwTabGetNextInstruction(cb, ucb) << 2);
242
 
242
 
243
     } else
243
     } else
244
-    if (instruction == 0xb3 || // ARM_EXIDX_CMD_VFP_POP
245
-      instruction == 0xc8 ||
246
-      instruction == 0xc9) {
244
+    if (instruction == 0xB3 || // ARM_EXIDX_CMD_VFP_POP
245
+      instruction == 0xC8 ||
246
+      instruction == 0xC9) {
247
 
247
 
248
       /* pop VFP double-precision registers */
248
       /* pop VFP double-precision registers */
249
       vsp = ucb->vrs[13];
249
       vsp = ucb->vrs[13];
256
       ucb->vrs[14] = v;
256
       ucb->vrs[14] = v;
257
       vsp += 4;
257
       vsp += 4;
258
 
258
 
259
-      if (instruction == 0xc8) {
259
+      if (instruction == 0xC8) {
260
         /* D[16+sssss]-D[16+ssss+cccc] */
260
         /* D[16+sssss]-D[16+ssss+cccc] */
261
         ucb->vrs[14] |= 1 << 16;
261
         ucb->vrs[14] |= 1 << 16;
262
       }
262
       }
263
 
263
 
264
-      if (instruction != 0xb3) {
264
+      if (instruction != 0xB3) {
265
         /* D[sssss]-D[ssss+cccc] */
265
         /* D[sssss]-D[ssss+cccc] */
266
         ucb->vrs[14] |= 1 << 17;
266
         ucb->vrs[14] |= 1 << 17;
267
       }
267
       }
269
       ucb->vrs[13] = vsp;
269
       ucb->vrs[13] = vsp;
270
 
270
 
271
     } else
271
     } else
272
-    if ((instruction & 0xf8) == 0xb8 ||
273
-        (instruction & 0xf8) == 0xd0) {
272
+    if ((instruction & 0xF8) == 0xB8 ||
273
+        (instruction & 0xF8) == 0xD0) {
274
 
274
 
275
       /* Pop VFP double precision registers D[8]-D[8+nnn] */
275
       /* Pop VFP double precision registers D[8]-D[8+nnn] */
276
       ucb->vrs[14] = 0x80 | (instruction & 0x07);
276
       ucb->vrs[14] = 0x80 | (instruction & 0x07);
277
 
277
 
278
-      if ((instruction & 0xf8) == 0xd0) {
278
+      if ((instruction & 0xF8) == 0xD0) {
279
         ucb->vrs[14] = 1 << 17;
279
         ucb->vrs[14] = 1 << 17;
280
       }
280
       }
281
 
281
 
337
 
337
 
338
   /* Check for exception return */
338
   /* Check for exception return */
339
   /* TODO Test with other ARM processors to verify this method. */
339
   /* TODO Test with other ARM processors to verify this method. */
340
-  if ((ucb.vrs[15] & 0xf0000000) == 0xf0000000) {
340
+  if ((ucb.vrs[15] & 0xF0000000) == 0xF0000000) {
341
     /* According to the Cortex Programming Manual (p.44), the stack address is always 8-byte aligned (Cortex-M7).
341
     /* According to the Cortex Programming Manual (p.44), the stack address is always 8-byte aligned (Cortex-M7).
342
        Depending on where the exception came from (MSP or PSP), we need the right SP value to work with.
342
        Depending on where the exception came from (MSP or PSP), we need the right SP value to work with.
343
 
343
 
354
        If we need to start from the PSP, we need to go up exactly 6 words to find the PC.
354
        If we need to start from the PSP, we need to go up exactly 6 words to find the PC.
355
        See the ARMv7-M Architecture Reference Manual p.594 and Cortex-M7 Processor Programming Manual p.44/p.45 for details.
355
        See the ARMv7-M Architecture Reference Manual p.594 and Cortex-M7 Processor Programming Manual p.44/p.45 for details.
356
     */
356
     */
357
-    if ((ucb.vrs[15] & 0xc) == 0) {
358
-      /* Return to Handler Mode: MSP (0xffffff-1) */
357
+    if ((ucb.vrs[15] & 0xC) == 0) {
358
+      /* Return to Handler Mode: MSP (0xFFFFFF-1) */
359
       stack = ucb.vrs[13];
359
       stack = ucb.vrs[13];
360
 
360
 
361
       /* The PC is always 2 words down from the MSP, if it was a non-floating-point exception */
361
       /* The PC is always 2 words down from the MSP, if it was a non-floating-point exception */
362
       stack -= 2*4;
362
       stack -= 2*4;
363
 
363
 
364
-      /* If there was a VFP exception (0xffffffe1), the PC is located another 18 words down */
365
-      if ((ucb.vrs[15] & 0xf0) == 0xe0) {
364
+      /* If there was a VFP exception (0xFFFFFFE1), the PC is located another 18 words down */
365
+      if ((ucb.vrs[15] & 0xF0) == 0xE0) {
366
         stack -= 18*4;
366
         stack -= 18*4;
367
       }
367
       }
368
     }
368
     }
369
     else {
369
     else {
370
-      /* Return to Thread Mode: PSP (0xffffff-d) */
370
+      /* Return to Thread Mode: PSP (0xFFFFFF-d) */
371
       stack = read_psp();
371
       stack = read_psp();
372
 
372
 
373
       /* The PC is always 6 words up from the PSP */
373
       /* The PC is always 6 words up from the PSP */
423
     const UnwTabEntry *index = UnwTabSearchIndex(__exidx_start, __exidx_end, frame->pc);
423
     const UnwTabEntry *index = UnwTabSearchIndex(__exidx_start, __exidx_end, frame->pc);
424
 
424
 
425
     /* Clear last bit (Thumb indicator) */
425
     /* Clear last bit (Thumb indicator) */
426
-    frame->pc &= 0xfffffffeU;
426
+    frame->pc &= 0xFFFFFFFEU;
427
 
427
 
428
     /* Generate the backtrace information */
428
     /* Generate the backtrace information */
429
     entry.address = frame->pc;
429
     entry.address = frame->pc;

+ 3
- 3
Marlin/src/backtrace/unwarmmem.cpp View File

91
       M_SetIdxUsed(memData->tracked, i);
91
       M_SetIdxUsed(memData->tracked, i);
92
     }
92
     }
93
     else {
93
     else {
94
-#if defined(UNW_DEBUG)
95
-      memData->v[i] = 0xdeadbeef;
96
-#endif
94
+      #if defined(UNW_DEBUG)
95
+        memData->v[i] = 0xDEADBEEF;
96
+      #endif
97
       M_ClrIdxUsed(memData->tracked, i);
97
       M_ClrIdxUsed(memData->tracked, i);
98
     }
98
     }
99
 
99
 

+ 12
- 12
Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp View File

123
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
123
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
124
         u8g_SetAddress(u8g, dev, 0);           // instruction mode
124
         u8g_SetAddress(u8g, dev, 0);           // instruction mode
125
         u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_sh1106_128x64_data_start_2_wire);
125
         u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_sh1106_128x64_data_start_2_wire);
126
-        u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2)); // select current page
126
+        u8g_WriteByte(u8g, dev, 0x0B0 | (pb->p.page*2)); // select current page
127
         u8g_SetAddress(u8g, dev, 1);           // data mode
127
         u8g_SetAddress(u8g, dev, 1);           // data mode
128
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *) pb->buf);
128
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *) pb->buf);
129
         u8g_SetChipSelect(u8g, dev, 0);
129
         u8g_SetChipSelect(u8g, dev, 0);
130
         u8g_SetAddress(u8g, dev, 0);           // instruction mode
130
         u8g_SetAddress(u8g, dev, 0);           // instruction mode
131
         u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_sh1106_128x64_data_start_2_wire);
131
         u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_sh1106_128x64_data_start_2_wire);
132
-        u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2+1)); // select current page
132
+        u8g_WriteByte(u8g, dev, 0x0B0 | (pb->p.page*2+1)); // select current page
133
         u8g_SetAddress(u8g, dev, 1);           // data mode
133
         u8g_SetAddress(u8g, dev, 1);           // data mode
134
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
134
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
135
         u8g_SetChipSelect(u8g, dev, 0);
135
         u8g_SetChipSelect(u8g, dev, 0);
191
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
191
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
192
         u8g_SetAddress(u8g, dev, 0);           // instruction mode
192
         u8g_SetAddress(u8g, dev, 0);           // instruction mode
193
         u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_ssd1306_128x64_data_start_2_wire);
193
         u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_ssd1306_128x64_data_start_2_wire);
194
-        u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2)); // select current page
194
+        u8g_WriteByte(u8g, dev, 0x0B0 | (pb->p.page*2)); // select current page
195
         u8g_SetAddress(u8g, dev, 1);           // data mode
195
         u8g_SetAddress(u8g, dev, 1);           // data mode
196
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *) pb->buf);
196
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *) pb->buf);
197
         u8g_SetChipSelect(u8g, dev, 0);
197
         u8g_SetChipSelect(u8g, dev, 0);
198
         u8g_SetAddress(u8g, dev, 0);           // instruction mode
198
         u8g_SetAddress(u8g, dev, 0);           // instruction mode
199
         u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_ssd1306_128x64_data_start_2_wire);
199
         u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_ssd1306_128x64_data_start_2_wire);
200
-        u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2+1)); // select current page
200
+        u8g_WriteByte(u8g, dev, 0x0B0 | (pb->p.page*2+1)); // select current page
201
         u8g_SetAddress(u8g, dev, 1);           // data mode
201
         u8g_SetAddress(u8g, dev, 1);           // data mode
202
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
202
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
203
         u8g_SetChipSelect(u8g, dev, 0);
203
         u8g_SetChipSelect(u8g, dev, 0);
250
       else if (value == 254) {
250
       else if (value == 254) {
251
         break;
251
         break;
252
       }
252
       }
253
-      else if (value >= 0x0f0) {
253
+      else if (value >= 0x0F0) {
254
         /* not yet used, do nothing */
254
         /* not yet used, do nothing */
255
       }
255
       }
256
-      else if (value >= 0xe0 ) {
257
-        u8g_SetAddress(u8g, dev, value & 0x0f);
256
+      else if (value >= 0xE0 ) {
257
+        u8g_SetAddress(u8g, dev, value & 0x0F);
258
       }
258
       }
259
-      else if (value >= 0xd0) {
260
-        u8g_SetChipSelect(u8g, dev, value & 0x0f);
259
+      else if (value >= 0xD0) {
260
+        u8g_SetChipSelect(u8g, dev, value & 0x0F);
261
       }
261
       }
262
-      else if (value >= 0xc0) {
262
+      else if (value >= 0xC0) {
263
         u8g_SetResetLow(u8g, dev);
263
         u8g_SetResetLow(u8g, dev);
264
-        value &= 0x0f;
264
+        value &= 0x0F;
265
         value <<= 4;
265
         value <<= 4;
266
         value+=2;
266
         value+=2;
267
         u8g_Delay(value);
267
         u8g_Delay(value);
268
         u8g_SetResetHigh(u8g, dev);
268
         u8g_SetResetHigh(u8g, dev);
269
         u8g_Delay(value);
269
         u8g_Delay(value);
270
       }
270
       }
271
-      else if (value >= 0xbe) {                       /* not yet implemented */
271
+      else if (value >= 0xBE) {                       /* not yet implemented */
272
         /* u8g_SetVCC(u8g, dev, value & 0x01); */
272
         /* u8g_SetVCC(u8g, dev, value & 0x01); */
273
       }
273
       }
274
       else if (value <= 127) {
274
       else if (value <= 127) {

+ 15
- 15
Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp View File

72
     U8G_ESC_CS(1),      // enable chip
72
     U8G_ESC_CS(1),      // enable chip
73
     U8G_ESC_RST(15),    // do reset low pulse with (15*16)+2 milliseconds (=maximum delay)*/
73
     U8G_ESC_RST(15),    // do reset low pulse with (15*16)+2 milliseconds (=maximum delay)*/
74
 
74
 
75
-    0x0A2,              // 0x0a2: LCD bias 1/9 (according to Displaytech 64128N datasheet)
75
+    0x0A2,              // 0x0A2: LCD bias 1/9 (according to Displaytech 64128N datasheet)
76
     0x0A0,              // Normal ADC Select (according to Displaytech 64128N datasheet)
76
     0x0A0,              // Normal ADC Select (according to Displaytech 64128N datasheet)
77
 
77
 
78
-    0x0c8,              // common output mode: set scan direction normal operation/SHL Select, 0x0c0 --> SHL = 0, normal, 0x0c8 --> SHL = 1
78
+    0x0C8,              // common output mode: set scan direction normal operation/SHL Select, 0x0C0 --> SHL = 0, normal, 0x0C8 --> SHL = 1
79
     0x040,              // Display start line for Displaytech 64128N
79
     0x040,              // Display start line for Displaytech 64128N
80
 
80
 
81
     0x028 | 0x04,       // power control: turn on voltage converter
81
     0x028 | 0x04,       // power control: turn on voltage converter
89
 
89
 
90
     0x010,              // Set V0 voltage resistor ratio. Setting for controlling brightness of Displaytech 64128N
90
     0x010,              // Set V0 voltage resistor ratio. Setting for controlling brightness of Displaytech 64128N
91
 
91
 
92
-    0x0a6,              // display normal, bit val 0: LCD pixel off.
92
+    0x0A6,              // display normal, bit val 0: LCD pixel off.
93
 
93
 
94
     0x081,              // set contrast
94
     0x081,              // set contrast
95
-    0x01e,              // Contrast value. Setting for controlling brightness of Displaytech 64128N
95
+    0x01E,              // Contrast value. Setting for controlling brightness of Displaytech 64128N
96
 
96
 
97
 
97
 
98
-    0x0af,              // display on
98
+    0x0AF,              // display on
99
 
99
 
100
     U8G_ESC_DLY(100),   // delay 100 ms
100
     U8G_ESC_DLY(100),   // delay 100 ms
101
-    0x0a5,              // display all points, ST7565
101
+    0x0A5,              // display all points, ST7565
102
     U8G_ESC_DLY(100),   // delay 100 ms
102
     U8G_ESC_DLY(100),   // delay 100 ms
103
     U8G_ESC_DLY(100),   // delay 100 ms
103
     U8G_ESC_DLY(100),   // delay 100 ms
104
-    0x0a4,              // normal display
104
+    0x0A4,              // normal display
105
     U8G_ESC_CS(0),      // disable chip
105
     U8G_ESC_CS(0),      // disable chip
106
     U8G_ESC_END         // end of sequence
106
     U8G_ESC_END         // end of sequence
107
 };
107
 };
117
 static const uint8_t u8g_dev_st7565_64128n_HAL_sleep_on[] PROGMEM = {
117
 static const uint8_t u8g_dev_st7565_64128n_HAL_sleep_on[] PROGMEM = {
118
   U8G_ESC_ADR(0),       // instruction mode
118
   U8G_ESC_ADR(0),       // instruction mode
119
   U8G_ESC_CS(1),        // enable chip
119
   U8G_ESC_CS(1),        // enable chip
120
-  0x0ac,                // static indicator off
120
+  0x0AC,                // static indicator off
121
   0x000,                // indicator register set (not sure if this is required)
121
   0x000,                // indicator register set (not sure if this is required)
122
-  0x0ae,                // display off
123
-  0x0a5,                // all points on
122
+  0x0AE,                // display off
123
+  0x0A5,                // all points on
124
   U8G_ESC_CS(0),        // disable chip, bugfix 12 nov 2014
124
   U8G_ESC_CS(0),        // disable chip, bugfix 12 nov 2014
125
   U8G_ESC_END           // end of sequence
125
   U8G_ESC_END           // end of sequence
126
   };
126
   };
128
 static const uint8_t u8g_dev_st7565_64128n_HAL_sleep_off[] PROGMEM = {
128
 static const uint8_t u8g_dev_st7565_64128n_HAL_sleep_off[] PROGMEM = {
129
   U8G_ESC_ADR(0),       // instruction mode
129
   U8G_ESC_ADR(0),       // instruction mode
130
   U8G_ESC_CS(1),        // enable chip
130
   U8G_ESC_CS(1),        // enable chip
131
-  0x0a4,                // all points off
132
-  0x0af,                // display on
131
+  0x0A4,                // all points off
132
+  0x0AF,                // display on
133
   U8G_ESC_DLY(50),      // delay 50 ms
133
   U8G_ESC_DLY(50),      // delay 50 ms
134
   U8G_ESC_CS(0),        // disable chip, bugfix 12 nov 2014
134
   U8G_ESC_CS(0),        // disable chip, bugfix 12 nov 2014
135
   U8G_ESC_END           // end of sequence
135
   U8G_ESC_END           // end of sequence
146
     case U8G_DEV_MSG_PAGE_NEXT: {
146
     case U8G_DEV_MSG_PAGE_NEXT: {
147
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
147
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
148
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_data_start);
148
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_data_start);
149
-        u8g_WriteByte(u8g, dev, 0x0b0 | pb->p.page); /* select current page (ST7565R) */
149
+        u8g_WriteByte(u8g, dev, 0x0B0 | pb->p.page); /* select current page (ST7565R) */
150
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
150
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
151
         if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
151
         if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
152
           return 0;
152
           return 0;
182
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
182
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
183
 
183
 
184
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_data_start);
184
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_data_start);
185
-        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page)); /* select current page (ST7565R) */
185
+        u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page)); /* select current page (ST7565R) */
186
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
186
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
187
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)pb->buf);
187
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)pb->buf);
188
         u8g_SetChipSelect(u8g, dev, 0);
188
         u8g_SetChipSelect(u8g, dev, 0);
189
 
189
 
190
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_data_start);
190
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_data_start);
191
-        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page+1)); /* select current page (ST7565R) */
191
+        u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page+1)); /* select current page (ST7565R) */
192
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
192
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
193
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
193
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
194
         u8g_SetChipSelect(u8g, dev, 0);
194
         u8g_SetChipSelect(u8g, dev, 0);

+ 3
- 3
Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp View File

75
   U8G_ESC_DLY(50),    // delay 50 ms
75
   U8G_ESC_DLY(50),    // delay 50 ms
76
 
76
 
77
   0x038,              // 8 Bit interface (DL=1), basic instruction set (RE=0)
77
   0x038,              // 8 Bit interface (DL=1), basic instruction set (RE=0)
78
-  0x00c,              // display on, cursor & blink off; 0x08: all off
78
+  0x00C,              // display on, cursor & blink off; 0x08: all off
79
   0x006,              // Entry mode: Cursor move to right ,DDRAM address counter (AC) plus 1, no shift
79
   0x006,              // Entry mode: Cursor move to right ,DDRAM address counter (AC) plus 1, no shift
80
   0x002,              // disable scroll, enable CGRAM adress
80
   0x002,              // disable scroll, enable CGRAM adress
81
   0x001,              // clear RAM, needs 1.6 ms
81
   0x001,              // clear RAM, needs 1.6 ms
125
       ptr = (uint8_t *)pb->buf;
125
       ptr = (uint8_t *)pb->buf;
126
       for (i = 0; i < 8; i ++) {
126
       for (i = 0; i < 8; i ++) {
127
         u8g_SetAddress(u8g, dev, 0);           /* cmd mode */
127
         u8g_SetAddress(u8g, dev, 0);           /* cmd mode */
128
-        u8g_WriteByte(u8g, dev, 0x03e );      /* enable extended mode */
128
+        u8g_WriteByte(u8g, dev, 0x03E );      /* enable extended mode */
129
 
129
 
130
         if (y < 32) {
130
         if (y < 32) {
131
           u8g_WriteByte(u8g, dev, 0x080 | y );      /* y pos  */
131
           u8g_WriteByte(u8g, dev, 0x080 | y );      /* y pos  */
170
       ptr = (uint8_t *)pb->buf;
170
       ptr = (uint8_t *)pb->buf;
171
       for (i = 0; i < 32; i ++) {
171
       for (i = 0; i < 32; i ++) {
172
         u8g_SetAddress(u8g, dev, 0);           /* cmd mode */
172
         u8g_SetAddress(u8g, dev, 0);           /* cmd mode */
173
-        u8g_WriteByte(u8g, dev, 0x03e );      /* enable extended mode */
173
+        u8g_WriteByte(u8g, dev, 0x03E );      /* enable extended mode */
174
 
174
 
175
         if (y < 32) {
175
         if (y < 32) {
176
           u8g_WriteByte(u8g, dev, 0x080 | y );      /* y pos  */
176
           u8g_WriteByte(u8g, dev, 0x080 | y );      /* y pos  */

+ 14
- 14
Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp View File

75
   U8G_ESC_RST(1),           /* do reset low pulse with (1*16)+2 milliseconds */
75
   U8G_ESC_RST(1),           /* do reset low pulse with (1*16)+2 milliseconds */
76
   U8G_ESC_CS(1),             /* enable chip */
76
   U8G_ESC_CS(1),             /* enable chip */
77
 
77
 
78
-  0x0e2,            /* soft reset */
78
+  0x0E2,            /* soft reset */
79
   0x040,    /* set display start line to 0 */
79
   0x040,    /* set display start line to 0 */
80
-  0x0a0,    /* ADC set to reverse */
81
-  0x0c8,    /* common output mode */
82
-  0x0a6,    /* display normal, bit val 0: LCD pixel off. */
83
-  0x0a2,    /* LCD bias 1/9 */
84
-  0x02f,    /* all power  control circuits on */
85
-  0x0f8,    /* set booster ratio to */
80
+  0x0A0,    /* ADC set to reverse */
81
+  0x0C8,    /* common output mode */
82
+  0x0A6,    /* display normal, bit val 0: LCD pixel off. */
83
+  0x0A2,    /* LCD bias 1/9 */
84
+  0x02F,    /* all power  control circuits on */
85
+  0x0F8,    /* set booster ratio to */
86
   0x000,    /* 4x */
86
   0x000,    /* 4x */
87
   0x023,    /* set V0 voltage resistor ratio to large */
87
   0x023,    /* set V0 voltage resistor ratio to large */
88
   0x081,    /* set contrast */
88
   0x081,    /* set contrast */
89
   0x027,    /* contrast value */
89
   0x027,    /* contrast value */
90
-  0x0ac,    /* indicator */
90
+  0x0AC,    /* indicator */
91
   0x000,    /* disable */
91
   0x000,    /* disable */
92
-  0x0af,    /* display on */
92
+  0x0AF,    /* display on */
93
 
93
 
94
   U8G_ESC_DLY(100),       /* delay 100 ms */
94
   U8G_ESC_DLY(100),       /* delay 100 ms */
95
-  0x0a5,                    /* display all points, ST7565 */
95
+  0x0A5,                    /* display all points, ST7565 */
96
   U8G_ESC_DLY(100),       /* delay 100 ms */
96
   U8G_ESC_DLY(100),       /* delay 100 ms */
97
   U8G_ESC_DLY(100),       /* delay 100 ms */
97
   U8G_ESC_DLY(100),       /* delay 100 ms */
98
-  0x0a4,                    /* normal display */
98
+  0x0A4,                    /* normal display */
99
   U8G_ESC_CS(0),             /* disable chip */
99
   U8G_ESC_CS(0),             /* disable chip */
100
   U8G_ESC_END                /* end of sequence */
100
   U8G_ESC_END                /* end of sequence */
101
 };
101
 };
122
       {
122
       {
123
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
123
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
124
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start);
124
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start);
125
-        u8g_WriteByte(u8g, dev, 0x0b0 | pb->p.page); /* select current page */
125
+        u8g_WriteByte(u8g, dev, 0x0B0 | pb->p.page); /* select current page */
126
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
126
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
127
         if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
127
         if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
128
           return 0;
128
           return 0;
155
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
155
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
156
 
156
 
157
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start);
157
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start);
158
-        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page)); /* select current page */
158
+        u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page)); /* select current page */
159
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
159
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
160
   u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)pb->buf);
160
   u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)pb->buf);
161
         u8g_SetChipSelect(u8g, dev, 0);
161
         u8g_SetChipSelect(u8g, dev, 0);
162
 
162
 
163
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start);
163
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start);
164
-        u8g_WriteByte(u8g, dev, 0x0b0 | (2*pb->p.page+1)); /* select current page */
164
+        u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page+1)); /* select current page */
165
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
165
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
166
   u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
166
   u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
167
         u8g_SetChipSelect(u8g, dev, 0);
167
         u8g_SetChipSelect(u8g, dev, 0);

+ 4
- 4
Marlin/src/module/planner.cpp View File

322
     //  // Get most significant bit set on divider
322
     //  // Get most significant bit set on divider
323
     //  uint8_t idx = 0;
323
     //  uint8_t idx = 0;
324
     //  uint32_t nr = d;
324
     //  uint32_t nr = d;
325
-    //  if (!(nr & 0xff0000)) {
325
+    //  if (!(nr & 0xFF0000)) {
326
     //    nr <<= 8;
326
     //    nr <<= 8;
327
     //    idx += 8;
327
     //    idx += 8;
328
-    //    if (!(nr & 0xff0000)) {
328
+    //    if (!(nr & 0xFF0000)) {
329
     //      nr <<= 8;
329
     //      nr <<= 8;
330
     //      idx += 8;
330
     //      idx += 8;
331
     //    }
331
     //    }
332
     //  }
332
     //  }
333
-    //  if (!(nr & 0xf00000)) {
333
+    //  if (!(nr & 0xF00000)) {
334
     //    nr <<= 4;
334
     //    nr <<= 4;
335
     //    idx += 4;
335
     //    idx += 4;
336
     //  }
336
     //  }
337
-    //  if (!(nr & 0xc00000)) {
337
+    //  if (!(nr & 0xC00000)) {
338
     //    nr <<= 2;
338
     //    nr <<= 2;
339
     //    idx += 2;
339
     //    idx += 2;
340
     //  }
340
     //  }

+ 2
- 2
Marlin/src/module/stepper.h View File

365
         step_rate -= F_CPU / 500000; // Correct for minimal speed
365
         step_rate -= F_CPU / 500000; // Correct for minimal speed
366
         if (step_rate >= (8 * 256)) { // higher step rate
366
         if (step_rate >= (8 * 256)) { // higher step rate
367
           unsigned short table_address = (unsigned short)&speed_lookuptable_fast[(unsigned char)(step_rate >> 8)][0];
367
           unsigned short table_address = (unsigned short)&speed_lookuptable_fast[(unsigned char)(step_rate >> 8)][0];
368
-          unsigned char tmp_step_rate = (step_rate & 0x00ff);
368
+          unsigned char tmp_step_rate = (step_rate & 0x00FF);
369
           unsigned short gain = (unsigned short)pgm_read_word_near(table_address + 2);
369
           unsigned short gain = (unsigned short)pgm_read_word_near(table_address + 2);
370
           MultiU16X8toH16(timer, tmp_step_rate, gain);
370
           MultiU16X8toH16(timer, tmp_step_rate, gain);
371
           timer = (unsigned short)pgm_read_word_near(table_address) - timer;
371
           timer = (unsigned short)pgm_read_word_near(table_address) - timer;
372
         }
372
         }
373
         else { // lower step rates
373
         else { // lower step rates
374
           unsigned short table_address = (unsigned short)&speed_lookuptable_slow[0][0];
374
           unsigned short table_address = (unsigned short)&speed_lookuptable_slow[0][0];
375
-          table_address += ((step_rate) >> 1) & 0xfffc;
375
+          table_address += ((step_rate) >> 1) & 0xFFFC;
376
           timer = (unsigned short)pgm_read_word_near(table_address);
376
           timer = (unsigned short)pgm_read_word_near(table_address);
377
           timer -= (((unsigned short)pgm_read_word_near(table_address + 2) * (unsigned char)(step_rate & 0x0007)) >> 3);
377
           timer -= (((unsigned short)pgm_read_word_near(table_address + 2) * (unsigned char)(step_rate & 0x0007)) >> 3);
378
         }
378
         }

+ 20
- 20
Marlin/src/sd/Sd2Card.cpp View File

45
 
45
 
46
   #ifdef FAST_CRC
46
   #ifdef FAST_CRC
47
     static const uint8_t crctab7[] PROGMEM = {
47
     static const uint8_t crctab7[] PROGMEM = {
48
-      0x00,0x09,0x12,0x1b,0x24,0x2d,0x36,0x3f,0x48,0x41,0x5a,0x53,0x6c,0x65,0x7e,0x77,
49
-      0x19,0x10,0x0b,0x02,0x3d,0x34,0x2f,0x26,0x51,0x58,0x43,0x4a,0x75,0x7c,0x67,0x6e,
50
-      0x32,0x3b,0x20,0x29,0x16,0x1f,0x04,0x0d,0x7a,0x73,0x68,0x61,0x5e,0x57,0x4c,0x45,
51
-      0x2b,0x22,0x39,0x30,0x0f,0x06,0x1d,0x14,0x63,0x6a,0x71,0x78,0x47,0x4e,0x55,0x5c,
52
-      0x64,0x6d,0x76,0x7f,0x40,0x49,0x52,0x5b,0x2c,0x25,0x3e,0x37,0x08,0x01,0x1a,0x13,
53
-      0x7d,0x74,0x6f,0x66,0x59,0x50,0x4b,0x42,0x35,0x3c,0x27,0x2e,0x11,0x18,0x03,0x0a,
54
-      0x56,0x5f,0x44,0x4d,0x72,0x7b,0x60,0x69,0x1e,0x17,0x0c,0x05,0x3a,0x33,0x28,0x21,
55
-      0x4f,0x46,0x5d,0x54,0x6b,0x62,0x79,0x70,0x07,0x0e,0x15,0x1c,0x23,0x2a,0x31,0x38,
56
-      0x41,0x48,0x53,0x5a,0x65,0x6c,0x77,0x7e,0x09,0x00,0x1b,0x12,0x2d,0x24,0x3f,0x36,
57
-      0x58,0x51,0x4a,0x43,0x7c,0x75,0x6e,0x67,0x10,0x19,0x02,0x0b,0x34,0x3d,0x26,0x2f,
58
-      0x73,0x7a,0x61,0x68,0x57,0x5e,0x45,0x4c,0x3b,0x32,0x29,0x20,0x1f,0x16,0x0d,0x04,
59
-      0x6a,0x63,0x78,0x71,0x4e,0x47,0x5c,0x55,0x22,0x2b,0x30,0x39,0x06,0x0f,0x14,0x1d,
60
-      0x25,0x2c,0x37,0x3e,0x01,0x08,0x13,0x1a,0x6d,0x64,0x7f,0x76,0x49,0x40,0x5b,0x52,
61
-      0x3c,0x35,0x2e,0x27,0x18,0x11,0x0a,0x03,0x74,0x7d,0x66,0x6f,0x50,0x59,0x42,0x4b,
62
-      0x17,0x1e,0x05,0x0c,0x33,0x3a,0x21,0x28,0x5f,0x56,0x4d,0x44,0x7b,0x72,0x69,0x60,
63
-      0x0e,0x07,0x1c,0x15,0x2a,0x23,0x38,0x31,0x46,0x4f,0x54,0x5d,0x62,0x6b,0x70,0x79
48
+      0x00,0x09,0x12,0x1B,0x24,0x2D,0x36,0x3F,0x48,0x41,0x5A,0x53,0x6C,0x65,0x7E,0x77,
49
+      0x19,0x10,0x0B,0x02,0x3D,0x34,0x2F,0x26,0x51,0x58,0x43,0x4A,0x75,0x7C,0x67,0x6E,
50
+      0x32,0x3B,0x20,0x29,0x16,0x1F,0x04,0x0D,0x7A,0x73,0x68,0x61,0x5E,0x57,0x4C,0x45,
51
+      0x2B,0x22,0x39,0x30,0x0F,0x06,0x1D,0x14,0x63,0x6A,0x71,0x78,0x47,0x4E,0x55,0x5C,
52
+      0x64,0x6D,0x76,0x7F,0x40,0x49,0x52,0x5B,0x2C,0x25,0x3E,0x37,0x08,0x01,0x1A,0x13,
53
+      0x7D,0x74,0x6F,0x66,0x59,0x50,0x4B,0x42,0x35,0x3C,0x27,0x2E,0x11,0x18,0x03,0x0A,
54
+      0x56,0x5F,0x44,0x4D,0x72,0x7B,0x60,0x69,0x1E,0x17,0x0C,0x05,0x3A,0x33,0x28,0x21,
55
+      0x4F,0x46,0x5D,0x54,0x6B,0x62,0x79,0x70,0x07,0x0E,0x15,0x1C,0x23,0x2A,0x31,0x38,
56
+      0x41,0x48,0x53,0x5A,0x65,0x6C,0x77,0x7E,0x09,0x00,0x1B,0x12,0x2D,0x24,0x3F,0x36,
57
+      0x58,0x51,0x4A,0x43,0x7C,0x75,0x6E,0x67,0x10,0x19,0x02,0x0B,0x34,0x3D,0x26,0x2F,
58
+      0x73,0x7A,0x61,0x68,0x57,0x5E,0x45,0x4C,0x3B,0x32,0x29,0x20,0x1F,0x16,0x0D,0x04,
59
+      0x6A,0x63,0x78,0x71,0x4E,0x47,0x5C,0x55,0x22,0x2B,0x30,0x39,0x06,0x0F,0x14,0x1D,
60
+      0x25,0x2C,0x37,0x3E,0x01,0x08,0x13,0x1A,0x6D,0x64,0x7F,0x76,0x49,0x40,0x5B,0x52,
61
+      0x3C,0x35,0x2E,0x27,0x18,0x11,0x0A,0x03,0x74,0x7D,0x66,0x6F,0x50,0x59,0x42,0x4B,
62
+      0x17,0x1E,0x05,0x0C,0x33,0x3A,0x21,0x28,0x5F,0x56,0x4D,0x44,0x7B,0x72,0x69,0x60,
63
+      0x0E,0x07,0x1C,0x15,0x2A,0x23,0x38,0x31,0x46,0x4F,0x54,0x5D,0x62,0x6B,0x70,0x79
64
     };
64
     };
65
 
65
 
66
     static uint8_t CRC7(const uint8_t* data, uint8_t n) {
66
     static uint8_t CRC7(const uint8_t* data, uint8_t n) {
79
         d ^= crc << 1;
79
         d ^= crc << 1;
80
         if (d & 0x80) d ^= 9;
80
         if (d & 0x80) d ^= 9;
81
         crc = d ^ (crc & 0x78) ^ (crc << 4) ^ ((crc >> 3) & 15);
81
         crc = d ^ (crc & 0x78) ^ (crc << 4) ^ ((crc >> 3) & 15);
82
-        crc &= 0x7f;
82
+        crc &= 0x7F;
83
       }
83
       }
84
-      crc = (crc << 1) ^ (crc << 4) ^ (crc & 0x70) ^ ((crc >> 3) & 0x0f);
84
+      crc = (crc << 1) ^ (crc << 4) ^ (crc & 0x70) ^ ((crc >> 3) & 0x0F);
85
       return crc | 1;
85
       return crc | 1;
86
     }
86
     }
87
   #endif
87
   #endif
438
       for (size_t i = 0; i < n; i++) {
438
       for (size_t i = 0; i < n; i++) {
439
         crc = (uint8_t)(crc >> 8) | (crc << 8);
439
         crc = (uint8_t)(crc >> 8) | (crc << 8);
440
         crc ^= data[i];
440
         crc ^= data[i];
441
-        crc ^= (uint8_t)(crc & 0xff) >> 4;
441
+        crc ^= (uint8_t)(crc & 0xFF) >> 4;
442
         crc ^= crc << 12;
442
         crc ^= crc << 12;
443
-        crc ^= (crc & 0xff) << 5;
443
+        crc ^= (crc & 0xFF) << 5;
444
       }
444
       }
445
       return crc;
445
       return crc;
446
     }
446
     }

Loading…
Cancel
Save