add tos_slist.h, rename tos.h to tos_k.h

This commit is contained in:
daishengdong
2020-01-03 17:25:38 +08:00
parent af07f199d9
commit c9556307df
268 changed files with 900 additions and 742 deletions

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include <tos.h>
#include <tos_k.h>
__API__ uint32_t tos_cpu_clz(uint32_t val)
{

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include "tos.h"
#include "tos_k.h"
#if TOS_CFG_FAULT_BACKTRACE_EN > 0u

View File

@@ -1,4 +1,4 @@
#include "tos.h"
#include "tos_k.h"
#include "core_cm0.h"
__PORT__ void port_cpu_reset(void)

View File

@@ -1,4 +1,4 @@
#include "tos.h"
#include "tos_k.h"
#include "core_cm0.h"
__PORT__ void port_cpu_reset(void)

View File

@@ -1,4 +1,4 @@
#include "tos.h"
#include "tos_k.h"
#include "core_cm0.h"
__PORT__ void port_cpu_reset(void)

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include <tos.h>
#include <tos_k.h>
__API__ uint32_t tos_cpu_clz(uint32_t val)
{

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include "tos.h"
#include "tos_k.h"
#if TOS_CFG_FAULT_BACKTRACE_EN > 0u

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include "tos.h"
#include "tos_k.h"
#include "core_cm0plus.h"
__PORT__ void port_cpu_reset(void)

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include "tos.h"
#include "tos_k.h"
#include "core_cm0plus.h"
__PORT__ void port_cpu_reset(void)

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include "tos.h"
#include "tos_k.h"
#include "core_cm0plus.h"
__PORT__ void port_cpu_reset(void)

View File

@@ -17,9 +17,9 @@
/*
* The MIT License (MIT)
*
*
* Copyright (c) 2016-2018 Armink (armink.ztl@gmail.com)
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* 'Software'), to deal in the Software without restriction, including
@@ -27,10 +27,10 @@
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -40,7 +40,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "tos.h"
#include "tos_k.h"
#include "core_cm3.h"
__PORT__ void port_cpu_reset(void)

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include "tos.h"
#include "tos_k.h"
#include "core_cm3.h"
__PORT__ void port_cpu_reset(void)

View File

@@ -17,9 +17,9 @@
/*
* The MIT License (MIT)
*
*
* Copyright (c) 2016-2018 Armink (armink.ztl@gmail.com)
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* 'Software'), to deal in the Software without restriction, including
@@ -27,10 +27,10 @@
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -40,7 +40,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "tos.h"
#include "tos_k.h"
#include "core_cm4.h"
__PORT__ void port_cpu_reset(void)

View File

@@ -17,9 +17,9 @@
/*
* The MIT License (MIT)
*
*
* Copyright (c) 2016-2018 Armink (armink.ztl@gmail.com)
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* 'Software'), to deal in the Software without restriction, including
@@ -27,10 +27,10 @@
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -40,7 +40,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "tos.h"
#include "tos_k.h"
#include "core_cm4.h"
__PORT__ void port_cpu_reset(void)

View File

@@ -17,9 +17,9 @@
/*
* The MIT License (MIT)
*
*
* Copyright (c) 2016-2018 Armink (armink.ztl@gmail.com)
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* 'Software'), to deal in the Software without restriction, including
@@ -27,10 +27,10 @@
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -40,7 +40,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "tos.h"
#include "tos_k.h"
#include "core_cm4.h"
__PORT__ void port_cpu_reset(void)

View File

@@ -17,9 +17,9 @@
/*
* The MIT License (MIT)
*
*
* Copyright (c) 2016-2018 Armink (armink.ztl@gmail.com)
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* 'Software'), to deal in the Software without restriction, including
@@ -27,10 +27,10 @@
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -40,7 +40,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "tos.h"
#include "tos_k.h"
#include "core_cm7.h"
__PORT__ void port_cpu_reset(void)

View File

@@ -1,8 +1,8 @@
/*
* The MIT License (MIT)
*
*
* Copyright (c) 2016-2018 Armink (armink.ztl@gmail.com)
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* 'Software'), to deal in the Software without restriction, including
@@ -10,10 +10,10 @@
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -23,7 +23,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "tos.h"
#include "tos_k.h"
#include "core_cm7.h"
__PORT__ void port_cpu_reset(void)

View File

@@ -1,8 +1,8 @@
/*
* The MIT License (MIT)
*
*
* Copyright (c) 2016-2018 Armink (armink.ztl@gmail.com)
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* 'Software'), to deal in the Software without restriction, including
@@ -10,10 +10,10 @@
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -23,7 +23,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "tos.h"
#include "tos_k.h"
#include "core_cm7.h"
__PORT__ void port_cpu_reset(void)

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include <tos.h>
#include <tos_k.h>
__API__ uint32_t tos_cpu_clz(uint32_t val)
{

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include "tos.h"
#include "tos_k.h"
#if TOS_CFG_FAULT_BACKTRACE_EN > 0u

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include "tos.h"
#include "tos_k.h"
#include "core_cm23.h"
__PORT__ void port_cpu_reset(void)

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include "tos.h"
#include "tos_k.h"
#include "core_cm0plus.h"
__PORT__ void port_cpu_reset(void)

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include "tos.h"
#include "tos_k.h"
#include "core_cm0plus.h"
__PORT__ void port_cpu_reset(void)

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include <tos.h>
#include <tos_k.h>
__API__ uint32_t tos_cpu_clz(uint32_t val)
{

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include "tos.h"
#include "tos_k.h"
#if TOS_CFG_FAULT_BACKTRACE_EN > 0u

View File

@@ -17,9 +17,9 @@
/*
* The MIT License (MIT)
*
*
* Copyright (c) 2016-2018 Armink (armink.ztl@gmail.com)
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* 'Software'), to deal in the Software without restriction, including
@@ -27,10 +27,10 @@
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -40,7 +40,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "tos.h"
#include "tos_k.h"
#include <pthread.h>
#include <sched.h>
@@ -131,7 +131,7 @@ __PORT__ pthread_t port_create_thread(void *arg)
return thread_id;
}
__PORT__ void port_sched_start(void)
__PORT__ void port_sched_start(void)
{
k_curr_task = k_next_task;
_resume_task(k_curr_task);
@@ -196,8 +196,8 @@ __PORT__ void port_init(void)
_install_signal(SIG_CONTEXT_SWITCH, _handle_context_switch);
}
__PORT__ void port_delay_ms(uint32_t ms)
{
__PORT__ void port_delay_ms(uint32_t ms)
{
uint64_t start_time = _get_time_ms();
do{
usleep(100);
@@ -352,7 +352,7 @@ __PORT__ void port_standby_mode_enter(void)
__STATIC__ void port_fault_do_diagnosis(port_fault_regs_t *regs)
{
k_fault_log_writer("\n\n====================== Fault Diagnosis =====================\n");
}
__PORT__ void port_fault_diagnosis(void)

View File

@@ -1,8 +1,8 @@
#include "tos.h"
#include "tos_k.h"
__PORT__ void port_cpu_reset(void)
{
WDTCTL = WDTPW | 0xff00; // write a wrong Watchdog timer password will cause a PUC(reset)
WDTCTL = WDTPW | 0xff00; // write a wrong Watchdog timer password will cause a PUC(reset)
}
__PORT__ void port_systick_config(uint32_t cycle_per_tick)
@@ -42,7 +42,7 @@ __PORT__ void port_setup_systick(void)
/* The MSP430X port uses a callback function to configure its tick interrupt.
*/
#pragma vector=TIMER0_A0_VECTOR
#pragma vector=TIMER0_A0_VECTOR
__PORT__ __interrupt __raw void timer0_isr( void )
{
extern void port_systick_isr( void );
@@ -110,7 +110,7 @@ __PORT__ void port_fault_diagnosis(void)
/*------------------ 430 IAR Compiler-------------------*/
#if defined (__ICC430__) // __IAR_SYSTEMS_ICC__
#endif
#endif
#endif /* TOS_CFG_FAULT_BACKTRACE_EN */

View File

@@ -1,4 +1,21 @@
#include <tos.h>
/*----------------------------------------------------------------------------
* Tencent is pleased to support the open source community by making TencentOS
* available.
*
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
* If you have downloaded a copy of the TencentOS binary from Tencent, please
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
*
* If you have downloaded a copy of the TencentOS source code from Tencent,
* please note that TencentOS source code is licensed under the BSD 3-Clause
* License, except for the third-party components listed below which are
* subject to different license terms. Your integration of TencentOS into your
* own projects may require compliance with the BSD 3-Clause License, as well
* as the other licenses applicable to the third-party components included
* within TencentOS.
*---------------------------------------------------------------------------*/
#include <tos_k.h>
uint8_t irq_context_switch_flag = 0;
@@ -183,12 +200,12 @@ __KERNEL__ k_stack_t *cpu_task_stk_init(void *entry,
uint32_t *pul_top_of_stack;
#define PORT_BYTE_ALIGNMENT_MASK ( 0x0001 )
/* The stack type changes depending on the data model. */
sp = (cpu_data_t *)&( stk_base[ stk_size - ( uint32_t ) 1 ] );
sp = ( cpu_data_t * ) ( ( ( cpu_data_t ) sp ) & ( ~( ( cpu_data_t ) PORT_BYTE_ALIGNMENT_MASK ) ) );
sp = ( cpu_data_t * ) ( ( ( cpu_data_t ) sp ) & ( ~( ( cpu_data_t ) PORT_BYTE_ALIGNMENT_MASK ) ) );
/* cpu_data_t is either 16 bits or 32 bits depending on the data model.
Some stacked items do not change size depending on the data model so have
to be explicitly cast to the correct size so this function will work
@@ -207,20 +224,20 @@ __KERNEL__ k_stack_t *cpu_task_stk_init(void *entry,
}
/* PC - Interrupt return pointer */
*pul_top_of_stack = ( uint32_t ) entry;
*pul_top_of_stack = ( uint32_t ) entry;
pus_top_of_stack = ( uint16_t * ) pul_top_of_stack;
pus_top_of_stack--;
/* R2 - SR.GIE - bit8,golbal interrupt enable */
*pus_top_of_stack = 0x08;
/* SR size is 16-bits */
/* SR size is 16-bits */
pus_top_of_stack -= ( sizeof( cpu_data_t ) / 2 );
/* From here on the size of stacked items depends on the memory model. */
sp = ( cpu_data_t * ) pus_top_of_stack;
#if 0 // enable for debug
*sp = ( cpu_data_t ) 0xffff;
sp--;
@@ -237,7 +254,7 @@ __KERNEL__ k_stack_t *cpu_task_stk_init(void *entry,
*sp = ( cpu_data_t ) 0x9999;
sp--;
*sp = ( cpu_data_t ) 0x8888;
sp--;
sp--;
*sp = ( cpu_data_t ) 0x5555;
sp--;
*sp = ( cpu_data_t ) 0x6666;
@@ -249,8 +266,8 @@ __KERNEL__ k_stack_t *cpu_task_stk_init(void *entry,
sp -= 3;
*sp = ( cpu_data_t ) arg;
sp -= 8;// R11-R4
#endif
#endif
return (k_stack_t *)sp;
}

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include <tos.h>
#include <tos_k.h>
#include <riscv_port.h>
#ifndef TOS_CFG_IRQ_STK_SIZE

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include <tos.h>
#include <tos_k.h>
#include "riscv_port.h"
__PORT__ void port_systick_config(uint32_t cycle_per_tick)

View File

@@ -15,7 +15,7 @@
* within TencentOS.
*---------------------------------------------------------------------------*/
#include "tos.h"
#include "tos_k.h"
__PORT__ void port_cpu_init() {
// DO NOTHING