- endianess fixes everywhere but in the flash code. flashing might still be broken...
[openocd.git] / src / flash / at91sam7.c
index 59ed2aa08a9afa6bf46c7048430b80beb38c3b78..dd8bdeb5e1c354b4f8dcccbb08bb1c189fc0d9a9 100644 (file)
@@ -133,9 +133,10 @@ u32 at91sam7_get_flash_status(flash_bank_t *bank)
 {
        at91sam7_flash_bank_t *at91sam7_info = bank->driver_priv;
        target_t *target = at91sam7_info->target;
-       long fsr;
+       u32 fsr;
        
        target->type->read_memory(target, MC_FSR, 4, 1, (u8 *)&fsr);
+       fsr = target_buffer_get_u32(target, (u8 *)&fsr);
        
        return fsr;
 }
@@ -206,7 +207,7 @@ void at91sam7_read_clock_info(flash_bank_t *bank)
 /* Setup the timimg registers for nvbits or normal flash */
 void at91sam7_set_flash_mode(flash_bank_t *bank,int mode)
 {
-       u32 fmcn, fmr;
+       u32 fmr, fmcn = 0, fws = 0;
        at91sam7_flash_bank_t *at91sam7_info = bank->driver_priv;
        target_t *target = at91sam7_info->target;
        
@@ -220,12 +221,14 @@ void at91sam7_set_flash_mode(flash_bank_t *bank,int mode)
                        fmcn = (at91sam7_info->mck_freq/666666ul)+1;
 
                /* Only allow fmcn=0 if clock period is > 30 us. */
-               if (at91sam7_info->mck_freq <= 33333)
+               if (at91sam7_info->mck_freq <= 33333333ul)
                        fmcn = 0;
+               else
+                       fws = 1;
 
                DEBUG("fmcn: %i", fmcn); 
-               fmr = fmcn<<16;
-               target->type->write_memory(target, MC_FSR, 4, 1, (u8 *)&fmr);
+               fmr = fmcn << 16 | fws << 8;
+               target->type->write_memory(target, MC_FMR, 4, 1, (u8 *)&fmr);
        }
        at91sam7_info->flashmode = mode;                
 }

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)