Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
avmem.c
Package: ST_5105DTV.rar [view]
Upload User: fy98168
Upload Date: 2015-06-26
Package Size: 13771k
Code Size: 6k
Category:
DVD
Development Platform:
C/C++
- /*****************************************************************************
- File name : avmem.c
- Description : AVMEM functions
- COPYRIGHT (C) 2004 STMicroelectronics
- *****************************************************************************/
- /* Includes --------------------------------------------------------------- */
- #include <string.h>
- #include "stdevice.h"
- #include "sttbx.h"
- #include "section.h" /* memory partitions */
- #include "errors.h"
- #include "boot.h"
- #include "avmem.h"
- #include "fdma.h"
- /* Private Types ------------------------------------------------------ */
- /* Private Constants -------------------------------------------------- */
- #define AVMEM_MAX_BLOCKS 100
- #define AVMEM_FORB_RANGES 2
- /* Private Variables -------------------------------------------------- */
- void *Forbidden_Borders_p[KB_AVMEM_FORB_BORDERS] = {
- #if 0 //def MALY3
- (void*)0xC0800000,
- (void*)0xC0900000,
- (void*)0xC0A00000,
- (void*)0xC0B00000,
- (void*)0xC0C00000,
- (void*)0xC0D00000
- #else
- (void*)0xC0800000,
- (void*)0xC0900000,
- (void*)0xC0A00000,
- (void*)0xC0B00000,
- (void*)0xC0C00000,
- (void*)0xC0D00000,
- (void*)0xC0E00000,
- (void*)0xC0F00000,
- (void*)0xC1A00000,
- (void*)0xC1B00000
- #endif
- };
- /* Private Macros ----------------------------------------------------- */
- #ifndef BM_BASE_ADDRESS
- #define BM_BASE_ADDRESS 0
- #endif
- /* Private Function prototypes ---------------------------------------- */
- /* Functions ---------------------------------------------------------- */
- /* Global ----------------------------------------------------------------- */
- ST_DeviceName_t AVMEM_DeviceName = "AVMEM";
- STAVMEM_PartitionHandle_t g_KBAvmemPartitionHandle[KB_AVMEM_MAX_PARTITIONS];
- /* Functions -------------------------------------------------------------- */
- /*
- 1 bits buffer (Video)
- 4 frame buffers (Video)
- 2 dest buffer (Video tests)
- 1 bits buffer (Audio)
- ---
- 8 (MaxBlocks rounded to 10) */
- /*-------------------------------------------------------------------------
- * Function : KB_AVMEMSetup
- * Input : None
- * Output :
- * Return : Error Code
- * ----------------------------------------------------------------------*/
- ST_ErrorCode_t KB_AVMEMSetup(void)
- {
- ST_ErrorCode_t ST_ErrorCode;
- U32 instance;
- STAVMEM_InitParams_t STAVMEM_InitParams;
- STAVMEM_SharedMemoryVirtualMapping_t VirtualMapping;
- STAVMEM_MemoryRange_t PartitionMapTable[KB_AVMEM_MAX_PARTITIONS];
- STAVMEM_CreatePartitionParams_t STAVMEM_CreatePartitionParams = { 0 }; /* dummy parameter */
- PartitionMapTable[0].StartAddr_p = (void *) (AVMEM_BASE_ADDRESS);
- PartitionMapTable[0].StopAddr_p = (void *) (AVMEM_BASE_ADDRESS + AVMEM_SIZE -1);
- #if (KB_AVMEM_MAX_PARTITIONS - 1)
- PartitionMapTable[1].StartAddr_p = (void *) (NCACHE_BASE_ADDRESS);
- PartitionMapTable[1].StopAddr_p = (void *) (NCACHE_BASE_ADDRESS + NCACHE_SIZE -1);
- #endif
- if (KB_AVMEM_DEVICE_TYPE == STAVMEM_DEVICE_TYPE_VIRTUAL)
- {
- VirtualMapping.PhysicalAddressSeenFromCPU_p = (void *)AVMEM_BASE_ADDRESS;
- VirtualMapping.PhysicalAddressSeenFromDevice_p = (void *)AVMEM_BASE_ADDRESS;
- VirtualMapping.PhysicalAddressSeenFromDevice2_p = (void *)AVMEM_BASE_ADDRESS;
- VirtualMapping.VirtualBaseAddress_p = (void *)AVMEM_BASE_ADDRESS;
- VirtualMapping.VirtualSize = AVMEM_SIZE;
- VirtualMapping.VirtualWindowOffset = 0;
- VirtualMapping.VirtualWindowSize = AVMEM_SIZE;
- }
- STAVMEM_InitParams.DeviceType = KB_AVMEM_DEVICE_TYPE;
- STAVMEM_InitParams.MaxPartitions = KB_AVMEM_MAX_PARTITIONS;
- STAVMEM_InitParams.MaxNumberOfMemoryMapRanges = KB_AVMEM_MAX_PARTITIONS;
- /* because each partition has a single range here */
- STAVMEM_InitParams.SharedMemoryVirtualMapping_p = &VirtualMapping;
- STTBX_Print(("KB_AVMEMSetup(GENERIC,"));
- STAVMEM_InitParams.CPUPartition_p = SystemPartition;
- STAVMEM_InitParams.NCachePartition_p = NcachePartition;
- STAVMEM_InitParams.MaxBlocks = AVMEM_MAX_BLOCKS;
- STAVMEM_InitParams.MaxForbiddenRanges = AVMEM_FORB_RANGES;
- STAVMEM_InitParams.MaxForbiddenBorders = KB_AVMEM_FORB_BORDERS;
- STAVMEM_InitParams.OptimisedMemAccessStrategy_p = NULL;
- STAVMEM_InitParams.BlockMoveDmaBaseAddr_p = (void *)BM_BASE_ADDRESS;
- STAVMEM_InitParams.VideoBaseAddr_p = (void *)VIDEO_BASE_ADDRESS;
- STAVMEM_InitParams.CacheBaseAddr_p = (void *)CACHE_BASE_ADDRESS;
- STAVMEM_InitParams.NumberOfDCachedRanges = (sizeof( g_KBBOOTDCacheMap ) / sizeof(STBOOT_DCache_Area_t)) - 1;
- STAVMEM_InitParams.DCachedRanges_p = (STAVMEM_MemoryRange_t *)(g_KBBOOTDCacheMap);
- STAVMEM_InitParams.SDRAMBaseAddr_p = (void *)AVMEM_BASE_ADDRESS;
- STAVMEM_InitParams.SDRAMSize = AVMEM_SIZE;
- memset(STAVMEM_InitParams.GpdmaName, 0, sizeof(STAVMEM_InitParams.GpdmaName));
- STTBX_Print(("%s)=", AVMEM_DeviceName ));
- ST_ErrorCode = STAVMEM_Init(AVMEM_DeviceName, &STAVMEM_InitParams);
- if (ST_ErrorCode != ST_NO_ERROR)
- {
- STTBX_Print(("%sn", KB_ErrorGetText(ST_ErrorCode) ));
- return( ST_ErrorCode );
- }
- STTBX_Print(("%sn", STAVMEM_GetRevision() ));
- for (instance=0; (instance < KB_AVMEM_MAX_PARTITIONS); instance++)
- {
- STAVMEM_CreatePartitionParams.NumberOfPartitionRanges=(sizeof(PartitionMapTable[instance])/sizeof(STAVMEM_MemoryRange_t));
- STAVMEM_CreatePartitionParams.PartitionRanges_p = &PartitionMapTable[instance];
- ST_ErrorCode = STAVMEM_CreatePartition(AVMEM_DeviceName, &STAVMEM_CreatePartitionParams, &g_KBAvmemPartitionHandle[instance]);
- STTBX_Print(("AVMEM_CreatePartition() #%d %sn", instance, KB_ErrorGetText(ST_ErrorCode)));
- }
- return( ST_ErrorCode );
- }
- /* EOF --------------------------------------------------------------------- */