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

📄 fcu.h

📁 Zoran V966 DVD 解码 Soc芯片的源程序
💻 H
字号:
/**
%file Fcu.h
%desc
Header file for the FCU component.
%author Ofir Alon
*/

#ifndef __FCU_H
#define __FCU_H

#include "Config.h"		// Global Configuration - do not remove!
#ifdef INTERNAL_MEM_CARD_READER


#include <string.h>
#include <embedded.h>
#include "MediaCards\Include\Register.h"
#include "MediaCards\Fcu\_I86_FCU_LL_\Program.h"
#include "CPU\v186t\v186t.h"

// Media drivers.
#include "Playcore\FileSys\FileX\fx_api.h"
#include "MediaCards\Fcu\Cf_\Fcu_cf.h"
#include "MediaCards\Fcu\Sd_\Fcu_sd.h"
#include "MediaCards\Fcu\Ms_\Fcu_ms.h"
#include "MediaCards\Fcu\Ssfdc_\Fcu_ssfdc.h"
#include "MediaCards\Fcu\Nand_\Fcu_nand.h"
#include "MediaCards\Fcu\MsPro_\Fcu_mspro.h"

#include "MediaCards\Include\Fs.h"

////////////////////////////////////////////////////////////////////////////////
// General information.
////////////////////////////////////////////////////////////////////////////////

#define FCU_BYTES_PER_SECTOR         512
#define FCU_BYTES_PER_SECTOR_BITS    9
#define FCU_MAX_SECTORS_IN_BURST     256


////////////////////////////////////////////////////////////////////////////////
// Media IDs. The high byte states if the media is external (1) or resident (0)
// while the low byte gives a numbered id.
////////////////////////////////////////////////////////////////////////////////

#define FCU_NOR                         0x0000
#define FCU_NAND                        0x0001
#define FCU_NOR_WITH_BUSY               0x0002
#define FCU_CF_MEM                      0x0100
#define FCU_CF_IDE                      0x0101
#define FCU_SSFDC                       0x0102
#define FCU_SD_4BIT                     0x0103
#define FCU_SD_1BIT                     0x0104
#define FCU_MEMORY_STICK                0x0105
#define FCU_MSPRO                       0x0105


////////////////////////////////////////////////////////////////////////////////
// IDs of all possible operations that are allowed to be performed on media.
////////////////////////////////////////////////////////////////////////////////

#define FCU_OP_INIT                     0   // Used to initialize media
#define FCU_OP_INIT_ALTERNATIVE         1   // Used only if FCU_OP_INIT failed
#define FCU_OP_READ_ID                  2   // Used to read the ID of media
#define FCU_OP_READ_CIS                 3   // Used to read the CIS from media
#define FCU_OP_READ                     4   // Used to read data from media
#define FCU_OP_WRITE                    5   // Used to write data to media
#define FCU_OP_READ_EXTRA               6   // Used to read extra info from media
#define FCU_OP_WRITE_EXTRA              7   // Used to rwrite extra info to media
#define FCU_OP_ERASE                    8   // Used to erase regions in media
#define FCU_OP_ERASE_ALL                9   // Used to erase the whole media
#define FCU_OP_CHECK_ERASED             10  // Used to check if region is erased
#define FCU_OP_RESET                    11  // Used to reset the current operation
#define FCU_OP_NO_DATA                  12  // A special operation
#define FCU_OP_READ_REG                 13  // Used to read registers
#define FCU_OP_OPEN_BURST               14  // Used to start an on-going burst.
#define FCU_OP_WRITE_BURST              15  // Used to write into a on-going burst.
#define FCU_OP_CLOSE_BURST              16  // Used to close an on-going burst.
#define FCU_OP_GO_IDLE                  17  // Used to send card to idle mode
#define FCU_OP_CHECK_WP_STATUS          18  // Used to check the WP status of media.

#ifdef CHECK_XD_ID
#define FCU_OP_READ_XD_ID					 19
#endif

////////////////////////////////////////////////////////////////////////////////
// Return values.
////////////////////////////////////////////////////////////////////////////////

#define FCU_SUCCESS                     0
#define FCU_ERROR                       1
#define FCU_NOT_ERASED                  2
#define FCU_TIME_OUT                    3
#define FCU_READ_ONLY                   5
#define FCU_TRANSFER_SIZE_ERROR         6
#define FCU_DEVICE_REMOVED              7

////////////////////////////////////////////////////////////////////////////////
// Error codes.
////////////////////////////////////////////////////////////////////////////////

