revert between 56095 -> 55830 in arch
[AROS.git] / arch / ppc-sam440 / serial.hidd / serial_init.c
blob67ea5c1d614d4e795f91501e4a18fdf41c6ebc0a
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Serial hidd initialization code.
6 Lang: English.
7 */
8 #define DEBUG 0
9 #include <aros/debug.h>
11 #include <exec/types.h>
12 #include <exec/alerts.h>
14 #include <aros/symbolsets.h>
16 #include <hidd/irq.h>
18 #include <proto/oop.h>
19 #include <proto/exec.h>
21 #include "serial_intern.h"
23 #include LC_LIBDEFS_FILE
25 void serial_int(void *data, void *data2);
27 static inline BOOL GetIRQs(int *irq);
29 struct Library *ProcessorBase = OpenResource(PROCESSORNAME);
30 ULONG pvr = 0;
32 if (ProcessorBase) {
33 struct TagItem tags[] = {
34 { GCIT_Model, (IPTR)&pvr },
35 { TAG_END }
37 GetCPUInfo(tags);
40 switch (pvr) {
41 case PVR_PPC460EX_B:
42 irq[0] = INTR_UIC1_UART0;
43 irq[1] = INTR_UIC0_UART1;
44 irq[2] = INTR_UIC1_UART2;
45 irq[3] = INTR_UIC1_UART3;
46 break;
47 case PVR_PPC440EP_B:
48 case PVR_PPC440EP_C:
49 /* ppc440 */
50 irq[0] = INTR_U0;
51 irq[1] = INTR_U1;
52 irq[2] = INTR_U2;
53 irq[3] = INTR_U3;
54 break;
55 default:
56 return FALSE;
59 return TRUE;
62 static int PPC4xxSer_Init(LIBBASETYPEPTR LIBBASE)
64 int i;
65 struct class_static_data *csd = &LIBBASE->hdg_csd; /* SerialHidd static data */
67 EnterFunc(bug("SerialHIDD_Init()\n"));
69 if (GetIRQs(&csd->cs_IRQ[0])) {
70 /* Install interrupts */
71 for (i = 0; i < 4; i++)
72 KrnAddHandler(csd->cs_IRQ[i], serial_int, csd->cs_Unit[i]);
74 D(bug(" Got Interrupts\n"));
75 ReturnInt("SerialHIDD_Init", ULONG, TRUE);
78 ReturnInt("SerialHIDD_Init", ULONG, FALSE);
81 ADD2INITLIB(PPC4xxSer_Init, 0)