Commit graph

37 commits

Author SHA1 Message Date
Philippe Teuwen
b703bb746b Adapting license headers, WIP 2022-01-06 02:20:38 +01:00
Philippe Teuwen
5b54385347 rename globals 2021-08-21 23:08:26 +02:00
iceman1001
b993236be2 send sync signal to clock when reset 2021-06-24 17:20:48 +02:00
iceman1001
0c54d13c47 added a precision timer ( 0.6ns for 43ms) 2020-10-09 14:30:34 +02:00
Philippe Teuwen
4ed57c7c4d make style 2020-08-13 12:25:04 +02:00
iceman1001
2f4335d31e chg: ssp clock changes 2020-07-02 12:33:23 +02:00
Philippe Teuwen
98d641dba5 WaitUS/WaitMS: accept uint32_t 2019-10-09 12:06:45 +02:00
iceman1001
ffa3e2a0f8 style 2019-09-13 16:25:33 +02:00
iceman1001
ff66ea896b ssp clock delta 2019-09-11 15:16:20 +02:00
Philippe Teuwen
d19754567d summer restructuring:
* .h include only the strict minimum for their own parsing
  * this forces all files to include explicitment their needs and not count on far streched dependencies
  * this helps Makefile to rebuild only the minimum
  * according to this rule, most standalone .h are now gone
  * big app.h is gone
  * remove seldom __cplusplus, if c++ happens, everything will have to be done properly anyway
* all unrequired include were removed
* split common/ into common/ (client+arm) and common_arm/ (os+bootloader)
  * bring zlib to common/
  * bring stuff not really/not yet used in common back to armsrc/ or client/
  * bring liblua into client/
  * bring uart into client/
  * move some portions of code around (dbprint, protocols,...)
* rename unused files into *_disabled.[ch] to make it explicit
* rename soft Uarts between 14a, 14b and iclass, so a standalone could use several without clash
* remove PrintAndLogDevice
* move deprecated-hid-flasher from client to tools
* Makefiles
  * treat deps in armsrc/ as in client/
  * client: stop on warning (-Werror), same as for armsrc/

Tested on:

* all standalone modes
* Linux
2019-08-11 21:42:01 +02:00
Philippe Teuwen
80941ed9e1 Remove comments 2019-08-07 00:02:00 +02:00
Philippe Teuwen
9f8e63a7c8 print errors only if dbg level allows errors 2019-08-06 23:19:59 +02:00
Philippe Teuwen
650dd5855f ok it seems PMW CNTR is not reset as promised in the datasheet, let's fix this for now... 2019-08-06 23:10:02 +02:00
Philippe Teuwen
0f9880b18f cleaning 2019-08-06 13:52:03 +02:00
Philippe Teuwen
1354aec556 typos 2019-08-06 13:51:10 +02:00
Philippe Teuwen
8b3159c83d Use more defines when using main clock or master clock 2019-08-06 13:40:08 +02:00
Philippe Teuwen
2cbe43f269 clarifications and minor changes in slow clock related operations:
* SpinDelay and SpinDelayUs: now rounding applies instead of truncating
* Document maximum duration of SpinDelay/SpinDelayUs/BUTTON_CLICK/BUTTON_HELD
* Add argument check against max duration in SpinDelay/BUTTON_CLICK/BUTTON_HELD
* Document why these functions don't need to take wrapping into acount as in GetTickCountDelta
* Use >= in the spinning loops
* Clarify StartTickCount calibration operations and use masks AT91C_CKGR_MAINRDY and AT91C_RTTC_RTPRES
2019-08-06 13:09:48 +02:00
Colin J. Brigato
b4e004abc2
Off by one in GetTickCountDelta (FIXes #301)
FIXes #301 and prevent a `-1`aka`UINT_MAX` delta.
2019-08-01 01:56:30 +02:00
Philippe Teuwen
e0c9e2b0d1 rework usart RX timings 2019-05-22 23:30:52 +02:00
Philippe Teuwen
961d929f4d changing {} style to match majority of previous style 2019-03-10 11:20:22 +01:00
Philippe Teuwen
0373696662 make style 2019-03-10 00:00:59 +01:00
Philippe Teuwen
8a7c6825b5 armsrc: fix mix of spaces & tabs 2019-03-09 20:34:41 +01:00
Philippe Teuwen
60f292b18e remove spurious spaces & tabs at end of lines 2019-03-09 08:59:13 +01:00
Andreas Dröscher
9d330dde87 fix: 32bit tick timer based on TC0 and TC1
TC1 counts the number of TC0 overflows (carry bits).
In random conditions TC1 would return or stay at zero,
instead of counting up. This due to the behavior of the
reset signal.

SAM7S Series Datasheet, 33.5.6 Trigger:
Regardless of the trigger used, it will be taken into account
at the following active edge of the selected clock. This means
that the counter value can be read differently from zero just
after a trigger, especially when a low frequency signal is
selected as the clock.

The new code first prepares TC1 and asserts TC1 trigger and
then prepares TC0 and asserts TC0 trigger. The TC0 start-up
will reset TC1.
2018-08-12 12:41:11 +02:00
iceman1001
c082531110 fix: potential implicit type cast issue (Thanks to @drandreas for pointing it out) 2018-07-29 18:20:39 +02:00
Chris
afeb0d0cd7 fix: removes unneeded floating point lib inclusion (@piwi) 2018-07-23 21:02:13 +02:00
iceman1001
a615fd6a9e chg: smartcard , testing to use pwm clock instead of timer clock.
chg: added some comments
2018-04-16 19:58:49 +02:00
iceman1001
701ad7cb3a chg: syntax sugar 2017-01-11 23:11:55 +01:00
iceman1001
8fd0a564e5 CHG: removed unused clocks,
CHG: now uses the DEFINEs instead. a bit clear
CHG: xor in the clocks,  should allow for co-exist with SSP clock.
2016-10-19 21:26:29 +02:00
iceman1001
d41efbf21b ADD: added a StopTicks functions, to disable the timer used for ticks (TC0, TC1) 2016-10-07 00:13:09 +02:00
iceman1001
c649c43389 CHG: finally, the ticks timer does what it is supposed to do. 32bits and working. 2016-09-29 21:36:43 +02:00
iceman1001
fabef615ec CHG: added addresize to legic select struct.
CHG: TIMER, it turns out the TC0, TC1 and TC2 is only 16bit.  So adjust to use two clocks to get a 32bit timer.
CHG: code clean up in legic device side.  consistency with variable names..
2016-09-29 17:43:39 +02:00
iceman1001
d7e24e7c5f CHG: 'hf list legic' doesn't print the parity now.
CHG: 'hf legic read' the device side timings is starting to look much better. HUGE Thanks to @will-rbnt for endless checks and logic analyser feedback. Without his effort this would not work. What does work? We can now use ANY IV in legic. The PM3 Master version is flawed, will only work with IV=0x55.

---still broke--- my crc implementation.. I know I'm about to look into it.
2016-09-28 21:37:08 +02:00
iceman1001
d5bded10e2 CHG: lowered the timout again, but re-added the spindelay since 14a requires 5ms powerup before entering the idle-state where tag starts to listen.
CHG: fix the ticks compare xx > 1 into  xx >= 1
2016-09-23 23:23:17 +02:00
iceman1001
f885043422 FIX: "hf 14a read" / "hf mf *" / "hf mfdes info" and failure when calling these commands serveral times in row.
For long transactions the sspclock compare with >1 instead of >=1 ..   Now the timer resets properly.
CHG: use some #define constants for iso-commands.
2016-09-23 21:28:07 +02:00
iceman1001
24c49d36ba FIX: This commit fixes the broken LF since I change the spindelay calls. The original problem is that spindelayus calls is incremented with21.3us each step, making it very hard to find exact timings found in the datasheets for T55x7, HID etcetc. When @marshmellow and I looked into this 2014, I had this on my back of my mind but forgot it since I didn't know how the source code / pm3 worked. This behavior in spindelayus has given the bit-period for ON/OFF measured in (us) very hard to find. Its kind of magic that it worked so far so good. Well until I started to look into the "hf legic" bitbanging ASK ON/OFF keying and that one needs a much more precis timer. Same goes for the PCF7931 code.
I've added a precise timer in the new files ticks.c and moved some older stuff from util.c to have a solid base for this.
UNTESTED,  and the timings measured for t55x7 in lfops.c and other parts has not been adjusted to this "correct" timer.
2016-09-23 16:35:26 +02:00
iceman1001
22f4dca88c CHG: extracted some timers functionality, to get unified access to a timer/clock which counts in ticks. Moved stuff from util.c 2016-09-21 19:03:32 +02:00