device.h

来自「操作系统实验」· C头文件 代码 · 共 106 行

H
106
字号
// device.h: interface for the device class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_DEVICE_H__82D39F22_6DB7_460D_A350_BEC66C7CC5D3__INCLUDED_)
#define AFX_DEVICE_H__82D39F22_6DB7_460D_A350_BEC66C7CC5D3__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

typedef struct pcb
{
    int id;
	int devnum;
	int need;
	char state[8];
	char name[20];
	char deviceid[22];
	struct neicun *nstart;//指向分配的内存
	struct pcb *next;
};

struct chct
{
    int channelid;
	int state;
	int coctnum;
	struct coct *coct;
    struct pcb* pcbhead;
	struct pcb* pcbtail;
};

struct coct
{
    int controllerid;
	int state;
	struct chct *chct_;
    struct pcb* pcbhead;
	struct pcb* pcbtail;
};

struct dct
{
    char type[20];
	int id;
    int waite;
	int busy;
	struct coct *co;
	int retrytimes;
	struct pcb* pcbhead;
};

struct sdt
{
    char type[20];
    char deviceid[22];
	struct dct *dct_;
	int address;
	struct sdt *next;
};

struct dev
{
    int id;
	char name[20];
	bool exist;
};

struct exe
{
    char pcbname[10];
	char deviceid[22];
	int state;
};

class device  
{
public:
	void exedev();
	void run();
	bool existdev(int n);
	void outs(bool tf);
	void back();
	int add();
	int dele();
	int ask();
	void init();
	device();
	virtual ~device();
protected:
	struct chct ch[2];
    struct coct co[3];
    struct sdt *in;
	struct sdt *out;
    int inid;
	int outid;
	int pcbid;
	struct dev indev[4];
	struct dev outdev[4];
	int cod[3];
	struct exe exe[8];
};

#endif // !defined(AFX_DEVICE_H__82D39F22_6DB7_460D_A350_BEC66C7CC5D3__INCLUDED_)

⌨️ 快捷键说明

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