sdk: examples: remove machine_timer

Signed-off-by: liangkangnan <liangkangnan@163.com>
pull/4/head
liangkangnan 2021-08-10 11:30:08 +08:00
parent 79f83c1ad4
commit 0437ff99da
4 changed files with 0 additions and 87 deletions

View File

@ -1,8 +0,0 @@
# Object files
*.o
*.ko
*.obj
*.bin
*.dump
*.mem
machine_timer

View File

@ -1,20 +0,0 @@
RISCV_ARCH := rv32im
RISCV_ABI := ilp32
RISCV_MCMODEL := medlow
TARGET = machine_timer
CFLAGS += -DSIMULATION
#CFLAGS += -Os
#ASM_SRCS +=
#LDFLAGS +=
#INCLUDES += -I.
C_SRCS := \
main.c \
BSP_DIR = ../../bsp
include ../../bsp/bsp.mk

View File

@ -1 +0,0 @@
机器定时器(中断)例程。

View File

@ -1,58 +0,0 @@
#include <stdint.h>
#include "../../bsp/include/machine_timer.h"
#include "../../bsp/include/utils.h"
#include "../../bsp/include/rvic.h"
#include "../../bsp/include/gpio.h"
static volatile uint32_t count;
int main()
{
count = 0;
#ifdef SIMULATION
machine_timer_set_cmp_val(5000); // 100us period
machine_timer_clear_irq_pending();
global_irq_enable();
machine_timer_irq_enable(1);
rvic_irq_enable(0);
machine_timer_enable(1);
while (1) {
if (count == 3) {
machine_timer_enable(0);
// TODO: do something
set_test_pass();
break;
}
}
return 0;
#else
machine_timer_set_cmp_val(CPU_FREQ_MHZ * 10000); // 10ms period
machine_timer_clear_irq_pending();
global_irq_enable();
machine_timer_irq_enable(1);
rvic_irq_enable(0);
machine_timer_enable(1);
gpio_output_enable(GPIO0);
while (1) {
// 500ms
if (count == 50) {
count = 0;
gpio_data_toggle(GPIO0); // toggle led
}
}
#endif
}
void timer_irq_handler()
{
count++;
machine_timer_clear_irq_pending();
rvic_clear_irq_pending(0);
}