rfdsatt: use librfn/time.h instead of own systick handler

This commit is contained in:
Harald Welte 2021-04-11 16:24:33 +02:00
parent f9b2ca10b4
commit 3af30f0a6a
3 changed files with 14 additions and 15 deletions

View File

@ -7,7 +7,15 @@ $(info Using $(LIBRFN_DIR) path to librfn library)
endif
OBJS += \
ringbuf.o
bitops.o \
fibre.o \
fibre_default.o \
list.o \
messageq.o \
regdump.o \
ringbuf.o \
time_libopencm3.o \
util.o
vpath %.c $(LIBRFN_DIR)/librfn
vpath %.c $(LIBRFN_DIR)/librfn/libopencm3

View File

@ -30,7 +30,7 @@ OBJS = attenuator.o board_rfdsatt_4ch.o
LDSCRIPT = ./stm32f103-openblt.ld
LIBNAME = opencm3_stm32f1
DEFS += -DSTM32F1
DEFS += -DSTM32F1 -DF_CPU=48000000
FP_FLAGS ?= -msoft-float
ARCH_FLAGS = -mthumb -mcpu=cortex-m3 $(FP_FLAGS) -mfix-cortex-m3-ldrd

View File

@ -26,6 +26,8 @@
#include <libopencm3/cm3/scb.h>
#include <libopencm3/cm3/systick.h>
#include <librfn/time.h>
#include <libcommon/iob.h>
#include <libcommon/microvty.h>
@ -40,19 +42,12 @@ static uint32_t last_reset_cause;
extern const struct attenuator_cfg board_att_cfg;
extern struct attenuator_state *board_att_st[];
volatile uint32_t jiffies;
void sys_tick_handler(void)
{
jiffies++;
}
/* busy wait specified number of ms */
void msleep(uint32_t delay)
{
uint32_t wake = jiffies + delay;
uint32_t wake = time_now() + delay;
do {
} while (wake > jiffies);
} while (wake > time_now());
}
/***********************************************************************
@ -65,10 +60,6 @@ static void clock_setup(void)
/* HCLK=48MHz; ADC=6MHz; APB1=24MHz; APB2=48MHz; USB=48MHz */
/* tick rate of 1ms */
systick_set_reload(48000);
systick_set_clocksource(STK_CSR_CLKSOURCE_AHB);
systick_counter_enable();
systick_interrupt_enable();
/* Enable GPIOC clock. */
rcc_periph_clock_enable(RCC_GPIOA);