summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJiaojinxing <jiaojinxing1987@gmail.com>2015-04-19 09:32:08 (GMT)
committer Jiaojinxing <jiaojinxing1987@gmail.com>2015-04-19 09:32:08 (GMT)
commit11cc2f2d8a4fa0f9c8e5784aa679c74ebf219a95 (patch)
tree9df871287c6a951412e0f6b9ca4d941be59208ad
parented4f15690f62e12b015cce8b5dee3ec465908797 (diff)
downloadbspam335x-11cc2f2d8a4fa0f9c8e5784aa679c74ebf219a95.zip
bspam335x-11cc2f2d8a4fa0f9c8e5784aa679c74ebf219a95.tar.gz
bspam335x-11cc2f2d8a4fa0f9c8e5784aa679c74ebf219a95.tar.bz2
Compatible with new SylixOS.
-rw-r--r--SylixOS/StarterWare/system_config/armv7a/am335x/interrupt.c8
-rw-r--r--SylixOS/bsp/bspInit.c2
-rw-r--r--SylixOS/bsp/bspLib.c58
3 files changed, 30 insertions, 38 deletions
diff --git a/SylixOS/StarterWare/system_config/armv7a/am335x/interrupt.c b/SylixOS/StarterWare/system_config/armv7a/am335x/interrupt.c
index 18d9908..02d9ebc 100644
--- a/SylixOS/StarterWare/system_config/armv7a/am335x/interrupt.c
+++ b/SylixOS/StarterWare/system_config/armv7a/am335x/interrupt.c
@@ -40,16 +40,16 @@
*
*/
-
+#ifdef SYLIXOS
+#define __SYLIXOS_KERNEL
+#include "SylixOS.h"
+#endif
#include "hw_intc.h"
#include "interrupt.h"
#include "hw_types.h"
#include "soc_AM335x.h"
#ifndef SYLIXOS
#include "cpu.h"
-#else
-#define __SYLIXOS_KERNEL
-#include "SylixOS.h"
#endif
/******************************************************************************
diff --git a/SylixOS/bsp/bspInit.c b/SylixOS/bsp/bspInit.c
index 797f45f..4996017 100644
--- a/SylixOS/bsp/bspInit.c
+++ b/SylixOS/bsp/bspInit.c
@@ -905,7 +905,7 @@ INT bspInit (VOID)
* 这里使用 bsp 设置启动参数, 如果 bootloader 支持, 可使用 bootloader 设置.
* 为了兼容以前的项目, 这里 kfpu=yes 允许内核中(包括中断)使用 FPU.
*/
- API_KernelStartParam("ncpus=1 kdlog=no kderror=yes kfpu=no heapchk=yes");
+ API_KernelStartParam("ncpus=1 kdlog=no kderror=yes kfpu=no heapchk=yes hz=100 hhz=100");
/* 操作系统启动参数设置 */
API_KernelStart(usrStartup,
cKernelHeap,
diff --git a/SylixOS/bsp/bspLib.c b/SylixOS/bsp/bspLib.c
index 232a66b..dd24430 100644
--- a/SylixOS/bsp/bspLib.c
+++ b/SylixOS/bsp/bspLib.c
@@ -209,31 +209,19 @@ INT am335xIsrPerfShow (INT iArgC, PCHAR ppcArgV[])
{
REGISTER UINT uiVector;
- if (iArgC < 2) {
- printf(" IRQ\t MAX\t TOTAL\n");
-
- for (uiVector = 0; uiVector < LW_CFG_MAX_INTER_SRC; uiVector++) {
- if (_G_uiIsrExecTimeMax[uiVector]) {
- printf(" %d\t %u\t %lu\n",
- uiVector,
- _G_uiIsrExecTimeMax[uiVector],
- _G_ulIsrExecTimeTotal[uiVector]);
- }
+ printf(" IRQ\t MAX\t TOTAL(ms)\n");
+
+ for (uiVector = 0; uiVector < LW_CFG_MAX_INTER_SRC; uiVector++) {
+ if (_G_uiIsrExecTimeMax[uiVector]) {
+ printf(" %d\t %u\t %lu\n",
+ uiVector,
+ _G_uiIsrExecTimeMax[uiVector],
+ _G_ulIsrExecTimeTotal[uiVector] / 24000);
}
- } else {
- uiVector = lib_atoi(ppcArgV[1]);
- if (uiVector >= LW_CFG_MAX_INTER_SRC) {
- return (PX_ERROR);
- }
-
- printf(" IRQ\t MAX\t TOTAL\n");
- printf(" %d\t %u\t %lu\n",
- uiVector,
- _G_uiIsrExecTimeMax[uiVector],
- _G_ulIsrExecTimeTotal[uiVector]);
}
printf("Tick IRQ delay max: %u\n", _G_uiTickIrqDelayMax);
+ printf("System run time: %lld ms\n", API_TimeGet64() * 1000 / LW_TICK_HZ);
return (ERROR_NONE);
}
@@ -758,10 +746,9 @@ static VOID __tickThread (VOID)
/*********************************************************************************************************
精确时间换算参数
*********************************************************************************************************/
-#define __TIMER_OVERFLOW 0xFFFFFFFF
-#define __TIMER_COUNT_PER_TICK (24 * 1000000 / LW_CFG_TICKS_PER_SEC)
-#define __TIMER_NSEC_PER_COUNT ((1000 * 1000 * 1000 / LW_CFG_TICKS_PER_SEC) / __TIMER_COUNT_PER_TICK)
-#define __TIMER_RELOAD (__TIMER_OVERFLOW - __TIMER_COUNT_PER_TICK)
+static UINT32 _G_uiTimerCntPerTick;
+static UINT32 _G_uiTimerNSecPerCnt;
+static UINT32 _G_uiTimerReloadValue;
/*********************************************************************************************************
** 函数名称: __tickTimerIsr
** 功能描述: tick 定时器中断服务例程
@@ -775,7 +762,7 @@ static irqreturn_t __tickTimerIsr (VOID)
#if (BSP_CFG_INT_PERF_EN > 0)
REGISTER UINT uiTime;
- uiTime = DMTimerCounterGet(SOC_DMTIMER_2_REGS) - __TIMER_RELOAD;
+ uiTime = DMTimerCounterGet(SOC_DMTIMER_2_REGS) - _G_uiTimerReloadValue;
if (uiTime > _G_uiTickIrqDelayMax) {
_G_uiTickIrqDelayMax = uiTime;
}
@@ -827,6 +814,11 @@ VOID bspTickInit (VOID)
* If the input clock is changed to different source this value has to be updated
* accordingly.
*/
+#define __TIMER_OVERFLOW 0xFFFFFFFF
+
+ _G_uiTimerCntPerTick = 24 * 1000000 / LW_TICK_HZ;
+ _G_uiTimerNSecPerCnt = (1000 * 1000 * 1000 / LW_TICK_HZ) / _G_uiTimerCntPerTick;
+ _G_uiTimerReloadValue = __TIMER_OVERFLOW - _G_uiTimerCntPerTick;
/*
* This function will enable clocks for the DMTimer2 instance
@@ -841,12 +833,12 @@ VOID bspTickInit (VOID)
/*
* Load the counter with the initial count value
*/
- DMTimerCounterSet(SOC_DMTIMER_2_REGS, __TIMER_RELOAD);
+ DMTimerCounterSet(SOC_DMTIMER_2_REGS, _G_uiTimerReloadValue);
/*
* Load the counter with the reload count value
*/
- DMTimerReloadSet(SOC_DMTIMER_2_REGS, __TIMER_RELOAD);
+ DMTimerReloadSet(SOC_DMTIMER_2_REGS, _G_uiTimerReloadValue);
/*
* Configure the DMTimer for auto-reload and non-compare mode
@@ -886,7 +878,7 @@ VOID bspTickInit (VOID)
VOID bspTickHighResolution (struct timespec *ptv)
{
REGISTER UINT32 uiCntCur = DMTimerCounterGet(SOC_DMTIMER_2_REGS);
- REGISTER UINT32 uiDone = uiCntCur - __TIMER_RELOAD;
+ REGISTER UINT32 uiDone = uiCntCur - _G_uiTimerReloadValue;
/*
* 检查是否有 TICK 中断请求
@@ -896,14 +888,14 @@ VOID bspTickHighResolution (struct timespec *ptv)
* 这里由于 TICK 没有及时更新, 所以需要重新获取并且加上一个 TICK 的时间
*/
uiCntCur = DMTimerCounterGet(SOC_DMTIMER_2_REGS);
- uiDone = uiCntCur - __TIMER_RELOAD;
+ uiDone = uiCntCur - _G_uiTimerReloadValue;
- if (uiCntCur != __TIMER_RELOAD) {
- uiDone += __TIMER_COUNT_PER_TICK;
+ if (uiCntCur != _G_uiTimerReloadValue) {
+ uiDone += _G_uiTimerCntPerTick;
}
}
- ptv->tv_nsec += uiDone * __TIMER_NSEC_PER_COUNT;
+ ptv->tv_nsec += uiDone * _G_uiTimerNSecPerCnt;
if (ptv->tv_nsec >= 1000000000) {
ptv->tv_nsec -= 1000000000;
ptv->tv_sec++;