+ SendCommand(&c);
+ int ret = wait_for_ack(&c);
+ if (ret && c.arg[0]) {
+ uint32_t lock_bits = c.arg[0] >> 16;
+ bool lock_error = c.arg[0] & AT91C_MC_LOCKE;
+ bool prog_error = c.arg[0] & AT91C_MC_PROGE;
+ bool security_bit = c.arg[0] & AT91C_MC_SECURITY;
+ printf("%s", lock_error ? " Lock Error\n" : "");
+ printf("%s", prog_error ? " Invalid Command or bad Keyword\n" : "");
+ printf("%s", security_bit ? " Security Bit is set!\n" : "");
+ printf(" Lock Bits: 0x%04x\n", lock_bits);
+ }
+ return ret;