#include "hardware_task.h"

#include <io.h>
#include <stdio.h>


#define REG_START_OFFSET 0
#define START 1

#define REG_STATE_OFFSET 1
#define REG_CYCLE_COUNT_OFFSET 2
#define REG_CONFIG_OFFSET 3

void hardware_task_start( uint32_t base ) {
    IOWR( base, REG_START_OFFSET, START );
}

uint32_t hardware_task_get_state( uint32_t base ) {
    return IORD( base, REG_STATE_OFFSET );
}

uint32_t hardware_task_get_cycle_count( uint32_t base ) {
    return IORD( base, REG_CYCLE_COUNT_OFFSET );
}

void hardware_task_set_config( uint32_t base, uint32_t offset, uint32_t value ) {
    IOWR( base, REG_CONFIG_OFFSET + offset, value );
}
uint32_t hardware_task_get_config( uint32_t base, uint32_t offset ) {
    return IORD( base, REG_CONFIG_OFFSET + offset );
}

