📄 amtxhal.h
字号:
/*++
----------------------------------------------------------------------------------------------------
Copyright (c) 2003-2007 Amontec http://www.amontec.com ALL RIGHTS RESERVED
----------------------------------------------------------------------------------------------------
Module Name:
amtxhal.h
Abstract:
AmtXHAL API (Amontec X Hardware Abstraction Layer).
Amontec JTAG HAL : ready
Amontec SPI HAL : in test process
Amontec I2C HAL : TBD (To Be Defined)
Easy controls of the popular ICE called Amontec JTAGkey Series.
Never USB JTAG was so customizable... The true Parallel Port Wiggler replacement !
See http://www.amontec.com for documentation.
Environment:
kernel & user mode (WINDOWS + LINUX + CYGWIN WIN32)
Revision History:
20061117 Amontec, Gauch Laurent
Created. First build.
20070214 Amontec, Gauch Laurent
Remove all the complex structures and pointers for helping wrappers.
20070405 Amontec, Gauch Laurent
Add Definitions in the amtxhal.h
20070406 Amontec, Gauch Laurent
New Implementation for AMTXHAL_GetVersion
20070426 Amontec, Gauch Laurent
Add SVF support (Execute SVF File or SVF Line)
20070427 Amontec, Gauch Laurent
Add l_endState parameter in the AMTXHAL_CMDQ_Add_jtag_runtck function
20070507 Amontec, Gauch Laurent
Add Frequency/Runtest factors for SVF support.
20070612 Amontec, Gauch Laurent
Correct typo bug in the Execute Command functions
20070618 Amontec, Gauch Laurent
Add some defines as #define AMTXHAL_SCAN_IN_ENABLE_TRUE
20070620 Amontec, Gauch Laurent
Correct some typo !
20070712 Amontec, Gauch Laurent
Add AMTXHAL_JTAGXPLORE_ functions
Allowing to detect the maximum JTAG Frequency (check JTAG chain stability)
Allowing auto-detection of TAP number and Tap IDCODE
20070713 Amontec, Gauch Laurent
Resolve issue when AutoExe and small JTAG scans
20070716 Amontec, Laurent Gauch
Add TRST checks in the AMTXHAL_JTAGXPLORE_GetSafeChainInfo functions !
Never JTAG auto-detection was so fun.
(We lost hours for helping our customers to safe minutes in the first uses of JTAGkey)
20070809 Amontec, Laurent Gauch
Add AMTXHAL_ICE_GetDescription
20070815 Amontec, Laurent Gauch
HOT HOT HOT ! Now AmtXHAL allows true JTAG Stream !
Add AMTXHAL_SCOB_Initialize function
Add AMTXHAL_SCOB_Finalize function
20070828 Amontec, Laurent Gauch
Correct TDI error (last scan bit when 8 bit modulo scans) and when l_scanOutEn = 1
----------------------------------------------------------------------------------------------------
--*/
#ifndef AMTXHAL_H
#define AMTXHAL_H
#if defined(_WIN32)||defined(WIN32)||defined(__MC68K__)||defined(_WIN32_WCE)||defined(_DOS)||defined(_WINDOWS)
#include <windows.h>
#elif defined(linux) || defined(__CYGWIN__)
// Linux only, or Linux on Windows with CygWin
// Windows types
#include <pthread.h>
#endif
//----------------------------------------------------------------------------------------------------
// DLL EXPORTER
//----------------------------------------------------------------------------------------------------
// The following ifdef block is the standard way of creating macros
// which make exporting from a DLL simpler. All files within this DLL
// are compiled with the AMTXHAL_EXPORTS symbol defined on the command line.
// This symbol should not be defined on any project that uses this DLL.
// This way any other project whose source files include this file see
// AMTXHAL_API functions as being imported from a DLL, whereas this DLL
// sees symbols defined with this macro as being exported.
#if defined(_WIN32)||defined(WIN32)||defined(__MC68K__)||defined(_WIN32_WCE)||defined(_DOS)||defined(_WINDOWS)
#ifdef AMTXHAL_EXPORTS
#define AMTXHAL_API __declspec(dllexport)
#else
#define AMTXHAL_API __declspec(dllimport)
#endif
#elif defined(linux) || defined(__CYGWIN__)
// Linux only, or Linux on Windows with CygWin
#include "wintypes_linux.h"
#ifdef AMTXHAL_API
#undef AMTXHAL_API
#define AMTXHAL_API
#else
#define AMTXHAL_API
#endif
#define WINAPI
#define APIENTRY __stdcall
#endif
#ifdef __cplusplus
extern "C" {
#endif
//####################################################################################################
// DEFINITIONS
//####################################################################################################
#define AMTXHAL_BOOLEAN_FALSE 0
#define AMTXHAL_BOOLEAN_TRUE 1
#define AMTXHAL_STATUS_SUCCESS 0 // function successfully executed
#define AMTXHAL_STATUS_MESSAGE_BUFFER_SIZE 100
#define AMTXHAL_ICE_DESCRIPTION_BUFFER_SIZE 32
#define AMTXHAL_ICE_SERIAL_NUMBER_BUFFER_SIZE 16
#define AMTXHAL_ICE_CONFIG_ID_DEFAULT 0 // used by AMTXHAL_ICE_Init function
#define AMTXHAL_PORT_ID_DEFAULT 0
#define AMTXHAL_PORT_IO_LEVEL_0 0 // -- logical level 0
#define AMTXHAL_PORT_IO_LEVEL_1 1 // -- logical level 1
#define AMTXHAL_PORT_IO_LEVEL_Z 2 // -- High Impedance
#define AMTXHAL_PORT_IO_LEVEL_L 3 // -- Low Weak 0
#define AMTXHAL_PORT_IO_LEVEL_H 4 // -- High Weak 1
#define AMTXHAL_PORT_IO_LEVEL_A 5 // -- Absent
#define AMTXHAL_CMDQ_STATUS_READY 0 // Queue is ready, command can be added in the Command Queue
#define AMTXHAL_CMDQ_STATUS_FULL 1 // Queue is full, execute and/or clear then Command Queue
#define AMTXHAL_CMDQ_AUTOEXEWHENFULL_TRUE AMTXHAL_BOOLEAN_TRUE // for enabling (JTAG) Scan Stream
#define AMTXHAL_CMDQ_AUTOEXEWHENFULL_FALSE AMTXHAL_BOOLEAN_FALSE // by default
#define AMTXHAL_CMDQ_MAX_INPUT_BYTE_BUFFER_SIZE 65536 // 64K bytes
#define AMTXHAL_CMDQ_MAX_OUTPUT_BYTE_BUFFER_SIZE 131072 // 128K bytes
#define AMTXHAL_TARGET_ID_DEFAULT 0
#define AMTXHAL_SCAN_ID_DEFAULT 0
#define AMTXHAL_SCAN_IN_ENABLE_TRUE AMTXHAL_BOOLEAN_TRUE
#define AMTXHAL_SCAN_IN_ENABLE_FALSE AMTXHAL_BOOLEAN_FALSE
#define AMTXHAL_SCAN_OUT_ENABLE_TRUE AMTXHAL_BOOLEAN_TRUE
#define AMTXHAL_SCAN_OUT_ENABLE_FALSE AMTXHAL_BOOLEAN_FALSE
#define AMTXHAL_SCAN_CHECK_ENABLE_TRUE AMTXHAL_BOOLEAN_TRUE
#define AMTXHAL_SCAN_CHECK_ENABLE_FALSE AMTXHAL_BOOLEAN_FALSE
#define AMTXHAL_JTAG_STATE_RESET 1
#define AMTXHAL_JTAG_STATE_IDLE 2
#define AMTXHAL_JTAG_STATE_DRPAUSE 3
#define AMTXHAL_JTAG_STATE_IRPAUSE 4
#define AMTXHAL_JTAG_STATE_DRSHIFT 5
#define AMTXHAL_JTAG_STATE_IRSHIFT 6
#define AMTXHAL_JTAG_FREQUENCY_IS_IN_QUEUE_TRUE AMTXHAL_BOOLEAN_TRUE
#define AMTXHAL_JTAG_FREQUENCY_IS_IN_QUEUE_FALSE AMTXHAL_BOOLEAN_FALSE
#define AMTXHAL_JTAGXPLORE_CHAIN_STATUS_SUCCESS 0 // JTAG chain is detected, valid and stable.
#define AMTXHAL_JTAGXPLORE_CHAIN_STATUS_ERROR 1 // JTAG chain is corrupted, broken or not stable !
#define AMTXHAL_JTAGXPLORE_TAP_STATUS_SUCCESS 0
#define AMTXHAL_JTAGXPLORE_TAP_STATUS_ERROR 1
#define AMTXHAL_SVF_FREQUENCY_FACTOR_DEFAULT 100
#define AMTXHAL_SVF_RUNTEST_FACTOR_DEFAULT 100
#define AMTXHAL_SVF_OPTIMIZER_ENABLE_TRUE AMTXHAL_BOOLEAN_TRUE
#define AMTXHAL_SVF_OPTIMIZER_ENABLE_FALSE AMTXHAL_BOOLEAN_FALSE
//////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////
// LOW ABSTRACTION LAYER LEVEL //
/////////////////////////////////
//####################################################################################################
// ERRORS / STATUS SUPPORT
//####################################################################################################
AMTXHAL_API
long // O - exit status
WINAPI AMTXHAL_GetVersion(
long *pl_major, // O - major version
long *pl_minor, // O - minor version
long *pl_build); // O - build version
AMTXHAL_API
long // O - exit status
WINAPI AMTXHAL_GetStatusCodeMessage(
long l_statusCode, // I - Status code
char *pc_statusMessageBuffer, // O - message string
long l_bufferSize); // I - buffer size of the message
//####################################################################################################
// IN-CIRCUIT EMULATOR (ICE) OPEN / CLOSE
//####################################################################################################
// These functions are used to Open or to Close a specific ICE (JTAGkey, ...).
AMTXHAL_API
long // O - exit status
WINAPI AMTXHAL_ICE_Open(
long *pl_iceHandle); // O - will return the handle of the ice
AMTXHAL_API
long // O - exit status
WINAPI AMTXHAL_ICE_Close(
long l_iceHandle); // I - handle returned by AMTXHAL_ICE_Open function
AMTXHAL_API
long // O - exit status
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -