some hints of using voyage on WRAPs

Infos by Matthias m@box.li

vi /etc/modules

for the right watchdog (wd1100) insert following

wd1100 sysctl_wd_graceful=0 sysctl_wd_timeout=30

The value 30 in sysctl_wd_timeout is measured in “seconds”. On some systems, a normal reboot (which stops the watchdog daemon and then triggers the hardware watchdog..) 30s is not enough for a complete shutdown. 45-60s may be more appropriete.

for reading on-board temperature chip add

scx200_acb 
i2c-sensor
lm77

after reboot you can read temps with

cat /sys/bus/i2c/devices/0-0048/temp1_input

Automatic try to reboot on kernel panic is always a good idea:

/etc/sysctl.conf:
kernel.panic=2

Additional info by B. Anderson:

To manipulate the LEDs on a WRAP board, you can use the following script:

#!/bin/sh
#
# Script to control the LEDs on a WRAP board
# Written by B.W. Anderson
# LED access code contributed by Josef Liska
# Note: there is currently no way to read status of LEDs,
# and 1&2 are not programmable separately. So the assumed
# state of LED 1 is on, and not programmable. It will be
# on at the end of this script, regardless.
#
# Full listing of LED control commands:
# led 3 on
# echo "A" | dd of=/dev/port bs=1 count=1 seek=62466
# led 3 off
# echo "L" | dd of=/dev/port bs=1 count=1 seek=62466
# led 1&2 on
# echo "A" | dd of=/dev/port bs=1 count=1 seek=62464
# led 1&2 off
# echo "L" | dd of=/dev/port bs=1 count=1 seek=62464
# led 1 on 2 off
# echo "H" | dd of=/dev/port bs=1 count=1 seek=62464
# led 1 off 2 on
# echo "D" | dd of=/dev/port bs=1 count=1 seek=62464
#
#
# Test for presence of command line options
if [ $# -lt 2 ]; then
	echo "Usage: $0 [n] [state]"
echo "where n = 2 or 3 and state = on or off"
exit 1
fi

if [ $2 != "on" ] && [ $2 != "off" ]; then
	echo " LED state must be on or off"
	exit 1
fi

case $1 in
	2) if [ $2 = "on" ] ; then
			echo "A" | dd of=/dev/port bs=1 count=1 seek=62464 2> /dev/null
			echo "LED 2 is now on"
		else
			echo "H" | dd of=/dev/port bs=1 count=1 seek=62464 2> /dev/null
			echo "LED 2 is now off"
		fi;;
	3) if [ $2 = "on" ] ; then
			echo "A" | dd of=/dev/port bs=1 count=1 seek=62466 2> /dev/null
			echo "LED 3 is now on"
		else
			echo "L" | dd of=/dev/port bs=1 count=1 seek=62466 2> /dev/null
			echo "LED 3 is now off"
		fi;;
	*) echo "Must specify LED 2 or 3"
		exit 1;;
esac
exit 0

Uses include turning on one of the LEDs upon boot completion or successful wireless connection.

Controlling each led individually

info by Assaf Gordon (agordon88 [at] gmail.com)

This program allows to turn on, off, switch over or query the status of each led individually.

usage:

# wrap_led_ctl 2 off
# wrap_led_ctl 2 get
off
# wrap_led_ctl 2 on
# wrap_led_ctl 1 on
# wrap_led_ctl 3 swap
etc.

To compile:
Save this code as “wrap_led_ctl.c” on your host computer, run “gcc -o wrap_led_ctl wrap_led_ctl.c” and copy the resulting binary (wrap_led_ctl) to your voyage system.

/*
   WRAP board LEDs control program
   Copyright (C) 2006 Assaf Gordon
   Copyright (C) 2007 Vaclav Vobornik, http://Syslog.eu/
 
   
   Based on William Brack's gpio_ctl.c
   (http://list.voyage.hk/pipermail/voyage-linux/2006-June/000969.html)
 
   This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
 
    This program 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 General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <sys/io.h>
#include <stdio.h>
#include <stdlib.h>
 
/* This is the offset (this is always the offset on the WRAP board) of the F0BAR0 register */
#define DATA	0xf400
 
void usage()
{
	fprintf(stderr,"usage: wrap_led_ctl [LED] [CMD]\n"
			"\tLED = 1,2 or 3\n"
			"\tCMD = \"on\", \"off\", \"swap\" or \"get\"\n"
			"Read the WRAP board manual for details.\n" ) ;
	exit(0);
}
 
int main(int nargs, char **argv)
{
	unsigned int val ;
	unsigned int led ;
	unsigned int cmd ;
	
	unsigned int bits[3] = {2,3,18} ;
	
	if (nargs!=3)
		usage();
	
	led = atoi(argv[1]) ;
	if ( led<1 || led>3 ) {
		fprintf(stderr, "Error: invaid led number (%s)\n", argv[1]) ;
		exit(0);
	}
	led--;
	
	
	/* Request I/O prvileges */
	iopl(3);
	
	/*
	  Note about the port and offsets:
	  The main GPIO port number is fixed for the WRAP board at 0xF400
	  The Three LEDs on the WRAP board are connected to GPIO 2, 3 and 18.
	  (According to the WRAP board documentation).
	
	  In the SC1100 Data Book, this port is called "F0BAR0" (Table 6-30).
	  F0BAR0 + 0x00 is the "GPIO Data Out 0 Register" - a write port controlling GPIOs 0 to 31.
	  F0BAR0 + 0x04 is the "GPIO Data In 0 Register" - a read port, reporting the status of GPIOs 0 to 31.
	*/
 
	if (strncasecmp(argv[2],"get",3)==0) {
		val = inl(DATA + 0x04) ;
		val = val & ( 1 << bits[led] ) ;
		printf("%s\n", (val!=0) ? "off" : "on") ;
	}
	else if (strncasecmp(argv[2],"on",2)==0) {
		val = inl(DATA + 0x04) ;
		val = val & ~( 1 << bits[led] ) ;
		outl(val, DATA+0x00) ;
	}
	else if (strncasecmp(argv[2],"off",3)==0) {
		val = inl(DATA + 0x04) ;
		val = val | ( 1 << bits[led] ) ;
		outl(val, DATA+0x00) ;
	}
	else if (strncasecmp(argv[2],"swap",4)==0) {
		val = inl(DATA + 0x04) ;
		val = val ^ ( 1 << bits[led] ) ;
		outl(val, DATA+0x00) ;
	}
	return 0;
}
 
wrap.txt · Last modified: 2007/04/01 19:09 by 81.92.155.38
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki