Skip to content

We Have Blinkenlights

April 11, 2018


This is a desperate travesty of my rusty system programming skills but it works.

I started out wanting to write a C program using GCCMVS and inline assembly language to toggle a LED on the Pi. I can get GCCMVS to run but it doesn’t recognize the asm() constructs. I ended up writing the whole thing in Assembly.

To get the led to blink the easiest approach was to get the hercules emulator to issue a shell command “echo X > /sys/class/gpio/gpio18/value ” where X is 1 to turn it on or 0 to turn it off.

A program under MVS can get the emulator to issue a command by passing it via “DIAG 8”. Hercules wants you to be in supervisor state so i needed to use modeset which wants you to be APF authorized so the program had to go into sys1.linklib.

I stole the bulk of the code from a program called MDDIAG8 by Mark Dickinson.
The shell commands to manipulate a GPIO pin came from here

#   Exports pin to userspace
echo "18" > /sys/class/gpio/export                  

# Sets pin 18 as an output
echo "out" > /sys/class/gpio/gpio18/direction

# Sets pin 18 to high
echo "1" > /sys/class/gpio/gpio18/value

# Sets pin 18 to low
echo "0" > /sys/class/gpio/gpio18/value 
Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: