2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
5 Desc: OwnCard() function.
9 #include <proto/exec.h>
11 #include "card_intern.h"
13 AROS_LH1(struct CardHandle
*, OwnCard
,
14 AROS_LHA(struct CardHandle
*, handle
, A1
),
15 struct CardResource
*, CardResource
, 1, Card
)
19 struct CardHandle
*ret
= NULL
;
21 CARDDEBUG(bug("OwnCard(%p,%08x)\n", handle
, handle
->cah_CardFlags
));
23 handle
->cah_CardFlags
&= ~CARDF_USED
;
24 if (handle
->cah_CardFlags
& CARDF_DELAYOWNERSHIP
) {
26 Enqueue(&CardResource
->handles
, &handle
->cah_CardNode
);
28 pcmcia_newowner(CardResource
, TRUE
);
29 ret
= (struct CardHandle
*)-1;
30 } else if (handle
->cah_CardFlags
& CARDF_IFAVAILABLE
) {
31 if (CardResource
->removed
)
32 ret
= (struct CardHandle
*)-1;
33 else if (CardResource
->ownedcard
)
34 ret
= CardResource
->ownedcard
;
38 if (CardResource
->removed
)
39 ret
= (struct CardHandle
*)-1;
40 else if (CardResource
->ownedcard
== NULL
) {
42 AddHead(&CardResource
->handles
, &handle
->cah_CardNode
);
44 pcmcia_newowner(CardResource
, FALSE
);
49 CARDDEBUG(bug("=%p\n", ret
));