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

📄 psoc.h

📁 psoc_usb的代码,用来小卡测试的.没事下下来
💻 H
字号:
/*
 * INVENTEC corporation (c)2007 all rights reserved. 
 * Description: PSoC driver for gladius
 *              
 * Update: 
 * Revision		Date       Author              Reason 	
 * ========		========== =================== ==================
 * 1.0.0		2007-11-22  Liu.Fang-dong(ED)  Create
 *
 * Known issues:None
 *
 * Support Chip:
 * CY8C27143		CY8C27243	CY8C27443	CY8C27543	CY8C27643
 * CY8C24123		CY8C24223	CY8C24423
 * CY8C22113		CY8C22213
 * CY8C21123		CY8C21223	CY8C21323
 * CY8C21234		CY8C21334	CY8C21434	CY8C21534	CY8C21634
 */
 
//define the PSoC CY8C27xxx ID
#define PSoC_CY8C27143_ID	0x09
#define PSoC_CY8C27243_ID	0x0A
#define PSoC_CY8C27443_ID	0x0B
#define PSoC_CY8C27543_ID	0x0C
#define PSoC_CY8C27643_ID	0x0D
//define the PSoC CY8C24xxx ID
#define PSoC_CY8C24123_ID	0x12
#define PSoC_CY8C24223_ID	0x13
#define PSoC_CY8C24423_ID	0x14
//define the PSoC CY8C22xxx ID
#define PSoC_CY8C22113_ID	0x0F
#define PSoC_CY8C22213_ID	0x10
//define the PSoC CY8C21xxx ID
#define PSoC_CY8C21123_ID	0x17
#define PSoC_CY8C21223_ID	0x18
#define PSoC_CY8C21323_ID	0x19
#define PSoC_CY8C21234_ID	0x36

#define PSoC_CY8C21334_ID	0x37
#define PSoC_CY8C21434_ID	0x38
#define PSoC_CY8C21534_ID	0x40
#define PSoC_CY8C21634_ID	0x49

#ifndef __PSOC_H__
#define __PSOC_H__

#define LOW		0
#define HIGH	1

//#define SETIN_PA(n)		OEA &= (~(1 << n))
//#define SETOUT_PA(n)	OEA |= (1 << n)
//#define SETIN_PB(n)		OEB &= (~(1 << n))
//#define SETOUT_PB(n)	OEB |= (1 << n)
//#define SETIN_PC(n)		OEC &= (~(1 << n))
//#define SETOUT_PC(n)	OEC |= (1 << n)
#define SETIN_PD(n)		OED &= (~(1 << n))
#define SETOUT_PD(n)	OED |= (1 << n)

//define for psoc test
#define SET_DOUT	SETOUT_PD(2)
#define SET_DIN		SETIN_PD(2)

#define	PSOC_RESET(x)	(HIGH == x)?(PD0 = HIGH):(PD0 = LOW)
#define	PSOC_CLK(x)		(HIGH == x)?(PD1 = HIGH):(PD1 = LOW)
#define PSOC_DOUT(x)	(HIGH == x)?(PD2 = HIGH):(PD2 = LOW)
#define	PSOC_DIN			PD2

//define for sgpio test
#define	SGPIO_START(x)	(HIGH == x)?(PD2 = HIGH):(PD2 = LOW)
#define	SGPIO_CLK(x)		(HIGH == x)?(PD3 = HIGH):(PD3 = LOW)
#define SGPIO_DIN(x)		(HIGH == x)?(PD4 = HIGH):(PD4 = LOW)
#define	SGPIO_DOUT			PD1

#define _3V_PULL_DOWN_	SETOUT_PD(5);PD5 = LOW
#define _3V_PULL_UP_		SETOUT_PD(5);PD5 = HIGH

int do_psoc_init(void);
int GetCheckSum(void);
int SgpioTest(void);
int PsocReset(void);

#endif

⌨️ 快捷键说明

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