pure sdk for main
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2016 YunOS Project. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef CORETIM_H
|
||||
#define CORETIM_H
|
||||
|
||||
#define CORETIM_BASE (0xE000E000)
|
||||
#define CORET_CSR (volatile uint32_t *)(CORETIM_BASE + 0x10)
|
||||
#define CORET_RVR (volatile uint32_t *)(CORETIM_BASE + 0x14)
|
||||
#define CORET_CVR (volatile uint32_t *)(CORETIM_BASE + 0x18)
|
||||
#define CORET_CALIB (volatile uint32_t *)(CORETIM_BASE + 0x1c)
|
||||
#define CORET_ICPR (volatile uint32_t *)(CORETIM_BASE + 0x280)
|
||||
|
||||
/*
|
||||
* define the bits for TxControl
|
||||
*/
|
||||
#define CORETIM_TXCONTROL_ENABLE (1UL << 0)
|
||||
#define CORETIM_TXCONTROL_INTMASK (1UL << 1)
|
||||
#define CORETIM_TXCONTROL_MODE (1UL << 16)
|
||||
|
||||
/* function prototypes */
|
||||
void coretim_init(uint32_t hz);
|
||||
void coretim_clr_irq(void);
|
||||
uint32_t coretim_get_currval(void);
|
||||
|
||||
#endif /* CORETIM_H */
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright (C) 2016 YunOS Project. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <k_api.h>
|
||||
//#include <drv_timer.h>
|
||||
#include <csi_config.h>
|
||||
#include <csi_core.h>
|
||||
/* auto define heap size */
|
||||
extern size_t __heap_start;
|
||||
extern size_t __heap_end;
|
||||
extern k_mm_region_t g_mm_region[];
|
||||
|
||||
extern void soc_hw_timer_init(void);
|
||||
|
||||
#if (RHINO_CONFIG_USER_HOOK > 0)
|
||||
__init void krhino_init_hook(void)
|
||||
{
|
||||
#if (RHINO_CONFIG_HW_COUNT > 0)
|
||||
soc_hw_timer_init();
|
||||
#endif
|
||||
|
||||
/* auto define heap size */
|
||||
g_mm_region[0].len = (uint32_t)(&__heap_end) - (uint32_t)(&__heap_start);
|
||||
}
|
||||
|
||||
void krhino_start_hook(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void krhino_task_create_hook(ktask_t *task)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void krhino_task_del_hook(ktask_t *task, res_free_t *arg)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void krhino_task_abort_hook(ktask_t *task)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void krhino_task_switch_hook(ktask_t *orgin, ktask_t *dest)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void krhino_tick_hook(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void krhino_idle_pre_hook(void)
|
||||
{
|
||||
extern void lpm_idle_pre_hook(void);
|
||||
lpm_idle_pre_hook();
|
||||
}
|
||||
|
||||
int32_t _sleep_tick_get()
|
||||
{
|
||||
if (is_klist_empty(&g_tick_head))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
ktask_t * p_tcb = krhino_list_entry(g_tick_head.next, ktask_t, tick_list);
|
||||
return p_tcb->tick_match > g_tick_count ? p_tcb->tick_match - g_tick_count : 0;
|
||||
}
|
||||
|
||||
void krhino_idle_hook(void)
|
||||
{
|
||||
extern void lpm_idle_hook(void);
|
||||
lpm_idle_hook();
|
||||
}
|
||||
|
||||
void krhino_intrpt_hook(int irq)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void krhino_mm_alloc_hook(void *mem, size_t size)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void krhino_intrpt_enter_hook(int irq)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void krhino_intrpt_exit_hook(int irq)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2016 YunOS Project. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
void __attribute__((weak)) lpm_idle_hook(void)
|
||||
{
|
||||
}
|
||||
|
||||
void __attribute__((weak)) lpm_idle_pre_hook(void)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) 2016 YunOS Project. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <k_api.h>
|
||||
#include <csi_config.h>
|
||||
#include <soc.h>
|
||||
//#include <drv_timer.h>
|
||||
|
||||
typedef struct osTimespec {
|
||||
long tv_sec;
|
||||
long tv_msec;
|
||||
} osTimespec_t;
|
||||
|
||||
__bobj uint64_t g_sys_tick_count;
|
||||
__bobj osTimespec_t os_time2;
|
||||
|
||||
void systick_handler(void)
|
||||
{
|
||||
g_sys_tick_count++;
|
||||
os_time2.tv_msec += (1000/CONFIG_SYSTICK_HZ);
|
||||
if(os_time2.tv_msec > 1000){
|
||||
os_time2.tv_sec++;
|
||||
os_time2.tv_msec = 0;
|
||||
}
|
||||
krhino_tick_proc();
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (C) 2016 YunOS Project. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <csi_config.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <k_api.h>
|
||||
//#include <drv_timer.h>
|
||||
#include <soc.h>
|
||||
#include <csi_core.h>
|
||||
|
||||
#define THIS_MODULE MODULE_NONE
|
||||
|
||||
/* auto define heap size */
|
||||
extern size_t __heap_start;
|
||||
extern size_t __heap_end;
|
||||
|
||||
#ifndef RHINO_CONFIG_STD_MALLOC
|
||||
static k_mm_region_head_t hobbit_mm_region_head;
|
||||
#endif
|
||||
|
||||
#if (RHINO_CONFIG_HW_COUNT > 0)
|
||||
void soc_hw_timer_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
hr_timer_t soc_hr_hw_cnt_get(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
lr_timer_t soc_lr_hw_cnt_get(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* auto define heap size */
|
||||
k_mm_region_t g_mm_region[] = {
|
||||
{(uint8_t *)&__heap_start, (size_t)0},
|
||||
};
|
||||
int g_region_num = sizeof(g_mm_region)/sizeof(k_mm_region_t);
|
||||
|
||||
#if (RHINO_CONFIG_INTRPT_GUARD > 0)
|
||||
void soc_intrpt_guard(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (RHINO_CONFIG_INTRPT_STACK_REMAIN_GET > 0)
|
||||
size_t soc_intrpt_stack_remain_get(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (RHINO_CONFIG_INTRPT_STACK_OVF_CHECK > 0)
|
||||
void soc_intrpt_stack_ovf_check(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
size_t soc_get_cur_sp(void)
|
||||
{
|
||||
return __get_SP();
|
||||
}
|
||||
|
||||
extern void mcu_reset(void);
|
||||
void soc_err_proc(kstat_t err)
|
||||
{
|
||||
switch(err) {
|
||||
case RHINO_TASK_STACK_OVF:
|
||||
case RHINO_INTRPT_STACK_OVF:
|
||||
printf("stack overflow: %s!, %p\n", g_active_task[0]->task_name, g_active_task[0]);
|
||||
break;
|
||||
default:
|
||||
printf("sys error:%d %s!\n", err, g_active_task[0]->task_name);
|
||||
}
|
||||
|
||||
mcu_reset();
|
||||
//while(1);
|
||||
}
|
||||
|
||||
//__bobj krhino_err_proc_t g_err_proc = soc_err_proc;
|
||||
|
||||
Reference in New Issue
Block a user