📄 board_at91ev40.h
字号:
/*
* Copyright (c) 2005 Zhejiang University, P.R.China
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
//=============================================================================
/**
* \file Arch/ARM/Board_AT91EV40.h
*
* $Id: Board_AT91EV40.h,v 1.2 2005/06/16 11:26:03 qilj Exp $
*
* \author zhao jun <junzhao_china@yahoo.com.cn>
*/
//=============================================================================
#include "Core/Board.h"
#ifdef WIN32
#include <conio.h>
#endif
class Core::Device;
#define AT91_IO_BASEADDRESS 0x0
namespace ARM {
class CPU_7TDMI;
class Board_AT91EV40 : public Core::Board<Core::u32>
{
public:
//! extern signals, for example fiq, irq, etc.
typedef enum{
FIQ_sig = 0,
IRQ_sig = 1,
UXINT_sig = 2,
NIC_sig = 3,
Signal_End
}Extern_Signal;
//! AIC register
typedef enum{
AIC_SMR0, AIC_SMR1, AIC_SMR31,
AIC_SVR0, AIC_SVR1, AIC_SVR31,
AIC_IVR, AIC_FVR, AIC_ISR,
AIC_IPR, AIC_IMR, AIC_CISR,
AIC_IECR, AIC_IDCR, AIC_ICCR,
AIC_ISCR, AIC_EOICR, AIC_SPU,
AIC_REG_END=19
}AIC_Reg;
//!Interruption type
typedef enum{
CLOCK_INT = 0,
Inter_Undefined
}Inter_Type;
//! it answers for all address of io
virtual Core::Memory_Result io_dispatch(Core::Memory_Access_Type type, Core::u32 start, \
size_t size, Core::Bytecode_Type & buffer);
//!Invoked in every CPU cycle
virtual void io_do_cycle(void);
//!Prepare the ROM when startup
virtual bool prepare_rom(void);
//!return the current highest interruption
virtual Core::Interrupt_Type get_highest_interrupt(void);//{return 0;}
//!call the interruption-function refer to parameter-"type"
virtual void on_interrupt(Core::Interrupt_Type type);
//!process IRQ or FIQ exception
void poll_extern_exception();
//! This method will be called when module is created
virtual void on_create(void);
//! This method will be called when module is destroyed
virtual void on_destroy(void);
//! This method will be called when module is created
virtual void on_reset(void);
//! load os kernel into memory, the address is already included in the kernel file
//bool load_kernel(std::string name);
//! load os filesystem into memory
bool load_fs(std::string name, Core::u32 addr);
//! set value to the which signal
void set_signal(Extern_Signal which, bool val);
//! test the which signal, return ture or false
bool test_signal(Extern_Signal which);
//! get the register of aic
Core::u32 & get_aic_reg(AIC_Reg whick);
//! clear the register's value into 0
void clear(AIC_Reg whick);
//! load all device into board
//void load_device();
//! io read, the unit is word
Core::Memory_Result io_read_word(Core::u32 start, size_t size, Core::Bytecode_Type & buffer);
//! io write, the unit is word
Core::Memory_Result io_write_word(Core::u32 start, size_t size, Core::Bytecode_Type & buffer);
//! unfix interrupt
void unfix_int(Core::Register_Int reg){}
//! fix interrupt
void fix_int(Core::Register_Int reg){}
//! clear clock into zero
void clear_clock();
//! descend clock 1 per instruction cycle
void descend_clock();
//! reset clock
void reset_clock();
//! test clock if zero
bool test_clock();
//! get clock
Core::u32 get_clock();
//! descend io_prescale 1 per io cycle
void descend_io_prescale();
//! reset io_prescale
void reset_io_prescale();
//! test io_prescale if zero
bool test_io_prescale();
#ifdef LINUX
//! check there is keyborad pressed
Core::s32 kb_input();
#define is_kb_input() kb_input()
#endif
#ifdef WIN32
Core::s32 kb_read(Core::s32 fd,char *buffer, Core::s32 count);
/* #define is_kb_input() kbhit()*/
bool is_kb_input()
{
return Core::Wukong_Get_System().get_key_event_count() != 0;
} //kbhit()
#endif
private:
bool signal_[Signal_End];
Core::u32 aic_reg_[AIC_REG_END];
Core::u32 clock;
Core::u32 io_prescale_;
//boad's devices
Core::Device<Core::u32> * uart_;
//lijc add
Core::Device<Core::u32> * nic8019_;
//whether there is nic8019 on board
bool is_nic8019_;
CPU_7TDMI *cpu_;
Core::MMU<Core::u32> *mmu_;
bool is_kb_input_;
//lijc add
bool is_nic_input_;
Core::u32 current_isr_;
};
#include "Board_AT91EV40_i.h"
} //namespace
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -