1
0
mirror of https://github.com/preble/libpinproc synced 2026-02-24 18:25:23 +01:00

Merge branch 'dev' of github.com:preble/libpinproc into dev

Conflicts:
	utils/pinprocfw/pinprocfw.cpp
This commit is contained in:
preble
2011-02-02 21:56:42 -05:00
11 changed files with 402 additions and 251 deletions

View File

@@ -1,11 +1,16 @@
### ###
### CMake policy settings ### CMake settings
### ###
## Due to Mac OSX we need to keep compatibility with CMake 2.6
# see http://www.cmake.org/Wiki/CMake_Policies # see http://www.cmake.org/Wiki/CMake_Policies
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
# see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0012
if(POLICY CMP0012)
cmake_policy(SET CMP0012 OLD)
endif()
# see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0015 # see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0015
if(POLICY CMP0015) if(POLICY CMP0015)
cmake_policy(SET CMP0015 NEW) cmake_policy(SET CMP0015 OLD)
endif() endif()
@@ -22,55 +27,141 @@ set(PINPROC_VERSION "${PINPROC_VERSION_MAJOR}.${PINPROC_VERSION_MINOR}")
### ###
### Project options ### Project options
### ###
# General stuff ## Project stuff
option(PINPROC_BUILD_TOOLS "Enable testing and firmware tools" ON) option(PINPROC_BUILD_TOOLS "Enable testing and firmware tools" ON)
# Compilation options ## Build options
# --> General
# see http://www.cmake.org/cmake/help/cmake2.6docs.html#variable:BUILD_SHARED_LIBS # see http://www.cmake.org/cmake/help/cmake2.6docs.html#variable:BUILD_SHARED_LIBS
# http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_library # http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_library
option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF) option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
# see http://msdn.microsoft.com/en-us/library/aa278396(v=vs.60).aspx
# http://msdn.microsoft.com/en-us/library/2kzt1wy3%28v=VS.71%29.aspx # --> Apple
option(APPLE_UNIVERSAL_BIN "Apple: Build universal binary" OFF)
# --> Microsoft Visual C++
# see http://msdn.microsoft.com/en-us/library/aa278396(v=VS.60).aspx
# http://msdn.microsoft.com/en-us/library/2kzt1wy3(v=VS.71).aspx
option(MSVC_SHARED_RT "MSVC: Build with shared runtime libs (/MD)" ON) option(MSVC_SHARED_RT "MSVC: Build with shared runtime libs (/MD)" ON)
option(MSVC_STHREADED_RT "MSVC: Build with single-threaded static runtime libs (/ML until VS .NET 2003)" OFF) option(MSVC_STHREADED_RT "MSVC: Build with single-threaded static runtime libs (/ML until VS .NET 2003)" OFF)
### ###
### Source ### Sources, headers, directories and libs
### ###
# !!! file(GLOB) didn't work on Ubuntu 10.04 with cmake 2.8 !!! file(GLOB sources "src/[a-zA-Z]*.cpp")
#file(GLOB sources src/[a-z]*.cpp) file(GLOB public_headers "include/[a-zA-Z]*.h")
#file(GLOB public_headers include/[a-z]*.h) file(GLOB private_headers "src/[a-zA-Z]*.h")
#file(GLOB private_headers src/[a-z]*.h)
set(sources "src/pinproc.cpp;src/PRDevice.cpp;src/PRHardware.cpp")
set(public_headers "include/pinproc.h")
set(private_headers "src/PRCommon.h;src/PRDevice.h;src/PRHardware.h")
message(STATUS "sources is ${sources}")
message(STATUS "public_headers is ${public_headers}")
message(STATUS "private_headers is ${private_headers}")
include_directories(${PINPROC_SOURCE_DIR}/include $ENV{EXTRA_INC} /usr/local/include) if(WIN32)
link_directories($ENV{EXTRA_LINK} /usr/local/lib) if(BUILD_SHARED_LIBS)
set(defs
src/pinproc.def
)
endif()
endif()
if(VERBOSE)
message(STATUS "sources: ${sources}")
message(STATUS "public_headers: ${public_headers}")
message(STATUS "private_headers: ${private_headers}")
message(STATUS "defs: ${defs}")
endif()
# use -DEXTRA_INC="<path>;<path>" and -DEXTRA_LINK="<path>;<path>"
include_directories(${PINPROC_SOURCE_DIR}/include ${EXTRA_INC} /usr/local/include)
link_directories(${EXTRA_LINK} /usr/local/lib)
set(YAML_CPP_LIB "yaml-cpp")
set(YAML_CPP_LIB_DBG "${YAML_CPP_LIB}")
### ###
### General compilation settings ### General compilation settings
### ###
if(BUILD_SHARED_LIBS)
set(LABEL_SUFFIX "shared")
else()
set(LABEL_SUFFIX "static")
endif()
if(APPLE) if(APPLE)
# set(CMAKE_OSX_ARCHITECTURES ppc;i386) # Uncomment for universal binary if(APPLE_UNIVERSAL_BIN)
set(CMAKE_OSX_ARCHITECTURES ppc;i386)
endif()
endif() endif()
if(WIN32) if(WIN32)
set(libraries ftd2xx) set(lib_ftdi_usb ftd2xx)
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
add_definitions(-DPINPROC_DLL) # use or build Windows DLL add_definitions(-D${PROJECT_NAME}_DLL) # use or build Windows DLL
endif()
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "C:/")
endif() endif()
else() else()
set(libraries usb ftdi) set(lib_ftdi_usb usb ftdi)
endif() endif()
set(YAML_CPP_LIB "yaml-cpp") # GCC specialities
set(YAML_CPP_LIB_DBG "${YAML_CPP_LIB}") if(CMAKE_COMPILER_IS_GNUCC)
if(WIN32)
set(CMAKE_SHARED_LIBRARY_PREFIX "") # DLLs do not have a "lib" prefix
set(CMAKE_IMPORT_LIBRARY_PREFIX "") # same for DLL import libs
set(CMAKE_LINK_DEF_FILE_FLAG "") # CMake workaround (2.8.3)
endif()
endif()
# Microsoft VisualC++ specialities
if(MSVC)
### General stuff
# a) Change MSVC runtime library settings (/MD[d], /MT[d], /ML[d] (single-threaded until VS 2003))
# plus set lib suffix for later use and project label accordingly
# see http://msdn.microsoft.com/en-us/library/aa278396(v=VS.60).aspx
# http://msdn.microsoft.com/en-us/library/2kzt1wy3(v=VS.71).aspx
set(LIB_RT_SUFFIX "md") # CMake defaults to /MD for MSVC
set(LIB_RT_OPTION "/MD")
#
if(NOT MSVC_SHARED_RT) # User wants to have static runtime libraries (/MT, /ML)
if(MSVC_STHREADED_RT) # User wants to have old single-threaded static runtime libraries
set(LIB_RT_SUFFIX "ml")
set(LIB_RT_OPTION "/ML")
if(NOT ${MSVC_VERSION} LESS 1400)
message(FATAL_ERROR "Single-threaded static runtime libraries (/ML) only available until VS .NET 2003 (7.1).")
endif()
else()
set(LIB_RT_SUFFIX "mt")
set(LIB_RT_OPTION "/MT")
endif()
# correct linker options
foreach(flag_var CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
foreach(config_name "" DEBUG RELEASE MINSIZEREL RELWITHDEBINFO)
set(var_name "${flag_var}")
if(NOT "${config_name}" STREQUAL "")
set(var_name "${var_name}_${config_name}")
endif()
string(REPLACE "/MD" "${LIB_RT_OPTION}" ${var_name} "${${var_name}}")
endforeach()
endforeach()
endif()
#
set(LABEL_SUFFIX "${LABEL_SUFFIX} ${LIB_RT_OPTION}")
# b) Change prefix for static libraries
set(CMAKE_STATIC_LIBRARY_PREFIX "lib") # to distinguish static libraries from DLL import libs
# c) Correct suffixes for static libraries
if(NOT BUILD_SHARED_LIBS)
### General stuff
set(LIB_TARGET_SUFFIX "${LIB_SUFFIX}${LIB_RT_SUFFIX}")
### Project stuff
# correct external library names
set(YAML_CPP_LIB "${CMAKE_STATIC_LIBRARY_PREFIX}${YAML_CPP_LIB}${LIB_RT_SUFFIX}")
set(YAML_CPP_LIB_DBG "${YAML_CPP_LIB}d")
endif()
endif()
### ###
@@ -83,12 +174,12 @@ else()
endif() endif()
set(INCLUDE_INSTALL_DIR include/p-roc) set(INCLUDE_INSTALL_DIR include/p-roc)
set(LIB_INSTALL_DIR ${_library_dir}${LIB_SUFFIX}) set(LIB_INSTALL_DIR "${_library_dir}${LIB_SUFFIX}")
set(_INSTALL_DESTINATIONS set(_INSTALL_DESTINATIONS
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
LIBRARY DESTINATION ${LIB_INSTALL_DIR} LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
) )
@@ -99,50 +190,29 @@ add_library(pinproc
${sources} ${sources}
${public_headers} ${public_headers}
${private_headers} ${private_headers}
${defs}
) )
set_target_properties(pinproc PROPERTIES set_target_properties(pinproc PROPERTIES
VERSION "${PINPROC_VERSION}" VERSION "${PINPROC_VERSION}"
SOVERSION "${PINPROC_VERSION_MAJOR}.${PINPROC_VERSION_MINOR}" SOVERSION "${PINPROC_VERSION_MAJOR}.${PINPROC_VERSION_MINOR}"
PROJECT_LABEL "pinproc ${LABEL_SUFFIX}"
) )
# Correct MSVC for static libraries (/MD[d], /MT[d], /ML[d] (single-threaded until VS 2003)) target_link_libraries(pinproc
# see http://msdn.microsoft.com/en-us/library/aa278396(v=vs.60).aspx ${lib_ftdi_usb}
# http://msdn.microsoft.com/en-us/library/2kzt1wy3%28v=VS.71%29.aspx )
if((MSVC) AND (NOT BUILD_SHARED_LIBS))
set(TMP_SUFFIX "md") # CMake defaults to /MD for MSVC
if (NOT MSVC_SHARED_RT) # User wants to have static runtime libraries (/MT, /ML) if(MSVC)
if (MSVC_STHREADED_RT) # User wants to have old single-threade runtime libraries if(NOT BUILD_SHARED_LIBS)
set(TMP_SUFFIX "ml") # correct library names
set(TMP_OPTION "/ML") set_target_properties(pinproc PROPERTIES
if(NOT MSVC_VERSION LESS 1400) DEBUG_POSTFIX "${LIB_TARGET_SUFFIX}d"
message(FATAL_ERROR "Single-threaded runtime libraries (/ML) only availbe until VS .NET 2003 (7.1).") RELEASE_POSTFIX "${LIB_TARGET_SUFFIX}"
endif() MINSIZEREL_POSTFIX "${LIB_TARGET_SUFFIX}"
else() RELWITHDEBINFO_POSTFIX "${LIB_TARGET_SUFFIX}"
set(TMP_SUFFIX "mt") )
set(TMP_OPTION "/MT")
endif()
# correct linker options
string(REPLACE "/MD" "${TMP_OPTION}" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
string(REPLACE "/MD" "${TMP_OPTION}" CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_CXX_FLAGS_MINSIZEREL})
string(REPLACE "/MD" "${TMP_OPTION}" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
string(REPLACE "/MD" "${TMP_OPTION}" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
string(REPLACE "/MD" "${TMP_OPTION}" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
string(REPLACE "/MD" "${TMP_OPTION}" CMAKE_C_FLAGS_MINSIZEREL ${CMAKE_C_FLAGS_MINSIZEREL})
string(REPLACE "/MD" "${TMP_OPTION}" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
string(REPLACE "/MD" "${TMP_OPTION}" CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO})
endif() endif()
# correct library names
set_target_properties(pinproc PROPERTIES PREFIX "lib")
set_target_properties(pinproc PROPERTIES DEBUG_POSTFIX "${TMP_SUFFIX}d")
set_target_properties(pinproc PROPERTIES RELEASE_POSTFIX "${TMP_SUFFIX}")
set_target_properties(pinproc PROPERTIES MINSIZEREL_POSTFIX "${TMP_SUFFIX}")
set_target_properties(pinproc PROPERTIES RELWITHDEBINFO_POSTFIX "${TMP_SUFFIX}")
# correct external library names
set(YAML_CPP_LIB "lib${YAML_CPP_LIB}${TMP_SUFFIX}")
set(YAML_CPP_LIB_DBG "${YAML_CPP_LIB}d")
endif() endif()
install(TARGETS pinproc ${_INSTALL_DESTINATIONS}) install(TARGETS pinproc ${_INSTALL_DESTINATIONS})
@@ -161,9 +231,10 @@ endif()
### ###
### Extras ### Extras
### ###
#TODO: use add_subdirectory() and separate CMakeLists.txt
if(PINPROC_BUILD_TOOLS) if(PINPROC_BUILD_TOOLS)
# Create a target for the test tool (see yaml-cpp) # Create a target for the test tool
#TODO: use add_subdirectory() and separate CMakeLists.txt (like yaml-cpp)
# see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:add_subdirectory
add_executable(pinproctest add_executable(pinproctest
examples/pinproctest/pinproctest.cpp examples/pinproctest/pinproctest.cpp
examples/pinproctest/drivers.cpp examples/pinproctest/drivers.cpp
@@ -173,19 +244,18 @@ add_executable(pinproctest
) )
target_link_libraries(pinproctest target_link_libraries(pinproctest
pinproc pinproc
${libraries}
optimized ${YAML_CPP_LIB} optimized ${YAML_CPP_LIB}
debug ${YAML_CPP_LIB_DBG} debug ${YAML_CPP_LIB_DBG}
) )
# Create a target for the firmware tool (see yaml-cpp) # Create a target for the firmware tool
#TODO: use add_subdirectory() and separate CMakeLists.txt #TODO: use add_subdirectory() and separate CMakeLists.txt (like yaml-cpp)
# see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:add_subdirectory
add_executable(pinprocfw add_executable(pinprocfw
utils/pinprocfw/pinprocfw.cpp utils/pinprocfw/pinprocfw.cpp
utils/pinprocfw/lenval.cpp utils/pinprocfw/lenval.cpp
) )
target_link_libraries(pinprocfw target_link_libraries(pinprocfw
pinproc pinproc
${libraries}
) )
endif() endif()

View File

@@ -27,6 +27,12 @@
* pinproctest.cpp * pinproctest.cpp
* libpinproc * libpinproc
*/ */
#ifndef PINPROCTEST_PINPROCTEST_H
#define PINPROCTEST_PINPROCTEST_H
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <signal.h> #include <signal.h>
@@ -75,3 +81,5 @@ void ConfigureDMD(PRHandle proc);
void UpdateDots(unsigned char * dots, unsigned int dotOffset); void UpdateDots(unsigned char * dots, unsigned int dotOffset);
void UpdateAlphaDisplay(PRHandle, int); void UpdateAlphaDisplay(PRHandle, int);
#endif /* PINPROCTEST_PINPROCTEST_H */

View File

@@ -27,9 +27,11 @@
* @brief libpinproc, P-ROC Layer 1 API (Preliminary) * @brief libpinproc, P-ROC Layer 1 API (Preliminary)
* *
*/ */
#ifndef PINPROC_PINPROC_H
#ifndef _PINPROC_H_ #define PINPROC_PINPROC_H
#define _PINPROC_H_ #if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
/* /*
* 3rd party "stdint.h" replacement available for Visual C++ before version 2010. * 3rd party "stdint.h" replacement available for Visual C++ before version 2010.
@@ -40,32 +42,35 @@
#include <stdint.h> #include <stdint.h>
/** @cond */ /** @cond */
#if defined(__WIN32__) || defined(_WIN32) // The following ifdef block is the standard way of creating macros which make exporting
#undef PR_EXPORT // from a DLL simpler. All files within this DLL are compiled with the pinproc_EXPORTS
#if defined(PR_BUILDING_PR) // symbol defined on the command line. This symbol should not be defined on any project
#define PR_EXPORT __declspec(dllexport) extern // that uses this DLL. This way any other project whose source files include this file see
// PINPROC_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#undef PINPROC_API
#ifdef PINPROC_DLL // Using or Building PinPROC DLL (definition defined manually)
#ifdef pinproc_EXPORTS // Building PinPROC DLL (definition created by CMake or defined manually)
#define PINPROC_API __declspec(dllexport)
#else #else
// TODO: Decide what to do here: #define PINPROC_API __declspec(dllimport)
//#define PR_EXPORT __declspec(dllimport) extern
#define PR_EXPORT
#endif #endif
#endif #endif
// fallback for non-DLL usage and builds
#if !defined(PR_EXPORT) #ifndef PINPROC_API
#define PR_EXPORT extern #define PINPROC_API
#endif #endif
#if !defined(PR_EXTERN_C_BEGIN) #if defined(__cplusplus)
#if defined(__cplusplus) #define PINPROC_EXTERN_C_BEGIN extern "C" {
#define PR_EXTERN_C_BEGIN extern "C" { #define PINPROC_EXTERN_C_END }
#define PR_EXTERN_C_END } #else
#else #define PINPROC_EXTERN_C_BEGIN
#define PR_EXTERN_C_BEGIN #define PINPROC_EXTERN_C_END
#define PR_EXTERN_C_END
#endif
#endif #endif
PR_EXTERN_C_BEGIN PINPROC_EXTERN_C_BEGIN
/** @endcond */ /** @endcond */
// Types // Types
@@ -87,11 +92,11 @@ typedef enum PRLogLevel {
} PRLogLevel; } PRLogLevel;
typedef void (*PRLogCallback)(PRLogLevel level, const char *text); /**< Function pointer type for a custom logging callback. See: PRLogSetCallback(). */ typedef void (*PRLogCallback)(PRLogLevel level, const char *text); /**< Function pointer type for a custom logging callback. See: PRLogSetCallback(). */
PR_EXPORT void PRLogSetCallback(PRLogCallback callback); /**< Replaces the default logging handler with the given callback function. */ PINPROC_API void PRLogSetCallback(PRLogCallback callback); /**< Replaces the default logging handler with the given callback function. */
PR_EXPORT void PRLogSetLevel(PRLogLevel level); PINPROC_API void PRLogSetLevel(PRLogLevel level);
PR_EXPORT const char *PRGetLastErrorText(); PINPROC_API const char *PRGetLastErrorText();
/** /**
* @defgroup device Device Creation & Deletion * @defgroup device Device Creation & Deletion
@@ -110,8 +115,8 @@ typedef enum PRMachineType {
// PRHandle Creation and Deletion // PRHandle Creation and Deletion
PR_EXPORT PRHandle PRCreate(PRMachineType machineType); /**< Create a new P-ROC device handle. Only one handle per device may be created. This handle must be destroyed with PRDelete() when it is no longer needed. Returns #kPRHandleInvalid if an error occurred. */ PINPROC_API PRHandle PRCreate(PRMachineType machineType); /**< Create a new P-ROC device handle. Only one handle per device may be created. This handle must be destroyed with PRDelete() when it is no longer needed. Returns #kPRHandleInvalid if an error occurred. */
PR_EXPORT void PRDelete(PRHandle handle); /**< Destroys an existing P-ROC device handle. */ PINPROC_API void PRDelete(PRHandle handle); /**< Destroys an existing P-ROC device handle. */
#define kPRResetFlagDefault (0) /**< Only resets state in memory and does not write changes to the device. */ #define kPRResetFlagDefault (0) /**< Only resets state in memory and does not write changes to the device. */
#define kPRResetFlagUpdateDevice (1) /**< Instructs PRReset() to update the device once it has reset the configuration to its defaults. */ #define kPRResetFlagUpdateDevice (1) /**< Instructs PRReset() to update the device once it has reset the configuration to its defaults. */
@@ -120,20 +125,20 @@ PR_EXPORT void PRDelete(PRHandle handle); /**< Destroys an existin
* @brief Resets internally maintained driver and switch rule structures. * @brief Resets internally maintained driver and switch rule structures.
* @param resetFlags Specify #kPRResetFlagDefault to only reset the configuration in host memory. #kPRResetFlagUpdateDevice will write the default configuration to the device, effectively disabling all drivers and switch rules. * @param resetFlags Specify #kPRResetFlagDefault to only reset the configuration in host memory. #kPRResetFlagUpdateDevice will write the default configuration to the device, effectively disabling all drivers and switch rules.
*/ */
PR_EXPORT PRResult PRReset(PRHandle handle, uint32_t resetFlags); PINPROC_API PRResult PRReset(PRHandle handle, uint32_t resetFlags);
/** @} */ // End of Device Creation & Deletion /** @} */ // End of Device Creation & Deletion
// I/O // I/O
/** Flush all pending write data out to the P-ROC. */ /** Flush all pending write data out to the P-ROC. */
PR_EXPORT PRResult PRFlushWriteData(PRHandle handle); PINPROC_API PRResult PRFlushWriteData(PRHandle handle);
/** Write data out to the P-ROC immediately (does not require a call to PRFlushWriteData). */ /** Write data out to the P-ROC immediately (does not require a call to PRFlushWriteData). */
PR_EXPORT PRResult PRWriteData(PRHandle handle, uint32_t moduleSelect, uint32_t startingAddr, int32_t numWriteWords, uint32_t * writeBuffer); PINPROC_API PRResult PRWriteData(PRHandle handle, uint32_t moduleSelect, uint32_t startingAddr, int32_t numWriteWords, uint32_t * writeBuffer);
/** Read data from the P-ROC. */ /** Read data from the P-ROC. */
PR_EXPORT PRResult PRReadData(PRHandle handle, uint32_t moduleSelect, uint32_t startingAddr, int32_t numReadWords, uint32_t * readBuffer); PINPROC_API PRResult PRReadData(PRHandle handle, uint32_t moduleSelect, uint32_t startingAddr, int32_t numReadWords, uint32_t * readBuffer);
// Manager // Manager
/** @defgroup Manager /** @defgroup Manager
@@ -146,7 +151,7 @@ typedef struct PRManagerConfig {
} PRManagerConfig; } PRManagerConfig;
/** Update Manager configuration */ /** Update Manager configuration */
PR_EXPORT PRResult PRManagerUpdateConfig(PRHandle handle, PRManagerConfig *managerConfig); PINPROC_API PRResult PRManagerUpdateConfig(PRHandle handle, PRManagerConfig *managerConfig);
// Drivers // Drivers
/** @defgroup drivers Driver Manipulation /** @defgroup drivers Driver Manipulation
@@ -212,24 +217,24 @@ typedef struct PRDriverAuxCommand {
} PRDriverAuxCommand; } PRDriverAuxCommand;
/** Update registers for the global driver configuration. */ /** Update registers for the global driver configuration. */
PR_EXPORT PRResult PRDriverUpdateGlobalConfig(PRHandle handle, PRDriverGlobalConfig *driverGlobalConfig); PINPROC_API PRResult PRDriverUpdateGlobalConfig(PRHandle handle, PRDriverGlobalConfig *driverGlobalConfig);
PR_EXPORT PRResult PRDriverGetGroupConfig(PRHandle handle, uint8_t groupNum, PRDriverGroupConfig *driverGroupConfig); PINPROC_API PRResult PRDriverGetGroupConfig(PRHandle handle, uint8_t groupNum, PRDriverGroupConfig *driverGroupConfig);
/** Update registers for the given driver group configuration. */ /** Update registers for the given driver group configuration. */
PR_EXPORT PRResult PRDriverUpdateGroupConfig(PRHandle handle, PRDriverGroupConfig *driverGroupConfig); PINPROC_API PRResult PRDriverUpdateGroupConfig(PRHandle handle, PRDriverGroupConfig *driverGroupConfig);
PR_EXPORT PRResult PRDriverGetState(PRHandle handle, uint8_t driverNum, PRDriverState *driverState); PINPROC_API PRResult PRDriverGetState(PRHandle handle, uint8_t driverNum, PRDriverState *driverState);
/** /**
* @brief Sets the state of the given driver (lamp or coil). * @brief Sets the state of the given driver (lamp or coil).
*/ */
PR_EXPORT PRResult PRDriverUpdateState(PRHandle handle, PRDriverState *driverState); PINPROC_API PRResult PRDriverUpdateState(PRHandle handle, PRDriverState *driverState);
/** /**
* @brief Loads the driver defaults for the given machine type. * @brief Loads the driver defaults for the given machine type.
* *
* PRReset() calls this function internally; this function is useful for basing custom driver settings off of the defaults for a particular machine. * PRReset() calls this function internally; this function is useful for basing custom driver settings off of the defaults for a particular machine.
* @note This function does not update the P-ROC hardware, only the internal data structures. Use PRDriverGetGlobalConfig() and PRDriverGetGroupConfig() to retrieve the settings. * @note This function does not update the P-ROC hardware, only the internal data structures. Use PRDriverGetGlobalConfig() and PRDriverGetGroupConfig() to retrieve the settings.
*/ */
PR_EXPORT PRResult PRDriverLoadMachineTypeDefaults(PRHandle handle, PRMachineType machineType); PINPROC_API PRResult PRDriverLoadMachineTypeDefaults(PRHandle handle, PRMachineType machineType);
// Driver Group Helper functions: // Driver Group Helper functions:
@@ -237,85 +242,85 @@ PR_EXPORT PRResult PRDriverLoadMachineTypeDefaults(PRHandle handle, PRMachineTyp
* Disables (turns off) the given driver group. * Disables (turns off) the given driver group.
* This function is provided for convenience. See PRDriverGroupDisable() for a full description. * This function is provided for convenience. See PRDriverGroupDisable() for a full description.
*/ */
PR_EXPORT PRResult PRDriverGroupDisable(PRHandle handle, uint8_t groupNum); PINPROC_API PRResult PRDriverGroupDisable(PRHandle handle, uint8_t groupNum);
// Driver Helper functions: // Driver Helper functions:
/** /**
* Disables (turns off) the given driver. * Disables (turns off) the given driver.
* This function is provided for convenience. See PRDriverStateDisable() for a full description. * This function is provided for convenience. See PRDriverStateDisable() for a full description.
*/ */
PR_EXPORT PRResult PRDriverDisable(PRHandle handle, uint8_t driverNum); PINPROC_API PRResult PRDriverDisable(PRHandle handle, uint8_t driverNum);
/** /**
* Pulses the given driver for a number of milliseconds. * Pulses the given driver for a number of milliseconds.
* This function is provided for convenience. See PRDriverStatePulse() for a full description. * This function is provided for convenience. See PRDriverStatePulse() for a full description.
*/ */
PR_EXPORT PRResult PRDriverPulse(PRHandle handle, uint8_t driverNum, uint8_t milliseconds); PINPROC_API PRResult PRDriverPulse(PRHandle handle, uint8_t driverNum, uint8_t milliseconds);
/** /**
* Assigns a repeating schedule to the given driver. * Assigns a repeating schedule to the given driver.
* This function is provided for convenience. See PRDriverStateSchedule() for a full description. * This function is provided for convenience. See PRDriverStateSchedule() for a full description.
*/ */
PR_EXPORT PRResult PRDriverSchedule(PRHandle handle, uint8_t driverNum, uint32_t schedule, uint8_t cycleSeconds, bool_t now); PINPROC_API PRResult PRDriverSchedule(PRHandle handle, uint8_t driverNum, uint32_t schedule, uint8_t cycleSeconds, bool_t now);
/** /**
* Assigns a pitter-patter schedule (repeating on/off) to the given driver. * Assigns a pitter-patter schedule (repeating on/off) to the given driver.
* This function is provided for convenience. See PRDriverStatePatter() for a full description. * This function is provided for convenience. See PRDriverStatePatter() for a full description.
*/ */
PR_EXPORT PRResult PRDriverPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime); PINPROC_API PRResult PRDriverPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime);
/** /**
* Assigns a pitter-patter schedule (repeating on/off) to the given driver on for the given duration. * Assigns a pitter-patter schedule (repeating on/off) to the given driver on for the given duration.
* This function is provided for convenience. See PRDriverStatePulsedPatter() for a full description. * This function is provided for convenience. See PRDriverStatePulsedPatter() for a full description.
*/ */
PR_EXPORT PRResult PRDriverPulsedPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime); PINPROC_API PRResult PRDriverPulsedPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime);
/** /**
* Assigns a pitter-patter schedule (repeating on/off) to the given driver for the given duration. * Assigns a pitter-patter schedule (repeating on/off) to the given driver for the given duration.
* This function is provided for convenience. See PRDriverStatePatter() for a full description. * This function is provided for convenience. See PRDriverStatePatter() for a full description.
*/ */
PR_EXPORT PRResult PRDriverPulsedPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime); PINPROC_API PRResult PRDriverPulsedPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime);
/** /**
* Prepares an Aux Command to drive the Aux bus. * Prepares an Aux Command to drive the Aux bus.
* This function is provided for convenience. * This function is provided for convenience.
*/ */
PR_EXPORT void PRDriverAuxPrepareOutput(PRDriverAuxCommand *auxCommand, uint8_t data, uint8_t extraData, uint8_t enables, bool_t muxEnables, uint16_t delayTime); PINPROC_API void PRDriverAuxPrepareOutput(PRDriverAuxCommand *auxCommand, uint8_t data, uint8_t extraData, uint8_t enables, bool_t muxEnables, uint16_t delayTime);
/** /**
* Prepares an Aux Command to delay the Aux logic. * Prepares an Aux Command to delay the Aux logic.
* This function is provided for convenience. * This function is provided for convenience.
*/ */
PR_EXPORT void PRDriverAuxPrepareDelay(PRDriverAuxCommand *auxCommand, uint16_t delayTime); PINPROC_API void PRDriverAuxPrepareDelay(PRDriverAuxCommand *auxCommand, uint16_t delayTime);
/** /**
* Prepares an Aux Command to have the Aux memory pointer jump to a new address. * Prepares an Aux Command to have the Aux memory pointer jump to a new address.
* This function is provided for convenience. * This function is provided for convenience.
*/ */
PR_EXPORT void PRDriverAuxPrepareJump(PRDriverAuxCommand *auxCommand, uint8_t jumpAddr); PINPROC_API void PRDriverAuxPrepareJump(PRDriverAuxCommand *auxCommand, uint8_t jumpAddr);
/** /**
* Prepares a disabled Aux Command. * Prepares a disabled Aux Command.
* This function is provided for convenience. * This function is provided for convenience.
*/ */
PR_EXPORT void PRDriverAuxPrepareDisable(PRDriverAuxCommand *auxCommand); PINPROC_API void PRDriverAuxPrepareDisable(PRDriverAuxCommand *auxCommand);
/** Tickle the watchdog timer. */ /** Tickle the watchdog timer. */
PR_EXPORT PRResult PRDriverWatchdogTickle(PRHandle handle); PINPROC_API PRResult PRDriverWatchdogTickle(PRHandle handle);
/** /**
* Changes the given #PRDriverGroupConfig to reflect a disabled group. * Changes the given #PRDriverGroupConfig to reflect a disabled group.
* @note The driver group config structure must be applied using PRDriverUpdateGroupConfig() to have any effect. * @note The driver group config structure must be applied using PRDriverUpdateGroupConfig() to have any effect.
*/ */
PR_EXPORT void PRDriverGroupStateDisable(PRDriverGroupConfig *driverGroup); PINPROC_API void PRDriverGroupStateDisable(PRDriverGroupConfig *driverGroup);
/** /**
* Changes the given #PRDriverState to reflect a disabled state. * Changes the given #PRDriverState to reflect a disabled state.
* @note The driver state structure must be applied using PRDriverUpdateState() or linked to a switch rule using PRSwitchUpdateRule() to have any effect. * @note The driver state structure must be applied using PRDriverUpdateState() or linked to a switch rule using PRSwitchUpdateRule() to have any effect.
*/ */
PR_EXPORT void PRDriverStateDisable(PRDriverState *driverState); PINPROC_API void PRDriverStateDisable(PRDriverState *driverState);
/** /**
* Changes the given #PRDriverState to reflect a pulse state. * Changes the given #PRDriverState to reflect a pulse state.
* @param milliseconds Number of milliseconds to pulse the driver for. * @param milliseconds Number of milliseconds to pulse the driver for.
* @note The driver state structure must be applied using PRDriverUpdateState() or linked to a switch rule using PRSwitchUpdateRule() to have any effect. * @note The driver state structure must be applied using PRDriverUpdateState() or linked to a switch rule using PRSwitchUpdateRule() to have any effect.
*/ */
PR_EXPORT void PRDriverStatePulse(PRDriverState *driverState, uint8_t milliseconds); PINPROC_API void PRDriverStatePulse(PRDriverState *driverState, uint8_t milliseconds);
/** /**
* Changes the given #PRDriverState to reflect a scheduled state. * Changes the given #PRDriverState to reflect a scheduled state.
* Assigns a repeating schedule to the given driver. * Assigns a repeating schedule to the given driver.
* @note The driver state structure must be applied using PRDriverUpdateState() or linked to a switch rule using PRSwitchUpdateRule() to have any effect. * @note The driver state structure must be applied using PRDriverUpdateState() or linked to a switch rule using PRSwitchUpdateRule() to have any effect.
*/ */
PR_EXPORT void PRDriverStateSchedule(PRDriverState *driverState, uint32_t schedule, uint8_t cycleSeconds, bool_t now); PINPROC_API void PRDriverStateSchedule(PRDriverState *driverState, uint32_t schedule, uint8_t cycleSeconds, bool_t now);
/** /**
* @brief Changes the given #PRDriverState to reflect a pitter-patter schedule state. * @brief Changes the given #PRDriverState to reflect a pitter-patter schedule state.
* Assigns a pitter-patter schedule (repeating on/off) to the given driver. * Assigns a pitter-patter schedule (repeating on/off) to the given driver.
@@ -323,27 +328,27 @@ PR_EXPORT void PRDriverStateSchedule(PRDriverState *driverState, uint32_t schedu
* *
* Use originalOnTime to pulse the driver for a number of milliseconds before the pitter-patter schedule begins. * Use originalOnTime to pulse the driver for a number of milliseconds before the pitter-patter schedule begins.
*/ */
PR_EXPORT void PRDriverStatePatter(PRDriverState *driverState, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime); PINPROC_API void PRDriverStatePatter(PRDriverState *driverState, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime);
/** /**
* @brief Changes the given #PRDriverState to reflect a pitter-patter schedule state. * @brief Changes the given #PRDriverState to reflect a pitter-patter schedule state.
* Just like the regular Patter above, but PulsePatter only drives the patter * Just like the regular Patter above, but PulsePatter only drives the patter
* scheduled for the given number of milliseconds before disabling the driver. * scheduled for the given number of milliseconds before disabling the driver.
*/ */
PR_EXPORT void PRDriverStatePulsedPatter(PRDriverState *driverState, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t patterTime); PINPROC_API void PRDriverStatePulsedPatter(PRDriverState *driverState, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t patterTime);
/** /**
* Write Aux Port commands into the Aux Port command memory. * Write Aux Port commands into the Aux Port command memory.
*/ */
PR_EXPORT PRResult PRDriverAuxSendCommands(PRHandle handle, PRDriverAuxCommand * commands, uint8_t numCommands, uint8_t startingAddr); PINPROC_API PRResult PRDriverAuxSendCommands(PRHandle handle, PRDriverAuxCommand * commands, uint8_t numCommands, uint8_t startingAddr);
/** /**
* @brief Converts a coil, lamp, switch, or GI string into a P-ROC driver number. * @brief Converts a coil, lamp, switch, or GI string into a P-ROC driver number.
* The following formats are accepted: Cxx (coil), Lxx (lamp), Sxx (matrix switch), SFx (flipper grounded switch), or SDx (dedicated grounded switch). * The following formats are accepted: Cxx (coil), Lxx (lamp), Sxx (matrix switch), SFx (flipper grounded switch), or SDx (dedicated grounded switch).
* If the string does not match this format it will be converted into an integer using atoi(). * If the string does not match this format it will be converted into an integer using atoi().
*/ */
PR_EXPORT uint16_t PRDecode(PRMachineType machineType, const char *str); PINPROC_API uint16_t PRDecode(PRMachineType machineType, const char *str);
/** @} */ // End of Drivers /** @} */ // End of Drivers
@@ -374,7 +379,7 @@ typedef struct PREvent {
/** Get all of the available events that have been received. /** Get all of the available events that have been received.
* \return Number of events returned; -1 if an error occurred. * \return Number of events returned; -1 if an error occurred.
*/ */
PR_EXPORT int PRGetEvents(PRHandle handle, PREvent *eventsOut, int maxEvents); PINPROC_API int PRGetEvents(PRHandle handle, PREvent *eventsOut, int maxEvents);
#define kPRSwitchPhysicalFirst (0) /**< Switch number of the first physical switch. */ #define kPRSwitchPhysicalFirst (0) /**< Switch number of the first physical switch. */
@@ -402,7 +407,7 @@ typedef struct PRSwitchRule {
} PRSwitchRule; } PRSwitchRule;
/** Update the switch controller configurion registers */ /** Update the switch controller configurion registers */
PR_EXPORT PRResult PRSwitchUpdateConfig(PRHandle handle, PRSwitchConfig *switchConfig); PINPROC_API PRResult PRSwitchUpdateConfig(PRHandle handle, PRSwitchConfig *switchConfig);
/** /**
* @brief Configures the handling of switch rules within P-ROC. * @brief Configures the handling of switch rules within P-ROC.
@@ -456,10 +461,10 @@ PR_EXPORT PRResult PRSwitchUpdateConfig(PRHandle handle, PRSwitchConfig *switchC
* @param linkedDrivers An array of #PRDriverState structures describing the driver state changes to be made when this switch rule is triggered. May be NULL if numDrivers is 0. * @param linkedDrivers An array of #PRDriverState structures describing the driver state changes to be made when this switch rule is triggered. May be NULL if numDrivers is 0.
* @param numDrivers Number of elements in the linkedDrivers array. May be zero or more. * @param numDrivers Number of elements in the linkedDrivers array. May be zero or more.
*/ */
PR_EXPORT PRResult PRSwitchUpdateRule(PRHandle handle, uint8_t switchNum, PREventType eventType, PRSwitchRule *rule, PRDriverState *linkedDrivers, int numDrivers); PINPROC_API PRResult PRSwitchUpdateRule(PRHandle handle, uint8_t switchNum, PREventType eventType, PRSwitchRule *rule, PRDriverState *linkedDrivers, int numDrivers);
/** Returns a list of PREventTypes describing the states of the requested number of switches */ /** Returns a list of PREventTypes describing the states of the requested number of switches */
PR_EXPORT PRResult PRSwitchGetStates(PRHandle handle, PREventType * switchStates, uint16_t numSwitches); PINPROC_API PRResult PRSwitchGetStates(PRHandle handle, PREventType * switchStates, uint16_t numSwitches);
/** @} */ // End of Switches & Events /** @} */ // End of Switches & Events
@@ -484,9 +489,9 @@ typedef struct PRDMDConfig {
} PRDMDConfig; } PRDMDConfig;
/** Sets the configuration registers for the DMD driver. */ /** Sets the configuration registers for the DMD driver. */
PR_EXPORT int32_t PRDMDUpdateConfig(PRHandle handle, PRDMDConfig *dmdConfig); PINPROC_API int32_t PRDMDUpdateConfig(PRHandle handle, PRDMDConfig *dmdConfig);
/** Updates the DMD frame buffer with the given data. */ /** Updates the DMD frame buffer with the given data. */
PR_EXPORT PRResult PRDMDDraw(PRHandle handle, uint8_t * dots); PINPROC_API PRResult PRDMDDraw(PRHandle handle, uint8_t * dots);
/** @} */ // End of DMD /** @} */ // End of DMD
@@ -513,20 +518,20 @@ typedef struct PRJTAGOutputs {
} PRJTAGOutputs; } PRJTAGOutputs;
/** Force JTAG outputs (TCK, TDO, TMS) to specific values. Optionally toggle the clock when driving only TDO and/or TMS.*/ /** Force JTAG outputs (TCK, TDO, TMS) to specific values. Optionally toggle the clock when driving only TDO and/or TMS.*/
PR_EXPORT PRResult PRJTAGDriveOutputs(PRHandle handle, PRJTAGOutputs * jtagOutputs, bool_t toggleClk); PINPROC_API PRResult PRJTAGDriveOutputs(PRHandle handle, PRJTAGOutputs * jtagOutputs, bool_t toggleClk);
/** Store data to be shifted out on TDO */ /** Store data to be shifted out on TDO */
PR_EXPORT PRResult PRJTAGWriteTDOMemory(PRHandle handle, uint16_t tableOffset, uint16_t numWords, uint32_t * tdoData); PINPROC_API PRResult PRJTAGWriteTDOMemory(PRHandle handle, uint16_t tableOffset, uint16_t numWords, uint32_t * tdoData);
/** Shift stored TDO data onto the TDO pin, toggling TCK on every bit. */ /** Shift stored TDO data onto the TDO pin, toggling TCK on every bit. */
PR_EXPORT PRResult PRJTAGShiftTDOData(PRHandle handle, uint16_t numBits, bool_t dataBlockComplete); PINPROC_API PRResult PRJTAGShiftTDOData(PRHandle handle, uint16_t numBits, bool_t dataBlockComplete);
/** Get the contents of the TDI memory. */ /** Get the contents of the TDI memory. */
PR_EXPORT PRResult PRJTAGReadTDIMemory(PRHandle handle, uint16_t tableOffset, uint16_t numWords, uint32_t * tdiData); PINPROC_API PRResult PRJTAGReadTDIMemory(PRHandle handle, uint16_t tableOffset, uint16_t numWords, uint32_t * tdiData);
/** Read the JTAG status register for the command complete bit and JTAG pin states. */ /** Read the JTAG status register for the command complete bit and JTAG pin states. */
PR_EXPORT PRResult PRJTAGGetStatus(PRHandle handle, PRJTAGStatus * status); PINPROC_API PRResult PRJTAGGetStatus(PRHandle handle, PRJTAGStatus * status);
/** @} */ // End of DMD /** @} */ // End of DMD
/** @cond */ /** @cond */
PR_EXTERN_C_END PINPROC_EXTERN_C_END
/** @endcond */ /** @endcond */
/** /**
@@ -535,4 +540,4 @@ PR_EXTERN_C_END
* This is the documentation for libpinproc, the P-ROC Layer 1 API. * This is the documentation for libpinproc, the P-ROC Layer 1 API.
*/ */
#endif // _PINPROC_H_ #endif /* PINPROC_PINPROC_H */

View File

@@ -22,8 +22,11 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _PRCOMMON_H_ #ifndef PINPROC_PRCOMMON_H
#define _PRCOMMON_H_ #define PINPROC_PRCOMMON_H
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
#ifdef NDEBUG #ifdef NDEBUG
# define DEBUG(block) # define DEBUG(block)
@@ -34,4 +37,4 @@
void PRLog(PRLogLevel level, const char *format, ...); void PRLog(PRLogLevel level, const char *format, ...);
void PRSetLastErrorText(const char *format, ...); void PRSetLastErrorText(const char *format, ...);
#endif // _PRCOMMON_H_ #endif /* PINPROC_PRCOMMON_H */

View File

@@ -27,6 +27,11 @@
* PRDevice.h * PRDevice.h
* libpinproc * libpinproc
*/ */
#ifndef PINPROC_PRDEVICE_H
#define PINPROC_PRDEVICE_H
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
#include "pinproc.h" #include "pinproc.h"
#include "PRCommon.h" #include "PRCommon.h"
@@ -167,3 +172,5 @@ protected:
queue<uint32_t> freeSwitchRuleIndexes; /**< Indexes of available switch rules. */ queue<uint32_t> freeSwitchRuleIndexes; /**< Indexes of available switch rules. */
PRSwitchRuleInternal *GetSwitchRuleByIndex(uint16_t index); PRSwitchRuleInternal *GetSwitchRuleByIndex(uint16_t index);
}; };
#endif /* PINPROC_PRDEVICE_H */

