Files
86Box/src/usb.c
David Hrdlička a505894a10 Move all include files to src/include
- 86Box's own headers go to /86box
- munt's public interface goes to /mt32emu
- all slirp headers go to /slirp (might want to consider using only its public inteface)
- single file headers from other projects go in include root
2020-03-29 19:53:29 +02:00

54 lines
1.2 KiB
C

/* Copyright holders: Melissa Goad
see COPYING for more details
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <86box/io.h>
#include <86box/mem.h>
#include <86box/usb.h>
void *usb_priv[32];
static int usb_min_card, usb_max_card;
void (*usb_packet_handle[32])(usb_packet_t* packet, void *priv);
void usb_init(int min_card, int max_card)
{
int c;
for (c = 0; c < 32; c++)
usb_packet_handle[c] = usb_priv[c] = NULL;
usb_min_card = min_card;
usb_max_card = max_card;
}
void usb_add_specific(int card, void (*packet_handle)(usb_packet_t *packet, void *priv), void *priv)
{
usb_packet_handle[card] = packet_handle;
usb_priv[card] = priv;
}
void usb_add(void (*packet_handle)(usb_packet_t *packet, void *priv), void *priv)
{
int c;
for (c = usb_min_card; c <= usb_max_card; c++)
{
if (!usb_packet_handle[c])
{
usb_packet_handle[c] = packet_handle;
usb_priv[c] = priv;
// pclog("USB device added to card: %i\n", c);
return;
}
}
}