Cleanup and add licencse

This commit is contained in:
Peng Fan
2013-07-17 18:42:19 +08:00
parent 73beced22a
commit 82bc21ff7b
17 changed files with 274 additions and 332 deletions

View File

@@ -1,164 +0,0 @@
/*
* File : clock.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2013-7-16 Peng Fan Just put the file here, should be implemented in
* future
*/
#include <rtthread.h>
#include <sep6200.h>
#define PLL_CFG(_f, _r) {.f = _f, .r = _r} /*f(frequency, MHz); r(config register value)*/
#define MHz 1000000UL
/*
*SEP0611_CLOCK
*├── APLL
*│   └── CPU
*├── DPLL
*│   └── DDR
*└── MPLL
* └── BUS1
* ├── BUS2
* │   ├── DMAC1
* │   ├── ESRAM
* │   ├── LCDC
* │   ├── NAND
* │   ├── NOR
* │   ├── SDIO1
* │   ├── SDIO2
* │   └── VPU
* ├── BUS3
* │   ├── BUS5
* │   │   ├── I2C1
* │   │   ├── I2C2
* │   │   ├── I2C3
* │   │   ├── I2S
* │   │   ├── SPI1
* │   │   ├── SPI2
* │   │   ├── SPI3
* │   │   ├── UART1
* │   │   ├── UART2
* │   │   ├── UART3
* │   │   └── UART4
* │   ├── DMAC2
* │   ├── GPU
* │   └── USB
* ├── BUS4
* │   ├── GPIO
* │   ├── GPSCTRL
* │   ├── PWM
* │   ├── RTC
* │   ├── SYSCTRL
* │   ├── TIMER
* │   └── VIC
* ├── DS1_2
* ├── DS1_3
* └── GPS
*/
enum sep0611_clk_gate{
DDRC = 0, BUS1, BUS2, BUS3, DS1_2,
DS1_3, USBC, DMAC1, NAND, DMAC2,
ESRAM, SDIO1, SDIO2, GPU, VPU,
BUS4, BUS5, VIC_, SYSCTRL, PRTC,
TIMER, GPSCTRL, GPIO, LCDC2HDMI, DDRPHY,
UART1, UART2, UART3, UART4, SPI1,
SPI2, SPI3,
I2C1 = 32, I2C2, I2C3, I2S, PWM,
H2X, LCDC, NOR, GPSHCLK, GPS,
};
typedef struct {
unsigned long f;
unsigned long r;
}pll_t;
static pll_t apll_tab[] = {
PLL_CFG(800*MHz, 0x00010810),
};
static pll_t mpll_tab[] = {
PLL_CFG(480*MHz, 0x00013C12), // 480MHz
};
static pll_t dpll_tab[] = {
PLL_CFG(400*MHz, 0x00010812), // 402MHz
};
static void rt_hw_set_system_clock(void)
{
/*apll, mpll, dpll is set in uboot when system boots up*/
}
static void rt_hw_set_usb_clock(void)
{
}
static void rt_hw_set_peripheral_clock(void)
{
}
/**
* @brief System Clock Configuration
*/
/* apll mpll dpll should be set in u-boot, Here just set clock
* of the pherial
*/
void rt_hw_set_apll_clock(void)
{
}
void rt_hw_set_mpll_clock(void)
{
}
void rt_hw_set_dpll_clock(void)
{
}
void rt_hw_clock_init(void)
{
/* set system clock */
rt_hw_set_system_clock();
}
/**
* @brief Get system clock
*/
rt_uint32_t rt_hw_get_clock(void)
{
}
/**
* @brief Enable module clock
*/
void rt_hw_enable_module_clock(rt_uint8_t module)
{
if (module >= 32) {
write_reg(SEP6200_PMU_CLK_GT_CFG2, (1 << (module - 32)) | read_reg(SEP6200_PMU_CLK_GT_CFG2));
} else {
write_reg(SEP6200_PMU_CLK_GT_CFG1, (1 << module) | read_reg(SEP6200_PMU_CLK_GT_CFG1));
}
}
/**
* @brief Disable module clock
*/
void rt_hw_disable_module_clock(rt_uint8_t module)
{
if (module >= 32) {
write_reg(SEP6200_PMU_CLK_GT_CFG2, ~(1 << (module - 32)) & read_reg(SEP6200_PMU_CLK_GT_CFG2));
} else {
write_reg(SEP6200_PMU_CLK_GT_CFG1, ~(1 << module) & read_reg(SEP6200_PMU_CLK_GT_CFG1));
}
}

