www.pudn.com > rtu.rar > PSD913F2.H


/* psd913f2.h - Register and bit definitons for the PSD913F2 device 
 
-1/6/00, msr 
  >> New release.   
 
*/ 
 
#include   // include the definition of your system memory map 
 
// Select which functions within psd913f2.c that you would like to include into your 
// compile session by defining the associated compiler directive. defined = include,  
// not defined = do not include 
 
// Module: flash_write_with_poll 
// Programs a single byte, checks status using polling method. 
//#define _F_W_W_P 
 
// Module: flash_write_with_toggle 
// Programs a single byte, checks status using toggle method. 
//#define _F_W_W_T 
 
// Module: flash_erase_bulk 
// Erases the entire Flash memory (all sectors). 
//#define _F_E_B 
 
// Module: flash_reset 
// Resets the main Flash memory to Read Array mode. 
//#define _F_R 
 
// Module: flash_read_id 
// Reads the Flash Identifier byte from main Flash memory.  
//#define _F_R_I 
 
// Module: flash_read_sector_protect 
// Reads individual Flash sector protection status. 
//#define _F_R_S_P 
 
// Module: flash_boot_write_with_poll 
// Programs a single byte, checks status using polling method. 
//#define _F_B_W_W_P 
 
// Module: flash_boot_write_with_toggle 
// Programs a single byte, checks status using toggle method. 
//#define _F_B_W_W_T 
 
// Module: flash_boot_erase_bulk 
// Erases the Flash boot memory (all sectors). 
//#define _F_B_E_B 
 
// Module: flash_boot_reset 
// Resets the Flash boot memory to Read Array mode. 
//#define _F_B_R 
 
// Module: flash_boot_read_id 
// Reads the Flash Identifier byte from boot Flash memory.  
//#define _F_B_R_I 
 
// Module: flash_boot_read_sector_protect 
// Reads Flash boot sector protection status and PSD security bit. 
//#define _F_B_R_S_P 
 
 
typedef struct	// general structure of 8 bit register allowing bit access  
	{ 
	unsigned char bit0 : 1; 
	unsigned char bit1 : 1; 
	unsigned char bit2 : 1; 
	unsigned char bit3 : 1; 
	unsigned char bit4 : 1; 
 	unsigned char bit5 : 1; 
	unsigned char bit6 : 1; 
	unsigned char bit7 : 1; 
	} Register;     
 
typedef union	// allow bit or byte access to registers  
	{ 
	char byte; 
	Register bits; 
	} Mix_Reg; 
 
 
 
//*******************  PSD9XXFX register addresses  ************************ 
 
