Soliton SCTS Extender

Similar documents
Soliton PCI Express Mini Extender

CprE 288 Introduction to Embedded Systems Exam 1 Review. 1

Linked List using a Sentinel

CS 33. Architecture and the OS. CS33 Intro to Computer Systems XIX 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.

CS 33. Architecture and the OS. CS33 Intro to Computer Systems XIX 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

SpinWarrior Dynamic Library V1.5 for Windows and Linux

Intel Embedded System Design Contest

Serial C Programming 03/11/2008. Lecture 15 1

PS3 Programming. Week 4. Events, Signals, Mailbox Chap 7 and Chap 13

CS 2301 Exam 3 B-Term 2011

Note: The following (with modifications) is adapted from Silberschatz (our course textbook), Project: Producer-Consumer Problem.

Common Misunderstandings from Exam 1 Material

DYNAMIC ENGINEERING 435 Park Dr., Ben Lomond, Calif Fax Est

IO-Warrior Dynamic Library V1.5 for Windows

DYNAMIC ENGINEERING 150 DuBois St Suite 3, Santa Cruz CA Fax Est.

DYNAMIC ENGINEERING 435 Park Dr., Ben Lomond, Calif Fax Est

CC Pilot XS. Backlight interface description

W90N745. System Library. User's Manual

& WizChan. Driver Documentation

PSoC Designer Quick Start Guide

EE 472 Embedded Systems. Name solutions. Instructions:

Binary Search Tree 1.0. Generated by Doxygen Mon Jun :12:39

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above

Thread Fundamentals. CSCI 315 Operating Systems Design 1

Why files? 1. Storing a large amount of data 2. Long-term data retention 3. Access to the various processes in parallel

CONTROL THE GPIO PINS ON THE DELL EMBEDDED BOX PC 5000 IN UBUNTU LINUX

STD_CU43USBSW_V1.0E. CUnet (MKY43) USB Unit. CU-43USB Software Manual

Memory. What is memory? How is memory organized? Storage for variables, data, code etc. Text (Code) Data (Constants) BSS (Global and static variables)

COMP 2355 Introduction to Systems Programming

C Language Summary (Continued)

TouchKit Software Programming Guide Version 1.1

EL2310 Scientific Programming

CS240: Programming in C

JENET C LIBRARY API ver. 3.00

TouchKit Software Programming Guide Version 1.2

Program threaded-fft-mutex.cc

FPGA Device Driver Design Guide on Windows 7 Embedded

ECE 264 Exam 2. 6:30-7:30PM, March 9, You must sign here. Otherwise you will receive a 1-point penalty.

robotics/ openel.h File Reference Macros Macro Definition Documentation Typedefs Functions

// middle priority ISR Status.flag = 1; Status.y = 6;

Assignment description: This is a C++ project. The comms class containing the

CS 326 Operating Systems C Programming. Greg Benson Department of Computer Science University of San Francisco

Programmer s Guide to the SNP Facility

CS 3305 Intro to Threads. Lecture 6

USB-910H API DLL and Include File Reference Manual

HUNT ENGINEERING HeartConf HEART connection configuration tool

CS 1713 Introduction to Programming II

ICS-121. VxWORKS DEVICE DRIVER MANUAL

#include <stdio.h> int main() { char s[] = Hsjodi, *p; for (p = s + 5; p >= s; p--) --*p; puts(s); return 0;

How to write a Measurement Telnet Server

Airence C Library v1.2 for Windows

Prepared by Prof. Hui Jiang Process. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University

Embedded Systems. Input/Output Programming

NuCOM. PCI-7841/cPCI-7841/PM-7841 Dual-Port Isolated CAN Interface Card User s Guide

DYNAMIC ENGINEERING 150 DuBois St., Suite C Santa Cruz, CA (831) Fax (831) Est.

Software API Library. User s Manual V1.3

DYNAMIC ENGINEERING 435 Park Dr., Ben Lomond, Calif Fax Est

Process. Prepared by Prof. Hui Jiang Dept. of EECS, York Univ. 1. Process in Memory (I) PROCESS. Process. How OS manages CPU usage? No.

DYNAMIC ENGINEERING 435 Park Dr., Ben Lomond, Calif Fax Est

