⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rom400_mem.h

📁 tini的http-slientC程序
💻 H
字号:
/*---------------------------------------------------------------------------
 *  Copyright (C) 2003 Dallas Semiconductor Corporation, All Rights Reserved.
 * 
 *  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 without limitation
 *  the rights to use, copy, modify, merge, publish, 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.
 *  IN NO EVENT SHALL DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES
 *  OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 *  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 *  OTHER DEALINGS IN THE SOFTWARE.
 * 
 *  Except as contained in this notice, the name of Dallas Semiconductor
 *  shall not be used except as stated in the Dallas Semiconductor
 *  Branding Policy.
 * ---------------------------------------------------------------------------
 *
 * This file contains function definitions for the built-in ROM functions 
 * of the Dallas Semiconductor 400 processor.  This file is intended for use 
 * with the Keil MicroVision (uVision) C compiler.
 *
 * ---------------------------------------------------------------------------
 */
#ifndef __rom400_mem_
#define __rom400_mem_

/** \file rom400_mem.h
 *  \brief Memory management functions in the DS80C400 ROM
 *
 *  This library contains functions for allocating and de-allocating
 *  blocks of memory through the ROM's memory manager.
 *  
 *  For detailed information on the DS80C400 please see the
 *  <a href="http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf">
 *  High-Speed Microcontroller User's Guide: DS80C400 Supplement</a>.
 *
 *  The methods in this library are all multi-process safe.  That is,
 *  a function can be called by more than one process at the same time
 *  and its parameters won't be destroyed.
 */

/** Version number associated with this header file.  Should be the same as
 * the version number returned by the <i>#mem_version</i> function.
 * \sa #mem_version */
#define ROM400_MEM_VERSION         5

/**
 * \brief     Requests a block of memory to be allocated
 *
 * Tries to allocate a block of memory of the requested size.  The data 
 * allocated is filled with 0's.  To request non-cleared memory (and 
 * save the extra time) use <i>#mem_mallocdirty</i>.  To de-allocate the
 * memory block, use <i>#mem_free</i>.
 *
 * This is a redirected function.  The ROM includes a default 
 * memory manager implementation.  See the 
 * <a href="http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf">
 * DS80C400 User's Guide</a> for information on replacing the default 
 * memory manager with your own memory manager.
 *
 * \param     size  amount of data requested for allocation
 *
 * \return    pointer to the newly allocated memory, or NULL (0) if the operation failed
 *
 * \sa        #mem_mallocdirty
 * \sa        #mem_free
 * \sa        #mem_sizeof
 */
//---------------------------------------------------------------------------
void* mem_malloc(unsigned int size);

/**
 * \brief     Requests a block of memory to be allocated
 *
 * Tries to allocate a block of memory of the requested size.  
 * The data allocated is NOT filled with 0's, and is likely to be 
 * filled with unpredictable values.  To request cleared memory,
 * use <i>#mem_malloc</i>.  To de-allocate the memory block, use <i>#mem_free</i>.
 *
 * This is a redirected function.  The ROM includes a default 
 * memory manager implementation.  See the 
 * <a href="http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf">
 * DS80C400 User's Guide</a> for information on replacing the default 
 * memory manager with your own memory manager.
 *
 * \param     size  amount of data requested for allocation
 *
 * \return    pointer to the newly allocated memory, or NULL (0) if the operation failed
 *
 * \sa        #mem_malloc
 * \sa        #mem_free
 * \sa        #mem_sizeof
 */
//---------------------------------------------------------------------------
void* mem_mallocdirty(unsigned int size);

/**
 * \brief      De-allocates a block of memory.
 *
 * Deallocates a block of memory that was previously allocated
 * by calling <i>#mem_malloc</i> or <i>#mem_mallocdirty</i>, making this
 * block available for re-allocation.  Use the function <i>#mem_getfreeram</i>
 * to determine how much memory is available for allocation. 
 *
 * This is a redirected function.  The ROM includes a default 
 * memory manager implementation.  See the 
 * <a href="http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf">
 * DS80C400 User's Guide</a> for information on replacing the default 
 * memory manager with your own memory manager.
 *
 * \param     ptr pointer to the beginning of the previously allocated memory
 *
 * \return    0 for success, non-zero for failure
 *
 * \sa        #mem_malloc
 * \sa        #mem_mallocdirty
 * \sa        #mem_getfreeram
 * \sa        #mem_sizeof
 */
//---------------------------------------------------------------------------
unsigned char mem_free(void* ptr);

/**
 * \brief     Returns the amount of memory available for allocation
 *
 * Returns the total amount of memory available for allocation.  Memory is
 * allocated in increments of 32 bytes.  Due to fragmentation, large
 * memory allocations may not be possible.
 *
 * This is a redirected function.  The ROM includes a default 
 * memory manager implementation.  See the 
 * <a href="http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf">
 * DS80C400 User's Guide</a> for information on replacing the default 
 * memory manager with your own memory manager.
 *
 * \sa        #mem_sizeof
 *
 * \return    The amount of memory available for allocation from the memory manager.
 */
//---------------------------------------------------------------------------
unsigned long mem_getfreeram(void);

/**
 * \brief      Gets the size of an allocated block of memory.
 *
 * Returns the size of a block of memory that was allocated by the ROM's
 * default memory manager.  If the input pointer is not a valid pointer that
 * was created by an earlier call to <i>#mem_malloc</i> or <i>#mem_dirtymalloc</i>,
 * the value returned has no meaning.
 *
 * This is <b>NOT</b> a redirected function, and only functions if the ROM's
 * default memory manager is used.  
 *
 * \param     ptr pointer to the beginning of the previously allocated memory
 *
 * \return    size of the memory allocated for a valid input pointer
 *
 * \sa        #mem_malloc
 * \sa        #mem_mallocdirty
 * \sa        #mem_getfreeram
 */
//---------------------------------------------------------------------------
unsigned int mem_sizeof(void* ptr);

/**
 * \brief     Returns the version number of this memory management library.
 *
 * \return    Version number of this memory management library.
 */
//---------------------------------------------------------------------------
unsigned int mem_version(void);


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -