Commit 9216288c authored by Alessandro Rubini's avatar Alessandro Rubini

timer: define timer_delay_ms(), header minor cleanup

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 6f9c296b
......@@ -8,6 +8,7 @@
#include <hw/memlayout.h>
/* Board-specific parameters */
#define TICS_PER_SECOND 1000
/* WR Core system/CPU clock frequency in Hz */
#define CPU_CLOCK 62500000ULL
......
#ifndef __BOARD_H
#define __BOARD_H
/* RT CPU Memory layout */
#define TICS_PER_SECOND 100000
#define CPU_CLOCK 62500000
#define REF_CLOCK_FREQ_HZ 62500000
......@@ -9,6 +9,7 @@
#define UART_BAUDRATE 115200
/* RT CPU Memory layout */
#define BASE_UART 0x10000
#define BASE_SOFTPLL 0x10100
#define BASE_SPI 0x10200
......
......@@ -3,17 +3,20 @@
#include <inttypes.h>
#include <sys/types.h>
#ifdef CONFIG_WR_SWITCH
#define TICS_PER_SECOND 100000
#include "board.h"
uint32_t timer_get_tics(void);
void timer_delay(uint32_t tics);
#else /* CONFIG_WR_NODE */
/* This can be used for up to 2^32 / TICS_PER_SECONDS == 42 seconds in wrs */
static inline void timer_delay_ms(int ms)
{
timer_delay(ms * TICS_PER_SECOND / 1000);
}
#ifdef CONFIG_WR_NODE
#include "board.h"
#undef PACKED /* if we already included a regs file, we'd get a warning */
#include <hw/wrc_syscon_regs.h>
......@@ -43,10 +46,7 @@ struct s_i2c_if {
extern struct s_i2c_if i2c_if[2];
#define TICS_PER_SECOND 1000
void timer_init(uint32_t enable);
uint32_t timer_get_tics(void);
void timer_delay(uint32_t tics);
/* usleep.c */
extern void usleep_init(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment