Initial commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 3.7
|
||||
|
||||
# Relative path conversion top directories.
|
||||
set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/root/projekti/CyUSB/libcyusbserial-master")
|
||||
set(CMAKE_RELATIVE_PATH_TOP_BINARY "/root/projekti/CyUSB/libcyusbserial-master")
|
||||
|
||||
# Force unix paths in dependencies.
|
||||
set(CMAKE_FORCE_UNIX_PATHS 1)
|
||||
|
||||
|
||||
# The C and CXX include file regular expressions for this directory.
|
||||
set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$")
|
||||
set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$")
|
||||
set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})
|
||||
set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})
|
||||
@@ -0,0 +1,36 @@
|
||||
#IncludeRegexLine: ^[ ]*#[ ]*(include|import)[ ]*[<"]([^">]+)([">])
|
||||
|
||||
#IncludeRegexScan: ^.*$
|
||||
|
||||
#IncludeRegexComplain: ^$
|
||||
|
||||
#IncludeRegexTransform:
|
||||
|
||||
/root/projekti/CyUSB/libcyusbserial-master/tools/cyusbserialtest.c
|
||||
stdio.h
|
||||
-
|
||||
unistd.h
|
||||
-
|
||||
stdlib.h
|
||||
-
|
||||
getopt.h
|
||||
-
|
||||
string.h
|
||||
-
|
||||
signal.h
|
||||
-
|
||||
stdbool.h
|
||||
-
|
||||
unistd.h
|
||||
-
|
||||
sys/time.h
|
||||
-
|
||||
pthread.h
|
||||
-
|
||||
ctype.h
|
||||
-
|
||||
CyUSBSerial.h
|
||||
/root/projekti/CyUSB/libcyusbserial-master/tools/CyUSBSerial.h
|
||||
|
||||
include/CyUSBSerial.h
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# The set of languages for which implicit dependencies are needed:
|
||||
set(CMAKE_DEPENDS_LANGUAGES
|
||||
"C"
|
||||
)
|
||||
# The set of files for implicit dependencies of each language:
|
||||
set(CMAKE_DEPENDS_CHECK_C
|
||||
"/root/projekti/CyUSB/libcyusbserial-master/tools/cyusbserialtest.c" "/root/projekti/CyUSB/libcyusbserial-master/tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o"
|
||||
)
|
||||
set(CMAKE_C_COMPILER_ID "GNU")
|
||||
|
||||
# The include file search paths:
|
||||
set(CMAKE_C_TARGET_INCLUDE_PATH
|
||||
"include"
|
||||
)
|
||||
|
||||
# Targets to which this target links.
|
||||
set(CMAKE_TARGET_LINKED_INFO_FILES
|
||||
"/root/projekti/CyUSB/libcyusbserial-master/lib/CMakeFiles/cyusbserial.dir/DependInfo.cmake"
|
||||
)
|
||||
|
||||
# Fortran module output directory.
|
||||
set(CMAKE_Fortran_TARGET_MODULE_DIR "")
|
||||
@@ -0,0 +1,115 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 3.7
|
||||
|
||||
# Delete rule output on recipe failure.
|
||||
.DELETE_ON_ERROR:
|
||||
|
||||
|
||||
#=============================================================================
|
||||
# Special targets provided by cmake.
|
||||
|
||||
# Disable implicit rules so canonical targets will work.
|
||||
.SUFFIXES:
|
||||
|
||||
|
||||
# Remove some rules from gmake that .SUFFIXES does not remove.
|
||||
SUFFIXES =
|
||||
|
||||
.SUFFIXES: .hpux_make_needs_suffix_list
|
||||
|
||||
|
||||
# Suppress display of executed commands.
|
||||
$(VERBOSE).SILENT:
|
||||
|
||||
|
||||
# A target that is always out of date.
|
||||
cmake_force:
|
||||
|
||||
.PHONY : cmake_force
|
||||
|
||||
#=============================================================================
|
||||
# Set environment variables for the build.
|
||||
|
||||
# The shell in which to execute make rules.
|
||||
SHELL = /bin/sh
|
||||
|
||||
# The CMake executable.
|
||||
CMAKE_COMMAND = /usr/bin/cmake
|
||||
|
||||
# The command to remove a file.
|
||||
RM = /usr/bin/cmake -E remove -f
|
||||
|
||||
# Escaping for special characters.
|
||||
EQUALS = =
|
||||
|
||||
# The top-level source directory on which CMake was run.
|
||||
CMAKE_SOURCE_DIR = /root/projekti/CyUSB/libcyusbserial-master
|
||||
|
||||
# The top-level build directory on which CMake was run.
|
||||
CMAKE_BINARY_DIR = /root/projekti/CyUSB/libcyusbserial-master
|
||||
|
||||
# Include any dependencies generated for this target.
|
||||
include tools/CMakeFiles/cyusbserialtest.dir/depend.make
|
||||
|
||||
# Include the progress variables for this target.
|
||||
include tools/CMakeFiles/cyusbserialtest.dir/progress.make
|
||||
|
||||
# Include the compile flags for this target's objects.
|
||||
include tools/CMakeFiles/cyusbserialtest.dir/flags.make
|
||||
|
||||
tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o: tools/CMakeFiles/cyusbserialtest.dir/flags.make
|
||||
tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o: tools/cyusbserialtest.c
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/root/projekti/CyUSB/libcyusbserial-master/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o"
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master/tools && /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -o CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o -c /root/projekti/CyUSB/libcyusbserial-master/tools/cyusbserialtest.c
|
||||
|
||||
tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.i: cmake_force
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.i"
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master/tools && /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /root/projekti/CyUSB/libcyusbserial-master/tools/cyusbserialtest.c > CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.i
|
||||
|
||||
tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.s: cmake_force
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.s"
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master/tools && /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /root/projekti/CyUSB/libcyusbserial-master/tools/cyusbserialtest.c -o CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.s
|
||||
|
||||
tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o.requires:
|
||||
|
||||
.PHONY : tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o.requires
|
||||
|
||||
tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o.provides: tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o.requires
|
||||
$(MAKE) -f tools/CMakeFiles/cyusbserialtest.dir/build.make tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o.provides.build
|
||||
.PHONY : tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o.provides
|
||||
|
||||
tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o.provides.build: tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o
|
||||
|
||||
|
||||
# Object files for target cyusbserialtest
|
||||
cyusbserialtest_OBJECTS = \
|
||||
"CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o"
|
||||
|
||||
# External object files for target cyusbserialtest
|
||||
cyusbserialtest_EXTERNAL_OBJECTS =
|
||||
|
||||
tools/cyusbserialtest: tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o
|
||||
tools/cyusbserialtest: tools/CMakeFiles/cyusbserialtest.dir/build.make
|
||||
tools/cyusbserialtest: lib/libcyusbserial.so.1
|
||||
tools/cyusbserialtest: /usr/local/lib/libusb-1.0.so
|
||||
tools/cyusbserialtest: tools/CMakeFiles/cyusbserialtest.dir/link.txt
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/root/projekti/CyUSB/libcyusbserial-master/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking C executable cyusbserialtest"
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master/tools && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/cyusbserialtest.dir/link.txt --verbose=$(VERBOSE)
|
||||
|
||||
# Rule to build all files generated by this target.
|
||||
tools/CMakeFiles/cyusbserialtest.dir/build: tools/cyusbserialtest
|
||||
|
||||
.PHONY : tools/CMakeFiles/cyusbserialtest.dir/build
|
||||
|
||||
tools/CMakeFiles/cyusbserialtest.dir/requires: tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o.requires
|
||||
|
||||
.PHONY : tools/CMakeFiles/cyusbserialtest.dir/requires
|
||||
|
||||
tools/CMakeFiles/cyusbserialtest.dir/clean:
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master/tools && $(CMAKE_COMMAND) -P CMakeFiles/cyusbserialtest.dir/cmake_clean.cmake
|
||||
.PHONY : tools/CMakeFiles/cyusbserialtest.dir/clean
|
||||
|
||||
tools/CMakeFiles/cyusbserialtest.dir/depend:
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /root/projekti/CyUSB/libcyusbserial-master /root/projekti/CyUSB/libcyusbserial-master/tools /root/projekti/CyUSB/libcyusbserial-master /root/projekti/CyUSB/libcyusbserial-master/tools /root/projekti/CyUSB/libcyusbserial-master/tools/CMakeFiles/cyusbserialtest.dir/DependInfo.cmake --color=$(COLOR)
|
||||
.PHONY : tools/CMakeFiles/cyusbserialtest.dir/depend
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
file(REMOVE_RECURSE
|
||||
"CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o"
|
||||
"cyusbserialtest.pdb"
|
||||
"cyusbserialtest"
|
||||
)
|
||||
|
||||
# Per-language clean rules from dependency scanning.
|
||||
foreach(lang C)
|
||||
include(CMakeFiles/cyusbserialtest.dir/cmake_clean_${lang}.cmake OPTIONAL)
|
||||
endforeach()
|
||||
@@ -0,0 +1,6 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 3.7
|
||||
|
||||
tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o
|
||||
/root/projekti/CyUSB/libcyusbserial-master/tools/cyusbserialtest.c
|
||||
include/CyUSBSerial.h
|
||||
@@ -0,0 +1,6 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 3.7
|
||||
|
||||
tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o: tools/cyusbserialtest.c
|
||||
tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o: include/CyUSBSerial.h
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 3.7
|
||||
|
||||
# compile C with /usr/bin/cc
|
||||
C_FLAGS = -Wall -Wextra -Wno-unused-parameter
|
||||
|
||||
C_DEFINES =
|
||||
|
||||
C_INCLUDES = -I/root/projekti/CyUSB/libcyusbserial-master/include
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
/usr/bin/cc CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o -o cyusbserialtest -Wl,-rpath,/root/projekti/CyUSB/libcyusbserial-master/lib:/usr/local/lib: -rdynamic ../lib/libcyusbserial.so.1 /usr/local/lib/libusb-1.0.so
|
||||
@@ -0,0 +1,3 @@
|
||||
CMAKE_PROGRESS_1 = 9
|
||||
CMAKE_PROGRESS_2 = 10
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
10
|
||||
@@ -0,0 +1,23 @@
|
||||
add_executable(cyusbserialtest cyusbserialtest.c)
|
||||
|
||||
################################################################################
|
||||
# Version information
|
||||
################################################################################
|
||||
|
||||
set(VERSION_INFO_MAJOR 0)
|
||||
set(VERSION_INFO_MINOR 0)
|
||||
set(VERSION_INFO_PATCH 1)
|
||||
|
||||
################################################################################
|
||||
# Link libraries
|
||||
################################################################################
|
||||
target_link_libraries(cyusbserialtest LINK_PUBLIC cyusbserial)
|
||||
|
||||
################################################################################
|
||||
# Installation
|
||||
################################################################################
|
||||
if(NOT DEFINED BIN_INSTALL_DIR)
|
||||
set(BIN_INSTALL_DIR bin)
|
||||
endif()
|
||||
|
||||
install(TARGETS cyusbserialtest DESTINATION ${BIN_INSTALL_DIR})
|
||||
@@ -0,0 +1,228 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 3.7
|
||||
|
||||
# Default target executed when no arguments are given to make.
|
||||
default_target: all
|
||||
|
||||
.PHONY : default_target
|
||||
|
||||
# Allow only one "make -f Makefile2" at a time, but pass parallelism.
|
||||
.NOTPARALLEL:
|
||||
|
||||
|
||||
#=============================================================================
|
||||
# Special targets provided by cmake.
|
||||
|
||||
# Disable implicit rules so canonical targets will work.
|
||||
.SUFFIXES:
|
||||
|
||||
|
||||
# Remove some rules from gmake that .SUFFIXES does not remove.
|
||||
SUFFIXES =
|
||||
|
||||
.SUFFIXES: .hpux_make_needs_suffix_list
|
||||
|
||||
|
||||
# Suppress display of executed commands.
|
||||
$(VERBOSE).SILENT:
|
||||
|
||||
|
||||
# A target that is always out of date.
|
||||
cmake_force:
|
||||
|
||||
.PHONY : cmake_force
|
||||
|
||||
#=============================================================================
|
||||
# Set environment variables for the build.
|
||||
|
||||
# The shell in which to execute make rules.
|
||||
SHELL = /bin/sh
|
||||
|
||||
# The CMake executable.
|
||||
CMAKE_COMMAND = /usr/bin/cmake
|
||||
|
||||
# The command to remove a file.
|
||||
RM = /usr/bin/cmake -E remove -f
|
||||
|
||||
# Escaping for special characters.
|
||||
EQUALS = =
|
||||
|
||||
# The top-level source directory on which CMake was run.
|
||||
CMAKE_SOURCE_DIR = /root/projekti/CyUSB/libcyusbserial-master
|
||||
|
||||
# The top-level build directory on which CMake was run.
|
||||
CMAKE_BINARY_DIR = /root/projekti/CyUSB/libcyusbserial-master
|
||||
|
||||
#=============================================================================
|
||||
# Targets provided globally by CMake.
|
||||
|
||||
# Special rule for the target install/strip
|
||||
install/strip: preinstall
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
|
||||
/usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
|
||||
.PHONY : install/strip
|
||||
|
||||
# Special rule for the target install/strip
|
||||
install/strip/fast: install/strip
|
||||
|
||||
.PHONY : install/strip/fast
|
||||
|
||||
# Special rule for the target install/local
|
||||
install/local: preinstall
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
|
||||
/usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
|
||||
.PHONY : install/local
|
||||
|
||||
# Special rule for the target install/local
|
||||
install/local/fast: install/local
|
||||
|
||||
.PHONY : install/local/fast
|
||||
|
||||
# Special rule for the target install
|
||||
install: preinstall
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
|
||||
/usr/bin/cmake -P cmake_install.cmake
|
||||
.PHONY : install
|
||||
|
||||
# Special rule for the target install
|
||||
install/fast: preinstall/fast
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
|
||||
/usr/bin/cmake -P cmake_install.cmake
|
||||
.PHONY : install/fast
|
||||
|
||||
# Special rule for the target list_install_components
|
||||
list_install_components:
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
|
||||
.PHONY : list_install_components
|
||||
|
||||
# Special rule for the target list_install_components
|
||||
list_install_components/fast: list_install_components
|
||||
|
||||
.PHONY : list_install_components/fast
|
||||
|
||||
# Special rule for the target edit_cache
|
||||
edit_cache:
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."
|
||||
/usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
|
||||
.PHONY : edit_cache
|
||||
|
||||
# Special rule for the target edit_cache
|
||||
edit_cache/fast: edit_cache
|
||||
|
||||
.PHONY : edit_cache/fast
|
||||
|
||||
# Special rule for the target rebuild_cache
|
||||
rebuild_cache:
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
|
||||
/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
|
||||
.PHONY : rebuild_cache
|
||||
|
||||
# Special rule for the target rebuild_cache
|
||||
rebuild_cache/fast: rebuild_cache
|
||||
|
||||
.PHONY : rebuild_cache/fast
|
||||
|
||||
# The main all target
|
||||
all: cmake_check_build_system
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master && $(CMAKE_COMMAND) -E cmake_progress_start /root/projekti/CyUSB/libcyusbserial-master/CMakeFiles /root/projekti/CyUSB/libcyusbserial-master/tools/CMakeFiles/progress.marks
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master && $(MAKE) -f CMakeFiles/Makefile2 tools/all
|
||||
$(CMAKE_COMMAND) -E cmake_progress_start /root/projekti/CyUSB/libcyusbserial-master/CMakeFiles 0
|
||||
.PHONY : all
|
||||
|
||||
# The main clean target
|
||||
clean:
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master && $(MAKE) -f CMakeFiles/Makefile2 tools/clean
|
||||
.PHONY : clean
|
||||
|
||||
# The main clean target
|
||||
clean/fast: clean
|
||||
|
||||
.PHONY : clean/fast
|
||||
|
||||
# Prepare targets for installation.
|
||||
preinstall: all
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master && $(MAKE) -f CMakeFiles/Makefile2 tools/preinstall
|
||||
.PHONY : preinstall
|
||||
|
||||
# Prepare targets for installation.
|
||||
preinstall/fast:
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master && $(MAKE) -f CMakeFiles/Makefile2 tools/preinstall
|
||||
.PHONY : preinstall/fast
|
||||
|
||||
# clear depends
|
||||
depend:
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
|
||||
.PHONY : depend
|
||||
|
||||
# Convenience name for target.
|
||||
tools/CMakeFiles/cyusbserialtest.dir/rule:
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master && $(MAKE) -f CMakeFiles/Makefile2 tools/CMakeFiles/cyusbserialtest.dir/rule
|
||||
.PHONY : tools/CMakeFiles/cyusbserialtest.dir/rule
|
||||
|
||||
# Convenience name for target.
|
||||
cyusbserialtest: tools/CMakeFiles/cyusbserialtest.dir/rule
|
||||
|
||||
.PHONY : cyusbserialtest
|
||||
|
||||
# fast build rule for target.
|
||||
cyusbserialtest/fast:
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master && $(MAKE) -f tools/CMakeFiles/cyusbserialtest.dir/build.make tools/CMakeFiles/cyusbserialtest.dir/build
|
||||
.PHONY : cyusbserialtest/fast
|
||||
|
||||
cyusbserialtest.o: cyusbserialtest.c.o
|
||||
|
||||
.PHONY : cyusbserialtest.o
|
||||
|
||||
# target to build an object file
|
||||
cyusbserialtest.c.o:
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master && $(MAKE) -f tools/CMakeFiles/cyusbserialtest.dir/build.make tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.o
|
||||
.PHONY : cyusbserialtest.c.o
|
||||
|
||||
cyusbserialtest.i: cyusbserialtest.c.i
|
||||
|
||||
.PHONY : cyusbserialtest.i
|
||||
|
||||
# target to preprocess a source file
|
||||
cyusbserialtest.c.i:
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master && $(MAKE) -f tools/CMakeFiles/cyusbserialtest.dir/build.make tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.i
|
||||
.PHONY : cyusbserialtest.c.i
|
||||
|
||||
cyusbserialtest.s: cyusbserialtest.c.s
|
||||
|
||||
.PHONY : cyusbserialtest.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
cyusbserialtest.c.s:
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master && $(MAKE) -f tools/CMakeFiles/cyusbserialtest.dir/build.make tools/CMakeFiles/cyusbserialtest.dir/cyusbserialtest.c.s
|
||||
.PHONY : cyusbserialtest.c.s
|
||||
|
||||
# Help Target
|
||||
help:
|
||||
@echo "The following are some of the valid targets for this Makefile:"
|
||||
@echo "... all (the default if no target is provided)"
|
||||
@echo "... clean"
|
||||
@echo "... depend"
|
||||
@echo "... install/strip"
|
||||
@echo "... install/local"
|
||||
@echo "... install"
|
||||
@echo "... list_install_components"
|
||||
@echo "... cyusbserialtest"
|
||||
@echo "... edit_cache"
|
||||
@echo "... rebuild_cache"
|
||||
@echo "... cyusbserialtest.o"
|
||||
@echo "... cyusbserialtest.i"
|
||||
@echo "... cyusbserialtest.s"
|
||||
.PHONY : help
|
||||
|
||||
|
||||
|
||||
#=============================================================================
|
||||
# Special targets to cleanup operation of make.
|
||||
|
||||
# Special rule to run CMake to check the build system integrity.
|
||||
# No rule that depends on this can have commands that come from listfiles
|
||||
# because they might be regenerated.
|
||||
cmake_check_build_system:
|
||||
cd /root/projekti/CyUSB/libcyusbserial-master && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
|
||||
.PHONY : cmake_check_build_system
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
================================================================================
|
||||
Cypress Semiconductor Corporation
|
||||
CyUSB Serial DVK test utility for I2C/SPI
|
||||
================================================================================
|
||||
|
||||
This utility is used for testing I2C/SPI master mode functionality on the
|
||||
Cypress CyUSBSerial DVK.
|
||||
|
||||
The utility writes to I2C/SPI flash devices on the DVK, reads the data back
|
||||
and verifies the data read for integrity.
|
||||
|
||||
|
||||
Using the test utility:
|
||||
================================================================================
|
||||
1. On starting the utility, the Cypress USB Serial devices that are connected
|
||||
are listed along with their device numbers, interface numbers and
|
||||
functionalities (SPI or I2C).
|
||||
|
||||
$ CyUSBSerial
|
||||
----------------------------------------------------------------------
|
||||
Device Number | VID | PID | INTERFACE NUMBER | FUNCTIONALITY
|
||||
----------------------------------------------------------------------
|
||||
0 |4b4 |a | 0 | VENDOR_I2C
|
||||
0 |4b4 |a | 1 | VENDOR_SPI
|
||||
0 |4b4 |a | 2 | NA
|
||||
----------------------------------------------------------------------
|
||||
|
||||
2. A menu providing the various operations is also printed:
|
||||
----------------------------------------------------------------------
|
||||
1: Print list of devices
|
||||
2: Select device...No device selected !!
|
||||
3: Enter I2C/SPI Flash page address and length to write/read.
|
||||
4: Verify data
|
||||
5: Exit
|
||||
----------------------------------------------------------------------
|
||||
|
||||
3. On selecting option 2, the utility prompts for the device and interface
|
||||
number to be selected for testing.
|
||||
|
||||
-----------------------------------
|
||||
Enter Device number to select:
|
||||
0
|
||||
Enter interface number:
|
||||
1
|
||||
-----------------------------------
|
||||
|
||||
Once the selections are made, the menu will be updated with the details.
|
||||
----------------------------------------------------------------------
|
||||
1: Print list of devices
|
||||
2: Change device selection--selected device: [Device number 0] : [Interface No 1] : SPI
|
||||
3: Enter I2C/SPI Flash page address and length to write/read.
|
||||
4: Verify data
|
||||
5: Exit
|
||||
----------------------------------------------------------------------
|
||||
|
||||
4. Option 3 can be selected now to do data read/write to the I2C/SPI flash
|
||||
device. The utility prompts for the page address to be written as well as
|
||||
the length of data to be written.
|
||||
|
||||
------------------------------------------------
|
||||
Enter Page address ... (less than 65536)
|
||||
1234
|
||||
Enter length to read/write ... (less than 256)
|
||||
32
|
||||
------------------------------------------------
|
||||
|
||||
Length needs to be less than or equal to 256 bytes in the case of SPI access,
|
||||
and less than or equal to 64 bytes in the case of I2C access. Page address
|
||||
needs to be less than 65536 in case of SPI and 256 in case of I2C.
|
||||
|
||||
Once the values are selected, the menu is updated with the details as below:
|
||||
-------------------------------------------------------------------
|
||||
1: Print list of devices
|
||||
2: Change device selection--selected device: [Device number 0] : [Interface No 1] : SPI
|
||||
3: Change Flash page address and length ...Entered is page address 1234 and length 123
|
||||
4: Verify data
|
||||
5: Exit
|
||||
-------------------------------------------------------------------
|
||||
|
||||
5. Selecting option 4 causes the utility to write a randomly generated data
|
||||
sequence to the flash device, read it back, and verify the data read back.
|
||||
|
||||
The data pattern written and read back will be displayed as shown below:
|
||||
--------------------------------------------------------------------
|
||||
67 c6 69 73 51 ff 4a ec 29 cd ba ab f2 fb e3 46 7c c2 54 f8 1b e8 e7 8d 76 5a 2e 63 33 9f c9 9a
|
||||
--------------------------------------------------------------------
|
||||
Data Read back is:
|
||||
---------------------------------------------------------------------
|
||||
67 c6 69 73 51 ff 4a ec 29 cd ba ab f2 fb e3 46 7c c2 54 f8 1b e8 e7 8d 76 5a 2e 63 33 9f c9 9a
|
||||
---------------------------------------------------------------------
|
||||
Data verified successfully
|
||||
-------------------------------------------------------------------
|
||||
|
||||
6. The utility runs through these menu options until the user selects the
|
||||
exit option (5).
|
||||
|
||||
================================================================================
|
||||
|
||||
EOF
|
||||
@@ -0,0 +1,54 @@
|
||||
# Install script for directory: /root/projekti/CyUSB/libcyusbserial-master/tools
|
||||
|
||||
# Set the install prefix
|
||||
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
|
||||
set(CMAKE_INSTALL_PREFIX "/usr/local")
|
||||
endif()
|
||||
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
# Set the install configuration name.
|
||||
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
|
||||
if(BUILD_TYPE)
|
||||
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
|
||||
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
|
||||
else()
|
||||
set(CMAKE_INSTALL_CONFIG_NAME "")
|
||||
endif()
|
||||
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
|
||||
endif()
|
||||
|
||||
# Set the component getting installed.
|
||||
if(NOT CMAKE_INSTALL_COMPONENT)
|
||||
if(COMPONENT)
|
||||
message(STATUS "Install component: \"${COMPONENT}\"")
|
||||
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
|
||||
else()
|
||||
set(CMAKE_INSTALL_COMPONENT)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Install shared libraries without execute permission?
|
||||
if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
|
||||
set(CMAKE_INSTALL_SO_NO_EXE "1")
|
||||
endif()
|
||||
|
||||
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT)
|
||||
if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/cyusbserialtest" AND
|
||||
NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/cyusbserialtest")
|
||||
file(RPATH_CHECK
|
||||
FILE "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/cyusbserialtest"
|
||||
RPATH "")
|
||||
endif()
|
||||
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/root/projekti/CyUSB/libcyusbserial-master/tools/cyusbserialtest")
|
||||
if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/cyusbserialtest" AND
|
||||
NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/cyusbserialtest")
|
||||
file(RPATH_CHANGE
|
||||
FILE "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/cyusbserialtest"
|
||||
OLD_RPATH "/root/projekti/CyUSB/libcyusbserial-master/lib:/usr/local/lib:"
|
||||
NEW_RPATH "")
|
||||
if(CMAKE_INSTALL_DO_STRIP)
|
||||
execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/cyusbserialtest")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
Executable
BIN
Binary file not shown.
@@ -0,0 +1,603 @@
|
||||
/*
|
||||
* Test utility
|
||||
* Copyright (C) 2013 Cypress Semiconductor
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <pthread.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "CyUSBSerial.h"
|
||||
#define CY_MAX_DEVICES 30
|
||||
#define CY_MAX_INTERFACES 4
|
||||
|
||||
typedef struct _CY_DEVICE_STRUCT {
|
||||
int deviceNumber;
|
||||
int interfaceFunctionality[CY_MAX_INTERFACES];
|
||||
bool isI2c;
|
||||
bool isSpi;
|
||||
int numInterface;
|
||||
}CY_DEVICE_STRUCT;
|
||||
|
||||
CY_DEVICE_STRUCT *glDevice;
|
||||
int i2cDeviceIndex[CY_MAX_DEVICES][CY_MAX_INTERFACES];
|
||||
unsigned char *deviceNumber = NULL;
|
||||
int cyDevices, i2cDevices = 0;
|
||||
UINT8 numDevices = 0;
|
||||
int selectedDeviceNum = -1, selectedInterfaceNum = -1;
|
||||
bool exitApp = false;
|
||||
short pageAddress = -1;
|
||||
short readWriteLength = -1;
|
||||
bool deviceAddedRemoved = false;
|
||||
|
||||
int i2cVerifyData (int deviceNumber, int interfaceNum);
|
||||
void printListOfDevices (bool isPrint);
|
||||
int spiVerifyData (int deviceNumber, int interfaceNum);
|
||||
|
||||
int getUserInput()
|
||||
{
|
||||
char userInput[6], x;
|
||||
int output,i = 0;
|
||||
bool isDigit = true;
|
||||
x = getchar();
|
||||
while (x != '\n'){
|
||||
if (i < 5){
|
||||
userInput[i] = x;
|
||||
i++;
|
||||
}
|
||||
if (!isdigit(x))
|
||||
isDigit = false;
|
||||
|
||||
x = getchar();
|
||||
}
|
||||
userInput[i] = '\0';
|
||||
if (isDigit == false)
|
||||
return -1;
|
||||
output = atoi(userInput);
|
||||
return output;
|
||||
}
|
||||
|
||||
void deviceHotPlug () {
|
||||
CY_RETURN_STATUS rStatus;
|
||||
deviceAddedRemoved = true;
|
||||
selectedDeviceNum = -1;
|
||||
selectedInterfaceNum = -1;
|
||||
printf ("Device of interest Removed/Added \n");
|
||||
rStatus = CyGetListofDevices (&numDevices);
|
||||
if (rStatus != CY_SUCCESS) {
|
||||
printf ("CY:Error in Getting List of Devices: Error NO:<%d> \n", rStatus);
|
||||
}
|
||||
printListOfDevices (false);
|
||||
}
|
||||
|
||||
int main (int argc, char **agrv)
|
||||
{
|
||||
int userInput;
|
||||
int tempSelectedDeviceNum, tempSelectedInterfaceNum, tempPageAddress, tempLength;
|
||||
CY_RETURN_STATUS rStatus;
|
||||
signal (SIGUSR1, deviceHotPlug);
|
||||
glDevice = (CY_DEVICE_STRUCT *)malloc (CY_MAX_DEVICES *sizeof (CY_DEVICE_STRUCT));
|
||||
if (glDevice == NULL){
|
||||
printf ("Memory allocation failed ...!! \n");
|
||||
return -1;
|
||||
}
|
||||
rStatus = CyLibraryInit ();
|
||||
if (rStatus != CY_SUCCESS) {
|
||||
printf ("CY:Error in Doing library init Error NO:<%d> \n", rStatus);
|
||||
return rStatus;
|
||||
}
|
||||
rStatus = CyGetListofDevices (&numDevices);
|
||||
if (rStatus != CY_SUCCESS) {
|
||||
printf ("CY:Error in Getting List of Devices: Error NO:<%d> \n", rStatus);
|
||||
return rStatus;
|
||||
}
|
||||
printListOfDevices(true);
|
||||
do {
|
||||
|
||||
printf ("-------------------------------------------------------------------\n");
|
||||
printf ("1: Print list of devices \n");
|
||||
if (selectedDeviceNum != -1 && selectedInterfaceNum != -1){
|
||||
printf ("2: Change device selection--selected device: [Device number %d] : [Interface No %d]",\
|
||||
selectedDeviceNum, selectedInterfaceNum);
|
||||
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_I2C)
|
||||
printf (" : I2C\n");
|
||||
else if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_SPI)
|
||||
printf (" : SPI\n");
|
||||
else
|
||||
printf (" : NA\n");
|
||||
|
||||
}
|
||||
else
|
||||
printf ("2: Select device...No device selected !!\n");
|
||||
|
||||
if (readWriteLength != -1 && pageAddress != -1){
|
||||
printf ("3: Change Flash page address and length ...Entered is page address %d and length %d\n", pageAddress, readWriteLength);
|
||||
printf ("4: Verify data\n5: Exit\n");
|
||||
}
|
||||
else
|
||||
printf ("3: Enter I2C/SPI Flash page address and length to write/read.\n4: Verify data\n5: Exit\n");
|
||||
printf ("-------------------------------------------------------------------\n");
|
||||
|
||||
userInput = getUserInput();
|
||||
if (userInput < 1 || userInput > 5){
|
||||
printf ("Wrong selection code ... Enter again \n");
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (userInput){
|
||||
|
||||
case 1:
|
||||
printListOfDevices(true);
|
||||
break;
|
||||
case 2:
|
||||
if (cyDevices == 0) {
|
||||
printf ("No device of interest connected ...!!\n");
|
||||
continue;
|
||||
}
|
||||
printf ("Enter Device number to be selected.. \n");
|
||||
tempSelectedDeviceNum = getUserInput();
|
||||
//printf ("Selected device number is %d \n",tempSelectedDeviceNum);
|
||||
if (tempSelectedDeviceNum >= cyDevices || tempSelectedDeviceNum == -1){
|
||||
printf ("Wrong device selection \n");
|
||||
continue;
|
||||
}
|
||||
printf ("Enter interface number..\n");
|
||||
tempSelectedInterfaceNum = getUserInput();
|
||||
//printf ("Selected device number is %d %d\n",tempSelectedInterfaceNum, glDevice[tempSelectedDeviceNum].numInterface);
|
||||
|
||||
if (tempSelectedInterfaceNum >= glDevice[tempSelectedDeviceNum].numInterface ||
|
||||
tempSelectedInterfaceNum == -1) {
|
||||
printf ("Wrong interface Selection selection \n");
|
||||
continue;
|
||||
}
|
||||
if (glDevice[tempSelectedDeviceNum].interfaceFunctionality[tempSelectedInterfaceNum] == -1){
|
||||
printf ("Selected device does not have I2C or SPI !!! \n");
|
||||
continue;
|
||||
}
|
||||
if (deviceAddedRemoved == true) {
|
||||
printf ("Device of interest was added/removed .... Print and select from new list\n");
|
||||
continue;
|
||||
}
|
||||
selectedDeviceNum = tempSelectedDeviceNum;
|
||||
selectedInterfaceNum = tempSelectedInterfaceNum;
|
||||
//pageAddress = -1;
|
||||
//readWriteLength = -1;
|
||||
break;
|
||||
case 3:
|
||||
if (selectedDeviceNum == -1) {
|
||||
printf ("Select proper device!!! \n");
|
||||
continue;
|
||||
}
|
||||
if (selectedDeviceNum >= cyDevices){
|
||||
printf ("Select proper device!!! \n");
|
||||
continue;
|
||||
}
|
||||
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_I2C){
|
||||
printf ("Enter Page address... (less than 256)\n");
|
||||
tempPageAddress = getUserInput();
|
||||
printf ("Enter length to read/write...(less than 64)\n");
|
||||
tempLength = getUserInput();
|
||||
if (deviceAddedRemoved == true) {
|
||||
printf ("Device of interest was added/removed .... Print and select from new list\n");
|
||||
continue;
|
||||
}
|
||||
if (tempPageAddress > 256){
|
||||
printf ("Invalid page address ..Enter page address less than 256 (1 bytes len)\n");
|
||||
continue;
|
||||
}
|
||||
if (tempLength < 0 || tempLength > 64){
|
||||
printf ("Invalid Length ..Enter length less than 64 bytes\n");
|
||||
continue;
|
||||
}
|
||||
pageAddress = tempPageAddress;
|
||||
readWriteLength = tempLength;
|
||||
break;
|
||||
}
|
||||
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_SPI){
|
||||
printf ("Enter Page address... (less than 65536)\n");
|
||||
tempPageAddress = getUserInput();
|
||||
printf ("Enter length to read/write...(less than 256)\n");
|
||||
tempLength = getUserInput();
|
||||
if (deviceAddedRemoved == true) {
|
||||
printf ("Device of interest was added/removed .... Print and select from new list\n");
|
||||
continue;
|
||||
}
|
||||
if (tempPageAddress > 65536){
|
||||
printf ("Invalid page address ..Enter page address less than 65536 (1 bytes len)\n");
|
||||
continue;
|
||||
}
|
||||
if (tempLength < 0 || tempLength > 256){
|
||||
printf ("Invalid Length ..Enter length less than 256 bytes\n");
|
||||
continue;
|
||||
}
|
||||
pageAddress = tempPageAddress;
|
||||
readWriteLength = tempLength;
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
if (selectedDeviceNum == -1) {
|
||||
printf ("Select proper device!!! \n");
|
||||
continue;
|
||||
}
|
||||
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == -1){
|
||||
printf ("Selected device does not have I2C or SPI !!! \n");
|
||||
continue;
|
||||
}
|
||||
if ((pageAddress == -1) || (readWriteLength == -1)){
|
||||
printf ("Select proper page address and length !!! \n");
|
||||
continue;
|
||||
}
|
||||
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_I2C){
|
||||
if (pageAddress > 256){
|
||||
printf ("Invalid Page address for I2C .. need to be less than 256\n");
|
||||
continue;
|
||||
}
|
||||
if (readWriteLength > 64){
|
||||
printf ("Invalid read write length for I2C .. need to be less than 64\n");
|
||||
continue;
|
||||
}
|
||||
printf ("Calling I2C \n");
|
||||
i2cVerifyData(glDevice[selectedDeviceNum].deviceNumber, selectedInterfaceNum);
|
||||
}
|
||||
if (glDevice[selectedDeviceNum].interfaceFunctionality[selectedInterfaceNum] == CY_TYPE_SPI){
|
||||
spiVerifyData(glDevice[selectedDeviceNum].deviceNumber, selectedInterfaceNum);
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
exitApp = true;
|
||||
CyLibraryExit ();
|
||||
break;
|
||||
}
|
||||
}while (exitApp == false);
|
||||
free (glDevice);
|
||||
return CY_SUCCESS;
|
||||
}
|
||||
int spiWriteEnable (CY_HANDLE handle)
|
||||
{
|
||||
unsigned char wr_data,rd_data;
|
||||
CY_RETURN_STATUS status = CY_SUCCESS;
|
||||
CY_DATA_BUFFER writeBuf;
|
||||
CY_DATA_BUFFER readBuf;
|
||||
|
||||
writeBuf.buffer = &wr_data;
|
||||
writeBuf.length = 1;
|
||||
|
||||
readBuf.buffer = &rd_data;
|
||||
readBuf.length = 1;
|
||||
|
||||
wr_data = 0x06; /* Write enable */
|
||||
status = CySpiReadWrite (handle, &readBuf, &writeBuf, 5000);
|
||||
return status;
|
||||
}
|
||||
//Helper functions for doing data transfer to/from SPI flash
|
||||
int spiWaitForIdle (CY_HANDLE handle)
|
||||
{
|
||||
char rd_data[2], wr_data[2];
|
||||
CY_DATA_BUFFER writeBuf, readBuf;
|
||||
writeBuf.length = 2;
|
||||
writeBuf.buffer = (unsigned char *)wr_data;
|
||||
int timeout = 0xFFFF;
|
||||
CY_RETURN_STATUS status;
|
||||
|
||||
readBuf.length = 2;
|
||||
readBuf.buffer = (unsigned char *)rd_data;
|
||||
do
|
||||
{
|
||||
wr_data[0] = 0x05; /* Status */
|
||||
status = CySpiReadWrite (handle, &readBuf, &writeBuf, 5000);
|
||||
if (status != CY_SUCCESS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
timeout--;
|
||||
if (timeout == 0)
|
||||
{
|
||||
status = CY_ERROR_IO_TIMEOUT;
|
||||
return status;
|
||||
}
|
||||
} while (rd_data[1] & 0x01);
|
||||
return status;
|
||||
}
|
||||
|
||||
int spiVerifyData (int deviceNumber, int interfaceNum)
|
||||
{
|
||||
CY_DATA_BUFFER dataBufferWrite,dataBufferRead;
|
||||
CY_HANDLE handle;
|
||||
bool isVerify = true;
|
||||
unsigned char wbuffer[256 + 4], rbuffer[256 + 4];
|
||||
int rStatus;
|
||||
|
||||
memset (rbuffer, 0x00, 256);
|
||||
memset (wbuffer, 0x00, 256);
|
||||
|
||||
rStatus = CyOpen (deviceNumber, interfaceNum, &handle);
|
||||
if (rStatus != CY_SUCCESS){
|
||||
printf ("CY_SPI: Open failed \n");
|
||||
return rStatus;
|
||||
}
|
||||
dataBufferWrite.buffer = wbuffer;
|
||||
dataBufferRead.buffer = rbuffer;
|
||||
|
||||
rStatus = spiWaitForIdle (handle);
|
||||
if (rStatus){
|
||||
printf("Error in Waiting for EEPOM active state %d \n", rStatus);
|
||||
CyClose (handle);
|
||||
|
||||
return CY_ERROR_REQUEST_FAILED;
|
||||
}
|
||||
printf ("Calling spi write enable \n");
|
||||
rStatus = spiWriteEnable (handle);
|
||||
if (rStatus){
|
||||
printf("Error in setting Write Enable %d \n", rStatus);
|
||||
CyClose (handle);
|
||||
return CY_ERROR_REQUEST_FAILED;
|
||||
}
|
||||
//Write SPI write command
|
||||
wbuffer[0] = 0x02;
|
||||
//SPI flash address
|
||||
wbuffer[1] = (pageAddress >> 8);
|
||||
wbuffer[2] = (pageAddress) & 0x00FF;
|
||||
wbuffer[3] = 0;
|
||||
|
||||
printf ("The Data written is ...\n");
|
||||
printf ("\n--------------------------------------------------------------------\n");
|
||||
for (rStatus = 4; rStatus < (readWriteLength + 4); rStatus++){
|
||||
wbuffer[rStatus] = rand() % 256;
|
||||
printf ("%x ",wbuffer[rStatus]);
|
||||
}
|
||||
printf ("\n--------------------------------------------------------------------\n");
|
||||
|
||||
dataBufferRead.length = (4 + readWriteLength);
|
||||
dataBufferWrite.length = (4 + readWriteLength);
|
||||
|
||||
rStatus = CySpiReadWrite (handle , &dataBufferRead, &dataBufferWrite, 5000);
|
||||
if (rStatus != CY_SUCCESS){
|
||||
CyClose (handle);
|
||||
printf ("Error in doing SPI data write data Write is %d data read is %d\n" , dataBufferWrite.transferCount,dataBufferRead.transferCount);
|
||||
return CY_ERROR_REQUEST_FAILED;
|
||||
}
|
||||
|
||||
spiWaitForIdle (handle);
|
||||
//Write SPI read command
|
||||
wbuffer[0] = 0x03;
|
||||
dataBufferRead.length = (4 + readWriteLength);
|
||||
dataBufferWrite.length = (4 + readWriteLength);
|
||||
|
||||
rStatus = CySpiReadWrite (handle, &dataBufferRead, &dataBufferWrite, 5000);
|
||||
if (rStatus != CY_SUCCESS){
|
||||
CyClose (handle);
|
||||
printf ("The Error is %d \n", rStatus);
|
||||
printf ("Error in doing SPI data write data Write is %d data read is %d\n" , dataBufferWrite.transferCount,dataBufferRead.transferCount);
|
||||
return CY_ERROR_REQUEST_FAILED;
|
||||
}
|
||||
printf ("Data Read back is \n");
|
||||
printf ("\n---------------------------------------------------------------------\n");
|
||||
for (rStatus = 4; rStatus < (readWriteLength + 4); rStatus++){
|
||||
printf ("%x ",rbuffer[rStatus]);
|
||||
if (rbuffer[rStatus] != wbuffer[rStatus]){
|
||||
isVerify = false;
|
||||
}
|
||||
}
|
||||
printf ("\n---------------------------------------------------------------------\n");
|
||||
if (isVerify)
|
||||
printf ("Data verified successfully \n");
|
||||
else
|
||||
printf ("Data corruption occured!!\n");
|
||||
|
||||
CyClose (handle);
|
||||
return CY_SUCCESS;
|
||||
}
|
||||
|
||||
int i2cVerifyData (int deviceNumber, int interfaceNum)
|
||||
{
|
||||
CY_DATA_BUFFER dataBufferWrite, dataBufferRead;
|
||||
CY_HANDLE handle;
|
||||
int length = 0;
|
||||
bool isVerify = true;
|
||||
int loopCount = 100, i;
|
||||
CY_RETURN_STATUS rStatus;
|
||||
unsigned char address[2], wbuffer[66], rbuffer[66];
|
||||
CY_I2C_DATA_CONFIG i2cDataConfig;
|
||||
|
||||
memset (wbuffer, 0, 66);
|
||||
memset (rbuffer, 0, 66);
|
||||
|
||||
i2cDataConfig.isStopBit = true;
|
||||
i2cDataConfig.slaveAddress = 0x51;
|
||||
|
||||
rStatus = CyOpen (deviceNumber, interfaceNum, &handle);
|
||||
if (rStatus != CY_SUCCESS){
|
||||
printf("CY_I2C: Open failed \n");
|
||||
return rStatus;
|
||||
}
|
||||
loopCount = 100;
|
||||
length = readWriteLength;
|
||||
wbuffer[0]= pageAddress;
|
||||
wbuffer[1] = 0;
|
||||
dataBufferWrite.buffer = wbuffer;
|
||||
i2cDataConfig.isStopBit = true;
|
||||
dataBufferWrite.length = (length + 2);
|
||||
printf ("\n Data that is written on to i2c ...\n");
|
||||
printf ("\n-----------------------------------------------------------------\n");
|
||||
for (i = 2; i < (length +2); i++){
|
||||
wbuffer[i] = rand() % 256;
|
||||
printf ("%x ", wbuffer[i]);
|
||||
}
|
||||
printf ("\n-----------------------------------------------------------------\n");
|
||||
rStatus = CyI2cWrite (handle, &i2cDataConfig, &dataBufferWrite, 5000);
|
||||
if (rStatus != CY_SUCCESS){
|
||||
printf ("Error in doing i2c write \n");
|
||||
CyClose (handle);
|
||||
return -1;
|
||||
}
|
||||
//We encountered a error in I2C read repeat the procedure again
|
||||
//Loop here untill Read vendor command passes
|
||||
i2cDataConfig.isStopBit = false;
|
||||
dataBufferWrite.length = 2;
|
||||
|
||||
do {
|
||||
rStatus = CyI2cWrite (handle, &i2cDataConfig, &dataBufferWrite, 5000);
|
||||
loopCount--;
|
||||
}while (rStatus != CY_SUCCESS && loopCount != 0);
|
||||
|
||||
if (loopCount == 0 && rStatus != CY_SUCCESS){
|
||||
printf ("Error in sending read command \n");
|
||||
CyClose (handle);
|
||||
return -1;
|
||||
}
|
||||
|
||||
dataBufferRead.buffer = rbuffer;
|
||||
rbuffer[0]= address[0];
|
||||
rbuffer[1] = 0;
|
||||
i2cDataConfig.isStopBit = true;
|
||||
i2cDataConfig.isNakBit = true;
|
||||
dataBufferRead.length = length;
|
||||
dataBufferRead.buffer = rbuffer;
|
||||
|
||||
memset (rbuffer, 0, 64);
|
||||
|
||||
rStatus = CyI2cRead (handle, &i2cDataConfig, &dataBufferRead, 5000);
|
||||
if (rStatus != CY_SUCCESS){
|
||||
printf ("Error in doing i2c read ... Error is %d \n", rStatus);
|
||||
CyClose (handle);
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf ("\n Data that is read from i2c ...\n");
|
||||
printf ("\n-----------------------------------------------------------------\n");
|
||||
for (i = 0; i < length; i++){
|
||||
printf ("%x ", rbuffer[i]);
|
||||
if (rbuffer[i] != wbuffer[i + 2]){
|
||||
isVerify = false;
|
||||
}
|
||||
}
|
||||
printf ("\n-----------------------------------------------------------------\n");
|
||||
if (!isVerify)
|
||||
printf ("Data corruption occured ..!!!\n");
|
||||
else
|
||||
printf ("Data verified successfully \n");
|
||||
|
||||
CyClose (handle);
|
||||
return CY_SUCCESS;
|
||||
}
|
||||
bool isCypressDevice (int deviceNum) {
|
||||
CY_HANDLE handle;
|
||||
unsigned char interfaceNum = 0;
|
||||
unsigned char sig[6];
|
||||
CY_RETURN_STATUS rStatus;
|
||||
rStatus = CyOpen (deviceNum, interfaceNum, &handle);
|
||||
if (rStatus == CY_SUCCESS){
|
||||
rStatus = CyGetSignature (handle, sig);
|
||||
if (rStatus == CY_SUCCESS){
|
||||
CyClose (handle);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
CyClose (handle);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
void printListOfDevices (bool isPrint)
|
||||
{
|
||||
int i, j, devNum;
|
||||
int index = 0, numInterfaces, interfaceNum;
|
||||
|
||||
char functionality[64];
|
||||
CY_DEVICE_INFO deviceInfo;
|
||||
CY_RETURN_STATUS rStatus;
|
||||
|
||||
deviceAddedRemoved = false;
|
||||
CyGetListofDevices (&numDevices);
|
||||
//printf ("The number of devices is %d \n", numDevices);
|
||||
for (i = 0; i < numDevices; i++){
|
||||
for (j = 0; j< CY_MAX_INTERFACES; j++)
|
||||
glDevice[i].interfaceFunctionality[j] = -1;
|
||||
}
|
||||
if (isPrint){
|
||||
printf ("\n\n---------------------------------------------------------------------------------\n");
|
||||
printf ("Device Number | VID | PID | INTERFACE NUMBER | FUNCTIONALITY \n");
|
||||
printf ("---------------------------------------------------------------------------------\n");
|
||||
}
|
||||
cyDevices = 0;
|
||||
for (devNum = 0; devNum < numDevices; devNum++){
|
||||
rStatus = CyGetDeviceInfo (devNum, &deviceInfo);
|
||||
interfaceNum = 0;
|
||||
if (!rStatus)
|
||||
{
|
||||
if (!isCypressDevice (devNum)){
|
||||
continue;
|
||||
}
|
||||
strcpy (functionality, "NA");
|
||||
numInterfaces = deviceInfo.numInterfaces;
|
||||
glDevice[index].numInterface = numInterfaces;
|
||||
cyDevices++;
|
||||
|
||||
while (numInterfaces){
|
||||
if (deviceInfo.deviceClass[interfaceNum] == CY_CLASS_VENDOR)
|
||||
{
|
||||
glDevice[index].deviceNumber = devNum;
|
||||
switch (deviceInfo.deviceType[interfaceNum]){
|
||||
case CY_TYPE_I2C:
|
||||
glDevice[index].interfaceFunctionality[interfaceNum] = CY_TYPE_I2C;
|
||||
strcpy (functionality, "VENDOR_I2C");
|
||||
glDevice[index].isI2c = true;
|
||||
break;
|
||||
case CY_TYPE_SPI:
|
||||
glDevice[index].interfaceFunctionality[interfaceNum] = CY_TYPE_SPI;
|
||||
strcpy (functionality, "VENDOR_SPI");
|
||||
glDevice[index].isSpi = true;
|
||||
break;
|
||||
default:
|
||||
strcpy (functionality, "NA");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (deviceInfo.deviceClass[interfaceNum] == CY_CLASS_CDC){
|
||||
strcpy (functionality, "NA");
|
||||
}
|
||||
if (isPrint) {
|
||||
printf ("%d |%x |%x | %d | %s\n", \
|
||||
index, \
|
||||
deviceInfo.vidPid.vid, \
|
||||
deviceInfo.vidPid.pid, \
|
||||
interfaceNum, \
|
||||
functionality \
|
||||
);
|
||||
}
|
||||
interfaceNum++;
|
||||
numInterfaces--;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
if (isPrint){
|
||||
printf ("---------------------------------------------------------------------------------\n\n");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user