#define DATAIN_A (*(volatile Mix_Reg*)(PSD_REG_BASE+0x00)) 
#define DATAIN_B (*(volatile Mix_Reg*)(PSD_REG_BASE+0x01)) 
#define DATAIN_C (*(volatile Mix_Reg*)(PSD_REG_BASE+0x10)) 
#define DATAIN_D (*(volatile Mix_Reg*)(PSD_REG_BASE+0x11)) 
#define DATAOUT_A (*(volatile Mix_Reg*)(PSD_REG_BASE+0x04)) 
#define DATAOUT_B (*(volatile Mix_Reg*)(PSD_REG_BASE+0x05)) 
#define DATAOUT_C (*(volatile Mix_Reg*)(PSD_REG_BASE+0x12)) 
#define DATAOUT_D (*(volatile Mix_Reg*)(PSD_REG_BASE+0x13)) 
#define DIRECTION_A (*(volatile Mix_Reg*)(PSD_REG_BASE+0x06)) 
#define DIRECTION_B (*(volatile Mix_Reg*)(PSD_REG_BASE+0x07)) 
#define DIRECTION_C (*(volatile Mix_Reg*)(PSD_REG_BASE+0x14)) 
#define DIRECTION_D (*(volatile Mix_Reg*)(PSD_REG_BASE+0x15)) 
#define DRIVE_A (*(volatile Mix_Reg*)(PSD_REG_BASE+0x08)) 
#define DRIVE_B (*(volatile Mix_Reg*)(PSD_REG_BASE+0x09)) 
#define DRIVE_C (*(volatile Mix_Reg*)(PSD_REG_BASE+0x16)) 
#define DRIVE_D (*(volatile Mix_Reg*)(PSD_REG_BASE+0x17)) 
#define OUTENABLE_A (*(volatile Mix_Reg*)(PSD_REG_BASE+0x0C)) 
#define OUTENABLE_B (*(volatile Mix_Reg*)(PSD_REG_BASE+0x0D)) 
#define OUTENABLE_C (*(volatile Mix_Reg*)(PSD_REG_BASE+0x1A)) 
#define OUTENABLE_D (*(volatile Mix_Reg*)(PSD_REG_BASE+0x1B)) 
#define CONTROL_A (*(volatile Mix_Reg*)(PSD_REG_BASE+0x02)) 
#define CONTROL_B (*(volatile Mix_Reg*)(PSD_REG_BASE+0x03)) 
#define IMC_A (*(volatile Mix_Reg*)(PSD_REG_BASE+0x0A)) 
#define IMC_B (*(volatile Mix_Reg*)(PSD_REG_BASE+0x0B)) 
#define IMC_C (*(volatile Mix_Reg*)(PSD_REG_BASE+0x18)) 
#define OMC_AB (*(volatile Mix_Reg*)(PSD_REG_BASE+0x20)) 
#define OMC_BC (*(volatile Mix_Reg*)(PSD_REG_BASE+0x21)) 
#define OMCMASK_AB (*(Mix_Reg*)(PSD_REG_BASE+0x22)) 
#define OMCMASK_BC (*(Mix_Reg*)(PSD_REG_BASE+0x23)) 
#define MAINPROTECT (*(Mix_Reg*)(PSD_REG_BASE+0xC0)) 
#define ALTPROTECT (*(Mix_Reg*)(PSD_REG_BASE+0xC2)) 
#define JTAG (*(volatile Mix_Reg*)(PSD_REG_BASE+0xC7)) 
#define PMMR0 (*(volatile Mix_Reg*)(PSD_REG_BASE+0xB0)) 
#define PMMR2 (*(volatile Mix_Reg*)(PSD_REG_BASE+0xB4)) 
#define PAGE (*(volatile Mix_Reg*)(PSD_REG_BASE+0xE0)) 
#define VM (*(Mix_Reg*)(PSD_REG_BASE+0xE2)) 
 
 
 
//****************** PSD9XXFX control register bit definitions ********* 
 
//PSD PORTA 
#define PA0		bit0 
#define PA1		bit1	 
#define PA2		bit2	 
#define PA3		bit3	 
#define PA4		bit4	 
#define PA5		bit5	 
#define PA6		bit6	 
#define PA7		bit7	 
 
//PSD PORTB 
#define PB0		bit0 
#define PB1		bit1	 
#define PB2		bit2	 
#define PB3		bit3	 
#define PB4		bit4	 
#define PB5		bit5	 
#define PB6		bit6	 
#define PB7		bit7	 
 
//PSD PORTC 
#define PC0		bit0 
#define PC1		bit1	 
#define PC2		bit2	 
#define PC3		bit3	 
#define PC4		bit4	 
#define PC5		bit5	 
#define PC6		bit6	 
#define PC7		bit7	 
 
//PSD PORTD 
#define PD0		bit0 
#define PD1		bit1	 
#define PD2		bit2	 
 
//PSD JTAG 
#define JEN		bit0   // JTAG enable 
 
//PSD PMMR0 
#define APD_ENABLE		bit1 
#define PLD_TURBO		bit3 
#define PLD_ARRAY_CLK	bit4 
#define PLD_MCELL_CLK	bit5 
 
//PSD PMMR2 
#define PLD_CNTL0	bit2 
#define PLD_CNTL1	bit3 
#define PLD_CNTL2	bit4 
#define PLD_ALE		bit5 
#define PLD_DBE		bit6 
 
//PSD VM 
#define SRAM_CODE	bit0 
#define EE_CODE		bit1 
#define FL_CODE		bit2 
#define EE_DATA		bit3 
#define FL_DATA		bit4 
#define PIO_EN		bit7 
 
 
// Flash parameters 
 
#define NVM_DATA_POLL     0x80		// flash status "data poll" bit at DQ7    
#define NVM_DATA_TOGGLE   0x40		// flash status "toggle poll" bit at DQ6 
#define NVM_ERROR         0x20 		// flash status "error" bit at DQ5    
 
 
// Misc. 
#define TRUE          0x01 
#define FALSE         0x00