2021-09-24 10:52:11 +08:00
|
|
|
/**************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
|
|
|
/* */
|
|
|
|
/* This software is licensed under the Microsoft Software License */
|
|
|
|
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
|
|
|
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
|
|
|
/* and in the root directory of this software. */
|
|
|
|
/* */
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
/**************************************************************************/
|
|
|
|
/** */
|
|
|
|
/** ThreadX Component */
|
|
|
|
/** */
|
|
|
|
/** Port Specific */
|
|
|
|
/** */
|
|
|
|
/**************************************************************************/
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* PORT SPECIFIC C INFORMATION RELEASE */
|
|
|
|
/* */
|
|
|
|
/* tx_port.h RXv1/CCRX */
|
2022-04-26 14:19:28 +08:00
|
|
|
/* 6.1.11 */
|
2021-09-24 10:52:11 +08:00
|
|
|
/* */
|
|
|
|
/* AUTHOR */
|
|
|
|
/* */
|
|
|
|
/* William E. Lamie, Microsoft Corporation */
|
|
|
|
/* */
|
|
|
|
/* DESCRIPTION */
|
|
|
|
/* */
|
|
|
|
/* This file contains data type definitions that make the ThreadX */
|
|
|
|
/* real-time kernel function identically on a variety of different */
|
|
|
|
/* processor architectures. For example, the size or number of bits */
|
|
|
|
/* in an "int" data type vary between microprocessor architectures and */
|
|
|
|
/* even C compilers for the same microprocessor. ThreadX does not */
|
|
|
|
/* directly use native C data types. Instead, ThreadX creates its */
|
|
|
|
/* own special types that can be mapped to actual data types by this */
|
|
|
|
/* file to guarantee consistency in the interface and functionality. */
|
|
|
|
/* */
|
|
|
|
/* RELEASE HISTORY */
|
|
|
|
/* */
|
|
|
|
/* DATE NAME DESCRIPTION */
|
|
|
|
/* */
|
|
|
|
/* 08-02-2021 William E. Lamie Initial Version 6.1.8 */
|
2021-10-14 00:51:26 +00:00
|
|
|
/* 10-15-2021 William E. Lamie Modified comment(s), */
|
|
|
|
/* resulting in version 6.1.9 */
|
2022-02-01 23:21:49 -08:00
|
|
|
/* 01-31-2022 William E. Lamie Modified comment(s), removed */
|
|
|
|
/* system state macro, and */
|
|
|
|
/* added missing interrupt */
|
|
|
|
/* control defines, */
|
|
|
|
/* resulting in version 6.1.10 */
|
2022-04-26 14:19:28 +08:00
|
|
|
/* 04-25-2022 William E. Lamie Modified comment(s), */
|
|
|
|
/* resulting in version 6.1.11 */
|
2021-09-24 10:52:11 +08:00
|
|
|
/* */
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
#ifndef TX_PORT_H
|
|
|
|
#define TX_PORT_H
|
|
|
|
|
|
|
|
/* Determine if the optional ThreadX user define file should be used. */
|
|
|
|
|
|
|
|
#ifdef TX_INCLUDE_USER_DEFINE_FILE
|
|
|
|
|
|
|
|
|
|
|
|
/* Yes, include the user defines in tx_user.h. The defines in this file may
|
|
|
|
alternately be defined on the command line. */
|
|
|
|
|
|
|
|
#include "tx_user.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Define ThreadX basic types for this port. */
|
|
|
|
|
|
|
|
#define VOID void
|
|
|
|
typedef char CHAR;
|
|
|
|
typedef unsigned char UCHAR;
|
|
|
|
typedef int INT;
|
|
|
|
typedef unsigned int UINT;
|
|
|
|
typedef long LONG;
|
|
|
|
typedef unsigned long ULONG;
|
|
|
|
typedef short SHORT;
|
|
|
|
typedef unsigned short USHORT;
|
|
|
|
|
|
|
|
|
2022-02-01 23:21:49 -08:00
|
|
|
/* Define interrupt control options. */
|
|
|
|
|
|
|
|
#define TX_INT_DISABLE 0x00000000
|
|
|
|
#define TX_INT_ENABLE 0x00010000
|
|
|
|
|
|
|
|
|
2021-09-24 10:52:11 +08:00
|
|
|
/* Define the priority levels for ThreadX. Legal values range
|
|
|
|
from 32 to 1024 and MUST be evenly divisible by 32. */
|
|
|
|
|
|
|
|
#ifndef TX_MAX_PRIORITIES
|
|
|
|
#define TX_MAX_PRIORITIES 32
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* Define the minimum stack for a ThreadX thread on this processor. If the size supplied during
|
|
|
|
thread creation is less than this value, the thread create call will return an error. */
|
|
|
|
|
|
|
|
#ifndef TX_MINIMUM_STACK
|
|
|
|
#define TX_MINIMUM_STACK 256 /* Minimum stack size for this port */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* Define the system timer thread's default stack size and priority. These are only applicable
|
|
|
|
if TX_TIMER_PROCESS_IN_ISR is not defined. */
|
|
|
|
|
|
|
|
#ifndef TX_TIMER_THREAD_STACK_SIZE
|
|
|
|
#define TX_TIMER_THREAD_STACK_SIZE 1024 /* Default timer thread stack size */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef TX_TIMER_THREAD_PRIORITY
|
|
|
|
#define TX_TIMER_THREAD_PRIORITY 0 /* Default timer thread priority */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef TX_TRACE_TIME_SOURCE
|
|
|
|
#define TX_TRACE_TIME_SOURCE ++_tx_trace_simulated_time
|
|
|
|
#endif
|
|
|
|
#ifndef TX_TRACE_TIME_MASK
|
|
|
|
#define TX_TRACE_TIME_MASK 0xFFFFFFFFUL
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* Define the port specific options for the _tx_build_options variable. This variable indicates
|
|
|
|
how the ThreadX library was built. */
|
|
|
|
|
|
|
|
#define TX_PORT_SPECIFIC_BUILD_OPTIONS 0
|
|
|
|
|
|
|
|
|
|
|
|
/* Define the in-line initialization constant so that modules with in-line
|
|
|
|
initialization capabilities can prevent their initialization from being
|
|
|
|
a function call. */
|
|
|
|
|
|
|
|
#define TX_INLINE_INITIALIZATION
|
|
|
|
|
|
|
|
|
|
|
|
/* Determine whether or not stack checking is enabled. By default, ThreadX stack checking is
|
|
|
|
disabled. When the following is defined, ThreadX thread stack checking is enabled. If stack
|
|
|
|
checking is enabled (TX_ENABLE_STACK_CHECKING is defined), the TX_DISABLE_STACK_FILLING
|
|
|
|
define is negated, thereby forcing the stack fill which is necessary for the stack checking
|
|
|
|
logic. */
|
|
|
|
|
|
|
|
#ifdef TX_ENABLE_STACK_CHECKING
|
|
|
|
#undef TX_DISABLE_STACK_FILLING
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* Define the TX_THREAD control block extensions for this port. The main reason
|
|
|
|
for the multiple macros is so that backward compatibility can be maintained with
|
|
|
|
existing ThreadX kernel awareness modules. */
|
|
|
|
|
|
|
|
#define TX_THREAD_EXTENSION_0
|
|
|
|
#define TX_THREAD_EXTENSION_1
|
|
|
|
#define TX_THREAD_EXTENSION_2
|
|
|
|
#define TX_THREAD_EXTENSION_3
|
|
|
|
|
|
|
|
|
|
|
|
/* Define the port extensions of the remaining ThreadX objects. */
|
|
|
|
|
|
|
|
#define TX_BLOCK_POOL_EXTENSION
|
|
|
|
#define TX_BYTE_POOL_EXTENSION
|
|
|
|
#define TX_EVENT_FLAGS_GROUP_EXTENSION
|
|
|
|
#define TX_MUTEX_EXTENSION
|
|
|
|
#define TX_QUEUE_EXTENSION
|
|
|
|
#define TX_SEMAPHORE_EXTENSION
|
|
|
|
#define TX_TIMER_EXTENSION
|
|
|
|
|
|
|
|
|
|
|
|
/* Define the user extension field of the thread control block. Nothing
|
|
|
|
additional is needed for this port so it is defined as white space. */
|
|
|
|
|
|
|
|
#ifndef TX_THREAD_USER_EXTENSION
|
|
|
|
#define TX_THREAD_USER_EXTENSION
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* Define the macros for processing extensions in tx_thread_create, tx_thread_delete,
|
|
|
|
tx_thread_shell_entry, and tx_thread_terminate. */
|
|
|
|
|
|
|
|
|
|
|
|
#define TX_THREAD_CREATE_EXTENSION(thread_ptr)
|
|
|
|
#define TX_THREAD_DELETE_EXTENSION(thread_ptr)
|
|
|
|
#define TX_THREAD_COMPLETED_EXTENSION(thread_ptr)
|
|
|
|
#define TX_THREAD_TERMINATED_EXTENSION(thread_ptr)
|
|
|
|
|
|
|
|
|
|
|
|
/* Define the ThreadX object creation extensions for the remaining objects. */
|
|
|
|
|
|
|
|
#define TX_BLOCK_POOL_CREATE_EXTENSION(pool_ptr)
|
|
|
|
#define TX_BYTE_POOL_CREATE_EXTENSION(pool_ptr)
|
|
|
|
#define TX_EVENT_FLAGS_GROUP_CREATE_EXTENSION(group_ptr)
|
|
|
|
#define TX_MUTEX_CREATE_EXTENSION(mutex_ptr)
|
|
|
|
#define TX_QUEUE_CREATE_EXTENSION(queue_ptr)
|
|
|
|
#define TX_SEMAPHORE_CREATE_EXTENSION(semaphore_ptr)
|
|
|
|
#define TX_TIMER_CREATE_EXTENSION(timer_ptr)
|
|
|
|
|
|
|
|
|
|
|
|
/* Define the ThreadX object deletion extensions for the remaining objects. */
|
|
|
|
|
|
|
|
#define TX_BLOCK_POOL_DELETE_EXTENSION(pool_ptr)
|
|
|
|
#define TX_BYTE_POOL_DELETE_EXTENSION(pool_ptr)
|
|
|
|
#define TX_EVENT_FLAGS_GROUP_DELETE_EXTENSION(group_ptr)
|
|
|
|
#define TX_MUTEX_DELETE_EXTENSION(mutex_ptr)
|
|
|
|
#define TX_QUEUE_DELETE_EXTENSION(queue_ptr)
|
|
|
|
#define TX_SEMAPHORE_DELETE_EXTENSION(semaphore_ptr)
|
|
|
|
#define TX_TIMER_DELETE_EXTENSION(timer_ptr)
|
|
|
|
|
|
|
|
|
|
|
|
/* Define ThreadX interrupt lockout and restore macros for protection on
|
|
|
|
access of critical kernel information. The restore interrupt macro must
|
|
|
|
restore the interrupt posture of the running thread prior to the value
|
|
|
|
present prior to the disable macro. In most cases, the save area macro
|
|
|
|
is used to define a local function save area for the disable and restore
|
|
|
|
macros. */
|
|
|
|
|
|
|
|
/* UINT _tx_thread_interrupt_control(UINT new_posture); */
|
|
|
|
|
|
|
|
#pragma inline_asm _tx_thread_interrupt_disable
|
|
|
|
static UINT _tx_thread_interrupt_disable(void){
|
|
|
|
MVFC PSW,R1 ;
|
|
|
|
CLRPSW I ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#pragma inline_asm _tx_thread_interrupt_restore
|
|
|
|
static void _tx_thread_interrupt_restore(UINT old_posture){
|
|
|
|
MVFC PSW, R2 ;
|
|
|
|
BTST #16,r1 ;
|
|
|
|
BMC #16,r2 ;
|
|
|
|
MVTC r2,PSW ;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define TX_INTERRUPT_SAVE_AREA UINT interrupt_save;
|
|
|
|
|
|
|
|
#define TX_DISABLE interrupt_save = _tx_thread_interrupt_disable();
|
|
|
|
|
|
|
|
|
|
|
|
#define TX_RESTORE _tx_thread_interrupt_restore(interrupt_save);
|
|
|
|
|
|
|
|
|
|
|
|
#define _tx_thread_system_return _tx_thread_system_return_inline
|
|
|
|
|
|
|
|
static void _tx_thread_system_return_inline(void)
|
|
|
|
{
|
|
|
|
UINT interrupt_save;
|
|
|
|
|
|
|
|
interrupt_save = _tx_thread_interrupt_disable();
|
|
|
|
|
|
|
|
*((volatile UCHAR *)(0x872E0u)) = 1u;
|
|
|
|
|
|
|
|
_tx_thread_interrupt_restore(interrupt_save);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Define the interrupt lockout macros for each ThreadX object. */
|
|
|
|
|
|
|
|
#define TX_BLOCK_POOL_DISABLE TX_DISABLE
|
|
|
|
#define TX_BYTE_POOL_DISABLE TX_DISABLE
|
|
|
|
#define TX_EVENT_FLAGS_GROUP_DISABLE TX_DISABLE
|
|
|
|
#define TX_MUTEX_DISABLE TX_DISABLE
|
|
|
|
#define TX_QUEUE_DISABLE TX_DISABLE
|
|
|
|
#define TX_SEMAPHORE_DISABLE TX_DISABLE
|
|
|
|
|
|
|
|
|
|
|
|
/* Define the version ID of ThreadX. This may be utilized by the application. */
|
|
|
|
|
|
|
|
#ifdef TX_THREAD_INIT
|
|
|
|
CHAR _tx_version_id[] =
|
2023-12-28 10:51:29 +08:00
|
|
|
"Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv1/CCRX Version 6.4.0 *";
|
2021-09-24 10:52:11 +08:00
|
|
|
#else
|
|
|
|
extern CHAR _tx_version_id[];
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|