瀏覽代碼

Standardize some hexadecimals

Scott Lahteine 6 年之前
父節點
當前提交
d1b619be52

+ 1
- 1
Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp 查看文件

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

+ 3
- 3
Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp 查看文件

@@ -122,16 +122,16 @@ static void u8g_com_DUE_st7920_write_byte_sw_spi(uint8_t rs, uint8_t val) {
122 122
 
123 123
     if ( rs == 0 )
124 124
       /* command */
125
-      spiSend_sw_DUE(0x0f8);
125
+      spiSend_sw_DUE(0x0F8);
126 126
     else
127 127
        /* data */
128
-      spiSend_sw_DUE(0x0fa);
128
+      spiSend_sw_DUE(0x0FA);
129 129
 
130 130
     for (i = 0; i < 4; i++)   // give the controller some time to process the data
131 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 135
   spiSend_sw_DUE(val << 4);
136 136
 }
137 137
 

+ 1
- 1
Marlin/src/HAL/HAL_DUE/usb/pll.h 查看文件

@@ -74,7 +74,7 @@ extern "C" {
74 74
 
75 75
 #define PLL_UPLL_HZ     480000000
76 76
 
77
-#define PLL_COUNT           0x3fU
77
+#define PLL_COUNT           0x3FU
78 78
 
79 79
 enum pll_source {
80 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 查看文件

@@ -96,13 +96,13 @@ struct scsi_inquiry_data {
96 96
 #define  SCSI_INQ_DT_CD_DVD      0x05   //!< CD/DVD device
97 97
 #define  SCSI_INQ_DT_OPTICAL     0x07   //!< Optical Memory
98 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 103
 #define  SCSI_INQ_DT_BCC         0x10   //!< Bridge Controller Commands
104 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 106
 	uint8_t flags1; //!< Flags (byte 1)
107 107
 #define  SCSI_INQ_RMB            0x80   //!< Removable Medium
108 108
 	uint8_t version; //!< Version
@@ -213,17 +213,17 @@ enum scsi_sense_key {
213 213
 	SCSI_SK_DATA_PROTECT = 0x7,
214 214
 	SCSI_SK_BLANK_CHECK = 0x8,
215 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 222
 /* Additional Sense Code / Additional Sense Code Qualifier pairs */
223 223
 enum scsi_asc_ascq {
224 224
 	SCSI_ASC_NO_ADDITIONAL_SENSE_INFO = 0x0000,
225 225
 	SCSI_ASC_LU_NOT_READY_REBUILD_IN_PROGRESS = 0x0405,
226
-	SCSI_ASC_WRITE_ERROR = 0x0c00,
226
+	SCSI_ASC_WRITE_ERROR = 0x0C00,
227 227
 	SCSI_ASC_UNRECOVERED_READ_ERROR = 0x1100,
228 228
 	SCSI_ASC_INVALID_COMMAND_OPERATION_CODE = 0x2000,
229 229
 	SCSI_ASC_INVALID_FIELD_IN_CDB = 0x2400,
@@ -242,7 +242,7 @@ enum scsi_asc_ascq {
242 242
 enum scsi_spc_mode {
243 243
 	SCSI_MS_MODE_VENDOR_SPEC = 0x00,
244 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,7 +289,7 @@ static inline bool scsi_mode_sense_dbd_is_set(const uint8_t * cdb)
289 289
 
290 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 295
 static inline uint8_t scsi_mode_sense_get_pc(const uint8_t * cdb)

+ 3
- 3
Marlin/src/HAL/HAL_DUE/usb/udc.c 查看文件

@@ -527,7 +527,7 @@ static bool udc_req_std_dev_set_feature(void)
527 527
 		if (!udd_is_high_speed()) {
528 528
 			break;
529 529
 		}
530
-		if (udd_g_ctrlreq.req.wIndex & 0xff) {
530
+		if (udd_g_ctrlreq.req.wIndex & 0xFF) {
531 531
 			break;
532 532
 		}
533 533
 		// Unconfigure the device, terminating all ongoing requests
@@ -618,7 +618,7 @@ static bool udc_req_std_dev_get_str_desc(void)
618 618
 	uint8_t str_length = 0;
619 619
 
620 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 622
 	case 0:
623 623
 		udd_set_setup_payload((uint8_t *) &udc_string_desc_languageid,
624 624
 				sizeof(udc_string_desc_languageid));
@@ -674,7 +674,7 @@ static bool udc_req_std_dev_get_descriptor(void)
674 674
 {
675 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 679
 	// Check descriptor ID
680 680
 	switch ((uint8_t) (udd_g_ctrlreq.req.wValue >> 8)) {

+ 1
- 1
Marlin/src/HAL/HAL_DUE/usb/usb_protocol.h 查看文件

@@ -271,7 +271,7 @@ enum usb_langid {
271 271
 /**
272 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 276
 //! \brief USB address identifier
277 277
 typedef uint8_t usb_add_t;

+ 1
- 1
Marlin/src/HAL/HAL_DUE/usb/usb_task.c 查看文件

@@ -225,7 +225,7 @@ bool usb_task_extra_string(void) {
225 225
   uint8_t str_lgt = 0;
226 226
 
227 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 229
   case UDI_CDC_IAD_STRING_ID:
230 230
     str_lgt = sizeof(udi_cdc_name) - 1;
231 231
     str = udi_cdc_name;

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/HAL.cpp 查看文件

@@ -247,7 +247,7 @@ uint16_t HAL_adc_get_result(void) {
247 247
     data = lowpass_filter[adc_channel].update(data);
248 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 253
 #define SBIT_CNTEN     0

+ 2
- 2
Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp 查看文件

@@ -83,14 +83,14 @@
83 83
   }
84 84
 
85 85
   uint8_t spiRec() {
86
-    uint8_t b = spiTransfer(0xff);
86
+    uint8_t b = spiTransfer(0xFF);
87 87
     return b;
88 88
   }
89 89
 
90 90
   void spiRead(uint8_t*buf, uint16_t nbyte) {
91 91
     if (nbyte == 0) return;
92 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 查看文件

@@ -213,7 +213,7 @@ void LPC1768_PWM_sort(void) {
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 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 查看文件

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

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction 查看文件

@@ -68,7 +68,7 @@ void delayMicroseconds(uint32_t us);
68 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 72
   //#define I2C_CMD_MODE  0x080
73 73
   #define I2C_CMD_MODE    0x000
74 74
   #define I2C_DATA_MODE   0x040

+ 3
- 3
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp 查看文件

@@ -87,16 +87,16 @@
87 87
 
88 88
       if ( rs == 0 )
89 89
         /* command */
90
-        spiSend(0x0f8);
90
+        spiSend(0x0F8);
91 91
       else
92 92
          /* data */
93
-        spiSend(0x0fa);
93
+        spiSend(0x0FA);
94 94
 
95 95
       for( i = 0; i < 4; i++ )   // give the controller some time to process the data
96 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 100
     spiSend(val << 4);
101 101
   }
102 102
 

+ 3
- 3
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp 查看文件

@@ -73,16 +73,16 @@
73 73
 
74 74
       if ( rs == 0 )
75 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 77
       else
78 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 81
       for( i = 0; i < 4; i++ )   // give the controller some time to process the data
82 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 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 查看文件

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

+ 1
- 1
Marlin/src/backtrace/unwarm.cpp 查看文件

@@ -80,7 +80,7 @@ void UnwInitState(UnwState * const state,     /**< Pointer to structure to fill.
80 80
 // Detect if function names are available
81 81
 static int __attribute__ ((noinline)) has_function_names(void) {
82 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 查看文件

@@ -104,7 +104,7 @@ typedef struct {
104 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 108
 #define M_Origin2Str(v)    ((v) ? "VALID" : "INVALID")
109 109
 
110 110
 #if defined(UNW_DEBUG)

+ 57
- 57
Marlin/src/backtrace/unwarm_thumb.cpp 查看文件

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

+ 36
- 36
Marlin/src/backtrace/unwarmbytab.cpp 查看文件

@@ -29,7 +29,7 @@ void __aeabi_unwind_cpp_pr2(void) {};
29 29
 
30 30
 static inline __attribute__((always_inline)) uint32_t prel31_to_addr(const uint32_t *prel31) {
31 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 35
 static const UnwTabEntry *UnwTabSearchIndex(const UnwTabEntry *start, const UnwTabEntry *end, uint32_t ip) {
@@ -54,8 +54,8 @@ static const char *UnwTabGetFunctionName(const UnwindCallbacks *cb, uint32_t add
54 54
   if (!cb->readW(address-4,&flag_word))
55 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 60
   return NULL;
61 61
 }
@@ -77,7 +77,7 @@ static int UnwTabGetNextInstruction(const UnwindCallbacks *cb, UnwTabState *ucb)
77 77
   uint32_t v = 0;
78 78
   if (!cb->readW(ucb->current, &v))
79 79
     return -1;
80
-  instruction = (v >> (ucb->byte << 3)) & 0xff;
80
+  instruction = (v >> (ucb->byte << 3)) & 0xFF;
81 81
 
82 82
   /* Move the next byte */
83 83
   --ucb->byte;
@@ -104,12 +104,12 @@ static UnwResult UnwTabStateInit(const UnwindCallbacks *cb, UnwTabState *ucb, ui
104 104
   if (!cb->readW(instructions, &v))
105 105
     return UNWIND_DREAD_W_FAIL;
106 106
 
107
-  if ((v & 0xff000000) == 0x80000000) {
107
+  if ((v & 0xFF000000) == 0x80000000) {
108 108
     ucb->remaining = 3;
109 109
     ucb->byte = 2;
110 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 113
     ucb->byte = 1;
114 114
   } else
115 115
     return UNWIND_UNSUPPORTED_DWARF_PERSONALITY;
@@ -138,15 +138,15 @@ static UnwResult UnwTabExecuteInstructions(const UnwindCallbacks *cb, UnwTabStat
138 138
   /* Consume all instruction byte */
139 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 142
       /* vsp = vsp + (xxxxxx << 2) + 4 */
143
-      ucb->vrs[13] += ((instruction & 0x3f) << 2) + 4;
143
+      ucb->vrs[13] += ((instruction & 0x3F) << 2) + 4;
144 144
     } else
145
-    if ((instruction & 0xc0) == 0x40) { // ARM_EXIDX_CMD_DATA_PUSH
145
+    if ((instruction & 0xC0) == 0x40) { // ARM_EXIDX_CMD_DATA_PUSH
146 146
       /* vsp = vsp - (xxxxxx << 2) - 4 */
147
-      ucb->vrs[13] -= ((instruction & 0x3f) << 2) - 4;
147
+      ucb->vrs[13] -= ((instruction & 0x3F) << 2) - 4;
148 148
     } else
149
-    if ((instruction & 0xf0) == 0x80) {
149
+    if ((instruction & 0xF0) == 0x80) {
150 150
       /* pop under mask {r15-r12},{r11-r4} or refuse to unwind */
151 151
       instruction = instruction << 8 | UnwTabGetNextInstruction(cb, ucb);
152 152
 
@@ -156,7 +156,7 @@ static UnwResult UnwTabExecuteInstructions(const UnwindCallbacks *cb, UnwTabStat
156 156
 
157 157
       /* Pop registers using mask */    // ARM_EXIDX_CMD_REG_POP
158 158
       vsp = ucb->vrs[13];
159
-      mask = instruction & 0xfff;
159
+      mask = instruction & 0xFFF;
160 160
 
161 161
       reg = 4;
162 162
       while (mask) {
@@ -176,13 +176,13 @@ static UnwResult UnwTabExecuteInstructions(const UnwindCallbacks *cb, UnwTabStat
176 176
         ucb->vrs[13] = vsp;
177 177
 
178 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 182
       /* vsp = r[nnnn] */
183
-      ucb->vrs[13] = ucb->vrs[instruction & 0x0f];
183
+      ucb->vrs[13] = ucb->vrs[instruction & 0x0F];
184 184
     } else
185
-    if ((instruction & 0xf0) == 0xa0) { // ARM_EXIDX_CMD_REG_POP
185
+    if ((instruction & 0xF0) == 0xA0) { // ARM_EXIDX_CMD_REG_POP
186 186
       /* pop r4-r[4+nnn] or pop r4-r[4+nnn], r14*/
187 187
       vsp = ucb->vrs[13];
188 188
 
@@ -206,7 +206,7 @@ static UnwResult UnwTabExecuteInstructions(const UnwindCallbacks *cb, UnwTabStat
206 206
       ucb->vrs[13] = vsp;
207 207
 
208 208
     } else
209
-    if (instruction == 0xb0) { // ARM_EXIDX_CMD_FINISH
209
+    if (instruction == 0xB0) { // ARM_EXIDX_CMD_FINISH
210 210
       /* finished */
211 211
       if (ucb->vrs[15] == 0)
212 212
         ucb->vrs[15] = ucb->vrs[14];
@@ -215,7 +215,7 @@ static UnwResult UnwTabExecuteInstructions(const UnwindCallbacks *cb, UnwTabStat
215 215
       return UNWIND_SUCCESS;
216 216
 
217 217
     } else
218
-    if (instruction == 0xb1) { // ARM_EXIDX_CMD_REG_POP
218
+    if (instruction == 0xB1) { // ARM_EXIDX_CMD_REG_POP
219 219
       /* pop register under mask {r3,r2,r1,r0} */
220 220
       vsp = ucb->vrs[13];
221 221
       mask = UnwTabGetNextInstruction(cb, ucb);
@@ -236,14 +236,14 @@ static UnwResult UnwTabExecuteInstructions(const UnwindCallbacks *cb, UnwTabStat
236 236
       ucb->vrs[13] = (uint32_t)vsp;
237 237
 
238 238
     } else
239
-    if (instruction == 0xb2) { // ARM_EXIDX_CMD_DATA_POP
239
+    if (instruction == 0xB2) { // ARM_EXIDX_CMD_DATA_POP
240 240
       /* vps = vsp + 0x204 + (uleb128 << 2) */
241 241
       ucb->vrs[13] += 0x204 + (UnwTabGetNextInstruction(cb, ucb) << 2);
242 242
 
243 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 248
       /* pop VFP double-precision registers */
249 249
       vsp = ucb->vrs[13];
@@ -256,12 +256,12 @@ static UnwResult UnwTabExecuteInstructions(const UnwindCallbacks *cb, UnwTabStat
256 256
       ucb->vrs[14] = v;
257 257
       vsp += 4;
258 258
 
259
-      if (instruction == 0xc8) {
259
+      if (instruction == 0xC8) {
260 260
         /* D[16+sssss]-D[16+ssss+cccc] */
261 261
         ucb->vrs[14] |= 1 << 16;
262 262
       }
263 263
 
264
-      if (instruction != 0xb3) {
264
+      if (instruction != 0xB3) {
265 265
         /* D[sssss]-D[ssss+cccc] */
266 266
         ucb->vrs[14] |= 1 << 17;
267 267
       }
@@ -269,13 +269,13 @@ static UnwResult UnwTabExecuteInstructions(const UnwindCallbacks *cb, UnwTabStat
269 269
       ucb->vrs[13] = vsp;
270 270
 
271 271
     } else
272
-    if ((instruction & 0xf8) == 0xb8 ||
273
-        (instruction & 0xf8) == 0xd0) {
272
+    if ((instruction & 0xF8) == 0xB8 ||
273
+        (instruction & 0xF8) == 0xD0) {
274 274
 
275 275
       /* Pop VFP double precision registers D[8]-D[8+nnn] */
276 276
       ucb->vrs[14] = 0x80 | (instruction & 0x07);
277 277
 
278
-      if ((instruction & 0xf8) == 0xd0) {
278
+      if ((instruction & 0xF8) == 0xD0) {
279 279
         ucb->vrs[14] = 1 << 17;
280 280
       }
281 281
 
@@ -337,7 +337,7 @@ static UnwResult UnwTabUnwindFrame(const UnwindCallbacks *cb, UnwindFrame *frame
337 337
 
338 338
   /* Check for exception return */
339 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 341
     /* According to the Cortex Programming Manual (p.44), the stack address is always 8-byte aligned (Cortex-M7).
342 342
        Depending on where the exception came from (MSP or PSP), we need the right SP value to work with.
343 343
 
@@ -354,20 +354,20 @@ static UnwResult UnwTabUnwindFrame(const UnwindCallbacks *cb, UnwindFrame *frame
354 354
        If we need to start from the PSP, we need to go up exactly 6 words to find the PC.
355 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 359
       stack = ucb.vrs[13];
360 360
 
361 361
       /* The PC is always 2 words down from the MSP, if it was a non-floating-point exception */
362 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 366
         stack -= 18*4;
367 367
       }
368 368
     }
369 369
     else {
370
-      /* Return to Thread Mode: PSP (0xffffff-d) */
370
+      /* Return to Thread Mode: PSP (0xFFFFFF-d) */
371 371
       stack = read_psp();
372 372
 
373 373
       /* The PC is always 6 words up from the PSP */
@@ -423,7 +423,7 @@ UnwResult UnwindByTableStart(UnwindFrame* frame, const UnwindCallbacks *cb, void
423 423
     const UnwTabEntry *index = UnwTabSearchIndex(__exidx_start, __exidx_end, frame->pc);
424 424
 
425 425
     /* Clear last bit (Thumb indicator) */
426
-    frame->pc &= 0xfffffffeU;
426
+    frame->pc &= 0xFFFFFFFEU;
427 427
 
428 428
     /* Generate the backtrace information */
429 429
     entry.address = frame->pc;

+ 3
- 3
Marlin/src/backtrace/unwarmmem.cpp 查看文件

@@ -91,9 +91,9 @@ bool UnwMemHashWrite(MemData * const memData, uint32_t addr, uint32_t val, bool
91 91
       M_SetIdxUsed(memData->tracked, i);
92 92
     }
93 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 97
       M_ClrIdxUsed(memData->tracked, i);
98 98
     }
99 99
 

+ 12
- 12
Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp 查看文件

@@ -123,13 +123,13 @@ uint8_t u8g_dev_sh1106_128x64_2x_2_wire_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m
123 123
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
124 124
         u8g_SetAddress(u8g, dev, 0);           // instruction mode
125 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 127
         u8g_SetAddress(u8g, dev, 1);           // data mode
128 128
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *) pb->buf);
129 129
         u8g_SetChipSelect(u8g, dev, 0);
130 130
         u8g_SetAddress(u8g, dev, 0);           // instruction mode
131 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 133
         u8g_SetAddress(u8g, dev, 1);           // data mode
134 134
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
135 135
         u8g_SetChipSelect(u8g, dev, 0);
@@ -191,13 +191,13 @@ uint8_t u8g_dev_ssd1306_128x64_2x_2_wire_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t
191 191
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
192 192
         u8g_SetAddress(u8g, dev, 0);           // instruction mode
193 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 195
         u8g_SetAddress(u8g, dev, 1);           // data mode
196 196
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *) pb->buf);
197 197
         u8g_SetChipSelect(u8g, dev, 0);
198 198
         u8g_SetAddress(u8g, dev, 0);           // instruction mode
199 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 201
         u8g_SetAddress(u8g, dev, 1);           // data mode
202 202
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
203 203
         u8g_SetChipSelect(u8g, dev, 0);
@@ -250,25 +250,25 @@ uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_s
250 250
       else if (value == 254) {
251 251
         break;
252 252
       }
253
-      else if (value >= 0x0f0) {
253
+      else if (value >= 0x0F0) {
254 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 263
         u8g_SetResetLow(u8g, dev);
264
-        value &= 0x0f;
264
+        value &= 0x0F;
265 265
         value <<= 4;
266 266
         value+=2;
267 267
         u8g_Delay(value);
268 268
         u8g_SetResetHigh(u8g, dev);
269 269
         u8g_Delay(value);
270 270
       }
271
-      else if (value >= 0xbe) {                       /* not yet implemented */
271
+      else if (value >= 0xBE) {                       /* not yet implemented */
272 272
         /* u8g_SetVCC(u8g, dev, value & 0x01); */
273 273
       }
274 274
       else if (value <= 127) {

+ 15
- 15
Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp 查看文件

@@ -72,10 +72,10 @@ static const uint8_t u8g_dev_st7565_64128n_HAL_init_seq[] PROGMEM = {
72 72
     U8G_ESC_CS(1),      // enable chip
73 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 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 79
     0x040,              // Display start line for Displaytech 64128N
80 80
 
81 81
     0x028 | 0x04,       // power control: turn on voltage converter
@@ -89,19 +89,19 @@ static const uint8_t u8g_dev_st7565_64128n_HAL_init_seq[] PROGMEM = {
89 89
 
90 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 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 100
     U8G_ESC_DLY(100),   // delay 100 ms
101
-    0x0a5,              // display all points, ST7565
101
+    0x0A5,              // display all points, ST7565
102 102
     U8G_ESC_DLY(100),   // delay 100 ms
103 103
     U8G_ESC_DLY(100),   // delay 100 ms
104
-    0x0a4,              // normal display
104
+    0x0A4,              // normal display
105 105
     U8G_ESC_CS(0),      // disable chip
106 106
     U8G_ESC_END         // end of sequence
107 107
 };
@@ -117,10 +117,10 @@ static const uint8_t u8g_dev_st7565_64128n_HAL_data_start[] PROGMEM = {
117 117
 static const uint8_t u8g_dev_st7565_64128n_HAL_sleep_on[] PROGMEM = {
118 118
   U8G_ESC_ADR(0),       // instruction mode
119 119
   U8G_ESC_CS(1),        // enable chip
120
-  0x0ac,                // static indicator off
120
+  0x0AC,                // static indicator off
121 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 124
   U8G_ESC_CS(0),        // disable chip, bugfix 12 nov 2014
125 125
   U8G_ESC_END           // end of sequence
126 126
   };
@@ -128,8 +128,8 @@ static const uint8_t u8g_dev_st7565_64128n_HAL_sleep_on[] PROGMEM = {
128 128
 static const uint8_t u8g_dev_st7565_64128n_HAL_sleep_off[] PROGMEM = {
129 129
   U8G_ESC_ADR(0),       // instruction mode
130 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 133
   U8G_ESC_DLY(50),      // delay 50 ms
134 134
   U8G_ESC_CS(0),        // disable chip, bugfix 12 nov 2014
135 135
   U8G_ESC_END           // end of sequence
@@ -146,7 +146,7 @@ uint8_t u8g_dev_st7565_64128n_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
146 146
     case U8G_DEV_MSG_PAGE_NEXT: {
147 147
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
148 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 150
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
151 151
         if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
152 152
           return 0;
@@ -182,13 +182,13 @@ uint8_t u8g_dev_st7565_64128n_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
182 182
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
183 183
 
184 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 186
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
187 187
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)pb->buf);
188 188
         u8g_SetChipSelect(u8g, dev, 0);
189 189
 
190 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 192
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
193 193
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
194 194
         u8g_SetChipSelect(u8g, dev, 0);

+ 3
- 3
Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp 查看文件

@@ -75,7 +75,7 @@ static const uint8_t u8g_dev_st7920_128x64_HAL_init_seq[] PROGMEM = {
75 75
   U8G_ESC_DLY(50),    // delay 50 ms
76 76
 
77 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 79
   0x006,              // Entry mode: Cursor move to right ,DDRAM address counter (AC) plus 1, no shift
80 80
   0x002,              // disable scroll, enable CGRAM adress
81 81
   0x001,              // clear RAM, needs 1.6 ms
@@ -125,7 +125,7 @@ uint8_t u8g_dev_st7920_128x64_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
125 125
       ptr = (uint8_t *)pb->buf;
126 126
       for (i = 0; i < 8; i ++) {
127 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 130
         if (y < 32) {
131 131
           u8g_WriteByte(u8g, dev, 0x080 | y );      /* y pos  */
@@ -170,7 +170,7 @@ uint8_t u8g_dev_st7920_128x64_HAL_4x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
170 170
       ptr = (uint8_t *)pb->buf;
171 171
       for (i = 0; i < 32; i ++) {
172 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 175
         if (y < 32) {
176 176
           u8g_WriteByte(u8g, dev, 0x080 | y );      /* y pos  */

+ 14
- 14
Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp 查看文件

@@ -75,27 +75,27 @@ static const uint8_t u8g_dev_uc1701_mini12864_HAL_init_seq[] PROGMEM = {
75 75
   U8G_ESC_RST(1),           /* do reset low pulse with (1*16)+2 milliseconds */
76 76
   U8G_ESC_CS(1),             /* enable chip */
77 77
 
78
-  0x0e2,            /* soft reset */
78
+  0x0E2,            /* soft reset */
79 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 86
   0x000,    /* 4x */
87 87
   0x023,    /* set V0 voltage resistor ratio to large */
88 88
   0x081,    /* set contrast */
89 89
   0x027,    /* contrast value */
90
-  0x0ac,    /* indicator */
90
+  0x0AC,    /* indicator */
91 91
   0x000,    /* disable */
92
-  0x0af,    /* display on */
92
+  0x0AF,    /* display on */
93 93
 
94 94
   U8G_ESC_DLY(100),       /* delay 100 ms */
95
-  0x0a5,                    /* display all points, ST7565 */
95
+  0x0A5,                    /* display all points, ST7565 */
96 96
   U8G_ESC_DLY(100),       /* delay 100 ms */
97 97
   U8G_ESC_DLY(100),       /* delay 100 ms */
98
-  0x0a4,                    /* normal display */
98
+  0x0A4,                    /* normal display */
99 99
   U8G_ESC_CS(0),             /* disable chip */
100 100
   U8G_ESC_END                /* end of sequence */
101 101
 };
@@ -122,7 +122,7 @@ uint8_t u8g_dev_uc1701_mini12864_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
122 122
       {
123 123
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
124 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 126
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
127 127
         if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
128 128
           return 0;
@@ -155,13 +155,13 @@ uint8_t u8g_dev_uc1701_mini12864_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m
155 155
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
156 156
 
157 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 159
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
160 160
   u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)pb->buf);
161 161
         u8g_SetChipSelect(u8g, dev, 0);
162 162
 
163 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 165
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
166 166
   u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
167 167
         u8g_SetChipSelect(u8g, dev, 0);

+ 4
- 4
Marlin/src/module/planner.cpp 查看文件

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

+ 2
- 2
Marlin/src/module/stepper.h 查看文件

@@ -365,14 +365,14 @@ class Stepper {
365 365
         step_rate -= F_CPU / 500000; // Correct for minimal speed
366 366
         if (step_rate >= (8 * 256)) { // higher step rate
367 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 369
           unsigned short gain = (unsigned short)pgm_read_word_near(table_address + 2);
370 370
           MultiU16X8toH16(timer, tmp_step_rate, gain);
371 371
           timer = (unsigned short)pgm_read_word_near(table_address) - timer;
372 372
         }
373 373
         else { // lower step rates
374 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 376
           timer = (unsigned short)pgm_read_word_near(table_address);
377 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 查看文件

@@ -45,22 +45,22 @@
45 45
 
46 46
   #ifdef FAST_CRC
47 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 66
     static uint8_t CRC7(const uint8_t* data, uint8_t n) {
@@ -79,9 +79,9 @@
79 79
         d ^= crc << 1;
80 80
         if (d & 0x80) d ^= 9;
81 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 85
       return crc | 1;
86 86
     }
87 87
   #endif
@@ -438,9 +438,9 @@ bool Sd2Card::readData(uint8_t* dst) {
438 438
       for (size_t i = 0; i < n; i++) {
439 439
         crc = (uint8_t)(crc >> 8) | (crc << 8);
440 440
         crc ^= data[i];
441
-        crc ^= (uint8_t)(crc & 0xff) >> 4;
441
+        crc ^= (uint8_t)(crc & 0xFF) >> 4;
442 442
         crc ^= crc << 12;
443
-        crc ^= (crc & 0xff) << 5;
443
+        crc ^= (crc & 0xFF) << 5;
444 444
       }
445 445
       return crc;
446 446
     }

Loading…
取消
儲存