View File

@@ -1,20 +1,31 @@
/*
* File : context.S
* File : context_gcc.S
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
* 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.
*
* Change Logs:
* Date Author Notes
* 2013-7-14 Peng Fan First implementation
* 2013-7-14 Peng Fan sep6200 implementation
*/
/*!
/**
* \addtogroup sep6200
*/
/*@{*/
#define NOINT 0xc0

View File

@@ -1,15 +1,25 @@
/*
* File : cpu.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Develop Team
* COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
* 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.
*
* Change Logs:
* Date Author Notes
* 2013-7-14 Peng Fan first implementation
* 2013-7-14 Peng Fan sep6200 implementation
*/
#include <rthw.h>

View File

@@ -1,15 +1,25 @@
/*
* File : interrupt.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
* 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.
*
* Change Logs:
* Date Author Notes
* 2013-7-14 Peng Fan First implementation
* 2013-7-14 Peng Fan sep6200 implementation
*/
#include <rtthread.h>

View File

@@ -1,3 +1,27 @@
/*
* File : sep6200.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
*
* 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.
*
* Change Logs:
* Date Author Notes
* 2013-7-17 Peng Fan sep6200 implementation
*/
#ifndef __SEP6200_H
#define __SEP6200_H

View File

@@ -1,11 +1,21 @@
/*
* File : serial.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
* 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.
*
* Change Logs:
* Date Author Notes
@@ -16,7 +26,7 @@
#include "serial.h"
/**
* @addtogroup SEP6200
* @addtogroup sep6200
*/
/*@{*/

View File

@@ -1,11 +1,21 @@
/*
* File : serial.c
* File : serial.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
* 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.
*
* Change Logs:
* Date Author Notes

View File

@@ -1,15 +1,25 @@
/*
* File : stack.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
* 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.
*
* Change Logs:
* Date Author Notes
* 2013-7-14 Peng Fan Modifiled from sep4020
* 2013-7-14 Peng Fan sep6200 implementation
*/
#include <rtthread.h>

View File