CSE 333 Autumn 2014 Midterm Key

LAP-B(PCI/C-PCI) GPF LAP-B Communications Driver Software for for Windows. Help for Windows.

DYNAMIC ENGINEERING 150 DuBois St., Suite C Santa Cruz, CA Fax Est.

AET60 API version 1.4 February Introduction...3 Features...3 Application Programming Interface...4

ECE264 Fall 2013 Exam 3, November 20, 2013

DYNAMIC ENGINEERING. 150 DuBois, Suite C Santa Cruz, CA (831) Fax (831) Est.

Nubotics Device Interface DLL

CS61C Machine Structures. Lecture 3 Introduction to the C Programming Language. 1/23/2006 John Wawrzynek. www-inst.eecs.berkeley.

Visualization Of Hard Disk Geometry And Master Boot Record

ProvideX. C-Library File IO Routines

BioRadio Software Development Kit BioRadio 150 DLL

4) In response to the the 8259A sets the highest priority ISR, bit and reset the corresponding IRR bit. The 8259A also places

20-EECE-4029 Operating Systems Fall, 2015 John Franco

Part Two - Process Management. Chapter 3: Processes

Programming the keys

DYNAMIC ENGINEERING 150 DuBois, Suite 3 Santa Cruz, CA (831) Fax (831) Est

Designing Responsive and Real-Time Systems

DYNAMIC ENGINEERING 150 DuBois, Suite 3 Santa Cruz, CA (831) Fax (831) Est.

Performing Background Digital Input Acquisition Using the External Interrupt on a KPCI-PIO24 and DriverLINX

Embedded Linux. Session 4: Introduction to the GPIO Kernel API. Martin Aebersold BFH-TI Dipl. El.-Ing. FH.

Key Switch Control Software Windows driver software for Touch Panel Classembly Devices

USB-CTR Series cbdaqinscan Timing Mode C++ example

Operating systems for embedded systems

CSE 333 SECTION 3. POSIX I/O Functions

PusleIR Multitouch Screen Software SDK Specification. Revision 4.0

EMS CPC 104I. CAN-PC Interface. User Manual THOMAS WÜNSCHE. Documentation for plug-in board CPC-104I.

Procedures, Parameters, Values and Variables. Steven R. Bagley

PRINCIPLES OF OPERATING SYSTEMS

ECE332, Week 8. Topics. October 15, Exceptions. Hardware Interrupts Software exceptions

AET60 BioCARDKey. Application Programming Interface. Subject to change without prior notice

libacarsd documentation 12. December 2003 libacarsd 1.46 ACARS Decoder Library ,2004 by KjM

IPAC for VME64x. Pete Owens Daresbury Laboratory

DYNAMIC ENGINEERING 435 Park Dr., Ben Lomond, Calif Fax Est

Lesson 6.1: Structs. This declares a collection of two integer variables to denote the two coordinates of a point in a plane.

COP Programming Concepts Spring 1999 CLOSED BOOK Exam #1 100 Points NAME

AN Entering ISP mode from user code. Document information. ARM ISP, bootloader

CSE 351: The Hardware/Software Interface. Section 2 Integer representations, two s complement, and bitwise operators

F28069 ControlCard Lab1

Decisions II. Switch Statement. If else allows a 2 way decision Switch allows for n-way decisions

TDDB68. Lesson 1. Simon Ståhlberg

Transcription:

Soliton SCTS Extender Rev 1.0 May 20, 2008 Rev. No. Description Date Approved 0.1 Initial May/20/2008 Vincent 1.0 First Relase Jun/13/2008 Vincent 1

