⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uart.h

📁 浙江大学的悟空嵌入式系统模拟器
💻 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   UART.h
*
*  $Id: UART.h,v 1.3 2005/06/21 02:56:05 qilj Exp $
*
*  \author  zhao jun <junzhao_china@yahoo.com.cn>
*/
//=============================================================================

#ifndef UART_H_INCLUDED
#define UART_H_INCLUDED

#include "Core/Device.h"

namespace DEVICE {

	class UART: public Core::Device_32Bit
	{
	public:

		~UART(void){}
		
		typedef enum{
			IN,
			OUT
		}Char_Type;

		//! read uart data into buffer
		virtual void on_mapped_memory_read(Core::u32 start, size_t size, Core::Bytecode_Type & buffer);

		//! write uart register
		virtual void on_mapped_memory_write(Core::u32 start, size_t  size, Core::Bytecode_Type & buffer);
		
		//! stop cpu when a special char input or output
		void stop_cpu(Core::u8 c, Char_Type type);

		//void set_rpr(Core::u32 val);

		//! This method will be called when module is created
		virtual void on_create(void){ name_ = "UART"; }

		//! 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){}

		virtual void notify(void){}

		//! set the size of receive buffer
		void set_rcr(Core::u32 val);

		//! get the address of receive buffer  
		Core::u32 & get_rpr();

		//! get the size of receive buffer
		Core::u32 & get_rcr();
		
	private:
		Core::u32 rpr;	//the address of receive buffer  
		Core::u32 rcr;  //the size of receive buffer
		Core::u32 tpr;  //the address of send buffer
		Core::u32 tcr;  // the size of send buffer

	};

#include "UART_i.h"
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -