2 Copyright © 2002-2003, The AROS Development Team. All rights reserved.
6 #include <proto/exec.h>
7 #include <proto/intuition.h>
10 #include <dos/dostags.h>
12 #include <proto/alib.h>
14 #include "muimiamipanel_intern.h"
15 #include "muimiamipanel_commands.h"
16 #include "muimiamipanel_message.h"
18 extern void MiamiPanelProc(STRPTR argPtr
, ULONG argSize
);
19 extern void DoCommand(struct MiamiPanelBase_intern
*MiamiPanelBaseIntern
, ULONG id
,...);
21 /*****************************************************************************
24 AROS_LH8(LONG
, MiamiPanelInit
,
27 AROS_LHA(IPTR
, synccb
, A0
),
28 AROS_LHA(IPTR
, asynccb
, A1
),
29 AROS_LHA(LONG
, flags
, D0
),
30 AROS_LHA(STRPTR
, font
, A2
),
31 AROS_LHA(STRPTR
, screen
, A3
),
32 AROS_LHA(LONG
, xo
, D1
),
33 AROS_LHA(LONG
, yo
, D2
),
34 AROS_LHA(IPTR
, sigbit
, A4
),
37 struct Library
*, MiamiPanelBase
, 5, MiamiPanel
)
55 *****************************************************************************/
58 struct MiamiPanelBase_intern
*MiamiPanelBaseIntern
= MiamiPanelBase
;
60 D(bug("[MiamiPanel] MiamiPanelInit()\n"));
63 struct Process
*proc
= NULL
;
67 struct TagItem tags
[] = {NP_Entry
, 0,
69 NP_CodeType
, CODETYPE_PPC
,
70 NP_PPCStackSize
, 32000,
72 NP_UserData
, MiamiPanelBaseIntern
,
74 NP_Name
, (ULONG
)DEF_Base
,
79 NP_CloseOutput
, FALSE
,
86 ObtainSemaphore(&MiamiPanelBaseIntern
->mpb_libSem
);
88 if (!AttemptSemaphore(&MiamiPanelBaseIntern
->mpb_procSem
))
90 ReleaseSemaphore(&MiamiPanelBaseIntern
->mpb_libSem
);
94 ReleaseSemaphore(&MiamiPanelBaseIntern
->mpb_procSem
);
96 if ((sig
= AllocSignal(-1))<0)
98 ReleaseSemaphore(&MiamiPanelBaseIntern
->mpb_libSem
);
102 tags
[0].ti_Data
= (ULONG
)MiamiPanelProc
;
104 if (proc
= CreateNewProcTagList(tags
))
106 struct MPS_AppMsg msg
;
108 INITPORT(&reply
,sig
);
109 INITMESSAGE(&msg
, &reply
, sizeof(msg
));
112 MiamiPanelBaseIntern
->mpb_synccb
= synccb
;
113 MiamiPanelBaseIntern
->mpb_asynccb
= asynccb
;
116 MiamiPanelBaseIntern
->mpb_use
++;
119 PutMsg(&proc
->pr_MsgPort
, (struct Message
*)&msg
);
129 ReleaseSemaphore(&MiamiPanelBaseIntern
->mpb_libSem
);
135 } /* MiamiPanelInit */
138 /*****************************************************************************
141 AROS_LH0(void, MiamiPanelCleanup
,
146 struct Library
*, MiamiPanelBase
, 6, MiamiPanel
)
164 *****************************************************************************/
167 struct MiamiPanelBase_intern
*MiamiPanelBaseIntern
= MiamiPanelBase
;
169 D(bug("[MiamiPanel] MiamiPanelCleanup()\n"));
171 DoCommand(MiamiPanelBaseIntern
, MPV_Msg_Type_Cleanup
);
173 ObtainSemaphore(&MiamiPanelBaseIntern
->mpb_procSem
);
174 ReleaseSemaphore(&MiamiPanelBaseIntern
->mpb_procSem
);
178 } /* MiamiPanelCleanup */
180 /*****************************************************************************
183 AROS_LH5(void, MiamiPanelAddInterface
,
186 AROS_LHA(LONG
, unit
, D0
),
187 AROS_LHA(STRPTR
, name
, A0
),
188 AROS_LHA(LONG
, state
, D1
),
189 AROS_LHA(LONG
, ontime
, D2
),
190 AROS_LHA(STRPTR
, speed
, A1
),
193 struct Library
*, MiamiPanelBase
, 7, MiamiPanel
)
211 *****************************************************************************/
214 struct MiamiPanelBase_intern
*MiamiPanelBaseIntern
= MiamiPanelBase
;
216 D(bug("[MiamiPanel] MiamiPanelAddInterface()\n"));
218 DoCommand(MiamiPanelBaseIntern
, MPV_Msg_Type_AddInterface
,unit
,name
,state
,ontime
,speed
);
222 } /* MiamiPanelAddInterface */
224 /*****************************************************************************
227 AROS_LH1(void, MiamiPanelDelInterface
,
230 AROS_LHA(LONG
, unit
, D0
),
233 struct Library
*, MiamiPanelBase
, 8, MiamiPanel
)
251 *****************************************************************************/
254 struct MiamiPanelBase_intern
*MiamiPanelBaseIntern
= MiamiPanelBase
;
256 D(bug("[MiamiPanel] MiamiPanelDelInterface()\n"));
258 DoCommand(MiamiPanelBaseIntern
, MPV_Msg_Type_DelInterface
,unit
);
262 } /* MiamiPanelDelInterface */
264 /*****************************************************************************
267 AROS_LH3(void, MiamiPanelSetInterfaceState
,
270 AROS_LHA(LONG
, unit
, D0
),
271 AROS_LHA(LONG
, state
, D1
),
272 AROS_LHA(LONG
, ontime
, D2
),
275 struct Library
*, MiamiPanelBase
, 9, MiamiPanel
)
293 *****************************************************************************/
296 struct MiamiPanelBase_intern
*MiamiPanelBaseIntern
= MiamiPanelBase
;
298 D(bug("[MiamiPanel] MiamiPanelSetInterfaceState()\n"));
300 DoCommand(MiamiPanelBaseIntern
, MPV_Msg_Type_SetInterfaceState
,unit
,state
,ontime
);
304 } /* MiamiPanelSetInterfaceState */
306 /*****************************************************************************
309 AROS_LH2(void, MiamiPanelSetInterfaceSpeed
,
312 AROS_LHA(LONG
, unit
, D0
),
313 AROS_LHA(UBYTE
*, speed
, A0
),
316 struct Library
*, MiamiPanelBase
, 10, MiamiPanel
)
334 *****************************************************************************/
337 struct MiamiPanelBase_intern
*MiamiPanelBaseIntern
= MiamiPanelBase
;
339 D(bug("[MiamiPanel] MiamiPanelSetInterfaceSpeed()\n"));
341 DoCommand(MiamiPanelBaseIntern
, MPV_Msg_Type_SetInterfaceSpeed
,unit
,speed
);
345 } /* MiamiPanelSetInterfaceSpeed */
347 /*****************************************************************************
350 AROS_LH5(void, MiamiPanelInterfaceReport
,
353 AROS_LHA(LONG
, unit
, D0
),
354 AROS_LHA(LONG
, rate
, D1
),
355 AROS_LHA(LONG
, now
, D2
),
356 AROS_LHA(LONG
, totalhi
, D3
),
357 AROS_LHA(ULONG
, totallo
, D4
),
360 struct Library
*, MiamiPanelBase
, 11, MiamiPanel
)
378 *****************************************************************************/
381 struct MiamiPanelBase_intern
*MiamiPanelBaseIntern
= MiamiPanelBase
;
383 D(bug("[MiamiPanel] MiamiPanelInterfaceReport()\n"));
386 DoCommand(MiamiPanelBaseIntern
, MPV_Msg_Type_InterfaceReport
,unit
,rate
,now
,totalhi
,totallo
);
390 } /* MiamiPanelInterfaceReport */
392 /*****************************************************************************
395 AROS_LH0(void, MiamiPanelToFront
,
400 struct Library
*, MiamiPanelBase
, 12, MiamiPanel
)
418 *****************************************************************************/
421 struct MiamiPanelBase_intern
*MiamiPanelBaseIntern
= MiamiPanelBase
;
423 D(bug("[MiamiPanel] MiamiPanelToFront()\n"));
425 DoCommand(MiamiPanelBaseIntern
, MPV_Msg_Type_ToFront
);
429 } /* MiamiPanelToFront */
431 /*****************************************************************************
434 AROS_LH1(void, MiamiPanelInhibitRefresh
,
437 AROS_LHA(LONG
, val
, D0
),
440 struct Library
*, MiamiPanelBase
, 13, MiamiPanel
)
458 *****************************************************************************/
461 struct MiamiPanelBase_intern
*MiamiPanelBaseIntern
= MiamiPanelBase
;
463 D(bug("[MiamiPanel] MiamiPanelInhibitRefresh()\n"));
465 DoCommand(MiamiPanelBaseIntern
, MPV_Msg_Type_InhibitRefresh
,val
);
469 } /* MiamiPanelInhibitRefresh */
471 /*****************************************************************************
474 AROS_LH2(void, MiamiPanelGetCoord
,
477 AROS_LHA(LONG
*, xp
, A0
),
478 AROS_LHA(LONG
*, yp
, A1
),
481 struct Library
*, MiamiPanelBase
, 14, MiamiPanel
)
499 *****************************************************************************/
502 struct MiamiPanelBase_intern
*MiamiPanelBaseIntern
= MiamiPanelBase
;
504 D(bug("[MiamiPanel] MiamiPanelGetCoord()\n"));
510 } /* MiamiPanelGetCoord */
512 /*****************************************************************************
515 AROS_LH1(void, MiamiPanelEvent
,
518 AROS_LHA(ULONG
, sigs
, D0
),
521 struct Library
*, MiamiPanelBase
, 15, MiamiPanel
)
539 *****************************************************************************/
542 struct MiamiPanelBase_intern
*MiamiPanelBaseIntern
= MiamiPanelBase
;
544 D(bug("[MiamiPanel] MiamiPanelEvent()\n"));
548 } /* MiamiPanelEvent */
550 /*****************************************************************************
553 AROS_LH2(void, MiamiPanelRefreshName
,
556 AROS_LHA(LONG
, unit
, D0
),
557 AROS_LHA(UBYTE
*, name
, A0
),
560 struct Library
*, MiamiPanelBase
, 16, MiamiPanel
)
578 *****************************************************************************/
581 struct MiamiPanelBase_intern
*MiamiPanelBaseIntern
= MiamiPanelBase
;
583 D(bug("[MiamiPanel] MiamiPanelRefreshName()\n"));
585 DoCommand(MiamiPanelBaseIntern
, MPV_Msg_Type_RefreshName
,unit
,name
);
589 } /* MiamiPanelRefreshName */
591 /*****************************************************************************
594 AROS_LH0(LONG
, MiamiPanelGetVersion
,
599 struct Library
*, MiamiPanelBase
, 17, MiamiPanel
)
617 *****************************************************************************/
620 struct MiamiPanelBase_intern
*MiamiPanelBaseIntern
= MiamiPanelBase
;
622 D(bug("[MiamiPanel] MiamiPanelGetVersion()\n"));
628 } /* MiamiPanelGetVersion */
630 /*****************************************************************************
633 AROS_LH0(ULONG
, MiamiPanelKill
,
638 struct Library
*, MiamiPanelBase
, 26, MiamiPanel
)
656 *****************************************************************************/
659 struct MiamiPanelBase_intern
*MiamiPanelBaseIntern
= MiamiPanelBase
;
661 D(bug("[MiamiPanel] MiamiPanelKill()\n"));
663 ObtainSemaphore(&MiamiPanelBaseIntern
->mpb_libSem
);
665 if (AttemptSemaphore(&MiamiPanelBaseIntern
->mpb_procSem
))
667 ReleaseSemaphore(&MiamiPanelBaseIntern
->mpb_procSem
);
668 ReleaseSemaphore(&MiamiPanelBaseIntern
->mpb_libSem
);
672 if (MiamiPanelBaseIntern
->mpb_app
)
674 DoMethod(MiamiPanelBaseIntern
->mpb_app
,MUIM_Application_PushMethod
,(ULONG
)MiamiPanelBaseIntern
->mpb_app
,2,MUIM_Application_ReturnID
,MUIV_Application_ReturnID_Quit
);
678 if (AttemptSemaphore(&MiamiPanelBaseIntern
->mpb_procSem
))
680 ReleaseSemaphore(&MiamiPanelBaseIntern
->mpb_procSem
);
681 ReleaseSemaphore(&MiamiPanelBaseIntern
->mpb_libSem
);
686 memset(&MiamiPanelBaseIntern
->mpb_procSem
,0,sizeof(&MiamiPanelBaseIntern
->mpb_procSem
));
687 InitSemaphore(&MiamiPanelBaseIntern
->mpb_procSem
);
688 if (MiamiPanelBaseIntern
->mpb_port
) DeleteMsgPort(MiamiPanelBaseIntern
->mpb_port
);
689 MiamiPanelBaseIntern
->mpb_port
= NULL
;
690 MiamiPanelBaseIntern
->mpb_app
= NULL
;
692 ReleaseSemaphore(&MiamiPanelBaseIntern
->mpb_libSem
);
698 } /* MiamiPanelKill */