1 #ifndef _CPULIST_H
2 #define _CPULIST_H
3 /* cpulist.h */
4 /*****************************************************************************/
5 /* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only                     */
6 /*                                                                           */
7 /* AS-Port                                                                   */
8 /*                                                                           */
9 /* Manages CPU List                                                          */
10 /*                                                                           */
11 /*****************************************************************************/
12 
13 typedef void (*tCPUSwitchProc)(
14 #ifdef __PROTOS__
15 void
16 #endif
17 );
18 
19 typedef void (*tCPUSwitchUserProc)(
20 #ifdef __PROTOS__
21 void *pUserData
22 #endif
23 );
24 
25 typedef void (*tPrintNextCPUProc)(
26 #ifdef __PROTOS__
27 void
28 #endif
29 );
30 
31 typedef void (*tCPUFreeUserDataProc)(void *pUserData);
32 
33 typedef unsigned CPUVar;
34 #define CPUNone ((CPUVar)-1)
35 
36 typedef struct sCPUArg
37 {
38   const char *pName;
39   const LongInt Min, Max, DefValue;
40   LongInt *pValue;
41 } tCPUArg;
42 
43 typedef struct sCPUDef
44 {
45   struct sCPUDef *Next;
46   char *Name;
47   CPUVar Number, Orig;
48   tCPUSwitchUserProc SwitchProc;
49   tCPUFreeUserDataProc FreeProc;
50   void *pUserData;
51   const tCPUArg *pArgs;
52 } tCPUDef, *tpCPUDef;
53 
54 typedef void (*tCPUListIterator)(const tCPUDef *pRun, void *pUser);
55 
56 extern CPUVar AddCPUWithArgs(const char *NewName, tCPUSwitchProc Switcher, const tCPUArg *pArgs);
57 #define AddCPU(NewName, Switcher) AddCPUWithArgs(NewName, Switcher, NULL)
58 extern CPUVar AddCPUUserWithArgs(const char *NewName, tCPUSwitchUserProc Switcher, void *pUserData, tCPUFreeUserDataProc Freeer, const tCPUArg *pArgs);
59 #define AddCPUUser(NewName, Switcher, pUserData, Freeer) AddCPUUserWithArgs(NewName, Switcher, pUserData, Freeer, NULL)
60 
61 extern Boolean AddCPUAlias(char *OrigName, char *AliasName);
62 
63 extern const tCPUDef *LookupCPUDefByVar(CPUVar Var);
64 
65 extern const tCPUDef *LookupCPUDefByName(const char *pName);
66 
67 extern void IterateCPUList(tCPUListIterator Iterator, void *pUser);
68 
69 extern void PrintCPUList(tPrintNextCPUProc NxtProc);
70 
71 extern void ClearCPUList(void);
72 
73 extern void cpulist_init(void);
74 
75 #endif /* _CPULIST_H */
76