revert between 56095 -> 55830 in arch
[AROS.git] / rom / usb / classes / felsunxi / class_FELSunxiTask.c
blob807c3c98cb66fef40c8a190616047d5fa5f64d3a
1 /*
2 Copyright © 2014, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #ifdef DEBUG
10 #undef DEBUG
11 #endif
12 #define DEBUG 0
14 #include <proto/intuition.h>
15 #include <proto/muimaster.h>
16 #include <libraries/mui.h>
17 #include <clib/alib_protos.h>
19 #include "felsunxi_intern.h"
22 FELSunxiTask
24 AROS_UFH0(void, FELSunxiTask) {
25 AROS_USERFUNC_INIT
27 struct Task *thistask;
28 struct FELSunxiDevice *FELSunxiDevice;
30 struct Library *ps;
31 struct Library *MUIMasterBase;
33 thistask = FindTask(NULL);
34 FELSunxiDevice = thistask->tc_UserData;
36 ps = FELSunxiDevice->ps;
37 MUIMasterBase = FELSunxiDevice->MUIMasterBase;
39 mybug(-1,("FELSunxiTask started\n"));
41 Object *app, *wnd, *b1, *b2, *b3, *tick1;
43 app = ApplicationObject,
44 SubWindow, wnd = WindowObject,
45 MUIA_Window_Title, "FELSunxi",
46 MUIA_Window_Activate, TRUE,
47 WindowContents, HGroup,
48 Child, VGroup,
49 MUIA_Weight, 1,
50 MUIA_Group_SameWidth, TRUE,
51 GroupFrameT("FELSunxi"),
52 Child, b1 = SimpleButton("DRAM"),
53 Child, b2 = SimpleButton("NAND"),
54 Child, b3 = SimpleButton("SERIAL"),
55 Child, HGroup,
56 Child, tick1 = MUI_MakeObject(MUIO_Checkmark, NULL),
57 Child, MUI_MakeObject(MUIO_Label,"Show object box", 0),
58 End,
59 Child, (IPTR) VSpace(0),
61 End,
62 End,
63 End,
64 End;
66 if (app) {
68 mybug(-1,("Zune app up!\n"));
70 mybug(-1,("FELSunxiTask signaling creator\n"));
71 Signal(FELSunxiDevice->readysigtask, 1L<<FELSunxiDevice->readysignal);
73 ULONG sigs = 0;
75 DoMethod(wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, (IPTR) app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
76 set(wnd,MUIA_Window_Open,TRUE);
78 while(1) {
80 if( DoMethod(app, MUIM_Application_NewInput, (IPTR) &sigs) == MUIV_Application_ReturnID_Quit ) {
81 psdReleaseDevBinding(FELSunxiDevice->pd);
84 if (sigs) {
85 sigs = Wait(sigs | SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D);
86 if(sigs & SIGBREAKF_CTRL_C) break;
87 if(sigs & SIGBREAKF_CTRL_D) break;
91 MUI_DisposeObject(app);
94 psdFreeVec(FELSunxiDevice);
95 /* This is why we copied the bases to stack */
96 CloseLibrary(MUIMasterBase);
97 CloseLibrary(ps);
99 AROS_USERFUNC_EXIT