📄 mem.h
字号:
/*-----------------------------------------------------------------------------
$File: //hodad/usblink/3.4/source/hostctrl/otg242/mem.h $
$DateTime: 2003/11/14 14:15:56 $
$Revision: #2 $
Purpose: OTG242 on chip memory data and macro definitions.
CONFIDENTIAL AND PROPRIETARY INFORMATION OF SOFTCONNEX TECHNOLOGIES, INC.
THIS NOTICE IS NOT TO BE DELETED, MODIFIED, MOVED OR CHANGED IN ANY WAY.
Copyright (c) 1999 - 2003 by SoftConnex Technologies, Inc.
This software is protected by copyright laws and international copyright
treaties, as well as other intellectual property laws and treaties. This
software is a CONFIDENTIAL, unpublished work of authorship, and with portions
constituting TRADE SECRETS of SoftConnex Technologies, Inc., a Delaware USA
corporation. Any unauthorized use, disclosure, and/or reproduction of this
software, or any part of this software; or distribution of this software in any
form or by any means; or storage of this software in any database or retrieval
system, without the express written consent of, and license from, SoftConnex
Technologies, Inc. is strictly prohibited. This software is protected under the
copyright and/or trade secret laws in other countries in addition to USA. All
Rights Reserved. Failure to abide by the use, disclosure and/or reproduction
restrictions may result in civil and /or criminal penalties, and will be
prosecuted to the maximum extent of the law.
-----------------------------------------------------------------------------*/
#ifndef _SOFTCONNEX_OTG242MEM_H_
#define _SOFTCONNEX_OTG242MEM_H_
#define OTG242MEM_SIZE 4096 /* size of host controller data memory */
#define OTG242MEM_START 0x00 /* Data memory */
#define OTG242MEM_BLOCK_MAGNITUDE 4 /* 2^4 = 16 bytes per block */
#define OTG242MEM_BLOCK_SIZE (1 << 4)
#define OTG242MEM_BLOCK_USED 0x80
typedef struct _Otg242MemBlock
{
U8 size; /* number of blocks - 1 */
U8 status;
}
Otg242MemBlock;
typedef struct _Otg242Mem
{
U32 start; /* Start address of memory */
U32 blocks; /* Number of 16 bytes blocks in memory */
Otg242MemBlock memBlocks[OTG242MEM_SIZE >> OTG242MEM_BLOCK_MAGNITUDE];
}
Otg242Mem;
#define OTG242MEM_SET_BLOCKS(block, blocks) (block)->size = blocks
/* S32 otg_mem_Test(otg_t *otg); */
#define OTG242MEM_BYTE_TO_BLOCK(size) ((size + OTG242MEM_BLOCK_SIZE - 1) >> OTG242MEM_BLOCK_MAGNITUDE)
#define OTG242MEM_BLOCK_TO_ADDR(mem, blocks) (mem->start + ((blocks) << OTG242MEM_BLOCK_MAGNITUDE))
#define OTG242MEM_ADDR_TO_BLOCK(mem, addr) (mem->memBlocks + ((addr - mem->start) >> OTG242MEM_BLOCK_MAGNITUDE))
SctStatus OTG242MEM_Create(Otg242Mem* mem);
void OTG242MEM_Delete(Otg242Mem* mem);
SctStatus OTG242MEM_Initialize(Otg242Mem* mem);
S32 OTG242MEM_Allocate(Otg242Mem* mem, S32 size);
void OTG242MEM_Free(Otg242Mem* mem, U32 addr);
#endif /* _SOFTCONNEX_OTG242MEM_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -