Skip to content

Commit

Permalink
Fix thumb16 again
Browse files Browse the repository at this point in the history
  • Loading branch information
felixjones committed Dec 10, 2023
1 parent b878b2d commit 03c0fdc
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions source/rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,12 @@ static void rtc_cmd_arg(const unsigned int cmd, unsigned int data, unsigned int
assume(len > 0 && len <= 32);
rtc_write(data, len);

int wait = (TIMEOUT_CYCLES_WAIT_AFTER_WRITE_PER_BYTE * 7 + 11 + 6) / 12;
__asm__ volatile (
"L1%=: subs %[wait], #1" "\n\t"
"bne L1%="
:: [wait]"l"(((TIMEOUT_CYCLES_WAIT_AFTER_WRITE_PER_BYTE * len + 7) / 8 + 11 + 6) / 12)
"L1%=:" "\n\t"
"subs %[wait], %[wait], #1" "\n\t"
"bne L1%="
:: [wait]"r"(wait)
);
}

Expand All @@ -159,10 +161,12 @@ static void rtc_cmd_arg_datetime(unsigned int cmd, __agbabi_datetime_t datetime,
rtc_write(date, 32);
rtc_write(time, 24);

int wait = (TIMEOUT_CYCLES_WAIT_AFTER_WRITE_PER_BYTE * 7 + 11 + 6) / 12;
__asm__ volatile (
"L1%=: subs %[wait], #1" "\n\t"
"bne L1%="
:: [wait]"l"((TIMEOUT_CYCLES_WAIT_AFTER_WRITE_PER_BYTE * 7 + 11 + 6) / 12)
"L1%=:" "\n\t"
"subs %[wait], %[wait], #1" "\n\t"
"bne L1%="
:: [wait]"r"(wait)
);
}

Expand Down

0 comments on commit 03c0fdc

Please sign in to comment.