Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / camd / midilinkconnected.c
blobd319643f8916d972ef2009d6bb235faee2c5ad5e
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
11 #include <proto/exec.h>
13 #include "camd_intern.h"
15 /*****************************************************************************
17 NAME */
19 AROS_LH1(BOOL, MidiLinkConnected,
21 /* SYNOPSIS */
22 AROS_LHA(struct MidiLink *, midilink, A0),
24 /* LOCATION */
25 struct CamdBase *, CamdBase, 20, Camd)
27 /* FUNCTION
28 If midilink is a sender, returns FALSE if the cluster has no
29 receivers. If midilink is a receiver, returns FALSE if the
30 cluster has no senders. Else TRUE.
32 INPUTS
33 midilink - pointer to midilink we want to check.
35 RESULT
37 NOTES
39 EXAMPLE
41 BUGS
43 SEE ALSO
45 INTERNALS
47 HISTORY
49 2001-01-12 ksvalast first created
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
56 BOOL ret=TRUE;
57 struct MyMidiCluster *mycluster=(struct MyMidiCluster *)midilink->ml_Location;
58 int type=midilink->ml_Node.ln_Type;
60 if(type==NT_USER-MLTYPE_Sender){
61 ObtainSemaphoreShared(&mycluster->semaphore);
62 if(IsListEmpty(&midilink->ml_Location->mcl_Receivers)) ret=FALSE;
63 ReleaseSemaphore(&mycluster->semaphore);
64 }else{
65 ObtainSemaphoreShared(CB(CamdBase)->CLSemaphore);
66 if(IsListEmpty(&midilink->ml_Location->mcl_Senders)) ret=FALSE;
67 ReleaseSemaphore(CB(CamdBase)->CLSemaphore);
70 return ret;
72 AROS_LIBFUNC_EXIT