1. Installation...3 2. Function Description...3 sctsctl_t stdcall SCTSCTL_OPEN(DWORD instance)...3 void stdcall SCTSCTL_CLOSE(sctsctl_t board)...3 int stdcall SCTSCTL_CONNECT(sctsctl_t board, void (*sig_handler)(sctsctl_t, int))...4 int stdcall SCTSCTL_SET_EXTENSION(sctsctl_t board, PVOID pext)...5 PVOID stdcall SCTSCTL_GET_EXTENSION(sctsctl_t board)...6 int stdcall SCTSCTL_ADCCONV(sctsctl_t board, int ch, double *value)...6 int stdcall SCTSCTL_CARDSERVICE_INIT(sctsctl_t board)...7 int stdcall SCTSCTL_CARDINSERTPROCESS(sctsctl_t board, double *volt, double *current)...7 int stdcall SCTSCTL_CARDREMOVEPROCESS(sctsctl_t board)...7 int stdcall SCTSCTL_ CARDOCPROCESS (sctsctl_t board)...8 int stdcall SCTSCTL_CARDSERVICE_EXIT(sctsctl_t board)...8 int stdcall SCTSCTL_BEEP(sctsctl_t board, int freq, int msec)...8 int stdcall SCTSCTL_LEDGO(sctsctl_t board)...9 int stdcall SCTSCTL_LEDNG(sctsctl_t board)...9 int stdcall SCTSCTL_LEDOFF(sctsctl_t board)...9 int stdcall SCTSCTL_MCARD_FORCEPON(sctsctl_t board)...10 int stdcall SCTSCTL_MCARD_DISCONNECT(sctsctl_t board)...10 int stdcall SCTSCTL_MCARD_NORMAL(sctsctl_t board)...10 int stdcall SCTSCTL_MCARD_CHECKSDCD(sctsctl_t board)...11 int stdcall SCTSCTL_MCARD_CHECKOC(sctsctl_t board)...11 int stdcall SCTSCTL_MEAS_VOLTAGE(sctsctl_t board, double *voltage)...11 int stdcall SCTSCTL_ MEAS_ CURRENT(sctsctl_t board, double *current)...12 int stdcall SCTSCTL_ PON(sctsctl_t board)...12 int stdcall SCTSCTL_ POFF(sctsctl_t board)...12 int stdcall SCTSCTL_GPIOSET(sctsctl_t board, int pinno)...13 int stdcall SCTSCTL_GPIORESET(sctsctl_t board, int pinno)...13 Initialize Flow...14 Operation/Test Flow...15 4. Sample Program...16 VC++ Sample...16 VC++ MFC Sample...18 5. Contact...18 2

1. Installation Execute the SCTS_Setup.exe from the CD. All the required component will be installed in the Program files/soliton/scts folder. For developer, who want to integrate test program with the SCTS control. Please find all the needed samples and development resources in the Program files/soliton/scts/dlldev folder. 2. Function Description sctsctl_t stdcall SCTSCTL_OPEN(DWORD instance) Sctsctl_t stdcall SCTSCTL_OPEN(DWORD instance) Get a handle to a device(scts). When the function returns, sctsctl_t will Contain completed information for th SCTS board. instance is SCTS board ID or board Index to determine whitch SCTS board we want to control. The valid range is 0 to 7 If successful, will return the SCTS handle of data structure sctsctl_t. Return 0 if fail. sctsctl_t board0; int boarded = 0; board0 = sctsctl_open(boarded); Notes: This function should be used to open a channel to a SCTS device and get a handle to the device driver before any PCIAPI functions that require a handle can be used. void stdcall SCTSCTL_CLOSE(sctsctl_t board) void stdcall SCTSCTL_CLOSE(sctsctl_t board) Close the handle of SCTS board No return value. 3

SCTSCTL_CLOSE(board0); Notes: Be sure to call SCTSCTL_CLOSE before your application exits. int stdcall SCTSCTL_CONNECT(sctsctl_t board, void (*sig_handler)(sctsctl_t, int)) int stdcall SCTSCTL_CONNECT(sctsctl_t board, void (*sig_handler)(sctsctl_t, int)) To connect user s interrupt process to main program and pass its handle to main program. *sig_handler: UserISR. * int : INT vector, will be one of the PCITG_IRQ_EXT, PCITG_IRQ_0, PCITG_IRQ_1, PCITG_IRQ_2, PCITG_IRQ_3, * // Define a data structure typedef struct HANDLE userevent; ULONG nsamplecount; int intvec; int event; } MY_EXTENSION, *PMY_EXTENSION; sctsctl_t board0; board0 = SCTSCTL_OPEN(0); SCTSCTL_CARDSERVICE_INIT(board0); HANDLE UserISREvent; DWORD dwwaitresult; PMY_EXTENSION pextension = NULL; UserISREvent = CreateEvent(NULL, TRUE, FALSE, NULL); pextension = (PMY_EXTENSION)malloc(sizeof(MY_EXTENSION)); pextension->nsamplecount = 0; pextension->userevent = UserISREvent; 4

