mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-07 00:59:00 +08:00
[fh8620] auto formatted
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -27,18 +27,18 @@
|
||||
|
||||
void init_thread(void *parameter)
|
||||
{
|
||||
rt_components_init();
|
||||
rt_components_init();
|
||||
|
||||
return ;
|
||||
return ;
|
||||
}
|
||||
|
||||
int rt_application_init(void)
|
||||
{
|
||||
rt_thread_t tid;
|
||||
rt_thread_t tid;
|
||||
|
||||
tid = rt_thread_create("init", init_thread, RT_NULL,
|
||||
4096, RT_THREAD_PRIORITY_MAX/3, 20);
|
||||
if (tid) rt_thread_startup(tid);
|
||||
tid = rt_thread_create("init", init_thread, RT_NULL,
|
||||
4096, RT_THREAD_PRIORITY_MAX/3, 20);
|
||||
if (tid) rt_thread_startup(tid);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
+68
-68
File diff suppressed because it is too large
Load Diff
+123
-123
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Include Section
|
||||
* add all #include here
|
||||
@@ -88,7 +88,7 @@ static rt_err_t rt_dma_control(struct rt_device *dev,
|
||||
*****************************************************************************/
|
||||
static rt_err_t rt_dma_init(struct rt_device *dev)
|
||||
{
|
||||
struct rt_dma_device *dma;
|
||||
struct rt_dma_device *dma;
|
||||
|
||||
RT_ASSERT(dev != RT_NULL);
|
||||
dma = (struct rt_dma_device *)dev;
|
||||
@@ -107,7 +107,7 @@ static rt_err_t rt_dma_open(struct rt_device *dev, rt_uint16_t oflag)
|
||||
|
||||
static rt_err_t rt_dma_close(struct rt_device *dev)
|
||||
{
|
||||
struct rt_dma_device *dma;
|
||||
struct rt_dma_device *dma;
|
||||
|
||||
RT_ASSERT(dev != RT_NULL);
|
||||
dma = (struct rt_dma_device *)dev;
|
||||
@@ -124,7 +124,7 @@ static rt_err_t rt_dma_control(struct rt_device *dev,
|
||||
rt_uint8_t cmd,
|
||||
void *args)
|
||||
{
|
||||
struct rt_dma_device *dma;
|
||||
struct rt_dma_device *dma;
|
||||
|
||||
RT_ASSERT(dev != RT_NULL);
|
||||
dma = (struct rt_dma_device *)dev;
|
||||
@@ -141,7 +141,7 @@ rt_err_t rt_hw_dma_register(struct rt_dma_device *dma,
|
||||
rt_uint32_t flag,
|
||||
void *data)
|
||||
{
|
||||
rt_uint32_t ret;
|
||||
rt_uint32_t ret;
|
||||
struct rt_device *device;
|
||||
RT_ASSERT(dma != RT_NULL);
|
||||
|
||||
|
||||
+18
-18
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -29,31 +29,31 @@
|
||||
#include <rtthread.h>
|
||||
/****************************************************************************
|
||||
* #include section
|
||||
* add #include here if any
|
||||
* add #include here if any
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* #define section
|
||||
* add constant #define here if any
|
||||
* add constant #define here if any
|
||||
***************************************************************************/
|
||||
#define RT_DEVICE_CTRL_DMA_OPEN (1)
|
||||
#define RT_DEVICE_CTRL_DMA_CLOSE (2)
|
||||
#define RT_DEVICE_CTRL_DMA_REQUEST_CHANNEL (3)
|
||||
#define RT_DEVICE_CTRL_DMA_RELEASE_CHANNEL (4)
|
||||
#define RT_DEVICE_CTRL_DMA_SINGLE_TRANSFER (5)
|
||||
#define RT_DEVICE_CTRL_DMA_OPEN (1)
|
||||
#define RT_DEVICE_CTRL_DMA_CLOSE (2)
|
||||
#define RT_DEVICE_CTRL_DMA_REQUEST_CHANNEL (3)
|
||||
#define RT_DEVICE_CTRL_DMA_RELEASE_CHANNEL (4)
|
||||
#define RT_DEVICE_CTRL_DMA_SINGLE_TRANSFER (5)
|
||||
|
||||
|
||||
//cyclic add func below....
|
||||
|
||||
|
||||
#define RT_DEVICE_CTRL_DMA_CYCLIC_PREPARE (6)
|
||||
#define RT_DEVICE_CTRL_DMA_CYCLIC_START (7)
|
||||
#define RT_DEVICE_CTRL_DMA_CYCLIC_STOP (8)
|
||||
#define RT_DEVICE_CTRL_DMA_CYCLIC_FREE (9)
|
||||
#define RT_DEVICE_CTRL_DMA_CYCLIC_PREPARE (6)
|
||||
#define RT_DEVICE_CTRL_DMA_CYCLIC_START (7)
|
||||
#define RT_DEVICE_CTRL_DMA_CYCLIC_STOP (8)
|
||||
#define RT_DEVICE_CTRL_DMA_CYCLIC_FREE (9)
|
||||
|
||||
|
||||
//#define RT_DEVICE_CTRL_ (3) /* get the left time before reboot(in seconds) */
|
||||
//#define RT_DEVICE_CTRL_ (3) /* get the left time before reboot(in seconds) */
|
||||
//#define RT_DEVICE_CTRL_ (4) /* refresh watchdog */
|
||||
//#define RT_DEVICE_CTRL_ (5) /* start watchdog */
|
||||
//#define RT_DEVICE_CTRL_ (6) /* stop watchdog */
|
||||
@@ -64,13 +64,13 @@
|
||||
|
||||
/****************************************************************************
|
||||
* ADT section
|
||||
* add Abstract Data Type definition here
|
||||
* add Abstract Data Type definition here
|
||||
***************************************************************************/
|
||||
|
||||
struct rt_dma_ops;
|
||||
struct rt_dma_device
|
||||
{
|
||||
// the parent must be the fitst para..
|
||||
// the parent must be the fitst para..
|
||||
struct rt_device parent;
|
||||
struct rt_dma_ops *ops;
|
||||
};
|
||||
@@ -91,7 +91,7 @@ struct rt_dma_ops
|
||||
|
||||
/****************************************************************************
|
||||
* section
|
||||
* add function prototype here if any
|
||||
* add function prototype here if any
|
||||
***************************************************************************/
|
||||
rt_err_t rt_hw_dma_register(struct rt_dma_device *dma,
|
||||
const char *name,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Include Section
|
||||
* add all #include here
|
||||
@@ -86,27 +86,27 @@ static struct rt_memheap dma_heap = {0};
|
||||
* what does this function returned?
|
||||
*****************************************************************************/
|
||||
rt_err_t fh_dma_mem_init(rt_uint32_t *mem_start,rt_uint32_t size){
|
||||
return rt_memheap_init(&dma_heap,"dma_heap",mem_start,size);
|
||||
return rt_memheap_init(&dma_heap,"dma_heap",mem_start,size);
|
||||
}
|
||||
|
||||
|
||||
void *fh_dma_mem_malloc(rt_uint32_t size){
|
||||
return rt_memheap_alloc(&dma_heap, size);
|
||||
return rt_memheap_alloc(&dma_heap, size);
|
||||
}
|
||||
|
||||
|
||||
void fh_dma_mem_free(void *ptr){
|
||||
rt_memheap_free(ptr);
|
||||
rt_memheap_free(ptr);
|
||||
}
|
||||
|
||||
#ifdef FH_TEST_DMA_MEM
|
||||
int dma_mem_debug(void *ptr){
|
||||
//rt_memheap_free(ptr);
|
||||
rt_kprintf("dma mem start 0x%08x\n",(rt_uint32_t)dma_heap.start_addr);
|
||||
rt_kprintf("dma mem total size 0x%08x\n",dma_heap.pool_size);
|
||||
rt_kprintf("dma mem left size 0x%08x\n",dma_heap.available_size);
|
||||
rt_kprintf("dma mem max use size 0x%08x\n",dma_heap.max_used_size);
|
||||
return 0;
|
||||
//rt_memheap_free(ptr);
|
||||
rt_kprintf("dma mem start 0x%08x\n",(rt_uint32_t)dma_heap.start_addr);
|
||||
rt_kprintf("dma mem total size 0x%08x\n",dma_heap.pool_size);
|
||||
rt_kprintf("dma mem left size 0x%08x\n",dma_heap.available_size);
|
||||
rt_kprintf("dma mem max use size 0x%08x\n",dma_heap.max_used_size);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DMA_MEM_H_
|
||||
#define DMA_MEM_H_
|
||||
|
||||
@@ -36,20 +36,20 @@
|
||||
#include <rtthread.h>
|
||||
/****************************************************************************
|
||||
* #include section
|
||||
* add #include here if any
|
||||
* add #include here if any
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* #define section
|
||||
* add constant #define here if any
|
||||
* add constant #define here if any
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* ADT section
|
||||
* add Abstract Data Type definition here
|
||||
* add Abstract Data Type definition here
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
/****************************************************************************
|
||||
* section
|
||||
* add function prototype here if any
|
||||
* add function prototype here if any
|
||||
***************************************************************************/
|
||||
#ifdef RT_USING_DMA_MEM
|
||||
rt_err_t fh_dma_mem_init(rt_uint32_t *mem_start,rt_uint32_t size);
|
||||
|
||||
+928
-928
File diff suppressed because it is too large
Load Diff
+118
-118
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -410,10 +410,10 @@ int fh_gpio_probe(void *priv_data)
|
||||
int i;
|
||||
|
||||
if(gpio_obj->id == 0){
|
||||
rt_hw_interrupt_install(gpio_obj->irq, fh_gpio_interrupt, (void *)gpio_obj, "gpio_0");
|
||||
rt_hw_interrupt_install(gpio_obj->irq, fh_gpio_interrupt, (void *)gpio_obj, "gpio_0");
|
||||
}
|
||||
else if(gpio_obj->id == 1){
|
||||
rt_hw_interrupt_install(gpio_obj->irq, fh_gpio_interrupt, (void *)gpio_obj, "gpio_1");
|
||||
rt_hw_interrupt_install(gpio_obj->irq, fh_gpio_interrupt, (void *)gpio_obj, "gpio_1");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GPIO_H_
|
||||
#define GPIO_H_
|
||||
|
||||
|
||||
+255
-255
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -105,10 +105,10 @@ void rt_hw_interrupt_init(void)
|
||||
{
|
||||
rt_int32_t i;
|
||||
register rt_uint32_t idx;
|
||||
fh_intc *p = (fh_intc *)INTC_REG_BASE;
|
||||
fh_intc *p = (fh_intc *)INTC_REG_BASE;
|
||||
|
||||
|
||||
ictl_close_all_isr(p);
|
||||
ictl_close_all_isr(p);
|
||||
/* init exceptions table */
|
||||
for(idx=0; idx < MAX_HANDLERS; idx++)
|
||||
{
|
||||
@@ -137,27 +137,27 @@ void rt_hw_interrupt_init(void)
|
||||
void rt_hw_interrupt_mask(int irq)
|
||||
{
|
||||
|
||||
fh_intc *p = (fh_intc *)INTC_REG_BASE;
|
||||
fh_intc *p = (fh_intc *)INTC_REG_BASE;
|
||||
/* Disable irq on AIC */
|
||||
ictl_mask_isr(p,irq);
|
||||
ictl_mask_isr(p,irq);
|
||||
|
||||
// if (irq < 32)
|
||||
// p->IRQ_EN_L &= ~(1 << irq);
|
||||
// else
|
||||
// p->IRQ_EN_H &= ~(1 << (irq - 32));
|
||||
// if (irq < 32)
|
||||
// p->IRQ_EN_L &= ~(1 << irq);
|
||||
// else
|
||||
// p->IRQ_EN_H &= ~(1 << (irq - 32));
|
||||
}
|
||||
|
||||
|
||||
void rt_hw_interrupt_umask(int irq)
|
||||
{
|
||||
|
||||
fh_intc *p = (fh_intc *)INTC_REG_BASE;
|
||||
fh_intc *p = (fh_intc *)INTC_REG_BASE;
|
||||
/* Enable irq on AIC */
|
||||
ictl_unmask_isr(p,irq);
|
||||
ictl_unmask_isr(p,irq);
|
||||
// if (irq < 32)
|
||||
// p->IRQ_EN_L |= 1 << irq;
|
||||
// else
|
||||
// p->IRQ_EN_H |= 1 << (irq - 32);
|
||||
// p->IRQ_EN_L |= 1 << irq;
|
||||
// else
|
||||
// p->IRQ_EN_H |= 1 << (irq - 32);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,7 +168,7 @@ void rt_hw_interrupt_umask(int irq)
|
||||
* @param name the interrupt name
|
||||
* @return old handler
|
||||
*/
|
||||
rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
|
||||
rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
|
||||
void *param, const char *name)
|
||||
{
|
||||
rt_isr_handler_t old_handler = RT_NULL;
|
||||
@@ -182,7 +182,7 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
|
||||
irq_desc[vector].param = param;
|
||||
#ifdef RT_USING_INTERRUPT_INFO
|
||||
rt_snprintf(irq_desc[vector].name, RT_NAME_MAX - 1, "%s", name);
|
||||
irq_desc[vector].counter = 0;
|
||||
irq_desc[vector].counter = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ void list_irq(void)
|
||||
{
|
||||
|
||||
#ifdef RT_USING_INTERRUPT_INFO
|
||||
int irq;
|
||||
int irq;
|
||||
rt_kprintf("number\tcount\tname\n");
|
||||
for (irq = 0; irq < MAX_HANDLERS; irq++)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -35,6 +35,6 @@ void rt_hw_interrupt_init(void);
|
||||
void rt_hw_interrupt_mask(int irq);
|
||||
void rt_hw_interrupt_umask(int irq);
|
||||
rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
|
||||
void *param, const char *name);
|
||||
void *param, const char *name);
|
||||
|
||||
#endif /* INTERRUPT_H_ */
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -28,52 +28,52 @@
|
||||
#include <rtdevice.h>
|
||||
#include "mmu.h"
|
||||
|
||||
#define CHANGLINE_SIZE (1)
|
||||
#define CHANGLINE_SIZE (1)
|
||||
|
||||
//#define FH_DBG_MEM_PROCESS
|
||||
|
||||
#ifdef FH_DBG_MEM_PROCESS
|
||||
void mem_input(rt_uint32_t t_addr, rt_uint32_t t_size, rt_uint8_t t_value) {
|
||||
|
||||
rt_kprintf("mem process add:%x \tsize:%x\tvalue:%x\n", t_addr, t_size,
|
||||
t_value);
|
||||
rt_kprintf("mem process add:%x \tsize:%x\tvalue:%x\n", t_addr, t_size,
|
||||
t_value);
|
||||
|
||||
rt_memset((void *) t_addr, t_value, t_size);
|
||||
rt_memset((void *) t_addr, t_value, t_size);
|
||||
|
||||
mmu_clean_invalidated_dcache(t_addr, t_size);
|
||||
mmu_clean_invalidated_dcache(t_addr, t_size);
|
||||
|
||||
}
|
||||
|
||||
void mem_output(rt_uint32_t t_addr, rt_uint32_t t_size) {
|
||||
|
||||
rt_uint32_t i;
|
||||
rt_uint32_t cnt = 0;
|
||||
rt_uint32_t value;
|
||||
rt_uint32_t addr, size;
|
||||
rt_uint32_t i;
|
||||
rt_uint32_t cnt = 0;
|
||||
rt_uint32_t value;
|
||||
rt_uint32_t addr, size;
|
||||
|
||||
addr = t_addr;
|
||||
if (t_size % 4) {
|
||||
rt_kprintf("mem must be alligned\n");
|
||||
}
|
||||
size = t_size / 4;
|
||||
rt_int32_t *p = (rt_uint32_t *) t_addr;
|
||||
addr = t_addr;
|
||||
if (t_size % 4) {
|
||||
rt_kprintf("mem must be alligned\n");
|
||||
}
|
||||
size = t_size / 4;
|
||||
rt_int32_t *p = (rt_uint32_t *) t_addr;
|
||||
|
||||
//mmu_clean_invalidated_dcache(addr,t_size);
|
||||
rt_kprintf("mem process add:0x%x \tsize:0x%x\n", addr, t_size);
|
||||
rt_kprintf("0x%08x:", addr);
|
||||
for (i = 0; i < size; i++) {
|
||||
value = *p++;
|
||||
if ((cnt / CHANGLINE_SIZE) && (cnt % CHANGLINE_SIZE == 0)) {
|
||||
rt_kprintf("\n");
|
||||
}
|
||||
if (cnt / CHANGLINE_SIZE && (cnt % CHANGLINE_SIZE) == 0) {
|
||||
rt_kprintf("0x%08x:", addr + i * 4);
|
||||
}
|
||||
rt_kprintf("\t%08x", value);
|
||||
cnt++;
|
||||
//mmu_clean_invalidated_dcache(addr,t_size);
|
||||
rt_kprintf("mem process add:0x%x \tsize:0x%x\n", addr, t_size);
|
||||
rt_kprintf("0x%08x:", addr);
|
||||
for (i = 0; i < size; i++) {
|
||||
value = *p++;
|
||||
if ((cnt / CHANGLINE_SIZE) && (cnt % CHANGLINE_SIZE == 0)) {
|
||||
rt_kprintf("\n");
|
||||
}
|
||||
if (cnt / CHANGLINE_SIZE && (cnt % CHANGLINE_SIZE) == 0) {
|
||||
rt_kprintf("0x%08x:", addr + i * 4);
|
||||
}
|
||||
rt_kprintf("\t%08x", value);
|
||||
cnt++;
|
||||
|
||||
}
|
||||
rt_kprintf("\n");
|
||||
}
|
||||
rt_kprintf("\n");
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -193,7 +193,7 @@ int fh_pwm_probe(void *priv_data)
|
||||
rt_kprintf("ERROR: %s rt_device calloc failed\n", __func__);
|
||||
return -RT_ENOMEM;
|
||||
}
|
||||
|
||||
|
||||
pwm_dev->user_data = &pwm_drv;
|
||||
pwm_dev->open =fh_pwm_open;
|
||||
pwm_dev->close = fh_pwm_close;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef PWM_H_
|
||||
#define PWM_H_
|
||||
|
||||
|
||||
+160
-160
File diff suppressed because it is too large
Load Diff
+43
-43
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SADC_H_
|
||||
#define SADC_H_
|
||||
|
||||
@@ -33,57 +33,57 @@
|
||||
|
||||
/****************************************************************************
|
||||
* #define section
|
||||
* add constant #define here if any
|
||||
* add constant #define here if any
|
||||
***************************************************************************/
|
||||
//#define FH_SADC_PROC_FILE "driver/sadc"
|
||||
#define MAX_CHANNEL_NO (8)
|
||||
#define SADC_REF (3300)
|
||||
#define SADC_MAX_AD_VALUE (0x3ff)
|
||||
#define LOOP_MODE (0x55)
|
||||
#define ISR_MODE (0xAA)
|
||||
#define MAX_CHANNEL_NO (8)
|
||||
#define SADC_REF (3300)
|
||||
#define SADC_MAX_AD_VALUE (0x3ff)
|
||||
#define LOOP_MODE (0x55)
|
||||
#define ISR_MODE (0xAA)
|
||||
|
||||
|
||||
#define SADC_INIT_ALREADY (0x33)
|
||||
#define SADC_INIT_NOT_YET (0)
|
||||
#define SADC_INIT_ALREADY (0x33)
|
||||
#define SADC_INIT_NOT_YET (0)
|
||||
|
||||
|
||||
#define SADC_CMD_READ_RAW_DATA (0x22)
|
||||
#define SADC_CMD_READ_VOLT (0x33)
|
||||
#define SADC_CMD_DISABLE (0x44)
|
||||
#define SADC_CMD_READ_RAW_DATA (0x22)
|
||||
#define SADC_CMD_READ_VOLT (0x33)
|
||||
#define SADC_CMD_DISABLE (0x44)
|
||||
|
||||
/****************************************************************************
|
||||
* ADT section
|
||||
* add Abstract Data Type definition here
|
||||
* add Abstract Data Type definition here
|
||||
***************************************************************************/
|
||||
|
||||
struct wrap_sadc_reg {
|
||||
rt_uint32_t sadc_cmd;
|
||||
rt_uint32_t sadc_control;
|
||||
rt_uint32_t sadc_ier;
|
||||
rt_uint32_t sadc_int_status;
|
||||
rt_uint32_t sadc_dout0;
|
||||
rt_uint32_t sadc_dout1;
|
||||
rt_uint32_t sadc_dout2;
|
||||
rt_uint32_t sadc_dout3;
|
||||
rt_uint32_t sadc_debuge0;
|
||||
rt_uint32_t sadc_status;
|
||||
rt_uint32_t sadc_cnt;
|
||||
rt_uint32_t sadc_timeout;
|
||||
rt_uint32_t sadc_cmd;
|
||||
rt_uint32_t sadc_control;
|
||||
rt_uint32_t sadc_ier;
|
||||
rt_uint32_t sadc_int_status;
|
||||
rt_uint32_t sadc_dout0;
|
||||
rt_uint32_t sadc_dout1;
|
||||
rt_uint32_t sadc_dout2;
|
||||
rt_uint32_t sadc_dout3;
|
||||
rt_uint32_t sadc_debuge0;
|
||||
rt_uint32_t sadc_status;
|
||||
rt_uint32_t sadc_cnt;
|
||||
rt_uint32_t sadc_timeout;
|
||||
};
|
||||
|
||||
struct wrap_sadc_obj {
|
||||
rt_uint32_t id;
|
||||
void *regs;
|
||||
rt_uint32_t irq_no;
|
||||
rt_uint32_t init_flag;
|
||||
rt_uint32_t active_channel_no;
|
||||
rt_uint32_t active_channel_status;
|
||||
rt_uint16_t channel_data[MAX_CHANNEL_NO];
|
||||
rt_uint32_t error_rec;
|
||||
rt_uint32_t en_isr;
|
||||
rt_uint32_t sample_mode;
|
||||
struct rt_mutex lock;
|
||||
struct rt_semaphore completion;
|
||||
rt_uint32_t id;
|
||||
void *regs;
|
||||
rt_uint32_t irq_no;
|
||||
rt_uint32_t init_flag;
|
||||
rt_uint32_t active_channel_no;
|
||||
rt_uint32_t active_channel_status;
|
||||
rt_uint16_t channel_data[MAX_CHANNEL_NO];
|
||||
rt_uint32_t error_rec;
|
||||
rt_uint32_t en_isr;
|
||||
rt_uint32_t sample_mode;
|
||||
struct rt_mutex lock;
|
||||
struct rt_semaphore completion;
|
||||
|
||||
//bind to the rtdev..
|
||||
rt_device_t rt_dev;
|
||||
@@ -91,8 +91,8 @@ struct wrap_sadc_obj {
|
||||
};
|
||||
|
||||
typedef struct{
|
||||
rt_uint32_t channel;
|
||||
rt_uint32_t sadc_data;
|
||||
rt_uint32_t channel;
|
||||
rt_uint32_t sadc_data;
|
||||
}SADC_INFO;
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ typedef struct{
|
||||
|
||||
/****************************************************************************
|
||||
* section
|
||||
* add function prototype here if any
|
||||
* add function prototype here if any
|
||||
***************************************************************************/
|
||||
void rt_hw_sadc_init(void);
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* spi_fh_adapt.c
|
||||
*
|
||||
@@ -60,9 +60,9 @@
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
|
||||
|
||||
#define WX_MANU_ID 0xEF
|
||||
#define WX_MANU_ID 0xEF
|
||||
#define AT_MANU_ID 0x1F /* atmel */
|
||||
#define SST_MANU_ID 0xBF
|
||||
#define SST_MANU_ID 0xBF
|
||||
#define GD_MANU_ID 0xC8
|
||||
|
||||
|
||||
@@ -70,50 +70,50 @@
|
||||
#define SPI_ADAPT_DEBUG
|
||||
#ifdef SPI_ADAPT_DEBUG
|
||||
|
||||
#define CMD_JEDEC_ID 0x9f
|
||||
#define CMD_JEDEC_ID 0x9f
|
||||
|
||||
|
||||
#define FH_SPI_ADAPT_DEBUG(fmt, args...) \
|
||||
rt_kprintf(fmt,##args);
|
||||
#define FH_SPI_ADAPT_DEBUG(fmt, args...) \
|
||||
rt_kprintf(fmt,##args);
|
||||
#else
|
||||
#define FH_SPI_ADAPT_DEBUG(fmt, args...)
|
||||
#endif
|
||||
struct fh_flash_id{
|
||||
unsigned char id;
|
||||
rt_err_t (*fh_flash_init)(struct flash_platform_data *plat_flash);
|
||||
char *name;
|
||||
unsigned char id;
|
||||
rt_err_t (*fh_flash_init)(struct flash_platform_data *plat_flash);
|
||||
char *name;
|
||||
};
|
||||
const struct fh_flash_id id_map[] = {
|
||||
|
||||
#ifdef RT_USING_W25QXX
|
||||
WX_MANU_ID,w25qxx_init,"winbond",
|
||||
WX_MANU_ID,w25qxx_init,"winbond",
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_AT45DBXX
|
||||
AT_MANU_ID,at45dbxx_init,"atmel",
|
||||
AT_MANU_ID,at45dbxx_init,"atmel",
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_SST25VFXX
|
||||
SST_MANU_ID,sst25vfxx_init,"SST",
|
||||
SST_MANU_ID,sst25vfxx_init,"SST",
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_GD
|
||||
GD_MANU_ID,gd_init,"GD",
|
||||
GD_MANU_ID,gd_init,"GD",
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct fh_flash_id * fh_flash_check_id_map(unsigned char id){
|
||||
struct fh_flash_id *p_map = RT_NULL;
|
||||
unsigned int i;
|
||||
for (i = 0; i < ARRAY_SIZE(id_map); i++) {
|
||||
p_map = (struct fh_flash_id *)&id_map[i];
|
||||
if (p_map->id == id){
|
||||
return p_map;
|
||||
}
|
||||
}
|
||||
return RT_NULL;
|
||||
struct fh_flash_id *p_map = RT_NULL;
|
||||
unsigned int i;
|
||||
for (i = 0; i < ARRAY_SIZE(id_map); i++) {
|
||||
p_map = (struct fh_flash_id *)&id_map[i];
|
||||
if (p_map->id == id){
|
||||
return p_map;
|
||||
}
|
||||
}
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -144,50 +144,50 @@ int fh_flash_adapt_probe(void *priv_data)
|
||||
|
||||
/* init flash */
|
||||
|
||||
rt_uint8_t cmd;
|
||||
rt_uint8_t id_recv[3];
|
||||
uint16_t memory_type_capacity;
|
||||
rt_err_t ret;
|
||||
rt_uint8_t cmd;
|
||||
rt_uint8_t id_recv[3];
|
||||
uint16_t memory_type_capacity;
|
||||
rt_err_t ret;
|
||||
|
||||
cmd = 0xFF; /* reset SPI FLASH, cancel all cmd in processing. */
|
||||
rt_spi_send(rt_spi_device, &cmd, 1);
|
||||
/* read flash id */
|
||||
cmd = CMD_JEDEC_ID;
|
||||
rt_spi_send_then_recv(rt_spi_device, &cmd, 1, id_recv, 3);
|
||||
cmd = 0xFF; /* reset SPI FLASH, cancel all cmd in processing. */
|
||||
rt_spi_send(rt_spi_device, &cmd, 1);
|
||||
/* read flash id */
|
||||
cmd = CMD_JEDEC_ID;
|
||||
rt_spi_send_then_recv(rt_spi_device, &cmd, 1, id_recv, 3);
|
||||
|
||||
//if the flash is already connect.
|
||||
if(id_recv[0] != 0xff){
|
||||
flash_model =fh_flash_check_id_map(id_recv[0]);
|
||||
if(flash_model){
|
||||
ret = flash_model->fh_flash_init(plat_flash);
|
||||
if(ret != RT_EOK){
|
||||
rt_kprintf("flash:%s init error\n",flash_model->name);
|
||||
rt_kprintf("use default flash ops..\n");
|
||||
//flash_model->fh_flash_adapt_init =flash_default_init;
|
||||
ret = flash_default_init(plat_flash);
|
||||
}
|
||||
}
|
||||
else{
|
||||
rt_kprintf(
|
||||
"use default flash ops...\nunrecognized flash id is :%02X %02X %02X\n",
|
||||
id_recv[0], id_recv[1], id_recv[2]);
|
||||
ret = flash_default_init(plat_flash);
|
||||
//if the flash is already connect.
|
||||
if(id_recv[0] != 0xff){
|
||||
flash_model =fh_flash_check_id_map(id_recv[0]);
|
||||
if(flash_model){
|
||||
ret = flash_model->fh_flash_init(plat_flash);
|
||||
if(ret != RT_EOK){
|
||||
rt_kprintf("flash:%s init error\n",flash_model->name);
|
||||
rt_kprintf("use default flash ops..\n");
|
||||
//flash_model->fh_flash_adapt_init =flash_default_init;
|
||||
ret = flash_default_init(plat_flash);
|
||||
}
|
||||
}
|
||||
else{
|
||||
rt_kprintf(
|
||||
"use default flash ops...\nunrecognized flash id is :%02X %02X %02X\n",
|
||||
id_recv[0], id_recv[1], id_recv[2]);
|
||||
ret = flash_default_init(plat_flash);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int i;
|
||||
for(i=0; i<plat_flash->nr_parts; i++)
|
||||
{
|
||||
fh_spi_partition_register(plat_flash->flash_name, &plat_flash->parts[i]);
|
||||
}
|
||||
int i;
|
||||
for(i=0; i<plat_flash->nr_parts; i++)
|
||||
{
|
||||
fh_spi_partition_register(plat_flash->flash_name, &plat_flash->parts[i]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
|
||||
}
|
||||
else{
|
||||
rt_kprintf("please check if you connect the flash already...\n");
|
||||
return RT_ENOSYS;
|
||||
}
|
||||
}
|
||||
else{
|
||||
rt_kprintf("please check if you connect the flash already...\n");
|
||||
return RT_ENOSYS;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* spi_fh_adapt.h
|
||||
*
|
||||
|
||||
+429
-429
File diff suppressed because it is too large
Load Diff
+48
-48
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SSI_H_
|
||||
#define SSI_H_
|
||||
#include "libraries/inc/fh_driverlib.h"
|
||||
@@ -32,37 +32,37 @@
|
||||
#include "fh_dma.h"
|
||||
#define SPI_PRIV(drv) ( (struct fh_spi_obj)(drv->priv) )
|
||||
|
||||
#define FH_SPI_SLAVE_MAX_NO 2
|
||||
#define FH_SPI_SLAVE_MAX_NO 2
|
||||
|
||||
struct spi_controller;
|
||||
//platform use below
|
||||
struct spi_slave_platform_data{
|
||||
|
||||
rt_uint32_t cs_pin;
|
||||
#define ACTIVE_LOW 1
|
||||
#define ACTIVE_HIGH 2
|
||||
rt_uint32_t actice_level;
|
||||
rt_uint32_t cs_pin;
|
||||
#define ACTIVE_LOW 1
|
||||
#define ACTIVE_HIGH 2
|
||||
rt_uint32_t actice_level;
|
||||
};
|
||||
|
||||
|
||||
struct spi_control_platform_data{
|
||||
rt_uint32_t id;
|
||||
rt_uint32_t irq;
|
||||
rt_uint32_t base;
|
||||
rt_uint32_t max_hz;
|
||||
rt_uint32_t slave_no;
|
||||
rt_uint32_t clk_in;
|
||||
//handshake no...
|
||||
rt_uint32_t rx_hs_no;
|
||||
rt_uint32_t tx_hs_no;
|
||||
rt_uint32_t id;
|
||||
rt_uint32_t irq;
|
||||
rt_uint32_t base;
|
||||
rt_uint32_t max_hz;
|
||||
rt_uint32_t slave_no;
|
||||
rt_uint32_t clk_in;
|
||||
//handshake no...
|
||||
rt_uint32_t rx_hs_no;
|
||||
rt_uint32_t tx_hs_no;
|
||||
|
||||
char *dma_name;
|
||||
//isr will be the default...
|
||||
#define USE_ISR_TRANSFER 0
|
||||
#define USE_DMA_TRANSFER 1
|
||||
rt_uint32_t transfer_mode;
|
||||
struct spi_controller *control;
|
||||
struct spi_slave_platform_data plat_slave[FH_SPI_SLAVE_MAX_NO];
|
||||
char *dma_name;
|
||||
//isr will be the default...
|
||||
#define USE_ISR_TRANSFER 0
|
||||
#define USE_DMA_TRANSFER 1
|
||||
rt_uint32_t transfer_mode;
|
||||
struct spi_controller *control;
|
||||
struct spi_slave_platform_data plat_slave[FH_SPI_SLAVE_MAX_NO];
|
||||
|
||||
};
|
||||
|
||||
@@ -81,15 +81,15 @@ struct spi_slave_info
|
||||
|
||||
struct spi_dma
|
||||
{
|
||||
char *dma_name;
|
||||
#define DMA_BIND_OK 0
|
||||
#define DMA_BIND_ERROR 1
|
||||
rt_uint32_t dma_flag;
|
||||
char *dma_name;
|
||||
#define DMA_BIND_OK 0
|
||||
#define DMA_BIND_ERROR 1
|
||||
rt_uint32_t dma_flag;
|
||||
//bind to the dma dev..
|
||||
rt_uint32_t rx_hs;
|
||||
rt_uint32_t tx_hs;
|
||||
rt_uint8_t *rx_dummy_buff;
|
||||
rt_uint8_t *tx_dummy_buff;
|
||||
rt_uint32_t rx_hs;
|
||||
rt_uint32_t tx_hs;
|
||||
rt_uint8_t *rx_dummy_buff;
|
||||
rt_uint8_t *tx_dummy_buff;
|
||||
struct rt_dma_device *dma_dev;
|
||||
struct dma_transfer tx_trans;
|
||||
struct dma_transfer rx_trans;
|
||||
@@ -98,28 +98,28 @@ struct spi_dma
|
||||
|
||||
struct spi_controller
|
||||
{
|
||||
rt_uint32_t id;
|
||||
rt_uint32_t irq;
|
||||
rt_uint32_t base;
|
||||
rt_uint32_t max_hz;
|
||||
rt_uint32_t slave_no;
|
||||
rt_uint32_t clk_in;
|
||||
//bind to the platform data....
|
||||
struct spi_control_platform_data *plat_data;
|
||||
rt_uint32_t id;
|
||||
rt_uint32_t irq;
|
||||
rt_uint32_t base;
|
||||
rt_uint32_t max_hz;
|
||||
rt_uint32_t slave_no;
|
||||
rt_uint32_t clk_in;
|
||||
//bind to the platform data....
|
||||
struct spi_control_platform_data *plat_data;
|
||||
|
||||
//rt_uint32_t dma_xfer_flag;
|
||||
//rt_uint32_t dma_xfer_flag;
|
||||
|
||||
#define XFER_USE_ISR 0
|
||||
#define XFER_USE_DMA 1
|
||||
rt_uint32_t xfer_mode;
|
||||
#define XFER_USE_ISR 0
|
||||
#define XFER_USE_DMA 1
|
||||
rt_uint32_t xfer_mode;
|
||||
|
||||
struct spi_dma dma;
|
||||
rt_uint32_t dma_complete_times;
|
||||
struct spi_dma dma;
|
||||
rt_uint32_t dma_complete_times;
|
||||
struct rt_spi_bus spi_bus;
|
||||
struct spi_slave_info *spi_slave;
|
||||
struct rt_spi_message* current_message;
|
||||
struct rt_completion transfer_completion;
|
||||
struct rt_semaphore xfer_lock;
|
||||
struct rt_semaphore xfer_lock;
|
||||
struct fh_spi_obj obj;
|
||||
rt_uint32_t received_len;
|
||||
rt_uint32_t transfered_len;
|
||||
|
||||
+59
-59
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#include <rthw.h>
|
||||
#include <armv6.h>
|
||||
#include "fh_arch.h"
|
||||
@@ -47,13 +47,13 @@ extern long list_thread(void);
|
||||
|
||||
void rt_hw_show_register (struct rt_hw_register *regs)
|
||||
{
|
||||
rt_kprintf("Execption:\n");
|
||||
rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3);
|
||||
rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7);
|
||||
rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10);
|
||||
rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip);
|
||||
rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc);
|
||||
rt_kprintf("cpsr:0x%08x\n", regs->cpsr);
|
||||
rt_kprintf("Execption:\n");
|
||||
rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3);
|
||||
rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7);
|
||||
rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10);
|
||||
rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip);
|
||||
rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc);
|
||||
rt_kprintf("cpsr:0x%08x\n", regs->cpsr);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,15 +66,15 @@ void rt_hw_show_register (struct rt_hw_register *regs)
|
||||
*/
|
||||
void rt_hw_trap_udef(struct rt_hw_register *regs)
|
||||
{
|
||||
rt_hw_show_register(regs);
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("undefined instruction\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("undefined instruction\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
list_thread();
|
||||
list_thread();
|
||||
#endif
|
||||
rt_hw_cpu_shutdown();
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,10 +88,10 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
|
||||
*/
|
||||
void rt_hw_trap_swi(struct rt_hw_register *regs)
|
||||
{
|
||||
rt_hw_show_register(regs);
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("software interrupt\n");
|
||||
rt_hw_cpu_shutdown();
|
||||
rt_kprintf("software interrupt\n");
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,15 +104,15 @@ void rt_hw_trap_swi(struct rt_hw_register *regs)
|
||||
*/
|
||||
void rt_hw_trap_pabt(struct rt_hw_register *regs)
|
||||
{
|
||||
rt_hw_show_register(regs);
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("prefetch abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("prefetch abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
list_thread();
|
||||
list_thread();
|
||||
#endif
|
||||
rt_hw_cpu_shutdown();
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,15 +125,15 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
|
||||
*/
|
||||
void rt_hw_trap_dabt(struct rt_hw_register *regs)
|
||||
{
|
||||
rt_hw_show_register(regs);
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("data abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("data abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
list_thread();
|
||||
list_thread();
|
||||
#endif
|
||||
rt_hw_cpu_shutdown();
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,45 +145,45 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
|
||||
*/
|
||||
void rt_hw_trap_resv(struct rt_hw_register *regs)
|
||||
{
|
||||
rt_kprintf("not used\n");
|
||||
rt_hw_show_register(regs);
|
||||
rt_hw_cpu_shutdown();
|
||||
rt_kprintf("not used\n");
|
||||
rt_hw_show_register(regs);
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
extern struct rt_irq_desc irq_desc[];
|
||||
|
||||
void rt_hw_trap_irq()
|
||||
{
|
||||
rt_isr_handler_t isr_func;
|
||||
rt_uint32_t irqstat_l, irqstat_h, irq;
|
||||
void *param;
|
||||
rt_isr_handler_t isr_func;
|
||||
rt_uint32_t irqstat_l, irqstat_h, irq;
|
||||
void *param;
|
||||
|
||||
fh_intc *p = (fh_intc *)INTC_REG_BASE;
|
||||
fh_intc *p = (fh_intc *)INTC_REG_BASE;
|
||||
|
||||
irqstat_l = p->IRQ_FINALSTATUS_L;
|
||||
irqstat_h = p->IRQ_FINALSTATUS_H;
|
||||
if (irqstat_l)
|
||||
{
|
||||
irq = __rt_ffs(irqstat_l) - 1;
|
||||
}
|
||||
else if(irqstat_h)
|
||||
{
|
||||
irq = __rt_ffs(irqstat_h) - 1 + 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("No interrupt occur\n");
|
||||
return;
|
||||
}
|
||||
irqstat_l = p->IRQ_FINALSTATUS_L;
|
||||
irqstat_h = p->IRQ_FINALSTATUS_H;
|
||||
if (irqstat_l)
|
||||
{
|
||||
irq = __rt_ffs(irqstat_l) - 1;
|
||||
}
|
||||
else if(irqstat_h)
|
||||
{
|
||||
irq = __rt_ffs(irqstat_h) - 1 + 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("No interrupt occur\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* get interrupt service routine */
|
||||
isr_func = irq_desc[irq].handler;
|
||||
param = irq_desc[irq].param;
|
||||
/* get interrupt service routine */
|
||||
isr_func = irq_desc[irq].handler;
|
||||
param = irq_desc[irq].param;
|
||||
|
||||
/* turn to interrupt service routine */
|
||||
if(isr_func){
|
||||
isr_func(irq, param);
|
||||
}
|
||||
/* turn to interrupt service routine */
|
||||
if(isr_func){
|
||||
isr_func(irq, param);
|
||||
}
|
||||
#ifdef RT_USING_INTERRUPT_INFO
|
||||
irq_desc[irq].counter ++;
|
||||
#endif
|
||||
@@ -191,7 +191,7 @@ void rt_hw_trap_irq()
|
||||
|
||||
void rt_hw_trap_fiq()
|
||||
{
|
||||
rt_kprintf("fast interrupt request\n");
|
||||
rt_kprintf("fast interrupt request\n");
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
||||
+152
-152
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef UART_H_
|
||||
#define UART_H_
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#include "fh_def.h"
|
||||
#include "wdt.h"
|
||||
#include "interrupt.h"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef WDT_H_
|
||||
#define WDT_H_
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,10 +18,10 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#include "inc/fh_driverlib.h"
|
||||
|
||||
int I2C_WaitMasterIdle(struct fh_i2c_obj *i2c_obj)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,25 +18,25 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#include "inc/fh_driverlib.h"
|
||||
|
||||
|
||||
|
||||
void ictl_close_all_isr(fh_intc *p){
|
||||
if(p){
|
||||
//enable all interrupts
|
||||
p->IRQ_EN_L = 0xffffffff;
|
||||
p->IRQ_EN_H = 0xffffffff;
|
||||
//mask all interrupts
|
||||
p->IRQ_MASK_L = 0xffffffff;
|
||||
p->IRQ_MASK_H = 0xffffffff;
|
||||
}
|
||||
if(p){
|
||||
//enable all interrupts
|
||||
p->IRQ_EN_L = 0xffffffff;
|
||||
p->IRQ_EN_H = 0xffffffff;
|
||||
//mask all interrupts
|
||||
p->IRQ_MASK_L = 0xffffffff;
|
||||
p->IRQ_MASK_H = 0xffffffff;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,13 +44,13 @@ void ictl_close_all_isr(fh_intc *p){
|
||||
|
||||
|
||||
void ictl_mask_isr(fh_intc *p,int irq){
|
||||
if(p){
|
||||
if(p){
|
||||
|
||||
if (irq < 32)
|
||||
p->IRQ_MASK_L |= (1 << irq);
|
||||
else
|
||||
p->IRQ_MASK_H |= (1 << (irq - 32));
|
||||
}
|
||||
if (irq < 32)
|
||||
p->IRQ_MASK_L |= (1 << irq);
|
||||
else
|
||||
p->IRQ_MASK_H |= (1 << (irq - 32));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,12 +58,12 @@ void ictl_mask_isr(fh_intc *p,int irq){
|
||||
|
||||
|
||||
void ictl_unmask_isr(fh_intc *p,int irq){
|
||||
if(p){
|
||||
if (irq < 32)
|
||||
p->IRQ_MASK_L &= ~(1 << irq);
|
||||
else
|
||||
p->IRQ_MASK_H &= ~(1 << (irq - 32));
|
||||
if(p){
|
||||
if (irq < 32)
|
||||
p->IRQ_MASK_L &= ~(1 << irq);
|
||||
else
|
||||
p->IRQ_MASK_H &= ~(1 << (irq - 32));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
+1548
-1548
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Include Section
|
||||
* add all #include here
|
||||
@@ -79,66 +79,66 @@
|
||||
*****************************************************************************/
|
||||
int timer_init(timer *tim)
|
||||
{
|
||||
tim->TIMER_CTRL_REG = 0;
|
||||
tim->TIMER_CTRL_REG = 0;
|
||||
}
|
||||
|
||||
int timer_set_mode(timer *tim, enum timer_mode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case TIMER_MODE_PERIODIC:
|
||||
tim->TIMER_CTRL_REG |= TIMER_CTRL_MODE;
|
||||
break;
|
||||
case TIMER_MODE_ONESHOT:
|
||||
tim->TIMER_CTRL_REG |= TIMER_CTRL_MODE;
|
||||
break;
|
||||
default:
|
||||
rt_kprintf("Not support TIMER mode\n");
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
switch (mode)
|
||||
{
|
||||
case TIMER_MODE_PERIODIC:
|
||||
tim->TIMER_CTRL_REG |= TIMER_CTRL_MODE;
|
||||
break;
|
||||
case TIMER_MODE_ONESHOT:
|
||||
tim->TIMER_CTRL_REG |= TIMER_CTRL_MODE;
|
||||
break;
|
||||
default:
|
||||
rt_kprintf("Not support TIMER mode\n");
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void timer_set_period(timer *tim, UINT32 period, UINT32 clock)
|
||||
{
|
||||
tim->TIMER_LOAD_COUNT = clock/period;
|
||||
tim->TIMER_LOAD_COUNT = clock/period;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void timer_enable(timer *tim)
|
||||
{
|
||||
tim->TIMER_CTRL_REG |= TIMER_CTRL_ENABLE;
|
||||
tim->TIMER_CTRL_REG |= TIMER_CTRL_ENABLE;
|
||||
}
|
||||
|
||||
void timer_disable(timer *tim)
|
||||
{
|
||||
tim->TIMER_CTRL_REG &= ~TIMER_CTRL_ENABLE;
|
||||
tim->TIMER_CTRL_REG &= ~TIMER_CTRL_ENABLE;
|
||||
}
|
||||
|
||||
void timer_enable_irq(timer *tim)
|
||||
{
|
||||
tim->TIMER_CTRL_REG &= ~TIMER_CTRL_INTMASK;
|
||||
tim->TIMER_CTRL_REG &= ~TIMER_CTRL_INTMASK;
|
||||
}
|
||||
|
||||
void timer_disable_irq(timer *tim)
|
||||
{
|
||||
tim->TIMER_CTRL_REG |= TIMER_CTRL_INTMASK;
|
||||
tim->TIMER_CTRL_REG |= TIMER_CTRL_INTMASK;
|
||||
}
|
||||
|
||||
UINT32 timer_get_status(timer *tim)
|
||||
{
|
||||
return tim->TIMER_INT_STATUS;
|
||||
return tim->TIMER_INT_STATUS;
|
||||
}
|
||||
|
||||
UINT32 timer_get_eoi(timer *tim)
|
||||
{
|
||||
return tim->TIMER_EOI;
|
||||
return tim->TIMER_EOI;
|
||||
}
|
||||
|
||||
UINT32 timer_get_value(timer *tim)
|
||||
{
|
||||
return tim->TIMER_LOAD_COUNT - tim->TIMER_CURRENT_VALUE;
|
||||
return tim->TIMER_LOAD_COUNT - tim->TIMER_CURRENT_VALUE;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rthw.h>
|
||||
#include "fh_def.h"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FH_GPIO_H_
|
||||
#define FH_GPIO_H_
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FH_I2C_H_
|
||||
#define FH_I2C_H_
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -30,21 +30,21 @@
|
||||
#include "fh_def.h"
|
||||
|
||||
typedef struct {
|
||||
RwReg IRQ_EN_L;
|
||||
RwReg IRQ_EN_H;
|
||||
RwReg IRQ_MASK_L;
|
||||
RwReg IRQ_MASK_H;
|
||||
RwReg IRQ_FORCE_L;
|
||||
RwReg IRQ_FORCE_H;
|
||||
RwReg IRQ_RAWSTARUS_L;
|
||||
RwReg IRQ_RAWSTARUS_H;
|
||||
RwReg IRQ_STATUS_L;
|
||||
RwReg IRQ_STATUS_H;
|
||||
RwReg IRQ_MASKSTATUS_L;
|
||||
RwReg IRQ_MASKSTATUS_H;
|
||||
RwReg IRQ_FINALSTATUS_L;
|
||||
RwReg IRQ_FINALSTATUS_H;
|
||||
RwReg IRQ_VECTOR;
|
||||
RwReg IRQ_EN_L;
|
||||
RwReg IRQ_EN_H;
|
||||
RwReg IRQ_MASK_L;
|
||||
RwReg IRQ_MASK_H;
|
||||
RwReg IRQ_FORCE_L;
|
||||
RwReg IRQ_FORCE_H;
|
||||
RwReg IRQ_RAWSTARUS_L;
|
||||
RwReg IRQ_RAWSTARUS_H;
|
||||
RwReg IRQ_STATUS_L;
|
||||
RwReg IRQ_STATUS_H;
|
||||
RwReg IRQ_MASKSTATUS_L;
|
||||
RwReg IRQ_MASKSTATUS_H;
|
||||
RwReg IRQ_FINALSTATUS_L;
|
||||
RwReg IRQ_FINALSTATUS_H;
|
||||
RwReg IRQ_VECTOR;
|
||||
}fh_intc;
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
+162
-162
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FH_SPI_H_
|
||||
#define FH_SPI_H_
|
||||
|
||||
@@ -97,8 +97,8 @@
|
||||
#define SPI_STATUS_BUSY (1)
|
||||
|
||||
|
||||
#define SPI_TX_DMA (1<<1)
|
||||
#define SPI_RX_DMA (1<<0)
|
||||
#define SPI_TX_DMA (1<<1)
|
||||
#define SPI_RX_DMA (1<<0)
|
||||
|
||||
|
||||
struct spi_config
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
/****************************************************************************
|
||||
* #include section
|
||||
* add #include here if any
|
||||
* add #include here if any
|
||||
***************************************************************************/
|
||||
#include "fh_def.h"
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
/****************************************************************************
|
||||
* #define section
|
||||
* add constant #define here if any
|
||||
* add constant #define here if any
|
||||
***************************************************************************/
|
||||
#define TIMER_CTRL_ENABLE (1u << 0)
|
||||
#define TIMER_CTRL_MODE (1u << 1)
|
||||
@@ -49,19 +49,19 @@
|
||||
|
||||
/****************************************************************************
|
||||
* ADT section
|
||||
* add Abstract Data Type definition here
|
||||
* add Abstract Data Type definition here
|
||||
***************************************************************************/
|
||||
typedef struct {
|
||||
RwReg TIMER_LOAD_COUNT;
|
||||
RwReg TIMER_CURRENT_VALUE;
|
||||
RwReg TIMER_CTRL_REG;
|
||||
RwReg TIMER_EOI;
|
||||
RwReg TIMER_INT_STATUS;
|
||||
RwReg TIMER_LOAD_COUNT;
|
||||
RwReg TIMER_CURRENT_VALUE;
|
||||
RwReg TIMER_CTRL_REG;
|
||||
RwReg TIMER_EOI;
|
||||
RwReg TIMER_INT_STATUS;
|
||||
}timer;
|
||||
|
||||
enum timer_mode {
|
||||
TIMER_MODE_PERIODIC = 0,
|
||||
TIMER_MODE_ONESHOT = 1,
|
||||
TIMER_MODE_PERIODIC = 0,
|
||||
TIMER_MODE_ONESHOT = 1,
|
||||
};
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ typedef struct {
|
||||
|
||||
/****************************************************************************
|
||||
* section
|
||||
* add function prototype here if any
|
||||
* add function prototype here if any
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -29,13 +29,13 @@
|
||||
|
||||
/****************************************************************************
|
||||
* #include section
|
||||
* add #include here if any
|
||||
* add #include here if any
|
||||
***************************************************************************/
|
||||
#include "fh_def.h"
|
||||
|
||||
/****************************************************************************
|
||||
* #define section
|
||||
* add constant #define here if any
|
||||
* add constant #define here if any
|
||||
***************************************************************************/
|
||||
|
||||
#define UART_RBR RBRTHRDLL
|
||||
@@ -120,53 +120,53 @@
|
||||
#define UART_IIR_FIFOSE (0x03 << 6)
|
||||
|
||||
//uart baudrate cofig
|
||||
//#define UART_CLOCK_FREQ (27000000) //27MHZ
|
||||
//#define UART_CLOCK_FREQ (27000000) //27MHZ
|
||||
//
|
||||
//#define DIV(n) (((UART_CLOCK_FREQ/(n))+8)/16)
|
||||
//#define DIV(n) (((UART_CLOCK_FREQ/(n))+8)/16)
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* ADT section
|
||||
* add Abstract Data Type definition here
|
||||
* add Abstract Data Type definition here
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
RwReg RBRTHRDLL; /* UART_RBR, UART_THR, UART_DLL */
|
||||
RwReg DLHIER; /* UART_DLH, UART_IER */
|
||||
RwReg IIRFCR; /* UART_IIR, UART_FCR */
|
||||
RwReg UART_LCR; /*(0x000c) */
|
||||
RwReg UART_MCR; /*(0x0010) */
|
||||
RwReg UART_LSR; /*(0x0014) */
|
||||
RwReg UART_MSR; /*(0x0018) */
|
||||
RwReg UART_SCR; /*(0x001c) */
|
||||
RwReg reserved[20];
|
||||
RwReg UART_FAR; /* (0x0070) */
|
||||
RwReg UART_TFR; /* (0x0074) */
|
||||
RwReg UART_RFW; /* (0x0078) */
|
||||
RwReg UART_USR; /* (0x007c) */
|
||||
RwReg UART_TFL; /* (0x0080) */
|
||||
RwReg UART_RFL; /* (0x0084) */
|
||||
RwReg UART_SRR; /* (0x0088) */
|
||||
RwReg reserved1[3];
|
||||
RwReg UART_SFE; /* (0x0098) */
|
||||
RwReg UART_SRT; /* (0x009c) */
|
||||
RwReg UART_STET; /* (0x00a0) */
|
||||
RwReg UART_HTX; /* (0x00a4) */
|
||||
RwReg UART_DMASA; /* (0x00a8) */
|
||||
RwReg reserved2[18];
|
||||
RwReg UART_CPR; /* (0x00f4) */
|
||||
RwReg UART_UCV; /* (0x00f8) */
|
||||
RwReg UART_CTR; /* (0x00fc) */
|
||||
RwReg RBRTHRDLL; /* UART_RBR, UART_THR, UART_DLL */
|
||||
RwReg DLHIER; /* UART_DLH, UART_IER */
|
||||
RwReg IIRFCR; /* UART_IIR, UART_FCR */
|
||||
RwReg UART_LCR; /*(0x000c) */
|
||||
RwReg UART_MCR; /*(0x0010) */
|
||||
RwReg UART_LSR; /*(0x0014) */
|
||||
RwReg UART_MSR; /*(0x0018) */
|
||||
RwReg UART_SCR; /*(0x001c) */
|
||||
RwReg reserved[20];
|
||||
RwReg UART_FAR; /* (0x0070) */
|
||||
RwReg UART_TFR; /* (0x0074) */
|
||||
RwReg UART_RFW; /* (0x0078) */
|
||||
RwReg UART_USR; /* (0x007c) */
|
||||
RwReg UART_TFL; /* (0x0080) */
|
||||
RwReg UART_RFL; /* (0x0084) */
|
||||
RwReg UART_SRR; /* (0x0088) */
|
||||
RwReg reserved1[3];
|
||||
RwReg UART_SFE; /* (0x0098) */
|
||||
RwReg UART_SRT; /* (0x009c) */
|
||||
RwReg UART_STET; /* (0x00a0) */
|
||||
RwReg UART_HTX; /* (0x00a4) */
|
||||
RwReg UART_DMASA; /* (0x00a8) */
|
||||
RwReg reserved2[18];
|
||||
RwReg UART_CPR; /* (0x00f4) */
|
||||
RwReg UART_UCV; /* (0x00f8) */
|
||||
RwReg UART_CTR; /* (0x00fc) */
|
||||
}uart;
|
||||
|
||||
|
||||
|
||||
struct fh_uart {
|
||||
uart *uart_port;
|
||||
int irq;
|
||||
uart *uart_port;
|
||||
int irq;
|
||||
};
|
||||
|
||||
|
||||
@@ -174,34 +174,34 @@ struct fh_uart {
|
||||
|
||||
|
||||
enum data_bits {
|
||||
UART_DATA_BIT5 = 0,
|
||||
UART_DATA_BIT6 = 1,
|
||||
UART_DATA_BIT7 = 2,
|
||||
UART_DATA_BIT8 = 3
|
||||
UART_DATA_BIT5 = 0,
|
||||
UART_DATA_BIT6 = 1,
|
||||
UART_DATA_BIT7 = 2,
|
||||
UART_DATA_BIT8 = 3
|
||||
};
|
||||
|
||||
enum stop_bits {
|
||||
UART_STOP_BIT1 = 0,
|
||||
UART_STOP_BIT1_5 = 1,
|
||||
UART_STOP_BIT2 = 2
|
||||
UART_STOP_BIT1 = 0,
|
||||
UART_STOP_BIT1_5 = 1,
|
||||
UART_STOP_BIT2 = 2
|
||||
};
|
||||
|
||||
enum parity {
|
||||
UART_PARITY_NONE = 0,
|
||||
UART_PARITY_EVEN = 1,
|
||||
UART_PARITY_ODD = 2,
|
||||
UART_PARITY_ST = 3 /* Stick Parity */
|
||||
UART_PARITY_NONE = 0,
|
||||
UART_PARITY_EVEN = 1,
|
||||
UART_PARITY_ODD = 2,
|
||||
UART_PARITY_ST = 3 /* Stick Parity */
|
||||
};
|
||||
|
||||
|
||||
#define UART_CLOCK_FREQ (30000000) //30MHZ
|
||||
#define UART_CLOCK_FREQ (30000000) //30MHZ
|
||||
typedef enum enum_uart_baudrate{
|
||||
BAUDRATE_9600 = (((UART_CLOCK_FREQ/9600)+8)/16),
|
||||
BAUDRATE_19200 = (((UART_CLOCK_FREQ/19200)+8)/16),
|
||||
BAUDRATE_38400 = (((UART_CLOCK_FREQ/38400)+8)/16),
|
||||
BAUDRATE_57600 = (((UART_CLOCK_FREQ/57600)+8)/16),
|
||||
BAUDRATE_115200 = (((UART_CLOCK_FREQ/115200)+8)/16),
|
||||
BAUDRATE_194000 = (((UART_CLOCK_FREQ/194000)+8)/16),
|
||||
BAUDRATE_9600 = (((UART_CLOCK_FREQ/9600)+8)/16),
|
||||
BAUDRATE_19200 = (((UART_CLOCK_FREQ/19200)+8)/16),
|
||||
BAUDRATE_38400 = (((UART_CLOCK_FREQ/38400)+8)/16),
|
||||
BAUDRATE_57600 = (((UART_CLOCK_FREQ/57600)+8)/16),
|
||||
BAUDRATE_115200 = (((UART_CLOCK_FREQ/115200)+8)/16),
|
||||
BAUDRATE_194000 = (((UART_CLOCK_FREQ/194000)+8)/16),
|
||||
}uart_baudrate_e;
|
||||
|
||||
/****************************************************************************
|
||||
@@ -213,8 +213,8 @@ extern int uart_init(uart *port);
|
||||
extern UINT32 uart_get_status(uart *port);
|
||||
|
||||
extern void uart_configure(uart *port, enum data_bits data_bit,
|
||||
enum stop_bits stop_bit, enum parity parity,
|
||||
UINT32 buard_rate, UINT32 uart_clk);
|
||||
enum stop_bits stop_bit, enum parity parity,
|
||||
UINT32 buard_rate, UINT32 uart_clk);
|
||||
|
||||
|
||||
extern int uart_enable_irq(uart *port, UINT32 mode);
|
||||
@@ -235,7 +235,7 @@ extern void uart_set_fifo_mode(uart *port, UINT32 fifo_mode);
|
||||
|
||||
/****************************************************************************
|
||||
* section
|
||||
* add function prototype here if any
|
||||
* add function prototype here if any
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FH_WDT_H_
|
||||
#define FH_WDT_H_
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __BOARD_H__
|
||||
#define __BOARD_H__
|
||||
#include "platform_def.h"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __BOARD_INFO_H__
|
||||
#define __BOARD_INFO_H__
|
||||
|
||||
@@ -33,32 +33,32 @@ extern "C" {
|
||||
|
||||
/****************************************************************************
|
||||
* #include section
|
||||
* add #include here if any
|
||||
* add #include here if any
|
||||
***************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* #define section
|
||||
* add constant #define here if any
|
||||
* add constant #define here if any
|
||||
***************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* ADT section
|
||||
* add Abstract Data Type definition here
|
||||
* add Abstract Data Type definition here
|
||||
***************************************************************************/
|
||||
|
||||
typedef int (*probe_p)(void *);
|
||||
typedef int (*exit_p)(void *);
|
||||
|
||||
struct fh_board_ops {
|
||||
//void *ops_data;
|
||||
probe_p probe;
|
||||
probe_p exit;
|
||||
//void *ops_data;
|
||||
probe_p probe;
|
||||
probe_p exit;
|
||||
};
|
||||
|
||||
struct fh_board_info {
|
||||
char *name;
|
||||
void *data;
|
||||
struct fh_board_ops *ops;
|
||||
char *name;
|
||||
void *data;
|
||||
struct fh_board_ops *ops;
|
||||
|
||||
};
|
||||
|
||||
@@ -73,7 +73,7 @@ void fh_print_all_board_info(void);
|
||||
void fh_free_all_info(void);
|
||||
/****************************************************************************
|
||||
* section
|
||||
* add function prototype here if any
|
||||
* add function prototype here if any
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Include Section
|
||||
* add all #include here
|
||||
@@ -47,11 +47,11 @@
|
||||
*
|
||||
*
|
||||
**************************/
|
||||
#if RT_NAME_MAX != 16
|
||||
#if RT_NAME_MAX != 16
|
||||
#error "define RT_NAME_MAX 16"
|
||||
#endif
|
||||
|
||||
#if RT_TICK_PER_SECOND != 100
|
||||
#if RT_TICK_PER_SECOND != 100
|
||||
#warning "RT_TICK_PER_SECOND = 100"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ARCH_H_
|
||||
#define ARCH_H_
|
||||
|
||||
@@ -31,37 +31,37 @@
|
||||
/*****************************/
|
||||
/* BSP CONTROLLER BASE */
|
||||
/*****************************/
|
||||
#define INTC_REG_BASE (0xE0200000)
|
||||
#define SDC0_REG_BASE (0xE2000000)
|
||||
#define SDC1_REG_BASE (0xE2100000)
|
||||
#define TVE_REG_BASE (0xE8000000)
|
||||
#define VOU_REG_BASE (0xE8100000)
|
||||
#define AES_REG_BASE (0xE8200000)
|
||||
#define JPEG_REG_BASE (0xE8300000)
|
||||
#define ISPB_REG_BASE (0xEA000000)
|
||||
#define ISPF_REG_BASE (0xEA100000)
|
||||
#define VPU_REG_BASE (0xEC000000)
|
||||
#define VCU_REG_BASE (0xEC100000)
|
||||
#define DDRC_REG_BASE (0xED000000)
|
||||
#define DMAC_REG_BASE (0xEE000000)
|
||||
#define GMAC_REG_BASE (0xEF000000)
|
||||
#define PMU_REG_BASE (0xF0000000)
|
||||
#define I2C0_REG_BASE (0xF0200000)
|
||||
#define GPIO0_REG_BASE (0xF0300000)
|
||||
#define INTC_REG_BASE (0xE0200000)
|
||||
#define SDC0_REG_BASE (0xE2000000)
|
||||
#define SDC1_REG_BASE (0xE2100000)
|
||||
#define TVE_REG_BASE (0xE8000000)
|
||||
#define VOU_REG_BASE (0xE8100000)
|
||||
#define AES_REG_BASE (0xE8200000)
|
||||
#define JPEG_REG_BASE (0xE8300000)
|
||||
#define ISPB_REG_BASE (0xEA000000)
|
||||
#define ISPF_REG_BASE (0xEA100000)
|
||||
#define VPU_REG_BASE (0xEC000000)
|
||||
#define VCU_REG_BASE (0xEC100000)
|
||||
#define DDRC_REG_BASE (0xED000000)
|
||||
#define DMAC_REG_BASE (0xEE000000)
|
||||
#define GMAC_REG_BASE (0xEF000000)
|
||||
#define PMU_REG_BASE (0xF0000000)
|
||||
#define I2C0_REG_BASE (0xF0200000)
|
||||
#define GPIO0_REG_BASE (0xF0300000)
|
||||
#define GPIO1_REG_BASE (0xf4000000)
|
||||
#define PWM_REG_BASE (0xF0400000)
|
||||
#define SPI0_REG_BASE (0xF0500000)
|
||||
#define SPI1_REG_BASE (0xF0600000)
|
||||
#define UART0_REG_BASE (0xF0700000)
|
||||
#define UART1_REG_BASE (0xF0800000)
|
||||
#define I2S_REG_BASE (0xF0900000)
|
||||
#define ACODEC_REG_BASE (0xF0A00000)
|
||||
#define I2C1_REG_BASE (0xF0B00000)
|
||||
#define TMR_REG_BASE (0xF0C00000)
|
||||
#define WDT_REG_BASE (0xF0D00000)
|
||||
#define DPHY_REG_BASE (0xF1000000)
|
||||
#define MIPIC_REG_BASE (0xF1100000)
|
||||
#define SADC_REG_BASE (0xF1200000)
|
||||
#define PWM_REG_BASE (0xF0400000)
|
||||
#define SPI0_REG_BASE (0xF0500000)
|
||||
#define SPI1_REG_BASE (0xF0600000)
|
||||
#define UART0_REG_BASE (0xF0700000)
|
||||
#define UART1_REG_BASE (0xF0800000)
|
||||
#define I2S_REG_BASE (0xF0900000)
|
||||
#define ACODEC_REG_BASE (0xF0A00000)
|
||||
#define I2C1_REG_BASE (0xF0B00000)
|
||||
#define TMR_REG_BASE (0xF0C00000)
|
||||
#define WDT_REG_BASE (0xF0D00000)
|
||||
#define DPHY_REG_BASE (0xF1000000)
|
||||
#define MIPIC_REG_BASE (0xF1100000)
|
||||
#define SADC_REG_BASE (0xF1200000)
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,18 +18,18 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOARD_DEF_H_
|
||||
#define BOARD_DEF_H_
|
||||
|
||||
|
||||
/* ***********************
|
||||
* SECTION: DRIVE
|
||||
* SECTION: DRIVE
|
||||
* ***********************/
|
||||
// Basic drive..
|
||||
#define RT_USING_UART1
|
||||
@@ -49,22 +49,22 @@
|
||||
#define CONFIG_PLAT_V2
|
||||
|
||||
#ifndef FH_DDR_START
|
||||
#define FH_DDR_START 0xA0000000
|
||||
#define FH_DDR_END 0xA1000000
|
||||
#define FH_DDR_START 0xA0000000
|
||||
#define FH_DDR_END 0xA1000000
|
||||
|
||||
#define FH_RTT_OS_MEM_SIZE 0x00600000
|
||||
#define FH_DMA_MEM_SIZE 0x20000 /* 128k */
|
||||
#define FH_RTT_OS_MEM_SIZE 0x00600000
|
||||
#define FH_DMA_MEM_SIZE 0x20000 /* 128k */
|
||||
|
||||
#define FH_RTT_OS_MEM_END (FH_DDR_START + FH_RTT_OS_MEM_SIZE)
|
||||
#define FH_SDK_MEM_START (FH_RTT_OS_MEM_END + FH_DMA_MEM_SIZE)
|
||||
#define FH_RTT_OS_HEAP_END FH_SDK_MEM_START
|
||||
#define FH_SDK_MEM_SIZE (FH_DDR_END - FH_SDK_MEM_START)
|
||||
#define FH_RTT_OS_MEM_END (FH_DDR_START + FH_RTT_OS_MEM_SIZE)
|
||||
#define FH_SDK_MEM_START (FH_RTT_OS_MEM_END + FH_DMA_MEM_SIZE)
|
||||
#define FH_RTT_OS_HEAP_END FH_SDK_MEM_START
|
||||
#define FH_SDK_MEM_SIZE (FH_DDR_END - FH_SDK_MEM_START)
|
||||
#endif /* end of FH_DDR_START*/
|
||||
|
||||
|
||||
/* ***********************
|
||||
* SECTION: DRIVE COMPONENT
|
||||
* SECTION: DRIVE COMPONENT
|
||||
* ***********************/
|
||||
#define UART_NAME "uart1"
|
||||
#define UART_NAME "uart1"
|
||||
#define RT_USING_DMA_MEM
|
||||
|
||||
#define RT_USING_MCI0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
#include <mmu.h>
|
||||
@@ -50,13 +50,13 @@ extern void rt_system_heap_init(void*, void*);
|
||||
extern void rt_hw_finsh_init(void);
|
||||
extern void rt_application_init(void);
|
||||
|
||||
static struct mem_desc fh_mem_desc[] =
|
||||
static struct mem_desc fh_mem_desc[] =
|
||||
{
|
||||
{ 0xA0000000, FH_RTT_OS_MEM_END-1, 0xA0000000, SECT_RWX_CB, 0, SECT_MAPPED },
|
||||
{ FH_RTT_OS_MEM_END, FH_DDR_END-1, FH_RTT_OS_MEM_END, SECT_RWNX_NCNB, 0, SECT_MAPPED },
|
||||
{ 0xFFFF0000, 0xFFFF1000-1, 0xA0000000, SECT_TO_PAGE, PAGE_ROX_CB, PAGE_MAPPED }, /* isr vector table */
|
||||
{ 0xE0000000, 0xF1300000-1, 0xE0000000, SECT_RWNX_NCNB, 0, SECT_MAPPED }, /* io table */
|
||||
{ 0xF4000000, 0xF4100000-1, 0xF4000000, SECT_RWNX_NCNB, 0, SECT_MAPPED }, /* GPIO#1 io table */
|
||||
{ 0xA0000000, FH_RTT_OS_MEM_END-1, 0xA0000000, SECT_RWX_CB, 0, SECT_MAPPED },
|
||||
{ FH_RTT_OS_MEM_END, FH_DDR_END-1, FH_RTT_OS_MEM_END, SECT_RWNX_NCNB, 0, SECT_MAPPED },
|
||||
{ 0xFFFF0000, 0xFFFF1000-1, 0xA0000000, SECT_TO_PAGE, PAGE_ROX_CB, PAGE_MAPPED }, /* isr vector table */
|
||||
{ 0xE0000000, 0xF1300000-1, 0xE0000000, SECT_RWNX_NCNB, 0, SECT_MAPPED }, /* io table */
|
||||
{ 0xF4000000, 0xF4100000-1, 0xF4000000, SECT_RWNX_NCNB, 0, SECT_MAPPED }, /* GPIO#1 io table */
|
||||
};
|
||||
|
||||
rt_uint8_t _irq_stack_start[1024];
|
||||
@@ -72,46 +72,46 @@ extern unsigned char __bss_end;
|
||||
*/
|
||||
void rtthread_startup(void)
|
||||
{
|
||||
/* disable interrupt first */
|
||||
rt_hw_interrupt_disable();
|
||||
/* initialize hardware interrupt */
|
||||
rt_hw_interrupt_init();
|
||||
/* disable interrupt first */
|
||||
rt_hw_interrupt_disable();
|
||||
/* initialize hardware interrupt */
|
||||
rt_hw_interrupt_init();
|
||||
|
||||
/* initialize mmu */
|
||||
rt_hw_mmu_init(fh_mem_desc, sizeof(fh_mem_desc)/sizeof(fh_mem_desc[0]));
|
||||
/* initialize mmu */
|
||||
rt_hw_mmu_init(fh_mem_desc, sizeof(fh_mem_desc)/sizeof(fh_mem_desc[0]));
|
||||
|
||||
rt_system_heap_init((void*)&__bss_end, (void*)FH_RTT_OS_MEM_END);
|
||||
rt_system_heap_init((void*)&__bss_end, (void*)FH_RTT_OS_MEM_END);
|
||||
|
||||
#ifdef RT_USING_DMA_MEM
|
||||
//just use the last 100KB
|
||||
fh_dma_mem_init((rt_uint32_t *)FH_RTT_OS_MEM_END, FH_DMA_MEM_SIZE);
|
||||
//just use the last 100KB
|
||||
fh_dma_mem_init((rt_uint32_t *)FH_RTT_OS_MEM_END, FH_DMA_MEM_SIZE);
|
||||
#endif
|
||||
|
||||
/* initialize board */
|
||||
rt_hw_board_init();
|
||||
/* initialize board */
|
||||
rt_hw_board_init();
|
||||
|
||||
/* show version */
|
||||
rt_show_version();
|
||||
/* show version */
|
||||
rt_show_version();
|
||||
|
||||
/* initialize timer system */
|
||||
rt_system_timer_init();
|
||||
/* initialize timer system */
|
||||
rt_system_timer_init();
|
||||
|
||||
/* initialize scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
/* initialize scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
/* initialize application */
|
||||
rt_application_init();
|
||||
/* initialize application */
|
||||
rt_application_init();
|
||||
|
||||
/* initialize system timer thread */
|
||||
rt_system_timer_thread_init();
|
||||
/* initialize system timer thread */
|
||||
rt_system_timer_thread_init();
|
||||
|
||||
/* initialize idle thread */
|
||||
rt_thread_idle_init();
|
||||
/* initialize idle thread */
|
||||
rt_thread_idle_init();
|
||||
|
||||
/* start scheduler */
|
||||
rt_system_scheduler_start();
|
||||
/* start scheduler */
|
||||
rt_system_scheduler_start();
|
||||
|
||||
/* never reach here */
|
||||
/* never reach here */
|
||||
|
||||
return ;
|
||||
return ;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FH_ARCH_H_
|
||||
#define FH_ARCH_H_
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FH_DEF_H_
|
||||
#define FH_DEF_H_
|
||||
|
||||
@@ -32,29 +32,29 @@
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
typedef char SINT8;
|
||||
typedef short SINT16;
|
||||
typedef int SINT32;
|
||||
typedef long long SINT64;
|
||||
typedef unsigned char UINT8;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned int UINT32;
|
||||
typedef unsigned long long UINT64;
|
||||
typedef char SINT8;
|
||||
typedef short SINT16;
|
||||
typedef int SINT32;
|
||||
typedef long long SINT64;
|
||||
typedef unsigned char UINT8;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned int UINT32;
|
||||
typedef unsigned long long UINT64;
|
||||
|
||||
#ifndef TYPE_DEFINED
|
||||
typedef unsigned char uchar;
|
||||
typedef signed char int8;
|
||||
typedef unsigned char uint8;
|
||||
typedef signed short int16;
|
||||
typedef unsigned short uint16;
|
||||
typedef signed int int32;
|
||||
typedef unsigned int uint32;
|
||||
typedef signed long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
typedef float ieee_single;
|
||||
typedef double ieee_double;
|
||||
typedef unsigned char uchar;
|
||||
typedef signed char int8;
|
||||
typedef unsigned char uint8;
|
||||
typedef signed short int16;
|
||||
typedef unsigned short uint16;
|
||||
typedef signed int int32;
|
||||
typedef unsigned int uint32;
|
||||
typedef signed long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
typedef float ieee_single;
|
||||
typedef double ieee_double;
|
||||
|
||||
typedef unsigned long boolean;
|
||||
typedef unsigned long boolean;
|
||||
|
||||
#define TYPE_DEFINED
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,53 +18,53 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ARCH_H_
|
||||
#define ARCH_H_
|
||||
|
||||
/*****************************/
|
||||
/* BSP CONTROLLER BASE */
|
||||
/*****************************/
|
||||
#define INTC_REG_BASE (0xE0200000)
|
||||
#define SDC0_REG_BASE (0xE2000000)
|
||||
#define SDC1_REG_BASE (0xE2100000)
|
||||
#define TVE_REG_BASE (0xE8000000)
|
||||
#define VOU_REG_BASE (0xE8100000)
|
||||
#define AES_REG_BASE (0xE8200000)
|
||||
#define INTC_REG_BASE (0xE0200000)
|
||||
#define SDC0_REG_BASE (0xE2000000)
|
||||
#define SDC1_REG_BASE (0xE2100000)
|
||||
#define TVE_REG_BASE (0xE8000000)
|
||||
#define VOU_REG_BASE (0xE8100000)
|
||||
#define AES_REG_BASE (0xE8200000)
|
||||
/*
|
||||
#define JPEG_REG_BASE (0xE8300000)
|
||||
#define ISPB_REG_BASE (0xEA000000)
|
||||
#define ISPF_REG_BASE (0xEA100000)
|
||||
#define VPU_REG_BASE (0xEC000000)
|
||||
#define VCU_REG_BASE (0xEC100000)
|
||||
#define DDRC_REG_BASE (0xED000000)
|
||||
#define JPEG_REG_BASE (0xE8300000)
|
||||
#define ISPB_REG_BASE (0xEA000000)
|
||||
#define ISPF_REG_BASE (0xEA100000)
|
||||
#define VPU_REG_BASE (0xEC000000)
|
||||
#define VCU_REG_BASE (0xEC100000)
|
||||
#define DDRC_REG_BASE (0xED000000)
|
||||
*/
|
||||
#define DMAC_REG_BASE (0xEE000000)
|
||||
#define GMAC_REG_BASE (0xEF000000)
|
||||
#define PMU_REG_BASE (0xF0000000)
|
||||
#define I2C0_REG_BASE (0xF0200000)
|
||||
#define GPIO0_REG_BASE (0xF0300000)
|
||||
#define DMAC_REG_BASE (0xEE000000)
|
||||
#define GMAC_REG_BASE (0xEF000000)
|
||||
#define PMU_REG_BASE (0xF0000000)
|
||||
#define I2C0_REG_BASE (0xF0200000)
|
||||
#define GPIO0_REG_BASE (0xF0300000)
|
||||
#define GPIO1_REG_BASE (0xf4000000)
|
||||
#define PWM_REG_BASE (0xF0400000)
|
||||
#define SPI0_REG_BASE (0xF0500000)
|
||||
#define SPI1_REG_BASE (0xF0600000)
|
||||
#define UART0_REG_BASE (0xF0700000)
|
||||
#define UART1_REG_BASE (0xF0800000)
|
||||
/*#define I2S_REG_BASE (0xF0900000)*/
|
||||
#define ACODEC_REG_BASE (0xF0A00000)
|
||||
#define I2C1_REG_BASE (0xF0B00000)
|
||||
#define TMR_REG_BASE (0xF0C00000)
|
||||
#define WDT_REG_BASE (0xF0D00000)
|
||||
#define PWM_REG_BASE (0xF0400000)
|
||||
#define SPI0_REG_BASE (0xF0500000)
|
||||
#define SPI1_REG_BASE (0xF0600000)
|
||||
#define UART0_REG_BASE (0xF0700000)
|
||||
#define UART1_REG_BASE (0xF0800000)
|
||||
/*#define I2S_REG_BASE (0xF0900000)*/
|
||||
#define ACODEC_REG_BASE (0xF0A00000)
|
||||
#define I2C1_REG_BASE (0xF0B00000)
|
||||
#define TMR_REG_BASE (0xF0C00000)
|
||||
#define WDT_REG_BASE (0xF0D00000)
|
||||
/*
|
||||
#define DPHY_REG_BASE (0xF1000000)
|
||||
#define MIPIC_REG_BASE (0xF1100000)
|
||||
#define DPHY_REG_BASE (0xF1000000)
|
||||
#define MIPIC_REG_BASE (0xF1100000)
|
||||
*/
|
||||
#define SADC_REG_BASE (0xF1200000)
|
||||
#define SADC_REG_BASE (0xF1200000)
|
||||
|
||||
typedef enum IRQn
|
||||
{
|
||||
|
||||
+1436
-1436
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TIMER_H_
|
||||
#define TIMER_H_
|
||||
|
||||
@@ -43,12 +43,12 @@ void fh_pmu_open(void);
|
||||
void fh_pmu_close(void);
|
||||
*/
|
||||
|
||||
#define DIFF_SDC_REFCLK_0 (0)
|
||||
#define DIFF_SDC_REFCLK_90 (1)
|
||||
#define DIFF_SDC_REFCLK_180 (2)
|
||||
#define DIFF_SDC_REFCLK_270 (3)
|
||||
#define SDC_CLK_PARA_ERROR (0xffff0000)
|
||||
#define SDC_CLK_PARA_OK (0)
|
||||
#define DIFF_SDC_REFCLK_0 (0)
|
||||
#define DIFF_SDC_REFCLK_90 (1)
|
||||
#define DIFF_SDC_REFCLK_180 (2)
|
||||
#define DIFF_SDC_REFCLK_270 (3)
|
||||
#define SDC_CLK_PARA_ERROR (0xffff0000)
|
||||
#define SDC_CLK_PARA_OK (0)
|
||||
|
||||
|
||||
void clk_gate(struct fh_clk *p_clk);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,45 +18,45 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#include "rtdebug.h"
|
||||
#include "arch.h"
|
||||
#include "fh_pmu.h"
|
||||
#include "fh_def.h"
|
||||
|
||||
#define FH_PMU_WRITEL(offset,value) SET_REG((PMU_REG_BASE + offset),value)
|
||||
#define FH_PMU_WRITEL_MASK(offset,value, mask) SET_REG_M((PMU_REG_BASE + offset), value, mask)
|
||||
#define FH_PMU_READL(offset) GET_REG((PMU_REG_BASE + offset))
|
||||
#define FH_PMU_WRITEL(offset,value) SET_REG((PMU_REG_BASE + offset),value)
|
||||
#define FH_PMU_WRITEL_MASK(offset,value, mask) SET_REG_M((PMU_REG_BASE + offset), value, mask)
|
||||
#define FH_PMU_READL(offset) GET_REG((PMU_REG_BASE + offset))
|
||||
|
||||
#define PMU_OFFSET_MAX 0x1d0
|
||||
#define PMU_OFFSET_MAX 0x1d0
|
||||
|
||||
int fh_pmu_read(rt_uint32_t offset, rt_uint32_t *value)
|
||||
{
|
||||
RT_ASSERT(offset < PMU_OFFSET_MAX);
|
||||
RT_ASSERT(offset < PMU_OFFSET_MAX);
|
||||
|
||||
*value = FH_PMU_READL(offset);
|
||||
return 0;
|
||||
*value = FH_PMU_READL(offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fh_pmu_write(rt_uint32_t offset, const rt_uint32_t value)
|
||||
{
|
||||
RT_ASSERT(offset < PMU_OFFSET_MAX);
|
||||
RT_ASSERT(offset < PMU_OFFSET_MAX);
|
||||
|
||||
FH_PMU_WRITEL(offset, value);
|
||||
return 0;
|
||||
FH_PMU_WRITEL(offset, value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fh_pmu_write_mask(rt_uint32_t offset, const rt_uint32_t value,
|
||||
const rt_uint32_t mask)
|
||||
const rt_uint32_t mask)
|
||||
{
|
||||
RT_ASSERT(offset < PMU_OFFSET_MAX);
|
||||
RT_ASSERT(offset < PMU_OFFSET_MAX);
|
||||
|
||||
FH_PMU_WRITEL_MASK(offset, value, mask);
|
||||
return 0;
|
||||
FH_PMU_WRITEL_MASK(offset, value, mask);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FH_PMU_H_
|
||||
#define FH_PMU_H_
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#define REG_PMU_PLL0_CTRL (0x010)
|
||||
#define REG_PMU_PLL1_CTRL (0x014)
|
||||
#define REG_PMU_ARC_CLK_GATE (0x018)
|
||||
#define REG_PMU_CLK_GATE (0x01c)
|
||||
#define REG_PMU_CLK_GATE (0x01c)
|
||||
#define REG_PMU_CLK_SEL (0x020)
|
||||
#define REG_PMU_CLK_DIV0 (0x024)
|
||||
#define REG_PMU_CLK_DIV1 (0x028)
|
||||
|
||||
+175
-175
File diff suppressed because it is too large
Load Diff
+107
-107
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
#include "fh_pmu.h"
|
||||
@@ -32,13 +32,13 @@
|
||||
|
||||
void machine_reset(void)
|
||||
{
|
||||
fh_pmu_write(REG_PMU_SWRST_MAIN_CTRL, 0x7fffffff);
|
||||
fh_pmu_write(REG_PMU_SWRST_MAIN_CTRL, 0x7fffffff);
|
||||
}
|
||||
|
||||
void machine_shutdown(void)
|
||||
{
|
||||
while(1)
|
||||
;
|
||||
while(1)
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -43,48 +43,48 @@ static unsigned long long timestamp;
|
||||
|
||||
rt_uint32_t read_pts(void)
|
||||
{
|
||||
return GET_REG(REG_PAE_PTS_REG);
|
||||
return GET_REG(REG_PAE_PTS_REG);
|
||||
}
|
||||
|
||||
unsigned long long get_ticks(void)
|
||||
{
|
||||
rt_uint32_t now = read_pts();
|
||||
if (now >= lastdec) {
|
||||
/* normal mode */
|
||||
timestamp += now - lastdec;
|
||||
} else {
|
||||
now = read_pts();
|
||||
if (now >= lastdec)
|
||||
timestamp += now - lastdec;
|
||||
else {
|
||||
/* we have an overflow ... */
|
||||
timestamp += now + 0xffffffff - lastdec;
|
||||
}
|
||||
}
|
||||
lastdec = now;
|
||||
return timestamp / (TICKS_PER_USEC * 10);
|
||||
rt_uint32_t now = read_pts();
|
||||
if (now >= lastdec) {
|
||||
/* normal mode */
|
||||
timestamp += now - lastdec;
|
||||
} else {
|
||||
now = read_pts();
|
||||
if (now >= lastdec)
|
||||
timestamp += now - lastdec;
|
||||
else {
|
||||
/* we have an overflow ... */
|
||||
timestamp += now + 0xffffffff - lastdec;
|
||||
}
|
||||
}
|
||||
lastdec = now;
|
||||
return timestamp / (TICKS_PER_USEC * 10);
|
||||
}
|
||||
|
||||
void udelay(unsigned long usec)
|
||||
{
|
||||
unsigned long long tmp;
|
||||
rt_uint32_t tmo;
|
||||
tmo = (usec + 9) / 10;
|
||||
tmp = get_ticks() + tmo; /* get current timestamp */
|
||||
unsigned long long tmp;
|
||||
rt_uint32_t tmo;
|
||||
tmo = (usec + 9) / 10;
|
||||
tmp = get_ticks() + tmo; /* get current timestamp */
|
||||
|
||||
while (get_ticks() < tmp)
|
||||
/* loop till event */
|
||||
/*NOP*/;
|
||||
while (get_ticks() < tmp)
|
||||
/* loop till event */
|
||||
/*NOP*/;
|
||||
}
|
||||
|
||||
void rt_timer_handler(int vector, void *param)
|
||||
{
|
||||
timer *tim = param;
|
||||
timer *tim = param;
|
||||
|
||||
rt_interrupt_enter();
|
||||
timer_get_eoi(tim);
|
||||
rt_tick_increase();
|
||||
rt_interrupt_leave();
|
||||
rt_interrupt_enter();
|
||||
timer_get_eoi(tim);
|
||||
rt_tick_increase();
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,18 +92,18 @@ void rt_timer_handler(int vector, void *param)
|
||||
*/
|
||||
void rt_hw_timer_init()
|
||||
{
|
||||
timer *tim = (timer *) TMR_REG_BASE;
|
||||
timer_init(tim);
|
||||
/* install interrupt handler */
|
||||
rt_hw_interrupt_install(TMR0_IRQn, rt_timer_handler, (void *) tim,
|
||||
"sys_tick");
|
||||
rt_hw_interrupt_umask(TMR0_IRQn);
|
||||
timer *tim = (timer *) TMR_REG_BASE;
|
||||
timer_init(tim);
|
||||
/* install interrupt handler */
|
||||
rt_hw_interrupt_install(TMR0_IRQn, rt_timer_handler, (void *) tim,
|
||||
"sys_tick");
|
||||
rt_hw_interrupt_umask(TMR0_IRQn);
|
||||
|
||||
timer_set_mode(tim, TIMER_MODE_PERIODIC);
|
||||
timer_set_period(tim, RT_TICK_PER_SECOND, TIMER_CLOCK);
|
||||
//timer_set_period(tim, RT_TIMER_TICK_PER_SECOND, TIMER_CLOCK);
|
||||
timer_enable_irq(tim);
|
||||
timer_enable(tim);
|
||||
timer_set_mode(tim, TIMER_MODE_PERIODIC);
|
||||
timer_set_period(tim, RT_TICK_PER_SECOND, TIMER_CLOCK);
|
||||
//timer_set_period(tim, RT_TIMER_TICK_PER_SECOND, TIMER_CLOCK);
|
||||
timer_enable_irq(tim);
|
||||
timer_enable(tim);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TIMER_H_
|
||||
#define TIMER_H_
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This file is part of FH8620 BSP for RT-Thread distribution.
|
||||
*
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
|
||||
* All rights reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,12 +18,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
* Visit http://www.fullhan.com to get contact with Fullhan.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
|
||||
#ifndef PLATFORM_DEF_H_
|
||||
#define PLATFORM_DEF_H_
|
||||
|
||||
|
||||
+24
-24
@@ -5,19 +5,19 @@
|
||||
// <RDTConfigurator URL="http://www.rt-thread.com/eclipse">
|
||||
|
||||
// <integer name="RT_NAME_MAX" description="Maximal size of kernel object name length" default="6" />
|
||||
#define RT_NAME_MAX 16
|
||||
#define RT_NAME_MAX 16
|
||||
// <integer name="RT_ALIGN_SIZE" description="Alignment size for CPU architecture data access" default="4" />
|
||||
#define RT_ALIGN_SIZE 4
|
||||
#define RT_ALIGN_SIZE 4
|
||||
// <integer name="RT_THREAD_PRIORITY_MAX" description="Maximal level of thread priority" default="32">
|
||||
// <item description="8">8</item>
|
||||
// <item description="32">32</item>
|
||||
// <item description="256">256</item>
|
||||
// </integer>
|
||||
#define RT_THREAD_PRIORITY_MAX 256
|
||||
#define RT_THREAD_PRIORITY_MAX 256
|
||||
// <integer name="RT_TICK_PER_SECOND" description="OS tick per second" default="100" />
|
||||
#define RT_TICK_PER_SECOND 100
|
||||
#define RT_TICK_PER_SECOND 100
|
||||
// <integer name="IDLE_THREAD_STACK_SIZE" description="The stack size of idle thread" default="512" />
|
||||
#define IDLE_THREAD_STACK_SIZE 512
|
||||
#define IDLE_THREAD_STACK_SIZE 512
|
||||
// <bool name="RT_USING_MODULE" description="Using Application Module" default="true" />
|
||||
// #define RT_USING_MODULE
|
||||
// <bool name="RT_USING_CPU_FFS" description="Using CPU instructions for ffs function" default="true" />
|
||||
@@ -36,11 +36,11 @@
|
||||
// <section name="RT_USING_TIMER_SOFT" description="Using software timer which will start a thread to handle soft-timer" default="true" >
|
||||
// #define RT_USING_TIMER_SOFT
|
||||
// <integer name="RT_TIMER_THREAD_PRIO" description="The priority level of timer thread" default="4" />
|
||||
#define RT_TIMER_THREAD_PRIO 4
|
||||
#define RT_TIMER_THREAD_PRIO 4
|
||||
// <integer name="RT_TIMER_THREAD_STACK_SIZE" description="The stack size of timer thread" default="512" />
|
||||
#define RT_TIMER_THREAD_STACK_SIZE 512
|
||||
#define RT_TIMER_THREAD_STACK_SIZE 512
|
||||
// <integer name="RT_TIMER_TICK_PER_SECOND" description="The soft-timer tick per second" default="10" />
|
||||
#define RT_TIMER_TICK_PER_SECOND 100
|
||||
#define RT_TIMER_TICK_PER_SECOND 100
|
||||
// </section>
|
||||
|
||||
// <section name="IPC" description="Inter-Thread communication" default="always" >
|
||||
@@ -86,13 +86,13 @@
|
||||
// <bool name="RT_USING_RTC" description="Using RTC Device Driver Framework" default="true" />
|
||||
//#define RT_USING_RTC
|
||||
// <integer name="RT_MMCSD_THREAD_PREORITY" description="The prority of mmcsd thread" default="15" />
|
||||
#define RT_MMCSD_THREAD_PREORITY 15
|
||||
#define RT_MMCSD_THREAD_PREORITY 15
|
||||
// <section name="RT_USING_CONSOLE" description="Using console" default="true" >
|
||||
#define RT_USING_CONSOLE
|
||||
// <integer name="RT_CONSOLEBUF_SIZE" description="The buffer size for console output" default="128" />
|
||||
#define RT_CONSOLEBUF_SIZE 128
|
||||
#define RT_CONSOLEBUF_SIZE 128
|
||||
// <string name="RT_CONSOLE_DEVICE_NAME" description="The device name for console" default="uart" />
|
||||
#define RT_CONSOLE_DEVICE_NAME "uart1"
|
||||
#define RT_CONSOLE_DEVICE_NAME "uart1"
|
||||
// </section>
|
||||
|
||||
// <bool name="RT_USING_COMPONENTS_INIT" description="Using RT-Thread components initialization" default="true" />
|
||||
@@ -105,7 +105,7 @@
|
||||
// <bool name="FINSH_USING_DESCRIPTION" description="Keeping description in symbol table" default="true" />
|
||||
#define FINSH_USING_DESCRIPTION
|
||||
// <integer name="FINSH_THREAD_STACK_SIZE" description="The stack size for finsh thread" default="4096" />
|
||||
#define FINSH_THREAD_STACK_SIZE 4096
|
||||
#define FINSH_THREAD_STACK_SIZE 4096
|
||||
// </section>
|
||||
|
||||
// <section name="LIBC" description="C Runtime library setting" default="always" >
|
||||
@@ -124,9 +124,9 @@
|
||||
// <bool name="DFS_USING_WORKDIR" description="Using working directory" default="true" />
|
||||
#define DFS_USING_WORKDIR
|
||||
// <integer name="DFS_FILESYSTEMS_MAX" description="The maximal number of mounted file system" default="4" />
|
||||
#define DFS_FILESYSTEMS_MAX 2
|
||||
#define DFS_FILESYSTEMS_MAX 2
|
||||
// <integer name="DFS_FD_MAX" description="The maximal number of opened files" default="4" />
|
||||
#define DFS_FD_MAX 16
|
||||
#define DFS_FD_MAX 16
|
||||
// <bool name="RT_USING_DFS_ELMFAT" description="Using ELM FatFs" default="true" />
|
||||
#define RT_USING_DFS_ELMFAT
|
||||
// <integer name="RT_DFS_ELM_DRIVES" description="The maximal number of drives of FatFs" default="4" />
|
||||
@@ -138,13 +138,13 @@
|
||||
// <item description="LFN with dynamic LFN working buffer on the stack">2</item>
|
||||
// <item description="LFN with dynamic LFN working buffer on the heap">3</item>
|
||||
// </integer>
|
||||
#define RT_DFS_ELM_USE_LFN 3
|
||||
#define RT_DFS_ELM_USE_LFN 3
|
||||
// <integer name="RT_DFS_ELM_CODE_PAGE" description="OEM code page" default="936">
|
||||
#define RT_DFS_ELM_CODE_PAGE 936
|
||||
#define RT_DFS_ELM_CODE_PAGE 936
|
||||
// <bool name="RT_DFS_ELM_CODE_PAGE_FILE" description="Using OEM code page file" default="false" />
|
||||
#define RT_DFS_ELM_CODE_PAGE_FILE
|
||||
// <integer name="RT_DFS_ELM_MAX_LFN" description="Maximal size of file name length" default="255" />
|
||||
#define RT_DFS_ELM_MAX_LFN 255
|
||||
#define RT_DFS_ELM_MAX_LFN 255
|
||||
// <integer name="RT_DFS_ELM_MAX_SECTOR_SIZE" description="Maximal size of sector" default="512" />
|
||||
#define RT_DFS_ELM_MAX_SECTOR_SIZE 4096
|
||||
// <bool name="RT_USING_DFS_YAFFS2" description="Using YAFFS2" default="false" />
|
||||
@@ -174,19 +174,19 @@
|
||||
// <bool name="RT_LWIP_DHCP" description="Enable DHCP client to get IP address" default="false" />
|
||||
#define RT_LWIP_DHCP
|
||||
// <integer name="RT_LWIP_TCPTHREAD_PRIORITY" description="the thread priority of TCP thread" default="128" />
|
||||
#define RT_LWIP_TCPTHREAD_PRIORITY 12
|
||||
#define RT_LWIP_TCPTHREAD_PRIORITY 12
|
||||
// <integer name="RT_LWIP_TCPTHREAD_MBOX_SIZE" description="the mail box size of TCP thread to wait for" default="32" />
|
||||
#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8
|
||||
#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8
|
||||
// <integer name="RT_LWIP_TCPTHREAD_STACKSIZE" description="the thread stack size of TCP thread" default="4096" />
|
||||
#define RT_LWIP_TCPTHREAD_STACKSIZE 4096
|
||||
#define RT_LWIP_TCPTHREAD_STACKSIZE 4096
|
||||
// <integer name="RT_LWIP_ETHTHREAD_PRIORITY" description="the thread priority of ethnetif thread" default="144" />
|
||||
#define RT_LWIP_ETHTHREAD_PRIORITY 14
|
||||
#define RT_LWIP_ETHTHREAD_PRIORITY 14
|
||||
// <integer name="RT_LWIP_ETHTHREAD_MBOX_SIZE" description="the mail box size of ethnetif thread to wait for" default="8" />
|
||||
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 8
|
||||
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 8
|
||||
// <integer name="RT_LWIP_ETHTHREAD_STACKSIZE" description="the stack size of ethnetif thread" default="512" />
|
||||
#define RT_LWIP_ETHTHREAD_STACKSIZE 512
|
||||
#define RT_LWIP_ETHTHREAD_STACKSIZE 512
|
||||
// <ipaddr name="RT_LWIP_IPADDR" description="IP address of device" default="192.168.1.30" />
|
||||
#define RT_LWIP_IPADDR "192.168.1.30"
|
||||
#define RT_LWIP_IPADDR "192.168.1.30"
|
||||
// <ipaddr name="RT_LWIP_GWADDR" description="Gateway address of device" default="192.168.1.1" />
|
||||
#define RT_LWIP_GWADDR "192.168.1.1"
|
||||
// <ipaddr name="RT_LWIP_MSKADDR" description="Mask address of device" default="255.255.255.0" />
|
||||
|
||||
Reference in New Issue
Block a user