Browse Source

Nybbles & Bits

Scott Lahteine 3 years ago
parent
commit
49564e5310

+ 12
- 12
Marlin/src/libs/W25Qxx.cpp View File

191
   W25QXX_CS_L;
191
   W25QXX_CS_L;
192
   // Send Sector Erase instruction
192
   // Send Sector Erase instruction
193
   spi_flash_Send(W25X_SectorErase);
193
   spi_flash_Send(W25X_SectorErase);
194
-  // Send SectorAddr high nibble address byte
194
+  // Send SectorAddr high nybble address byte
195
   spi_flash_Send((SectorAddr & 0xFF0000) >> 16);
195
   spi_flash_Send((SectorAddr & 0xFF0000) >> 16);
196
-  // Send SectorAddr medium nibble address byte
196
+  // Send SectorAddr medium nybble address byte
197
   spi_flash_Send((SectorAddr & 0xFF00) >> 8);
197
   spi_flash_Send((SectorAddr & 0xFF00) >> 8);
198
-  // Send SectorAddr low nibble address byte
198
+  // Send SectorAddr low nybble address byte
199
   spi_flash_Send(SectorAddr & 0xFF);
199
   spi_flash_Send(SectorAddr & 0xFF);
200
   // Deselect the FLASH: Chip Select high
200
   // Deselect the FLASH: Chip Select high
201
 
201
 
209
   W25QXX_CS_L;
209
   W25QXX_CS_L;
210
   // Send Sector Erase instruction
210
   // Send Sector Erase instruction
211
   spi_flash_Send(W25X_BlockErase);
211
   spi_flash_Send(W25X_BlockErase);
212
-  // Send SectorAddr high nibble address byte
212
+  // Send SectorAddr high nybble address byte
213
   spi_flash_Send((BlockAddr & 0xFF0000) >> 16);
213
   spi_flash_Send((BlockAddr & 0xFF0000) >> 16);
214
-  // Send SectorAddr medium nibble address byte
214
+  // Send SectorAddr medium nybble address byte
215
   spi_flash_Send((BlockAddr & 0xFF00) >> 8);
215
   spi_flash_Send((BlockAddr & 0xFF00) >> 8);
216
-  // Send SectorAddr low nibble address byte
216
+  // Send SectorAddr low nybble address byte
217
   spi_flash_Send(BlockAddr & 0xFF);
217
   spi_flash_Send(BlockAddr & 0xFF);
218
 
218
 
219
   W25QXX_CS_H;
219
   W25QXX_CS_H;
265
   W25QXX_CS_L;
265
   W25QXX_CS_L;
266
   // Send "Write to Memory " instruction
266
   // Send "Write to Memory " instruction
267
   spi_flash_Send(W25X_PageProgram);
267
   spi_flash_Send(W25X_PageProgram);
268
-  // Send WriteAddr high nibble address byte to write to
268
+  // Send WriteAddr high nybble address byte to write to
269
   spi_flash_Send((WriteAddr & 0xFF0000) >> 16);
269
   spi_flash_Send((WriteAddr & 0xFF0000) >> 16);
270
-  // Send WriteAddr medium nibble address byte to write to
270
+  // Send WriteAddr medium nybble address byte to write to
271
   spi_flash_Send((WriteAddr & 0xFF00) >> 8);
271
   spi_flash_Send((WriteAddr & 0xFF00) >> 8);
272
-  // Send WriteAddr low nibble address byte to write to
272
+  // Send WriteAddr low nybble address byte to write to
273
   spi_flash_Send(WriteAddr & 0xFF);
273
   spi_flash_Send(WriteAddr & 0xFF);
274
 
274
 
275
   NOMORE(NumByteToWrite, SPI_FLASH_PerWritePageSize);
275
   NOMORE(NumByteToWrite, SPI_FLASH_PerWritePageSize);
371
   // Send "Read from Memory " instruction
371
   // Send "Read from Memory " instruction
372
   spi_flash_Send(W25X_ReadData);
372
   spi_flash_Send(W25X_ReadData);
373
 
373
 
374
-  // Send ReadAddr high nibble address byte to read from
374
+  // Send ReadAddr high nybble address byte to read from
375
   spi_flash_Send((ReadAddr & 0xFF0000) >> 16);
375
   spi_flash_Send((ReadAddr & 0xFF0000) >> 16);
376
-  // Send ReadAddr medium nibble address byte to read from
376
+  // Send ReadAddr medium nybble address byte to read from
377
   spi_flash_Send((ReadAddr & 0xFF00) >> 8);
377
   spi_flash_Send((ReadAddr & 0xFF00) >> 8);
