]> rtime.felk.cvut.cz Git - can-usb1.git/blob - ulan/host/ul_drv/lazarus/ul_drvdef.pas
Initializing repo
[can-usb1.git] / ulan / host / ul_drv / lazarus / ul_drvdef.pas
1 unit ul_drvdef;
2 interface
3
4 {$DEFINE UL_INDIR}
5
6 {$IFDEF FPC}
7 {$PACKRECORDS C}
8 {$ENDIF}
9
10 //uses
11 //  Windows;
12
13
14   const
15      UL_BFL_LOCK = $8000;
16   { Message must be received by some proccess  }
17      UL_BFL_MSST = $4000;
18   { After succesfull proccessing move to proc_bll  }
19      UL_BFL_M2IN = $2000;
20   { Length of received frame must match expected len  }
21      UL_BFL_LNMM = $1000;
22   { Message cannot be proccessed - error  }
23      UL_BFL_FAIL = $0800;
24   { Multiframe message continues by next bll block  }
25      UL_BFL_TAIL = $0400;
26   { Send this frame  }
27      UL_BFL_SND = $0200;
28   { Receive answer frame into this bll block  }
29      UL_BFL_REC = $0100;
30   { Verify free space in buffer of destination station  }
31      UL_BFL_VERL = $0040;
32   { Do not try to repeat if error occurs  }
33      UL_BFL_NORE = $0020;
34   { If error occurs do wait with retry  }
35      UL_BFL_REWA = $0010;
36   { Request imediate proccessing of frame by receiver station  }
37      UL_BFL_PRQ = $0002;
38   { Request imediate acknowledge by receiving station  }
39      UL_BFL_ARQ = $0001;
40
41   type
42      {$IFDEF UL_INDIR}
43        ul_fd_t = Pointer;
44      {$ELSE}
45        ul_fd_t = THandle;
46      {$ENDIF}
47
48      ul_msginfo = record
49           dadr : longint;
50           sadr : longint;
51           cmd : longint;
52           flg : longint;
53           len : longint;
54           stamp : longword;
55        end;
56
57   const
58     {$IFDEF UL_INDIR}
59        UL_FD_INVALID = nil;
60     {$ELSE}
61        UL_FD_INVALID = INVALID_HANDLE_VALUE;
62     {$ENDIF}
63
64
65     {$IF Defined(WINDOWS)}
66        UL_DEV_NAME = '\\.\UL_DRV';
67     {$ELSEIF Defined(UNIX)}
68        UL_DEV_NAME = '/dev/ulan';
69     {$ELSE}
70       {$MESSAGE ERROR 'invalid OS'}
71     {$ENDIF}
72
73   {***************************************************************** }
74   { command definitions  }
75   { standard command codes
76      00H .. 3FH    store to buffer
77      40H .. 7FH    store to buffer without ACK
78      80H .. 9FH    proccess at onece
79      A0H .. BFH    process with additional receive
80      C0H .. FFH    process with additional send
81    }
82
83   { Reinitialize RS485  }
84
85   const
86      UL_CMD_RES = $80;
87   { Test free space in input buffer  }
88      UL_CMD_SFT = $81;
89   { Send identification  }
90      UL_CMD_SID = $F0;
91   { Send amount of free space in IB  }
92      UL_CMD_SFI = $F1;
93   { End of stepping  }
94      UL_CMD_TF0 = $98;
95   { Begin of stepping  }
96      UL_CMD_TF1 = $99;
97   { Do step  }
98      UL_CMD_STP = $9A;
99   { Additional debug commands  }
100      UL_CMD_DEB = $9B;
101   { Send state - for 8051 PCL PCH PSW ACC  }
102      UL_CMD_SPC = $DA;
103   { Read memory   T T B B L L  }
104      UL_CMD_RDM = $F8;
105   { Write mamory  T T B B L L  }
106      UL_CMD_WRM = $B8;
107   { Erase memory T T B B L L  }
108      UL_CMD_ERM = $88;
109
110 implementation
111 end.