DriverSynchronization.pas 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986
  1. {
  2. File: CarbonCore/DriverSynchronization.h
  3. Contains: Driver Synchronization Interfaces.
  4. The contents of this header file are deprecated.
  5. Use OSAtomic API instead.
  6. Copyright: © 1985-2011 by Apple Inc. All rights reserved.
  7. }
  8. {
  9. Modified for use with Free Pascal
  10. Version 308
  11. Please report any bugs to <[email protected]>
  12. }
  13. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  14. {$mode macpas}
  15. {$modeswitch cblocks}
  16. {$packenum 1}
  17. {$macro on}
  18. {$inline on}
  19. {$calling mwpascal}
  20. unit DriverSynchronization;
  21. interface
  22. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  23. {$setc GAP_INTERFACES_VERSION := $0308}
  24. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  25. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  26. {$endc}
  27. {$ifc defined CPUPOWERPC and defined CPUI386}
  28. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  29. {$endc}
  30. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  31. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  32. {$endc}
  33. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  34. {$setc __ppc__ := 1}
  35. {$elsec}
  36. {$setc __ppc__ := 0}
  37. {$endc}
  38. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  39. {$setc __ppc64__ := 1}
  40. {$elsec}
  41. {$setc __ppc64__ := 0}
  42. {$endc}
  43. {$ifc not defined __i386__ and defined CPUI386}
  44. {$setc __i386__ := 1}
  45. {$elsec}
  46. {$setc __i386__ := 0}
  47. {$endc}
  48. {$ifc not defined __x86_64__ and defined CPUX86_64}
  49. {$setc __x86_64__ := 1}
  50. {$elsec}
  51. {$setc __x86_64__ := 0}
  52. {$endc}
  53. {$ifc not defined __arm__ and defined CPUARM}
  54. {$setc __arm__ := 1}
  55. {$elsec}
  56. {$setc __arm__ := 0}
  57. {$endc}
  58. {$ifc not defined __arm64__ and defined CPUAARCH64}
  59. {$setc __arm64__ := 1}
  60. {$elsec}
  61. {$setc __arm64__ := 0}
  62. {$endc}
  63. {$ifc defined cpu64}
  64. {$setc __LP64__ := 1}
  65. {$elsec}
  66. {$setc __LP64__ := 0}
  67. {$endc}
  68. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  69. {$error Conflicting definitions for __ppc__ and __i386__}
  70. {$endc}
  71. {$ifc defined __ppc__ and __ppc__}
  72. {$setc TARGET_CPU_PPC := TRUE}
  73. {$setc TARGET_CPU_PPC64 := FALSE}
  74. {$setc TARGET_CPU_X86 := FALSE}
  75. {$setc TARGET_CPU_X86_64 := FALSE}
  76. {$setc TARGET_CPU_ARM := FALSE}
  77. {$setc TARGET_CPU_ARM64 := FALSE}
  78. {$setc TARGET_OS_MAC := TRUE}
  79. {$setc TARGET_OS_IPHONE := FALSE}
  80. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  81. {$setc TARGET_OS_EMBEDDED := FALSE}
  82. {$elifc defined __ppc64__ and __ppc64__}
  83. {$setc TARGET_CPU_PPC := FALSE}
  84. {$setc TARGET_CPU_PPC64 := TRUE}
  85. {$setc TARGET_CPU_X86 := FALSE}
  86. {$setc TARGET_CPU_X86_64 := FALSE}
  87. {$setc TARGET_CPU_ARM := FALSE}
  88. {$setc TARGET_CPU_ARM64 := FALSE}
  89. {$setc TARGET_OS_MAC := TRUE}
  90. {$setc TARGET_OS_IPHONE := FALSE}
  91. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  92. {$setc TARGET_OS_EMBEDDED := FALSE}
  93. {$elifc defined __i386__ and __i386__}
  94. {$setc TARGET_CPU_PPC := FALSE}
  95. {$setc TARGET_CPU_PPC64 := FALSE}
  96. {$setc TARGET_CPU_X86 := TRUE}
  97. {$setc TARGET_CPU_X86_64 := FALSE}
  98. {$setc TARGET_CPU_ARM := FALSE}
  99. {$setc TARGET_CPU_ARM64 := FALSE}
  100. {$ifc defined iphonesim}
  101. {$setc TARGET_OS_MAC := FALSE}
  102. {$setc TARGET_OS_IPHONE := TRUE}
  103. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  104. {$elsec}
  105. {$setc TARGET_OS_MAC := TRUE}
  106. {$setc TARGET_OS_IPHONE := FALSE}
  107. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  108. {$endc}
  109. {$setc TARGET_OS_EMBEDDED := FALSE}
  110. {$elifc defined __x86_64__ and __x86_64__}
  111. {$setc TARGET_CPU_PPC := FALSE}
  112. {$setc TARGET_CPU_PPC64 := FALSE}
  113. {$setc TARGET_CPU_X86 := FALSE}
  114. {$setc TARGET_CPU_X86_64 := TRUE}
  115. {$setc TARGET_CPU_ARM := FALSE}
  116. {$setc TARGET_CPU_ARM64 := FALSE}
  117. {$ifc defined iphonesim}
  118. {$setc TARGET_OS_MAC := FALSE}
  119. {$setc TARGET_OS_IPHONE := TRUE}
  120. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  121. {$elsec}
  122. {$setc TARGET_OS_MAC := TRUE}
  123. {$setc TARGET_OS_IPHONE := FALSE}
  124. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  125. {$endc}
  126. {$setc TARGET_OS_EMBEDDED := FALSE}
  127. {$elifc defined __arm__ and __arm__}
  128. {$setc TARGET_CPU_PPC := FALSE}
  129. {$setc TARGET_CPU_PPC64 := FALSE}
  130. {$setc TARGET_CPU_X86 := FALSE}
  131. {$setc TARGET_CPU_X86_64 := FALSE}
  132. {$setc TARGET_CPU_ARM := TRUE}
  133. {$setc TARGET_CPU_ARM64 := FALSE}
  134. {$setc TARGET_OS_MAC := FALSE}
  135. {$setc TARGET_OS_IPHONE := TRUE}
  136. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  137. {$setc TARGET_OS_EMBEDDED := TRUE}
  138. {$elifc defined __arm64__ and __arm64__}
  139. {$setc TARGET_CPU_PPC := FALSE}
  140. {$setc TARGET_CPU_PPC64 := FALSE}
  141. {$setc TARGET_CPU_X86 := FALSE}
  142. {$setc TARGET_CPU_X86_64 := FALSE}
  143. {$setc TARGET_CPU_ARM := FALSE}
  144. {$setc TARGET_CPU_ARM64 := TRUE}
  145. {$ifc defined ios}
  146. {$setc TARGET_OS_MAC := FALSE}
  147. {$setc TARGET_OS_IPHONE := TRUE}
  148. {$setc TARGET_OS_EMBEDDED := TRUE}
  149. {$elsec}
  150. {$setc TARGET_OS_MAC := TRUE}
  151. {$setc TARGET_OS_IPHONE := FALSE}
  152. {$setc TARGET_OS_EMBEDDED := FALSE}
  153. {$endc}
  154. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  155. {$elsec}
  156. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  157. {$endc}
  158. {$ifc defined __LP64__ and __LP64__ }
  159. {$setc TARGET_CPU_64 := TRUE}
  160. {$elsec}
  161. {$setc TARGET_CPU_64 := FALSE}
  162. {$endc}
  163. {$ifc defined FPC_BIG_ENDIAN}
  164. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  165. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  166. {$elifc defined FPC_LITTLE_ENDIAN}
  167. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  168. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  169. {$elsec}
  170. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  171. {$endc}
  172. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  173. {$setc CALL_NOT_IN_CARBON := FALSE}
  174. {$setc OLDROUTINENAMES := FALSE}
  175. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  176. {$setc OPAQUE_UPP_TYPES := TRUE}
  177. {$setc OTCARBONAPPLICATION := TRUE}
  178. {$setc OTKERNEL := FALSE}
  179. {$setc PM_USE_SESSION_APIS := TRUE}
  180. {$setc TARGET_API_MAC_CARBON := TRUE}
  181. {$setc TARGET_API_MAC_OS8 := FALSE}
  182. {$setc TARGET_API_MAC_OSX := TRUE}
  183. {$setc TARGET_CARBON := TRUE}
  184. {$setc TARGET_CPU_68K := FALSE}
  185. {$setc TARGET_CPU_MIPS := FALSE}
  186. {$setc TARGET_CPU_SPARC := FALSE}
  187. {$setc TARGET_OS_UNIX := FALSE}
  188. {$setc TARGET_OS_WIN32 := FALSE}
  189. {$setc TARGET_RT_MAC_68881 := FALSE}
  190. {$setc TARGET_RT_MAC_CFM := FALSE}
  191. {$setc TARGET_RT_MAC_MACHO := TRUE}
  192. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  193. {$setc TYPE_BOOL := FALSE}
  194. {$setc TYPE_EXTENDED := FALSE}
  195. {$setc TYPE_LONGLONG := TRUE}
  196. uses MacTypes;
  197. {$endc} {not MACOSALLINCLUDE}
  198. {$ifc TARGET_OS_MAC}
  199. {$ALIGN POWER}
  200. {
  201. * CompareAndSwap()
  202. *
  203. * Summary:
  204. * Compare and swap operation, performed atomically with respect to
  205. * all devices that participate in the coherency architecture of the
  206. * platform.
  207. *
  208. * Discussion:
  209. * The CompareAndSwap function compares the value at the specified
  210. * address with oldVal. The value of newValue is written to the
  211. * address only if oldValue and the value at the address are equal.
  212. * CompareAndSwap returns true if newValue is written to the
  213. * address; otherwise, it returns false.
  214. * This function guarantees atomicity only with main system memory.
  215. * It is specifically unsuitable for use on noncacheable memory such
  216. * as that in devices; this function cannot guarantee atomicity, for
  217. * example, on memory mapped from a PCI device.
  218. *
  219. * Parameters:
  220. *
  221. * oldValue:
  222. * The value to compare at address.
  223. *
  224. * newValue:
  225. * The value to write to address if oldValue compares true.
  226. *
  227. * address:
  228. * The 4-byte aligned address of the data to update atomically.
  229. *
  230. * Result:
  231. * true if newValue was written to the address.
  232. *
  233. * Availability:
  234. * Mac OS X: in version 10.0 and later in CoreServices.framework
  235. * CarbonLib: in CarbonLib 1.0 and later
  236. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  237. }
  238. function CompareAndSwap( oldValue: UInt32; newValue: UInt32; var address: UInt32 ): Boolean; external name '_CompareAndSwap';
  239. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  240. {
  241. * TestAndClear()
  242. *
  243. * Summary:
  244. * Bit test and clear operation, performed atomically with respect
  245. * to all devices that participate in the coherency architecture of
  246. * the platform.
  247. *
  248. * Discussion:
  249. * The TestAndClear function clears a single bit in a byte at a
  250. * specified address. It returns false if the bit was already clear,
  251. * true otherwise.
  252. * ------------------------------------------------------------
  253. * THIS ROUTINE WAS DOCUMENTED AS RETURNING TRUE IF THE BIT WAS
  254. * ALREADY CLEAR AND FALSE OTHERWISE, and on MAC OS 9.x and earlier
  255. * it did have this behavior, but on Mac OS X 10.0 and later it has
  256. * always returned the state of the bit before the operation ( false
  257. * if the bit was clear; true if it was set ). We have decided that
  258. * changing the documentation ( leaving the implementation as is )
  259. * is less risky than changing the implementation to match the
  260. * documented behavior.
  261. * ------------------------------------------------------------
  262. * This function guarantees atomicity only with main system memory.
  263. * It is specifically unsuitable for use on noncacheable memory such
  264. * as that in devices; this function cannot guarantee atomicity, for
  265. * example, on memory mapped from a PCI device.
  266. *
  267. * Parameters:
  268. *
  269. * bit:
  270. * The bit number in the range 0 through 7.
  271. *
  272. * address:
  273. * The address of the byte to update atomically.
  274. *
  275. * Result:
  276. * true if the bit was already clear, false otherwise.
  277. *
  278. * Availability:
  279. * Mac OS X: in version 10.0 and later in CoreServices.framework
  280. * CarbonLib: in CarbonLib 1.0 and later
  281. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  282. }
  283. function TestAndClear( bit: UInt32; address: UnivPtr ): Boolean; external name '_TestAndClear';
  284. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  285. {
  286. * TestAndSet()
  287. *
  288. * Summary:
  289. * Bit test and set operation, performed atomically with respect to
  290. * all devices that participate in the coherency architecture of the
  291. * platform.
  292. * This function guarantees atomicity only with main system memory.
  293. * It is specifically unsuitable for use on noncacheable memory such
  294. * as that in devices; this function cannot guarantee atomicity, for
  295. * example, on memory mapped from a PCI device.
  296. *
  297. * Discussion:
  298. * The TestAndSet function sets a single bit in a byte at a
  299. * specified address. It returns true if the bit was already set,
  300. * false otherwise.
  301. *
  302. * Parameters:
  303. *
  304. * bit:
  305. * The bit number in the range 0 through 7.
  306. *
  307. * address:
  308. * The address of the byte to update atomically.
  309. *
  310. * Result:
  311. * true if the bit was already set, false otherwise.
  312. *
  313. * Availability:
  314. * Mac OS X: in version 10.0 and later in CoreServices.framework
  315. * CarbonLib: in CarbonLib 1.0 and later
  316. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  317. }
  318. function TestAndSet( bit: UInt32; address: UnivPtr ): Boolean; external name '_TestAndSet';
  319. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  320. {
  321. * IncrementAtomic8()
  322. *
  323. * Summary:
  324. * 8-bit increment operation, performed atomically with respect to
  325. * all devices that participate in the coherency architecture of the
  326. * platform.
  327. *
  328. * Discussion:
  329. * The IncrementAtomic8 function increments the value at the
  330. * specified address by one and returns the original value.
  331. * This function guarantees atomicity only with main system memory.
  332. * It is specifically unsuitable for use on noncacheable memory such
  333. * as that in devices; this function cannot guarantee atomicity, for
  334. * example, on memory mapped from a PCI device.
  335. *
  336. * Parameters:
  337. *
  338. * address:
  339. * The address of the value to update atomically.
  340. *
  341. * Result:
  342. * The value before the increment.
  343. *
  344. * Availability:
  345. * Mac OS X: in version 10.0 and later in CoreServices.framework
  346. * CarbonLib: in CarbonLib 1.0 and later
  347. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  348. }
  349. function IncrementAtomic8( var address: SInt8 ): SInt8; external name '_IncrementAtomic8';
  350. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  351. {
  352. * DecrementAtomic8()
  353. *
  354. * Summary:
  355. * 8-bit decrement operation, performed atomically with respect to
  356. * all devices that participate in the coherency architecture of the
  357. * platform.
  358. *
  359. * Discussion:
  360. * The DecrementAtomic8 function decrements the value at the
  361. * specified address by one and returns the original value.
  362. * This function guarantees atomicity only with main system memory.
  363. * It is specifically unsuitable for use on noncacheable memory such
  364. * as that in devices; this function cannot guarantee atomicity, for
  365. * example, on memory mapped from a PCI device.
  366. *
  367. * Parameters:
  368. *
  369. * address:
  370. * The address of the value to update atomically.
  371. *
  372. * Result:
  373. * The value before the decrement.
  374. *
  375. * Availability:
  376. * Mac OS X: in version 10.0 and later in CoreServices.framework
  377. * CarbonLib: in CarbonLib 1.0 and later
  378. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  379. }
  380. function DecrementAtomic8( var address: SInt8 ): SInt8; external name '_DecrementAtomic8';
  381. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  382. {
  383. * AddAtomic8()
  384. *
  385. * Summary:
  386. * 8-bit add operation, performed atomically with respect to all
  387. * devices that participate in the coherency architecture of the
  388. * platform.
  389. *
  390. * Discussion:
  391. * The AddAtomic8 function adds the specified amount to the value at
  392. * the specified address and returns the original value.
  393. * This function guarantees atomicity only with main system memory.
  394. * It is specifically unsuitable for use on noncacheable memory such
  395. * as that in devices; this function cannot guarantee atomicity, for
  396. * example, on memory mapped from a PCI device.
  397. *
  398. * Parameters:
  399. *
  400. * amount:
  401. * The amount to add.
  402. *
  403. * address:
  404. * The address of the value to update atomically.
  405. *
  406. * Result:
  407. * The value before the addition
  408. *
  409. * Availability:
  410. * Mac OS X: in version 10.0 and later in CoreServices.framework
  411. * CarbonLib: in CarbonLib 1.0 and later
  412. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  413. }
  414. function AddAtomic8( amount: SInt32; var address: SInt8 ): SInt8; external name '_AddAtomic8';
  415. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  416. {
  417. * BitAndAtomic8()
  418. *
  419. * Summary:
  420. * 8-bit logical and operation, performed atomically with respect to
  421. * all devices that participate in the coherency architecture of the
  422. * platform.
  423. *
  424. * Discussion:
  425. * The BitAndAtomic8 function logically ands the bits of the
  426. * specified mask into the value at the specified address and
  427. * returns the original value.
  428. * This function guarantees atomicity only with main system memory.
  429. * It is specifically unsuitable for use on noncacheable memory such
  430. * as that in devices; this function cannot guarantee atomicity, for
  431. * example, on memory mapped from a PCI device.
  432. *
  433. * Parameters:
  434. *
  435. * mask:
  436. * The mask to logically and with the value.
  437. *
  438. * address:
  439. * The address of the value to update atomically.
  440. *
  441. * Result:
  442. * The value before the bitwise operation.
  443. *
  444. * Availability:
  445. * Mac OS X: in version 10.0 and later in CoreServices.framework
  446. * CarbonLib: in CarbonLib 1.0 and later
  447. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  448. }
  449. function BitAndAtomic8( mask: UInt32; var address: UInt8 ): UInt8; external name '_BitAndAtomic8';
  450. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  451. {
  452. * BitOrAtomic8()
  453. *
  454. * Summary:
  455. * 8-bit logical or operation, performed atomically with respect to
  456. * all devices that participate in the coherency architecture of the
  457. * platform.
  458. * This function guarantees atomicity only with main system memory.
  459. * It is specifically unsuitable for use on noncacheable memory such
  460. * as that in devices; this function cannot guarantee atomicity, for
  461. * example, on memory mapped from a PCI device.
  462. *
  463. * Discussion:
  464. * The BitOrAtomic8 function logically ors the bits of the specified
  465. * mask into the value at the specified address and returns the
  466. * original value.
  467. *
  468. * Parameters:
  469. *
  470. * mask:
  471. * The mask to logically or with the value.
  472. *
  473. * address:
  474. * The address of the value to update atomically.
  475. *
  476. * Result:
  477. * The value before the bitwise operation.
  478. *
  479. * Availability:
  480. * Mac OS X: in version 10.0 and later in CoreServices.framework
  481. * CarbonLib: in CarbonLib 1.0 and later
  482. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  483. }
  484. function BitOrAtomic8( mask: UInt32; var address: UInt8 ): UInt8; external name '_BitOrAtomic8';
  485. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  486. {
  487. * BitXorAtomic8()
  488. *
  489. * Summary:
  490. * 8-bit logical xor operation, performed atomically with respect to
  491. * all devices that participate in the coherency architecture of the
  492. * platform.
  493. * This function guarantees atomicity only with main system memory.
  494. * It is specifically unsuitable for use on noncacheable memory such
  495. * as that in devices; this function cannot guarantee atomicity, for
  496. * example, on memory mapped from a PCI device.
  497. *
  498. * Discussion:
  499. * The BitXorAtomic8 function logically xors the bits of the
  500. * specified mask into the value at the specified address and
  501. * returns the original value.
  502. *
  503. * Parameters:
  504. *
  505. * mask:
  506. * The mask to logically or with the value.
  507. *
  508. * address:
  509. * The address of the value to update atomically.
  510. *
  511. * Result:
  512. * The value before the bitwise operation.
  513. *
  514. * Availability:
  515. * Mac OS X: in version 10.0 and later in CoreServices.framework
  516. * CarbonLib: in CarbonLib 1.0 and later
  517. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  518. }
  519. function BitXorAtomic8( mask: UInt32; var address: UInt8 ): UInt8; external name '_BitXorAtomic8';
  520. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  521. {
  522. * IncrementAtomic16()
  523. *
  524. * Summary:
  525. * 16-bit increment operation, performed atomically with respect to
  526. * all devices that participate in the coherency architecture of the
  527. * platform.
  528. *
  529. * Discussion:
  530. * The IncrementAtomic16 function increments the value at the
  531. * specified address by one and returns the original value.
  532. * This function guarantees atomicity only with main system memory.
  533. * It is specifically unsuitable for use on noncacheable memory such
  534. * as that in devices; this function cannot guarantee atomicity, for
  535. * example, on memory mapped from a PCI device.
  536. *
  537. * Parameters:
  538. *
  539. * address:
  540. * The 2-byte aligned address of the value to update atomically.
  541. *
  542. * Result:
  543. * The value before the increment.
  544. *
  545. * Availability:
  546. * Mac OS X: in version 10.0 and later in CoreServices.framework
  547. * CarbonLib: in CarbonLib 1.0 and later
  548. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  549. }
  550. function IncrementAtomic16( var address: SInt16 ): SInt16; external name '_IncrementAtomic16';
  551. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  552. {
  553. * DecrementAtomic16()
  554. *
  555. * Summary:
  556. * 16-bit decrement operation, performed atomically with respect to
  557. * all devices that participate in the coherency architecture of the
  558. * platform.
  559. *
  560. * Discussion:
  561. * The DecrementAtomic16 function decrements the value at the
  562. * specified address by one and returns the original value.
  563. * This function guarantees atomicity only with main system memory.
  564. * It is specifically unsuitable for use on noncacheable memory such
  565. * as that in devices; this function cannot guarantee atomicity, for
  566. * example, on memory mapped from a PCI device.
  567. *
  568. * Parameters:
  569. *
  570. * address:
  571. * The 2-byte aligned address of the value to update atomically.
  572. *
  573. * Result:
  574. * The value before the decrement.
  575. *
  576. * Availability:
  577. * Mac OS X: in version 10.0 and later in CoreServices.framework
  578. * CarbonLib: in CarbonLib 1.0 and later
  579. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  580. }
  581. function DecrementAtomic16( var address: SInt16 ): SInt16; external name '_DecrementAtomic16';
  582. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  583. {
  584. * AddAtomic16()
  585. *
  586. * Summary:
  587. * 16-bit add operation, performed atomically with respect to all
  588. * devices that participate in the coherency architecture of the
  589. * platform.
  590. *
  591. * Discussion:
  592. * The AddAtomic16 function adds the specified amount to the value
  593. * at the specified address and returns the original value.
  594. * This function guarantees atomicity only with main system memory.
  595. * It is specifically unsuitable for use on noncacheable memory such
  596. * as that in devices; this function cannot guarantee atomicity, for
  597. * example, on memory mapped from a PCI device.
  598. *
  599. * Parameters:
  600. *
  601. * amount:
  602. * The amount to add.
  603. *
  604. * address:
  605. * The 2-byte aligned address of the value to update atomically.
  606. *
  607. * Result:
  608. * The value before the addition
  609. *
  610. * Availability:
  611. * Mac OS X: in version 10.0 and later in CoreServices.framework
  612. * CarbonLib: in CarbonLib 1.0 and later
  613. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  614. }
  615. function AddAtomic16( amount: SInt32; var address: SInt16 ): SInt16; external name '_AddAtomic16';
  616. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  617. {
  618. * BitAndAtomic16()
  619. *
  620. * Summary:
  621. * 16-bit logical and operation, performed atomically with respect
  622. * to all devices that participate in the coherency architecture of
  623. * the platform.
  624. *
  625. * Discussion:
  626. * The BitAndAtomic16 function logically ands the bits of the
  627. * specified mask into the value at the specified address and
  628. * returns the original value.
  629. * This function guarantees atomicity only with main system memory.
  630. * It is specifically unsuitable for use on noncacheable memory such
  631. * as that in devices; this function cannot guarantee atomicity, for
  632. * example, on memory mapped from a PCI device.
  633. *
  634. * Parameters:
  635. *
  636. * mask:
  637. * The mask to logically and with the value.
  638. *
  639. * address:
  640. * The 2-byte aligned address of the value to update atomically.
  641. *
  642. * Result:
  643. * The value before the bitwise operation.
  644. *
  645. * Availability:
  646. * Mac OS X: in version 10.0 and later in CoreServices.framework
  647. * CarbonLib: in CarbonLib 1.0 and later
  648. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  649. }
  650. function BitAndAtomic16( mask: UInt32; var address: UInt16 ): UInt16; external name '_BitAndAtomic16';
  651. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  652. {
  653. * BitOrAtomic16()
  654. *
  655. * Summary:
  656. * 16-bit logical or operation, performed atomically with respect to
  657. * all devices that participate in the coherency architecture of the
  658. * platform.
  659. *
  660. * Discussion:
  661. * The BitOrAtomic16 function logically ors the bits of the
  662. * specified mask into the value at the specified address and
  663. * returns the original value. This function guarantees atomicity
  664. * only with main system memory. It is specifically unsuitable for
  665. * use on noncacheable memory such as that in devices; this function
  666. * cannot guarantee atomicity, for example, on memory mapped from a
  667. * PCI device.
  668. *
  669. * Parameters:
  670. *
  671. * mask:
  672. * The mask to logically or with the value.
  673. *
  674. * address:
  675. * The 2-byte aligned address of the value to update atomically.
  676. *
  677. * Result:
  678. * The value before the bitwise operation.
  679. *
  680. * Availability:
  681. * Mac OS X: in version 10.0 and later in CoreServices.framework
  682. * CarbonLib: in CarbonLib 1.0 and later
  683. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  684. }
  685. function BitOrAtomic16( mask: UInt32; var address: UInt16 ): UInt16; external name '_BitOrAtomic16';
  686. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  687. {
  688. * BitXorAtomic16()
  689. *
  690. * Summary:
  691. * 16-bit logical xor operation, performed atomically with respect
  692. * to all devices that participate in the coherency architecture of
  693. * the platform.
  694. *
  695. * Discussion:
  696. * The BitXorAtomic16 function logically xors the bits of the
  697. * specified mask into the value at the specified address and
  698. * returns the original value. This function guarantees atomicity
  699. * only with main system memory. It is specifically unsuitable for
  700. * use on noncacheable memory such as that in devices; this function
  701. * cannot guarantee atomicity, for example, on memory mapped from a
  702. * PCI device.
  703. *
  704. * Parameters:
  705. *
  706. * mask:
  707. * The mask to logically or with the value.
  708. *
  709. * address:
  710. * The 2-byte aligned address of the value to update atomically.
  711. *
  712. * Result:
  713. * The value before the bitwise operation.
  714. *
  715. * Availability:
  716. * Mac OS X: in version 10.0 and later in CoreServices.framework
  717. * CarbonLib: in CarbonLib 1.0 and later
  718. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  719. }
  720. function BitXorAtomic16( mask: UInt32; var address: UInt16 ): UInt16; external name '_BitXorAtomic16';
  721. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  722. {
  723. * IncrementAtomic()
  724. *
  725. * Summary:
  726. * 32-bit increment operation, performed atomically with respect to
  727. * all devices that participate in the coherency architecture of the
  728. * platform.
  729. *
  730. * Discussion:
  731. * The IncrementAtomic function increments the value at the
  732. * specified address by one and returns the original value. This
  733. * function guarantees atomicity only with main system memory. It is
  734. * specifically unsuitable for use on noncacheable memory such as
  735. * that in devices; this function cannot guarantee atomicity, for
  736. * example, on memory mapped from a PCI device.
  737. *
  738. * Parameters:
  739. *
  740. * address:
  741. * The 4-byte aligned address of the value to update atomically.
  742. *
  743. * Result:
  744. * The value before the increment.
  745. *
  746. * Availability:
  747. * Mac OS X: in version 10.0 and later in CoreServices.framework
  748. * CarbonLib: in CarbonLib 1.0 and later
  749. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  750. }
  751. function IncrementAtomic( var address: SInt32 ): SInt32; external name '_IncrementAtomic';
  752. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  753. {
  754. * DecrementAtomic()
  755. *
  756. * Summary:
  757. * 32-bit decrement operation, performed atomically with respect to
  758. * all devices that participate in the coherency architecture of the
  759. * platform.
  760. *
  761. * Discussion:
  762. * The DecrementAtomic function decrements the value at the
  763. * specified address by one and returns the original value. This
  764. * function guarantees atomicity only with main system memory. It is
  765. * specifically unsuitable for use on noncacheable memory such as
  766. * that in devices; this function cannot guarantee atomicity, for
  767. * example, on memory mapped from a PCI device.
  768. *
  769. * Parameters:
  770. *
  771. * address:
  772. * The 4-byte aligned address of the value to update atomically.
  773. *
  774. * Result:
  775. * The value before the decrement.
  776. *
  777. * Availability:
  778. * Mac OS X: in version 10.0 and later in CoreServices.framework
  779. * CarbonLib: in CarbonLib 1.0 and later
  780. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  781. }
  782. function DecrementAtomic( var address: SInt32 ): SInt32; external name '_DecrementAtomic';
  783. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  784. {
  785. * AddAtomic()
  786. *
  787. * Summary:
  788. * 32-bit add operation, performed atomically with respect to all
  789. * devices that participate in the coherency architecture of the
  790. * platform.
  791. *
  792. * Discussion:
  793. * The AddAtomic function adds the specified amount to the value at
  794. * the specified address and returns the original value. This
  795. * function guarantees atomicity only with main system memory. It is
  796. * specifically unsuitable for use on noncacheable memory such as
  797. * that in devices; this function cannot guarantee atomicity, for
  798. * example, on memory mapped from a PCI device.
  799. *
  800. * Parameters:
  801. *
  802. * amount:
  803. * The amount to add.
  804. *
  805. * address:
  806. * The 4-byte aligned address of the value to update atomically.
  807. *
  808. * Result:
  809. * The value before the addition
  810. *
  811. * Availability:
  812. * Mac OS X: in version 10.0 and later in CoreServices.framework
  813. * CarbonLib: in CarbonLib 1.0 and later
  814. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  815. }
  816. function AddAtomic( amount: SInt32; var address: SInt32 ): SInt32; external name '_AddAtomic';
  817. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  818. {
  819. * BitAndAtomic()
  820. *
  821. * Summary:
  822. * 32-bit logical and operation, performed atomically with respect
  823. * to all devices that participate in the coherency architecture of
  824. * the platform.
  825. *
  826. * Discussion:
  827. * The BitAndAtomic function logically ands the bits of the
  828. * specified mask into the value at the specified address and
  829. * returns the original value. This function guarantees atomicity
  830. * only with main system memory. It is specifically unsuitable for
  831. * use on noncacheable memory such as that in devices; this function
  832. * cannot guarantee atomicity, for example, on memory mapped from a
  833. * PCI device.
  834. *
  835. * Parameters:
  836. *
  837. * mask:
  838. * The mask to logically and with the value.
  839. *
  840. * address:
  841. * The 4-byte aligned address of the value to update atomically.
  842. *
  843. * Result:
  844. * The value before the bitwise operation
  845. *
  846. * Availability:
  847. * Mac OS X: in version 10.0 and later in CoreServices.framework
  848. * CarbonLib: in CarbonLib 1.0 and later
  849. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  850. }
  851. function BitAndAtomic( mask: UInt32; var address: UInt32 ): UInt32; external name '_BitAndAtomic';
  852. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  853. {
  854. * BitOrAtomic()
  855. *
  856. * Summary:
  857. * 32-bit logical or operation, performed atomically with respect to
  858. * all devices that participate in the coherency architecture of the
  859. * platform.
  860. *
  861. * Discussion:
  862. * The BitOrAtomic function logically ors the bits of the specified
  863. * mask into the value at the specified address and returns the
  864. * original value. This function guarantees atomicity only with main
  865. * system memory. It is specifically unsuitable for use on
  866. * noncacheable memory such as that in devices; this function cannot
  867. * guarantee atomicity, for example, on memory mapped from a PCI
  868. * device.
  869. *
  870. * Parameters:
  871. *
  872. * mask:
  873. * The mask to logically or with the value.
  874. *
  875. * address:
  876. * The 4-byte aligned address of the value to update atomically.
  877. *
  878. * Result:
  879. * The value before the bitwise operation.
  880. *
  881. * Availability:
  882. * Mac OS X: in version 10.0 and later in CoreServices.framework
  883. * CarbonLib: in CarbonLib 1.0 and later
  884. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  885. }
  886. function BitOrAtomic( mask: UInt32; var address: UInt32 ): UInt32; external name '_BitOrAtomic';
  887. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  888. {
  889. * BitXorAtomic()
  890. *
  891. * Summary:
  892. * 32-bit logical xor operation, performed atomically with respect
  893. * to all devices that participate in the coherency architecture of
  894. * the platform. This function guarantees atomicity only with main
  895. * system memory. It is specifically unsuitable for use on
  896. * noncacheable memory such as that in devices; this function cannot
  897. * guarantee atomicity, for example, on memory mapped from a PCI
  898. * device.
  899. *
  900. * Discussion:
  901. * The BitXorAtomic function logically xors the bits of the
  902. * specified mask into the value at the specified address and
  903. * returns the original value.
  904. *
  905. * Parameters:
  906. *
  907. * mask:
  908. * The mask to logically or with the value.
  909. *
  910. * address:
  911. * The 4-byte aligned address of the value to update atomically.
  912. *
  913. * Result:
  914. * The value before the bitwise operation.
  915. *
  916. * Availability:
  917. * Mac OS X: in version 10.0 and later in CoreServices.framework
  918. * CarbonLib: in CarbonLib 1.0 and later
  919. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  920. }
  921. function BitXorAtomic( mask: UInt32; var address: UInt32 ): UInt32; external name '_BitXorAtomic';
  922. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  923. {$endc} {TARGET_OS_MAC}
  924. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  925. end.
  926. {$endc} {not MACOSALLINCLUDE}