RetroArch
Classes | Macros | Functions | Variables
wpad.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include "os.h"
#include "conf.h"
#include "ir.h"
#include "dynamics.h"
#include "wiiuse_internal.h"
#include "wiiuse/wpad.h"
#include "lwp_threads.h"
#include "ogcsys.h"
Include dependency graph for wpad.c:

Classes

struct  _wpad_thresh
 
struct  _wpad_cb
 

Macros

#define MAX_STREAMDATA_LEN   20
 
#define EVENTQUEUE_LENGTH   16
 
#define DISCONNECT_BATTERY_DIED   0x14
 
#define DISCONNECT_POWER_OFF   0x15
 
#define ABS(x)   ((s32)(x)>0?(s32)(x):-((s32)(x)))
 
#define STATE_CHECK(thresh, a, b)
 
#define STATE_CHECK_SIMPLE(thresh, a, b)
 

Functions

static s32 __wpad_onreset (s32 final)
 
static s32 __wpad_disconnect (struct _wpad_cb *wpdcb)
 
static void __wpad_eventCB (struct wiimote_t *wm, s32 event)
 
static void __wpad_def_powcb (s32 chan)
 
void __wiiuse_sensorbar_enable (int enable)
 
void __SYS_DoPowerCB (void)
 
static void __wpad_timeouthandler (syswd_t alarm, void *cbarg)
 
static void __wpad_setfmt (s32 chan)
 
wiimote__wpad_assign_slot (struct bd_addr *pad_addr)
 
static s32 __wpad_init_finished (s32 result, void *usrdata)
 
static s32 __wpad_patch_finished (s32 result, void *usrdata)
 
static s32 __readlinkkey_finished (s32 result, void *usrdata)
 
static s32 __initcore_finished (s32 result, void *usrdata)
 
static void __wpad_calc_data (WPADData *data, WPADData *lstate, struct accel_t *accel_calib, u32 smoothed)
 
static void __save_state (struct wiimote_t *wm)
 
static u32 __wpad_read_expansion (struct wiimote_t *wm, WPADData *data, struct _wpad_thresh *thresh)
 
static void __wpad_read_wiimote (struct wiimote_t *wm, WPADData *data, s32 *idle_time, struct _wpad_thresh *thresh)
 
void __wpad_disconnectCB (struct bd_addr *offaddr, u8 reason)
 
s32 WPAD_Init ()
 
s32 WPAD_ReadEvent (s32 chan, WPADData *data)
 
static s32 pad_readpending_temp (s32 chan)
 
s32 WPAD_ReadPending (s32 chan, WPADDataCallback datacb)
 
s32 WPAD_SetMotionPlus (s32 chan, u8 enable)
 
s32 WPAD_SetVRes (s32 chan, u32 xres, u32 yres)
 
s32 WPAD_GetStatus ()
 
s32 WPAD_Probe (s32 chan, u32 *type)
 
void WPAD_SetPowerButtonCallback (WPADShutdownCallback cb)
 
void WPAD_SetBatteryDeadCallback (WPADShutdownCallback cb)
 
s32 WPAD_Disconnect (s32 chan)
 
void WPAD_Shutdown ()
 
void WPAD_SetIdleTimeout (u32 seconds)
 
WPADDataWPAD_Data (int chan)
 
u8 WPAD_BatteryLevel (int chan)
 
void WPAD_IR (int chan, struct ir_t *ir)
 
void WPAD_Orientation (int chan, struct orient_t *orient)
 
void WPAD_GForce (int chan, struct gforce_t *gforce)
 
void WPAD_Accel (int chan, struct vec3w_t *accel)
 

Variables

static syswd_t __wpad_timer
 
static vu32 __wpads_inited = 0
 
static vs32 __wpads_ponded = 0
 
static u32 __wpad_idletimeout = 300
 
static vu32 __wpads_active = 0
 
static vu32 __wpads_used = 0
 
static wiimote ** __wpads = NULL
 
static wiimote_listen __wpads_listen [CONF_PAD_MAX_REGISTERED]
 
static WPADData wpaddata [WPAD_MAX_WIIMOTES]
 
static struct _wpad_cb __wpdcb [WPAD_MAX_WIIMOTES]
 
static conf_pads __wpad_devs
 
static struct linkkey_info __wpad_keys [WPAD_MAX_WIIMOTES]
 
static WPADShutdownCallback __wpad_batcb = NULL
 
static WPADShutdownCallback __wpad_powcb = __wpad_def_powcb
 
static sys_resetinfo __wpad_resetinfo
 

Macro Definition Documentation

◆ ABS

#define ABS (   x)    ((s32)(x)>0?(s32)(x):-((s32)(x)))

◆ DISCONNECT_BATTERY_DIED

#define DISCONNECT_BATTERY_DIED   0x14

◆ DISCONNECT_POWER_OFF

#define DISCONNECT_POWER_OFF   0x15

◆ EVENTQUEUE_LENGTH

#define EVENTQUEUE_LENGTH   16

◆ MAX_STREAMDATA_LEN

#define MAX_STREAMDATA_LEN   20

◆ STATE_CHECK

#define STATE_CHECK (   thresh,
  a,
  b 
)
Value:
if(((thresh) > WPAD_THRESH_IGNORE) && (ABS((a)-(b)) > (thresh))) \
state_changed = 1;
GLboolean GLboolean GLboolean b
Definition: glext.h:6844
#define ABS(x)
Definition: wpad.c:381
#define WPAD_THRESH_IGNORE
Definition: wpad.h:130
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

◆ STATE_CHECK_SIMPLE

#define STATE_CHECK_SIMPLE (   thresh,
  a,
  b 
)
Value:
if(((thresh) > WPAD_THRESH_IGNORE) && ((a) != (b))) \
state_changed = 1;
GLboolean GLboolean GLboolean b
Definition: glext.h:6844
#define WPAD_THRESH_IGNORE
Definition: wpad.h:130
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

Function Documentation

◆ __initcore_finished()

