1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #16221 from maribu/ptp-fix

cpu/stm32/periph_ptp: bugfix & better debug output
This commit is contained in:
Marian Buschsieweke 2021-03-25 17:23:19 +01:00 committed by GitHub
commit 80e14e88a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -71,9 +71,9 @@ void isr_eth(void)
if (IS_USED(MODULE_PERIPH_PTP_TIMER)) {
if (ETH->MACSR & ETH_MACSR_TSTS) {
ptp_timer_cb();
/* clear interrupt by reading PTPTSSR */
(void)ETH->PTPTSSR;
ptp_timer_cb();
}
}

View File

@ -29,7 +29,8 @@
#include "periph_cpu.h"
#include "timex.h"
#define ENABLE_DEBUG 0
#define ENABLE_DEBUG 0
#define DEBUG_VERBOSE 0
#include "debug.h"
/* Workaround for typos in vendor files; drop when fixed upstream */
@ -198,7 +199,7 @@ void ptp_timer_clear(void)
void ptp_timer_set_absolute(const ptp_timestamp_t *target)
{
assert(target);
DEBUG("[periph_ptp] Set timer: %" PRIu32 ".%" PRIu32 "\n",
DEBUG("[periph_ptp] Set timer: %" PRIu32 ".%09" PRIu32 "\n",
(uint32_t)target->seconds, target->nanoseconds);
unsigned state = irq_disable();
/* Mask PTP timer IRQ first, so that an interrupt is not triggered
@ -212,7 +213,9 @@ void ptp_timer_set_absolute(const ptp_timestamp_t *target)
/* Unmask the time stamp trigger interrupt */
ETH->MACIMR &= ~ETH_MACIMR_TSTIM;
irq_restore(state);
DEBUG("PTPTSCR: 0x%08x, MACIMR: 0x%08x, MACSR: 0x%08x\n",
(unsigned)ETH->PTPTSCR, (unsigned)ETH->MACIMR, (unsigned)ETH->MACSR);
if (IS_ACTIVE(DEBUG_VERBOSE)) {
DEBUG("PTPTSCR: 0x%08x, MACIMR: 0x%08x, MACSR: 0x%08x\n",
(unsigned)ETH->PTPTSCR, (unsigned)ETH->MACIMR, (unsigned)ETH->MACSR);
}
}
#endif /* IS_USED(MODULE_PTP_TIMER) */