378
-  // Send ReadAddr low nibble address byte to read from
378
+  // Send ReadAddr low nybble address byte to read from
379
   spi_flash_Send(ReadAddr & 0xFF);
379
   spi_flash_Send(ReadAddr & 0xFF);
380
 
380
 
381
   if (NumByteToRead <= 32 || !flash_dma_mode) {
381
   if (NumByteToRead <= 32 || !flash_dma_mode) {

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

418
         L("2")
418
         L("2")
419
         A("cpi %16,0x10")                 // (nr & 0xF00000) == 0 ?
419
         A("cpi %16,0x10")                 // (nr & 0xF00000) == 0 ?
420
         A("brcc 3f")                      // No, skip this
420
         A("brcc 3f")                      // No, skip this
421
-        A("swap %15")                     // Swap nibbles
422
-        A("swap %16")                     // Swap nibbles. Low nibble is 0
421
+        A("swap %15")                     // Swap nybbles
422
+        A("swap %16")                     // Swap nybbles. Low nybble is 0
423
         A("mov %14, %15")
423
         A("mov %14, %15")
424
-        A("andi %14,0x0F")                // Isolate low nibble
425
-        A("andi %15,0xF0")                // Keep proper nibble in %15
424
+        A("andi %14,0x0F")                // Isolate low nybble
425
+        A("andi %15,0xF0")                // Keep proper nybble in %15
426
         A("or %16, %14")                  // %16:%15 <<= 4
426
         A("or %16, %14")                  // %16:%15 <<= 4
427
         A("subi %3,-4")                   // idx += 4
427
         A("subi %3,-4")                   // idx += 4
428
 
428
 
473
         L("9")
473
         L("9")
474
         A("sbrs %3,2")                    // shift by 4bits position?
474
         A("sbrs %3,2")                    // shift by 4bits position?
475
         A("rjmp 16f")                     // No
475
         A("rjmp 16f")                     // No
476
-        A("swap %15")                     // Swap nibbles. lo nibble of %15 will always be 0
477
-        A("swap %14")                     // Swap nibbles
476
+        A("swap %15")                     // Swap nybbles. lo nybble of %15 will always be 0
477
+        A("swap %14")                     // Swap nybbles
478
         A("mov %12,%14")
478
         A("mov %12,%14")
479
-        A("andi %12,0x0F")                // isolate low nibble
479
+        A("andi %12,0x0F")                // isolate low nybble
480
         A("andi %14,0xF0")                // and clear it
480
         A("andi %14,0xF0")                // and clear it
481
         A("or %15,%12")                   // %15:%16 <<= 4
481
         A("or %15,%12")                   // %15:%16 <<= 4
482
         L("16")
482
         L("16")
504
         L("11")
504
         L("11")
505
         A("sbrs %3,2")                    // shift by 4 bit position ?
505
         A("sbrs %3,2")                    // shift by 4 bit position ?
506
         A("rjmp 12f")                     // No, skip it
506
         A("rjmp 12f")                     // No, skip it
507
-        A("swap %15")                     // Swap nibbles
508
-        A("andi %14, 0xF0")               // Lose the lowest nibble
509
-        A("swap %14")                     // Swap nibbles. Upper nibble is 0
510
-        A("or %14,%15")                   // Pass nibble from upper byte
511
-        A("andi %15, 0x0F")               // And get rid of that nibble
507
+        A("swap %15")                     // Swap nybbles
508
+        A("andi %14, 0xF0")               // Lose the lowest nybble
509
+        A("swap %14")                     // Swap nybbles. Upper nybble is 0
510
+        A("or %14,%15")                   // Pass nybble from upper byte
511
+        A("andi %15, 0x0F")               // And get rid of that nybble
512
         L("12")
512
         L("12")
513
         A("sbrs %3,3")                    // shift by 8 bit position ?
513
         A("sbrs %3,3")                    // shift by 8 bit position ?
514
         A("rjmp 6f")                      // No, skip it
514
         A("rjmp 6f")                      // No, skip it

+ 6
- 6
Marlin/src/sd/usb_flashdrive/lib-uhs2/printhex.h View File

32
 
32
 
33
 template <class T>
33
 template <class T>
34
 void PrintHex(T val, int lvl) {
34
 void PrintHex(T val, int lvl) {
35
-  int num_nibbles = sizeof (T) * 2;
35
+  int num_nybbles = sizeof (T) * 2;
36
   do {
36
   do {
37
-    char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0F);
37
+    char v = 48 + (((val >> (num_nybbles - 1) * 4)) & 0x0F);
38
     if (v > 57) v += 7;
38
     if (v > 57) v += 7;
39
     E_Notifyc(v, lvl);
39
     E_Notifyc(v, lvl);
40
-  } while (--num_nibbles);
40
+  } while (--num_nybbles);
41
 }
41
 }
42
 
42
 
43
 template <class T>
43
 template <class T>
48
 
48
 
49
 template <class T>
49
 template <class T>
50
 void SerialPrintHex(T val) {
50
 void SerialPrintHex(T val) {
51
-  int num_nibbles = sizeof (T) * 2;
51
+  int num_nybbles = sizeof (T) * 2;
52
   do {
52
   do {
53
-    char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0F);
53
+    char v = 48 + (((val >> (num_nybbles - 1) * 4)) & 0x0F);
54
     if (v > 57) v += 7;
54
     if (v > 57) v += 7;
55
     USB_HOST_SERIAL.print(v);
55
     USB_HOST_SERIAL.print(v);
56
-  } while (--num_nibbles);
56
+  } while (--num_nybbles);
57
 }
57
 }
