[20050812]
|
More NetBSD/toaster stuff (Updated)
OK, so this cute baby now also got an
article at The Inquirer,
and Christian von Kleist's posting
in the Slashdot thread
contains some nice details about how the toaster hardware is
accessed from NetBSD by using sysctls:
# sysctl -a | grep hw.t
hw.toaster0.led0_duty = 1
hw.toaster0.led0_width = 8
hw.toaster0.led1_duty = 2
hw.toaster0.led1_width = 16
hw.toaster0.led2_duty = 4
hw.toaster0.led2_width = 32
hw.toaster0.led3_duty = 8
hw.toaster0.led3_width = 64
hw.toaster0.magnetic_latch = 0
hw.toaster0.burner_element = 0
hw.toastersensors0.burnlevel_knob = 1593
hw.toastersensors0.cancel_key = 0
hw.toastersensors0.cancel_key_ticks = 13
hw.toastersensors0.toast_key = 0
hw.toastersensors0.toast_key_ticks = 4
hw.toastersensors0.bagel_key = 0
hw.toastersensors0.bagel_key_ticks = 6
hw.toastersensors0.warm_key = 0
hw.toastersensors0.warm_key_ticks = 7
hw.toastersensors0.frozen_key = 0
hw.toastersensors0.frozen_key_ticks = 10
hw.toastersensors0.toast_down = 0
hw.toastersensors0.toast_down_ticks = 50965
hw.tspld0.board_temp = 40250000
hw.tspld0.board_temp_5s = 40290128
hw.tspld0.board_temp_30s = 40477805
(The board_temp are the temperature in C, multiplied by 10^6, so right now it's at 40.25 degrees C.)
/usr/local/bin/toast is pretty complicated, but a basic toast script works like this:
#! /bin/sh
sysctl -w hw.toaster0.magnetic_latch=1
# user presses toast lever down now...
sysctl -w hw.toaster0.burner_element = 1
sleep 60
sysctl -w hw.toaster0.burner_element = 0
sysctl -w hw.toaster0.magnetic_latch=0
echo "Toast is done!"
Only root has write access to hw.toaster0.burner_element! :D
''
Update:
For the record, here's the
dmesg output of the system booting>
# dmesg
NetBSD 3.0_BETA (TS7200) #57: Mon Aug 8 00:34:41 MST 2005 joff@sayan.wifi.home:/home/joff/NetBSD-toaster/obj /sys/arch/evbarm/compile/TS7200
total memory = 32768 KB
avail memory = 28196 KB
mainbus0 (root)
cpu0 at mainbus0: ARM920T rev 0 (ARM9TDMI core)
cpu0: DC enabled IC enabled WB enabled EABT
cpu0: 16KB/32B 64-way Instruction cache
cpu0: 16KB/32B 64-way write-back-locking-A Data cache
epsoc0 at mainbus0: Cirrus Logic EP93xx SoC rev E0
epsoc0: fclk 200.03 Mhz hclk 100.01 Mhz pclk 50.01 Mhz
ohci0 at epsoc0 addr 0x80020000-0x80020fff intr 56
epclk0 at epsoc0 addr 0x80810000-0x8081008f intr 35
epe0 at epsoc0 addr 0x80010000-0x8001ffff intr 39
epe0: MAC address 00:d0:69:4f:af:76
ukphy0 at epe0 phy 1: Generic IEEE 802.3u media interface
ukphy0: OUI 0x0010a1, model 0x0021, rev. 9
ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
epcom0 at epsoc0 addr 0x808c0000-0x808c0fff intr 52
epcom1 at epsoc0 addr 0x808d0000-0x808d0fff intr 54
epcom1: console
ohci0: OHCI version 1.0
usb0 at ohci0: USB revision 1.0
uhub0 at usb0
uhub0: Cirrus Logic OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 3 ports with 3 removable, self powered
tspld0 at mainbus0: Technologic Systems TS-7200 rev C, features 0x1
tspld0: jumpers 0x7
tspld0: board temperature 21.93 degC (71.48 degF)
isa0 at tspld0: PC/104 expansion bus
tsdio0 at isa0 port 0x100-0x107: Technologic Systems TS-DIO24
toasterlcd0 at tsdio0: 4x40 text-mode hd44780 LCD
toasterlcd0: using port C, bits 0-7 as DB0-DB7
toasterlcd0: using port B, bits 0-3 as RS, WR, EN1, EN2
wsdisplay0 at toasterlcd0 kbdmux 1
wsmux1: connecting to wsdisplay0
toaster0 at tsdio0: internal toaster control outputs
toaster0: using port B, bits 4-7 for front panel LEDs
toaster0: using port A, bit 0 for magnetic latch
toaster0: using port A, bit 1 for burner element
wdc0 at tspld0: on-board CompactFlash socket
atabus0 at wdc0 channel 0
toastersensors0 at tspld0: internal toaster sensor inputs
toastersensors0: using signal DIO_0 for toast down sensor
toastersensors0: using signals DIO_1-DIO_5 for panel buttons
toastersensors0: using 12-bit MAX197-ADC channel 0 for burnlevel knob
wskbd0 at toastersensors0 mux 1
wskbd0: connecting to wsdisplay0
uhub1 at uhub0 port 1
uhub1: Chicony Generic USB Hub, class 9/0, rev 1.10/1.00, addr 2
uhub1: 3 ports with 2 removable, bus powered
uhidev0 at uhub1 port 1 configuration 1 interface 0
uhidev0: Chicony PFU-65 USB Keyboard, rev 1.10/1.00, addr 3, iclass 3/1
ukbd0 at uhidev0: 8 modifier keys, 6 key codes
wd0 at atabus0 drive 0:
wd0: drive supports 1-sector PIO transfers, LBA addressing
wd0: 488 MB, 993 cyl, 16 head, 63 sec, 512 bytes/sect x 1000944 sectors
wd0: drive supports PIO mode 4, DMA mode 2
wskbd1 at ukbd0 mux 1
wskbd1: connecting to wsdisplay0
boot device:
root on wd0a dumps on wd0b
WARNING: CHECK AND RESET THE DATE!
wsdisplay0: screen 0 added (std_toasterlcd, vt100 emulation)
wsdisplay0: screen 1 added (std_toasterlcd, vt100 emulation)
wsdisplay0: screen 2 added (std_toasterlcd, vt100 emulation)
wsdisplay0: screen 3 added (std_toasterlcd, vt100 emulation)
[Tags: embedded, toaster]
|