📄 rom400_kmem.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_kmem_
#define __rom400_kmem_
/** \file rom400_kmem.h
* \brief Kernel Memory initialization functions for the DS80C400 ROM
*
* This library allows users to allocate different amounts of
* memory as fast kernel buffers for use as ethernet buffers
* and as task control structures. The default allocation by the
* ROM may not be sufficient, and the use of multiple processes
* and multiple sockets might combine to drain all kernel memory.
* This library allows you to increase that amount for more complex
* applications.
*
* There are two ways to use this library.
* 1) When using <i>#init_rom</i>:
* Call <i>#kmem_install</i> before calling <i>#init_rom</i>.
*
* 2) When using the individual initialization functions:
* The function <i>#kmem_init</i> is meant to replace the function
* <i>#init_km</i> from the initialization library.
*
* 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 functions in this library are multi-process safe--that is, if
* you call the same method from two different processes at the same
* time, the parameters to the function will not be destroyed. However,
* the function <i>#kmem_init</i> is a system initialization function
* and should only be called once before the process scheduler is active.
*/
/** Version number associated with this header file. Should be the same as
* the version number returned by the <i>#kmem_version</i> function.
* \sa #kmem_version */
#define ROM400_KMEM_VERSION 4
/** The smallest value of the argument to be passed to <i>#kmem_init</i>.
* \sa #ROM400_KMEM_MODEL_LARGEST
* \sa #kmem_init */
#define ROM400_KMEM_MODEL_SMALLEST 1
/** The largest value of the argument to be passed to <i>#kmem_init</i>.
* \sa #ROM400_KMEM_MODEL_SMALLEST
* \sa #kmem_init */
#define ROM400_KMEM_MODEL_LARGEST 11
/**
* \brief Initializes the kernel buffers
*
* Allows user applications to specify the amount of kernel memory
* that will be available to the system. Kernel memory is used internally
* for Ethernet buffers and task control structures, and as such can
* limit the number of processes or sockets an application can use
* concurrently if there is not enough kernel buffer space.
* The default kernel buffer allocation given by the ROM is:
*
* - 90 byte buffers (20 count)
* - 256 byte buffers (2 count)
* - 512 byte buffers (1 count)
* - 768 byte buffers (1 count)
* - 1024 byte buffers (1 count)
* - 1280 byte buffers (1 count)
* - 1600 byte buffers (2 count)
*
* By calling this function, the count of kernel buffers is multiplied
* by the value <i>MODEL</i>. Note that while <b>#ROM400_KMEM_MODEL_LARGEST</b>
* is the largest amount of kernel memory that the system can support,
* few applications will need to go beyond <b>#ROM400_KMEM_MODEL_SMALLEST + 2</b>.
*
* \param MODEL specifies how much kernel memory will be allocated for the system
*
* \return 0 for success, non-zero for failure.
*
* \sa #init_rom
*/
//---------------------------------------------------------------------------
unsigned char kmem_init(unsigned char MODEL);
/**
* \brief Returns the version number of this KMEM library.
*
* \return Version number of this KMEM library.
*/
//---------------------------------------------------------------------------
unsigned int kmem_version(void);
/**
* \brief Installs the kmem library.
*
* This function must be called before <i>#init_rom</i>.
*
* Allows user applications to specify the amount of kernel memory
* that will be available to the system. Kernel memory is used internally
* for Ethernet buffers and task control structures, and as such can
* limit the number of processes or sockets an application can use
* concurrently if there is not enough kernel buffer space.
* The default kernel buffer allocation given by the ROM is:
*
* - 90 byte buffers (20 count)
* - 256 byte buffers (2 count)
* - 512 byte buffers (1 count)
* - 768 byte buffers (1 count)
* - 1024 byte buffers (1 count)
* - 1280 byte buffers (1 count)
* - 1600 byte buffers (2 count)
*
* By calling this function, the count of kernel buffers is multiplied
* by the value <i>MODEL</i>. Note that while <b>#ROM400_KMEM_MODEL_LARGEST</b>
* is the largest amount of kernel memory that the system can support,
* few applications will need to go beyond <b>#ROM400_KMEM_MODEL_SMALLEST + 2</b>.
*
* \param MODEL specifies how much kernel memory will be allocated for the system
*
* \sa #init_rom
*/
//---------------------------------------------------------------------------
void kmem_install(unsigned char MODEL);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -