[bsp]delete fh8620、gkipc, because of gpl license

This commit is contained in:
yangjie
2021-04-25 11:39:21 +08:00
parent e3c19a8463
commit 6152b37ca6
737 changed files with 0 additions and 891349 deletions
-1
View File
@@ -125,7 +125,6 @@ jobs:
- {RTT_BSP: "beaglebone", RTT_TOOL_CHAIN: "sourcery-arm"}
- {RTT_BSP: "zynqmp-r5-axu4ev", RTT_TOOL_CHAIN: "sourcery-arm"}
- {RTT_BSP: "frdm-k64f", RTT_TOOL_CHAIN: "sourcery-arm"}
- {RTT_BSP: "fh8620", RTT_TOOL_CHAIN: "sourcery-arm"}
- {RTT_BSP: "xplorer4330/M4", RTT_TOOL_CHAIN: "sourcery-arm"}
- {RTT_BSP: "at32/at32f403a-start", RTT_TOOL_CHAIN: "sourcery-arm"}
- {RTT_BSP: "at32/at32f407-start", RTT_TOOL_CHAIN: "sourcery-arm"}
Vendored
-2
View File
@@ -29,7 +29,6 @@ pipeline {
// ['gd32e230k-start', 'sourcery-arm'], /* CI compile not support */
['gd32303e-eval', 'sourcery-arm'],
// ['gd32450z-eval', 'sourcery-arm'], /* CI link not support */
['gkipc', 'sourcery-arm'],
['imx6sx/cortex-a9', 'sourcery-arm'],
// ['imxrt/imxrt1052-atk-commander', 'sourcery-arm'], /* CI compile not support */
// ['imxrt/imxrt1052-fire-pro', 'sourcery-arm'], /* CI compile not support */
@@ -108,7 +107,6 @@ pipeline {
['swm320-lq100', 'sourcery-arm'],
['beaglebone', 'sourcery-arm'],
['frdm-k64f', 'sourcery-arm'],
['fh8620', 'sourcery-arm'],
['xplorer4330/M4', 'sourcery-arm'],
// ['at32/at32f403a-start', 'sourcery-arm'],/* CI link not support */
// ['at32/at32f407-start', 'sourcery-arm']/* CI compile C99 not support */
-14
View File
@@ -1,14 +0,0 @@
# for module compiling
import os
Import('RTT_ROOT')
cwd = str(Dir('#'))
objs = []
list = os.listdir(cwd)
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
objs = objs + SConscript(os.path.join(d, 'SConscript'))
Return('objs')
-34
View File
@@ -1,34 +0,0 @@
import os
import sys
import rtconfig
if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
else:
RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
from building import *
TARGET = rtconfig.OUTPUT_NAME + rtconfig.TARGET_EXT
# add rtconfig.h path to the assembler
rtconfig.AFLAGS += ' -I' + str(Dir('#')) +' -I' + RTT_ROOT + '/libcpu/arm/armv6'
DefaultEnvironment(tools=[])
env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
Export('RTT_ROOT')
Export('rtconfig')
# prepare building environment
objs = PrepareBuilding(env, RTT_ROOT)
# make a building
DoBuilding(TARGET, objs)
-11
View File
@@ -1,11 +0,0 @@
import rtconfig
Import('RTT_ROOT')
from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd, str(Dir('#'))]
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
Return('group')
-44
View File
@@ -1,44 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#include <rtthread.h>
void init_thread(void *parameter)
{
rt_components_init();
return ;
}
int rt_application_init(void)
{
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);
return 0;
}
-9
View File
@@ -1,9 +0,0 @@
from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd]
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
Return('group')
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-170
View File
@@ -1,170 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
/*****************************************************************************
* Include Section
* add all #include here
*****************************************************************************/
#include "drivers/dma.h"
/*****************************************************************************
* Define section
* add all #define here
*****************************************************************************/
/****************************************************************************
* ADT section
* add definition of user defined Data Type that only be used in this file here
***************************************************************************/
/******************************************************************************
* Function prototype section
* add prototypes for all functions called by this file,execepting those
* declared in header file
*****************************************************************************/
/*****************************************************************************
* Global variables section - Exported
* add declaration of global variables that will be exported here
* e.g.
* int8_t foo;
****************************************************************************/
/*****************************************************************************
* static fun;
*****************************************************************************/
static rt_err_t rt_dma_init(struct rt_device *dev);
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);
static rt_err_t rt_dma_control(struct rt_device *dev,
rt_uint8_t cmd,
void *args);
/*****************************************************************************
* Global variables section - Local
* define global variables(will be refered only in this file) here,
* static keyword should be used to limit scope of local variable to this file
* e.g.
* static uint8_t ufoo;
*****************************************************************************/
/* function body */
/*****************************************************************************
* Description:
* add funtion description here
* Parameters:
* description for each argument, new argument starts at new line
* Return:
* what does this function returned?
*****************************************************************************/
static rt_err_t rt_dma_init(struct rt_device *dev)
{
struct rt_dma_device *dma;
RT_ASSERT(dev != RT_NULL);
dma = (struct rt_dma_device *)dev;
if (dma->ops->init)
{
return (dma->ops->init(dma));
}
return (-RT_ENOSYS);
}
static rt_err_t rt_dma_open(struct rt_device *dev, rt_uint16_t oflag)
{
return (RT_EOK);
}
static rt_err_t rt_dma_close(struct rt_device *dev)
{
struct rt_dma_device *dma;
RT_ASSERT(dev != RT_NULL);
dma = (struct rt_dma_device *)dev;
if (dma->ops->control(dma, RT_DEVICE_CTRL_DMA_CLOSE, RT_NULL) != RT_EOK)
{
return (-RT_ERROR);
}
return (RT_EOK);
}
static rt_err_t rt_dma_control(struct rt_device *dev,
rt_uint8_t cmd,
void *args)
{
struct rt_dma_device *dma;
RT_ASSERT(dev != RT_NULL);
dma = (struct rt_dma_device *)dev;
//args is the private data for the soc!!
return (dma->ops->control(dma, cmd, args));
}
/**
* This function register a dma device
*/
rt_err_t rt_hw_dma_register(struct rt_dma_device *dma,
const char *name,
rt_uint32_t flag,
void *data)
{
rt_uint32_t ret;
struct rt_device *device;
RT_ASSERT(dma != RT_NULL);
device = &(dma->parent);
device->type = RT_Device_Class_Miscellaneous;
device->rx_indicate = RT_NULL;
device->tx_complete = RT_NULL;
device->init = rt_dma_init;
device->open = rt_dma_open;
device->close = rt_dma_close;
device->read = RT_NULL;
device->write = RT_NULL;
device->control = rt_dma_control;
device->user_data = data;
/* register a character device */
ret = rt_device_register(device, name, flag);
rt_kprintf("dma ret is :%x\n",ret);
return ret;
}
-107
View File
@@ -1,107 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef DMA_H_
#define DMA_H_
#include <rtthread.h>
/****************************************************************************
* #include section
* add #include here if any
***************************************************************************/
/****************************************************************************
* #define section
* 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)
//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_ (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 */
/****************************************************************************
* ADT section
* add Abstract Data Type definition here
***************************************************************************/
struct rt_dma_ops;
struct rt_dma_device
{
// the parent must be the fitst para..
struct rt_device parent;
struct rt_dma_ops *ops;
};
struct rt_dma_ops
{
rt_err_t (*init)(struct rt_dma_device *dma);
rt_err_t (*control)(struct rt_dma_device *dma, int cmd, void *arg);
};
/****************************************************************************
* extern variable declaration section
***************************************************************************/
/****************************************************************************
* section
* add function prototype here if any
***************************************************************************/
rt_err_t rt_hw_dma_register(struct rt_dma_device *dma,
const char *name,
rt_uint32_t flag,
void *data);
/********************************End Of File********************************/
#endif
-122
View File
@@ -1,122 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
/*****************************************************************************
* Include Section
* add all #include here
*****************************************************************************/
#include "dma_mem.h"
#ifdef RT_USING_DMA_MEM
/*****************************************************************************
* Define section
* add all #define here
*****************************************************************************/
//#define FH_TEST_DMA_MEM
/****************************************************************************
* ADT section
* add definition of user defined Data Type that only be used in this file here
***************************************************************************/
/******************************************************************************
* Function prototype section
* add prototypes for all functions called by this file,execepting those
* declared in header file
*****************************************************************************/
/*****************************************************************************
* Global variables section - Exported
* add declaration of global variables that will be exported here
* e.g.
* int8_t foo;
****************************************************************************/
/*****************************************************************************
* static fun;
*****************************************************************************/
/*****************************************************************************
* Global variables section - Local
* define global variables(will be refered only in this file) here,
* static keyword should be used to limit scope of local variable to this file
* e.g.
* static uint8_t ufoo;
*****************************************************************************/
static struct rt_memheap dma_heap = {0};
/* function body */
/*****************************************************************************
* Description:
* add funtion description here
* Parameters:
* description for each argument, new argument starts at new line
* Return:
* 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);
}
void *fh_dma_mem_malloc(rt_uint32_t size){
return rt_memheap_alloc(&dma_heap, size);
}
void fh_dma_mem_free(void *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;
}
#endif
#ifdef RT_USING_FINSH
#include <finsh.h>
#ifdef FH_TEST_DMA_MEM
FINSH_FUNCTION_EXPORT(dma_mem_debug, dma_start & left size & max_use);
#endif
#endif
#endif
-76
View File
@@ -1,76 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef DMA_MEM_H_
#define DMA_MEM_H_
#ifndef RT_USING_MEMHEAP
#define RT_USING_MEMHEAP
#endif
#include <rtthread.h>
/****************************************************************************
* #include section
* add #include here if any
***************************************************************************/
/****************************************************************************
* #define section
* add constant #define here if any
***************************************************************************/
/****************************************************************************
* ADT section
* add Abstract Data Type definition here
***************************************************************************/
/****************************************************************************
* extern variable declaration section
***************************************************************************/
/****************************************************************************
* section
* 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);
void *fh_dma_mem_malloc(rt_uint32_t size);
void fh_dma_mem_free(void *ptr);
/********************************End Of File********************************/
#endif
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-188
View File
@@ -1,188 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef GPIO_H_
#define GPIO_H_
#include <rtdef.h>
/**
* GPIO interrupt trigger type macro,
* each represent an interrupt trigger mode
*
* @see gpio_set_irq_type();
*/
enum
{
IRQ_TYPE_NONE = 0x00000000, /**< none*/
IRQ_TYPE_EDGE_RISING = 0x00000001, /**< rising edge*/
IRQ_TYPE_EDGE_FALLING = 0x00000002, /**< falling edge*/
IRQ_TYPE_EDGE_BOTH = (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING),
IRQ_TYPE_LEVEL_HIGH = 0x00000004, /**< high level*/
IRQ_TYPE_LEVEL_LOW = 0x00000008, /**< low level*/
IRQ_TYPE_LEVEL_MASK = (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH),
IRQ_TYPE_TRIGGER_MASK = (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW | \
IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING),
};
/**
* GPIO direction macro,
* each represent a direction
*
* @see gpio_get_direction();
* @see gpio_set_direction();
*/
#define GPIO_DIR_OUTPUT 1 /**< output*/
#define GPIO_DIR_INPUT 0 /**< input*/
/**
* convert GPIO number to IRQ number
* @param gpio GPIO number to be converted
* @return IRQ number
*/
rt_uint32_t gpio_to_irq(rt_uint32_t gpio);
/**
* disable GPIO's debounce mode
* controls whether an external signal that is the source
* of an interrupt needs to be debounced to remove any
* spurious glitches.
* @param gpio GPIO number
*/
void gpio_disable_debounce(rt_uint32_t gpio);
/**
* enable GPIO's debounce mode
* controls whether an external signal that is the source
* of an interrupt needs to be debounced to remove any
* spurious glitches.
* @param gpio GPIO number
*/
void gpio_enable_debounce(rt_uint32_t gpio);
/**
* allows each GPIO to be configured for interrupts
* it configures the corresponding GPIO to become an interrupt
* @param gpio GPIO number
*/
void gpio_irq_enable(rt_uint32_t irq);
/**
* GPIO operates as a normal GPIO signal
* interrupts are disabled
* @param gpio GPIO number
*/
void gpio_irq_disable(rt_uint32_t irq);
/**
* it configures the interrupt type to be
* falling-edge or active-low sensitive
* rising-edge or active-high sensitive.
* @param gpio GPIO number
* @param type interrupt type
* @return 0 if OK
*/
int gpio_set_irq_type(rt_uint32_t gpio, rt_uint32_t type);
/**
* mask the interrupt
* @param gpio GPIO number
* @return 0 if OK
*/
int gpio_irq_mask(rt_uint32_t irq);
/**
* unmask the interrupt
* @param gpio GPIO number
* @return 0 if OK
*/
int gpio_irq_unmask(rt_uint32_t irq);
/**
* get corresponding GPIO's direction
* @param gpio GPIO number
* @return 0 - input
* 1 - output
*/
int gpio_get_direction(rt_uint32_t gpio);
/**
* set corresponding GPIO's direction
* @param gpio GPIO number
* @return 0 - input
* 1 - output
*/
void gpio_set_direction(rt_uint32_t gpio, rt_uint32_t direction);
/**
* get corresponding GPIO's value
* @param gpio GPIO number
* @return GPIO value
*/
int gpio_get_value(rt_uint32_t gpio);
/**
* set corresponding GPIO's value
* @param gpio GPIO number
* @param val GPIO value
*/
void gpio_set_value(rt_uint32_t gpio, int val);
/**
* set corresponding GPIO's direction to input
* @param gpio GPIO number
* @return 0 if OK
*/
int gpio_direction_input(rt_uint32_t gpio);
/**
* set corresponding GPIO's value and set direction to output
* @param gpio GPIO number
* @param val GPIO value
* @return 0 if OK
*/
int gpio_direction_output(rt_uint32_t gpio, rt_uint32_t val);
/**
* request a GPIO
* @param gpio GPIO number
* @return 0 if OK
*/
int gpio_request(rt_uint32_t gpio);
/**
* release a GPIO
* @param gpio GPIO number
* @return 0 if OK
*/
int gpio_release(rt_uint32_t gpio);
/**
* initialize GPIO driver
*/
void rt_hw_gpio_init(void);
#endif /* GPIO_H_ */
File diff suppressed because it is too large Load Diff
-56
View File
@@ -1,56 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef __FH81_I2C_H__
#define __FH81_I2C_H__
#include <rtthread.h>
struct i2c_driver
{
int cmd_err;
int msg_err;
rt_uint32_t status;
struct rt_i2c_msg *msgs;
int msgs_num;
int msg_write_idx;
rt_uint32_t tx_buf_len;
rt_uint8_t *tx_buf;
int msg_read_idx;
rt_uint32_t rx_buf_len;
rt_uint8_t *rx_buf;
struct rt_i2c_bus_device *i2c_bus_dev;
struct rt_completion transfer_completion;
rt_mutex_t lock;
void* priv;
};
void rt_hw_i2c_init(void);
#endif
File diff suppressed because it is too large Load Diff
-40
View File
@@ -1,40 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef INTERRUPT_H_
#define INTERRUPT_H_
#include <rthw.h>
#define NR_INTERNAL_IRQS 56
#define NR_EXTERNAL_IRQS 64
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);
#endif /* INTERRUPT_H_ */
-87
View File
@@ -1,87 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#include <rtthread.h>
#include <rtdevice.h>
#include "mmu.h"
#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_memset((void *) t_addr, t_value, 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;
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++;
}
rt_kprintf("\n");
}
#endif
#ifdef RT_USING_FINSH
#include <finsh.h>
#ifdef FH_DBG_MEM_PROCESS
FINSH_FUNCTION_EXPORT(mem_input, mem_input(addr,size,value));
FINSH_FUNCTION_EXPORT(mem_output, mem_output(add,size));
#endif
#endif
File diff suppressed because it is too large Load Diff
-51
View File
@@ -1,51 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef MMC_H_
#define MMC_H_
#include "libraries/inc/fh_driverlib.h"
#define MMC_FEQ_MIN 100000
#define MMC_FEQ_MAX 50000000
#define CARD_UNPLUGED 1
#define CARD_PLUGED 0
struct mmc_driver
{
MMC_DMA_Descriptors* dma_descriptors;
rt_uint32_t max_desc;
struct rt_mmcsd_host *host;
struct rt_mmcsd_req *req;
struct rt_mmcsd_data *data;
struct rt_mmcsd_cmd *cmd;
struct rt_completion transfer_completion;
void* priv;
};
void rt_hw_mmc_init(void);
#endif /* MMC_H_ */
File diff suppressed because it is too large Load Diff
-57
View File
@@ -1,57 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef PWM_H_
#define PWM_H_
#include <rtthread.h>
#define ENABLE_PWM (0x10)
#define DISABLE_PWM (0x11)
#define SET_PWM_DUTY_CYCLE (0x12)
#define GET_PWM_DUTY_CYCLE (0x13)
struct pwm_device
{
int id;
int working;
rt_uint32_t period_ns;
rt_uint32_t counter_ns;
};
struct pwm_driver
{
//struct clk *clk;
struct pwm_device pwm[3];
struct pwm_device *cur;
void* priv;
};
#endif /* PWM_H_ */
File diff suppressed because it is too large Load Diff
-109
View File
@@ -1,109 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef SADC_H_
#define SADC_H_
#include <rtdef.h>
#ifdef RT_USING_SADC
/****************************************************************************
* #define section
* 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 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)
/****************************************************************************
* ADT section
* 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;
};
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;
//bind to the rtdev..
rt_device_t rt_dev;
};
typedef struct{
rt_uint32_t channel;
rt_uint32_t sadc_data;
}SADC_INFO;
/****************************************************************************
* extern variable declaration section
***************************************************************************/
/****************************************************************************
* section
* add function prototype here if any
***************************************************************************/
void rt_hw_sadc_init(void);
#endif
#endif /* SADC_H_ */
File diff suppressed because it is too large Load Diff
-71
View File
@@ -1,71 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
/*
* spi_fh_adapt.h
*
* Created on: Mar 2, 2016
* Author: duobao
*/
#ifndef SPI_FH_ADAPT_H_
#define SPI_FH_ADAPT_H_
#include <rtthread.h>
#include <drivers/spi.h>
#define MTD_WRITEABLE 0x400 /* Device is writeable */
#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */
#define MTD_NO_ERASE 0x1000 /* No erase necessary */
#define MTD_POWERUP_LOCK 0x2000 /* Always locked after reset */
struct mtd_partition {
char *name; /* identifier string */
rt_uint32_t size; /* partition size */
rt_uint32_t offset; /* offset within the master MTD space */
rt_uint32_t mask_flags; /* master MTD flags to mask out for this partition */
struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only) */
};
struct flash_platform_data {
char *flash_name;
char *spi_name;
struct mtd_partition *parts;
unsigned int nr_parts;
char *type;
/* we'll likely add more ... use JEDEC IDs, etc */
};
rt_err_t fh_flash_adapt_init(void);
#endif /* SPI_FH_ADAPT_H_ */
File diff suppressed because it is too large Load Diff
-134
View File
@@ -1,134 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef SSI_H_
#define SSI_H_
#include "libraries/inc/fh_driverlib.h"
#include <drivers/spi.h>
#include <rtdevice.h>
#include "fh_dma.h"
#define SPI_PRIV(drv) ( (struct fh_spi_obj)(drv->priv) )
#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;
};
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;
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];
};
struct spi_controller;
//driver use below.......
struct spi_slave_info
{
struct rt_spi_device spi_device;
struct spi_controller *control;
struct spi_slave_platform_data plat_slave;
rt_uint32_t id;
//spi control will use to find all the slave info..
struct spi_slave_info *next;
};
struct spi_dma
{
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;
struct rt_dma_device *dma_dev;
struct dma_transfer tx_trans;
struct dma_transfer rx_trans;
struct spi_controller *control;
};
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 dma_xfer_flag;
#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 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 fh_spi_obj obj;
rt_uint32_t received_len;
rt_uint32_t transfered_len;
void* priv;
};
void rt_hw_spi_init(void);
#endif /* SPI_H_ */
-197
View File
@@ -1,197 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#include <rthw.h>
#include <armv6.h>
#include "fh_arch.h"
#include "interrupt.h"
#include "libraries/inc/fh_ictl.h"
/**
* @addtogroup FH81
*/
/*@{*/
extern struct rt_thread *rt_current_thread;
#ifdef RT_USING_FINSH
extern long list_thread(void);
#endif
/**
* this function will show registers of CPU
*
* @param regs the registers point
*/
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);
}
/**
* When ARM7TDMI comes across an instruction which it cannot handle,
* it takes the undefined instruction trap.
*
* @param regs system registers
*
* @note never invoke this function in application
*/
void rt_hw_trap_udef(struct rt_hw_register *regs)
{
rt_hw_show_register(regs);
rt_kprintf("undefined instruction\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
#ifdef RT_USING_FINSH
list_thread();
#endif
rt_hw_cpu_shutdown();
}
/**
* The software interrupt instruction (SWI) is used for entering
* Supervisor mode, usually to request a particular supervisor
* function.
*
* @param regs system registers
*
* @note never invoke this function in application
*/
void rt_hw_trap_swi(struct rt_hw_register *regs)
{
rt_hw_show_register(regs);
rt_kprintf("software interrupt\n");
rt_hw_cpu_shutdown();
}
/**
* An abort indicates that the current memory access cannot be completed,
* which occurs during an instruction prefetch.
*
* @param regs system registers
*
* @note never invoke this function in application
*/
void rt_hw_trap_pabt(struct rt_hw_register *regs)
{
rt_hw_show_register(regs);
rt_kprintf("prefetch abort\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
#ifdef RT_USING_FINSH
list_thread();
#endif
rt_hw_cpu_shutdown();
}
/**
* An abort indicates that the current memory access cannot be completed,
* which occurs during a data access.
*
* @param regs system registers
*
* @note never invoke this function in application
*/
void rt_hw_trap_dabt(struct rt_hw_register *regs)
{
rt_hw_show_register(regs);
rt_kprintf("data abort\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
#ifdef RT_USING_FINSH
list_thread();
#endif
rt_hw_cpu_shutdown();
}
/**
* Normally, system will never reach here
*
* @param regs system registers
*
* @note never invoke this function in application
*/
void rt_hw_trap_resv(struct rt_hw_register *regs)
{
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;
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;
}
/* 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);
}
#ifdef RT_USING_INTERRUPT_INFO
irq_desc[irq].counter ++;
#endif
}
void rt_hw_trap_fiq()
{
rt_kprintf("fast interrupt request\n");
}
/*@}*/
File diff suppressed because it is too large Load Diff
-33
View File
@@ -1,33 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef UART_H_
#define UART_H_
void rt_hw_uart_init(void);
#endif
File diff suppressed because it is too large Load Diff
-46
View File
@@ -1,46 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef WDT_H_
#define WDT_H_
struct wdt_driver
{
//struct clk *clk;
unsigned long in_use;
unsigned long next_heartbeat;
//struct timer_list timer;
int expect_close;
void* priv;
};
#endif /* WDT_H_ */
-14
View File
@@ -1,14 +0,0 @@
# for module compiling
import os
from building import *
objs = []
cwd = GetCurrentDir()
list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
objs = objs + SConscript(os.path.join(item, 'SConscript'))
Return('objs')
@@ -1,9 +0,0 @@
from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
path = [cwd + '/..']
group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path)
Return('group')
-27
View File
@@ -1,27 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
File diff suppressed because it is too large Load Diff
-69
View File
@@ -1,69 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* 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;
}
}
void ictl_mask_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));
}
}
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));
}
}
File diff suppressed because it is too large Load Diff
-42
View File
@@ -1,42 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#include "inc/fh_driverlib.h"
void PWM_Enable(struct fh_pwm_obj *pwm_obj, int enable)
{
SET_REG(pwm_obj->base + OFFSET_PWM_CTRL, enable);
}
unsigned int PWM_GetPwmCmd(struct fh_pwm_obj *pwm_obj, int device_id)
{
return GET_REG(pwm_obj->base + OFFSET_PWM_CMD(device_id));
}
void PWM_SetPwmCmd(struct fh_pwm_obj *pwm_obj, int device_id, unsigned int reg)
{
SET_REG(pwm_obj->base + OFFSET_PWM_CMD(device_id), reg);
}
File diff suppressed because it is too large Load Diff
-164
View File
@@ -1,164 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#include "fh_def.h"
#include "fh_arch.h"
#include "inc/fh_driverlib.h"
void SPI_EnableSlaveen(struct fh_spi_obj *spi_obj, rt_uint32_t port)
{
rt_uint32_t reg;
reg = GET_REG(spi_obj->base + OFFSET_SPI_SER);
reg |= (1 << port);
SET_REG(spi_obj->base + OFFSET_SPI_SER, reg);
}
void SPI_DisableSlaveen(struct fh_spi_obj *spi_obj, rt_uint32_t port)
{
rt_uint32_t reg;
reg = GET_REG(spi_obj->base + OFFSET_SPI_SER);
reg &= ~(1 << port);
SET_REG(spi_obj->base + OFFSET_SPI_SER, reg);
}
void SPI_SetTxLevel(struct fh_spi_obj *spi_obj, rt_uint32_t level)
{
SET_REG(spi_obj->base + OFFSET_SPI_TXFTLR, level);
}
void SPI_EnableInterrupt(struct fh_spi_obj *spi_obj, rt_uint32_t flag)
{
rt_uint32_t reg;
reg = GET_REG(spi_obj->base + OFFSET_SPI_IMR);
reg |= flag;
SET_REG(spi_obj->base + OFFSET_SPI_IMR, reg);
}
void SPI_EnableDma(struct fh_spi_obj *spi_obj, rt_uint32_t channel)
{
rt_uint32_t reg;
reg = GET_REG(spi_obj->base + OFFSET_SPI_DMACTRL);
reg |= channel;
SET_REG(spi_obj->base + OFFSET_SPI_DMACTRL, reg);
}
void SPI_DisableDma(struct fh_spi_obj *spi_obj, rt_uint32_t channel)
{
rt_uint32_t reg;
reg = GET_REG(spi_obj->base + OFFSET_SPI_DMACTRL);
reg &= ~channel;
SET_REG(spi_obj->base + OFFSET_SPI_DMACTRL, reg);
}
void SPI_DisableInterrupt(struct fh_spi_obj *spi_obj, rt_uint32_t flag)
{
rt_uint32_t reg;
reg = GET_REG(spi_obj->base + OFFSET_SPI_IMR);
reg &= ~flag;
SET_REG(spi_obj->base + OFFSET_SPI_IMR, reg);
}
rt_uint32_t SPI_InterruptStatus(struct fh_spi_obj *spi_obj)
{
return GET_REG(spi_obj->base + OFFSET_SPI_ISR);
}
void SPI_ClearInterrupt(struct fh_spi_obj *spi_obj)
{
GET_REG(spi_obj->base + OFFSET_SPI_ICR);
}
rt_uint32_t SPI_ReadTxFifoLevel(struct fh_spi_obj *spi_obj)
{
return GET_REG(spi_obj->base + OFFSET_SPI_TXFLR);
}
rt_uint32_t SPI_ReadRxFifoLevel(struct fh_spi_obj *spi_obj)
{
return GET_REG(spi_obj->base + OFFSET_SPI_RXFLR);
}
UINT8 SPI_ReadData(struct fh_spi_obj *spi_obj)
{
return GET_REG(spi_obj->base + OFFSET_SPI_DR) & 0xff;
}
void SPI_WriteData(struct fh_spi_obj *spi_obj, UINT8 data)
{
SET_REG(spi_obj->base + OFFSET_SPI_DR, data);
}
rt_uint32_t SPI_ReadStatus(struct fh_spi_obj *spi_obj)
{
return GET_REG(spi_obj->base + OFFSET_SPI_SR);
}
void SPI_Enable(struct fh_spi_obj *spi_obj, int enable)
{
SET_REG(spi_obj->base + OFFSET_SPI_SSIENR, enable);
}
void SPI_WriteTxDmaLevel(struct fh_spi_obj *spi_obj, rt_uint32_t data)
{
SET_REG(spi_obj->base + OFFSET_SPI_DMATDL, data);
}
void SPI_WriteRxDmaLevel(struct fh_spi_obj *spi_obj, rt_uint32_t data)
{
SET_REG(spi_obj->base + OFFSET_SPI_DMARDL, data);
}
void SPI_SetParameter(struct fh_spi_obj *spi_obj)
{
rt_uint32_t reg;
struct spi_config *config;
config = &spi_obj->config;
SET_REG(spi_obj->base + OFFSET_SPI_BAUD, config->clk_div);
reg = GET_REG(spi_obj->base + OFFSET_SPI_CTRL0);
reg &= ~(0x3ff);
reg |= config->data_size \
| config->frame_format \
| config->clk_phase \
| config->clk_polarity \
| config->transfer_mode;
SET_REG(spi_obj->base + OFFSET_SPI_CTRL0, reg);
}
-144
View File
@@ -1,144 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
/*****************************************************************************
* Include Section
* add all #include here
*****************************************************************************/
#include "inc/fh_driverlib.h"
/*****************************************************************************
* Define section
* add all #define here
*****************************************************************************/
/****************************************************************************
* ADT section
* add definition of user defined Data Type that only be used in this file here
***************************************************************************/
/******************************************************************************
* Function prototype section
* add prototypes for all functions called by this file,execepting those
* declared in header file
*****************************************************************************/
/*****************************************************************************
* Global variables section - Exported
* add declaration of global variables that will be exported here
* e.g.
* int8_t foo;
****************************************************************************/
/*****************************************************************************
* Global variables section - Local
* define global variables(will be refered only in this file) here,
* static keyword should be used to limit scope of local variable to this file
* e.g.
* static uint8_t ufoo;
*****************************************************************************/
/* function body */
/*****************************************************************************
* Description:
* add funtion description here
* Parameters:
* description for each argument, new argument starts at new line
* Return:
* what does this function returned?
*****************************************************************************/
int timer_init(timer *tim)
{
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;
}
return 0;
}
void timer_set_period(timer *tim, UINT32 period, UINT32 clock)
{
tim->TIMER_LOAD_COUNT = clock/period;
}
void timer_enable(timer *tim)
{
tim->TIMER_CTRL_REG |= TIMER_CTRL_ENABLE;
}
void timer_disable(timer *tim)
{
tim->TIMER_CTRL_REG &= ~TIMER_CTRL_ENABLE;
}
void timer_enable_irq(timer *tim)
{
tim->TIMER_CTRL_REG &= ~TIMER_CTRL_INTMASK;
}
void timer_disable_irq(timer *tim)
{
tim->TIMER_CTRL_REG |= TIMER_CTRL_INTMASK;
}
UINT32 timer_get_status(timer *tim)
{
return tim->TIMER_INT_STATUS;
}
UINT32 timer_get_eoi(timer *tim)
{
return tim->TIMER_EOI;
}
UINT32 timer_get_value(timer *tim)
{
return tim->TIMER_LOAD_COUNT - tim->TIMER_CURRENT_VALUE;
}
File diff suppressed because it is too large Load Diff
-52
View File
@@ -1,52 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#include "inc/fh_driverlib.h"
void WDT_Enable(struct fh_wdt_obj *wdt_obj, int enable)
{
SET_REG(wdt_obj->base + WDOG_CONTROL_REG_OFFSET, enable);
}
void WDT_SetTopValue(struct fh_wdt_obj *wdt_obj, int top)
{
SET_REG(wdt_obj->base + WDOG_TIMEOUT_RANGE_REG_OFFSET, top);
}
void WDT_SetCtrl(struct fh_wdt_obj *wdt_obj, UINT32 reg)
{
SET_REG(wdt_obj->base + WDOG_CONTROL_REG_OFFSET, reg);
}
void WDT_Kick(struct fh_wdt_obj *wdt_obj)
{
SET_REG(wdt_obj->base + WDOG_COUNTER_RESTART_REG_OFFSET, WDOG_COUNTER_RESTART_KICK_VALUE);
}
UINT32 WDT_GetCurrCount(struct fh_wdt_obj *wdt_obj)
{
return GET_REG(wdt_obj->base + WDOG_CURRENT_COUNT_REG_OFFSET);
}
-39
View File
@@ -1,39 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#include <rtthread.h>
#include <rthw.h>
#include "fh_def.h"
#include "fh_arch.h"
#include "fh_ictl.h"
#include "fh_timer.h"
#include "fh_uart.h"
#include "fh_spi.h"
#include "fh_gpio.h"
#include "fh_mmc.h"
#include "fh_i2c.h"
#include "fh_pwm.h"
#include "fh_wdt.h"
-54
View File
@@ -1,54 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef FH_GPIO_H_
#define FH_GPIO_H_
#define REG_GPIO_SWPORTA_DR (0x0000)
#define REG_GPIO_SWPORTA_DDR (0x0004)
#define REG_GPIO_PORTA_CTL (0x0008)
#define REG_GPIO_INTEN (0x0030)
#define REG_GPIO_INTMASK (0x0034)
#define REG_GPIO_INTTYPE_LEVEL (0x0038)
#define REG_GPIO_INT_POLARITY (0x003C)
#define REG_GPIO_INTSTATUS (0x0040)
#define REG_GPIO_RAWINTSTATUS (0x0044)
#define REG_GPIO_DEBOUNCE (0x0048)
#define REG_GPIO_PORTA_EOI (0x004C)
#define REG_GPIO_EXT_PORTA (0x0050)
#define NUM_OF_GPIO (64)
struct fh_gpio_obj
{
unsigned int id;
unsigned int irq;
};
#endif /* FH_GPIO_H_ */
File diff suppressed because it is too large Load Diff
-58
View File
@@ -1,58 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef FH_ICTL_H_
#define FH_ICTL_H_
#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;
}fh_intc;
void ictl_close_all_isr(fh_intc *p);
void ictl_mask_isr(fh_intc *p,int irq);
void ictl_unmask_isr(fh_intc *p,int irq);
#endif
File diff suppressed because it is too large Load Diff
-44
View File
@@ -1,44 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef FH_PWM_H_
#define FH_PWM_H_
#define OFFSET_PWM_CTRL (0x00)
#define OFFSET_PWM_CMD(n) (((n) * 4) + OFFSET_PWM_CTRL + 4)
struct fh_pwm_obj
{
int id;
int irq;
unsigned int base;
};
void PWM_Enable(struct fh_pwm_obj *pwm_obj, int enable);
void PWM_SetPwmCmd(struct fh_pwm_obj *pwm_obj, int device_id, unsigned int reg);
unsigned int PWM_GetPwmCmd(struct fh_pwm_obj *pwm_obj, int device_id);
#endif /* FH_PWM_H_ */
File diff suppressed because it is too large Load Diff
-148
View File
@@ -1,148 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef FH_SPI_H_
#define FH_SPI_H_
#include "fh_def.h"
#include "fh_arch.h"
#define OFFSET_SPI_CTRL0 (0x00)
#define OFFSET_SPI_CTRL1 (0x04)
#define OFFSET_SPI_SSIENR (0x08)
#define OFFSET_SPI_MWCR (0x0c)
#define OFFSET_SPI_SER (0x10)
#define OFFSET_SPI_BAUD (0x14)
#define OFFSET_SPI_TXFTLR (0x18)
#define OFFSET_SPI_RXFTLR (0x1c)
#define OFFSET_SPI_TXFLR (0x20)
#define OFFSET_SPI_RXFLR (0x24)
#define OFFSET_SPI_SR (0x28)
#define OFFSET_SPI_IMR (0x2c)
#define OFFSET_SPI_ISR (0x30)
#define OFFSET_SPI_RISR (0x34)
#define OFFSET_SPI_TXOIC (0x38)
#define OFFSET_SPI_RXOIC (0x3c)
#define OFFSET_SPI_RXUIC (0x40)
#define OFFSET_SPI_MSTIC (0x44)
#define OFFSET_SPI_ICR (0x48)
#define OFFSET_SPI_DMACTRL (0x4c)
#define OFFSET_SPI_DMATDL (0x50)
#define OFFSET_SPI_DMARDL (0x54)
#define OFFSET_SPI_IDR (0x58)
#define OFFSET_SPI_SSI_COMPVER (0x5c)
#define OFFSET_SPI_DR (0x60)
#define SPI_FORMAT_MOTOROLA (0x00)
#define SPI_FORMAT_TI (0x10)
#define SPI_FORMAT_MICROWIRE (0x20)
#define SPI_MODE_TX_RX (0x000)
#define SPI_MODE_TX_ONLY (0x100)
#define SPI_MODE_RX_ONLY (0x200)
#define SPI_MODE_EEPROM (0x300)
#define SPI_DATA_SIZE_4BIT (0x03)
#define SPI_DATA_SIZE_5BIT (0x04)
#define SPI_DATA_SIZE_6BIT (0x05)
#define SPI_DATA_SIZE_7BIT (0x06)
#define SPI_DATA_SIZE_8BIT (0x07)
#define SPI_DATA_SIZE_9BIT (0x08)
#define SPI_DATA_SIZE_10BIT (0x09)
#define SPI_DATA_SIZE_16BIT (0x0f)
#define SPI_POLARITY_HIGH (1<<7)
#define SPI_POLARITY_LOW (0<<7)
#define SPI_PHASE_RX_FIRST (0<<6)
#define SPI_PHASE_TX_FIRST (1<<6)
#define SPI_FIFO_DEPTH (32)
#define SPI_IRQ_TXEIM (1<<0)
#define SPI_IRQ_TXOIM (1<<1)
#define SPI_IRQ_RXUIM (1<<2)
#define SPI_IRQ_RXOIM (1<<3)
#define SPI_IRQ_RXFIM (1<<4)
#define SPI_IRQ_MSTIM (1<<5)
#define SPI_IRQ_ALL (0x3f)
#define SPI_ISR_FLAG (SPI_IRQ_TXEIM|SPI_IRQ_TXOIM|SPI_IRQ_RXUIM|SPI_IRQ_RXOIM)
#define SPI_ISR_ERROR (SPI_IRQ_TXOIM | SPI_IRQ_RXUIM | SPI_IRQ_RXOIM)
#define SPI_STATUS_BUSY (1)
#define SPI_TX_DMA (1<<1)
#define SPI_RX_DMA (1<<0)
struct spi_config
{
rt_uint32_t frame_format;
rt_uint32_t transfer_mode;
rt_uint32_t clk_polarity;
rt_uint32_t clk_phase;
rt_uint32_t data_size;
rt_uint32_t clk_div;
};
struct fh_spi_obj
{
rt_uint32_t id;
rt_uint32_t irq;
rt_uint32_t base;
rt_uint32_t fifo_len;
rt_uint32_t transfered_len;
rt_uint32_t received_len;
rt_uint32_t cs_gpio_pin;
struct spi_config config;
};
void SPI_EnableSlaveen(struct fh_spi_obj *spi_obj, rt_uint32_t port);
void SPI_DisableSlaveen(struct fh_spi_obj *spi_obj, rt_uint32_t port);
void SPI_SetTxLevel(struct fh_spi_obj *spi_obj, rt_uint32_t level);
void SPI_EnableIrq(struct fh_spi_obj *spi_obj, rt_uint32_t flag);
void SPI_DisableIrq(struct fh_spi_obj *spi_obj, rt_uint32_t flag);
rt_uint32_t SPI_InterruptStatus(struct fh_spi_obj *spi_obj);
void SPI_ClearInterrupt(struct fh_spi_obj *spi_obj);
rt_uint32_t SPI_ReadTxFifoLevel(struct fh_spi_obj *spi_obj);
rt_uint32_t SPI_ReadRxFifoLevel(struct fh_spi_obj *spi_obj);
UINT8 SPI_ReadData(struct fh_spi_obj *spi_obj);
void SPI_WriteData(struct fh_spi_obj *spi_obj, UINT8 data);
rt_uint32_t SPI_ReadStatus(struct fh_spi_obj *spi_obj);
void SPI_Enable(struct fh_spi_obj *spi_obj, int enable);
void SPI_SetParameter(struct fh_spi_obj *spi_obj);
void SPI_EnableDma(struct fh_spi_obj *spi_obj, rt_uint32_t channel);
void SPI_DisableDma(struct fh_spi_obj *spi_obj, rt_uint32_t channel);
void SPI_WriteTxDmaLevel(struct fh_spi_obj *spi_obj, rt_uint32_t data);
void SPI_WriteRxDmaLevel(struct fh_spi_obj *spi_obj, rt_uint32_t data);
#endif /* FH_SPI_H_ */
-100
View File
@@ -1,100 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef FH_TIMER_H_
#define FH_TIMER_H_
/****************************************************************************
* #include section
* add #include here if any
***************************************************************************/
#include "fh_def.h"
/****************************************************************************
* #define section
* add constant #define here if any
***************************************************************************/
#define TIMER_CTRL_ENABLE (1u << 0)
#define TIMER_CTRL_MODE (1u << 1)
#define TIMER_CTRL_INTMASK (1u << 2)
#define TIMER_CTRL_PWMEN (1u << 3)
/****************************************************************************
* ADT section
* 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;
}timer;
enum timer_mode {
TIMER_MODE_PERIODIC = 0,
TIMER_MODE_ONESHOT = 1,
};
/****************************************************************************
* extern variable declaration section
***************************************************************************/
/****************************************************************************
* section
* add function prototype here if any
***************************************************************************/
int timer_init(timer *tim);
int timer_set_mode(timer *tim, enum timer_mode);
void timer_set_period(timer *tim, UINT32 period, UINT32 clock);
void timer_enable(timer *tim);
void timer_disable(timer *tim);
void timer_enable_irq(timer *tim);
void timer_disable_irq(timer *tim);
UINT32 timer_get_status(timer *tim);
void udelay(unsigned long usec);
#endif /* #ifndef _TIMER_ */
File diff suppressed because it is too large Load Diff
-71
View File
@@ -1,71 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef FH_WDT_H_
#define FH_WDT_H_
#include "fh_def.h"
#define WDOG_CONTROL_REG_OFFSET 0x00
#define WDOG_CONTROL_REG_WDT_EN_MASK 0x01
#define WDOG_CONTROL_REG_RMOD_MASK 0x02
#define WDOG_TIMEOUT_RANGE_REG_OFFSET 0x04
#define WDOG_CURRENT_COUNT_REG_OFFSET 0x08
#define WDOG_COUNTER_RESTART_REG_OFFSET 0x0c
#define WDOG_COUNTER_RESTART_KICK_VALUE 0x76
/* Hardware timeout in seconds */
#define WDT_HW_TIMEOUT 2
/* User land timeout */
#define WDT_HEARTBEAT 15
/* The maximum TOP (timeout period) value that can be set in the watchdog. */
#define FH_WDT_MAX_TOP 15
#define WDT_TIMEOUT (HZ / 2)
struct fh_wdt_obj
{
int id;
int irq;
unsigned int base;
};
void WDT_Enable(struct fh_wdt_obj *wdt_obj, int enable);
rt_inline int WDT_IsEnable(struct fh_wdt_obj *wdt_obj)
{
return GET_REG(wdt_obj->base + WDOG_CONTROL_REG_OFFSET) &
WDOG_CONTROL_REG_WDT_EN_MASK;
}
void WDT_SetTopValue(struct fh_wdt_obj *wdt_obj, int top);
void WDT_SetCtrl(struct fh_wdt_obj *wdt_obj, UINT32 reg);
void WDT_Kick(struct fh_wdt_obj *wdt_obj);
unsigned int WDT_GetCurrCount(struct fh_wdt_obj *wdt_obj);
#endif /* FH_WDT_H_ */
-10
View File
@@ -1,10 +0,0 @@
from building import *
Import('rtconfig')
cwd = GetCurrentDir()
src = ['gcc/start_gcc.S']
group = DefineGroup('Libraries', src, depend = [''])
Return('group')
File diff suppressed because it is too large Load Diff
-96
View File
@@ -1,96 +0,0 @@
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
SECTIONS
{
. =0xA0000000;
. = ALIGN(4);
__text_start = .;
.text :
{
*(.init)
*(.text)
*(.gnu.linkonce.t*)
/* section information for finsh shell */
. = ALIGN(4);
__fsymtab_start = .;
KEEP(*(FSymTab))
__fsymtab_end = .;
. = ALIGN(4);
__vsymtab_start = .;
KEEP(*(VSymTab))
__vsymtab_end = .;
. = ALIGN(4);
. = ALIGN(4);
__rt_init_start = .;
KEEP(*(SORT(.rti_fn*)))
__rt_init_end = .;
. = ALIGN(4);
/* section information for modules */
. = ALIGN(4);
__rtmsymtab_start = .;
KEEP(*(RTMSymTab))
__rtmsymtab_end = .;
}
__text_end = .;
. = ALIGN(4);
__rodata_start = .;
.rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) *(.eh_frame) }
__rodata_end = .;
. = ALIGN(4);
.ctors :
{
PROVIDE(__ctors_start__ = .);
KEEP(*(SORT(.ctors.*)))
KEEP(*(.ctors))
PROVIDE(__ctors_end__ = .);
}
.dtors :
{
PROVIDE(__dtors_start__ = .);
KEEP(*(SORT(.dtors.*)))
KEEP(*(.dtors))
PROVIDE(__dtors_end__ = .);
}
. = ALIGN(4);
__data_start = .;
.data :
{
*(.data)
*(.data.*)
*(.gnu.linkonce.d*)
}
__data_end = .;
. = ALIGN(4);
.nobss : { *(.nobss) }
. = ALIGN(4);
__bss_start = .;
.bss : { *(.bss) }
__bss_end = .;
/* stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
_end = .;
}
-15
View File
@@ -1,15 +0,0 @@
# RT-Thread building script for bridge
import os
from building import *
cwd = GetCurrentDir()
objs = []
list = os.listdir(cwd)
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
objs = objs + SConscript(os.path.join(d, 'SConscript'))
Return('objs')
-33
View File
@@ -1,33 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef __BOARD_H__
#define __BOARD_H__
#include "platform_def.h"
void rt_hw_board_init(void);
#endif
-83
View File
@@ -1,83 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef __BOARD_INFO_H__
#define __BOARD_INFO_H__
#ifdef __cplusplus
extern "C" {
#endif
/****************************************************************************
* #include section
* add #include here if any
***************************************************************************/
/****************************************************************************
* #define section
* add constant #define here if any
***************************************************************************/
/****************************************************************************
* ADT section
* 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;
};
struct fh_board_info {
char *name;
void *data;
struct fh_board_ops *ops;
};
/****************************************************************************
* extern variable declaration section
***************************************************************************/
int fh_board_info_init(void);
struct fh_board_info *fh_board_info_register(char *info_name, void *data);
int fh_board_driver_register(char *info_name, struct fh_board_ops *ops);
void fh_print_all_board_info(void);
void fh_free_all_info(void);
/****************************************************************************
* section
* add function prototype here if any
***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif
-8
View File
@@ -1,8 +0,0 @@
from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
group = DefineGroup('Drivers', src, depend = [''])
Return('group')
File diff suppressed because it is too large Load Diff
-120
View File
@@ -1,120 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
/*****************************************************************************
* Include Section
* add all #include here
* those macro below should define....
* or the dsp or isp lib will not be supported
*****************************************************************************/
#include <rtconfig.h>
//#pragma comment ( linker, "/EXPORT: MyExportFunction = _MyExportFunctio" )
//#pragma message
//#warning RT_NAME_MAX=32
//#error ....
//#define yu_error(macro) #error ##macro
/**************************
*
*
* define value below.
*
*
**************************/
#if RT_NAME_MAX != 16
#error "define RT_NAME_MAX 16"
#endif
#if RT_TICK_PER_SECOND != 100
#warning "RT_TICK_PER_SECOND = 100"
#endif
#if RT_ALIGN_SIZE != 4
#error "define RT_ALIGN_SIZE 4"
#endif
/**************************
*
*
* should define below..
*
*
**************************/
#ifndef RT_USING_SEMAPHORE
#error need define "RT_USING_SEMAPHORE"
#endif
#ifndef RT_USING_MUTEX
#error need define "RT_USING_MUTEX"
#endif
#ifndef RT_USING_EVENT
#error need define "RT_USING_EVENT"
#endif
#ifndef RT_USING_MAILBOX
#error need define "RT_USING_MAILBOX"
#endif
#ifndef RT_USING_MESSAGEQUEUE
#warning need define "RT_USING_MESSAGEQUEUE"
#endif
#ifndef RT_USING_MEMPOOL
#warning need define "RT_USING_MEMPOOL"
#endif
#ifndef RT_USING_HEAP
#error need define "RT_USING_HEAP"
#endif
#ifndef RT_USING_MEMHEAP
#warning need define "RT_USING_MEMHEAP"
#endif
#ifndef RT_USING_DEVICE
#error need define "RT_USING_DEVICE"
#endif
#ifndef RT_USING_CONSOLE
#error need define "RT_USING_CONSOLE"
#endif
#ifndef RT_USING_FINSH
#error need define "RT_USING_FINSH"
#endif
#ifndef RT_USING_I2C
#error need define "RT_USING_I2C"
#endif
-15
View File
@@ -1,15 +0,0 @@
# RT-Thread building script for bridge
import os
from building import *
cwd = GetCurrentDir()
objs = []
list = os.listdir(cwd)
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
objs = objs + SConscript(os.path.join(d, 'SConscript'))
Return('objs')
-117
View File
@@ -1,117 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* 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 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)
typedef enum IRQn
{
PAE_IRQn = 0,
VPU_IRQn = 1,
ISP_F_IRQn = 2,
ISP_B_IRQn = 3,
VOU_IRQn = 4,
JPEG_IRQn = 5,
TVE_IRQn = 6,
TOE_IRQn = 7,
DDRC_IRQn = 8,
DMAC_IRQn = 9,
AES_IRQn = 10,
MIPIC_IRQn = 11,
MIPI_WRAP_IRQn = 12,
PMU_IRQn = 13,
EMAC_IRQn = 14,
AXIC0_IRQn = 16,
AXIC1_IRQn = 17,
X2H0_IRQn = 18,
X2H1_IRQn = 19,
AHBC0_IRQn = 20,
AHBC1_IRQn = 21,
SADC_IRQn = 23,
SDC0_IRQn = 24,
SDC1_IRQn = 25,
ACW_IRQn = 26,
WDT_IRQn = 27,
SPI0_IRQn = 28,
SPI1_IRQn = 29,
UART0_IRQn = 30,
UART1_IRQn = 31,
I2S0_IRQn = 32,
I2S1_IRQn = 33,
RTC_IRQn = 34,
PWM_IRQn = 35,
TMR0_IRQn = 36,
TMR1_IRQn = 37,
USB0_IRQn = 38,
USB1_IRQn = 39,
GPIO0_IRQn = 40,
GPIO1_IRQn = 41,
I2C0_IRQn = 42,
I2C1_IRQn = 43,
} IRQn_Type;
#endif /* ARCH_H_ */
@@ -1,9 +0,0 @@
from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
path = [cwd, cwd + '/..']
group = DefineGroup('Drivers', src, depend = ['CONFIG_BOARD_IOTCAM', 'CONFIG_CHIP_FH8620'], CPPPATH = path)
Return('group')
File diff suppressed because it is too large Load Diff
@@ -1,106 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef BOARD_DEF_H_
#define BOARD_DEF_H_
/* ***********************
* SECTION: DRIVE
* ***********************/
// Basic drive..
#define RT_USING_UART1
#define RT_USING_GPIO
#define RT_USING_SDIO
#define RT_USING_FH_DMA
#define RT_USING_FH_ACW
#define RT_USING_I2C
#define RT_USING_PWM
#define RT_USING_WDT
#define RT_USING_SPI
#define RT_USING_SADC
#define RT_USING_DSP
#define RT_USING_ISP
#define CONFIG_PLAT_V2
#ifndef FH_DDR_START
#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_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
* ***********************/
#define UART_NAME "uart1"
#define RT_USING_DMA_MEM
#define RT_USING_MCI0
#define RT_USING_GD
#define RT_USING_FLASH_DEFAULT
#define RT_USING_FH_FLASH_ADAPT
#ifndef _FH_AUTO_CONFIG_
#define CHANNUM 2
#define CHN0_Height 720
#define CHN0_WIDTH 1280
#define CHN0_Framerate 0x00010019
#define CHN0_Bitrate (2048 *4)
#define CHN1_Framerate 0x00010019
#define CHN1_WIDTH 352
#define CHN1_Height 288
#define CHN1_Bitrate 512
#define VPU_FRAME_CTRL 1
#define CONFIG_IRCUT_OFF 1
#define CONFIG_ISP_25FPS 1
#define NOT_RECORD 1
#define ENABLE_JPEG 1
#define CONFIG_ISP_720P 1
#define ENABLE_COOLVIEW 1
#define ENABLE_OSD 1
#define USE_RC 1
#define OSD_CHN_FONT_USING 1
#endif
#endif /* BOARD_H_ */
File diff suppressed because it is too large Load Diff
@@ -1,4 +0,0 @@
IoT Camera
powered by RT-Thread
V1.0
2016-3-14
@@ -1,117 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#include <rthw.h>
#include <rtthread.h>
#include <mmu.h>
#ifdef RT_USING_FINSH
#include <finsh.h>
#endif
#ifdef RT_USING_DMA_MEM
#include "dma_mem.h"
#endif
#include "board_def.h"
extern void rt_hw_interrupt_init(void);
extern void rt_hw_board_init(void);
extern void rt_system_timer_init(void);
extern void rt_system_scheduler_init(void);
extern void rt_thread_idle_init(void);
extern void mmu_invalidate_icache();
extern void rt_hw_cpu_icache_enable(void);
extern void rt_show_version(void);
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[] =
{
{ 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];
rt_uint8_t _fiq_stack_start[1024];
rt_uint8_t _undefined_stack_start[512];
rt_uint8_t _abort_stack_start[512];
rt_uint8_t _svc_stack_start[4096] RT_SECTION(".nobss");
extern unsigned char __bss_start;
extern unsigned char __bss_end;
/**
* This function will startup RT-Thread RTOS.
*/
void rtthread_startup(void)
{
/* 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]));
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);
#endif
/* initialize board */
rt_hw_board_init();
/* show version */
rt_show_version();
/* initialize timer system */
rt_system_timer_init();
/* initialize scheduler system */
rt_system_scheduler_init();
/* initialize application */
rt_application_init();
/* initialize system timer thread */
rt_system_timer_thread_init();
/* initialize idle thread */
rt_thread_idle_init();
/* start scheduler */
rt_system_scheduler_start();
/* never reach here */
return ;
}
-44
View File
@@ -1,44 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef FH_ARCH_H_
#define FH_ARCH_H_
#ifdef CONFIG_CHIP_FH8620
#include "plat-v2/arch.h"
#endif
#ifdef CONFIG_CHIP_FH8620G
#include "plat-v2/arch.h"
#endif
#ifdef CONFIG_CHIP_FH8810
#include "plat-v2/arch.h"
#endif
#endif /* FH_ARCH_H_ */
-90
View File
@@ -1,90 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef FH_DEF_H_
#define FH_DEF_H_
#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;
#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 long boolean;
#define TYPE_DEFINED
#endif
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define reg_read(addr) (*((volatile UINT32 *)(addr)))
#define reg_write(addr,value) (*(volatile UINT32 *)(addr)=(value))
#define GET_REG(addr) reg_read(addr)
#define SET_REG(addr,value) reg_write(addr,value)
#define SET_REG_M(addr,value,mask) reg_write(addr,(reg_read(addr)&(~(mask)))|((value)&(mask)))
#define SET_REG_B(addr,element,highbit,lowbit) SET_REG_M((addr),((element)<<(lowbit)),(((1<<((highbit)-(lowbit)+1))-1)<<(lowbit)))
#define GET_REG8(addr) (*((volatile UINT8 *)(addr)))
#define SET_REG8(addr,value) (*(volatile UINT8 *)(addr)=(value))
#define read_reg(addr) (*((volatile uint32 *)(addr)))
#define write_reg(addr, reg) (*((volatile uint32 *)(addr))) = (uint32)(reg)
#define inw(addr) (*((volatile uint32 *)(addr)))
#define outw(addr, reg) (*((volatile uint32 *)(addr))) = (uint32)(reg)
#ifndef BIT
#define BIT(nr) (1UL << (nr))
#endif
typedef volatile const unsigned int RoReg; /**< Read only 32-bit register (volatile const unsigned int) */
typedef volatile unsigned int WoReg; /**< Write only 32-bit register (volatile unsigned int) */
typedef volatile unsigned int RwReg; /**< Read-Write 32-bit register (volatile unsigned int) */
#endif /* FH_DEF_H_ */
-13
View File
@@ -1,13 +0,0 @@
Import('RTT_ROOT')
Import('rtconfig')
from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
path = [cwd, cwd + '/..']
group = DefineGroup('Drivers', src, depend = ['CONFIG_PLAT_V2'], CPPPATH = path)
Return('group')
-116
View File
@@ -1,116 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* 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 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)
typedef enum IRQn
{
PAE_IRQn = 0,
VPU_IRQn = 1,
ISP_F_IRQn = 2,
ISP_B_IRQn = 3,
VOU_IRQn = 4,
JPEG_IRQn = 5,
TVE_IRQn = 6,
TOE_IRQn = 7,
DDRC_IRQn = 8,
DMAC_IRQn = 9,
AES_IRQn = 10,
MIPIC_IRQn = 11,
MIPI_WRAP_IRQn = 12,
PMU_IRQn = 13,
EMAC_IRQn = 14,
AXIC0_IRQn = 16,
AXIC1_IRQn = 17,
X2H0_IRQn = 18,
X2H1_IRQn = 19,
AHBC0_IRQn = 20,
AHBC1_IRQn = 21,
SADC_IRQn = 23,
SDC0_IRQn = 24,
SDC1_IRQn = 25,
ACW_IRQn = 26,
WDT_IRQn = 27,
SPI0_IRQn = 28,
SPI1_IRQn = 29,
UART0_IRQn = 30,
UART1_IRQn = 31,
I2S0_IRQn = 32,
I2S1_IRQn = 33,
RTC_IRQn = 34,
PWM_IRQn = 35,
TMR0_IRQn = 36,
TMR1_IRQn = 37,
USB0_IRQn = 38,
USB1_IRQn = 39,
GPIO0_IRQn = 40,
GPIO1_IRQn = 41,
I2C0_IRQn = 42,
I2C1_IRQn = 43,
} IRQn_Type;
#endif /* ARCH_H_ */
File diff suppressed because it is too large Load Diff
-62
View File
@@ -1,62 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef TIMER_H_
#define TIMER_H_
#include <rtdef.h>
void rt_hw_clock_init(void);
void rt_hw_get_clock(void);
void rt_hw_set_dividor(rt_uint8_t hdivn, rt_uint8_t pdivn);
void rt_hw_set_clock(rt_uint8_t sdiv, rt_uint8_t pdiv, rt_uint8_t mdiv);
struct fh_clk;
/*
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)
void clk_gate(struct fh_clk *p_clk);
void clk_ungate(struct fh_clk *p_clk);
struct fh_clk *clk_get(const char *name);
rt_uint32_t clk_get_rate(struct fh_clk *p_clk);
void clk_set_rate(struct fh_clk *p_clk,rt_uint32_t rate_value);
rt_uint32_t sdc_get_phase(struct fh_clk *p_clk);
rt_uint32_t sdc_set_phase(struct fh_clk *p_clk,rt_uint32_t phase);
#endif
-62
View File
@@ -1,62 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* 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 PMU_OFFSET_MAX 0x1d0
int fh_pmu_read(rt_uint32_t offset, rt_uint32_t *value)
{
RT_ASSERT(offset < PMU_OFFSET_MAX);
*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);
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)
{
RT_ASSERT(offset < PMU_OFFSET_MAX);
FH_PMU_WRITEL_MASK(offset, value, mask);
return 0;
}
-59
View File
@@ -1,59 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef FH_PMU_H_
#define FH_PMU_H_
#include <rtdef.h>
#define REG_PMU_CHIP_ID (0x000)
#define REG_PMU_IP_VER (0x004)
#define REG_PMU_FW_VER (0x008)
#define REG_PMU_SYS_CTRL (0x00c)
#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_SEL (0x020)
#define REG_PMU_CLK_DIV0 (0x024)
#define REG_PMU_CLK_DIV1 (0x028)
#define REG_PMU_CLK_DIV2 (0x02c)
#define REG_PMU_CLK_DIV3 (0x030)
#define REG_PMU_CLK_DIV4 (0x034)
#define REG_PMU_CLK_DIV5 (0x038)
#define REG_PMU_CLK_DIV6 (0x03c)
#define REG_PMU_SWRST_MAIN_CTRL (0x040)
#define REG_PMU_SWRST_AXI_CTRL (0x044)
#define REG_PMU_SWRST_AHB_CTRL (0x048)
#define REG_PMU_SWRST_APB_CTRL (0x04c)
#define REG_PMU_VDAC_CTRL (0x050)
#define REG_PMU_MAC_REF_CLK_CFG (0x0a4)
int fh_pmu_read(rt_uint32_t offset,rt_uint32_t *value);
int fh_pmu_write(rt_uint32_t offset, const rt_uint32_t value);
int fh_pmu_write_mask(rt_uint32_t offset,const rt_uint32_t value, const rt_uint32_t mask);
#endif /* FH_PMU_H_ */
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-50
View File
@@ -1,50 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#include <rthw.h>
#include <rtthread.h>
#include "fh_pmu.h"
#include "fh_def.h"
#include "fh_arch.h"
void machine_reset(void)
{
fh_pmu_write(REG_PMU_SWRST_MAIN_CTRL, 0x7fffffff);
}
void machine_shutdown(void)
{
while(1)
;
}
#ifdef RT_USING_FINSH
#include <finsh.h>
FINSH_FUNCTION_EXPORT_ALIAS(rt_hw_cpu_reset, reset, system reset);
#endif
/*@}*/
-109
View File
@@ -1,109 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#include "timer.h"
#include <rtdevice.h>
#include "fh_arch.h"
#include "libraries/inc/fh_timer.h"
//#include "fh_pmu.h"
//#include "chip_reg.h"
//NEED_CAUTION.
#define TIMER_CLOCK 1000000
#define CONFIG_PAE_PTS_CLOCK (1000000)
#define TICKS_PER_USEC (CONFIG_PAE_PTS_CLOCK / 1000000)
#define REG_PAE_PTS_REG (0xec100000 + 0x0040)
static unsigned long lastdec;
static unsigned long long timestamp;
rt_uint32_t read_pts(void)
{
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);
}
void udelay(unsigned long usec)
{
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*/;
}
void rt_timer_handler(int vector, void *param)
{
timer *tim = param;
rt_interrupt_enter();
timer_get_eoi(tim);
rt_tick_increase();
rt_interrupt_leave();
}
/**
* This function will init pit for system ticks
*/
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_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);
}
-36
View File
@@ -1,36 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef TIMER_H_
#define TIMER_H_
#include <rtdef.h>
void rt_hw_timer_init(void);
#endif
-81
View File
@@ -1,81 +0,0 @@
/*
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.
*
* Change Logs:
* Date Author Notes
*/
#ifndef PLATFORM_DEF_H_
#define PLATFORM_DEF_H_
#include "rtconfig.h"
#ifdef CONFIG_CHIP_FH8620
#ifdef CONFIG_BOARD_DEV
#include "fh8620/dev_board/board_def.h"
#endif
#endif
#ifdef CONFIG_CHIP_FH8620
#ifdef CONFIG_BOARD_TEST
#include "fh8620/test_board/board_def.h"
#endif
#endif
#ifdef CONFIG_CHIP_FH8620
#ifdef CONFIG_BOARD_IOTCAM
#include "fh8620/iot_cam/board_def.h"
#endif
#endif
#ifdef CONFIG_CHIP_FH8620G
#ifdef CONFIG_BOARD_DEV
#include "fh8620g/dev_board/board_def.h"
#endif
#endif
#ifdef CONFIG_CHIP_FH8620G
#ifdef CONFIG_BOARD_TEST
#include "fh8620g/test_board/board_def.h"
#endif
#endif
#ifdef CONFIG_CHIP_FH8810
#ifdef CONFIG_BOARD_DEV
#include "fh8810/dev_board/board_def.h"
#endif
#endif
#ifdef CONFIG_CHIP_FH8810
#ifdef CONFIG_BOARD_TEST
#include "fh8810/test_board/board_def.h"
#endif
#endif
#endif /* TEST_H_ */
File diff suppressed because it is too large Load Diff
-44
View File
@@ -1,44 +0,0 @@
import os
import sys
import re
# toolchains options
ARCH = 'arm'
CPU = 'armv6'
OUTPUT_NAME = 'rtthread'
CROSS_TOOL = 'gcc' # we use gcc compiler always
PLATFORM = 'gcc'
LD_NAME = 'link'
EXEC_PATH = r'D:\arm-2013.11\bin'
if os.getenv('RTT_EXEC_PATH'):
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
BUILD = 'release'
if PLATFORM == 'gcc':
# toolchains
PREFIX = 'arm-none-eabi-'
CC = PREFIX + 'gcc'
CXX = PREFIX + 'g++'
AS = PREFIX + 'gcc'
AR = PREFIX + 'ar'
LINK = PREFIX + 'gcc'
TARGET_EXT = '.elf'
SIZE = PREFIX + 'size'
OBJDUMP = PREFIX + 'objdump'
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=soft'
CFLAGS = DEVICE + ' -mno-unaligned-access'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -D__ASSEMBLY__'
LFLAGS = DEVICE + ' -nostartfiles -Wl,--gc-sections,-Map='+ OUTPUT_NAME +'.map,-cref,-u,_start -T' + LD_NAME +'.ld'
CPATH = ''
LPATH = ''
if BUILD == 'debug':
CFLAGS += ' -O0 -gdwarf-2 '
AFLAGS += ' -gdwarf-2'
else:
CFLAGS += ' -O2'
CXXFLAGS = CFLAGS
POST_ACTION = OBJCPY + ' -O binary $TARGET '+ OUTPUT_NAME +'.bin\n' + SIZE + ' $TARGET \n'
-342
View File
File diff suppressed because it is too large Load Diff
-139
View File
@@ -1,139 +0,0 @@
mainmenu "RT-Thread Configuration"
config BSP_DIR
string
option env="BSP_ROOT"
default "."
config RTT_DIR
string
option env="RTT_ROOT"
default "../.."
config PKGS_DIR
string
option env="PKGS_ROOT"
default "packages"
source "$RTT_DIR/Kconfig"
source "$PKGS_DIR/Kconfig"
config SOC_GK710
bool
select RT_USING_COMPONENTS_INIT
select RT_USING_USER_MAIN
default y
choice
prompt "Device type"
default GK7102C
config SOC_GK7101
bool "GK7101"
config SOC_GK7102
bool "GK7102"
config SOC_GK7101S
bool "GK7101S"
config SOC_GK7102S
bool "GK7102S"
config SOC_GK7102C
bool "GK7102C"
endchoice
choice
prompt "Board type"
default GK7102C_EVB
config BOARD_GK7101_EVB
bool "GK7101_EVB"
depends on SOC_GK7101
config BOARD_GK7101_EVB
bool "GK7101_EVB"
depends on SOC_GK7102
config BOARD_GK7101S_EVB
bool "GK7101S_EVB"
depends on SOC_GK7101S
config BOARD_GK7101S_EVB
bool "GK7101S_EVB"
depends on SOC_GK7102S
config BOARD_GK7102C_EVB
bool "GK7102C_EVB"
depends on SOC_GK7102C
endchoice
choice
prompt "Sensor type"
default SENSOR_TYPE_SC1135
config SENSOR_TYPE_SC1135
bool "SC1135"
config SENSOR_TYPE_SC1145
bool "SC1145"
config SENSOR_TYPE_JXH65
bool "JXH65"
config SENSOR_TYPE_OV9750
bool "OV9750"
config SENSOR_TYPE_AR0130
bool "AR0130"
config SENSOR_TYPE_JXH42
bool "JXH42"
endchoice
config TUNNING_TOOL_SUPPORT
bool "Using Tuning Tool"
default y
config RT_USING_DMA_MEM
bool "Enable DMA Mem"
default y
config ARM1176_USE_VFP
bool "Enable ARM1176 VFP"
default y
config RT_USING_VFP
bool "Enable VFP"
default y
config RT_USING_CPU_FFS
bool "Enable CPU FFS"
default y
menu "Goke Peripheral Device Config"
config RT_USING_ADC
bool "Enable ADC"
default y
config RT_USING_GMAC
bool "Enable GMAC"
default y
config RT_USING_PWM
bool "Enable PWM"
default y
config RT_USING_GK_DMA
bool "Enable DMA"
default y
config RT_USING_LIBZ
bool "Enable Zlib for firmware uncompress"
default y
config RT_USING_LOGCAPTURE
bool "Enable DSP Logcaputure"
default y
config RT_ALIGN_UC_SIZE
int "Align UC Size"
default 8
config RT_ALIGN_DSP_SIZE
int "Align DSP Size"
default 32
config RT_DEBUG_UC_MEM
int "Debug UC Memory"
default 0
config RT_DEBUG_DSP_MEM
int "Debug DSP Memory"
default 0
endmenu
-61
View File
@@ -1,61 +0,0 @@
# gkipc板级支持包
标签: bsp说明文档
---
## 1. 简介
GK7102C是针对高清IP Camera产品开发的一款低功耗高性能 SOC芯片,支持 960@30p多路码流 H.264 编码及高质量的 ISP 处理,内置 3D降噪和动态对比度提升模块,支持主流的多种并口 8bit/10bit/12bit sensor。视频输出支持 RGB 小型 LCD 屏显示接口。 GK7102C 内封 DDR2 DRAM 芯片,内置 Ethernet PHY, Audio codec,USB PHY 等模拟 IP。 GK7102C 拥有
丰富的外设接口,如 USB2.0,SDIO,PWM,SPI,I2C 等等,支持最多 32 个GPIO,可灵活配置各功能模块的输出管脚,为实现高集成度 IPC提供了高性价比的解决方案。包括如下硬件特性:
| 硬件 | 描述 |
| -- | -- |
|芯片型号| GK7102C |
|CPU| ARM1176ZJFS |
|主频| 432MHz |
|片内DDR2| 512M bit@800MHz |
## 2. 编译说明
推荐使用[env工具][1],可以在console下进入到`bsp/gkipc`目录中,运行以下命令:
scons
来编译这个板级支持包。如果编译正确无误,会产生rtthread.elf、rtthread.bin文件。其中rtthread.bin可以通过网络加载或者烧写到设备中进行运行。
## 3. 烧写及执行
[需要说明电源连接情况,串口连接情况]
连接好串口,可以使用115200-N-8-1的配置方式连接到设备上。设备使用的串口引脚是:`[GPIO25/GPIO26]`
当正确编译产生出rtthread.bin映像文件后,可以使用tftp的方式来加载到设备中运行。
### 3.1 运行结果
如果编译 & 烧写无误,当复位设备后,会在串口上看到RT-Thread的启动logo信息:
## 4. 驱动支持情况及计划
| 驱动 | 支持情况 | 备注 |
| ------ | ---- | :------: |
| UART | 支持 | UART0/1/2 |
| clock | 支持 | |
| SPI | | SPI0 |
| ADC | 支持 | |
| DMA | 支持 | |
| GMAC | 支持 | |
| I2C | 支持 | |
| PWM | 支持 | |
| SDIO | 支持 | SDIO0/1 |
| WDT | 支持 | |
| MMC | 支持 | |
| SSI | 支持 | |
## 5. 联系人信息
维护人:gokemicro < gokemicro@yeah.net >
[1]: https://www.rt-thread.org/page/download.html
-19
View File
@@ -1,19 +0,0 @@
# for module compiling
import os
Import('RTT_ROOT')
cwd = str(Dir('#'))
objs = []
list = os.listdir(cwd)
print('------------------------------------------------')
print('rtt_root: ' + RTT_ROOT)
print('current dir: ' + cwd)
print('------------------------------------------------')
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
objs = objs + SConscript(os.path.join(d, 'SConscript'))
Return('objs')
-34
View File
@@ -1,34 +0,0 @@
import os
import sys
import rtconfig
if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
else:
RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
from building import *
TARGET = rtconfig.OUTPUT_NAME + rtconfig.TARGET_EXT
# add rtconfig.h path to the assembler
rtconfig.AFLAGS += ' -I' + str(Dir('#')) +' -I' + str(Dir('#')) + '/bsp'
DefaultEnvironment(tools=[])
env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
Export('RTT_ROOT')
Export('rtconfig')
# prepare building environment
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=True)
# make a building
DoBuilding(TARGET, objs)
-10
View File
@@ -1,10 +0,0 @@
from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd, cwd + '/../drivers', cwd + '/../libraries/inc']
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
Return('group')
-27
View File
@@ -1,27 +0,0 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
#include <rtthread.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef RT_USING_GMAC
#include <drv_gmac.h>
#endif
int main(void)
{
#ifdef RT_USING_GMAC
rt_app_gk_gmac_init();
#endif
printf("Hello\n");
return 0;
}

Some files were not shown because too many files have changed in this diff Show More