58
 
58
 
59
 template <class T>
59
 template <class T>

+ 6
- 6
Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/UHS_printhex.h View File

33
 
33
 
34
 template <class T>
34
 template <class T>
35
 void PrintHex(T val, int lvl) {
35
 void PrintHex(T val, int lvl) {
36
-        int num_nibbles = sizeof (T) * 2;
36
+        int num_nybbles = sizeof (T) * 2;
37
 
37
 
38
         do {
38
         do {
39
-                char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0F);
39
+                char v = 48 + (((val >> (num_nybbles - 1) * 4)) & 0x0F);
40
                 if(v > 57) v += 7;
40
                 if(v > 57) v += 7;
41
                 E_Notifyc(v, lvl);
41
                 E_Notifyc(v, lvl);
42
-        } while(--num_nibbles);
42
+        } while(--num_nybbles);
43
 }
43
 }
44
 
44
 
45
 template <class T>
45
 template <class T>
53
 
53
 
54
 template <class T>
54
 template <class T>
55
 void SerialPrintHex(T val) {
55
 void SerialPrintHex(T val) {
56
-        int num_nibbles = sizeof (T) * 2;
56
+        int num_nybbles = sizeof (T) * 2;
57
 
57
 
58
         do {
58
         do {
59
-                char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0F);
59
+                char v = 48 + (((val >> (num_nybbles - 1) * 4)) & 0x0F);
60
                 if(v > 57) v += 7;
60
                 if(v > 57) v += 7;
61
                 USB_HOST_SERIAL.print(v);
61
                 USB_HOST_SERIAL.print(v);
62
-        } while(--num_nibbles);
62
+        } while(--num_nybbles);
63
 }
63
 }
64
 
64
 
65
 template <class T>
65
 template <class T>

+ 3
- 3
Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/USB_HOST_SHIELD_INLINE.h View File

96
 /* GPIO write                                           */
96
 /* GPIO write                                           */
97
 /*GPIO byte is split between 2 registers, so two writes are needed to write one byte */
97
 /*GPIO byte is split between 2 registers, so two writes are needed to write one byte */
98
 
98
 
99
-/* GPOUT bits are in the low nibble. 0-3 in IOPINS1, 4-7 in IOPINS2 */
99
+/* GPOUT bits are in the low nybble. 0-3 in IOPINS1, 4-7 in IOPINS2 */
100
 void UHS_NI MAX3421E_HOST::gpioWr(uint8_t data) {
100
 void UHS_NI MAX3421E_HOST::gpioWr(uint8_t data) {
101
         regWr(rIOPINS1, data);
101
         regWr(rIOPINS1, data);
102
         data >>= 4;
102
         data >>= 4;
132
 
132
 
133
 /* GPIO read. See gpioWr for explanation */
133
 /* GPIO read. See gpioWr for explanation */
134
 
134
 
135
-/* GPIN pins are in high nibbles of IOPINS1, IOPINS2    */
135
+/* GPIN pins are in high nybbles of IOPINS1, IOPINS2    */
136
 uint8_t UHS_NI MAX3421E_HOST::gpioRd() {
136
 uint8_t UHS_NI MAX3421E_HOST::gpioRd() {
137
         uint8_t gpin = 0;
137
         uint8_t gpin = 0;
138
         gpin = regRd(rIOPINS2); //pins 4-7
138
         gpin = regRd(rIOPINS2); //pins 4-7
139
-        gpin &= 0xF0; //clean lower nibble
139
+        gpin &= 0xF0; //clean lower nybble
140
         gpin |= (regRd(rIOPINS1) >> 4); //shift low bits and OR with upper from previous operation.
140
         gpin |= (regRd(rIOPINS1) >> 4); //shift low bits and OR with upper from previous operation.
141
         return ( gpin);
141
         return ( gpin);
142
 }
142
 }

Loading…
Cancel
Save