tcp: Add APICall trace entry and move TRACEs into locked parts.
[haiku.git] / src / add-ons / accelerants / et6x00 / EngineManagment.c
blob0fc00f31e8f7e698438e1d878c431a772dca5f67
1 /*****************************************************************************\
2 * Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5.
3 * Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov.
4 \*****************************************************************************/
6 #include "GlobalData.h"
7 #include "generic.h"
10 /*****************************************************************************/
11 static engine_token et6000EngineToken = {1, B_2D_ACCELERATION, NULL};
12 /*****************************************************************************/
13 uint32 ACCELERANT_ENGINE_COUNT(void) {
14 return 1;
16 /*****************************************************************************/
17 status_t ACQUIRE_ENGINE(uint32 capabilities,
18 uint32 max_wait,
19 sync_token *st,
20 engine_token **et)
22 /* acquire the shared benaphore */
23 AQUIRE_BEN(si->engine.lock)
24 /* sync if required */
25 if (st) SYNC_TO_TOKEN(st);
27 /* return an engine token */
28 *et = &et6000EngineToken;
29 return B_OK;
31 /*****************************************************************************/
32 status_t RELEASE_ENGINE(engine_token *et, sync_token *st) {
33 /* update the sync token, if any */
34 if (st) {
35 st->engine_id = et->engine_id;
36 st->counter = si->engine.count;
39 /* release the shared benaphore */
40 RELEASE_BEN(si->engine.lock)
41 return B_OK;
43 /*****************************************************************************/
44 void WAIT_ENGINE_IDLE(void) {
45 et6000aclWaitIdle();
46 /* note our current possition */
47 si->engine.lastIdle = si->engine.count;
49 /*****************************************************************************/
50 status_t GET_SYNC_TOKEN(engine_token *et, sync_token *st) {
51 st->engine_id = et->engine_id;
52 st->counter = si->engine.count;
53 return B_OK;
55 /*****************************************************************************/
56 status_t SYNC_TO_TOKEN(sync_token *st) {
57 WAIT_ENGINE_IDLE();
58 si->engine.lastIdle = st->counter;
59 return B_OK;
61 /*****************************************************************************/