initial commit

This commit is contained in:
Tautvydas Belgeras 2018-06-05 16:16:17 +03:00
commit 60a7afcc83
2528 changed files with 1001987 additions and 0 deletions

View file

@ -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)

View file

@ -0,0 +1,71 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 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 "gpio_api.h" // mbed
#include "timer_api.h"
#include "main.h"
#define GPIO_LED_PIN1 _PA_23
#define GPIO_LED_PIN2 _PA_12
/**
* @brief Main program.
* @param None
* @retval None
*/
//int main_app(IN u16 argc, IN u8 *argv[])
gtimer_t my_timer1;
gtimer_t my_timer2;
gpio_t gpio_led1;
gpio_t gpio_led2;
volatile uint32_t time2_expired=0;
void timer1_timeout_handler(uint32_t id)
{
gpio_t *gpio_led = (gpio_t *)id;
gpio_write(gpio_led, !gpio_read(gpio_led));
}
void timer2_timeout_handler(uint32_t id)
{
time2_expired = 1;
}
void main(void)
{
// Init LED control pin
gpio_init(&gpio_led1, GPIO_LED_PIN1);
gpio_dir(&gpio_led1, PIN_OUTPUT); // Direction: Output
gpio_mode(&gpio_led1, PullNone); // No pull
gpio_init(&gpio_led2, GPIO_LED_PIN2);
gpio_dir(&gpio_led2, PIN_OUTPUT); // Direction: Output
gpio_mode(&gpio_led2, PullNone); // No pull
// Initial a periodical timer
gtimer_init(&my_timer1, TIMER2);
gtimer_start_periodical(&my_timer1, 1000000, (void*)timer1_timeout_handler, (uint32_t)&gpio_led1);
// Initial a one-shout timer and re-trigger it in while loop
gtimer_init(&my_timer2, TIMER3);
time2_expired = 0;
gtimer_start_one_shout(&my_timer2, 500000, (void*)timer2_timeout_handler, NULL);
while(1){
if (time2_expired) {
gpio_write(&gpio_led2, !gpio_read(&gpio_led2));
time2_expired = 0;
gtimer_start_one_shout(&my_timer2, 500000, (void*)timer2_timeout_handler, NULL);
}
}
}