November 15, 2024

Porting Kyu to the Zynq - Round 4 -- blinking the LEDs

In this case we have two of them: red and green. You might say this is just fun and frivolity, and maybe it is in part. But this pulls in two important drivers from my bare metal code. The "mio" and "gpio" drivers.

On the Antminer S9, there is a red and a green LED and they are connected to MIO pins. This means we don't need to configure the FPGA to get access to them (like we do on the Ebaz). There are 4 other super bright green LEDs that are connected to the FPGA -- we will get to those later.

The bare metal mio.c and gpio.c files simply copied over and compiled. I put the top level code (that was main.c in the bare metal demo) into led.c and this led to exercising some basic Kyu features. The blinking gets run by a "repeating thread". When it is running, the Kyu thread list looks like so:

  Thread:       name (  &tp   )    state     sem       pc       sp     pri
  Thread:      shell (20071eb4)   READY I          20004e5c 20534000   11
* Thread:        led (20071cdc)  REPEAT I          2000bb7c 20538000   25
  Thread:       idle (20071dc8)   READY C          2000bbd0 20536000 1234
The call to launch the "led" thread looks like this:
(void) thr_new_repeat ( "led", blinker, 0, 25, 0, 500 );
Using this tests some important Kyu functionality. We launch a new thread, and we exercise the timer to reschedule it every 500 ticks.
Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org