move nand drivers to src/flash/nand/
[openocd.git] / src / flash / nand_ecc.c
index 91dd8c6b8f44f3c6eef299bb7d255856b92266c8..7aa1519dde8fd07c9b2876f7fe38f6c29824f5f3 100644 (file)
 #include "config.h"
 #endif
 
-#include "replacements.h"
-
-#include <inttypes.h>
-
 #include "nand.h"
 
 /*
  * Pre-calculated 256-way 1 byte column parity
  */
-static const u8 nand_ecc_precalc_table[] = {
+static const uint8_t nand_ecc_precalc_table[] = {
        0x00, 0x55, 0x56, 0x03, 0x59, 0x0c, 0x0f, 0x5a, 0x5a, 0x0f, 0x0c, 0x59, 0x03, 0x56, 0x55, 0x00,
        0x65, 0x30, 0x33, 0x66, 0x3c, 0x69, 0x6a, 0x3f, 0x3f, 0x6a, 0x69, 0x3c, 0x66, 0x33, 0x30, 0x65,
        0x66, 0x33, 0x30, 0x65, 0x3f, 0x6a, 0x69, 0x3c, 0x3c, 0x69, 0x6a, 0x3f, 0x65, 0x30, 0x33, 0x66,
@@ -72,24 +68,24 @@ static const u8 nand_ecc_precalc_table[] = {
 /*
  * nand_calculate_ecc - Calculate 3-byte ECC for 256-byte block
  */
-int nand_calculate_ecc(struct nand_device_s *device, const u8 *dat, u8 *ecc_code)
+int nand_calculate_ecc(struct nand_device *nand, const uint8_t *dat, uint8_t *ecc_code)
 {
-       u8 idx, reg1, reg2, reg3, tmp1, tmp2;
+       uint8_t idx, reg1, reg2, reg3, tmp1, tmp2;
        int i;
 
        /* Initialize variables */
        reg1 = reg2 = reg3 = 0;
 
        /* Build up column parity */
-       for(i = 0; i < 256; i++) {
+       for (i = 0; i < 256; i++) {
                /* Get CP0 - CP5 from table */
                idx = nand_ecc_precalc_table[*dat++];
                reg1 ^= (idx & 0x3f);
 
                /* All bit XOR = 1 ? */
                if (idx & 0x40) {
-                       reg3 ^= (u8) i;
-                       reg2 ^= ~((u8) i);
+                       reg3 ^= (uint8_t) i;
+                       reg2 ^= ~((uint8_t) i);
                }
        }
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)