1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: 15: 16: 17:
18:
19: #ifndef _DEVICE_H_
20: #define _DEVICE_H_
21:
22:
23: #define OBJNAME_DMMBF "DEvt"
24: #define OBJNAME_DMSEM "DMSy"
25: #define OBJNAME_DMLOCK "DMLk"
26:
27: IMPORT T_IDEV knl_DefaultIDev;
28:
29: 30: 31:
32:
33: IMPORT DevCB knl_DevCBtbl[];
34: IMPORT QUEUE knl_UsedDevCB;
35: IMPORT QUEUE knl_FreeDevCB;
36:
37: #define MAX_UNIT 255
38:
39: 40: 41:
42: Inline ER knl_check_devid( ID devid )
43: {
44: devid >>= 8;
45: if ( devid < 1 || devid > MAX_REGDEV ) {
46: return E_ID;
47: }
48: return E_OK;
49: }
50:
51: 52: 53:
54: IMPORT OpnCB knl_OpnCBtbl[];
55: IMPORT QUEUE knl_FreeOpnCB;
56:
57: #define DD(opncb) ( (opncb) - knl_OpnCBtbl + 1 )
58: #define OPNCB(dd) ( knl_OpnCBtbl + ((dd) - 1) )
59:
60: IMPORT ReqCB knl_ReqCBtbl[];
61: IMPORT QUEUE knl_FreeReqCB;
62:
63: #define REQID(reqcb) ( (reqcb) - knl_ReqCBtbl + 1 )
64: #define REQCB(reqid) ( knl_ReqCBtbl + ((reqid) - 1) )
65:
66: #define DEVREQ_REQCB(devreq) ((ReqCB*)((B*)(devreq) - offsetof(ReqCB, req)))
67:
68: IMPORT ResCB knl_resource_control_block;
69:
70:
71: #include "limits.h"
72:
73:
74: IMPORT INT knl_DisSusCnt;
75:
76:
77: #define MAX_DISSUS INT_MAX
78:
79:
80: 81: 82:
83: Inline ER knl_call_abortfn( DevCB *devcb, ID tskid, T_DEVREQ *devreq, INT nreq )
84: {
85: ER ercd;
86: ABTFN abortfn;
87:
88: abortfn = (ABTFN)devcb->ddev.abortfn;
89:
90: DISABLE_INTERRUPT;
91: knl_ctxtsk->sysmode++;
92: ENABLE_INTERRUPT;
93: ercd = (*abortfn)(tskid, devreq, nreq, devcb->ddev.exinf);
94: DISABLE_INTERRUPT;
95: knl_ctxtsk->sysmode--;
96: ENABLE_INTERRUPT;
97:
98: return ercd;
99: }
100:
101:
102: IMPORT ID knl_request( ID dd, W start, void *buf, W size, TMO tmout, INT cmd );
103: IMPORT BOOL knl_chkopen( DevCB *devcb, INT unitno );
104: IMPORT void knl_delReqCB( ReqCB *reqcb );
105: IMPORT ResCB* knl_GetResCB( void );
106: IMPORT void knl_delOpnCB( OpnCB *opncb, BOOL free );
107: IMPORT ER knl_close_device( OpnCB *opncb, UINT option );
108:
109: #endif