dynamic_libs/syshid_functions.h

93 lines
3.1 KiB
C
Raw Normal View History

2016-04-25 20:33:48 +02:00
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef __SYSHID_FUNCTIONS_H_
#define __SYSHID_FUNCTIONS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <gctypes.h>
2017-03-30 17:51:11 +02:00
extern u32 syshid_handle;
2016-04-25 20:33:48 +02:00
typedef struct
{
2017-04-30 03:34:09 +02:00
u32 handle;
u32 physical_device_inst;
u16 vid;
u16 pid;
u8 interface_index;
u8 sub_class;
u8 protocol;
2016-04-25 20:33:48 +02:00
u16 max_packet_size_rx;
u16 max_packet_size_tx;
2016-04-25 20:33:48 +02:00
} HIDDevice;
typedef struct _HIDClient HIDClient;
2017-04-30 03:34:09 +02:00
#define HID_DEVICE_DETACH 0
#define HID_DEVICE_ATTACH 1
2016-04-25 20:33:48 +02:00
typedef s32 (*HIDAttachCallback)(HIDClient *p_hc,HIDDevice *p_hd,u32 attach);
2016-04-25 20:33:48 +02:00
struct _HIDClient
{
2017-04-30 03:34:09 +02:00
HIDClient *next;
HIDAttachCallback attach_cb;
2016-04-25 20:33:48 +02:00
};
typedef void (*HIDCallback)(u32 handle,s32 error,u8 *p_buffer,u32 bytes_transferred,void *p_user);
2016-04-25 20:33:48 +02:00
void InitSysHIDFunctionPointers(void);
void InitAcquireSysHID(void);
extern s32(*HIDSetup)(void);
extern s32(*HIDTeardown)(void);
2016-04-25 20:33:48 +02:00
extern s32(*HIDAddClient)(HIDClient *p_client, HIDAttachCallback attach_callback);
extern s32(*HIDDelClient)(HIDClient *p_client);
2016-04-25 20:33:48 +02:00
extern s32(*HIDGetDescriptor)(u32 handle,u8 descriptor_type,u8 descriptor_index, u16 language_id, u8 *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user);
extern s32(*HIDSetDescriptor)(u32 handle,u8 descriptor_type,u8 descriptor_index, u16 language_id, u8 *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user);
2016-04-25 20:33:48 +02:00
extern s32(*HIDGetReport)(u32 handle, u8 report_type, u8 report_id, u8 *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user);
extern s32(*HIDSetReport)(u32 handle, u8 report_type, u8 report_id, u8 *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user);
2016-04-25 20:33:48 +02:00
extern s32(*HIDSetIdle)(u32 handle, u8 s32erface_index,u8 duration, HIDCallback hc, void *p_user);
2016-04-25 20:33:48 +02:00
extern s32(* HIDSetProtocol)(u32 handle,u8 s32erface_index,u8 protocol, HIDCallback hc, void *p_user);
extern s32(* HIDGetProtocol)(u32 handle,u8 s32erface_index,u8 * protocol, HIDCallback hc, void *p_user);
2016-04-25 20:33:48 +02:00
extern s32(*HIDRead)(u32 handle, u8 *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user);
extern s32(*HIDWrite)(u32 handle, u8 *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user);
2016-04-25 20:33:48 +02:00
#ifdef __cplusplus
}
#endif
#endif // __SYSHID_FUNCTIONS_H_