/*
 * input_int.h
 *
 *  Created on: 2016/11/24
 *      Author: takayun
 */

#ifndef SWITCHES_INT_H_
#define SWITCHES_INT_H_

#include "system.h"

/**************************************************
 *						Defines
 **************************************************/

#define switches (volatile int *) SWITCHES_BASE
#define push_switches (volatile char *) PUSH_SWITCHES_BASE

typedef union {
	int sw;
	struct {
		unsigned int run_mode : 1;
		unsigned int rw_mode : 1;
		unsigned int program_selecter : 4;
		unsigned int memory_index : 4;
		unsigned int register_index : 4;
		unsigned int instruction_code : 4;
	} splited;
	struct {
		unsigned int : 10;
		unsigned int value : 8;
	} data;
} sw_t;

enum PushEvent{
	PUSH_NONE	= 1<<0,
	PUSH_ANY	= 1<<1,
	PUSH_VALSTR	= 1<<2,
	PUSH_INSSTR = 1<<3,
	PUSH_RUN	= 1<<4
};

/**************************************************
 *						Variables
 **************************************************/

extern unsigned char PUSH_EVENT;

/**************************************************
 *						Functions
 **************************************************/

/* Function: in_int
 * Sammary:
 *  全ての入力割り込みを行う
 * */
void in_int();

void push_int();

#endif /* SWITCHES_INT_H_ */