View File

@@ -23,8 +23,11 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _PROC_HARDWARE_H_ #ifndef PINPROC_PRHARDWARE_H
#define _PROC_HARDWARE_H_ #define PINPROC_PRHARDWARE_H
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
#include <stdint.h> #include <stdint.h>
#include "pinproc.h" #include "pinproc.h"
@@ -274,4 +277,4 @@ void PRHardwareClose();
int PRHardwareRead(uint8_t *buffer, int maxBytes); int PRHardwareRead(uint8_t *buffer, int maxBytes);
int PRHardwareWrite(uint8_t *buffer, int bytes); int PRHardwareWrite(uint8_t *buffer, int bytes);
#endif // _PROC_HARDWARE_H_ #endif /* PINPROC_PRHARDWARE_H */

View File

@@ -81,7 +81,7 @@ void PRSetLastErrorText(const char *format, ...)
PRLog(kPRLogError, "%s\n", lastErrorText); PRLog(kPRLogError, "%s\n", lastErrorText);
} }
PR_EXPORT const char *PRGetLastErrorText() const char *PRGetLastErrorText()
{ {
return lastErrorText; return lastErrorText;
} }
@@ -89,7 +89,7 @@ PR_EXPORT const char *PRGetLastErrorText()
#define handleAsDevice ((PRDevice*)handle) #define handleAsDevice ((PRDevice*)handle)
/** Create a new P-ROC device handle. Only one handle per device may be created. This handle must be destroyed with PRDelete() when it is no longer needed. */ /** Create a new P-ROC device handle. Only one handle per device may be created. This handle must be destroyed with PRDelete() when it is no longer needed. */
PR_EXPORT PRHandle PRCreate(PRMachineType machineType) PRHandle PRCreate(PRMachineType machineType)
{ {
PRDevice *device = PRDevice::Create(machineType); PRDevice *device = PRDevice::Create(machineType);
if (device == NULL) if (device == NULL)
@@ -98,14 +98,14 @@ PR_EXPORT PRHandle PRCreate(PRMachineType machineType)
return device; return device;
} }
/** Destroys an existing P-ROC device handle. */ /** Destroys an existing P-ROC device handle. */
PR_EXPORT void PRDelete(PRHandle handle) void PRDelete(PRHandle handle)
{ {
if (handle != kPRHandleInvalid) if (handle != kPRHandleInvalid)
delete (PRDevice*)handle; delete (PRDevice*)handle;
} }
/** Resets internally maintained driver and switch rule structures and optionally writes those to the P-ROC device. */ /** Resets internally maintained driver and switch rule structures and optionally writes those to the P-ROC device. */
PR_EXPORT PRResult PRReset(PRHandle handle, uint32_t resetFlags) PRResult PRReset(PRHandle handle, uint32_t resetFlags)
{ {
return handleAsDevice->Reset(resetFlags); return handleAsDevice->Reset(resetFlags);
} }
@@ -113,19 +113,19 @@ PR_EXPORT PRResult PRReset(PRHandle handle, uint32_t resetFlags)
// I/O // I/O
/** Flush all pending write data out to the P-ROC */ /** Flush all pending write data out to the P-ROC */
PR_EXPORT PRResult PRFlushWriteData(PRHandle handle) PRResult PRFlushWriteData(PRHandle handle)
{ {
return handleAsDevice->FlushWriteData(); return handleAsDevice->FlushWriteData();
} }
/** Write data out to the P-ROC immediately (does not require a call to PRFlushWriteData */ /** Write data out to the P-ROC immediately (does not require a call to PRFlushWriteData */
PR_EXPORT PRResult PRWriteData(PRHandle handle, uint32_t moduleSelect, uint32_t startingAddr, int32_t numWriteWords, uint32_t * writeBuffer) PRResult PRWriteData(PRHandle handle, uint32_t moduleSelect, uint32_t startingAddr, int32_t numWriteWords, uint32_t * writeBuffer)
{ {
return handleAsDevice->WriteDataRaw(moduleSelect, startingAddr, numWriteWords, writeBuffer); return handleAsDevice->WriteDataRaw(moduleSelect, startingAddr, numWriteWords, writeBuffer);
} }
/** Read data from the P-ROC. */ /** Read data from the P-ROC. */
PR_EXPORT PRResult PRReadData(PRHandle handle, uint32_t moduleSelect, uint32_t startingAddr, int32_t numReadWords, uint32_t * readBuffer) PRResult PRReadData(PRHandle handle, uint32_t moduleSelect, uint32_t startingAddr, int32_t numReadWords, uint32_t * readBuffer)
{ {
return handleAsDevice->ReadDataRaw(moduleSelect, startingAddr, numReadWords, readBuffer); return handleAsDevice->ReadDataRaw(moduleSelect, startingAddr, numReadWords, readBuffer);
} }
@@ -133,45 +133,45 @@ PR_EXPORT PRResult PRReadData(PRHandle handle, uint32_t moduleSelect, uint32_t s
// Events // Events
/** Get all of the available events that have been received. */ /** Get all of the available events that have been received. */
PR_EXPORT int PRGetEvents(PRHandle handle, PREvent *eventsOut, int maxEvents) int PRGetEvents(PRHandle handle, PREvent *eventsOut, int maxEvents)
{ {
return handleAsDevice->GetEvents(eventsOut, maxEvents); return handleAsDevice->GetEvents(eventsOut, maxEvents);
} }
// Manager // Manager
PR_EXPORT PRResult PRManagerUpdateConfig(PRHandle handle, PRManagerConfig *managerConfig) PRResult PRManagerUpdateConfig(PRHandle handle, PRManagerConfig *managerConfig)
{ {
return handleAsDevice->ManagerUpdateConfig(managerConfig); return handleAsDevice->ManagerUpdateConfig(managerConfig);
} }
// Drivers // Drivers
PR_EXPORT PRResult PRDriverUpdateGlobalConfig(PRHandle handle, PRDriverGlobalConfig *driverGlobalConfig) PRResult PRDriverUpdateGlobalConfig(PRHandle handle, PRDriverGlobalConfig *driverGlobalConfig)
{ {
return handleAsDevice->DriverUpdateGlobalConfig(driverGlobalConfig); return handleAsDevice->DriverUpdateGlobalConfig(driverGlobalConfig);
} }
PR_EXPORT PRResult PRDriverGetGroupConfig(PRHandle handle, uint8_t groupNum, PRDriverGroupConfig *driverGroupConfig) PRResult PRDriverGetGroupConfig(PRHandle handle, uint8_t groupNum, PRDriverGroupConfig *driverGroupConfig)
{ {
return handleAsDevice->DriverGetGroupConfig(groupNum, driverGroupConfig); return handleAsDevice->DriverGetGroupConfig(groupNum, driverGroupConfig);
} }
PR_EXPORT PRResult PRDriverUpdateGroupConfig(PRHandle handle, PRDriverGroupConfig *driverGroupConfig) PRResult PRDriverUpdateGroupConfig(PRHandle handle, PRDriverGroupConfig *driverGroupConfig)
{ {
return handleAsDevice->DriverUpdateGroupConfig(driverGroupConfig); return handleAsDevice->DriverUpdateGroupConfig(driverGroupConfig);
} }
PR_EXPORT PRResult PRDriverGetState(PRHandle handle, uint8_t driverNum, PRDriverState *driverState) PRResult PRDriverGetState(PRHandle handle, uint8_t driverNum, PRDriverState *driverState)
{ {
return handleAsDevice->DriverGetState(driverNum, driverState); return handleAsDevice->DriverGetState(driverNum, driverState);
} }
PR_EXPORT PRResult PRDriverUpdateState(PRHandle handle, PRDriverState *driverState) PRResult PRDriverUpdateState(PRHandle handle, PRDriverState *driverState)
{ {
return handleAsDevice->DriverUpdateState(driverState); return handleAsDevice->DriverUpdateState(driverState);
} }
PR_EXPORT PRResult PRDriverLoadMachineTypeDefaults(PRHandle handle, PRMachineType machineType) PRResult PRDriverLoadMachineTypeDefaults(PRHandle handle, PRMachineType machineType)
{ {
return handleAsDevice->DriverLoadMachineTypeDefaults(machineType); return handleAsDevice->DriverLoadMachineTypeDefaults(machineType);
} }
// Driver Group Helper functions: // Driver Group Helper functions:
PR_EXPORT PRResult PRDriverGroupDisable(PRHandle handle, uint8_t groupNum) PRResult PRDriverGroupDisable(PRHandle handle, uint8_t groupNum)
{ {
PRDriverGroupConfig driverGroup; PRDriverGroupConfig driverGroup;
handleAsDevice->DriverGetGroupConfig(groupNum, &driverGroup); handleAsDevice->DriverGetGroupConfig(groupNum, &driverGroup);
@@ -179,47 +179,47 @@ PR_EXPORT PRResult PRDriverGroupDisable(PRHandle handle, uint8_t groupNum)
return handleAsDevice->DriverUpdateGroupConfig(&driverGroup); return handleAsDevice->DriverUpdateGroupConfig(&driverGroup);
} }
// Driver Helper functions: // Driver Helper functions:
PR_EXPORT PRResult PRDriverDisable(PRHandle handle, uint8_t driverNum) PRResult PRDriverDisable(PRHandle handle, uint8_t driverNum)
{ {
PRDriverState driver; PRDriverState driver;
handleAsDevice->DriverGetState(driverNum, &driver); handleAsDevice->DriverGetState(driverNum, &driver);
PRDriverStateDisable(&driver); PRDriverStateDisable(&driver);
return handleAsDevice->DriverUpdateState(&driver); return handleAsDevice->DriverUpdateState(&driver);
} }
PR_EXPORT PRResult PRDriverPulse(PRHandle handle, uint8_t driverNum, uint8_t milliseconds) PRResult PRDriverPulse(PRHandle handle, uint8_t driverNum, uint8_t milliseconds)
{ {
PRDriverState driver; PRDriverState driver;
handleAsDevice->DriverGetState(driverNum, &driver); handleAsDevice->DriverGetState(driverNum, &driver);
PRDriverStatePulse(&driver, milliseconds); PRDriverStatePulse(&driver, milliseconds);
return handleAsDevice->DriverUpdateState(&driver); return handleAsDevice->DriverUpdateState(&driver);
} }
PR_EXPORT PRResult PRDriverSchedule(PRHandle handle, uint8_t driverNum, uint32_t schedule, uint8_t cycleSeconds, bool_t now) PRResult PRDriverSchedule(PRHandle handle, uint8_t driverNum, uint32_t schedule, uint8_t cycleSeconds, bool_t now)
{ {
PRDriverState driver; PRDriverState driver;
handleAsDevice->DriverGetState(driverNum, &driver); handleAsDevice->DriverGetState(driverNum, &driver);
PRDriverStateSchedule(&driver, schedule, cycleSeconds, now); PRDriverStateSchedule(&driver, schedule, cycleSeconds, now);
return handleAsDevice->DriverUpdateState(&driver); return handleAsDevice->DriverUpdateState(&driver);
} }
PR_EXPORT PRResult PRDriverPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime) PRResult PRDriverPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime)
{ {
PRDriverState driver; PRDriverState driver;
handleAsDevice->DriverGetState(driverNum, &driver); handleAsDevice->DriverGetState(driverNum, &driver);
PRDriverStatePatter(&driver, millisecondsOn, millisecondsOff, originalOnTime); PRDriverStatePatter(&driver, millisecondsOn, millisecondsOff, originalOnTime);
return handleAsDevice->DriverUpdateState(&driver); return handleAsDevice->DriverUpdateState(&driver);
} }
PR_EXPORT PRResult PRDriverPulsedPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t duration) PRResult PRDriverPulsedPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t duration)
{ {
PRDriverState driver; PRDriverState driver;
handleAsDevice->DriverGetState(driverNum, &driver); handleAsDevice->DriverGetState(driverNum, &driver);
PRDriverStatePulsedPatter(&driver, millisecondsOn, millisecondsOff, duration); PRDriverStatePulsedPatter(&driver, millisecondsOn, millisecondsOff, duration);
return handleAsDevice->DriverUpdateState(&driver); return handleAsDevice->DriverUpdateState(&driver);
} }
PR_EXPORT PRResult PRDriverAuxSendCommands(PRHandle handle, PRDriverAuxCommand * commands, uint8_t numCommands, uint8_t startingAddr) PRResult PRDriverAuxSendCommands(PRHandle handle, PRDriverAuxCommand * commands, uint8_t numCommands, uint8_t startingAddr)
{ {
return handleAsDevice->DriverAuxSendCommands(commands, numCommands, startingAddr); return handleAsDevice->DriverAuxSendCommands(commands, numCommands, startingAddr);
} }
PR_EXPORT void PRDriverAuxPrepareOutput(PRDriverAuxCommand *auxCommand, uint8_t data, uint8_t extraData, uint8_t enables, bool_t muxEnables, uint16_t delayTime) void PRDriverAuxPrepareOutput(PRDriverAuxCommand *auxCommand, uint8_t data, uint8_t extraData, uint8_t enables, bool_t muxEnables, uint16_t delayTime)
{ {
auxCommand->active = true; auxCommand->active = true;
auxCommand->data = data; auxCommand->data = data;
@@ -230,7 +230,7 @@ PR_EXPORT void PRDriverAuxPrepareOutput(PRDriverAuxCommand *auxCommand, uint8_t
auxCommand->delayTime = delayTime; auxCommand->delayTime = delayTime;
} }
PR_EXPORT void PRDriverAuxPrepareDelay(PRDriverAuxCommand *auxCommand, uint16_t delayTime) void PRDriverAuxPrepareDelay(PRDriverAuxCommand *auxCommand, uint16_t delayTime)
{ {
auxCommand->active = true; auxCommand->active = true;
auxCommand->delayTime = delayTime; auxCommand->delayTime = delayTime;
@@ -241,7 +241,7 @@ PR_EXPORT void PRDriverAuxPrepareDelay(PRDriverAuxCommand *auxCommand, uint16_t
auxCommand->muxEnables = false; auxCommand->muxEnables = false;
} }
PR_EXPORT void PRDriverAuxPrepareJump(PRDriverAuxCommand *auxCommand, uint8_t jumpAddr) void PRDriverAuxPrepareJump(PRDriverAuxCommand *auxCommand, uint8_t jumpAddr)
{ {
auxCommand->active = true; auxCommand->active = true;
auxCommand->jumpAddr = jumpAddr; auxCommand->jumpAddr = jumpAddr;
@@ -252,7 +252,7 @@ PR_EXPORT void PRDriverAuxPrepareJump(PRDriverAuxCommand *auxCommand, uint8_t ju
auxCommand->muxEnables = false; auxCommand->muxEnables = false;
} }
PR_EXPORT void PRDriverAuxPrepareDisable(PRDriverAuxCommand *auxCommand) void PRDriverAuxPrepareDisable(PRDriverAuxCommand *auxCommand)
{ {
auxCommand->active = false; auxCommand->active = false;
auxCommand->data = 0; auxCommand->data = 0;
@@ -261,16 +261,16 @@ PR_EXPORT void PRDriverAuxPrepareDisable(PRDriverAuxCommand *auxCommand)
auxCommand->muxEnables = false; auxCommand->muxEnables = false;
} }
PR_EXPORT PRResult PRDriverWatchdogTickle(PRHandle handle) PRResult PRDriverWatchdogTickle(PRHandle handle)
{ {
return handleAsDevice->DriverWatchdogTickle(); return handleAsDevice->DriverWatchdogTickle();
} }
PR_EXPORT void PRDriverGroupStateDisable(PRDriverGroupConfig *driverGroup) void PRDriverGroupStateDisable(PRDriverGroupConfig *driverGroup)
{ {
driverGroup->active = false; driverGroup->active = false;
} }
PR_EXPORT void PRDriverStateDisable(PRDriverState *driver) void PRDriverStateDisable(PRDriverState *driver)
{ {
driver->state = 0; driver->state = 0;
driver->timeslots = 0; driver->timeslots = 0;
@@ -280,7 +280,7 @@ PR_EXPORT void PRDriverStateDisable(PRDriverState *driver)
driver->patterOffTime = 0; driver->patterOffTime = 0;
driver->patterEnable = false; driver->patterEnable = false;
} }
PR_EXPORT void PRDriverStatePulse(PRDriverState *driver, uint8_t milliseconds) void PRDriverStatePulse(PRDriverState *driver, uint8_t milliseconds)
{ {
driver->state = 1; driver->state = 1;
driver->timeslots = 0; driver->timeslots = 0;
@@ -290,7 +290,7 @@ PR_EXPORT void PRDriverStatePulse(PRDriverState *driver, uint8_t milliseconds)
driver->patterOffTime = 0; driver->patterOffTime = 0;
driver->patterEnable = false; driver->patterEnable = false;
} }
PR_EXPORT void PRDriverStateSchedule(PRDriverState *driver, uint32_t schedule, uint8_t cycleSeconds, bool_t now) void PRDriverStateSchedule(PRDriverState *driver, uint32_t schedule, uint8_t cycleSeconds, bool_t now)
{ {
driver->state = 1; driver->state = 1;
driver->timeslots = schedule; driver->timeslots = schedule;
@@ -300,7 +300,7 @@ PR_EXPORT void PRDriverStateSchedule(PRDriverState *driver, uint32_t schedule, u
driver->patterOffTime = 0; driver->patterOffTime = 0;
driver->patterEnable = false; driver->patterEnable = false;
} }
PR_EXPORT void PRDriverStatePatter(PRDriverState *driver, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime) void PRDriverStatePatter(PRDriverState *driver, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime)
{ {
driver->state = true; driver->state = true;
driver->timeslots = 0; driver->timeslots = 0;
@@ -311,7 +311,7 @@ PR_EXPORT void PRDriverStatePatter(PRDriverState *driver, uint8_t millisecondsOn
driver->patterEnable = true; driver->patterEnable = true;
} }
PR_EXPORT void PRDriverStatePulsedPatter(PRDriverState *driver, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t patterTime) void PRDriverStatePulsedPatter(PRDriverState *driver, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t patterTime)
{ {
driver->state = false; driver->state = false;
driver->timeslots = 0; driver->timeslots = 0;
@@ -322,7 +322,7 @@ PR_EXPORT void PRDriverStatePulsedPatter(PRDriverState *driver, uint8_t millisec
driver->patterEnable = true; driver->patterEnable = true;
} }
PR_EXPORT uint16_t PRDecode(PRMachineType machineType, const char *str) uint16_t PRDecode(PRMachineType machineType, const char *str)
{ {
uint16_t x; uint16_t x;
@@ -492,55 +492,55 @@ PR_EXPORT uint16_t PRDecode(PRMachineType machineType, const char *str)
// Switches // Switches
PR_EXPORT PRResult PRSwitchUpdateConfig(PRHandle handle, PRSwitchConfig *switchConfig) PRResult PRSwitchUpdateConfig(PRHandle handle, PRSwitchConfig *switchConfig)
{ {
return handleAsDevice->SwitchUpdateConfig(switchConfig); return handleAsDevice->SwitchUpdateConfig(switchConfig);
} }
PR_EXPORT PRResult PRSwitchUpdateRule(PRHandle handle, uint8_t switchNum, PREventType eventType, PRSwitchRule *rule, PRDriverState *linkedDrivers, int numDrivers) PRResult PRSwitchUpdateRule(PRHandle handle, uint8_t switchNum, PREventType eventType, PRSwitchRule *rule, PRDriverState *linkedDrivers, int numDrivers)
{ {
return handleAsDevice->SwitchUpdateRule(switchNum, eventType, rule, linkedDrivers, numDrivers); return handleAsDevice->SwitchUpdateRule(switchNum, eventType, rule, linkedDrivers, numDrivers);
} }
PR_EXPORT PRResult PRSwitchGetStates(PRHandle handle, PREventType * switchStates, uint16_t numSwitches) PRResult PRSwitchGetStates(PRHandle handle, PREventType * switchStates, uint16_t numSwitches)
{ {
return handleAsDevice->SwitchGetStates(switchStates, numSwitches); return handleAsDevice->SwitchGetStates(switchStates, numSwitches);
} }
// DMD // DMD
PR_EXPORT int32_t PRDMDUpdateConfig(PRHandle handle, PRDMDConfig *dmdConfig) int32_t PRDMDUpdateConfig(PRHandle handle, PRDMDConfig *dmdConfig)
{ {
return handleAsDevice->DMDUpdateConfig(dmdConfig); return handleAsDevice->DMDUpdateConfig(dmdConfig);
} }
PR_EXPORT PRResult PRDMDDraw(PRHandle handle, uint8_t * dots) PRResult PRDMDDraw(PRHandle handle, uint8_t * dots)
{ {
return handleAsDevice->DMDDraw(dots); return handleAsDevice->DMDDraw(dots);
} }
// JTAG // JTAG
PR_EXPORT PRResult PRJTAGDriveOutputs(PRHandle handle, PRJTAGOutputs * jtagOutputs, bool_t toggleClk) PRResult PRJTAGDriveOutputs(PRHandle handle, PRJTAGOutputs * jtagOutputs, bool_t toggleClk)
{ {
return handleAsDevice->PRJTAGDriveOutputs(jtagOutputs, toggleClk); return handleAsDevice->PRJTAGDriveOutputs(jtagOutputs, toggleClk);
} }
PR_EXPORT PRResult PRJTAGWriteTDOMemory(PRHandle handle, uint16_t tableOffset, uint16_t numWords, uint32_t * tdoData) PRResult PRJTAGWriteTDOMemory(PRHandle handle, uint16_t tableOffset, uint16_t numWords, uint32_t * tdoData)
{ {
return handleAsDevice->PRJTAGWriteTDOMemory(tableOffset, numWords, tdoData); return handleAsDevice->PRJTAGWriteTDOMemory(tableOffset, numWords, tdoData);
} }
PR_EXPORT PRResult PRJTAGShiftTDOData(PRHandle handle, uint16_t numBits, bool_t dataBlockComplete) PRResult PRJTAGShiftTDOData(PRHandle handle, uint16_t numBits, bool_t dataBlockComplete)
{ {
return handleAsDevice->PRJTAGShiftTDOData(numBits, dataBlockComplete); return handleAsDevice->PRJTAGShiftTDOData(numBits, dataBlockComplete);
} }
PR_EXPORT PRResult PRJTAGReadTDIMemory(PRHandle handle, uint16_t tableOffset, uint16_t numWords, uint32_t * tdiData) PRResult PRJTAGReadTDIMemory(PRHandle handle, uint16_t tableOffset, uint16_t numWords, uint32_t * tdiData)
{ {
return handleAsDevice->PRJTAGReadTDIMemory(tableOffset, numWords, tdiData); return handleAsDevice->PRJTAGReadTDIMemory(tableOffset, numWords, tdiData);
} }
PR_EXPORT PRResult PRJTAGGetStatus(PRHandle handle, PRJTAGStatus * status) PRResult PRJTAGGetStatus(PRHandle handle, PRJTAGStatus * status)
{ {
return handleAsDevice->PRJTAGGetStatus(status); return handleAsDevice->PRJTAGGetStatus(status);
} }

52
src/pinproc.def Normal file
View File

@@ -0,0 +1,52 @@
LIBRARY "pinproc.dll"
DESCRIPTION "PinPROC library. See http://www.pinballcontrollers.com/"
EXPORTS
; since API/SO version 0.9
PRCreate @1
PRDMDDraw @2
PRDMDUpdateConfig @3
PRDecode @4
PRDelete @5
PRDriverAuxPrepareDelay @6
PRDriverAuxPrepareDisable @7
PRDriverAuxPrepareJump @8
PRDriverAuxPrepareOutput @9
PRDriverAuxSendCommands @10
PRDriverDisable @11
PRDriverGetGroupConfig @12
PRDriverGetState @13
PRDriverGroupDisable @14
PRDriverGroupStateDisable @15
PRDriverLoadMachineTypeDefaults @16
PRDriverPatter @17
PRDriverPulse @18
PRDriverPulsedPatter @19
PRDriverSchedule @20
PRDriverStateDisable @21
PRDriverStatePatter @22
PRDriverStatePulse @23
PRDriverStatePulsedPatter @24
PRDriverStateSchedule @25
PRDriverUpdateGlobalConfig @26
PRDriverUpdateGroupConfig @27
PRDriverUpdateState @28
PRDriverWatchdogTickle @29
PRFlushWriteData @30
PRGetEvents @31
PRGetLastErrorText @32
PRJTAGDriveOutputs @33
PRJTAGGetStatus @34
PRJTAGReadTDIMemory @35
PRJTAGShiftTDOData @36
PRJTAGWriteTDOMemory @37
PRLogSetCallback @38
PRLogSetLevel @39
PRManagerUpdateConfig @40
PRReadData @41
PRReset @42
PRSwitchGetStates @43
PRSwitchUpdateConfig @44
PRSwitchUpdateRule @45
PRWriteData @46

View File

@@ -3,9 +3,11 @@
/* abstract: This file contains a description of the */ /* abstract: This file contains a description of the */
/* data structure "lenval". */ /* data structure "lenval". */
/*******************************************************/ /*******************************************************/
#ifndef PINPROCFW_LENVAL_H
#ifndef lenval_dot_h #define PINPROCFW_LENVAL_H
#define lenval_dot_h #if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
/* the lenVal structure is a byte oriented type used to store an */ /* the lenVal structure is a byte oriented type used to store an */
/* arbitrary length binary value. As an example, the hex value */ /* arbitrary length binary value. As an example, the hex value */
@@ -90,5 +92,4 @@ extern void SetBit(lenVal *lv, int byte, int bit, short val);
/* read from XSVF numBytes bytes of data into x */ /* read from XSVF numBytes bytes of data into x */
extern void readVal(lenVal *x, short numBytes); extern void readVal(lenVal *x, short numBytes);
#endif #endif /* PINPROCFW_LENVAL_H */

View File

@@ -1271,7 +1271,7 @@ int xsvfDoXSIR2( SXsvfInfo* pXsvfInfo )
readVal( &(pXsvfInfo->lvTdi), 2 ); readVal( &(pXsvfInfo->lvTdi), 2 );
lShiftIrBits = value( &(pXsvfInfo->lvTdi) ); lShiftIrBits = value( &(pXsvfInfo->lvTdi) );
sShiftIrBytes = xsvfGetAsNumBytes( lShiftIrBits ); sShiftIrBytes = xsvfGetAsNumBytes( lShiftIrBits );
XSVFDBG_PRINTF1( 3, " XSIR2 length = %d\n", (int)lShiftIrBits); XSVFDBG_PRINTF1( 3, " XSIR2 length = %ld\n", lShiftIrBits);
if ( sShiftIrBytes > MAX_LEN ) if ( sShiftIrBytes > MAX_LEN )
{ {

View File

@@ -10,8 +10,11 @@
* in the readByte() function. * in the readByte() function.
* FINALLY - Call xsvfExecute(). * FINALLY - Call xsvfExecute().
*****************************************************************************/ *****************************************************************************/
#ifndef PINPROCFW_H #ifndef PINPROCFW_PINPROCFW_H
#define PINPROCFW_H #define PINPROCFW_PINPROCFW_H
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
#if defined(__WIN32__) || defined(_WIN32) #if defined(__WIN32__) || defined(_WIN32)
#include <windows.h> #include <windows.h>
@@ -67,5 +70,4 @@ void readByte(unsigned char *data);
void waitTime(long microsec); void waitTime(long microsec);
#endif /* PINPROCFW_H */ #endif /* PINPROCFW_PINPROCFW_H */