📄 txc_os_mem_mgmt.c
字号:
/*--------------------------------------------------------------------------
******* ****
* ***** ** * * * * * * ***** **** * *
* * * * * ** * * * * * * * * * *
* * * * * * * * **** * * * * * ******
* ***** ****** * * * * * ** * * * * * *
* * * * * * ** * * ** ** * * * * * *
* * * * * * * **** * * * * **** * *
Proprietary and Confidential
This program is made available only to customers and prospective customers
of TranSwitch Corporation under license and may be used only with TranSwitch
semi-conductor products.
Copyright(c) 2004 TranSwitch Inc.
|-----------------------------------------------------------------------|
| |
| ******** ****** |
| ** ** ** ** |
| ** ** ** * |
| ** ** ** |
| ** ** ** |
| ** ** ** |
| ** ** * *** |
| ** ** ** ** |
| ******** ****** |
| |
|-----------------------------------------------------------------------|
| Memory Management Source File |
|-----------------------------------------------------------------------|
| |
| Workfile: txc_os_mem_mgmt.c |
| |
| Description: this file contains all code for memory management |
| |
-------------------------------------------------------------------------
Revision History
-------------------------------------------------------------------------
Rev # Date Author Description
----- ------ ------- -----------
1.0 09-Mar-01 R. Ruchandani Initial Revision.
1.1 16-May-01 D. Zhang Added VxWorks block
1.2 19-Apr-02 R. Ruchandani Removed VxWorks block
1.3 25-Apr-02 B. Hawthorne Added VxWorks block back in. It
is now needed for MCS on Expresso.
1.4 24-Oct-02 D. Shea Redefined, PSOS, VXWORKS.
Added TXC_NO_RTOS
1.5 24-Oct-02 D. Shea Removed nested #elif statements
1.6 22-Nov-02 J. Federici For no Rtos case, put standard C
functions.
1.7 27-Dec-02 R. Kuhnen Fix C++ compiler warning
-----------------------------------------------------------------------*/
/***********************************************************************
** Include Files **
***********************************************************************/
#include <stdlib.h>
#include <string.h>
#include "txc_generic.h"
#include "txc_platform.h"
#include "txc_os_mem_mgmt.h"
#include "txc_error.h"
/************************************************************************
* *
* FUNCTION: TXC_Malloc *
* *
* DESCRIPTION: This will Allocate space in memory. *
* *
* INPUTS: unsigned int size of memory that will be allocated. *
* *
* RETURNS: *
* mallocPtr, the pointer to the memory allocated. *
* *
* *
* CAVEATS: *
* *
* *
* *
* REVISION HISTORY: *
* Date Author Description *
* ------------------------------------------------------------------- *
* 14-Mar-01 R. Ruchandani Initial Revision *
* *
************************************************************************/
char * TXC_Malloc(unsigned int size)
{
return ((char *)malloc (size) );
}
/************************************************************************
* *
* FUNCTION: TXC_Free *
* *
* DESCRIPTION: This will free memory that was allocated. *
* *
* INPUTS: void * ptr = Pointer to the memory allocated. *
* *
* RETURNS: None. *
* *
* *
* *
* CAVEATS: *
* *
* *
* *
* REVISION HISTORY: *
* Date Author Description *
* ------------------------------------------------------------------- *
* 14-Mar-01 R. Ruchandani Initial Revision *
* *
************************************************************************/
void TXC_Free(void *ptr)
{
free(ptr);
}
/************************************************************************
* *
* FUNCTION: TXC_Memset *
* *
* DESCRIPTION: Set a string into a block of memory. *
* *
* INPUTS: void * s, int c, size_t n. *
* *
* RETURNS: None. *
* *
* *
* *
* CAVEATS: *
* *
* *
* *
* REVISION HISTORY: *
* Date Author Description *
* ------------------------------------------------------------------- *
* 21-Mar-01 R. Ruchandani Initial Revision *
* *
************************************************************************/
void * TXC_Memset(void * s, int c, TXC_SIZE_T n)
{
return (memset(s, c, n) );
}
/************************************************************************
* *
* FUNCTION: TXC_Memcpy *
* *
* DESCRIPTION:copies a block of memory *
* *
* INPUTS: destination pointer, source pointer, and number of bytes *
* *
* RETURNS: none *
* *
* CAVEATS: *
* *
* REVISION HISTORY: *
* Date Author Description *
* ------------------------------------------------------------------- *
* 06-Feb-01 L. Olah Initial Revision *
* *
************************************************************************/
void TXC_Memcpy(void *destPtr, const void *srcPtr, TXC_SIZE_T numBytes)
{
memcpy(destPtr, srcPtr, numBytes);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -