📄 tx_adsp.c
字号:
/**************************************************************************/
/* */
/* Copyright (c) 1996-2004 by Express Logic Inc. */
/* */
/* This software is copyrighted by and is the sole property of Express */
/* Logic, Inc. All rights, title, ownership, or other interests */
/* in the software remain the property of Express Logic, Inc. This */
/* software may only be used in accordance with the corresponding */
/* license agreement. Any unauthorized use, duplication, transmission, */
/* distribution, or disclosure of this software is expressly forbidden. */
/* */
/* This Copyright notice may not be removed or modified without prior */
/* written consent of Express Logic, Inc. */
/* */
/* Express Logic, Inc. reserves the right to modify this software */
/* without notice. */
/* */
/* Express Logic, Inc. */
/* 11423 West Bernardo Court info@expresslogic.com */
/* San Diego, CA 92127 http://www.expresslogic.com */
/* */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Thread Control (THR) */
/** */
/**************************************************************************/
/**************************************************************************/
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_mut.h"
#ifdef __cplusplus
#define _EXTERN_C extern "C" {
#define _END_EXTERN_C }
#else
#define _EXTERN_C
#define _END_EXTERN_C
#endif /* __cplusplus */
/* TYPE bool */
#if defined(__cplusplus)
#if _HAS_BOOL_TYPE
typedef BOOL _Bool;
#endif
#else
typedef INT BOOL;
#endif
_EXTERN_C
TX_MUTEX tx_adsp_mutex;
extern TX_THREAD *tx_thread_identify(VOID);
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* AllocateThreadSlotEx__3VDKFPiPFPv_v BLACKFIN561/VisualDSP */
/* 4.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Express Logic, Inc. */
/* */
/* DESCRIPTION */
/* */
/* This function allocates a 32-bit slot in Thread Local Storage. */
/* */
/* */
/* INPUT */
/* */
/* ioSlotNum Pointer to allocated slot # */
/* cleanupfunc Pointer to deallocate/free */
/* */
/* OUTPUT */
/* */
/* return status Slot allocate return status */
/* */
/* CALLS */
/* */
/* _tx_thread_identify Identify the current thread */
/* */
/* CALLED BY */
/* */
/* ADSP libraries */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 07-15-2004 Karl Homer Initial Version 4.0 */
/* */
/**************************************************************************/
BOOL AllocateThreadSlotEx__3VDKFPiPFPv_v(INT_PTR ioSlotNum, VOID (*cleanupfunc)(VOID_PTR))
{
BOOL bStatus;
INT allocated_slots;
TX_THREAD *tx_current_thread_ptr;
TX_TLS *thread_local_storage_ptr;
tx_current_thread_ptr = tx_thread_identify();
thread_local_storage_ptr = &tx_current_thread_ptr->tx_thread_local_storage;
allocated_slots = thread_local_storage_ptr->allocated_slots;
if((allocated_slots >=0) && (allocated_slots < TX_ADSP_THREAD_SLOTS))
{
if(cleanupfunc != TX_NULL)
thread_local_storage_ptr->cleanupfunc[allocated_slots] = (VOID_PTR) cleanupfunc;
thread_local_storage_ptr->allocated_slots = ++allocated_slots;
*ioSlotNum = allocated_slots;
bStatus = TX_TRUE;
}
else
bStatus = TX_FALSE;
return(bStatus);
}
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* GetThreadSlotValue__3VDKFi BLACKFIN561/VisualDSP */
/* 4.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Express Logic, Inc. */
/* */
/* DESCRIPTION */
/* */
/* This function returns the 32-bit slot in Thread Local Storage. */
/* */
/* */
/* INPUT */
/* */
/* ioSlotNum pre-allocated slot # */
/* */
/* OUTPUT */
/* */
/* slot value contents of requested slot */
/* */
/* CALLS */
/* */
/* _tx_thread_identify Identify the current thread */
/* */
/* CALLED BY */
/* */
/* ADSP libraries */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 07-15-2004 Karl Homer Initial Version 4.0 */
/* */
/**************************************************************************/
VOID_PTR GetThreadSlotValue__3VDKFi(INT inSlotNum)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -