forwarding: The intel code has been updated to version 8.0.35, and the rx queue hang...
[AROS.git] / rom / hidds / kbd / kbdsubsystem.c
blob4b8f304f97e51a8c7a09e2a7a187951c3cf4d315
1 /*
2 Copyright (C) 2013, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define __OOP_NOATTRBASES__
8 #include <aros/debug.h>
9 #include <hidd/hidd.h>
10 #include <hidd/keyboard.h>
11 #include <oop/oop.h>
12 #include <utility/tagitem.h>
14 #include "kbd.h"
16 /*****************************************************************************************
18 NAME
19 --background_kbdsubsystem--
21 LOCATION
22 CLID_HW_Kbd
24 NOTES
25 This class represents a keyboard input subsystem in AROS. Additionally
26 it serves as a "hub" for collecting input from various keyboard devices
27 in the system. Events from all keyboard devices are merged into a single
28 stream and propagated to all clients.
30 In order to get an access to keyboard input subsystem you need to
31 create an object of CLID_HW_Kbd class. The actual returned object is a
32 singletone, you do not have to dispose it, and every call will return
33 the same object pointer. After getting this object, you can, for example,
34 register your driver using moHW_AddDriver method, or enumerate drivers
35 using moHW_EnumDrivers.
37 If you wish to receive keyboard events, use objects of CLID_Hidd_Kbd
38 class. This class implements the same interface as driver class, but
39 represents receiver's side and is responsible for registering user's
40 interrupt handler in the listeners chain. These objects are not real
41 drivers and do not need to me registered within the subsystem.
43 *****************************************************************************************/
45 /*****************************************************************************************
47 NAME
48 --hardware_drivers--
50 LOCATION
51 CLID_HW_Kbd
53 NOTES
54 A hardware driver should be a subclass of CLID_Hidd and implement IID_Hidd_Kbd
55 interface according to the following rules:
57 1. A single object of driver class represents a single hardware unit.
58 2. A single driver object maintains a single callback address (passed to it
59 using aoHidd_Kbd_IrqHandler). Under normal conditions this callback is supplied
60 by CLID_Hidd_Kbd class.
62 *****************************************************************************************/
64 static void GlobalCallback(struct kbd_staticdata *csd, UWORD code)
66 struct kbd_data *data;
68 for (data = (struct kbd_data *)csd->callbacks.mlh_Head; data->node.mln_Succ;
69 data = (struct kbd_data *)data->node.mln_Succ)
71 data->callback(data->callbackdata, code);
75 OOP_Object *KBDHW__Root__New(OOP_Class *cl, OOP_Object *o, struct pRoot_New *msg)
77 struct kbd_staticdata *csd = CSD(cl);
79 if (!csd->hwObj)
81 struct TagItem new_tags[] =
83 {aHW_ClassName, (IPTR)"Keyboards"},
84 {TAG_DONE , 0 }
86 struct pRoot_New new_msg =
88 .mID = msg->mID,
89 .attrList = new_tags
92 csd->hwObj = (OOP_Object *)OOP_DoSuperMethod(cl, o, &new_msg.mID);
94 return csd->hwObj;
97 VOID KBDHW__Root__Dispose(OOP_Class *cl, OOP_Object *o, OOP_Msg msg)
102 OOP_Object *KBDHW__HW__AddDriver(OOP_Class *cl, OOP_Object *o, struct pHW_AddDriver *Msg)
104 struct TagItem tags[] =
106 { aHidd_Kbd_IrqHandler , (IPTR)GlobalCallback },
107 { aHidd_Kbd_IrqHandlerData, (IPTR)CSD(cl) },
108 { TAG_MORE , (IPTR)Msg->tags }
110 struct pHW_AddDriver add_msg =
112 .mID = Msg->mID,
113 .driverClass = Msg->driverClass,
114 .tags = tags
117 D(bug("[KBD] Adding driver %s, tags 0x%p\n",
118 Msg->driverClass->ClassNode.ln_Name, Msg->tags));
120 return (OOP_Object *)OOP_DoSuperMethod(cl, o, &add_msg.mID);