📄 pscdrv.h
字号:
/******************************************************************************
*******************************************************************************
Copyright 1996 National Semiconductor Corporation
No warranties expressed or implied.
Note: National Semiconductor reserves the right to modify this file without notice.
For the latest revision, contact the Scan Applications technical support line
at (800) 341-0392 (ext 4500), Monday - Friday from 9am to 5pm EST.
Filename: pscdrv.h
Description: Header file for pscdrv.c (the National SCANPSC110 Embedded
Boundary Scan Controller device driver). Contains prototypes
and compiler constants and macros.
WRITE_PSC, and READ_PSC are macros that are conditionally
compiled depending on the I/O type of the target processor
(memory-mapped, I/O port, or Corelis Board (used for emulation)).
Revision History:
Revision Date Comments
-----------------------------------------------------------------------
1.00 01May95 Initial Revision
1.01 Sep95 Changed names of BSM_TYPE (now BSC_TYPE) compiler
constants to make more generic.
1.02 Oct95 QA/Clean-up.
SS $Revision: 1.1 $
*******************************************************************************
******************************************************************************/
#ifndef _PSCDRV_H
#define _PSCDRV_H /* Psc_base will be declared (not external) in pscdrv.h */
#include "scan_all.h" /* BSC_TYPE is optionally defined in all.h */
#include "pscreg.h" /* SCANPSC100 register defines */
#include "..\include\all.h"
/* If scan_all.h is not included, BSC_TYPE, data-types and BYTECOUNT are locally defined. */
#ifndef _SCAN_ALL_H
/* Symbols used for Conditional Compile *************************************/
#define PSC_MEM_MAPPED 1 /* Memory mapped I/O to PSC100 */
#define PSC_IO_MAPPED 2 /* I/O to PSC100 thru I/O port */
#define PC1149_1_100F 3 /* I/O to PSC100 via Corelis PC-1149.1/100F board */
#define BSC_TYPE PSC_MEM_MAPPED /* Currently selected I/O type */
/* Data-type definitions *****************************************************/
typedef unsigned char BYTE; /* BYTE is used by EVF, and I/O operations */
typedef unsigned int WORD; /* WORD is used for 2 byte unsigned values */
typedef unsigned long DWORD; /* DWORD is used for 4 byte unsigned values */
#define BYTECOUNT(x) x%8 ? x/8 + 1 : x/8
#endif
/* Function Return Codes *****************************************************/
#ifndef PASS
#define PASS 0
#endif
#ifndef FAIL
#define FAIL 1
#endif
#ifndef BAD_PTR
#define BAD_PTR 3
#endif
#ifndef PSC_NOT_RESPONDING
#define PSC_NOT_RESPONDING 4
#endif
#ifndef SHIFT_FAIL
#define SHIFT_FAIL 5
#endif
/* Prototypes for pscdrv.c ***************************************************/
void WriteTckCounter(unsigned long);
unsigned long ReadTckCounter(void);
int WaitForPsc(unsigned char);
int SequenceTms(WORD, unsigned int);
int SelectTms(unsigned int);
int Shift(BYTE *, unsigned long, BYTE *);
int PulseTck(unsigned long);
int InitPsc(void);
/******************************************************************************
WRITE_PSC and READ_PSC are defined as macro's for efficiency purposes. The
SCANPSC100 can be I/O or Memory-Mapped, therefor these macro's are
conditionally compiled depending on the target Boundary-Scan Master that the
code is being compiled for. BSC_TYPE (defined in scan_all.h) is used to
determine how to define the macro's WRITE_PSC and READ_PSC.
******************************************************************************/
/* Macro's for Memory Mapped I/O */
#define WRITE_PSC(PSC_REG_OFFSET, DATA) *(volatile unsigned char *)(PSC_BASE + PSC_REG_OFFSET) = DATA
#define READ_PSC(PSC_REG_OFFSET) *(volatile unsigned char *)(PSC_BASE + PSC_REG_OFFSET)
/* Because all writes are not bigger than 128
this replaces the function WriteTckCouter() */
#define WRITE_BYTE_TCK(X) \
WRITE_PSC(PSC_WRITE_CNT, X); \
WRITE_PSC(PSC_WRITE_CNT, 0); \
WRITE_PSC(PSC_WRITE_CNT, 0); \
WRITE_PSC(PSC_WRITE_CNT, 0)
/* This is a dangerous waitforpsc() because it has no timeout
but works much faster than the initial function */
#define WAIT_FOR_PSC(X) while((READ_PSC(PSC_MODE2) & X) == 0)
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -