2 * Copyright 2007-2012 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT license.
10 #include "accelerant.h"
11 #include "i810_regs.h"
14 static engine_token sEngineToken
= { 1, B_2D_ACCELERATION
, NULL
};
18 AccelerantEngineCount(void)
25 AcquireEngine(uint32 capabilities
, uint32 maxWait
,
26 sync_token
* syncToken
, engine_token
** engineToken
)
28 (void)capabilities
; // avoid compiler warning for unused arg
29 (void)maxWait
; // avoid compiler warning for unused arg
31 if (gInfo
.sharedInfo
->engineLock
.Acquire() != B_OK
)
35 SyncToToken(syncToken
);
37 *engineToken
= &sEngineToken
;
43 ReleaseEngine(engine_token
* engineToken
, sync_token
* syncToken
)
46 GetSyncToken(engineToken
, syncToken
);
48 gInfo
.sharedInfo
->engineLock
.Release();
56 // Wait until engine is idle.
60 while ((INREG16(INST_DONE
) & 0x7B) != 0x7B && k
> 0)
66 GetSyncToken(engine_token
* engineToken
, sync_token
* syncToken
)
68 syncToken
->engine_id
= engineToken
->engine_id
;
69 syncToken
->counter
= 0;
75 SyncToToken(sync_token
* syncToken
)
78 // avoid compiler warning for unused arg