@@ -1,11 +1,21 @@
/*
* File : start.S
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http:/*openlab.rt-thread.com/license/LICENSE
* 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.
*
* Change Logs:
* Date Author Notes
@@ -61,10 +71,6 @@
.equ MODEMASK, 0x1f
.equ NOINT, 0xc0
.equ RAM_BASE, 0x00000000 /*Start address of RAM */
/*
*************************************************************************
*
@@ -127,13 +133,12 @@ _bss_end:
.globl IRQ_STACK_START
IRQ_STACK_START:
.word _irq_stack_start + 10240 - 4
.word _irq_stack_start + 1024
.globl FIQ_STACK_START
FIQ_STACK_START:
.word _fiq_stack_start +1024
/*peng not sure*/
.globl UNDEFINED_STACK_START
UNDEFINED_STACK_START:
.word _undefined_stack_start + CONFIG_STACKSIZE
@@ -144,7 +149,7 @@ ABORT_STACK_START:
.globl _STACK_START
_STACK_START:
.word _priv_stack_start + 40960 - 4
.word _priv_stack_start + 4096
.equ SEP6200_VIC_BASE, 0xb0000000
.equ SEP6200_SYSCTL_BASE, 0xb0008000
@@ -176,6 +181,7 @@ reset:
/* setup stack */
b.l stack_setup
/* copy the vector code to address 0 */
ldw r12, =0x100
ldw r0, = 0x40000000
ldw r1, = 0x00000000
@@ -220,7 +226,7 @@ ctor_end:
andn r1, r0, #NOINT
mov.a asr, r1
/* start RT-Thread Kernel */
/* start RT-Thread Kernel */
ldw pc, _rtthread_startup
_rtthread_startup:
@@ -235,18 +241,18 @@ _rtthread_startup:
*/
/* exception handlers */
/*Just simple implementation here peng*/
/*Just simple implementation here */
.align 5
extend_handle:
b extend_handle
b rt_hw_trap_extn
swi_handle:
b swi_handle
b rt_hw_trap_swi
iabort_handle:
b iabort_handle
b rt_hw_trap_pabt
dabort_handle:
b dabort_handle
b rt_hw_trap_dabt
reserve_handle:
b reserve_handle
b rt_hw_trap_resv
.globl rt_interrupt_enter
.globl rt_interrupt_leave
@@ -276,9 +282,7 @@ IRQ_handle:
.align 5
FIQ_handle:
mov r0, #0x44
b.l printhex
mov pc, lr
b rt_hw_trap_fiq
_interrupt_thread_switch:
@@ -290,21 +294,12 @@ _interrupt_thread_switch:
ldm.w (r16 - r28), [sp]+
ldm.w (lr), [sp]+
stm.w (r0-r3), [sp-] /*save r0-r3*/
stm.w (r0 - r3), [sp-] /*save r0-r3*/
mov r1, sp
add sp, sp, #16 /* restore sp */
mov r2, lr /* save old task's pc to r2 */
#if 0
mov r3, bsr /* disable interrupt */
/*or r0, r3, #NOINT*/
mov.a bsr, r3
ldw r0, =.+8 /* switch to interrupted task's stack */
mov.a pc, r0 /*switch bsr to asr, irq to priv mode*/
#endif
mov r3, bsr
mov r0, #0xd3 /*I:F:0:PRIV*/
mov.a asr, r0
@@ -312,23 +307,24 @@ _interrupt_thread_switch:
stm.w (r2), [sp-] /* push old task's pc */
/* push old task's registers */
stm.w (r16, r17, r18, r19, r20, r21, r22, r23, r24, r25, r26, r27, r28, lr), [sp-]
stm.w (r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15), [sp-]
stm.w (lr), [sp-]
stm.w (r16 - r28), [sp-]
stm.w (r4 - r15), [sp-]
mov r4, r1 /* Special optimised code below */
mov r5, r3 /*pengpengpengpeng*/
ldm.w (r0,r1, r2, r3), [r4]+
stm.w (r0, r1, r2, r3), [sp-] /*push old task's r3-r0*/
mov r5, r3
ldm.w (r0 - r3), [r4]+
stm.w (r0 - r3), [sp-] /*push old task's r3-r0*/
stm.w (r5), [sp-] /* push old task's asr */
mov r4, bsr
stm.w (r4), [sp-] /* push old task's bsr I am not sure peng*/
mov r4, bsr
stm.w (r4), [sp-] /* push old task's bsr*/
ldw r4, =rt_interrupt_from_thread
ldw r5, [r4+]
stw sp, [r5+] /* store sp in preempted tasks's TCB*/
stw sp, [r5+] /* store sp in preempted tasks's TCB*/
ldw r6, =rt_interrupt_to_thread
ldw r6, [r6+]
ldw sp, [r6+] /* get new task's stack pointer */
ldw sp, [r6+] /* get new task's stack pointer */
ldm.w (r4), [sp]+ /* pop new task's spsr */
mov.a bsr, r4
@@ -340,14 +336,7 @@ _interrupt_thread_switch:
ldm.w (r0 - r15), [sp]+
ldm.w (r16 - r28), [sp]+
ldm.w (lr), [sp]+
/*peng*/
ldm.w (pc), [sp]+
#if 0
mov r0, lr
b.l printhex
ldm.w (r0), [sp]+
b.l printhex
#endif
stack_setup:
/*irq*/

View File

@@ -1,3 +1,26 @@
/*
* File : trace.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
*
* 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.
*
* Change Logs:
* Date Author Notes
* 2017-07-17 Peng Fan sep6200 implementation
*/
#include <rtthread.h>
void rt_hw_backtrace(rt_uint32_t *fp, rt_uint32_t thread_entry)

View File

@@ -1,11 +1,21 @@
/*
* File : trap.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
* 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.
*
* Change Logs:
* Date Author Notes