static s32 __initcore_finished ( s32  result,
void usrdata 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __readlinkkey_finished()

static s32 __readlinkkey_finished ( s32  result,
void usrdata 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __save_state()

static void __save_state ( struct wiimote_t wm)
static
Here is the caller graph for this function:

◆ __SYS_DoPowerCB()

void __SYS_DoPowerCB ( void  )
Here is the caller graph for this function:

◆ __wiiuse_sensorbar_enable()

void __wiiuse_sensorbar_enable ( int  enable)
Here is the caller graph for this function:

◆ __wpad_assign_slot()

wiimote* __wpad_assign_slot ( struct bd_addr pad_addr)
Here is the caller graph for this function:

◆ __wpad_calc_data()

static void __wpad_calc_data ( WPADData data,
WPADData lstate,
struct accel_t accel_calib,
u32  smoothed 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __wpad_def_powcb()

static void __wpad_def_powcb ( s32  chan)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __wpad_disconnect()

static s32 __wpad_disconnect ( struct _wpad_cb wpdcb)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __wpad_disconnectCB()

void __wpad_disconnectCB ( struct bd_addr offaddr,
u8  reason 
)
Here is the caller graph for this function:

◆ __wpad_eventCB()

static void __wpad_eventCB ( struct wiimote_t wm,
s32  event 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __wpad_init_finished()

static s32 __wpad_init_finished ( s32  result,
void usrdata 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __wpad_onreset()

static s32 __wpad_onreset ( s32  final)
static
Here is the call graph for this function:

◆ __wpad_patch_finished()

static s32 __wpad_patch_finished ( s32  result,
void usrdata 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __wpad_read_expansion()

static u32 __wpad_read_expansion ( struct wiimote_t wm,
WPADData data,
struct _wpad_thresh thresh 
)
static
Here is the caller graph for this function:

◆ __wpad_read_wiimote()

static void __wpad_read_wiimote ( struct wiimote_t wm,
WPADData data,
s32 idle_time,
struct _wpad_thresh thresh 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __wpad_setfmt()

static void __wpad_setfmt ( s32  chan)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __wpad_timeouthandler()

static void __wpad_timeouthandler ( syswd_t  alarm,
void cbarg 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pad_readpending_temp()

static s32 pad_readpending_temp ( s32  chan)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WPAD_Accel()

void WPAD_Accel ( int  chan,
struct vec3w_t accel 
)

◆ WPAD_BatteryLevel()

u8 WPAD_BatteryLevel ( int  chan)

◆ WPAD_Data()

WPADData* WPAD_Data ( int  chan)
Here is the caller graph for this function:

◆ WPAD_Disconnect()

s32 WPAD_Disconnect ( s32  chan)
Here is the call graph for this function:

◆ WPAD_GetStatus()

s32 WPAD_GetStatus ( )

◆ WPAD_GForce()

void WPAD_GForce ( int  chan,
struct gforce_t gforce 
)

◆ WPAD_Init()

s32 WPAD_Init ( )
Here is the call graph for this function:

◆ WPAD_IR()

void WPAD_IR ( int  chan,
struct ir_t ir 
)

◆ WPAD_Orientation()

void WPAD_Orientation ( int  chan,
struct orient_t orient 
)

◆ WPAD_Probe()

s32 WPAD_Probe ( s32  chan,
u32 type 
)

◆ WPAD_ReadEvent()

s32 WPAD_ReadEvent ( s32  chan,
WPADData data 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WPAD_ReadPending()

s32 WPAD_ReadPending ( s32  chan,
WPADDataCallback  datacb 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WPAD_SetBatteryDeadCallback()

void WPAD_SetBatteryDeadCallback ( WPADShutdownCallback  cb)

◆ WPAD_SetIdleTimeout()

void WPAD_SetIdleTimeout ( u32  seconds)

◆ WPAD_SetMotionPlus()

s32 WPAD_SetMotionPlus ( s32  chan,
u8  enable 
)
Here is the call graph for this function:

◆ WPAD_SetPowerButtonCallback()

void WPAD_SetPowerButtonCallback ( WPADShutdownCallback  cb)
Here is the call graph for this function:

◆ WPAD_SetVRes()

s32 WPAD_SetVRes ( s32  chan,
u32  xres,
u32  yres 
)
Here is the call graph for this function:

◆ WPAD_Shutdown()

void WPAD_Shutdown ( )
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ __wpad_batcb

WPADShutdownCallback __wpad_batcb = NULL
static

◆ __wpad_devs

conf_pads __wpad_devs
static

◆ __wpad_idletimeout

u32 __wpad_idletimeout = 300
static

◆ __wpad_keys

struct linkkey_info __wpad_keys[WPAD_MAX_WIIMOTES]
static

◆ __wpad_powcb

WPADShutdownCallback __wpad_powcb = __wpad_def_powcb
static

◆ __wpad_resetinfo

sys_resetinfo __wpad_resetinfo
static
Initial value:
= {
{},
127
}
static s32 __wpad_onreset(s32 final)
Definition: wpad.c:124

◆ __wpad_timer

syswd_t __wpad_timer
static

◆ __wpads

wiimote** __wpads = NULL
static

◆ __wpads_active

vu32 __wpads_active = 0
static

◆ __wpads_inited

vu32 __wpads_inited = 0
static

◆ __wpads_listen

wiimote_listen __wpads_listen[CONF_PAD_MAX_REGISTERED]
static

◆ __wpads_ponded

vs32 __wpads_ponded = 0
static

◆ __wpads_used

vu32 __wpads_used = 0
static

◆ __wpdcb

struct _wpad_cb __wpdcb[WPAD_MAX_WIIMOTES]
static

◆ wpaddata

WPADData wpaddata[WPAD_MAX_WIIMOTES]
static