SCTSCTL_SET_EXTENSION(board0, pextension); SCTSCTL_CONNECT(board0, UserISR); int stdcall SCTSCTL_SET_EXTENSION(sctsctl_t board, PVOID pext) int stdcall SCTSCTL_SET_EXTENSION(sctsctl_t board, PVOID pext) Associates a user defined data structure with a particular device. pext is the structure pointer of extension. Return 0 if successful. // Define a data structure typedef struct HANDLE userevent; ULONG nsamplecount; int intvec; int event; } MY_EXTENSION, *PMY_EXTENSION; sctsctl_t board0; board0 = SCTSCTL_OPEN(0); SCTSCTL_CARDSERVICE_INIT (board0); HANDLE UserISREvent; DWORD dwwaitresult; PMY_EXTENSION pextension = NULL; UserISREvent = CreateEvent(NULL, TRUE, FALSE, NULL); pextension = (PMY_EXTENSION)malloc(sizeof(MY_EXTENSION)); pextension->nsamplecount = 0; pextension->userevent = UserISREvent; SCTSCTL_SET_EXTENSION(board0, pextension); Notes: The SCTSCTL_SET_EXTENSION and SCTSCTL_GET_EXTENSION routines support a user defined device extension to hold variables and/or buffers associated with a particular device. 5

PVOID stdcall SCTSCTL_GET_EXTENSION(sctsctl_t board) int stdcall SCTSCTL_GET_EXTENSION(sctsctl_t board, PVOID pext) Return a pointer to the user defined data structure. A point by user defined. // User interrupt service routine void UserISR(sctsctl_t board, int intvec) //unsigned long datac; PMY_EXTENSION pextension = (PMY_EXTENSION)SCTSCTL_GET_EXTENSION(board); pextension->nsamplecount++; pextension->intvec = intvec; printf("isr INT Count=[%d] Vector=[0x%.2X] Diff[0x%.2X] val[0x%.2x]\n",pextension->nsamplecount, pextension->intvec, board->data_diff, board->data_in); SetEvent(pExtension->userevent); } int stdcall SCTSCTL_ADCCONV(sctsctl_t board, int ch, double *value) int stdcall SCTSCTL_ADCCONVL(sctsctl_t board, int ch, double *value) Meauser current or voltage. ch 0: Voltage meas, gain 0.5 1: Current meas, gain 5. return 0 if success, 1 if Error ( ADC NULL bit not detected) status = SCTSCTL_ADCCONVD(board, ch, &val); 6

int stdcall SCTSCTL_CARDSERVICE_INIT(sctsctl_t board) int stdcall SCTSCTL_CARDSERVICE_INIT(sctsctl_t board) Initial auto test flow. SCTSCTL_CARDSERVICE_INIT(board0); int stdcall SCTSCTL_CARDINSERTPROCESS(sctsctl_t board, double *volt, double *current) int stdcall SCTSCTL_CARDINSERTPROCESS(sctsctl_t board, double *volt, double *current) Card insert process. double *volt : if success, the measured voltage will stored in the passed double pointer. double *current: if success, the measured current will stored in the passed double pointer. status = SCTSCTL_CARDINSERTPROCESS(board0, &volt, &current); int stdcall SCTSCTL_CARDREMOVEPROCESS(sctsctl_t board) int stdcall SCTSCTL_CARDREMOVEPROCESS(sctsctl_t board) When device removed, switch to disconnected mode. 7

status = SCTSCTL_CARDREMOVEPROCESS(board0); int stdcall SCTSCTL_ CARDOCPROCESS (sctsctl_t board) int stdcall SCTSCTL_CARDOCPROCESS(sctsctl_t board) Over current process. status = SCTSCTL_CARDREMOVEPROCESS(board0); int stdcall SCTSCTL_CARDSERVICE_EXIT(sctsctl_t board) int stdcall SCTSCTL_CARDSERVICE_EXIT(sctsctl_t board) Card remove process. SCTSCTL_CARDSERVICE_EXIT(board0); int stdcall SCTSCTL_BEEP(sctsctl_t board, int freq, int msec) int stdcall SCTSCTL_BEEP(sctsctl_t board, int freq, int msec) Play Beeper. int freq: frequency of sound, range 0~3 int msec: length Millisecond 8

SCTSCTL_BEEP(board0, 0, 1000); int stdcall SCTSCTL_LEDGO(sctsctl_t board) int stdcall SCTSCTL_LEDGO(sctsctl_t board) Turn on the GO LED to indicate the test status. SCTSCTL_LEDGO(board0); int stdcall SCTSCTL_LEDNG(sctsctl_t board) int stdcall SCTSCTL_LEDNG(sctsctl_t board) Turn on the NO-GO LED to indicate the test status. SCTSCTL_LEDNG(board0); int stdcall SCTSCTL_LEDOFF(sctsctl_t board) int stdcall SCTSCTL_LEDOFF(sctsctl_t board) Turn off both the GO and NG LEDs SCTSCTL_LEDOFF(board0); 9

int stdcall SCTSCTL_MCARD_FORCEPON(sctsctl_t board) int stdcall SCTSCTL_MCARD_FORCEPON(sctsctl_t board) Manual mode force power on. SCTSCTL_MCARD_FORCEPON(board0); int stdcall SCTSCTL_MCARD_DISCONNECT(sctsctl_t board) int stdcall SCTSCTL_ MCARD_DISCONNECT (sctsctl_t board) Manual mode disconnect socket. SCTSCTL_MCARD_DISCONNECT(board0); int stdcall SCTSCTL_MCARD_NORMAL(sctsctl_t board) int stdcall SCTSCTL_MCARD_NORMAL(sctsctl_t board) Manual mode force normal mode. SCTSCTL_MCARD_NORMAL(board0); 10

int stdcall SCTSCTL_MCARD_CHECKSDCD(sctsctl_t board) int stdcall SCTSCTL_MCARD_CHECKSDCD(sctsctl_t board) Check SD card detect pin, check whether SD card is inserted. SCTSCTL_MCARD_CHECKSDCD(board0); int stdcall SCTSCTL_MCARD_CHECKOC(sctsctl_t board) int stdcall SCTSCTL_MCARD_CHECKOC(sctsctl_t board) Check over current flag. SCTSCTL_MCARD_CHECKOC(board0); int stdcall SCTSCTL_MEAS_VOLTAGE(sctsctl_t board, double *voltage) int stdcall SCTSCTL_MEAS_VOLTAGE(sctsctl_t board, double *voltage) Measure voltage. double *volt : if success, the measured voltage will stored in the passed double pointer. status = SCTSCTL_CARDINSERTPROCESS(board0, &volt, &current); 11

int stdcall SCTSCTL_ MEAS_ CURRENT(sctsctl_t board, double *current) int stdcall SCTSCTL_MEAS_CURRENT(sctsctl_t board, double *current) Measure current. double *current: if success, the measured current will stored in the passed double pointer. status = SCTSCTL_MEAS_CURRENT(board0, &current); int stdcall SCTSCTL_ PON(sctsctl_t board) int stdcall SCTSCTL_ PON(sctsctl_t board) Manual mode force power on. SCTSCTL_PON(board0); int stdcall SCTSCTL_ POFF(sctsctl_t board) int stdcall SCTSCTL_ POFF(sctsctl_t board) Manual mode force power off. SCTSCTL_POFF(board0); 12

int stdcall SCTSCTL_GPIOSET(sctsctl_t board, int pinno) int stdcall SCTSCTL_ GPIOSET(sctsctl_t board, int pinno) Set GPIO output to high. pinno: GPIO pin no, range 0~1 SCTSCTL_GPIOSET(board0, 0); int stdcall SCTSCTL_GPIORESET(sctsctl_t board, int pinno) int stdcall SCTSCTL_ GPIORESET(sctsctl_t board, int pinno) Set GPIO output to low. pinno: GPIO pin no, range 0~1 SCTSCTL_GPIORESET(board0, 0); 13

3. Operation Flow Initialize Flow Power up PC Fail sctsctl_open() Success sctsctl_cardservice_init() Success Setup Interrupt Extension sctsctl_connect() Enable Interrupt Operation/ Test Flow sctsctl_cardservice_exit() sctsctl_close() Fig. 1: Initialize Flow 14

