Added the small support driver for the picoscope
Added a deploysics script The Tcl data and time functions were moved to the SICS kernel
This commit is contained in:
45
utils/deploysics
Executable file
45
utils/deploysics
Executable file
@ -0,0 +1,45 @@
|
||||
#!/usr/bin/tclsh
|
||||
#----------------------------------------------------------
|
||||
# A script for deploying SICS servers easily
|
||||
#
|
||||
# Mark Koennecke, April 2015
|
||||
#----------------------------------------------------------
|
||||
|
||||
set instlist [list amor boa dmc eiger focus hrpt mars \
|
||||
morpheus narziss orion poldi rita2 sans sans2 tasp trics]
|
||||
|
||||
|
||||
proc execCommand {command} {
|
||||
puts stdout "Doing $command"
|
||||
set status [catch {eval exec $command} msg]
|
||||
if {$status != 0} {
|
||||
puts stdout "ERROR: $msg "
|
||||
}
|
||||
}
|
||||
#-----------------------------------------------------------
|
||||
proc replaceServer {inst} {
|
||||
execCommand "ssh ${inst}@${inst} monit stop sicsserver"
|
||||
execCommand "ssh ${inst}@${inst} monit stop simserver"
|
||||
execCommand "scp ./SICServer ${inst}@${inst}:${inst}_sics"
|
||||
execCommand "ssh ${inst}@${inst} updatesicscommon"
|
||||
execCommand "ssh ${inst}@${inst} monit start sicsserver"
|
||||
execCommand "ssh ${inst}@${inst} monit start simserver"
|
||||
}
|
||||
|
||||
if {[llength $argv] < 1} {
|
||||
puts stdout "usage:\n\tdeploysics instname| all"
|
||||
exit 1
|
||||
}
|
||||
|
||||
set inst [lindex $argv]
|
||||
|
||||
if {[string compare $inst all] == 0} {
|
||||
foreach inst $instlist {
|
||||
replaceServer $inst
|
||||
}
|
||||
} else {
|
||||
replaceServer $inst
|
||||
}
|
||||
|
||||
puts stdout "Done"
|
||||
|
17
utils/picoscope/Makefile
Normal file
17
utils/picoscope/Makefile
Normal file
@ -0,0 +1,17 @@
|
||||
#--------------------------------------------------------------
|
||||
# This requires the picoscope software to be installed under
|
||||
# /opt
|
||||
#
|
||||
# Mark Koennecke, May 2015
|
||||
#--------------------------------------------------------------
|
||||
|
||||
|
||||
picocontrol: picocontrol.o
|
||||
gcc -g -o picocontrol picocontrol.o -L/opt/picoscope/lib -lps2000a
|
||||
|
||||
.c.o:
|
||||
gcc -g -c -I/opt/picoscope/include $*.c
|
||||
|
||||
clean:
|
||||
- rm picocontrol picocontrol.o
|
||||
|
17
utils/picoscope/Makefile.osx
Executable file
17
utils/picoscope/Makefile.osx
Executable file
@ -0,0 +1,17 @@
|
||||
#--------------------------------------------------------------
|
||||
# This requires the picoscope software to be installed under
|
||||
# /opt
|
||||
#
|
||||
# Mark Koennecke, May 2015
|
||||
#--------------------------------------------------------------
|
||||
|
||||
|
||||
picocontrol: picocontrol.o
|
||||
gcc -g -o picocontrol picocontrol.o -L/Applications/PicoScope6.app/Contents/Resources/lib -lps2000a
|
||||
|
||||
.c.o:
|
||||
gcc -g -c -I/Applications/PicoScope6.app/Contents/Resources/include $*.c
|
||||
|
||||
clean:
|
||||
- rm picocontrol picocontrol.o
|
||||
|
2472
utils/picoscope/PS2000Acon.c
Normal file
2472
utils/picoscope/PS2000Acon.c
Normal file
File diff suppressed because it is too large
Load Diff
BIN
utils/picoscope/picocontrol
Executable file
BIN
utils/picoscope/picocontrol
Executable file
Binary file not shown.
127
utils/picoscope/picocontrol.c
Normal file
127
utils/picoscope/picocontrol.c
Normal file
@ -0,0 +1,127 @@
|
||||
/**
|
||||
This is a little CLI program to control the picoscope frequency
|
||||
generator coming with the Pico Labs Picoscope 2206a oscilloscope
|
||||
|
||||
Mark Koennecke, May 2015
|
||||
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <libps2000a-1.1/ps2000aApi.h>
|
||||
#ifndef PICO_STATUS
|
||||
#include <libps2000a-1.1/PicoStatus.h>
|
||||
#endif
|
||||
|
||||
|
||||
static short handle;
|
||||
|
||||
/*--------------------------------------------------------------*/
|
||||
static void StopPico(void)
|
||||
{
|
||||
ps2000aCloseUnit(handle);
|
||||
}
|
||||
/*--------------------------------------------------------------*/
|
||||
static void SetGenerator(long freq, float ampl)
|
||||
{
|
||||
int status;
|
||||
|
||||
if(freq == 0){
|
||||
status = ps2000aSetSigGenBuiltIn(handle,
|
||||
0,
|
||||
0,
|
||||
PS2000A_DC_VOLTAGE,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
} else {
|
||||
status = ps2000aSetSigGenBuiltIn(handle,
|
||||
0,
|
||||
(unsigned long)ampl,
|
||||
PS2000A_SINE,
|
||||
(float)freq,
|
||||
(float)freq,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
if(status != PICO_OK){
|
||||
printf("Failed to configure signal generator with %d\n", status);
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int status;
|
||||
long int freq = 1000;
|
||||
float mult = 1000000, ampl = 1.*mult, tmp;
|
||||
char line[80], token[80];
|
||||
|
||||
status = ps2000aOpenUnit(&handle, NULL);
|
||||
if(status != PICO_OK){
|
||||
printf("Failed to open picoscope with %d\n", status);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
atexit(StopPico);
|
||||
|
||||
while(1) {
|
||||
memset(line,0,sizeof(line));
|
||||
fgets(line,sizeof(line),stdin);
|
||||
|
||||
if(strstr(line,"freq") != NULL){
|
||||
status = sscanf(line,"%s %f",token, &tmp);
|
||||
if(status == 2){
|
||||
freq = (unsigned int) tmp;
|
||||
SetGenerator(freq,ampl);
|
||||
printf("OK\n");
|
||||
} else {
|
||||
printf("freq %ld\n", freq);
|
||||
}
|
||||
} else if(strstr(line,"ampl") != NULL){
|
||||
status = sscanf(line,"%s %f",token, &tmp);
|
||||
if(status == 2){
|
||||
ampl = tmp*mult;
|
||||
SetGenerator(freq,ampl);
|
||||
printf("OK\n");
|
||||
} else {
|
||||
printf("ampl %f\n", ampl/mult);
|
||||
}
|
||||
} else if(strstr(line,"on") != NULL){
|
||||
SetGenerator(freq,ampl);
|
||||
printf("OK\n");
|
||||
}else if(strstr(line,"off") != NULL){
|
||||
SetGenerator(0,0);
|
||||
printf("OK\n");
|
||||
}else if(strstr(line,"exit") != NULL){
|
||||
ps2000aCloseUnit(handle);
|
||||
break;
|
||||
} else {
|
||||
printf("Parameter commands: freq (hz), ampl( V), on, off\n");
|
||||
}
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
}
|
41
utils/picoscope/picocontrol.plist
Normal file
41
utils/picoscope/picocontrol.plist
Normal file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Disabled</key>
|
||||
<true/>
|
||||
<key>Label</key>
|
||||
<string>picocontrol</string>
|
||||
<key>Program</key>
|
||||
<string>/Users/sinquser/src/picoscope/picocontrol</string>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>DYLD_LIBRARY_PATH</key>
|
||||
<string>/Applications/PicoScope6.app/Contents/Resources/lib</string>
|
||||
</dict>
|
||||
<key>Sockets</key>
|
||||
<dict>
|
||||
<key>Listeners</key>
|
||||
<dict>
|
||||
<key>SockServiceName</key>
|
||||
<string>ssh</string>
|
||||
<key>Bonjour</key>
|
||||
<array>
|
||||
<string>ssh</string>
|
||||
<string>sftp-ssh</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>inetdCompatibility</key>
|
||||
<dict>
|
||||
<key>Wait</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/dev/null</string>
|
||||
<key>SHAuthorizationRight</key>
|
||||
<string>system.preferences</string>
|
||||
<key>POSIXSpawnType</key>
|
||||
<string>Interactive</string>
|
||||
</dict>
|
||||
</plist>
|
12
utils/picoscope/picocontrol.xinetd
Executable file
12
utils/picoscope/picocontrol.xinetd
Executable file
@ -0,0 +1,12 @@
|
||||
service picocontrol
|
||||
{
|
||||
socket_type = stream
|
||||
protocol = tcp
|
||||
port = 3030
|
||||
type = UNLISTED
|
||||
wait = no
|
||||
user = root
|
||||
server = /usr/bin/picocontrol
|
||||
}
|
||||
|
||||
|
BIN
utils/picoscope/picosig
Executable file
BIN
utils/picoscope/picosig
Executable file
Binary file not shown.
69
utils/picoscope/picosig.c
Normal file
69
utils/picoscope/picosig.c
Normal file
@ -0,0 +1,69 @@
|
||||
/**
|
||||
This is a little CLi program to control the picoscope frequency
|
||||
generator coming with the Pico Labs Picoscope 2206a oscilloscope
|
||||
|
||||
Mark Koennecke, May 2015
|
||||
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <libps2000a-1.1/ps2000aApi.h>
|
||||
#ifndef PICO_STATUS
|
||||
#include <libps2000a-1.1/PicoStatus.h>
|
||||
#endif
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int freq, ampl, status;
|
||||
short handle;
|
||||
|
||||
if(argc < 3) {
|
||||
printf("Usage:\n\tpicosig freq ampl\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
freq = atoi(argv[1]);
|
||||
ampl = atoi(argv[2]);
|
||||
|
||||
printf("Found freq, ample = %d %d\n", freq, ampl);
|
||||
|
||||
status = ps2000aOpenUnit(&handle, NULL);
|
||||
if(status != PICO_OK){
|
||||
printf("Failed to open picoscope with %d\n", status);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
status = ps2000aSetSigGenBuiltIn(handle,
|
||||
0,
|
||||
(unsigned long)ampl,
|
||||
PS2000A_SINE,
|
||||
(float)freq,
|
||||
(float)freq,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
if(status != PICO_OK){
|
||||
printf("Failed to configure signal generator with %d\n", status);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sleep(5);
|
||||
|
||||
ps2000aCloseUnit(handle);
|
||||
printf("Done\n");
|
||||
}
|
Reference in New Issue
Block a user