expansionmgr.pp 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. {$MACRO ON}
  2. {$define Rsc := }
  3. (******************************************************************************
  4. *
  5. * Copyright (c) 2000 Palm, Inc. or its subsidiaries.
  6. * All rights reserved.
  7. *
  8. * File: ExpansionMgr.h
  9. *
  10. * Release: Palm OS SDK 4.0 (63220)
  11. *
  12. * Description:
  13. * Header file for Expansion Manager.
  14. *
  15. * History:
  16. * 02/25/00 jed Created by Jesse Donaldson.
  17. *
  18. *****************************************************************************)
  19. unit expansionmgr;
  20. interface
  21. uses palmos, coretraps, errorbase;
  22. const
  23. sysTrapExpansionMgr = sysTrapExpansionDispatch;
  24. expFtrIDVersion = 0; // ID of feature containing version of ExpansionMgr.
  25. // Check existence of this feature to see if ExpMgr is installed.
  26. expMgrVersionNum = UInt16(200); // version of the ExpansionMgr, obtained from the feature
  27. expInvalidSlotRefNum = 0;
  28. type
  29. ExpPollingProcPtr = function(slotLibRefNum: UInt16; slotPollRefConP: Pointer): Err;
  30. (************************************************************
  31. * Capabilities of the hardware device for ExpCardInfoType.capabilityFlags
  32. *************************************************************)
  33. const
  34. expCapabilityHasStorage = $00000001; // card supports reading (& maybe writing) sectors
  35. expCapabilityReadOnly = $00000002; // card is read only
  36. expCapabilitySerial = $00000004; // card supports dumb serial interface
  37. expCardInfoStringMaxLen = 31;
  38. type
  39. ExpCardInfoTag = record
  40. capabilityFlags: UInt32; // bits for different stuff the card supports
  41. manufacturerStr: array [0..expCardInfoStringMaxLen] of Char; // Manufacturer, e.g., "Palm", "Motorola", etc...
  42. productStr: array [0..expCardInfoStringMaxLen] of Char; // Name of product, e.g., "SafeBackup 32MB"
  43. deviceClassStr: array [0..expCardInfoStringMaxLen] of Char; // Type of product, e.g., "Backup", "Ethernet", etc.
  44. deviceUniqueIDStr: array [0..expCardInfoStringMaxLen] of Char; // Unique identifier for product, e.g., a serial number. Set to "" if no such identifier exists.
  45. end;
  46. ExpCardInfoType = ExpCardInfoTag;
  47. ExpCardInfoPtr = ^ExpCardInfoType;
  48. (************************************************************
  49. * Iterator start and stop constants.
  50. * Used by ExpSlotEnumerate
  51. *************************************************************)
  52. const
  53. expIteratorStart = 0;
  54. expIteratorStop = $ffffffff;
  55. (************************************************************
  56. * Bits in the 'handled' field used in Card Inserted and Removed notifications
  57. *************************************************************)
  58. expHandledVolume = $01; // any volumes associated with the card have been dealt with... the ExpansionMgr will not mount or unmount as appropriate.
  59. expHandledSound = $02; // Any pleasing sounds have already been played... the ExpansionMgr will not play a pleasing sound on this insertion/removal.
  60. (************************************************************
  61. * Error codes
  62. *************************************************************)
  63. expErrUnsupportedOperation = expErrorClass or 1; // unsupported or undefined opcode and/or creator
  64. expErrNotEnoughPower = expErrorClass or 2; // the required power is not available
  65. expErrCardNotPresent = expErrorClass or 3; // no card is present
  66. expErrInvalidSlotRefNum = expErrorClass or 4; // slot reference number is bad
  67. expErrSlotDeallocated = expErrorClass or 5; // slot reference number is within valid range, but has been deallocated.
  68. expErrCardNoSectorReadWrite = expErrorClass or 6; // the card does not support the
  69. // SlotDriver block read/write API
  70. expErrCardReadOnly = expErrorClass or 7; // the card does support R/W API
  71. // but the card is read only
  72. expErrCardBadSector = expErrorClass or 8; // the card does support R/W API
  73. // but the sector is bad
  74. expErrCardProtectedSector = expErrorClass or 9; // The card does support R/W API
  75. // but the sector is protected
  76. expErrNotOpen = expErrorClass or 10; // slot driver library has not been opened
  77. expErrStillOpen = expErrorClass or 11; // slot driver library is still open - maybe it was opened > once
  78. expErrUnimplemented = expErrorClass or 12; // Call is unimplemented
  79. expErrEnumerationEmpty = expErrorClass or 13; // No values remaining to enumerate
  80. expErrIncompatibleAPIVer = expErrorClass or 14; // The API version of this slot driver is not supported by this version of ExpansionMgr.
  81. (************************************************************
  82. * Common media types. Used by SlotCardMediaType and SlotMediaType.
  83. *************************************************************)
  84. expMediaType_Any = Rsc('wild'); // matches all media types when looking up a default directory
  85. expMediaType_MemoryStick = Rsc('mstk');
  86. expMediaType_CompactFlash = Rsc('cfsh');
  87. expMediaType_SecureDigital = Rsc('sdig');
  88. expMediaType_MultiMediaCard = Rsc('mmcd');
  89. expMediaType_SmartMedia = Rsc('smed');
  90. expMediaType_RAMDisk = Rsc('ramd'); // a RAM disk based media
  91. expMediaType_PoserHost = Rsc('pose'); // Host filesystem emulated by Poser
  92. expMediaType_MacSim = Rsc('PSim'); // Host filesystem emulated by Poser
  93. (************************************************************
  94. * Selectors for routines found in the Expansion manager. The order
  95. * of these selectors MUST match the jump table in ExpansionMgr.c.
  96. *************************************************************)
  97. expInit_ = 0;
  98. expSlotDriverInstall_ = 1;
  99. expSlotDriverRemove_ = 2;
  100. expSlotLibFind_ = 3;
  101. expSlotRegister_ = 4;
  102. expSlotUnregister_ = 5;
  103. expCardInserted_ = 6;
  104. expCardRemoved_ = 7;
  105. expCardPresent_ = 8;
  106. expCardInfo_ = 9;
  107. expSlotEnumerate_ = 10;
  108. expCardGetSerialPort_ = 11;
  109. expMaxSelector = expCardGetSerialPort_;
  110. function ExpInit: Err;
  111. function ExpSlotDriverInstall(dbCreator: UInt32; var slotLibRefNumP: UInt16): Err;
  112. function ExpSlotDriverRemove(slotLibRefNum: UInt16): Err;
  113. function ExpSlotLibFind(slotRefNum: UInt16; var slotLibRefNum: UInt16): Err;
  114. function ExpSlotRegister(slotLibRefNum: UInt16; var slotRefNum: UInt16): Err;
  115. function ExpSlotUnregister(slotRefNum: UInt16): Err;
  116. function ExpCardInserted(slotRefNum: UInt16): Err;
  117. function ExpCardRemoved(slotRefNum: UInt16): Err;
  118. function ExpCardPresent(slotRefNum: UInt16): Err;
  119. function ExpCardInfo(slotRefNum: UInt16; var infoP: ExpCardInfoType): Err;
  120. function ExpSlotEnumerate(var slotRefNumP: UInt16; var slotIteratorP: UInt32): Err;
  121. function ExpCardGetSerialPort(slotRefNum: UInt16; var portP: UInt32): Err;
  122. implementation
  123. (**)
  124. function __ExpInit: Err; syscall sysTrapExpansionMgr;
  125. function __ExpSlotDriverInstall(dbCreator: UInt32; var slotLibRefNumP: UInt16): Err; syscall sysTrapExpansionMgr;
  126. function __ExpSlotDriverRemove(slotLibRefNum: UInt16): Err; syscall sysTrapExpansionMgr;
  127. function __ExpSlotLibFind(slotRefNum: UInt16; var slotLibRefNum: UInt16): Err; syscall sysTrapExpansionMgr;
  128. function __ExpSlotRegister(slotLibRefNum: UInt16; var slotRefNum: UInt16): Err; syscall sysTrapExpansionMgr;
  129. function __ExpSlotUnregister(slotRefNum: UInt16): Err; syscall sysTrapExpansionMgr;
  130. function __ExpCardInserted(slotRefNum: UInt16): Err; syscall sysTrapExpansionMgr;
  131. function __ExpCardRemoved(slotRefNum: UInt16): Err; syscall sysTrapExpansionMgr;
  132. function __ExpCardPresent(slotRefNum: UInt16): Err; syscall sysTrapExpansionMgr;
  133. function __ExpCardInfo(slotRefNum: UInt16; var infoP: ExpCardInfoType): Err; syscall sysTrapExpansionMgr;
  134. function __ExpSlotEnumerate(var slotRefNumP: UInt16; var slotIteratorP: UInt32): Err; syscall sysTrapExpansionMgr;
  135. function __ExpCardGetSerialPort(slotRefNum: UInt16; var portP: UInt32): Err; syscall sysTrapExpansionMgr;
  136. (**)
  137. function ExpInit: Err;
  138. begin
  139. asm
  140. move.l #expInit_,D2;
  141. end;
  142. ExpInit := __ExpInit;
  143. end;
  144. function ExpSlotDriverInstall(dbCreator: UInt32; var slotLibRefNumP: UInt16): Err;
  145. begin
  146. asm
  147. move.l #expSlotDriverInstall_,D2;
  148. end;
  149. ExpSlotDriverInstall := __ExpSlotDriverInstall(dbCreator, slotLibRefNumP);
  150. end;
  151. function ExpSlotDriverRemove(slotLibRefNum: UInt16): Err;
  152. begin
  153. asm
  154. move.l #expSlotDriverRemove_,D2;
  155. end;
  156. ExpSlotDriverRemove := __ExpSlotDriverRemove(slotLibRefNum);
  157. end;
  158. function ExpSlotLibFind(slotRefNum: UInt16; var slotLibRefNum: UInt16): Err;
  159. begin
  160. asm
  161. move.l #expSlotLibFind_,D2;
  162. end;
  163. ExpSlotLibFind := __ExpSlotLibFind(slotRefNum, slotLibRefNum);
  164. end;
  165. function ExpSlotRegister(slotLibRefNum: UInt16; var slotRefNum: UInt16): Err;
  166. begin
  167. asm
  168. move.l #expSlotRegister_,D2;
  169. end;
  170. ExpSlotRegister := __ExpSlotRegister(slotLibRefNum, slotRefNum);
  171. end;
  172. function ExpSlotUnregister(slotRefNum: UInt16): Err;
  173. begin
  174. asm
  175. move.l #expSlotUnregister_,D2;
  176. end;
  177. ExpSlotUnregister := __ExpSlotUnregister(slotRefNum);
  178. end;
  179. function ExpCardInserted(slotRefNum: UInt16): Err;
  180. begin
  181. asm
  182. move.l #expCardInserted_,D2;
  183. end;
  184. ExpCardInserted := __ExpCardInserted(slotRefNum);
  185. end;
  186. function ExpCardRemoved(slotRefNum: UInt16): Err;
  187. begin
  188. asm
  189. move.l #expCardRemoved_,D2;
  190. end;
  191. ExpCardRemoved := __ExpCardRemoved(slotRefNum);
  192. end;
  193. function ExpCardPresent(slotRefNum: UInt16): Err;
  194. begin
  195. asm
  196. move.l #expCardPresent_,D2;
  197. end;
  198. ExpCardPresent := __ExpCardPresent(slotRefNum);
  199. end;
  200. function ExpCardInfo(slotRefNum: UInt16; var infoP: ExpCardInfoType): Err;
  201. begin
  202. asm
  203. move.l #expCardInfo_,D2;
  204. end;
  205. ExpCardInfo := __ExpCardInfo(slotRefNum, infoP);
  206. end;
  207. function ExpSlotEnumerate(var slotRefNumP: UInt16; var slotIteratorP: UInt32): Err;
  208. begin
  209. asm
  210. move.l #expSlotEnumerate_,D2;
  211. end;
  212. ExpSlotEnumerate := __ExpSlotEnumerate(slotRefNumP, slotIteratorP);
  213. end;
  214. function ExpCardGetSerialPort(slotRefNum: UInt16; var portP: UInt32): Err;
  215. begin
  216. asm
  217. move.l #expCardGetSerialPort_,D2;
  218. end;
  219. ExpCardGetSerialPort := __ExpCardGetSerialPort(slotRefNum, portP);
  220. end;
  221. end.