mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
[PCF7931] refactor SendCmdPCF7931
first steps in understading and optimizing this function. replace != with < - if we don't poll fast enough, it is possible that the condition != is missed.
This commit is contained in:
parent
ea96a3b0c9
commit
8723037e68
2 changed files with 6 additions and 6 deletions
|
@ -555,7 +555,7 @@ void SendCmdPCF7931(const uint32_t *tab, bool ledcontrol) {
|
|||
AT91C_BASE_PMC->PMC_PCER |= (0x1 << AT91C_ID_TC0);
|
||||
AT91C_BASE_TCB->TCB_BMR = AT91C_TCB_TC0XC0S_NONE | AT91C_TCB_TC1XC1S_TIOA0 | AT91C_TCB_TC2XC2S_NONE;
|
||||
AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS; // timer disable
|
||||
AT91C_BASE_TC0->TC_CMR = AT91C_TC_CLKS_TIMER_DIV3_CLOCK; // clock at 48/32 MHz
|
||||
AT91C_BASE_TC0->TC_CMR = AT91C_TC_CLKS_TIMER_DIV3_CLOCK; // clock at 48/32 MHz (48Mhz clock, 32 = prescaler (div3))
|
||||
AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKEN;
|
||||
|
||||
// Assert a sync signal. This sets all timers to 0 on next active clock edge
|
||||
|
@ -565,19 +565,19 @@ void SendCmdPCF7931(const uint32_t *tab, bool ledcontrol) {
|
|||
for (u = 0; tab[u] != 0; u += 3) {
|
||||
// modulate antenna
|
||||
HIGH(GPIO_SSC_DOUT);
|
||||
while (tempo != tab[u]) {
|
||||
while (tempo < tab[u]) {
|
||||
tempo = AT91C_BASE_TC0->TC_CV;
|
||||
}
|
||||
|
||||
// stop modulating antenna
|
||||
LOW(GPIO_SSC_DOUT);
|
||||
while (tempo != tab[u + 1]) {
|
||||
while (tempo < tab[u + 1]) {
|
||||
tempo = AT91C_BASE_TC0->TC_CV;
|
||||
}
|
||||
|
||||
// modulate antenna
|
||||
HIGH(GPIO_SSC_DOUT);
|
||||
while (tempo != tab[u + 2]) {
|
||||
while (tempo < tab[u + 2]) {
|
||||
tempo = AT91C_BASE_TC0->TC_CV;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,8 +105,8 @@ static int CmdLFPCF7931Config(const char *Cmd) {
|
|||
arg_lit0("r", "reset", "Reset configuration to default values"),
|
||||
arg_str0("p", "pwd", "<hex>", "Password, 7bytes, LSB-order"),
|
||||
arg_u64_0("d", "delay", "<dec>", "Tag initialization delay (in us)"),
|
||||
arg_int0(NULL, "lw", "<dec>", "offset, low pulses width (in us)"),
|
||||
arg_int0(NULL, "lp", "<dec>", "offset, low pulses position (in us)"),
|
||||
arg_int0(NULL, "lw", "<dec>", "offset, low pulses width (in us), optional!"),
|
||||
arg_int0(NULL, "lp", "<dec>", "offset, low pulses position (in us), optional!"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue