#include "irq.h"
#include "usb/core/core.h"
#include "usb/drivers/class/hid.h"
+#include "usb/drivers/bt.h"
#include "sha1.h"
#include "hollywood.h"
/* external ohci */
irq_hw_enable(IRQ_OHCI0);
/* internal ohci */
- //irq_hw_enable(IRQ_OHCI1);
+ irq_hw_enable(IRQ_OHCI1);
ipc_initialize();
ipc_slowping();
usb_init(OHCI0_REG_BASE);
/* internal ohci */
- //usb_init(OHCI1_REG_BASE);
+ usb_init(OHCI1_REG_BASE);
/* load HID keyboard driver */
usb_hidkb_init();
+ /* load BT-USB driver */
+ usb_bt_init();
+
wait_kb:
/* wait for usb keyboard plugged in */
if(!usb_hidkb_inuse()) {
OBJS += usb/host/ohci.o usb/core/core.o usb/core/usb.o \
usb/lib/list.o \
- usb/drivers/class/hid.o
+ usb/drivers/class/hid.o usb/drivers/bt.o
return (void*) -1;
}
-//#define WTF
+#define WTF
#ifdef WTF
volatile u8 wzf = 11;
if(0 == wzf) {
/***************** Status Stage ***********************/
/* Zero packet for end */
td = usb_create_transfer_descriptor(irp);
- td->togl = 1; /* zero data packet = always DATA1 packet */
+ /* zero data packet = always DATA1 packet */
+ td->togl = 1;
td->actlen = 0;
td->buffer = NULL;
void (*probe)(void);
void (*check)(void);
void (*remove)(void);
- void *data;
+ struct usb_device *data;
struct usb_driver *next;
};
{
cleargbuf();
usb_control_msg(dev, 0x80, GET_CONFIGURATION, 0, 0, 4, gbuf, 0);
- printf("=============\nafter usb_get_configuration:\n");
- hexdump((void*) gbuf, 8);
return gbuf[0];
}
{
cleargbuf();
usb_control_msg(dev, 0x00, SET_CONFIGURATION, configuration, 0, 0, gbuf, 0);
- printf("=============\nafter usb_set_configuration:\n");
- hexdump((void*) gbuf, 8);
wait_ms(20);
return 0;
}
--- /dev/null
+/*
+ ppcskel - a Free Software replacement for the Nintendo/BroadOn bootloader.
+ bluetooth driver
+
+Copyright (C) 2009 Bernhard Urban <lewurm@gmx.net>
+Copyright (C) 2009 Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
+
+# This code is licensed to you under the terms of the GNU GPL, version 2;
+# see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+*/
+
+#include "../core/core.h"
+#include "../core/usb.h"
+#include "../usbspec/usb11spec.h"
+#include "../../malloc.h"
+#include "../../string.h"
+
+#include "bt.h"
+
+struct usb_driver btdriv = {
+ .name = "bt",
+ .probe = usb_bt_probe,
+ .check = usb_bt_check,
+ .remove = usb_bt_remove,
+ .data = NULL
+};
+
+u8 epi_it, epi_bk, epo_bk;
+
+
+void usb_bt_init()
+{
+ usb_register_driver(&btdriv);
+
+ usb_set_configuration(btdriv.data, btdriv.data->conf->bConfigurationValue);
+ printf("get_conf: %d\n", usb_get_configuration(btdriv.data));
+
+ u8 buf[8];
+ memset(buf, 0, 8);
+ usb_control_msg(btdriv.data, 0x01, SET_INTERFACE, 0, 1, 0, buf, 0);
+
+ epi_it = btdriv.data->conf->intf->endp->bEndpointAddress & 0x7F;
+ epi_bk = btdriv.data->conf->intf->endp->next->bEndpointAddress & 0x7F;
+ epo_bk = btdriv.data->conf->intf->endp->next->next->bEndpointAddress & 0x7F;
+
+ btdriv.data->epSize[1] = btdriv.data->conf->intf->endp->wMaxPacketSize;
+ btdriv.data->epSize[2] = btdriv.data->conf->intf->endp->next->wMaxPacketSize;
+ btdriv.data->epSize[3] = btdriv.data->conf->intf->endp->next->next->wMaxPacketSize;
+}
+
+void usb_bt_probe()
+{
+ struct usb_device *dev;
+ struct element *iterator = core.devices->head;
+
+ while(iterator != NULL) {
+ dev = (struct usb_device*) iterator->data;
+ if(dev == NULL) {
+ continue;
+ }
+
+ if(dev->idVendor == 0x057e && dev->idProduct == 0x0305) {
+ btdriv.data = dev;
+ }
+
+ iterator=iterator->next;
+ }
+}
+
+void usb_bt_check()
+{
+}
+
+u8 usb_bt_inuse()
+{
+ return btdriv.data ? 1 : 0;
+}
+
+void usb_bt_remove()
+{
+ btdriv.data = NULL;
+}
+
--- /dev/null
+/*
+ ppcskel - a Free Software replacement for the Nintendo/BroadOn bootloader.
+ bluetooth driver
+
+Copyright (C) 2009 Bernhard Urban <lewurm@gmx.net>
+Copyright (C) 2009 Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
+
+# This code is licensed to you under the terms of the GNU GPL, version 2;
+# see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+*/
+
+
+#ifndef __BT_H
+#define __BT_H
+
+void usb_bt_init();
+void usb_bt_probe();
+void usb_bt_check();
+u8 usb_bt_inuse();
+void usb_bt_remove();
+
+#endif /* __BT_H */
+
if(dev->conf->intf->bInterfaceClass == HID_CLASSCODE &&
dev->conf->intf->bInterfaceSubClass == 1 && /* keyboard support boot protocol? */
dev->conf->intf->bInterfaceProtocol == 1) { /* keyboard? */
- hidkb.data = (void*) dev;
+ hidkb.data = dev;
usb_hidkb_set_idle(dev, 1);
}