canbus: Move canbus uuid calculation to canbus.c

Move the uuid hash calculation to canbus.c and call canbus_set_uuid()
from src/stm32/chipid.c .  This simplifies the low-level canbus
hardware code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2022-06-12 11:55:46 -04:00
parent 3f7d05dd18
commit fc7838855f
7 changed files with 21 additions and 25 deletions

View File

@@ -10,7 +10,6 @@
#include "autoconf.h" // CONFIG_MACH_STM32F1
#include "board/irq.h" // irq_disable
#include "command.h" // DECL_CONSTANT_STR
#include "fasthash.h" // fasthash64
#include "generic/armcm_boot.h" // armcm_enable_irq
#include "generic/canbus.h" // canbus_notify_tx
#include "internal.h" // enable_pclock
@@ -272,9 +271,5 @@ can_init(void)
if (CAN_RX0_IRQn != CAN_TX_IRQn)
armcm_enable_irq(CAN_IRQHandler, CAN_TX_IRQn, 0);
SOC_CAN->IER = CAN_IER_FMPIE0;
// Convert unique 96-bit chip id into 48 bit representation
uint64_t hash = fasthash64((uint8_t*)UID_BASE, 12, 0xA16231A7);
canbus_set_uuid(&hash);
}
DECL_INIT(can_init);