Operation/Test Flow Wait Interrupt Event Happen WaitForSingleObject() Card Removed Card Inserted Over Current sctsctl_cardremoveprocess () Reset Card Detect Signal Power Off sctsctl_cardinsertprocess() Power On Check Power Set Card Detect Signal sctsctl_cardocprocess() Power Off Reset Card Detect Signal Fail Check Device Existence Fail Run User Test Prog. Pass sctsctl_meas_voltage() sctsctl_meas_current() sctsctl_ledng() sctsctl_ledgo() More DUT to Test Test Next DUT EXIT Fig. 2: Operation/Test Flow 15

4. Sample Program VC++ Sample #include "stdafx.h" #include "scts_lib.h" typedef struct HANDLE userevent; ULONG nsamplecount; int intvec; int event; } MY_EXTENSION, *PMY_EXTENSION; void UserISR(sctsctl_t board, int intvec) PMY_EXTENSION pextension = (PMY_EXTENSION)sctsctl_get_extension(board); pextension->nsamplecount++; pextension->intvec = intvec; Sleep(10); // De-Glitch for CD#, more sleep time if needed printf("isr INT Count=[%d] Vector=[0x%.2X] Diff[0x%.2X] Val[0x%.2X]\n",pExtension->nSampleCount, pextension->intvec, board->data_diff, board->data_in); SetEvent(pExtension->userevent); } int main(int argc, char* argv[]) int board_index = 0; sctsctl_t board0; unsigned long data; unsigned long address, ah, al; int execnt = 0; int sleeptime = 10; int status = 0; int x; int error = 0; int total_error = 0; int verbose = 0; double volt; double current; DWORD dwwaitresult; if (argc > 1) board_index = atoi(argv[1]); // if (argc > 2) verbose = 1; board0 = sctsctl_open(0); if (board0->hdevice == PCITG_NULL) 16

printf("error opening SCTS[%d]: (%0x) returned from CreateFile\n", board_index, GetLastError()); return 1; } printf("scts[%d] found, Device Handle = 0x%.8X\n", board_index, board0->hdevice); sctsctl_cardservice_init(board0); // Set ISR Extention HANDLE UserISREvent; PMY_EXTENSION pextension = NULL; UserISREvent = CreateEvent(NULL, TRUE, FALSE, NULL); pextension = (PMY_EXTENSION)malloc(sizeof(MY_EXTENSION)); pextension->nsamplecount = 0; pextension->userevent = UserISREvent; sctsctl_set_extension(board0, pextension); sctsctl_connect(board0, UserISR); Sleep(100); printf("wait for Interrupt!\n"); while(!kbhit()) dwwaitresult = WaitForSingleObject(UserISREvent, 3000); if (dwwaitresult == WAIT_OBJECT_0) switch (pextension->intvec) case SCTS_EVENT_SDMMCCARD_INSERT: case SCTS_EVENT_MSCARD_INSERT: case SCTS_EVENT_XDCARD_INSERT: status = sctsctl_cardinsertprocess(board0, &volt, &current); if (status == 0) printf("card Insert Process OK! V=[%f]V I=[%f]mA\n", volt, current*1e3); } else printf("card Insert Process Fail!\n"); } break; case SCTS_EVENT_SDMMCCARD_REMOVE: case SCTS_EVENT_MSCARD_REMOVE: case SCTS_EVENT_XDCARD_REMOVE: status = sctsctl_cardremoveprocess(board0); if (status == 0) printf("card Removed OK\n"); else printf("card Removed Fail\n"); break; case SCTS_EVENT_CARDPOWER_OC: 17

status = sctsctl_cardocprocess(board0); break; default: // Do nothing break; } } ResetEvent(UserISREvent); } } sctsctl_cardservice_exit(board0); sctsctl_close(board0); return 0; VC++ MFC Sample Please fine the project in the Program files/soliton/pem1x/dlldev/vc/pemwin folder. 5. Contact Please contact us if you have experienced any problems. E-mail: info@soliton.com.tw Tel: +886-3-6566996 Fax: +886-3-6566883 18