Initial commit: TXW82x FPV v2.7.0.7-42229 SDK + project sources

This commit is contained in:
2026-07-06 11:30:13 +08:00
commit e76462eeb7
3451 changed files with 1415300 additions and 0 deletions

View File

@@ -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 */

View File

@@ -0,0 +1,117 @@
/*
* 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 int32_t sys_event_new(uint32_t event_id, uint32_t data);
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)
{
sys_event_new((0x4<<16)|0x4, (uint32_t)task); //SYS_EVENT(SYS_EVENT_SYSTEM, SYSEVT_TASK_DELETE)
}
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)
{
}

View File

@@ -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)
{
}

View File

@@ -0,0 +1,72 @@
/*
* 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>
#include "osal/irq.h"
#define OS_MS_PERIOD_TICK (1000/OS_SYSTICK_HZ)
typedef struct osTimespec {
long tv_sec;
long tv_msec;
} osTimespec_t;
extern uint64_t g_sys_tick_count;
extern uint32_t g_cpuloading;
extern uint32_t g_cpuloading_int;
extern volatile uint64_t g_sys_time_last;
void systick_handler(void)
{
g_cpuloading_int++;
g_sys_tick_count++;
krhino_tick_proc();
if((g_cpuloading_int*OS_MS_PERIOD_TICK) >= 2000){
g_cpuloading = 100*(g_cpuloading_int - g_idle_task[cpu_cur_get()].runtime) / g_cpuloading_int;
g_idle_task[cpu_cur_get()].runtime = 0;
g_cpuloading_int = 0;
}
}
uint64_t krhino_curr_nanosec(void)
{
uint32_t flag;
uint32_t cycles;
uint64_t tick;
uint64_t now;
flag = __disable_irq();
tick = g_sys_tick_count;
cycles = csi_coret_get_value();
if(csi_vic_get_pending_irq(CORET_IRQn)) { //tick中断被delay
tick++;
}
if (!flag) __enable_irq();
cycles = csi_coret_get_load() - cycles;
now = (tick * OS_MS_PERIOD_TICK * 1000000ULL) +
(uint64_t)cycles * 1000000000ULL / DEFAULT_SYS_CLK;
if(now < g_sys_time_last){
now += (OS_MS_PERIOD_TICK * 1000000ULL);
}
g_sys_time_last = now;
return now;
}

View File

@@ -0,0 +1,101 @@
/*
* 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, cur task %s!, lr:%p\n",
err, g_active_task[0]->task_name, __builtin_return_address(0));
}
mcu_reset();
//while(1);
}
//__bobj krhino_err_proc_t g_err_proc = soc_err_proc;