#define FCU_ERROR_UC_RAM_EXCEEDED       1
#define FCU_ERROR_ERROR_INT_FROM_FCU    2  
#define FCU_ERROR_CD_INT_FROM_FCU       3
#define FCU_ERROR_TIMED_OUT             4  
#define FCU_ERROR_MALLOC                5
#define FCU_COMPARE_DRAM_ERROR          6 
#define FCU_COMPARE_REDUNDANT_ERROR     7
#define FCU_ILLEGAL_OPERATION           8

///////////////////////////////////////////////////////////////////////////////
// Fcu Events
///////////////////////////////////////////////////////////////////////////////

#define FCU_EVENT_END                   0x00000001
#define FCU_EVENT_ERR                   0x00000002
#define FCU_EVENT_TO                    0x00000004
#define MMU_EVENT_FCU_END               0x00000008 //(FCU bug)
#define USB_EVENT_ATTACH               	0x00000010

////////////////////////////////////////////////////////////////////////////////
// Operation types - These help to determine the control path used in orde
// to execute the FCU operation.
////////////////////////////////////////////////////////////////////////////////

#define FCU_STD_FLASH_WRITE             0
#define FCU_STD_FLASH_READ              1
#define FCU_STD_NO_DATA                 2
#define FCU_WRITE_BURST_OPEN            3
#define FCU_WRITE_BURST_WRITE           4
#define FCU_WRITE_BURST_CLOSE           5

////////////////////////////////////////////////////////////////////////////////
// Transfer direction. Must be according to the MMU spec.
////////////////////////////////////////////////////////////////////////////////

#define FCU_DRAM_TO_FCU                 0
#define FCU_FCU_TO_DRAM                 1

////////////////////////////////////////////////////////////////////////////////
// Common command definitions.
////////////////////////////////////////////////////////////////////////////////

#define FCU_COMMAND_LENGTH              16

#define FCU_STATUS_READY                0x00

// Media locations.
#define FCU_RESIDENT                    0x00
#define FCU_EXTERNAL                    0x01

////////////////////////////////////////////////////////////////////////////////
// Thresholds for decision-making in the issue of keeping cached buffers
// that are accessed by the FCU, coherent with the data cache. The thresholds
// indicate when it is better to flush the whole cache before the FCU operation
// or to access only parts of the cache that are relevant to the buffer.
// The thresholds are in bytes.
////////////////////////////////////////////////////////////////////////////////

#define FCU_DRAM_WRITE_DCACHE_THRESHOLD 4096
#define FCU_DRAM_READ_DCACHE_THRESHOLD  4096

////////////////////////////////////////////////////////////////////////////////
// Length of the extra buffer that can be written to or read from FCU registers.
////////////////////////////////////////////////////////////////////////////////
#define FCU_LAST16_EXTRA_LENGTH         16

////////////////////////////////////////////////////////////////////////////////
// Special byChannel values.
////////////////////////////////////////////////////////////////////////////////
#define FCU_CHANNEL_DRAM                0x01
#define FCU_CHANNEL_CPU                 0x00


#define TimerDeactivate( timerId )  			timer_service_disable(timerId);
#define TimerChange( timerId , timeCnt , 0 )	timer_service_set_freq( timerId, timeCnt ) 
#define TimerActivate( timerId )			   	timer_service_enable(timerId, TRUE)

#ifdef VERILOG_DRIVER
// FCU event group
//STATIC TX_EVENT_FLAGS_GROUP txFcuEvent;
#define EVENTFLAG_FCU_ID		1	//move dto sysdef.h  The statically-allocated event-flag


// This semaphore prevents two threads from trying to access the FCU
// simulanously.
//STATIC TX_SEMAPHORE txFcuProtect;
#define	SEM_FCU_PROTECT_ID		1 //- moved to sysdefs.h 

#endif // VERILOG_DRIVER
////////////////////////////////////////////////////////////////////////////////
// Function declarations.
////////////////////////////////////////////////////////////////////////////////

VOID 
FcuInit(void);

UINT 
FcuOperation(UINT   uiMediaId,
             USHORT uwCodeId,
             BYTE*  pbyCommand,
             //UINT   uiBytes,
			 ULONG 	uiBytes,
             UINT   uiOpType,
             BYTE*  pbyBuffer);

VOID
FcuLock(void);

VOID
FcuUnlock(void);


void 
FcuSetMediaReadLED( BOOL bLedOn );

VOID 
FcuTerminate(void);

#endif // INTERNAL_MEM_CARD_READER
#endif

⌨️ 快捷键说明

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