mirror of
https://github.com/taubel/sdk-ameba-v4.0b-gcc.git
synced 2026-07-05 10:55:43 +00:00
initial commit
This commit is contained in:
commit
60a7afcc83
2528 changed files with 1001987 additions and 0 deletions
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
|
||||
.PHONY: all copy clean
|
||||
|
||||
#*****************************************************************************#
|
||||
# Source FILE LIST #
|
||||
#*****************************************************************************#
|
||||
CSRC = src inc
|
||||
|
||||
|
||||
|
||||
#*****************************************************************************#
|
||||
# RULES TO GENERATE TARGETS #
|
||||
#*****************************************************************************#
|
||||
|
||||
# Define the Rules to build the core targets
|
||||
all: copy
|
||||
copy:
|
||||
for cpf in $(CSRC); do \
|
||||
cp -rf $$cpf ../..; \
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
Example Description
|
||||
|
||||
This example describes how to use watchdog api.
|
||||
|
||||
Requirement Components: None
|
||||
|
||||
In this example, watchdog is setup to 5s timeout.
|
||||
Watchdog won't bark if we refresh it before timeout.
|
||||
The timer is also reloaded after refresh.
|
||||
Otherwise it will restart system in default or call callback function if registered.
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
|
||||
include $(MAKE_INCLUDE_GEN)
|
||||
#include ./Makefile.inc
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
CHIP = rtl8195a
|
||||
HALINCDIR = realtek/v3_0/include
|
||||
|
||||
MODULE_IFLAGS += -I$(shell pwd -L)/../inc
|
||||
MODULE_IFLAGS += -I$(SWLIBDIR)/api
|
||||
MODULE_IFLAGS += -I$(SWLIBDIR)/api/mbed/hal/
|
||||
MODULE_IFLAGS += -I$(SWLIBDIR)/api/mbed/api/
|
||||
MODULE_IFLAGS += -I$(SWLIBDIR)/drivers/targets/cmsis/rtl8195a/
|
||||
MODULE_IFLAGS += -I$(SWLIBDIR)/drivers/targets/hal/rtl8195a/
|
||||
|
||||
GLOBAL_CFLAGS += -DCONFIG_PLATFORM_8195A
|
||||
#*****************************************************************************#
|
||||
# Source FILE LIST #
|
||||
#*****************************************************************************#
|
||||
CSRC += main.c
|
||||
|
||||
|
||||
#*****************************************************************************#
|
||||
# Object FILE LIST #
|
||||
#*****************************************************************************#
|
||||
OBJS = $(CSRC:.c=.o)
|
||||
|
||||
|
||||
#*****************************************************************************#
|
||||
# Object FILE LIST #
|
||||
#*****************************************************************************#
|
||||
#OBJS = monitor.o rtl_consol.o
|
||||
|
||||
#*****************************************************************************#
|
||||
# RULES TO GENERATE TARGETS #
|
||||
#*****************************************************************************#
|
||||
|
||||
# Define the Rules to build the core targets
|
||||
all: CORE_TARGETS COPY_RAM_OBJS
|
||||
|
||||
#*****************************************************************************#
|
||||
# GENERATE OBJECT FILE
|
||||
#*****************************************************************************#
|
||||
CORE_TARGETS: $(OBJS)
|
||||
|
||||
|
||||
#*****************************************************************************#
|
||||
# GENERATE OBJECT FILE
|
||||
#*****************************************************************************#
|
||||
clean:
|
||||
rm -f $(CSRC:.c=.o) $(CSRC:.c=.d) $(CSRC:.c=.i) $(CSRC:.c=.s)
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Routines to access hardware
|
||||
*
|
||||
* Copyright (c) 2015 Realtek Semiconductor Corp.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
*/
|
||||
|
||||
#include "device.h"
|
||||
#include "diag.h"
|
||||
#include "main.h"
|
||||
|
||||
#include "wdt_api.h"
|
||||
|
||||
#define RUN_CALLBACK_IF_WATCHDOG_BARKS (0)
|
||||
#define printf DBG_8195A
|
||||
|
||||
void dummy_task() {
|
||||
int i=0;
|
||||
for (i=0; i<50000000; i++)
|
||||
asm(" nop");
|
||||
}
|
||||
|
||||
void small_task() {
|
||||
printf("\r\ndoing small task...\r\n");
|
||||
dummy_task();
|
||||
printf("refresh watchdog\r\n\r\n");
|
||||
watchdog_refresh();
|
||||
}
|
||||
|
||||
void big_task() {
|
||||
int i=0;
|
||||
printf("\r\ndoing big task...\r\n");
|
||||
for (i=0; i<10; i++) {
|
||||
DiagPrintf("doing dummy task %d\r\n", i);
|
||||
dummy_task();
|
||||
}
|
||||
printf("refresh watchdog\r\n\r\n");
|
||||
watchdog_refresh();
|
||||
}
|
||||
|
||||
void my_watchdog_irq_handler(uint32_t id) {
|
||||
printf("watchdog barks!!!\r\n");
|
||||
watchdog_stop();
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
|
||||
watchdog_init(5000); // setup 5s watchdog
|
||||
|
||||
#if RUN_CALLBACK_IF_WATCHDOG_BARKS
|
||||
watchdog_irq_init(my_watchdog_irq_handler, 0);
|
||||
#else
|
||||
// system would restart when watchdog barks
|
||||
#endif
|
||||
|
||||
watchdog_start();
|
||||
|
||||
small_task();
|
||||
big_task();
|
||||
|
||||
while(1);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue