home *** CD-ROM | disk | FTP | other *** search
/ The Best of Mecomp Multimedia 2 / MECOMP-CD-II.iso / amiga / tools / system / serprefs / developers / includes / prefs / serial.i < prev   
Encoding:
Text File  |  1997-10-04  |  7.3 KB  |  240 lines

  1. IFND PREFS_SERIAL_I
  2. PREFS_SERIAL_I SET 1
  3. **
  4. ** $VER: serial.i 42.2 (4.10.1997) #ASMINCLUDE © Msi Software
  5. **
  6. ** File format for new (v1) serial preferences
  7. **
  8. ** Original (v38) structure was 33 in size, the new is 34 in size.
  9. **
  10. ** (C) Copyright 1997 Msi Software.
  11. ** All Rights Reserved
  12. **
  13.  
  14. ;---------------------------------------------------------------------------
  15.  
  16. IFND EXEC_TYPES_I
  17. INCLUDE "exec/types.i"
  18. ENDC
  19.  
  20. ;---------------------------------------------------------------------------
  21.  
  22. ID_SERL equ "SERL" ; Serial settings ID
  23. ID_SERN equ "SERN" ; Serial name ID
  24.  
  25.  
  26. STRUCTURE SerialPrefs,0
  27.  STRUCT sp_Reserved,3*4         ; System Reserved
  28.  ULONG  sp_Unit0Map             ; default unit
  29.  ULONG  sp_BaudRate             ; baud to be used
  30.  
  31.  ULONG  sp_InputBuffer          ; buffer size to be used (in bytes)
  32.  ULONG  sp_OutputBuffer         ; look above
  33.  
  34.  UBYTE  sp_InputHandshake       ; see handshake constants
  35.  UBYTE  sp_OutputHandshake      ; look above
  36.  
  37.  UBYTE  sp_Parity               ; see parity constants
  38.  UBYTE  sp_BitsPerChar          ; data bits (0-255)
  39.  UBYTE  sp_StopBits             ; stop bits (0-255)
  40.                                 ; End of old structure!
  41.  
  42.  UBYTE sp_SharedMode            ; See shared constants
  43.  
  44. LABEL SerialPrefs_SIZEOF        ; SIZEOF=34
  45.  
  46. ; "sername" Full pathname of device, (0 terminated)
  47. ; Stored in a separate IFF "SERN" CHUNK after the SERL chunk
  48.  
  49.  
  50. ; constants for SerialPrefs.sp_Parity
  51. PARITY_NONE  equ 0
  52. PARITY_EVEN  equ 1
  53. PARITY_ODD   equ 2
  54. PARITY_MARK  equ 3
  55. PARITY_SPACE equ 4
  56.  
  57. ; constants for SerialPrefs.sp_Input/OutputHandshaking
  58. HSHAKE_XON  equ 0
  59. HSHAKE_RTS  equ 1
  60. HSHAKE_NONE equ 2
  61.  
  62. ; End of old constants!
  63.  
  64.  
  65. ; constants for SerialPrefs.sp_ShareMode
  66. SHARE_NONE equ 0
  67. SHARE_ON equ 1
  68.  
  69.  
  70. ; some nice macros
  71. DEFSERNAME: MACRO
  72.  dc.b 'DEVS:serial.device',0
  73. ENDM
  74.  
  75. DEFSERENV: MACRO
  76.  dc.b 'ENV:Sys/serial.prefs',0
  77. ENDM
  78.  
  79. DEFSERENVARC: MACRO
  80.  dc.b 'ENVARC:Sys/serial.prefs',0
  81. ENDM
  82.  
  83. DEFSERPREFICON: MACRO
  84.  dc.b 'ENV:Sys/def_prefs',0
  85. ENDM
  86.  
  87. DEFSERPREFTOOL: MACRO
  88.  dc.b 'Sys:Prefs/Serial',0
  89. ENDM
  90.  
  91. ;---------------------------------------------------------------------------
  92.  
  93. ;  serial.prefs versions
  94. ;  SerPrefs uses the type entry in the PRHD chunk (prefheader)
  95. ;  to let you know that the prefs are different.
  96. ;  (INCLUDES:prefs/prefhdr.h)
  97. ;  The original serial.prefs keep that value 0,
  98. ;  and serial.prefs v42.x keep this value 1.
  99. ;  When the next serial.prefs is defined it will
  100. ;  have value 2 or something like that.
  101. ;  So check the type in the PRHD chunk,
  102. ;  since this is much better and safer than checking the size
  103. ;  of the SERL chunk :-)
  104. ;  If you find i.e 0 as the type in PRHD,
  105. ;  then DO NOT try to use any data after the stop bit,
  106. ;  since this most likely is an old serial.prefs.
  107. ;  This way old programs can use new prefs without problems,
  108. ;  (the old Serial programs will be ignorant to any extra data).
  109. ;  And new programs is able to use old prefs,
  110. ;  with no need for the user to convert the prefs.
  111. ;
  112. ;  A nice way to read the serial.prefs is:
  113. ;  1. get prefsheader.version
  114. ;  2. get prefsheader.type
  115. ;  3. get prefsheader.flags
  116. ;  4. if type is not 0 then report to user and abort
  117. ;  5. currently just ignore the flags
  118. ;  6. check SERL chunk lenght (do not use lenght for version checking)
  119. ;  7. process first part (v0)
  120. ;  8. if type was 1 process second part (v1)
  121. ;  9. (when v2 etc is used you would process it here and so on)
  122. ; 10. get SERN and process filename if any (perhaps get device version)
  123. ;
  124. ;  To avoid problems, always check that the lenght is "larger than 32",
  125. ;  do not check if it is 34 or 33 since even though it is 33
  126. ;  the bug cause it to become 34.
  127. ;  For v1 you should check the SERL lenght if it is larger than 34 or not,
  128. ;  if a v1 serial.prefs SERL chunk is less than 34, it is corrupt.
  129. ;  Doing this allow us to use the same code for v0
  130. ;  for v1 and v2 prefs, instead of separate v0,v1 ad v2 routines.
  131. ;  SerPrefs v2.1 use this method, resulting in much less code needed :-)
  132. ;
  133.    If you wonder why I used prefheader.type instead of prefheader.version,
  134. ;  it is because when using prefheader.version,
  135. ;  IPrefs complain about being unable to read the prefs,
  136. ;  and since serial.prefs has not realy changed,
  137. ;  but rather been extended this is silly since serial.prefs
  138. ;  no longer is backwards compatible.
  139. ;  But since there is no revision to use I had to use type instead,
  140. ;  after all v1 is a different prefs than v0 :-)
  141. ;  So by using type IPrefs is able to read the prefs as v0 prefs,
  142. ;  thus baud etc is used correctly.
  143.  
  144. ;  sharedmode
  145. ;  Due to a bug in the C= serial.prefs,
  146. ;  the SERL chunk pad is counted into the SERL chunk lenght.
  147. ;  To take advantage of this I used this "hidden" byte to
  148. ;  toggle sharedmode, please note that neither IPrefs or original Serial
  149. ;  is aware of this and will just ignore it (thinking it's a pad :-)
  150. ;  Since the IFF specs say a pad should always be zero,
  151. ;  we can count on it being correct (not corrupted by Serial prefs utils).
  152. ;  But since it is counted as a part of the chunk,
  153. ;  according to the IFF specs it is not a pad :-)
  154. ;  So we can count on the IFF system to not mess with it either,
  155. ;  so the result is a unused byte everyone ignores :-)
  156. ;  I decided the first best thing to add to serial.prefs was Shared Mode,
  157. ;  and what better place to start than the unused byte?
  158.  
  159. ;  bitsperchar
  160. ;  Common "Data Bits" (Bits Per Char):
  161. ;  5, 6, 7, 8.
  162. ;  8 is most used, and also the default value.
  163.  
  164. ;  Additional bits (for future use):
  165. ;  16, 32.
  166. ;  These are not used (hardly any hardware support >8 bits,
  167. ;  but to avoid updating of software,
  168. ;  these should be supported in preparation of new serial hardware.
  169.  
  170.  
  171. ;  stopbits
  172. ;  Common "Stop Bits":
  173. ;  0, 1, 2.
  174. ;  1 is most used, and also the default.
  175.  
  176.  
  177. ;  inputbuffer/outputbuffer
  178. ;  No real limits, can be up to the maximum 32bit value.
  179. ;  Or down to 64 bytes, the C= docs etc,
  180. ;  advise this value to be a multiple of 64.
  181. ;  Advised default is 4096 bytes, advised minimum is 512 bytes.
  182. ;  For simplicity use x*2, x/2 based values.
  183. ;  Like 512, 1024, 2048, 4096 etc, so the user don't have to
  184. ;  flip thru a bunch of numbers forever, or have to type it :-)
  185. ;  It's easier to keep the value a multiple of 64 also.
  186.  
  187.  
  188. ;  baudrate
  189. ;  No common or advised, this vary alot on modem/hardware/connection etc.
  190. ;  Can be odd/even, but using well know rates are HIGHLY ADVISED.
  191. ;  This to avoid confusing users as well as software/hardware :-)
  192.  
  193. ;  Here is a list of rates (as used in Msi Software's SerPrefs):
  194.  
  195. ;       75
  196. ;      110
  197. ;      150
  198. ;      300
  199. ;      600
  200. ;     1200
  201. ;     2400
  202. ;     4800
  203. ;     7200
  204. ;     9600 /* fax rate, default (old) */
  205. ;    14400
  206. ;    16800
  207. ;    19200 /* 14.4 rate, fax rate, common default */
  208. ;    21600
  209. ;    24000
  210. ;    26400
  211. ;    28800
  212. ;    31200
  213. ;    31250 /* MIDI rate, max rate on older software/Amiga */
  214. ;    33600
  215. ;    38400 /* 28.8/33.6 rate, advised default due to many 28.8 modems */
  216. ;    57600 /* Max (reliable) internal serial, can be used as 33.6 rate */
  217. ;    64000
  218. ;    62400
  219. ;    64800
  220. ;    65535
  221. ;    65536
  222. ;    76800
  223. ;   115200 /* Squirrel Surf (SCSI w/serial for A1200) can go this high */
  224. ;   230400
  225. ;   345600
  226. ;   460800
  227. ;   576000
  228. ;   614400
  229. ;   691200
  230. ;   806400
  231. ;   921600 (please note that the SerPrefs program may support even more)
  232.  
  233. ; Roger Hågensen <emsai@online.no>
  234. ; Msi Software - 5th July 1997
  235. ; http://www.sn.no/~msi/index.htm
  236.  
  237. ;---------------------------------------------------------------------------
  238.  
  239. ENDC ; PREFS_SERIAL_I
  240.