55 lines
1.1 KiB
C
Executable file
55 lines
1.1 KiB
C
Executable file
#pragma once
|
|
|
|
/************************************************************
|
|
|
|
hwo/systick.h
|
|
|
|
define systick methods for generating periodic events
|
|
used by...
|
|
-multithreading environment
|
|
-user defined event
|
|
|
|
uses timer0 for generating ticks
|
|
|
|
************************************************************/
|
|
|
|
#include <sys/systick.h>
|
|
|
|
#if 0
|
|
|
|
#include <stdint.h>
|
|
#include <cpu/systick.h>
|
|
|
|
typedef uint32_t systick_t;
|
|
|
|
struct avr_wait
|
|
{
|
|
systick_t target;
|
|
};
|
|
typedef struct avr_wait avrWAIT;
|
|
|
|
typedef void (*systick_handler)(systick_t ticks);
|
|
|
|
extern volatile uint32_t _systick_secs; // system uptime in [s]
|
|
extern volatile systick_t _systick_ticks; // system uptime in [us]
|
|
|
|
void systick_init(systick_t systick_us);
|
|
void systick(void);
|
|
void systick_set_us(systick_t tickus);
|
|
|
|
systick_t systick_ticks(void);
|
|
uint32_t systick_secs(void);
|
|
|
|
void systick_set_handler(systick_handler handler);
|
|
void systick_set_handler_sec(systick_handler handler);
|
|
|
|
void wait_ms(systick_t ms);
|
|
|
|
void wait_async_set(avrWAIT* wait,systick_t us);
|
|
uint8_t wait_async_test(avrWAIT* wait);
|
|
|
|
*
|
|
/* Interface to CPU Low Level Routines */
|
|
void systick_timer_init(uint32_t systick_us);
|
|
|
|
#endif
|