Bump required catalog version to 2. Don't build
[AROS.git] / arch / arm-native / kernel / platform_init.c
blob26129627242035ecb05b5b6e44c18732630e2df7
1 /*
2 Copyright © 2013-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define DEBUG 0
8 #include <aros/kernel.h>
9 #include <aros/symbolsets.h>
10 #include <exec/memory.h>
11 #include <exec/tasks.h>
12 #include <exec/alerts.h>
13 #include <exec/execbase.h>
14 #include <asm/io.h>
15 #include <proto/kernel.h>
16 #include <proto/exec.h>
17 #include <strings.h>
19 #include "etask.h"
21 #include "kernel_intern.h"
22 #include "kernel_arch.h"
23 #include "kernel_romtags.h"
25 THIS_PROGRAM_HANDLES_SYMBOLSET(ARMPLATFORMS);
26 DECLARESET(ARMPLATFORMS);
28 void platform_Init(struct ARM_Implementation *krnARMImpl, struct TagItem *msg)
30 IPTR (*platprobe) (struct ARM_Implementation *, struct TagItem *);
31 int cur;
33 for ( cur = 1; (void *)(SETNAME(ARMPLATFORMS))[cur] != NULL; cur++)
35 platprobe = (void *)(SETNAME(ARMPLATFORMS))[cur];
36 if (platprobe(krnARMImpl, msg))
38 if (krnARMImpl->ARMI_LED_Toggle)
39 krnARMImpl->ARMI_LED_Toggle(ARM_LED_POWER, ARM_LED_ON);
41 break;
45 return;
48 void *(*__AllocMem)();
50 #define ExecAllocMem(bytesize, requirements) \
51 AROS_CALL2(void *, __AllocMem, \
52 AROS_LCA(ULONG, byteSize, D0), \
53 AROS_LCA(ULONG, requirements, D1), \
54 struct ExecBase *, SysBase)
56 AROS_LH2(APTR, AllocMem,
57 AROS_LHA(ULONG, byteSize, D0),
58 AROS_LHA(ULONG, requirements, D1),
59 struct ExecBase *, SysBase, 33, Kernel)
61 AROS_LIBFUNC_INIT
63 if (requirements & MEMF_CHIP)
65 DALLOCMEM(bug("[Kernel] AllocMem: Ignoring MEMF_CHIP flag\n"));
66 requirements &= ~MEMF_CHIP;
68 return ExecAllocMem(bytesize, requirements);
70 AROS_LIBFUNC_EXIT
73 static int platform_PostInit(struct KernelBase *KernelBase)
75 D(bug("[Kernel] platform_PostInit()\n"));
77 D(bug("[Kernel] platform_PostInit: Patching in our AllocMem to ignore MEMF_CHIP..\n"));
79 __AllocMem = SetFunction((struct Library *)SysBase, -33*LIB_VECTSIZE, AROS_SLIB_ENTRY(AllocMem, Kernel, 33));
81 D(bug("[Kernel] platform_PostInit: Performing Post Init..\n"));
83 if (__arm_arosintern.ARMI_Init)
84 __arm_arosintern.ARMI_Init(KernelBase, SysBase);
86 D(bug("[Kernel] platform_PostInit: Registering Heartbeat timer..\n"));
88 KrnAddSysTimerHandler(KernelBase);
90 D(bug("[Kernel] platform_PostInit: Done..\n"));
92 return TRUE;
95 ADD2INITLIB(platform_PostInit, 10)
97 struct KernelBase *getKernelBase()
99 return (struct KernelBase *)KernelBase;