Line 7... |
Line 7... |
|
|
#include "platform.h"
|
#include "platform.h"
|
#include "potato.h"
|
#include "potato.h"
|
|
|
#include "gpio.h"
|
#include "gpio.h"
|
|
#include "seg7.h"
|
#include "sha256.h"
|
#include "sha256.h"
|
#include "timer.h"
|
#include "timer.h"
|
#include "uart.h"
|
#include "uart.h"
|
|
|
static int led_status = 0;
|
static int led_status = 0;
|
Line 27... |
Line 28... |
if(cause == ((1 << CAUSE_INTERRUPT_BIT) | (CAUSE_IRQ_BASE + 5))) // Timer interrupt
|
if(cause == ((1 << CAUSE_INTERRUPT_BIT) | (CAUSE_IRQ_BASE + 5))) // Timer interrupt
|
{
|
{
|
uart_puts(IO_ADDRESS(UART_BASE), "Hashes per second: ");
|
uart_puts(IO_ADDRESS(UART_BASE), "Hashes per second: ");
|
uart_puth(IO_ADDRESS(UART_BASE), hashes_per_second);
|
uart_puth(IO_ADDRESS(UART_BASE), hashes_per_second);
|
uart_puts(IO_ADDRESS(UART_BASE), "\n\r");
|
uart_puts(IO_ADDRESS(UART_BASE), "\n\r");
|
|
seg7_set_value(IO_ADDRESS(SEG7_BASE), hashes_per_second);
|
|
|
if(led_status == 0)
|
if(led_status == 0)
|
{
|
{
|
gpio_set_output(IO_ADDRESS(GPIO2_BASE), 1);
|
gpio_set_output(IO_ADDRESS(GPIO2_BASE), 1);
|
led_status = 1;
|
led_status = 1;
|
Line 58... |
Line 60... |
{
|
{
|
// Configure GPIOs:
|
// Configure GPIOs:
|
gpio_set_direction(IO_ADDRESS(GPIO1_BASE), 0x0000); // Switches
|
gpio_set_direction(IO_ADDRESS(GPIO1_BASE), 0x0000); // Switches
|
gpio_set_direction(IO_ADDRESS(GPIO2_BASE), 0xffff); // LEDs
|
gpio_set_direction(IO_ADDRESS(GPIO2_BASE), 0xffff); // LEDs
|
|
|
|
// Configure the 7-segment displays:
|
|
seg7_set_enabled_displays(IO_ADDRESS(SEG7_BASE), 0xff);
|
|
seg7_set_value(IO_ADDRESS(SEG7_BASE), 0);
|
|
|
// Set up the timer:
|
// Set up the timer:
|
timer_set(IO_ADDRESS(TIMER_BASE), SYSTEM_CLK_FREQ);
|
timer_set(IO_ADDRESS(TIMER_BASE), SYSTEM_CLK_FREQ);
|
|
|
// Print a startup message:
|
// Print a startup message:
|
uart_puts(IO_ADDRESS(UART_BASE), "The Potato Processor SHA256 Benchmark\n\r\n\r");
|
uart_puts(IO_ADDRESS(UART_BASE), "The Potato Processor SHA256 Benchmark\n\r\n\r");
|