├── .cvsignore ├── .gitignore ├── Makefile ├── README.md ├── gc ├── aesndlib.h ├── asndlib.h ├── bte │ ├── bd_addr.h │ └── bte.h ├── debug.h ├── di │ └── di.h ├── gccore.h ├── gcmodplay.h ├── gctypes.h ├── gcutil.h ├── ipv4 │ └── lwip │ │ ├── icmp.h │ │ ├── inet.h │ │ ├── ip.h │ │ ├── ip_addr.h │ │ └── ip_frag.h ├── iso9660.h ├── lwip │ ├── api.h │ ├── api_msg.h │ ├── arch.h │ ├── debug.h │ ├── def.h │ ├── dhcp.h │ ├── err.h │ ├── lwipopts.h │ ├── mem.h │ ├── memp.h │ ├── netif.h │ ├── opt.h │ ├── pbuf.h │ ├── raw.h │ ├── sio.h │ ├── snmp.h │ ├── sockets.h │ ├── stats.h │ ├── sys.h │ ├── tcp.h │ ├── tcpip.h │ └── udp.h ├── mad.h ├── modplay │ ├── defines.h │ ├── freqtab.h │ ├── mixer.h │ ├── modplay.h │ └── semitonetab.h ├── mp3player.h ├── netif │ ├── arch │ │ ├── cc.h │ │ ├── cpu.h │ │ ├── init.h │ │ ├── lib.h │ │ ├── perf.h │ │ └── sys_arch.h │ ├── etharp.h │ ├── gcif │ │ └── gcif.h │ └── loopif.h ├── network.h ├── ogc │ ├── aram.h │ ├── arqmgr.h │ ├── arqueue.h │ ├── audio.h │ ├── cache.h │ ├── card.h │ ├── cast.h │ ├── chain.h │ ├── color.h │ ├── cond.h │ ├── conf.h │ ├── consol.h │ ├── context.h │ ├── coremsg.h │ ├── coremutex.h │ ├── coresem.h │ ├── disc_io.h │ ├── dsp.h │ ├── dvd.h │ ├── es.h │ ├── exi.h │ ├── gu.h │ ├── gx.h │ ├── gx_struct.h │ ├── heap.h │ ├── ios.h │ ├── ipc.h │ ├── irq.h │ ├── isfs.h │ ├── libversion.h │ ├── lwp.h │ ├── lwp_config.h │ ├── machine │ │ ├── asm.h │ │ ├── processor.h │ │ └── spinlock.h │ ├── message.h │ ├── mutex.h │ ├── object.h │ ├── pad.h │ ├── priority.h │ ├── semaphore.h │ ├── si.h │ ├── stack.h │ ├── states.h │ ├── stm.h │ ├── sysstate.h │ ├── system.h │ ├── texconv.h │ ├── thread.h │ ├── threadq.h │ ├── tpl.h │ ├── tqdata.h │ ├── usb.h │ ├── usbgecko.h │ ├── usbmouse.h │ ├── usbstorage.h │ ├── video.h │ ├── video_types.h │ ├── watchdog.h │ ├── wiilaunch.h │ └── wkspace.h ├── ogcsys.h ├── samplerate.h ├── sdcard │ ├── card_buf.h │ ├── card_cmn.h │ ├── card_io.h │ ├── gcsd.h │ └── wiisd_io.h ├── smb.h ├── wiikeyboard │ ├── keyboard.h │ ├── usbkeyboard.h │ └── wsksymdef.h └── wiiuse │ ├── wiiuse.h │ └── wpad.h ├── gcsdk.dsp ├── gcsdk.dsw ├── gcsdk.vcproj ├── libaesnd ├── aesndlib.c ├── dspcode │ └── dspmixer.s └── dspmixer.h ├── libasnd ├── asndlib.c ├── dsp_mixer.h └── dsp_mixer │ └── dsp_mixer.s ├── libdb ├── debug.c ├── debug_handler.S ├── debug_if.h ├── debug_supp.c ├── debug_supp.h ├── geckousb.c ├── geckousb.h ├── tcpip.c ├── tcpip.h └── uIP │ ├── bba.c │ ├── bba.h │ ├── memb.c │ ├── memb.h │ ├── memr.c │ ├── memr.h │ ├── uip.h │ ├── uip_arch.c │ ├── uip_arch.h │ ├── uip_arp.c │ ├── uip_arp.h │ ├── uip_icmp.c │ ├── uip_icmp.h │ ├── uip_ip.c │ ├── uip_ip.h │ ├── uip_netif.c │ ├── uip_netif.h │ ├── uip_pbuf.c │ ├── uip_pbuf.h │ ├── uip_tcp.c │ ├── uip_tcp.h │ └── uipopt.h ├── libdi ├── README └── di.c ├── libiso9660 └── iso9660.c ├── libmad ├── D.dat ├── bit.c ├── bit.h ├── config.h ├── decoder.c ├── decoder.h ├── fixed.c ├── fixed.h ├── frame.c ├── frame.h ├── global.h ├── huffman.c ├── huffman.h ├── imdct_s.dat ├── layer12.c ├── layer12.h ├── layer3.c ├── layer3.h ├── mp3player.c ├── qc_table.dat ├── rq_table.dat ├── sf_table.dat ├── stream.c ├── stream.h ├── synth.c ├── synth.h ├── timer.c ├── timer.h ├── version.c └── version.h ├── libmodplay ├── freqtab.c ├── gcmodplay.c ├── mixer.c ├── modplay.c └── semitonetab.c ├── libogc.dox ├── libogc.prj ├── libogc ├── aram.c ├── argv.c ├── arqmgr.c ├── arqueue.c ├── audio.c ├── cache.c ├── cache_asm.S ├── card.c ├── chain.c ├── chain.inl ├── cond.c ├── conf.c ├── console.c ├── console.h ├── console_font_8x16.c ├── coremsg.c ├── coremsg.inl ├── coremutex.c ├── coremutex.inl ├── coresem.c ├── coresem.inl ├── cpu_asm.S ├── decrementer.c ├── decrementer_handler.S ├── depackrnc.S ├── depackrnc1.c ├── dsp.c ├── dvd.c ├── es.c ├── exception.c ├── exception_handler.S ├── exi.c ├── exinit.c ├── gcsd.c ├── gu.c ├── gu_psasm.S ├── gx.c ├── gx_regdef.h ├── heap.c ├── heap.inl ├── ios.c ├── ipc.c ├── irq.c ├── irq_handler.S ├── isfs.c ├── kprintf.c ├── lock_supp.c ├── lwp.c ├── lwp_stack.c ├── malloc_lock.c ├── message.c ├── mutex.c ├── network_common.c ├── network_wii.c ├── newlibc.c ├── object.c ├── object.inl ├── ogc_crt0.S ├── pad.c ├── priority.inl ├── sbrk.c ├── sdgecko_buf.c ├── sdgecko_io.c ├── semaphore.c ├── si.c ├── stack.inl ├── states.inl ├── stm.c ├── sys_state.c ├── sysstate.inl ├── system.c ├── system_asm.S ├── texconv.c ├── thread.c ├── thread.inl ├── threadq.c ├── timesupp.c ├── timesupp.h ├── tpl.c ├── tqdata.inl ├── usb.c ├── usbgecko.c ├── usbmouse.c ├── usbstorage.c ├── video.c ├── video_asm.S ├── watchdog.c ├── watchdog.inl ├── wiilaunch.c ├── wiisd.c ├── wkspace.c └── wkspace.inl ├── libogc_license.txt ├── libtinysmb ├── des.c ├── md4.c ├── ntlm.c ├── smb.c └── smb_devoptab.c ├── libwiikeyboard ├── keyboard.c ├── ukbdmap.c ├── usbkeyboard.c ├── wskbdutil.c └── wsksymvar.h ├── lwbt ├── bt.h ├── btarch.h ├── bte.c ├── btmemb.c ├── btmemb.h ├── btmemr.c ├── btmemr.h ├── btopt.h ├── btpbuf.c ├── btpbuf.h ├── hci.c ├── hci.h ├── l2cap.c ├── l2cap.h ├── physbusif.c └── physbusif.h ├── lwip ├── arch │ └── gc │ │ └── netif │ │ └── gcif.c ├── core │ ├── dhcp.c │ ├── inet.c │ ├── inet6.c │ ├── ipv4 │ │ ├── icmp.c │ │ ├── ip.c │ │ ├── ip_addr.c │ │ └── ip_frag.c │ ├── mem.c │ ├── memp.c │ ├── netif.c │ ├── pbuf.c │ ├── raw.c │ ├── stats.c │ ├── sys.c │ ├── tcp.c │ ├── tcp_in.c │ ├── tcp_out.c │ └── udp.c ├── netif │ ├── etharp.c │ ├── loopif.c │ └── skeleton │ │ ├── ethernetif.c │ │ └── slipif.c ├── netio.c └── network.c └── wiiuse ├── classic.c ├── classic.h ├── definitions.h ├── dynamics.c ├── dynamics.h ├── events.c ├── events.h ├── guitar_hero_3.c ├── guitar_hero_3.h ├── io.c ├── io.h ├── io_wii.c ├── ir.c ├── ir.h ├── license_libogc.txt ├── motion_plus.c ├── motion_plus.h ├── nunchuk.c ├── nunchuk.h ├── os.h ├── speaker.c ├── speaker.h ├── wiiboard.c ├── wiiboard.h ├── wiiuse.c ├── wiiuse_internal.h └── wpad.c /.cvsignore: -------------------------------------------------------------------------------- 1 | build 2 | 3 | deps 4 | 5 | lib 6 | 7 | include -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | cube 2 | deps 3 | include 4 | lib 5 | wii 6 | gc/ogc/libversion.h 7 | *.bz2 8 | docs 9 | warn.log 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # libOGC is actually RTEMS source code 2 | 3 | ## RTEMS branch 4 | 5 | This is what "libOGC" would have looked like if shagkur and Dave Murphy (a. k. a. WinterMute / WntrMute) 6 | hadn't chosen to rename and / or remove: 7 | 8 | - function names 9 | - function members 10 | - variable names 11 | - preprocessor definitions 12 | - original source code file headers 13 | - file names 14 | - whitespace 15 | 16 | This repository (branch) basically is "libOGC" as of v1.8.12 without all those changes mentioned above and 17 | the file headers restored as well after some Google search turned out that there are code similarities 18 | between "libOGC" and some older RTEMS commits which then finally made things clear: 19 | 20 | At least half of the "libOGC" source code is actually RTEMS source code - nothing more, nothing less 21 | (without itself giving any credits to the original developers due to removing the original file headers). 22 | 23 | How disgusting... 24 | -------------------------------------------------------------------------------- /gc/aesndlib.h: -------------------------------------------------------------------------------- 1 | #ifndef __AESNDLIB_H__ 2 | #define __AESNDLIB_H__ 3 | 4 | #include 5 | 6 | #define MAX_VOICES 32 7 | #define SND_BUFFERSIZE 384 // output 2ms sound data at 48KHz 8 | #define DSP_STREAMBUFFER_SIZE 1152 // input 2ms sound data at max. 144KHz 9 | 10 | #if defined(HW_DOL) 11 | #define DSP_DEFAULT_FREQ 48044 12 | #elif defined(HW_RVL) 13 | #define DSP_DEFAULT_FREQ 48000 14 | #endif 15 | 16 | #define VOICE_STATE_STOPPED 0 17 | #define VOICE_STATE_RUNNING 1 18 | #define VOICE_STATE_STREAM 2 19 | 20 | #define VOICE_MONO8 0x00000000 21 | #define VOICE_STEREO8 0x00000001 22 | #define VOICE_MONO16 0x00000002 23 | #define VOICE_STEREO16 0x00000003 24 | 25 | #define VOICE_FREQ32KHZ 32000 26 | #define VOICE_FREQ48KHZ 48000 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | typedef struct aesndpb_t AESNDPB; 33 | 34 | typedef void (*AESNDVoiceCallback)(AESNDPB *pb,u32 state); 35 | typedef void (*AESNDAudioCallback)(void *audio_buffer,u32 len); 36 | 37 | void AESND_Init(); 38 | void AESND_Reset(); 39 | void AESND_Pause(bool pause); 40 | u32 AESND_GetDSPProcessTime(); 41 | f32 AESND_GetDSPProcessUsage(); 42 | AESNDAudioCallback AESND_RegisterAudioCallback(AESNDAudioCallback cb); 43 | 44 | AESNDPB* AESND_AllocateVoice(AESNDVoiceCallback cb); 45 | void AESND_FreeVoice(AESNDPB *pb); 46 | void AESND_SetVoiceStop(AESNDPB *pb,bool stop); 47 | void AESND_SetVoiceMute(AESNDPB *pb,bool mute); 48 | void AESND_SetVoiceLoop(AESNDPB *pb,bool loop); 49 | void AESND_SetVoiceFormat(AESNDPB *pb,u32 format); 50 | void AESND_SetVoiceStream(AESNDPB *pb,bool stream); 51 | void AESND_SetVoiceFrequency(AESNDPB *pb,u32 freq); 52 | void AESND_SetVoiceVolume(AESNDPB *pb,u16 volume_l,u16 volume_r); 53 | void AESND_SetVoiceBuffer(AESNDPB *pb,const void *buffer,u32 len); 54 | void AESND_PlayVoice(AESNDPB *pb,u32 format,const void *buffer,u32 len,u32 freq,u32 delay,bool looped); 55 | AESNDVoiceCallback AESND_RegisterVoiceCallback(AESNDPB *pb,AESNDVoiceCallback cb); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /gc/debug.h: -------------------------------------------------------------------------------- 1 | #ifndef __DEBUG_H__ 2 | #define __DEBUG_H__ 3 | 4 | #include 5 | 6 | #define GDBSTUB_DEVICE_USB 0 /*!< device type: USBGecko */ 7 | #define GDBSTUB_DEVICE_TCP 1 /*!< device type: BBA-TCP */ 8 | 9 | #define GDBSTUB_DEF_CHANNEL 0 /*!< default EXI channel. channel can be 0 or 1. Note: Used for device type USBGecko */ 10 | #define GDBSTUB_DEF_TCPPORT 2828 /*!< default TCP port. Note: Used for device type TCP */ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | extern const char *tcp_localip; 17 | extern const char *tcp_netmask; 18 | extern const char *tcp_gateway; 19 | 20 | 21 | /*!\fn void _break() 22 | * \brief Stub function to insert the hardware break instruction. This function is used to enter the debug stub and to 23 | * connect with the host. The developer is free to insert this function at any position in project's source code. 24 | * 25 | * \return none. 26 | */ 27 | void _break(); 28 | 29 | 30 | /*!\fn void DEBUG_Init(s32 device_type,s32 channel_port) 31 | * \brief Performs the initialization of the debug stub. 32 | * \param[in] device_type type of device to use. can be either USB or TCP. 33 | * \param[in] channel_port depending on the used device this can be either the EXI channel or the TCP port. 34 | * 35 | * \return none. 36 | */ 37 | void DEBUG_Init(s32 device_type,s32 channel_port); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /gc/gcmodplay.h: -------------------------------------------------------------------------------- 1 | #ifndef __GCMODPLAY_H__ 2 | #define __GCMODPLAY_H__ 3 | 4 | #include 5 | #include "modplay/modplay.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif /* __cplusplus */ 10 | 11 | typedef struct _modsndbuf { 12 | u32 freq; 13 | u16 fmt; 14 | u32 chans; 15 | f32 samples; 16 | void *usr_data; 17 | void (*callback)(void *,u8 *,u32); 18 | } MODSNDBUF; 19 | 20 | typedef struct _modplay { 21 | MOD mod; 22 | BOOL playing,paused; 23 | BOOL bits,stereo,manual_polling; 24 | u32 playfreq,numSFXChans; 25 | MODSNDBUF soundBuf; 26 | } MODPlay; 27 | 28 | void MODPlay_Init(MODPlay *mod); 29 | s32 MODPlay_SetFrequency(MODPlay *mod,u32 freq); 30 | void MODPlay_SetStereo(MODPlay *mod,BOOL stereo); 31 | s32 MODPlay_SetMOD(MODPlay *mod,const void *mem); 32 | void MODPlay_Unload(MODPlay *mod); 33 | s32 MODPlay_AllocSFXChannels(MODPlay *mod,u32 sfxchans); 34 | s32 MODPlay_Start(MODPlay *mod); 35 | s32 MODPlay_Stop(MODPlay *mod); 36 | s32 MODPlay_TriggerNote(MODPlay *mod,u32 chan,u8 inst,u16 freq,u8 vol); 37 | s32 MODPlay_Pause(MODPlay *mod,BOOL); 38 | void MODPlay_SetVolume(MODPlay * mod, s32 musicvolume, s32 sfxvolume); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif /* __cplusplus */ 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /gc/gcutil.h: -------------------------------------------------------------------------------- 1 | #ifndef __GCUTIL_H__ 2 | #define __GCUTIL_H__ 3 | 4 | #ifndef ATTRIBUTE_ALIGN 5 | # define ATTRIBUTE_ALIGN(v) __attribute__((aligned(v))) 6 | #endif 7 | #ifndef ATTRIBUTE_PACKED 8 | # define ATTRIBUTE_PACKED __attribute__((packed)) 9 | #endif 10 | 11 | #endif /* _GCUTIL_H */ 12 | 13 | -------------------------------------------------------------------------------- /gc/ipv4/lwip/ip_frag.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Jani Monoses 30 | * 31 | */ 32 | 33 | #ifndef __LWIP_IP_FRAG_H__ 34 | #define __LWIP_IP_FRAG_H__ 35 | 36 | #include "lwip/err.h" 37 | #include "lwip/pbuf.h" 38 | #include "lwip/netif.h" 39 | #include "lwip/ip_addr.h" 40 | 41 | void ip_reass_tmr(void); 42 | struct pbuf * ip_reass(struct pbuf *p); 43 | err_t ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest); 44 | 45 | #endif /* __LWIP_IP_FRAG_H__ */ 46 | 47 | 48 | -------------------------------------------------------------------------------- /gc/iso9660.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * ISO9660 devoptab 3 | * 4 | * Copyright (C) 2008-2010 5 | * tipoloski, clava, shagkur, Tantric, joedj 6 | ****************************************************************************/ 7 | 8 | #ifndef __ISO9660_H__ 9 | #define __ISO9660_H__ 10 | 11 | #include 12 | 13 | #define ISO_MAXPATHLEN 128 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | bool ISO9660_Mount(const char* name, const DISC_INTERFACE* disc_interface); 20 | bool ISO9660_Unmount(const char* name); 21 | const char *ISO9660_GetVolumeLabel(const char *name); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /gc/lwip/api_msg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_API_MSG_H__ 33 | #define __LWIP_API_MSG_H__ 34 | 35 | #include "lwip/opt.h" 36 | #include "lwip/pbuf.h" 37 | #include "lwip/sys.h" 38 | 39 | #include "lwip/ip.h" 40 | 41 | #include "lwip/udp.h" 42 | #include "lwip/tcp.h" 43 | 44 | #include "lwip/api.h" 45 | 46 | enum apimsg_type { 47 | APIMSG_NEWCONN, 48 | APIMSG_DELCONN, 49 | APIMSG_BIND, 50 | APIMSG_CONNECT, 51 | APIMSG_DISCONNECT, 52 | APIMSG_LISTEN, 53 | APIMSG_ACCEPT, 54 | APIMSG_SEND, 55 | APIMSG_RECV, 56 | APIMSG_WRITE, 57 | APIMSG_CLOSE, 58 | APIMSG_MAX 59 | }; 60 | 61 | struct apimsg_msg { 62 | struct netconn *conn; 63 | enum netconn_type type; 64 | union { 65 | struct pbuf *p; 66 | struct { 67 | struct ip_addr *ipaddr; 68 | u16 port; 69 | } bc; 70 | struct { 71 | void *dataptr; 72 | u32 len; 73 | u8 copy; 74 | } w; 75 | sys_mbox mbox; 76 | u16 len; 77 | } msg; 78 | }; 79 | 80 | struct api_msg { 81 | enum apimsg_type type; 82 | struct apimsg_msg msg; 83 | }; 84 | 85 | #endif /* __LWIP_API_MSG_H__ */ 86 | 87 | -------------------------------------------------------------------------------- /gc/lwip/def.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_DEF_H__ 33 | #define __LWIP_DEF_H__ 34 | 35 | /* this might define NULL already */ 36 | #include "arch/cc.h" 37 | 38 | #define LWIP_MAX(x , y) (x) > (y) ? (x) : (y) 39 | #define LWIP_MIN(x , y) (x) < (y) ? (x) : (y) 40 | 41 | #ifndef NULL 42 | #define NULL ((void *)0) 43 | #endif 44 | 45 | 46 | #endif /* __LWIP_DEF_H__ */ 47 | 48 | -------------------------------------------------------------------------------- /gc/lwip/err.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_ERR_H__ 33 | #define __LWIP_ERR_H__ 34 | 35 | #include "lwip/opt.h" 36 | 37 | #include "arch/cc.h" 38 | 39 | typedef s8_t err_t; 40 | 41 | /* Definitions for error constants. */ 42 | 43 | #define ERR_OK 0 /* No error, everything OK. */ 44 | #define ERR_MEM -1 /* Out of memory error. */ 45 | #define ERR_BUF -2 /* Buffer error. */ 46 | 47 | 48 | #define ERR_ABRT -3 /* Connection aborted. */ 49 | #define ERR_RST -4 /* Connection reset. */ 50 | #define ERR_CLSD -5 /* Connection closed. */ 51 | #define ERR_CONN -6 /* Not connected. */ 52 | 53 | #define ERR_VAL -7 /* Illegal value. */ 54 | 55 | #define ERR_ARG -8 /* Illegal argument. */ 56 | 57 | #define ERR_RTE -9 /* Routing problem. */ 58 | 59 | #define ERR_USE -10 /* Address in use. */ 60 | 61 | #define ERR_IF -11 /* Low-level netif error */ 62 | #define ERR_ISCONN -12 /* Already connected. */ 63 | 64 | 65 | #ifdef LWIP_DEBUG 66 | extern char *lwip_strerr(err_t err); 67 | #else 68 | #define lwip_strerr(x) "" 69 | #endif /* LWIP_DEBUG */ 70 | #endif /* __LWIP_ERR_H__ */ 71 | -------------------------------------------------------------------------------- /gc/lwip/mem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_MEM_H__ 33 | #define __LWIP_MEM_H__ 34 | 35 | #include "lwip/opt.h" 36 | #include "lwip/arch.h" 37 | 38 | #if MEM_SIZE > 64000l 39 | typedef u32_t mem_size_t; 40 | #else 41 | typedef u16_t mem_size_t; 42 | #endif /* MEM_SIZE > 64000 */ 43 | 44 | 45 | void mem_init(void); 46 | 47 | void *mem_malloc(mem_size_t size); 48 | void mem_free(void *mem); 49 | void *mem_realloc(void *mem, mem_size_t size); 50 | void *mem_reallocm(void *mem, mem_size_t size); 51 | 52 | #ifndef MEM_ALIGN_SIZE 53 | #define MEM_ALIGN_SIZE(size) (((size) + MEM_ALIGNMENT - 1) & ~(MEM_ALIGNMENT-1)) 54 | #endif 55 | 56 | #ifndef MEM_ALIGN 57 | #define MEM_ALIGN(addr) ((void *)(((mem_ptr_t)(addr) + MEM_ALIGNMENT - 1) & ~(mem_ptr_t)(MEM_ALIGNMENT-1))) 58 | #endif 59 | 60 | #endif /* __LWIP_MEM_H__ */ 61 | 62 | -------------------------------------------------------------------------------- /gc/lwip/memp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | 33 | #ifndef __LWIP_MEMP_H__ 34 | #define __LWIP_MEMP_H__ 35 | 36 | #include "lwip/opt.h" 37 | 38 | typedef enum { 39 | MEMP_PBUF, 40 | MEMP_RAW_PCB, 41 | MEMP_UDP_PCB, 42 | MEMP_TCP_PCB, 43 | MEMP_TCP_PCB_LISTEN, 44 | MEMP_TCP_SEG, 45 | 46 | MEMP_NETBUF, 47 | MEMP_NETCONN, 48 | MEMP_API_MSG, 49 | MEMP_TCPIP_MSG, 50 | 51 | MEMP_SYS_TIMEOUT, 52 | 53 | MEMP_MAX 54 | } memp_t; 55 | 56 | void memp_init(void); 57 | 58 | void *memp_malloc(memp_t type); 59 | void *memp_realloc(memp_t fromtype, memp_t totype, void *mem); 60 | void memp_free(memp_t type, void *mem); 61 | 62 | #endif /* __LWIP_MEMP_H__ */ 63 | 64 | -------------------------------------------------------------------------------- /gc/lwip/sio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | */ 29 | 30 | /* 31 | * This is the interface to the platform specific serial IO module 32 | * It needs to be implemented by those platforms which need SLIP or PPP 33 | */ 34 | 35 | #include "arch/cc.h" 36 | 37 | #ifndef __sio_fd_t_defined 38 | typedef void * sio_fd_t; 39 | #endif 40 | 41 | #ifndef sio_open 42 | sio_fd_t sio_open(u8_t); 43 | #endif 44 | 45 | #ifndef sio_send 46 | void sio_send(u8_t, sio_fd_t); 47 | #endif 48 | 49 | #ifndef sio_recv 50 | u8_t sio_recv(sio_fd_t); 51 | #endif 52 | 53 | #ifndef sio_read 54 | u32_t sio_read(sio_fd_t, u8_t *, u32_t); 55 | #endif 56 | 57 | #ifndef sio_write 58 | u32_t sio_write(sio_fd_t, u8_t *, u32_t); 59 | #endif 60 | 61 | #ifndef sio_read_abort 62 | void sio_read_abort(sio_fd_t); 63 | #endif 64 | -------------------------------------------------------------------------------- /gc/lwip/tcpip.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_TCPIP_H__ 33 | #define __LWIP_TCPIP_H__ 34 | 35 | #include "lwip/api_msg.h" 36 | #include "lwip/pbuf.h" 37 | 38 | enum netmsq_type { 39 | NETMSG_API, 40 | NETMSG_INPUT, 41 | NETMSG_CALLBACK 42 | }; 43 | 44 | struct net_msg { 45 | enum netmsq_type type; 46 | union { 47 | struct api_msg *apimsg; 48 | struct { 49 | struct pbuf *p; 50 | struct netif *net; 51 | } inp; 52 | struct { 53 | void (*f)(void *); 54 | void *ctx; 55 | } cb; 56 | } msg; 57 | }; 58 | 59 | #endif /* __LWIP_TCPIP_H__ */ 60 | -------------------------------------------------------------------------------- /gc/modplay/defines.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2002,2003, Christian Nowak 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are 6 | permitted provided that the following conditions are met: 7 | 8 | - Redistributions of source code must retain the above copyright notice, this list of 9 | conditions and the following disclaimer. 10 | - Redistributions in binary form must reproduce the above copyright notice, this list 11 | of conditions and the following disclaimer in the documentation and/or other 12 | materials provided with the distribution. 13 | - The names of the contributors may not be used to endorse or promote products derived 14 | from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 17 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 19 | THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 23 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 24 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef __DEFINES_H__ 28 | #define __DEFINES_H__ 29 | 30 | #include 31 | 32 | #undef LITTLE_ENDIAN 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | typedef union 39 | { 40 | #ifdef LITTLE_ENDIAN 41 | struct 42 | { 43 | u8 low; 44 | u8 high; 45 | } abyte; 46 | #else 47 | struct 48 | { 49 | u8 high; 50 | u8 low; 51 | } abyte; 52 | #endif 53 | u16 aword; 54 | } union_word; 55 | 56 | 57 | typedef union 58 | { 59 | #ifdef LITTLE_ENDIAN 60 | struct 61 | { 62 | u16 low; 63 | u16 high; 64 | } aword; 65 | #else 66 | struct 67 | { 68 | u16 high; 69 | u16 low; 70 | } aword; 71 | #endif 72 | u32 adword; 73 | } union_dword; 74 | 75 | 76 | 77 | 78 | 79 | #ifndef BOOL 80 | #define BOOL u32 81 | #endif 82 | #ifndef TRUE 83 | #define TRUE 1 84 | #endif 85 | #ifndef FALSE 86 | #define FALSE 0 87 | #endif 88 | #ifndef NULL 89 | #define NULL 0 90 | #endif 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif 97 | 98 | 99 | -------------------------------------------------------------------------------- /gc/modplay/freqtab.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2002,2003, Christian Nowak 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are 6 | permitted provided that the following conditions are met: 7 | 8 | - Redistributions of source code must retain the above copyright notice, this list of 9 | conditions and the following disclaimer. 10 | - Redistributions in binary form must reproduce the above copyright notice, this list 11 | of conditions and the following disclaimer in the documentation and/or other 12 | materials provided with the distribution. 13 | - The names of the contributors may not be used to endorse or promote products derived 14 | from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 17 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 19 | THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 23 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 24 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef __FREQTAB_H__ 28 | #define __FREQTAB_H__ 29 | 30 | extern u16 freqtab[]; 31 | 32 | #endif 33 | 34 | 35 | -------------------------------------------------------------------------------- /gc/modplay/mixer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2002,2003, Christian Nowak 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are 6 | permitted provided that the following conditions are met: 7 | 8 | - Redistributions of source code must retain the above copyright notice, this list of 9 | conditions and the following disclaimer. 10 | - Redistributions in binary form must reproduce the above copyright notice, this list 11 | of conditions and the following disclaimer in the documentation and/or other 12 | materials provided with the distribution. 13 | - The names of the contributors may not be used to endorse or promote products derived 14 | from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 17 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 19 | THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 23 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 24 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | /* mixer.h */ 28 | 29 | #ifndef __MIXER_H__ 30 | #define __MIXER_H__ 31 | 32 | #include "defines.h" 33 | #include "modplay.h" 34 | 35 | int mix_mono_16bit ( MOD * mod, s16 * buf, int numSamples ); 36 | int mix_stereo_16bit ( MOD * mod, s16 * buf, int numSamples ); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /gc/modplay/semitonetab.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2002,2003, Christian Nowak 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are 6 | permitted provided that the following conditions are met: 7 | 8 | - Redistributions of source code must retain the above copyright notice, this list of 9 | conditions and the following disclaimer. 10 | - Redistributions in binary form must reproduce the above copyright notice, this list 11 | of conditions and the following disclaimer in the documentation and/or other 12 | materials provided with the distribution. 13 | - The names of the contributors may not be used to endorse or promote products derived 14 | from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 17 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 19 | THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 23 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 24 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef __SEMITONETAB_H__ 28 | #define __SEMITONETAB_H__ 29 | 30 | #include "defines.h" 31 | extern u8 semitonetab[4096]; 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /gc/mp3player.h: -------------------------------------------------------------------------------- 1 | #ifndef __MP3PLAYER_H__ 2 | #define __MP3PLAYER_H__ 3 | 4 | #include 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif /* __cplusplus */ 10 | 11 | void MP3Player_Init(); 12 | void MP3Player_Stop(); 13 | BOOL MP3Player_IsPlaying(); 14 | void MP3Player_Volume(u32 volume); 15 | s32 MP3Player_PlayBuffer(const void *buffer,s32 len,void (*filterfunc)(struct mad_stream *,struct mad_frame *)); 16 | s32 MP3Player_PlayFile(void *cb_data,s32 (*reader)(void *,void *,s32),void (*filterfunc)(struct mad_stream *,struct mad_frame *)); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif /* __cplusplus */ 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /gc/netif/arch/cc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | * Author: Adam Dunkels 32 | * 33 | */ 34 | #ifndef __ARCH_CC_H__ 35 | #define __ARCH_CC_H__ 36 | 37 | #include 38 | #include 39 | #include 40 | #include "asm.h" 41 | #include "processor.h" 42 | 43 | typedef u8 u8_t; 44 | typedef s8 s8_t; 45 | typedef u16 u16_t; 46 | typedef s16 s16_t; 47 | typedef u32 u32_t; 48 | typedef s32 s32_t; 49 | typedef u32 mem_ptr_t; 50 | 51 | 52 | #define PACK_STRUCT_FIELD(x) x 53 | #define PACK_STRUCT_STRUCT __attribute__((packed)) 54 | #define PACK_STRUCT_BEGIN 55 | #define PACK_STRUCT_END 56 | 57 | #define LWIP_PLATFORM_ASSERT(x) { printf(x); while (1); } 58 | #define LWIP_PLATFORM_DIAG(x) printf x 59 | 60 | #define SYS_ARCH_DECL_PROTECT(lev) u32 lev 61 | #define SYS_ARCH_PROTECT(lev) _ISR_Disable(lev) 62 | #define SYS_ARCH_UNPROTECT(lev) _ISR_Enable(lev) 63 | 64 | /* Define (sn)printf formatters for these lwIP types */ 65 | #define U16_F "hu" 66 | #define S16_F "hd" 67 | #define X16_F "hx" 68 | #define U32_F "u" 69 | #define S32_F "d" 70 | #define X32_F "x" 71 | 72 | 73 | #endif /* __ARCH_CC_H__ */ 74 | -------------------------------------------------------------------------------- /gc/netif/arch/cpu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | * Author: Adam Dunkels 32 | * 33 | */ 34 | #ifndef __CPU_H__ 35 | #define __CPU_H__ 36 | 37 | #define BYTE_ORDER BIG_ENDIAN 38 | 39 | #endif /* __CPU_H__ */ 40 | -------------------------------------------------------------------------------- /gc/netif/arch/init.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | * Author: Adam Dunkels 32 | * 33 | */ 34 | #ifndef __ARCH_INIT_H__ 35 | #define __ARCH_INIT_H__ 36 | 37 | #define TCPIP_INIT_DONE(arg) tcpip_init_done(arg) 38 | 39 | void tcpip_init_done(void *); 40 | int wait_for_tcpip_init(void); 41 | 42 | #endif /* __ARCH_INIT_H__ */ 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /gc/netif/arch/lib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | * Author: Adam Dunkels 32 | * 33 | */ 34 | #ifndef __LIB_H__ 35 | #define __LIB_H__ 36 | 37 | #include 38 | 39 | #define bcopy(s, d, l) memcpy(d, s, l) 40 | #define bzero(d, l) memset(d, 0, l) 41 | 42 | #endif /* __LIB_H__ */ 43 | -------------------------------------------------------------------------------- /gc/netif/arch/perf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | * Author: Adam Dunkels 32 | * 33 | */ 34 | #ifndef __PERF_H__ 35 | #define __PERF_H__ 36 | 37 | #define PERF_START /* null definition */ 38 | #define PERF_STOP(x) /* null definition */ 39 | 40 | #endif /* __PERF_H__ */ 41 | -------------------------------------------------------------------------------- /gc/netif/arch/sys_arch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | * Author: Adam Dunkels 32 | * 33 | */ 34 | #ifndef __SYS_GC_H__ 35 | #define __SYS_GC_H__ 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #define SYS_MBOX_NULL MQ_BOX_NULL 44 | #define SYS_SEM_NULL SEM_FAILED 45 | 46 | typedef sem_t sys_sem; 47 | typedef sem_t *sys_sem_t; 48 | 49 | typedef mqd_t sys_mbox; 50 | typedef mqd_t *sys_mbox_t; 51 | 52 | typedef lwp_t sys_thread; 53 | typedef lwp_t* sys_thread_t; 54 | 55 | #endif /* __SYS_C64_H__ */ 56 | -------------------------------------------------------------------------------- /gc/netif/gcif/gcif.h: -------------------------------------------------------------------------------- 1 | #ifndef __GCIF_H__ 2 | #define __GCIF_H__ 3 | 4 | #include 5 | 6 | #define ERR_NODATA -12 7 | #define ERR_ALLREAD -13 8 | #define ERR_TXERROR -14 9 | #define ERR_RXERROR -14 10 | #define ERR_NODEV -16 11 | #define ERR_PKTSIZE -17 12 | #define ERR_TXPENDING -18 13 | 14 | #define cpu_to_be16(x) (x) 15 | #define cpu_to_be32(x) (x) 16 | extern inline u16 cpu_to_le16(u16 x) { return (x<<8) | (x>>8);} 17 | extern inline u32 cpu_to_le32(u32 x) { return((x>>24) | ((x>>8)&0xff00) | ((x<<8)&0xff0000) | (x<<24));} 18 | 19 | #define cpu_to_le16p(addr) (cpu_to_le16(*(addr))) 20 | #define cpu_to_le32p(addr) (cpu_to_le32(*(addr))) 21 | #define cpu_to_be16p(addr) (cpu_to_be16(*(addr))) 22 | #define cpu_to_be32p(addr) (cpu_to_be32(*(addr))) 23 | 24 | extern inline void cpu_to_le16s(u16 *a) {*a = cpu_to_le16(*a);} 25 | extern inline void cpu_to_le32s(u32 *a) {*a = cpu_to_le32(*a);} 26 | extern inline void cpu_to_be16s(u16 *a) {*a = cpu_to_be16(*a);} 27 | extern inline void cpu_to_be32s(u32 *a) {*a = cpu_to_be32(*a);} 28 | 29 | #define le16_to_cpup(x) cpu_to_le16p(x) 30 | #define le32_to_cpup(x) cpu_to_le32p(x) 31 | #define be16_to_cpup(x) cpu_to_be16p(x) 32 | #define be32_to_cpup(x) cpu_to_be32p(x) 33 | 34 | #define le16_to_cpus(x) cpu_to_le16s(x) 35 | #define le32_to_cpus(x) cpu_to_le32s(x) 36 | #define be16_to_cpus(x) cpu_to_be16s(x) 37 | #define be32_to_cpus(x) cpu_to_be32s(x) 38 | 39 | typedef void* dev_s; 40 | 41 | dev_s bba_create(struct netif *); 42 | err_t bba_init(struct netif *); 43 | void bba_process(struct pbuf *p,struct netif *dev); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /gc/netif/loopif.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __NETIF_LOOPIF_H__ 33 | #define __NETIF_LOOPIF_H__ 34 | 35 | #include "lwip/netif.h" 36 | 37 | err_t loopif_init(struct netif *netif); 38 | 39 | #endif /* __NETIF_LOOPIF_H__ */ 40 | -------------------------------------------------------------------------------- /gc/ogc/color.h: -------------------------------------------------------------------------------- 1 | #ifndef __COLOR_H__ 2 | #define __COLOR_H__ 3 | 4 | // luminance is stored twice, thus one of the lum. is 5 | // redundant, but this way we can fill the screen. 6 | 7 | #define COLOR_BLACK (0x00800080) 8 | #define COLOR_MAROON (0x266A26C0) 9 | #define COLOR_GREEN (0x4B554B4A) 10 | #define COLOR_OLIVE (0x7140718A) 11 | #define COLOR_NAVY (0x0EC00E75) 12 | #define COLOR_PURPLE (0x34AA34B5) 13 | #define COLOR_TEAL (0x59955940) 14 | #define COLOR_GRAY (0x80808080) 15 | #define COLOR_SILVER (0xC080C080) 16 | #define COLOR_RED (0x4C544CFF) 17 | #define COLOR_LIME (0x952B9515) 18 | #define COLOR_YELLOW (0xE100E194) 19 | #define COLOR_BLUE (0x1DFF1D6B) 20 | #define COLOR_FUCHSIA (0x69D469EA) 21 | #define COLOR_AQUA (0xB2ABB200) 22 | #define COLOR_WHITE (0xFF80FF80) 23 | #define COLOR_MONEYGREEN (0xD076D074) 24 | #define COLOR_SKYBLUE (0xC399C36A) 25 | #define COLOR_CREAM (0xFA79FA82) 26 | #define COLOR_MEDGRAY (0xA082A07F) 27 | 28 | #endif /* COLOR_H */ 29 | -------------------------------------------------------------------------------- /gc/ogc/consol.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derek57/libogc/1d97726b06fed0e501569b4f755542123139e7ea/gc/ogc/consol.h -------------------------------------------------------------------------------- /gc/ogc/context.h: -------------------------------------------------------------------------------- 1 | #ifndef __EXCONTEXT_H__ 2 | #define __EXCONTEXT_H__ 3 | 4 | #define NUM_EXCEPTIONS 15 5 | 6 | #define EX_SYS_RESET 0 7 | #define EX_MACH_CHECK 1 8 | #define EX_DSI 2 9 | #define EX_ISI 3 10 | #define EX_INT 4 11 | #define EX_ALIGN 5 12 | #define EX_PRG 6 13 | #define EX_FP 7 14 | #define EX_DEC 8 15 | #define EX_SYS_CALL 9 16 | #define EX_TRACE 10 17 | #define EX_PERF 11 18 | #define EX_IABR 12 19 | #define EX_RESV 13 20 | #define EX_THERM 14 21 | 22 | #ifndef ASM 23 | 24 | #include 25 | #include "lwp_config.h" 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif /* __cplusplus */ 30 | 31 | typedef struct { 32 | unsigned32 EXCPT_Number; 33 | unsigned32 SRR0,SRR1; 34 | unsigned32 GPR[32]; 35 | unsigned32 GQR[8]; 36 | unsigned32 CR, LR, CTR, XER, MSR, DAR; 37 | 38 | unsigned16 state; //used to determine whether to restore the fpu context or not 39 | unsigned16 mode; //unused 40 | 41 | double_precision FPR[32]; 42 | unsigned64 FPSCR; 43 | double_precision PSFPR[32]; 44 | } Context_Control; 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif /* __cplusplus */ 49 | 50 | #endif /* !ASM */ 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /gc/ogc/disc_io.h: -------------------------------------------------------------------------------- 1 | /* 2 | disc_io.h 3 | Interface template for low level disc functions. 4 | 5 | Copyright (c) 2006 Michael "Chishm" Chisholm 6 | Based on code originally written by MightyMax 7 | 8 | Redistribution and use in source and binary forms, with or without modification, 9 | are permitted provided that the following conditions are met: 10 | 11 | 1. Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | 2. Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation and/or 15 | other materials provided with the distribution. 16 | 3. The name of the author may not be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 20 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 21 | AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 27 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef OGC_DISC_IO_INCLUDE 31 | #define OGC_DISC_IO_INCLUDE 32 | 33 | #include 34 | #include 35 | 36 | 37 | #define FEATURE_MEDIUM_CANREAD 0x00000001 38 | #define FEATURE_MEDIUM_CANWRITE 0x00000002 39 | #define FEATURE_GAMECUBE_SLOTA 0x00000010 40 | #define FEATURE_GAMECUBE_SLOTB 0x00000020 41 | #define FEATURE_GAMECUBE_DVD 0x00000040 42 | #define FEATURE_WII_SD 0x00000100 43 | #define FEATURE_WII_USB 0x00000200 44 | #define FEATURE_WII_DVD 0x00000400 45 | 46 | typedef uint32_t sec_t; 47 | 48 | typedef bool (* FN_MEDIUM_STARTUP)(void) ; 49 | typedef bool (* FN_MEDIUM_ISINSERTED)(void) ; 50 | typedef bool (* FN_MEDIUM_READSECTORS)(sec_t sector, sec_t numSectors, void* buffer) ; 51 | typedef bool (* FN_MEDIUM_WRITESECTORS)(sec_t sector, sec_t numSectors, const void* buffer) ; 52 | typedef bool (* FN_MEDIUM_CLEARSTATUS)(void) ; 53 | typedef bool (* FN_MEDIUM_SHUTDOWN)(void) ; 54 | 55 | struct DISC_INTERFACE_STRUCT { 56 | unsigned long ioType ; 57 | unsigned long features ; 58 | FN_MEDIUM_STARTUP startup ; 59 | FN_MEDIUM_ISINSERTED isInserted ; 60 | FN_MEDIUM_READSECTORS readSectors ; 61 | FN_MEDIUM_WRITESECTORS writeSectors ; 62 | FN_MEDIUM_CLEARSTATUS clearStatus ; 63 | FN_MEDIUM_SHUTDOWN shutdown ; 64 | } ; 65 | 66 | typedef struct DISC_INTERFACE_STRUCT DISC_INTERFACE ; 67 | 68 | #endif // define OGC_DISC_IO_INCLUDE 69 | -------------------------------------------------------------------------------- /gc/ogc/gx_struct.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------- 2 | 3 | gx_struct.h -- support header 4 | 5 | Copyright (C) 2004 6 | Michael Wiedenbauer (shagkur) 7 | Dave Murphy (WinterMute) 8 | 9 | This software is provided 'as-is', without any express or implied 10 | warranty. In no event will the authors be held liable for any 11 | damages arising from the use of this software. 12 | 13 | Permission is granted to anyone to use this software for any 14 | purpose, including commercial applications, and to alter it and 15 | redistribute it freely, subject to the following restrictions: 16 | 17 | 1. The origin of this software must not be misrepresented; you 18 | must not claim that you wrote the original software. If you use 19 | this software in a product, an acknowledgment in the product 20 | documentation would be appreciated but is not required. 21 | 22 | 2. Altered source versions must be plainly marked as such, and 23 | must not be misrepresented as being the original software. 24 | 25 | 3. This notice may not be removed or altered from any source 26 | distribution. 27 | 28 | -------------------------------------------------------------*/ 29 | 30 | 31 | #ifndef __GX_STRUCT_H__ 32 | #define __GX_STRUCT_H__ 33 | 34 | /*! 35 | \file gx_struct.h 36 | \brief support header 37 | */ 38 | 39 | #include 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif /* __cplusplus */ 44 | 45 | 46 | /*! 47 | \typedef struct _gx_rmodeobj GXRModeObj 48 | \brief structure to hold the selected video and render settings 49 | \param viTVMode mode and type of TV 50 | \param fbWidth width of external framebuffer 51 | \param efbHeight height of embedded framebuffer 52 | \param xfbHeight height of external framebuffer 53 | \param viXOrigin x starting point of first pixel to draw on VI 54 | \param viYOrigin y starting point of first pixel to draw on VI 55 | \param viWidth width of configured VI 56 | \param viHeight height of configured VI 57 | */ 58 | typedef struct _gx_rmodeobj { 59 | u32 viTVMode; 60 | u16 fbWidth; 61 | u16 efbHeight; 62 | u16 xfbHeight; 63 | u16 viXOrigin; 64 | u16 viYOrigin; 65 | u16 viWidth; 66 | u16 viHeight; 67 | u32 xfbMode; 68 | u8 field_rendering; 69 | u8 aa; 70 | u8 sample_pattern[12][2]; 71 | u8 vfilter[7]; 72 | } GXRModeObj; 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif /* __cplusplus */ 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /gc/ogc/ios.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------- 2 | 3 | ios.h -- IOS control 4 | 5 | Copyright (C) 2008 6 | Michael Wiedenbauer (shagkur) 7 | Dave Murphy (WinterMute) 8 | Hector Martin (marcan) 9 | 10 | This software is provided 'as-is', without any express or implied 11 | warranty. In no event will the authors be held liable for any 12 | damages arising from the use of this software. 13 | 14 | Permission is granted to anyone to use this software for any 15 | purpose, including commercial applications, and to alter it and 16 | redistribute it freely, subject to the following restrictions: 17 | 18 | 1. The origin of this software must not be misrepresented; you 19 | must not claim that you wrote the original software. If you use 20 | this software in a product, an acknowledgment in the product 21 | documentation would be appreciated but is not required. 22 | 23 | 2. Altered source versions must be plainly marked as such, and 24 | must not be misrepresented as being the original software. 25 | 26 | 3. This notice may not be removed or altered from any source 27 | distribution. 28 | 29 | -------------------------------------------------------------*/ 30 | 31 | #ifndef __IOS_H__ 32 | #define __IOS_H__ 33 | 34 | #if defined(HW_RVL) 35 | 36 | #include 37 | #include 38 | 39 | #define IOS_EINVAL -0x3004 40 | #define IOS_EBADVERSION -0x3100 41 | #define IOS_ETOOMANYVIEWS -0x3101 42 | #define IOS_EMISMATCH -0x3102 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif /* __cplusplus */ 47 | 48 | s32 __IOS_InitializeSubsystems(void); 49 | s32 __IOS_ShutdownSubsystems(void); 50 | s32 __IOS_LoadStartupIOS(void); 51 | s32 __IOS_LaunchNewIOS(int version); 52 | s32 IOS_GetPreferredVersion(void); 53 | s32 IOS_ReloadIOS(int version); 54 | s32 IOS_GetVersion(); 55 | s32 IOS_GetRevision(); 56 | s32 IOS_GetRevisionMajor(); 57 | s32 IOS_GetRevisionMinor(); 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif /* __cplusplus */ 62 | 63 | #endif 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /gc/ogc/libversion.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIBVERSION_H__ 2 | #define __LIBVERSION_H__ 3 | 4 | #define _V_MAJOR_ 1 5 | #define _V_MINOR_ 8 6 | #define _V_PATCH_ 12 7 | 8 | #define _V_DATE_ __DATE__ 9 | #define _V_TIME_ __TIME__ 10 | 11 | #define _V_STRING "libOGC Release 1.8.12" 12 | 13 | #endif // __LIBVERSION_H__ 14 | -------------------------------------------------------------------------------- /gc/ogc/message.h: -------------------------------------------------------------------------------- 1 | /* rtems/posix/mqueue.h 2 | * 3 | * This include file contains all the private support information for 4 | * POSIX Message Queues. 5 | * 6 | * COPYRIGHT (c) 1989-1999. 7 | * On-Line Applications Research Corporation (OAR). 8 | * 9 | * The license and distribution terms for this file may be 10 | * found in the file LICENSE in this distribution or at 11 | * http://www.OARcorp.com/rtems/license.html. 12 | * 13 | * $Id$ 14 | */ 15 | 16 | 17 | #ifndef __MESSAGE_H__ 18 | #define __MESSAGE_H__ 19 | 20 | /*! \file message.h 21 | \brief Thread subsystem II 22 | 23 | */ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | #include 30 | 31 | #define MQ_BOX_NULL 0xffffffff 32 | 33 | #define MQ_ERROR_SUCCESSFUL 0 34 | #define MQ_ERROR_TOOMANY -5 35 | 36 | #define MQ_MSG_BLOCK 0 37 | #define MQ_MSG_NOBLOCK 1 38 | 39 | 40 | /*! \typedef unsigned32 mqd_t 41 | \brief typedef for the message queue handle 42 | */ 43 | typedef Objects_Id mqd_t; 44 | 45 | 46 | /*! \fn unsigned32 mq_open(mqd_t *mqbox,unsigned32 count) 47 | \brief Initializes a message queue 48 | \param[out] mqbox pointer to the mqd_t handle. 49 | \param[in] count maximum number of messages the queue can hold 50 | 51 | \return 0 on success, <0 on error 52 | */ 53 | int mq_open( 54 | mqd_t *mqdes, 55 | unsigned32 count 56 | ); 57 | 58 | 59 | /*! \fn void mq_close(mqd_t mqbox) 60 | \brief Closes the message queue and releases all memory. 61 | \param[in] mqbox handle to the mqd_t structure. 62 | 63 | \return none 64 | */ 65 | void mq_close( 66 | mqd_t mqdes 67 | ); 68 | 69 | 70 | /*! \fn boolean mq_send(mqd_t mqbox,char *msg,unsigned32 flags) 71 | \brief Sends a message to the given message queue. 72 | \param[in] mqbox mqd_t handle to the message queue 73 | \param[in] msg message to send 74 | \param[in] flags message flags (MQ_MSG_BLOCK, MQ_MSG_NOBLOCK) 75 | 76 | \return boolean result 77 | */ 78 | boolean mq_send( 79 | mqd_t mqdes, 80 | char *msg_ptr, 81 | unsigned32 oflag 82 | ); 83 | 84 | 85 | /*! \fn boolean MQ_Jam(mqd_t mqdes, char *msg_ptr, unsigned32 oflag) 86 | \brief Sends a message to the given message queue and jams it in front of the queue. 87 | \param[in] mqdes mqd_t handle to the message queue 88 | \param[in] msg_ptr message to send 89 | \param[in] oflag message flags (MQ_MSG_BLOCK, MQ_MSG_NOBLOCK) 90 | 91 | \return boolean result 92 | */ 93 | boolean MQ_Jam(mqd_t mqdes, char *msg_ptr, unsigned32 oflag); 94 | 95 | 96 | /*! \fn boolean mq_receive(mqd_t mqbox,char **msg,unsigned32 oflag) 97 | \brief Sends a message to the given message queue. 98 | \param[in] mqdes mqd_t handle to the message queue 99 | \param[in] msg_ptr pointer to a mqmsg_t_t-type message to receive. 100 | \param[in] oflag message flags (MQ_MSG_BLOCK, MQ_MSG_NOBLOCK) 101 | 102 | \return boolean result 103 | */ 104 | boolean mq_receive( 105 | mqd_t mqdes, 106 | char *msg_ptr, 107 | unsigned32 oflag 108 | ); 109 | 110 | #ifdef __cplusplus 111 | } 112 | #endif 113 | 114 | #endif 115 | -------------------------------------------------------------------------------- /gc/ogc/mutex.h: -------------------------------------------------------------------------------- 1 | /* rtems/posix/mutex.h 2 | * 3 | * This include file contains all the private support information for 4 | * POSIX mutex's. 5 | * 6 | * COPYRIGHT (c) 1989-1999. 7 | * On-Line Applications Research Corporation (OAR). 8 | * 9 | * The license and distribution terms for this file may be 10 | * found in the file LICENSE in this distribution or at 11 | * http://www.OARcorp.com/rtems/license.html. 12 | * 13 | * $Id$ 14 | */ 15 | 16 | 17 | #ifndef __MUTEX_H__ 18 | #define __MUTEX_H__ 19 | 20 | /*! \file mutex.h 21 | \brief Thread subsystem III 22 | 23 | */ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | #include 30 | #include "lwp_config.h" 31 | 32 | /* 33 | * Constant to indicate condition variable does not currently have 34 | * a mutex assigned to it. 35 | */ 36 | 37 | #define POSIX_CONDITION_VARIABLES_NO_MUTEX 0xffffffff 38 | 39 | 40 | /*! \typedef unsigned32 pthread_mutex_t 41 | \brief typedef for the mutex handle 42 | */ 43 | typedef unsigned32 pthread_mutex_t; 44 | 45 | 46 | /*! \fn int pthread_mutex_init(pthread_mutex_t *mutex,boolean use_recursive) 47 | \brief Initializes a mutex lock. 48 | \param[out] mutex pointer to a pthread_mutex_t handle. 49 | \param[in] use_recursive whether to allow the thread, whithin the same context, to enter multiple times the lock or not. 50 | 51 | \return 0 on success, <0 on error 52 | */ 53 | int pthread_mutex_init( 54 | pthread_mutex_t *mutex, 55 | bool use_recursive 56 | ); 57 | 58 | 59 | /*! \fn int pthread_mutex_destroy(pthread_mutex_t mutex) 60 | \brief Close mutex lock, release all threads and handles locked on this mutex. 61 | \param[in] mutex handle to the pthread_mutex_t structure. 62 | 63 | \return 0 on success, <0 on error 64 | */ 65 | int pthread_mutex_destroy( 66 | pthread_mutex_t mutex 67 | ); 68 | 69 | 70 | /*! \fn int pthread_mutex_lock(pthread_mutex_t mutex) 71 | \brief Enter the mutex lock. 72 | \param[in] mutex handle to the mutext_t structure. 73 | 74 | \return 0 on success, <0 on error 75 | */ 76 | int pthread_mutex_lock( 77 | pthread_mutex_t mutex 78 | ); 79 | 80 | 81 | /*! \fn int pthread_mutex_trylock(pthread_mutex_t mutex) 82 | \brief Try to enter the mutex lock. 83 | \param[in] mutex handle to the pthread_mutex_t structure. 84 | 85 | \return 0: on first aquire, 1: would lock 86 | */ 87 | int pthread_mutex_trylock( 88 | pthread_mutex_t mutex 89 | ); 90 | 91 | 92 | /*! \fn int pthread_mutex_unlock(pthread_mutex_t mutex) 93 | \brief Release the mutex lock and let other threads process further on this mutex. 94 | \param[in] mutex handle to the pthread_mutex_t structure. 95 | 96 | \return 0 on success, <0 on error 97 | */ 98 | int pthread_mutex_unlock( 99 | pthread_mutex_t mutex 100 | ); 101 | 102 | #ifdef __cplusplus 103 | } 104 | #endif 105 | 106 | #endif 107 | -------------------------------------------------------------------------------- /gc/ogc/pad.h: -------------------------------------------------------------------------------- 1 | #ifndef __PAD_H__ 2 | #define __PAD_H__ 3 | 4 | #include 5 | 6 | #define PAD_CHAN0 0 7 | #define PAD_CHAN1 1 8 | #define PAD_CHAN2 2 9 | #define PAD_CHAN3 3 10 | #define PAD_CHANMAX 4 11 | 12 | #define PAD_MOTOR_STOP 0 13 | #define PAD_MOTOR_RUMBLE 1 14 | #define PAD_MOTOR_STOP_HARD 2 15 | 16 | #define PAD_ERR_NONE 0 17 | #define PAD_ERR_NO_CONTROLLER -1 18 | #define PAD_ERR_NOT_READY -2 19 | #define PAD_ERR_TRANSFER -3 20 | 21 | #define PAD_BUTTON_LEFT 0x0001 22 | #define PAD_BUTTON_RIGHT 0x0002 23 | #define PAD_BUTTON_DOWN 0x0004 24 | #define PAD_BUTTON_UP 0x0008 25 | #define PAD_TRIGGER_Z 0x0010 26 | #define PAD_TRIGGER_R 0x0020 27 | #define PAD_TRIGGER_L 0x0040 28 | #define PAD_BUTTON_A 0x0100 29 | #define PAD_BUTTON_B 0x0200 30 | #define PAD_BUTTON_X 0x0400 31 | #define PAD_BUTTON_Y 0x0800 32 | #define PAD_BUTTON_MENU 0x1000 33 | #define PAD_BUTTON_START 0x1000 34 | 35 | #define PAD_CHAN0_BIT 0x80000000 36 | #define PAD_CHAN1_BIT 0x40000000 37 | #define PAD_CHAN2_BIT 0x20000000 38 | #define PAD_CHAN3_BIT 0x10000000 39 | /*+----------------------------------------------------------------------------------------------+*/ 40 | /*+----------------------------------------------------------------------------------------------+*/ 41 | /*+----------------------------------------------------------------------------------------------+*/ 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif /* __cplusplus */ 45 | /*+----------------------------------------------------------------------------------------------+*/ 46 | typedef struct _padstatus { 47 | u16 button; 48 | s8 stickX; 49 | s8 stickY; 50 | s8 substickX; 51 | s8 substickY; 52 | u8 triggerL; 53 | u8 triggerR; 54 | u8 analogA; 55 | u8 analogB; 56 | s8 err; 57 | } PADStatus; 58 | 59 | typedef void (*sampling_callback)(void); 60 | /*+----------------------------------------------------------------------------------------------+*/ 61 | /*+----------------------------------------------------------------------------------------------+*/ 62 | /*+----------------------------------------------------------------------------------------------+*/ 63 | 64 | u32 PAD_Init(); 65 | u32 PAD_Sync(); 66 | u32 PAD_Read(PADStatus *status); 67 | u32 PAD_Reset(u32 mask); 68 | u32 PAD_Recalibrate(u32 mask); 69 | void PAD_Clamp(PADStatus *status); 70 | void PAD_ControlMotor(s32 chan,u32 cmd); 71 | void PAD_SetSpec(u32 spec); 72 | 73 | u32 PAD_ScanPads(); 74 | 75 | u16 PAD_ButtonsUp(int pad); 76 | u16 PAD_ButtonsDown(int pad); 77 | u16 PAD_ButtonsHeld(int pad); 78 | 79 | s8 PAD_SubStickX(int pad); 80 | s8 PAD_SubStickY(int pad); 81 | 82 | s8 PAD_StickX(int pad); 83 | s8 PAD_StickY(int pad); 84 | 85 | u8 PAD_TriggerL(int pad); 86 | u8 PAD_TriggerR(int pad); 87 | 88 | 89 | sampling_callback PAD_SetSamplingCallback(sampling_callback cb); 90 | 91 | /*+----------------------------------------------------------------------------------------------+*/ 92 | 93 | #ifdef __cplusplus 94 | } 95 | #endif /* __cplusplus */ 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /gc/ogc/priority.h: -------------------------------------------------------------------------------- 1 | /* priority.h 2 | * 3 | * This include file contains all thread priority manipulation routines. 4 | * This Handler provides mechanisms which can be used to 5 | * initialize and manipulate thread priorities. 6 | * 7 | * COPYRIGHT (c) 1989-1999. 8 | * On-Line Applications Research Corporation (OAR). 9 | * 10 | * The license and distribution terms for this file may be 11 | * found in the file LICENSE in this distribution or at 12 | * http://www.OARcorp.com/rtems/license.html. 13 | * 14 | * $Id$ 15 | */ 16 | 17 | #ifndef __PRIORITY_h 18 | #define __PRIORITY_h 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #include 25 | #include "machine/processor.h" 26 | 27 | #define PRIORITY_MINIMUM 0 /* highest thread priority */ 28 | #define PRIORITY_MAXIMUM 255 /* lowest thread priority */ 29 | 30 | /* 31 | * The following record defines the information associated with 32 | * each thread to manage its interaction with the priority bit maps. 33 | */ 34 | 35 | typedef struct { 36 | Priority_Bit_map_control *minor; /* addr of minor bit map slot */ 37 | Priority_Bit_map_control ready_minor; /* priority bit map ready mask */ 38 | Priority_Bit_map_control ready_major; /* priority bit map ready mask */ 39 | Priority_Bit_map_control block_minor; /* priority bit map block mask */ 40 | Priority_Bit_map_control block_major; /* priority bit map block mask */ 41 | } Priority_Information; 42 | 43 | /* 44 | * The following data items are the priority bit map. 45 | * Each of the sixteen bits used in the _Priority_Major_bit_map is 46 | * associated with one of the sixteen entries in the _Priority_Bit_map. 47 | * Each bit in the _Priority_Bit_map indicates whether or not there are 48 | * threads ready at a particular priority. The mapping of 49 | * individual priority levels to particular bits is processor 50 | * dependent as is the value of each bit used to indicate that 51 | * threads are ready at that priority. 52 | */ 53 | 54 | SCORE_EXTERN volatile Priority_Bit_map_control _Priority_Major_bit_map; 55 | SCORE_EXTERN Priority_Bit_map_control 56 | _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT; 57 | 58 | void _Priority_Handler_initialization( void ); 59 | 60 | #ifdef __RTEMS_APPLICATION__ 61 | #include 62 | #endif 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /gc/ogc/semaphore.h: -------------------------------------------------------------------------------- 1 | /* rtems/posix/semaphore.h 2 | * 3 | * This include file contains all the private support information for 4 | * POSIX Semaphores. 5 | * 6 | * COPYRIGHT (c) 1989-1999. 7 | * On-Line Applications Research Corporation (OAR). 8 | * 9 | * The license and distribution terms for this file may be 10 | * found in the file LICENSE in this distribution or at 11 | * http://www.OARcorp.com/rtems/license.html. 12 | * 13 | * $Id$ 14 | */ 15 | 16 | #ifndef __SEMAPHORE_H__ 17 | #define __SEMAPHORE_H__ 18 | 19 | /*! \file semaphore.h 20 | \brief Thread subsystem IV 21 | 22 | */ 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | #include 29 | 30 | #define SEM_FAILED 0xffffffff 31 | 32 | /*! \typedef unsigned32 sem_t 33 | \brief typedef for the semaphore handle 34 | */ 35 | typedef unsigned32 sem_t; 36 | 37 | /*! \fn int sem_init(sem_t *sem,unsigned32 start,unsigned32 max) 38 | \brief Initializes a semaphore. 39 | \param[out] sem pointer to a sem_t handle. 40 | \param[in] start start count of the semaphore 41 | \param[in] max maximum count of the semaphore 42 | 43 | \return 0 on success, <0 on error 44 | */ 45 | int sem_init( 46 | sem_t *sem, 47 | unsigned32 value, 48 | unsigned32 max 49 | ); 50 | 51 | 52 | /*! \fn int sem_destroy(sem_t sem) 53 | \brief Close and destroy a semaphore, release all threads and handles locked on this semaphore. 54 | \param[in] sem handle to the sem_t structure. 55 | 56 | \return 0 on success, <0 on error 57 | */ 58 | int sem_destroy( 59 | sem_t sem 60 | ); 61 | 62 | 63 | /*! \fn int sem_wait(sem_t sem) 64 | \brief Count down semaphore counter and enter lock if counter <=0 65 | \param[in] sem handle to the sem_t structure. 66 | 67 | \return 0 on success, <0 on error 68 | */ 69 | int sem_wait( 70 | sem_t sem 71 | ); 72 | 73 | 74 | /*! \fn int sem_post(sem_t sem) 75 | \brief Count up semaphore counter and release lock if counter >0 76 | \param[in] sem handle to the sem_t structure. 77 | 78 | \return 0 on success, <0 on error 79 | */ 80 | int sem_post( 81 | sem_t sem 82 | ); 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /gc/ogc/stack.h: -------------------------------------------------------------------------------- 1 | /* stack.h 2 | * 3 | * This include file contains all information about the thread 4 | * Stack Handler. This Handler provides mechanisms which can be used to 5 | * initialize and utilize stacks. 6 | * 7 | * COPYRIGHT (c) 1989-1999. 8 | * On-Line Applications Research Corporation (OAR). 9 | * 10 | * The license and distribution terms for this file may be 11 | * found in the file LICENSE in this distribution or at 12 | * http://www.OARcorp.com/rtems/license.html. 13 | * 14 | * $Id$ 15 | */ 16 | 17 | #ifndef __STACK_h 18 | #define __STACK_h 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #include 25 | #include 26 | 27 | /* 28 | * This number corresponds to the byte alignment requirement for the 29 | * stack. This alignment requirement may be stricter than that for the 30 | * data types alignment specified by CPU_ALIGNMENT. If the CPU_ALIGNMENT 31 | * is strict enough for the stack, then this should be set to 0. 32 | * 33 | * NOTE: This must be a power of 2 either 0 or greater than CPU_ALIGNMENT. 34 | */ 35 | 36 | #define CPU_STACK_ALIGNMENT (PPC_STACK_ALIGNMENT) 37 | 38 | /* 39 | * Should be large enough to run all RTEMS tests. This insures 40 | * that a "reasonable" small application should not have any problems. 41 | */ 42 | 43 | #define CPU_STACK_MINIMUM_SIZE (1024*8) 44 | 45 | /* 46 | * Needed for Interrupt stack 47 | */ 48 | 49 | //#define CPU_MINIMUM_STACK_FRAME_SIZE 8 // ??? - "libOGC" uses 16 50 | #define CPU_MINIMUM_STACK_FRAME_SIZE 16 // ??? - but it should be 8 51 | 52 | /* 53 | * This defines the number of levels and the mask used to pick those 54 | * bits out of a thread mode. 55 | */ 56 | 57 | #define CPU_MODES_INTERRUPT_MASK 0x00000001 /* interrupt level in mode */ 58 | 59 | /* 60 | * The following constant defines the minimum stack size which every 61 | * thread must exceed. 62 | */ 63 | 64 | #define STACK_MINIMUM_SIZE CPU_STACK_MINIMUM_SIZE 65 | 66 | /* 67 | * _Thread_Stack_Allocate 68 | * 69 | * DESCRIPTION: 70 | * 71 | * Allocate the requested stack space for the thread. 72 | * return the actual size allocated after any adjustment 73 | * or return zero if the allocation failed. 74 | * Set the Start.stack field to the address of the stack 75 | * 76 | * NOTES: NONE 77 | * 78 | */ 79 | 80 | unsigned32 _Thread_Stack_Allocate( 81 | Thread_Control *the_thread, 82 | unsigned32 stack_size 83 | ); 84 | 85 | /* 86 | * _Thread_Stack_Free 87 | * 88 | * DESCRIPTION: 89 | * 90 | * Deallocate the Thread's stack. 91 | * NOTES: NONE 92 | * 93 | */ 94 | 95 | void _Thread_Stack_Free( 96 | Thread_Control *the_thread 97 | ); 98 | 99 | #ifdef __RTEMS_APPLICATION__ 100 | #include 101 | #endif 102 | 103 | #ifdef __cplusplus 104 | } 105 | #endif 106 | 107 | #endif 108 | -------------------------------------------------------------------------------- /gc/ogc/states.h: -------------------------------------------------------------------------------- 1 | #ifndef __RTEMS_STATES_h 2 | #define __RTEMS_STATES_h 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | #define STATES_ALL_SET 0xfffff /* all states */ 11 | #define STATES_READY 0x00000 /* ready to run */ 12 | #define STATES_DORMANT 0x00001 /* created not started */ 13 | #define STATES_SUSPENDED 0x00002 /* waiting for resume */ 14 | #define STATES_TRANSIENT 0x00004 /* in transition */ 15 | #define STATES_DELAYING 0x00008 /* wait for timeout */ 16 | #define STATES_WAITING_FOR_TIME 0x00010 /* wait for TOD */ 17 | #define STATES_WAITING_FOR_BUFFER 0x00020 18 | #define STATES_WAITING_FOR_SEGMENT 0x00040 19 | #define STATES_WAITING_FOR_MESSAGE 0x00080 20 | #define STATES_WAITING_FOR_EVENT 0x00100 21 | #define STATES_WAITING_FOR_MUTEX 0x00200 22 | #define STATES_WAITING_FOR_SEMAPHORE 0x00400 23 | #define STATES_WAITING_FOR_CONDITION_VARIABLE 0x00800 24 | #define STATES_WAITING_FOR_JOIN_AT_EXIT 0x01000 25 | #define STATES_WAITING_FOR_RPC_REPLY 0x02000 26 | #define STATES_WAITING_FOR_PERIOD 0x04000 27 | #define STATES_WAITING_FOR_SIGNAL 0x08000 28 | #define STATES_INTERRUPTIBLE_BY_SIGNAL 0x10000 29 | 30 | #define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_BUFFER | \ 31 | STATES_WAITING_FOR_SEGMENT | \ 32 | STATES_WAITING_FOR_MESSAGE | \ 33 | STATES_WAITING_FOR_SEMAPHORE | \ 34 | STATES_WAITING_FOR_MUTEX | \ 35 | STATES_WAITING_FOR_CONDITION_VARIABLE | \ 36 | STATES_WAITING_FOR_JOIN_AT_EXIT | \ 37 | STATES_WAITING_FOR_SIGNAL ) 38 | 39 | #define STATES_WAITING_ON_THREAD_QUEUE \ 40 | ( STATES_LOCALLY_BLOCKED | \ 41 | STATES_WAITING_FOR_RPC_REPLY ) 42 | 43 | #define STATES_BLOCKED ( STATES_DELAYING | \ 44 | STATES_WAITING_FOR_TIME | \ 45 | STATES_WAITING_FOR_PERIOD | \ 46 | STATES_WAITING_FOR_EVENT | \ 47 | STATES_WAITING_ON_THREAD_QUEUE | \ 48 | STATES_INTERRUPTIBLE_BY_SIGNAL ) 49 | 50 | #ifdef __RTEMS_APPLICATION__ 51 | #include 52 | #endif 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /gc/ogc/stm.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------- 2 | 3 | stm.h - System and miscellaneous hardware control functions 4 | 5 | Copyright (C) 2008 6 | Michael Wiedenbauer (shagkur) 7 | Dave Murphy (WinterMute) 8 | Hector Martin (marcan) 9 | 10 | This software is provided 'as-is', without any express or implied 11 | warranty. In no event will the authors be held liable for any 12 | damages arising from the use of this software. 13 | 14 | Permission is granted to anyone to use this software for any 15 | purpose, including commercial applications, and to alter it and 16 | redistribute it freely, subject to the following restrictions: 17 | 18 | 1. The origin of this software must not be misrepresented; you 19 | must not claim that you wrote the original software. If you use 20 | this software in a product, an acknowledgment in the product 21 | documentation would be appreciated but is not required. 22 | 23 | 2. Altered source versions must be plainly marked as such, and 24 | must not be misrepresented as being the original software. 25 | 26 | 3. This notice may not be removed or altered from any source 27 | distribution. 28 | 29 | -------------------------------------------------------------*/ 30 | 31 | #ifndef __STM_H__ 32 | #define __STM_H__ 33 | 34 | #if defined(HW_RVL) 35 | 36 | #include 37 | #include 38 | 39 | #define STM_EVENT_RESET 0x00020000 40 | #define STM_EVENT_POWER 0x00000800 41 | 42 | #define STM_EINVAL -0x2004 43 | #define STM_ENOTINIT -0x2100 44 | #define STM_ENOHANDLER -0x2101 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif /* __cplusplus */ 49 | 50 | typedef void (*stmcallback)(u32 event); 51 | 52 | s32 __STM_Init(); 53 | s32 __STM_Close(); 54 | s32 STM_ShutdownToStandby(); 55 | s32 STM_ShutdownToIdle(); 56 | s32 STM_SetLedMode(u32 mode); 57 | s32 STM_RebootSystem(); 58 | stmcallback STM_RegisterEventHandler(stmcallback newhandler); 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif /* __cplusplus */ 63 | 64 | #endif /* defined(HW_RVL) */ 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /gc/ogc/sysstate.h: -------------------------------------------------------------------------------- 1 | /* sysstates.h 2 | * 3 | * This include file contains information regarding the system state. 4 | * 5 | * COPYRIGHT (c) 1989-1999. 6 | * On-Line Applications Research Corporation (OAR). 7 | * 8 | * The license and distribution terms for this file may be 9 | * found in the file LICENSE in this distribution or at 10 | * http://www.OARcorp.com/rtems/license.html. 11 | * 12 | * $Id$ 13 | */ 14 | 15 | #ifndef __RTEMS_SYSTEM_STATE_h 16 | #define __RTEMS_SYSTEM_STATE_h 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | #include 23 | 24 | #include "lwp_config.h" 25 | 26 | /* enumerated constants */ 27 | 28 | /* 29 | * The following type defines the possible system states. 30 | */ 31 | 32 | typedef enum { 33 | SYSTEM_STATE_BEFORE_INITIALIZATION, /* start -> end of 1st init part */ 34 | SYSTEM_STATE_BEFORE_MULTITASKING, /* end of 1st -> beginning of 2nd */ 35 | SYSTEM_STATE_BEGIN_MULTITASKING, /* just before multitasking starts */ 36 | SYSTEM_STATE_UP, /* normal operation */ 37 | SYSTEM_STATE_SHUTDOWN, /* shutdown */ 38 | SYSTEM_STATE_FAILED /* fatal error occurred */ 39 | } System_state_Codes; 40 | 41 | /* 42 | * The following variable contains the current system state. 43 | */ 44 | 45 | SCORE_EXTERN System_state_Codes _System_state_Current; 46 | 47 | #ifdef __RTEMS_APPLICATION__ 48 | #include 49 | #endif 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /gc/ogc/texconv.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------- 2 | 3 | texconv.h -- GX texture helper functions 4 | 5 | Copyright (C) 2004 6 | Michael Wiedenbauer (shagkur) 7 | Dave Murphy (WinterMute) 8 | 9 | This software is provided 'as-is', without any express or implied 10 | warranty. In no event will the authors be held liable for any 11 | damages arising from the use of this software. 12 | 13 | Permission is granted to anyone to use this software for any 14 | purpose, including commercial applications, and to alter it and 15 | redistribute it freely, subject to the following restrictions: 16 | 17 | 1. The origin of this software must not be misrepresented; you 18 | must not claim that you wrote the original software. If you use 19 | this software in a product, an acknowledgment in the product 20 | documentation would be appreciated but is not required. 21 | 22 | 2. Altered source versions must be plainly marked as such, and 23 | must not be misrepresented as being the original software. 24 | 25 | 3. This notice may not be removed or altered from any source 26 | distribution. 27 | 28 | -------------------------------------------------------------*/ 29 | 30 | 31 | #ifndef __TEXCONV_H__ 32 | #define __TEXTCONV_H__ 33 | 34 | /*! 35 | \file texconv.h 36 | \brief GX texture helper functions 37 | */ 38 | 39 | #include 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif /* __cplusplus */ 44 | 45 | void MakeTexture565(const void *src,void *dst,s32 width,s32 height); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif /* __cplusplus */ 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /gc/ogc/tpl.h: -------------------------------------------------------------------------------- 1 | #ifndef __TPL_H__ 2 | #define __TPL_H__ 3 | 4 | #include "gx.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif /* __cplusplus */ 9 | 10 | typedef void* FHANDLE; 11 | 12 | // tdf file 13 | typedef struct _tplfile { 14 | int type; 15 | int ntextures; 16 | void *texdesc; 17 | FHANDLE tpl_file; 18 | } TPLFile; 19 | 20 | s32 TPL_OpenTPLFromFile(TPLFile* tdf, const char* file_name); 21 | s32 TPL_OpenTPLFromMemory(TPLFile* tdf, void *memory,u32 len); 22 | s32 TPL_GetTexture(TPLFile *tdf,s32 id,GXTexObj *texObj); 23 | s32 TPL_GetTextureCI(TPLFile *tdf,s32 id,GXTexObj *texObj,GXTlutObj *tlutObj,u8 tluts); 24 | s32 TPL_GetTextureInfo(TPLFile *tdf,s32 id,u32 *fmt,u16 *width,u16 *height); 25 | void TPL_CloseTPLFile(TPLFile *tdf); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif /* __cplusplus */ 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /gc/ogc/tqdata.h: -------------------------------------------------------------------------------- 1 | /* tqdata.h 2 | * 3 | * This include file contains all the constants and structures 4 | * needed to declare a thread queue. 5 | * 6 | * COPYRIGHT (c) 1989-1999. 7 | * On-Line Applications Research Corporation (OAR). 8 | * 9 | * The license and distribution terms for this file may be 10 | * found in the file LICENSE in this distribution or at 11 | * http://www.OARcorp.com/rtems/license.html. 12 | * 13 | * $Id$ 14 | */ 15 | 16 | #ifndef __THREAD_QUEUE_DATA_h 17 | #define __THREAD_QUEUE_DATA_h 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | #include "chain.h" 24 | #include "priority.h" 25 | 26 | /* 27 | * The following constants are used to manage the priority queues. 28 | * 29 | * There are four chains used to maintain a priority -- each chain 30 | * manages a distinct set of task priorities. The number of chains 31 | * is determined by TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS. 32 | * The following set must be consistent. 33 | * 34 | * The set below configures 4 headers -- each contains 64 priorities. 35 | * Header x manages priority range (x*64) through ((x*64)+63). If 36 | * the priority is more than half way through the priority range it 37 | * is in, then the search is performed from the rear of the chain. 38 | * This halves the search time to find the insertion point. 39 | */ 40 | 41 | #define TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS 4 42 | #define TASK_QUEUE_DATA_PRIORITIES_PER_HEADER 64 43 | #define TASK_QUEUE_DATA_REVERSE_SEARCH_MASK 0x20 44 | 45 | /* 46 | * The following enumerated types indicate what happened while the thread 47 | * queue was in the synchronization window. 48 | */ 49 | 50 | typedef enum { 51 | THREAD_QUEUE_SYNCHRONIZED, 52 | THREAD_QUEUE_NOTHING_HAPPENED, 53 | THREAD_QUEUE_TIMEOUT, 54 | THREAD_QUEUE_SATISFIED 55 | } Thread_queue_States; 56 | 57 | /* 58 | * The following enumerated type details all of the disciplines 59 | * supported by the Thread Queue Handler. 60 | */ 61 | 62 | typedef enum { 63 | THREAD_QUEUE_DISCIPLINE_FIFO, /* FIFO queue discipline */ 64 | THREAD_QUEUE_DISCIPLINE_PRIORITY /* PRIORITY queue discipline */ 65 | } Thread_queue_Disciplines; 66 | 67 | typedef struct { 68 | union { 69 | Chain_Control Fifo; /* FIFO discipline list */ 70 | Chain_Control Priority[TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS]; 71 | /* priority discipline list */ 72 | } Queues; 73 | Thread_queue_States sync_state; /* alloc/dealloc critical section */ 74 | Thread_queue_Disciplines discipline; /* queue discipline */ 75 | States_Control state; /* state of threads on Thread_q */ 76 | unsigned32 timeout_status; 77 | } Thread_queue_Control; 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /gc/ogc/usbgecko.h: -------------------------------------------------------------------------------- 1 | #ifndef __USBGECKO_H___ 2 | #define __USBGECKO_H___ 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif /* __cplusplus */ 9 | 10 | void usb_flush(s32 chn); 11 | int usb_isgeckoalive(s32 chn); 12 | int usb_recvbuffer(s32 chn,void *buffer,int size); 13 | int usb_sendbuffer(s32 chn,const void *buffer,int size); 14 | int usb_recvbuffer_safe(s32 chn,void *buffer,int size); 15 | int usb_sendbuffer_safe(s32 chn,const void *buffer,int size); 16 | int usb_recvbuffer_ex(s32 chn,void *buffer,int size, int retries); 17 | int usb_sendbuffer_ex(s32 chn,const void *buffer,int size, int retries); 18 | int usb_recvbuffer_safe_ex(s32 chn,void *buffer,int size, int retries); 19 | int usb_sendbuffer_safe_ex(s32 chn,const void *buffer,int size, int retries); 20 | int usb_flashread(s32 chn, u32 offset, void *buffer, size_t length); 21 | int usb_flashwrite(s32 chn, u32 offset, const void *buffer, size_t length); 22 | int usb_flashverify(s32 chn); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif /* __cplusplus */ 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /gc/ogc/usbmouse.h: -------------------------------------------------------------------------------- 1 | #ifndef __USBMOUSE_H__ 2 | #define __USBMOUSE_H__ 3 | 4 | #if defined(HW_RVL) 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif /* __cplusplus */ 9 | 10 | typedef struct { 11 | u8 button; 12 | int rx; 13 | int ry; 14 | int rz; 15 | } mouse_event; 16 | 17 | s32 MOUSE_Init(void); 18 | s32 MOUSE_Deinit(void); 19 | 20 | s32 MOUSE_GetEvent(mouse_event *event); 21 | s32 MOUSE_FlushEvents(void); 22 | bool MOUSE_IsConnected(void); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif /* __cplusplus */ 27 | 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /gc/ogc/usbstorage.h: -------------------------------------------------------------------------------- 1 | #ifndef __USBSTORAGE_H__ 2 | #define __USBSTORAGE_H__ 3 | 4 | #if defined(HW_RVL) 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif /* __cplusplus */ 14 | 15 | #define USBSTORAGE_OK 0 16 | #define USBSTORAGE_ENOINTERFACE -10000 17 | #define USBSTORAGE_ESENSE -10001 18 | #define USBSTORAGE_ESHORTWRITE -10002 19 | #define USBSTORAGE_ESHORTREAD -10003 20 | #define USBSTORAGE_ESIGNATURE -10004 21 | #define USBSTORAGE_ETAG -10005 22 | #define USBSTORAGE_ESTATUS -10006 23 | #define USBSTORAGE_EDATARESIDUE -10007 24 | #define USBSTORAGE_ETIMEDOUT -10008 25 | #define USBSTORAGE_EINIT -10009 26 | #define USBSTORAGE_PROCESSING -10010 27 | 28 | typedef struct 29 | { 30 | u8 configuration; 31 | u32 interface; 32 | u32 altInterface; 33 | u8 bInterfaceSubClass; 34 | 35 | u8 ep_in; 36 | u8 ep_out; 37 | 38 | u8 max_lun; 39 | u32 *sector_size; 40 | 41 | s32 usb_fd; 42 | 43 | pthread_mutex_t lock; 44 | syswd_t alarm; 45 | s32 retval; 46 | 47 | u32 tag; 48 | u8 suspended; 49 | 50 | u8 *buffer; 51 | } usbstorage_handle; 52 | 53 | #define B_RAW_DEVICE_DATA_IN 0x01 54 | #define B_RAW_DEVICE_COMMAND 0 55 | 56 | typedef struct { 57 | uint8_t command[16]; 58 | uint8_t command_length; 59 | uint8_t flags; 60 | uint8_t scsi_status; 61 | void* data; 62 | size_t data_length; 63 | } raw_device_command; 64 | 65 | s32 USBStorage_Initialize(); 66 | 67 | s32 USBStorage_Open(usbstorage_handle *dev, s32 device_id, u16 vid, u16 pid); 68 | s32 USBStorage_Close(usbstorage_handle *dev); 69 | s32 USBStorage_Reset(usbstorage_handle *dev); 70 | 71 | s32 USBStorage_GetMaxLUN(usbstorage_handle *dev); 72 | s32 USBStorage_MountLUN(usbstorage_handle *dev, u8 lun); 73 | s32 USBStorage_Suspend(usbstorage_handle *dev); 74 | s32 USBStorage_IsDVD(); 75 | s32 USBStorage_ioctl(int request, ...); 76 | 77 | s32 USBStorage_ReadCapacity(usbstorage_handle *dev, u8 lun, u32 *sector_size, u32 *n_sectors); 78 | s32 USBStorage_Read(usbstorage_handle *dev, u8 lun, u32 sector, u16 n_sectors, u8 *buffer); 79 | s32 USBStorage_Write(usbstorage_handle *dev, u8 lun, u32 sector, u16 n_sectors, const u8 *buffer); 80 | s32 USBStorage_StartStop(usbstorage_handle *dev, u8 lun, u8 lo_ej, u8 start, u8 imm); 81 | 82 | #define DEVICE_TYPE_WII_USB (('W'<<24)|('U'<<16)|('S'<<8)|'B') 83 | 84 | extern DISC_INTERFACE __io_usbstorage; 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif /* __cplusplus */ 89 | 90 | #endif /* HW_RVL */ 91 | 92 | #endif /* __USBSTORAGE_H__ */ 93 | -------------------------------------------------------------------------------- /gc/ogc/wiilaunch.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------- 2 | 3 | wiilaunch.h -- Wii NAND title launching and argument passing 4 | 5 | Copyright (C) 2008 6 | Hector Martin (marcan) 7 | 8 | This software is provided 'as-is', without any express or implied 9 | warranty. In no event will the authors be held liable for any 10 | damages arising from the use of this software. 11 | 12 | Permission is granted to anyone to use this software for any 13 | purpose, including commercial applications, and to alter it and 14 | redistribute it freely, subject to the following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you 17 | must not claim that you wrote the original software. If you use 18 | this software in a product, an acknowledgment in the product 19 | documentation would be appreciated but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and 22 | must not be misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source 25 | distribution. 26 | 27 | -------------------------------------------------------------*/ 28 | 29 | #if defined(HW_RVL) 30 | 31 | #ifndef __WIILAUNCH_H__ 32 | #define __WIILAUNCH_H__ 33 | 34 | #include 35 | #include 36 | 37 | // not initialized 38 | #define WII_ENOTINIT -0x9001 39 | // internal error 40 | #define WII_EINTERNAL -0x9002 41 | // checksum error 42 | #define WII_ECHECKSUM -0x9003 43 | // required title not installed 44 | #define WII_EINSTALL -0x9004 45 | // argument list too big 46 | #define WII_E2BIG -0x9005 47 | 48 | // you probably shouldn't use anything not in this list, since those may change 49 | // these are guaranteed to exist because Nintendo hardcodes them 50 | // any category not on this list will cause a hang when the settings menu tries to do the animation 51 | // however, settings items contained in one of the following categories will work 52 | // nonexistent items will cause a 404 53 | #define SETTINGS_CALENDAR "Calendar/Calendar_index.html" 54 | #define SETTINGS_DISPLAY "Display/Display_index.html" 55 | #define SETTINGS_SOUND "Sound/Sound_index.html" 56 | #define SETTINGS_PARENTAL "Parental_Control/Parental_Control_index.html" 57 | #define SETTINGS_INTERNET "Internet/Internet_index.html" 58 | #define SETTINGS_WC24 "WiiConnect24/Wiiconnect24_index.html" 59 | #define SETTINGS_UPDATE "Update/Update_index.html" 60 | 61 | #ifdef __cplusplus 62 | extern "C" { 63 | #endif /* __cplusplus */ 64 | 65 | s32 WII_Initialize(void); 66 | s32 WII_ReturnToMenu(void); 67 | s32 WII_ReturnToSettings(void); 68 | s32 WII_ReturnToSettingsPage(const char *page); 69 | s32 WII_LaunchTitle(u64 titleID); 70 | s32 WII_LaunchTitleWithArgs(u64 titleID, int launchcode, ...); 71 | s32 WII_OpenURL(const char *url); 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif /* __cplusplus */ 76 | 77 | #endif 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /gc/ogc/wkspace.h: -------------------------------------------------------------------------------- 1 | /* wkspace.h 2 | * 3 | * This include file contains information related to the 4 | * RAM Workspace. This Handler provides mechanisms which can be used to 5 | * define, initialize and manipulate the workspace. 6 | * 7 | * COPYRIGHT (c) 1989-1999. 8 | * On-Line Applications Research Corporation (OAR). 9 | * 10 | * The license and distribution terms for this file may be 11 | * found in the file LICENSE in this distribution or at 12 | * http://www.OARcorp.com/rtems/license.html. 13 | * 14 | * $Id$ 15 | */ 16 | 17 | #ifndef __WORKSPACE_h 18 | #define __WORKSPACE_h 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #include 25 | #include 26 | 27 | /* 28 | * The following is used to manage the Workspace. 29 | * 30 | */ 31 | 32 | SCORE_EXTERN Heap_Control _Workspace_Area; /* executive heap header */ 33 | 34 | /* 35 | * _Workspace_Handler_initialization 36 | * 37 | * DESCRIPTION: 38 | * 39 | * This routine performs the initialization necessary for this handler. 40 | */ 41 | 42 | void _Workspace_Handler_initialization( 43 | unsigned32 size 44 | ); 45 | 46 | #ifdef __RTEMS_APPLICATION__ 47 | #include 48 | #endif 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /gc/ogcsys.h: -------------------------------------------------------------------------------- 1 | #ifndef __OGCSYS_H__ 2 | #define __OGCSYS_H__ 3 | 4 | #include 5 | #include 6 | 7 | #if defined(HW_RVL) 8 | #define TB_BUS_CLOCK 243000000u 9 | #define TB_CORE_CLOCK 729000000u 10 | #elif defined(HW_DOL) 11 | #define TB_BUS_CLOCK 162000000u 12 | #define TB_CORE_CLOCK 486000000u 13 | #endif 14 | #define TB_TIMER_CLOCK (TB_BUS_CLOCK/4000) //4th of the bus frequency 15 | 16 | #define TB_MSPERSEC 1000 17 | #define TB_USPERSEC 1000000 18 | #define TB_NSPERSEC 1000000000 19 | #define TB_NSPERMS 1000000 20 | #define TB_NSPERUS 1000 21 | #define TB_USPERTICK 10000 22 | 23 | #define TB_SECSPERMIN 60 24 | #define TB_MINSPERHR 60 25 | #define TB_MONSPERYR 12 26 | #define TB_DAYSPERYR 365 27 | #define TB_HRSPERDAY 24 28 | #define TB_SECSPERDAY (TB_SECSPERMIN*TB_MINSPERHR*TB_HRSPERDAY) 29 | #define TB_SECSPERNYR (365*TB_SECSPERDAY) 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | int nanosleep(struct timespec *tb); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /gc/sdcard/card_buf.h: -------------------------------------------------------------------------------- 1 | #ifndef __CARD_BUF_H__ 2 | #define __CARD_BUF_H__ 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void sdgecko_initBufferPool(); 11 | u8* sdgecko_allocBuffer(); 12 | void sdgecko_freeBuffer(u8 *buf); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /gc/sdcard/card_cmn.h: -------------------------------------------------------------------------------- 1 | #ifndef __CARD_CMN_H__ 2 | #define __CARD_CMN_H__ 3 | 4 | #include 5 | 6 | #define CARDIO_ERROR_READY 0 7 | #define CARDIO_ERROR_BUSY -1 8 | #define CARDIO_ERROR_WRONGDEVICE -2 9 | #define CARDIO_ERROR_NOCARD -3 10 | #define CARDIO_ERROR_IDLE -4 11 | #define CARDIO_ERROR_IOERROR -5 12 | #define CARDIO_ERROR_IOTIMEOUT -6 13 | 14 | #define CARDIO_ERROR_NOTPERMITTED -107 15 | #define CARDIO_ERROR_ROOTENTRY -108 16 | #define CARDIO_ERROR_OUTOFROOTENTRY -109 17 | #define CARDIO_ERROR_FILEEXIST -110 18 | #define CARDIO_ERROR_NOEMPTYCLUSTER -111 19 | #define CARDIO_ERROR_EOF -112 20 | #define CARDIO_ERROR_SYSTEMPARAM -113 21 | #define CARDIO_ERROR_FILEOPENED -114 22 | #define CARDIO_ERROR_FILENOTOPENED -115 23 | #define CARDIO_ERROR_FILENAMETOOLONG -116 24 | #define CARDIO_ERROR_INVALIDNAME -117 25 | #define CARDIO_ERROR_NOLONGNAME -118 26 | #define CARDIO_ERROR_INCORRECTFAT -119 27 | #define CARDIO_ERROR_NOTFOUND -120 28 | #define CARDIO_ERROR_OUTOFMEMORY -121 29 | #define CARDIO_ERROR_INVALIDFAT -122 30 | #define CARDIO_ERROR_INVALIDMBR -123 31 | #define CARDIO_ERROR_INVALIDPBR -124 32 | #define CARDIO_ERROR_NOEMPTYBLOCK -125 33 | #define CARDIO_ERROR_INTERNAL -126 34 | #define CARDIO_ERROR_INVALIDPARAM -127 35 | #define CARDIO_ERROR_FATALERROR -128 36 | 37 | #define MAX_DRIVE 2 38 | #define SECTOR_SIZE 512 39 | 40 | #define NOT_INITIALIZED 0 41 | #define INITIALIZING 1 42 | #define INITIALIZED 2 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif /* __cplusplus */ 47 | 48 | typedef struct _dev_info { 49 | u32 CpV; 50 | u32 HpC; 51 | u32 SpH; 52 | u32 allS; 53 | u32 szS; 54 | u32 PBpV; 55 | u32 LBpV; 56 | u32 SpB; 57 | u32 PpB; 58 | u32 szP; 59 | } DEV_INFO; 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif /* __cplusplus */ 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /gc/sdcard/card_io.h: -------------------------------------------------------------------------------- 1 | #ifndef __CARD_IO_H__ 2 | #define __CARD_IO_H__ 3 | 4 | #include 5 | 6 | #define MAX_MI_NUM 1 7 | #define MAX_DI_NUM 5 8 | 9 | #define PAGE_SIZE256 256 10 | #define PAGE_SIZE512 512 11 | 12 | /* CID Register */ 13 | #define MANUFACTURER_ID(drv_no) ((u8)(g_CID[drv_no][0])) 14 | 15 | /* CSD Register */ 16 | #define READ_BL_LEN(drv_no) ((u8)(g_CSD[drv_no][5]&0x0f)) 17 | #define WRITE_BL_LEN(drv_no) ((u8)((g_CSD[drv_no][12]&0x03)<<2)|((g_CSD[drv_no][13]>>6)&0x03)) 18 | #define C_SIZE(drv_no) ((u16)(((g_CSD[drv_no][6]&0x03)<<10)|(g_CSD[drv_no][7]<<2)|((g_CSD[drv_no][8]>>6)&0x03))) 19 | #define C_SIZE_MULT(drv_no) ((u8)((g_CSD[drv_no][9]&0x03)<<1)|((g_CSD[drv_no][10]>>7)&0x01)) 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif /* __cplusplus */ 24 | 25 | extern u8 g_CSD[MAX_DRIVE][16]; 26 | extern u8 g_CID[MAX_DRIVE][16]; 27 | extern u8 g_mCode[MAX_MI_NUM]; 28 | extern u16 g_dCode[MAX_MI_NUM][MAX_DI_NUM]; 29 | 30 | 31 | void sdgecko_initIODefault(); 32 | s32 sdgecko_initIO(s32 drv_no); 33 | s32 sdgecko_preIO(s32 drv_no); 34 | s32 sdgecko_readCID(s32 drv_no); 35 | s32 sdgecko_readCSD(s32 drv_no); 36 | s32 sdgecko_readStatus(s32 drv_no); 37 | s32 sdgecko_readSectors(s32 drv_no,u32 sector_no,u32 num_sectors,void *buf); 38 | s32 sdgecko_writeSector(s32 drv_no,u32 sector_no,const void *buf,u32 len); 39 | s32 sdgecko_writeSectors(s32 drv_no,u32 sector_no,u32 num_sectors,const void *buf); 40 | 41 | s32 sdgecko_doUnmount(s32 drv_no); 42 | 43 | void sdgecko_insertedCB(s32 drv_no); 44 | void sdgecko_ejectedCB(s32 drv_no); 45 | 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif /* __cplusplus */ 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /gc/sdcard/gcsd.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | gcsd.h 4 | 5 | Hardware routines for reading and writing to SD geckos connected 6 | to the memory card ports. 7 | 8 | These functions are just wrappers around libsdcard's functions. 9 | 10 | Copyright (c) 2008 Sven "svpe" Peter 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | 1. Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright notice, 18 | this list of conditions and the following disclaimer in the documentation and/or 19 | other materials provided with the distribution. 20 | 3. The name of the author may not be used to endorse or promote products derived 21 | from this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 24 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 25 | AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE 26 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 31 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __GCSD_H__ 35 | #define __GCSD_H__ 36 | 37 | #include 38 | #include 39 | 40 | #define DEVICE_TYPE_GC_SD (('G'<<24)|('C'<<16)|('S'<<8)|'D') 41 | 42 | extern const DISC_INTERFACE __io_gcsda; 43 | extern const DISC_INTERFACE __io_gcsdb; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /gc/sdcard/wiisd_io.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | wii_sd.h 4 | 5 | Hardware interface for libfat Wii internal SD 6 | 7 | Copyright (c) 2008 8 | Michael Wiedenbauer (shagkur) 9 | Dave Murphy (WinterMute) 10 | 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | 1. Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright notice, 18 | this list of conditions and the following disclaimer in the documentation and/or 19 | other materials provided with the distribution. 20 | 3. The name of the author may not be used to endorse or promote products derived 21 | from this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 24 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 25 | AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE 26 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 31 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __WIISD_IO_H__ 35 | #define __WIISD_IO_H__ 36 | 37 | #include 38 | #include 39 | 40 | #define DEVICE_TYPE_WII_SD (('W'<<24)|('I'<<16)|('S'<<8)|'D') 41 | 42 | extern const DISC_INTERFACE __io_wiisd; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /gc/wiikeyboard/keyboard.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------- 2 | 3 | keyboard.h -- keyboard event system 4 | 5 | Copyright (C) 2008, 2009 6 | DAVY Guillaume davyg2@gmail.com 7 | Brian Johnson brijohn@gmail.com 8 | dhewg 9 | 10 | This software is provided 'as-is', without any express or implied 11 | warranty. In no event will the authors be held liable for any 12 | damages arising from the use of this software. 13 | 14 | Permission is granted to anyone to use this software for any 15 | purpose, including commercial applications, and to alter it and 16 | redistribute it freely, subject to the following restrictions: 17 | 18 | 1. The origin of this software must not be misrepresented; you 19 | must not claim that you wrote the original software. If you use 20 | this software in a product, an acknowledgment in the product 21 | documentation would be appreciated but is not required. 22 | 23 | 2. Altered source versions must be plainly marked as such, and 24 | must not be misrepresented as being the original software. 25 | 26 | 3. This notice may not be removed or altered from any source 27 | distribution. 28 | 29 | -------------------------------------------------------------*/ 30 | 31 | #ifndef __KEYBOARD_H__ 32 | #define __KEYBOARD_H__ 33 | 34 | #include "wsksymdef.h" 35 | 36 | #define MOD_SHIFT_L (1 << 0) 37 | #define MOD_SHIFT_R (1 << 1) 38 | #define MOD_SHIFTLOCK (1 << 2) 39 | #define MOD_CAPSLOCK (1 << 3) 40 | #define MOD_CONTROL_L (1 << 4) 41 | #define MOD_CONTROL_R (1 << 5) 42 | #define MOD_META_L (1 << 6) 43 | #define MOD_META_R (1 << 7) 44 | #define MOD_MODESHIFT (1 << 8) 45 | #define MOD_NUMLOCK (1 << 9) 46 | #define MOD_COMPOSE (1 << 10) 47 | #define MOD_HOLDSCREEN (1 << 11) 48 | #define MOD_COMMAND (1 << 12) 49 | #define MOD_COMMAND1 (1 << 13) 50 | #define MOD_COMMAND2 (1 << 14) 51 | #define MOD_MODELOCK (1 << 15) 52 | 53 | #define MOD_ANYSHIFT (MOD_SHIFT_L | MOD_SHIFT_R | MOD_SHIFTLOCK) 54 | #define MOD_ANYCONTROL (MOD_CONTROL_L | MOD_CONTROL_R) 55 | #define MOD_ANYMETA (MOD_META_L | MOD_META_R) 56 | 57 | #define MOD_ONESET(val, mask) (((val) & (mask)) != 0) 58 | #define MOD_ALLSET(val, mask) (((val) & (mask)) == (mask)) 59 | 60 | #ifdef __cplusplus 61 | extern "C" { 62 | #endif /* __cplusplus */ 63 | 64 | typedef enum { 65 | KEYBOARD_CONNECTED, 66 | KEYBOARD_DISCONNECTED, 67 | KEYBOARD_PRESSED, 68 | KEYBOARD_RELEASED 69 | } keyboard_event_type; 70 | 71 | typedef struct { 72 | keyboard_event_type type; 73 | u16 modifiers; 74 | u8 keycode; 75 | u16 symbol; 76 | } keyboard_event; 77 | 78 | typedef void (*keyPressCallback)(char symbol); 79 | 80 | s32 KEYBOARD_Init(keyPressCallback keypress_cb); 81 | s32 KEYBOARD_Deinit(void); 82 | 83 | s32 KEYBOARD_GetEvent(keyboard_event *event); 84 | s32 KEYBOARD_FlushEvents(void); 85 | 86 | 87 | #ifdef __cplusplus 88 | } 89 | #endif /* __cplusplus */ 90 | 91 | #endif /* __KEYBOARD_H__ */ 92 | 93 | -------------------------------------------------------------------------------- /gc/wiikeyboard/usbkeyboard.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------- 2 | 3 | usbkeyboard.h -- Usb keyboard support(boot protocol) 4 | 5 | Copyright (C) 2008, 2009 6 | DAVY Guillaume davyg2@gmail.com 7 | dhewg 8 | 9 | This software is provided 'as-is', without any express or implied 10 | warranty. In no event will the authors be held liable for any 11 | damages arising from the use of this software. 12 | 13 | Permission is granted to anyone to use this software for any 14 | purpose, including commercial applications, and to alter it and 15 | redistribute it freely, subject to the following restrictions: 16 | 17 | 1. The origin of this software must not be misrepresented; you 18 | must not claim that you wrote the original software. If you use 19 | this software in a product, an acknowledgment in the product 20 | documentation would be appreciated but is not required. 21 | 22 | 2. Altered source versions must be plainly marked as such, and 23 | must not be misrepresented as being the original software. 24 | 25 | 3. This notice may not be removed or altered from any source 26 | distribution. 27 | 28 | -------------------------------------------------------------*/ 29 | 30 | #ifndef __USBKEYBOARD_H__ 31 | #define __USBKEYBOARD_H__ 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif /* __cplusplus */ 36 | 37 | typedef enum 38 | { 39 | USBKEYBOARD_PRESSED = 0, 40 | USBKEYBOARD_RELEASED, 41 | USBKEYBOARD_DISCONNECTED 42 | } USBKeyboard_eventType; 43 | 44 | typedef enum 45 | { 46 | USBKEYBOARD_LEDNUM = 0, 47 | USBKEYBOARD_LEDCAPS, 48 | USBKEYBOARD_LEDSCROLL 49 | } USBKeyboard_led; 50 | 51 | typedef struct 52 | { 53 | USBKeyboard_eventType type; 54 | u8 keyCode; 55 | } USBKeyboard_event; 56 | 57 | typedef void (*eventcallback) (USBKeyboard_event event); 58 | 59 | s32 USBKeyboard_Initialize(void); 60 | s32 USBKeyboard_Deinitialize(void); 61 | 62 | s32 USBKeyboard_Open(const eventcallback cb); 63 | void USBKeyboard_Close(void); 64 | 65 | bool USBKeyboard_IsConnected(void); 66 | s32 USBKeyboard_Scan(void); 67 | 68 | s32 USBKeyboard_SetLed(const USBKeyboard_led led, bool on); 69 | s32 USBKeyboard_ToggleLed(const USBKeyboard_led led); 70 | 71 | #ifdef __cplusplus 72 | } 73 | #endif /* __cplusplus */ 74 | 75 | #endif /* __USBKEYBOARD_H__ */ 76 | 77 | -------------------------------------------------------------------------------- /gcsdk.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "gcsdk"=.\gcsdk.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /libdb/debug_if.h: -------------------------------------------------------------------------------- 1 | #ifndef __DEBUG_IF_H__ 2 | #define __DEBUG_IF_H__ 3 | 4 | #include 5 | 6 | #define GDBSTUB_DEVICE_USB 0 7 | #define GDBSTUB_DEVICE_TCP 1 8 | 9 | struct dbginterface 10 | { 11 | s32 fhndl; 12 | 13 | int (*open)(struct dbginterface *device); 14 | int (*close)(struct dbginterface *device); 15 | int (*wait)(struct dbginterface *device); 16 | int (*read)(struct dbginterface *device,void *buffer,int size); 17 | int (*write)(struct dbginterface *devicec,const void *buffer,int size); 18 | }; 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /libdb/debug_supp.h: -------------------------------------------------------------------------------- 1 | #ifndef __DEBUG_SUPP_H__ 2 | #define __DEBUG_SUPP_H__ 3 | 4 | #include 5 | 6 | #define QM_MAXTHREADS (20) 7 | 8 | struct gdbstub_threadinfo { 9 | char display[256]; 10 | char more_display[256]; 11 | char name[256]; 12 | }; 13 | 14 | s32 gdbstub_getcurrentthread(); 15 | s32 hstr2nibble(const char *buf,s32 *nibble); 16 | char* int2vhstr(char *buf,s32 val); 17 | char* mem2hstr(char *buf,const char *mem,s32 count); 18 | char* thread2vhstr(char *buf,s32 thread); 19 | const char* vhstr2thread(const char *buf,s32 *thread); 20 | Thread_Control* gdbstub_indextoid(s32 thread); 21 | s32 gdbstub_getoffsets(char **textaddr,char **dataaddr,char **bssaddr); 22 | s32 parsezbreak(const char *in,int *type,char **addr,int *len); 23 | s32 gdbstub_getthreadinfo(s32 thread,struct gdbstub_threadinfo *info); 24 | s32 parseqp(const char *in,s32 *mask,s32 *thread); 25 | void packqq(char *out,s32 mask,s32 thread,struct gdbstub_threadinfo *info); 26 | char* reserve_qmheader(char *out); 27 | s32 parseql(const char *in,s32 *first,s32 *max_cnt,s32 *athread); 28 | s32 gdbstub_getnextthread(s32 athread); 29 | char* packqmthread(char *out,s32 thread); 30 | void packqmheader(char *out,s32 count,s32 done,s32 athread); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /libdb/geckousb.h: -------------------------------------------------------------------------------- 1 | #ifndef __GECKOUSB_H___ 2 | #define __GECKOUSB_H___ 3 | 4 | #include "debug_if.h" 5 | 6 | struct dbginterface* usb_init(s32 channel); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /libdb/tcpip.h: -------------------------------------------------------------------------------- 1 | #ifndef __TCPIP_H__ 2 | #define __TCPIP_H__ 3 | 4 | #include "uIP/uip.h" 5 | #include 6 | #include 7 | 8 | #define AF_UNSPEC 0 9 | #define AF_INET 2 10 | #define PF_INET AF_INET 11 | #define PF_UNSPEC AF_UNSPEC 12 | 13 | #define INADDR_ANY 0 14 | #define INADDR_BROADCAST 0xffffffff 15 | 16 | #ifndef socklen_t 17 | #define socklen_t u32_t 18 | #endif 19 | 20 | #ifndef HAVE_IN_ADDR 21 | #define HAVE_IN_ADDR 22 | struct in_addr { 23 | u32 s_addr; 24 | }; 25 | #endif 26 | 27 | struct sockaddr_in { 28 | u8 sin_len; 29 | u8 sin_family; 30 | u16 sin_port; 31 | struct in_addr sin_addr; 32 | s8 sin_zero[8]; 33 | }; 34 | 35 | struct sockaddr { 36 | u8 sa_len; 37 | u8 sa_family; 38 | s8 sa_data[14]; 39 | }; 40 | 41 | struct dbginterface* tcpip_init(struct uip_ip_addr *localip,struct uip_ip_addr *netmask,struct uip_ip_addr *gateway,u16 port); 42 | 43 | void tcpip_close(s32_t s); 44 | void tcpip_starttimer(s32_t s); 45 | void tcpip_stoptimer(s32_t s); 46 | s32_t tcpip_socket(); 47 | s32_t tcpip_listen(s32_t s,u32_t backlog); 48 | s32_t tcpip_bind(s32_t s,struct sockaddr *name,socklen_t *namelen); 49 | s32_t tcpip_accept(s32_t s); 50 | s32_t tcpip_read(s32_t s,void *buffer,u32_t len); 51 | s32_t tcpip_write(s32_t s,const void *buffer,u32_t len); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /libdb/uIP/bba.h: -------------------------------------------------------------------------------- 1 | #ifndef __BBA_DBG_H__ 2 | #define __BBA_DBG_H__ 3 | 4 | #include "uip.h" 5 | 6 | struct uip_netif; 7 | 8 | typedef void* uipdev_s; 9 | 10 | uipdev_s uip_bba_create(struct uip_netif *dev); 11 | s8_t uip_bba_init(struct uip_netif *dev); 12 | void uip_bba_poll(struct uip_netif *dev); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /libdb/uIP/memb.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "uip.h" 5 | #include "memb.h" 6 | 7 | void memb_init(struct memb_blks *blk) 8 | { 9 | UIP_MEMSET(blk->mem,0,(MEM_ALIGN_SIZE(blk->size)+sizeof(u32))*blk->num); 10 | } 11 | 12 | void* memb_alloc(struct memb_blks *blk) 13 | { 14 | s32 i; 15 | u32 *ptr; 16 | 17 | ptr = (u32*)blk->mem; 18 | for(i=0;inum;i++) { 19 | if(*ptr==0) { 20 | ++(*ptr); 21 | return (void*)(ptr+1); 22 | } 23 | ptr = (u32*)(u8*)ptr+(MEM_ALIGN_SIZE(blk->size)+sizeof(u32)); 24 | } 25 | return NULL; 26 | } 27 | 28 | u8 memb_free(struct memb_blks *blk,void *ptr) 29 | { 30 | s32 i; 31 | u32 *ptr2,*ptr1; 32 | 33 | ptr1 = ptr; 34 | ptr2 = (u32*)blk->mem; 35 | for(i=0;inum;i++) { 36 | if(ptr2==(ptr1 - 1)) { 37 | return --(*ptr2); 38 | } 39 | ptr2 = (u32*)(u8*)ptr2+(MEM_ALIGN_SIZE(blk->size)+sizeof(u32)); 40 | } 41 | return -1; 42 | } 43 | 44 | u8 memb_ref(struct memb_blks *blk,void *ptr) 45 | { 46 | u32 *pref = ptr-sizeof(u32); 47 | return ++(*pref); 48 | } 49 | -------------------------------------------------------------------------------- /libdb/uIP/memb.h: -------------------------------------------------------------------------------- 1 | #ifndef __MEMB_H__ 2 | #define __MEMB_H__ 3 | 4 | #include 5 | 6 | #define MEMB(name,size,num) \ 7 | static u8 memb_mem_##name[(MEM_ALIGN_SIZE(size)+sizeof(u32))*num]; \ 8 | static struct memb_blks name = {size,num,memb_mem_##name} 9 | 10 | struct memb_blks { 11 | u16 size; 12 | u16 num; 13 | u8 *mem; 14 | }; 15 | 16 | void memb_init(struct memb_blks *blk); 17 | void* memb_alloc(struct memb_blks *blk); 18 | u8 memb_free(struct memb_blks *blk,void *ptr); 19 | u8 memb_ref(struct memb_blks *blk,void *ptr); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /libdb/uIP/memr.h: -------------------------------------------------------------------------------- 1 | #ifndef __MEMR_H__ 2 | #define __MEMR_H__ 3 | 4 | #include 5 | 6 | void memr_init(); 7 | void* memr_malloc(u32 size); 8 | void memr_free(void *ptr); 9 | void* memr_realloc(void *ptr,u32 newsize); 10 | void* memr_reallocm(void *ptr,u32 newsize); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /libdb/uIP/uip_icmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "uip_ip.h" 5 | #include "uip_pbuf.h" 6 | #include "uip_netif.h" 7 | #include "uip_icmp.h" 8 | 9 | #if UIP_LOGGING == 1 10 | #include 11 | #define UIP_LOG(m) uip_log(__FILE__,__LINE__,m) 12 | #else 13 | #define UIP_LOG(m) 14 | #endif /* UIP_LOGGING == 1 */ 15 | 16 | #if UIP_STATISTICS == 1 17 | struct uip_stats uip_stat; 18 | #define UIP_STAT(s) s 19 | #else 20 | #define UIP_STAT(s) 21 | #endif /* UIP_STATISTICS == 1 */ 22 | 23 | void uip_icmpinput(struct uip_pbuf *p,struct uip_netif *inp) 24 | { 25 | u8_t type; 26 | u16_t hlen; 27 | struct uip_ip_addr tmpaddr; 28 | struct uip_ip_hdr *iphdr; 29 | struct uip_icmp_echo_hdr *iecho; 30 | 31 | iphdr = p->payload; 32 | hlen = UIP_IPH_HL(iphdr)*4; 33 | if(uip_pbuf_header(p,-((s16_t)hlen)) || p->tot_lenpayload); 40 | //code = *((u8_t*)p->payload+1); 41 | switch(type) { 42 | case UIP_ICMP_ECHO: 43 | if(ip_addr_isbroadcast(&iphdr->dst,inp) || ip_addr_ismulticast(&iphdr->dst)) { 44 | UIP_LOG("uip_icmpinput: Not echoing to broadcast pings.\n"); 45 | uip_pbuf_free(p); 46 | return; 47 | } 48 | 49 | if(p->tot_lenpayload; 56 | if(uip_ipchksum_pbuf(p)!=0) { 57 | UIP_LOG("uip_icmpinput: checksum failed for received ICMP echo.\n"); 58 | uip_pbuf_free(p); 59 | return; 60 | } 61 | 62 | tmpaddr.addr = iphdr->src.addr; 63 | iphdr->src.addr = iphdr->dst.addr; 64 | iphdr->dst.addr = tmpaddr.addr; 65 | UIP_ICMPH_TYPE_SET(iecho,UIP_ICMP_ER); 66 | 67 | if(iecho->chksum>=htons(0xffff-(UIP_ICMP_ECHO<<8))) iecho->chksum += htons(UIP_ICMP_ECHO<<8)+1; 68 | else iecho->chksum += htons(UIP_ICMP_ECHO<<8); 69 | 70 | uip_pbuf_header(p,hlen); 71 | uip_ipoutput_if(p,&iphdr->src,NULL,UIP_IPH_TTL(iphdr),0,UIP_PROTO_ICMP,inp); 72 | break; 73 | default: 74 | UIP_LOG("uip_icmpinput: ICMP type/code not supported.\n"); 75 | break; 76 | } 77 | uip_pbuf_free(p); 78 | } 79 | 80 | void uip_icmp_destunreach(struct uip_pbuf *p,enum uip_icmp_dur_type t) 81 | { 82 | struct uip_pbuf *q; 83 | struct uip_ip_hdr *iphdr; 84 | struct uip_icmp_dur_hdr *idur; 85 | 86 | q = uip_pbuf_alloc(UIP_PBUF_IP,sizeof(struct uip_icmp_dur_hdr)+UIP_IP_HLEN+8,UIP_PBUF_RAM); 87 | 88 | iphdr = p->payload; 89 | idur = q->payload; 90 | 91 | UIP_ICMPH_TYPE_SET(idur,UIP_ICMP_DUR); 92 | UIP_ICMPH_CODE_SET(idur,t); 93 | 94 | UIP_MEMCPY((u8_t*)q->payload+sizeof(struct uip_icmp_dur_hdr),p->payload,UIP_IP_HLEN+8); 95 | 96 | idur->chksum = 0; 97 | idur->chksum = uip_ipchksum(idur,q->len); 98 | 99 | uip_ipoutput(q,NULL,&iphdr->src,UIP_ICMP_TTL,0,UIP_PROTO_ICMP); 100 | uip_pbuf_free(q); 101 | } 102 | -------------------------------------------------------------------------------- /libdb/uIP/uip_icmp.h: -------------------------------------------------------------------------------- 1 | #ifndef __UIP_ICMP_H__ 2 | #define __UIP_ICMP_H__ 3 | 4 | #include "uip.h" 5 | #include "uip_arch.h" 6 | 7 | #define UIP_ICMP_TTL 255 8 | 9 | #define UIP_ICMP_ER 0 /* echo reply */ 10 | #define UIP_ICMP_DUR 3 /* destination unreachable */ 11 | #define UIP_ICMP_SQ 4 /* source quench */ 12 | #define UIP_ICMP_RD 5 /* redirect */ 13 | #define UIP_ICMP_ECHO 8 /* echo */ 14 | #define UIP_ICMP_TE 11 /* time exceeded */ 15 | #define UIP_ICMP_PP 12 /* parameter problem */ 16 | #define UIP_ICMP_TS 13 /* timestamp */ 17 | #define UIP_ICMP_TSR 14 /* timestamp reply */ 18 | #define UIP_ICMP_IRQ 15 /* information request */ 19 | #define UIP_ICMP_IR 16 /* information reply */ 20 | 21 | #define UIP_ICMPH_TYPE(hdr) (ntohs((hdr)->_type_code) >> 8) 22 | #define UIP_ICMPH_CODE(hdr) (ntohs((hdr)->_type_code) & 0xff) 23 | 24 | #define UIP_ICMPH_TYPE_SET(hdr, type) ((hdr)->_type_code = htons(UIP_ICMPH_CODE(hdr) | ((type) << 8))) 25 | #define UIP_ICMPH_CODE_SET(hdr, code) ((hdr)->_type_code = htons((code) | (UIP_ICMPH_TYPE(hdr) << 8))) 26 | 27 | enum uip_icmp_dur_type { 28 | UIP_ICMP_DUR_NET = 0, /* net unreachable */ 29 | UIP_ICMP_DUR_HOST = 1, /* host unreachable */ 30 | UIP_ICMP_DUR_PROTO = 2, /* protocol unreachable */ 31 | UIP_ICMP_DUR_PORT = 3, /* port unreachable */ 32 | UIP_ICMP_DUR_FRAG = 4, /* fragmentation needed and DF set */ 33 | UIP_ICMP_DUR_SR = 5 /* source route failed */ 34 | }; 35 | 36 | PACK_STRUCT_BEGIN 37 | struct uip_icmp_echo_hdr { 38 | PACK_STRUCT_FIELD(u16_t _type_code); 39 | PACK_STRUCT_FIELD(u16_t chksum); 40 | PACK_STRUCT_FIELD(u16_t id); 41 | PACK_STRUCT_FIELD(u16_t seqno); 42 | } PACK_STRUCT_STRUCT; 43 | PACK_STRUCT_END 44 | 45 | PACK_STRUCT_BEGIN 46 | struct uip_icmp_dur_hdr { 47 | PACK_STRUCT_FIELD(u16_t _type_code); 48 | PACK_STRUCT_FIELD(u16_t chksum); 49 | PACK_STRUCT_FIELD(u32_t unused); 50 | } PACK_STRUCT_STRUCT; 51 | PACK_STRUCT_END 52 | 53 | struct uip_pbuf; 54 | struct uip_netif; 55 | 56 | 57 | void uip_icmpinput(struct uip_pbuf *p,struct uip_netif *inp); 58 | void uip_icmp_destunreach(struct uip_pbuf *p,enum uip_icmp_dur_type t); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /libdb/uIP/uip_netif.h: -------------------------------------------------------------------------------- 1 | #ifndef __UIP_NETIF_H__ 2 | #define __UIP_NETIF_H__ 3 | 4 | #include "uip.h" 5 | 6 | #define UIP_NETIF_MAX_HWADDR_LEN 6U 7 | 8 | /** TODO: define the use (where, when, whom) of netif flags */ 9 | 10 | /** whether the network interface is 'up'. this is 11 | * a software flag used to control whether this network 12 | * interface is enabled and processes traffic. 13 | */ 14 | #define UIP_NETIF_FLAG_UP 0x1U 15 | /** if set, the netif has broadcast capability */ 16 | #define UIP_NETIF_FLAG_BROADCAST 0x2U 17 | /** if set, the netif is one end of a point-to-point connection */ 18 | #define UIP_NETIF_FLAG_POINTTOPOINT 0x4U 19 | /** if set, the interface is configured using DHCP */ 20 | #define UIP_NETIF_FLAG_DHCP 0x08U 21 | /** if set, the interface has an active link 22 | * (set by the network interface driver) */ 23 | #define UIP_NETIF_FLAG_LINK_UP 0x10U 24 | 25 | struct uip_netif; 26 | struct uip_pbuf; 27 | struct uip_ip_addr; 28 | 29 | struct uip_netif { 30 | struct uip_netif *next; 31 | 32 | struct uip_ip_addr ip_addr; 33 | struct uip_ip_addr netmask; 34 | struct uip_ip_addr gw; 35 | 36 | s8_t (*input)(struct uip_pbuf *p,struct uip_netif *inp); 37 | s8_t (*output)(struct uip_netif *netif,struct uip_pbuf *p,struct uip_ip_addr *ipaddr); 38 | s8_t (*linkoutput)(struct uip_netif *netif,struct uip_pbuf *p); 39 | 40 | void *state; 41 | 42 | u8_t hwaddr_len; 43 | u8_t hwaddr[UIP_NETIF_MAX_HWADDR_LEN]; 44 | 45 | u16_t mtu; 46 | u8_t flags; 47 | 48 | s8_t name[2]; 49 | u8_t num; 50 | }; 51 | 52 | extern struct uip_netif *uip_netif_list; 53 | extern struct uip_netif *uip_netif_default; 54 | 55 | void uip_netif_init(); 56 | void uip_netif_setup(struct uip_netif *netif); 57 | void uip_netif_setaddr(struct uip_netif *netif,struct uip_ip_addr *ipaddr,struct uip_ip_addr *netmask,struct uip_ip_addr *gw); 58 | void uip_netif_setipaddr(struct uip_netif *netif,struct uip_ip_addr *ipaddr); 59 | void uip_netif_setnetmask(struct uip_netif *netif,struct uip_ip_addr *netmask); 60 | void uip_netif_setgw(struct uip_netif *netif,struct uip_ip_addr *gw); 61 | void uip_netif_setdefault(struct uip_netif *netif); 62 | u8_t uip_netif_isup(struct uip_netif *netif); 63 | struct uip_netif* uip_netif_add(struct uip_netif *netif,struct uip_ip_addr *ipaddr,struct uip_ip_addr *netmask,struct uip_ip_addr *gw,void *state,s8_t (*init)(struct uip_netif *netif),s8_t (*input)(struct uip_pbuf *p,struct uip_netif *netif)); 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /libdb/uIP/uip_pbuf.h: -------------------------------------------------------------------------------- 1 | #ifndef __UIP_PBUF_H__ 2 | #define __UIP_PBUF_H__ 3 | 4 | #include "uip.h" 5 | 6 | /* Definitions for the pbuf flag field. These are NOT the flags that 7 | * are passed to pbuf_alloc(). */ 8 | #define UIP_PBUF_FLAG_RAM 0x00U /* Flags that pbuf data is stored in RAM */ 9 | #define UIP_PBUF_FLAG_ROM 0x01U /* Flags that pbuf data is stored in ROM */ 10 | #define UIP_PBUF_FLAG_POOL 0x02U /* Flags that the pbuf comes from the pbuf pool */ 11 | #define UIP_PBUF_FLAG_REF 0x04U /* Flags thet the pbuf payload refers to RAM */ 12 | 13 | typedef enum { 14 | UIP_PBUF_TRANSPORT, 15 | UIP_PBUF_IP, 16 | UIP_PBUF_LINK, 17 | UIP_PBUF_RAW 18 | } uip_pbuf_layer; 19 | 20 | typedef enum { 21 | UIP_PBUF_POOL, 22 | UIP_PBUF_RAM, 23 | UIP_PBUF_ROM, 24 | UIP_PBUF_REF 25 | } uip_pbuf_flag; 26 | 27 | struct uip_pbuf { 28 | struct uip_pbuf *next; 29 | void *payload; 30 | u16_t tot_len; 31 | u16_t len; 32 | u16_t flags; 33 | u16_t ref; 34 | }; 35 | 36 | void uip_pbuf_init(); 37 | struct uip_pbuf* uip_pbuf_alloc(uip_pbuf_layer layer,u16_t len,uip_pbuf_flag flag); 38 | u8_t uip_pbuf_free(struct uip_pbuf *p); 39 | void uip_pbuf_realloc(struct uip_pbuf *p,u16_t new_len); 40 | u8_t uip_pbuf_header(struct uip_pbuf *p,s16_t hdr_size_inc); 41 | void uip_pbuf_cat(struct uip_pbuf *h,struct uip_pbuf *t); 42 | u8_t uip_pbuf_clen(struct uip_pbuf *p); 43 | void uip_pbuf_queue(struct uip_pbuf *p,struct uip_pbuf *n); 44 | void uip_pbuf_ref(struct uip_pbuf *p); 45 | void uip_pbuf_chain(struct uip_pbuf *h,struct uip_pbuf *t); 46 | struct uip_pbuf* uip_pbuf_dequeue(struct uip_pbuf *p); 47 | struct uip_pbuf* uip_pbuf_dechain(struct uip_pbuf *p); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /libdi/README: -------------------------------------------------------------------------------- 1 | ===================================================================== 2 | == libdi by Team Twiizers. 3 | == 4 | == 5 | ===================================================================== 6 | 7 | libdi is a threadsafe library that allows you to access the DVD drive 8 | in your Wii, regardless of a modchip being installed or not. 9 | 10 | ----------- 11 | -- INSTALL 12 | ----------- 13 | 14 | To install the lib, simply type 15 | 16 | make 17 | make install 18 | 19 | This will install the lib into your libogc. 20 | 21 | ----------- 22 | -- USAGE 23 | ----------- 24 | 25 | Usage is fairly self-explanatory, aside from DI_Init. You can set 26 | a callback using DI_SetCallback, which will be called upon completion 27 | of the disc initialization. This callback runs in the regular callback 28 | context. 29 | 30 | After this initial init, you call DI_Mount to spin the drive up. There is 31 | no need for unmounting, you can just eject the disc any time you want. 32 | Remounting with DI_Mount is necessary however. Calling DI_Mount is also 33 | helpful as a last resort for failing reads. 34 | 35 | Async reads are implemented in the lib using the standard async ioctls. 36 | You can pass an ipccallback function, of which the usrdata will be filled 37 | with the buffer you pass. Async reads do not have the advantage of auto-retries. 38 | You will have to check wether a read succeeds or not in your callback. 39 | 40 | Sync reads do have auto-retry, and the lib will try up to MAX_RETRY amount 41 | of times before it gives up. Dirty discs can need up to 10 retries 42 | before data is actually properly read. By default MAX_RETRY is set to 16. 43 | 44 | Most of the functions in this lib are universal and can be used on modchipped 45 | or non-modchipped drives alike. Some exceptions are: 46 | 47 | DI_ReadDVDConfig Will only work on non-modchipped drives. 48 | DI_ReportKey Will only work on non-modchipped drives. 49 | DI_ReadDVDUnencrypted Will only work on original discs. 50 | DI_ClosePartition Will only work on original discs. 51 | DI_OpenPartition Will only work on original discs. 52 | DI_ReadDiscID Will only work on original discs. 53 | 54 | If you've been reading through the source, you've probably noticed by now the 55 | peculiar function DI_KillDrive. DI_KillDrive will not actually kill your drive 56 | as to be useless. It merely crashes it in such a way that it will not respond 57 | to any DI commands, it will not eject your disc, and it will not take in any discs 58 | until the next DI_Reset. DI_Mount might fail if used after this function! 59 | I have included this function because people might have a use for it. Like it 60 | says in the source, I am not responsible if someone's drive does actually die 61 | from usage of this function. 62 | 63 | 64 | Known bugs: 65 | 66 | Currently, if you do a DI_Init(), and then return to HBC without a disc ever being inserted, 67 | your program will hang until a disc is inserted. If anyone has a nice solution, I'd 68 | love to hear it. 69 | 70 | Erant 71 | -------------------------------------------------------------------------------- /libmad/bit.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2003 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | # ifndef LIBMAD_BIT_H 22 | # define LIBMAD_BIT_H 23 | 24 | #include 25 | 26 | struct mad_bitptr { 27 | u8 const *byte; 28 | u16 cache; 29 | u16 left; 30 | }; 31 | 32 | void mad_bit_init(struct mad_bitptr *, u8 const *); 33 | 34 | # define mad_bit_finish(bitptr) /* nothing */ 35 | 36 | u32 mad_bit_length(struct mad_bitptr const *, 37 | struct mad_bitptr const *); 38 | 39 | # define mad_bit_bitsleft(bitptr) ((bitptr)->left) 40 | u8 const *mad_bit_nextbyte(struct mad_bitptr const *); 41 | 42 | void mad_bit_skip(struct mad_bitptr *, u32); 43 | u32 mad_bit_read(struct mad_bitptr *, u32); 44 | void mad_bit_write(struct mad_bitptr *, u32, u32); 45 | 46 | u16 mad_bit_crc(struct mad_bitptr, u32, u16); 47 | 48 | # endif 49 | -------------------------------------------------------------------------------- /libmad/fixed.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2003 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | # ifdef HAVE_CONFIG_H 22 | # include "config.h" 23 | # endif 24 | 25 | # include "global.h" 26 | 27 | # include "fixed.h" 28 | 29 | /* 30 | * NAME: fixed->abs() 31 | * DESCRIPTION: return absolute value of a fixed-point number 32 | */ 33 | mad_fixed_t mad_f_abs(mad_fixed_t x) 34 | { 35 | return x < 0 ? -x : x; 36 | } 37 | 38 | /* 39 | * NAME: fixed->div() 40 | * DESCRIPTION: perform division using fixed-point math 41 | */ 42 | mad_fixed_t mad_f_div(mad_fixed_t x, mad_fixed_t y) 43 | { 44 | mad_fixed_t q, r; 45 | u32 bits; 46 | 47 | q = mad_f_abs(x / y); 48 | 49 | if (x < 0) { 50 | x = -x; 51 | y = -y; 52 | } 53 | 54 | r = x % y; 55 | 56 | if (y < 0) { 57 | x = -x; 58 | y = -y; 59 | } 60 | 61 | if (q > mad_f_intpart(MAD_F_MAX) && 62 | !(q == -mad_f_intpart(MAD_F_MIN) && r == 0 && (x < 0) != (y < 0))) 63 | return 0; 64 | 65 | for (bits = MAD_F_FRACBITS; bits && r; --bits) { 66 | q <<= 1, r <<= 1; 67 | if (r >= y) 68 | r -= y, ++q; 69 | } 70 | 71 | /* round */ 72 | if (2 * r >= y) 73 | ++q; 74 | 75 | /* fix sign */ 76 | if ((x < 0) != (y < 0)) 77 | q = -q; 78 | 79 | return q << bits; 80 | } 81 | -------------------------------------------------------------------------------- /libmad/global.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2003 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | # ifndef LIBMAD_GLOBAL_H 22 | # define LIBMAD_GLOBAL_H 23 | 24 | # define FPM_PPC 25 | /* conditional debugging */ 26 | 27 | # if defined(DEBUG) && defined(NDEBUG) 28 | # error "cannot define both DEBUG and NDEBUG" 29 | # endif 30 | 31 | # if defined(DEBUG) 32 | # include 33 | # endif 34 | 35 | /* conditional features */ 36 | 37 | # if defined(OPT_SPEED) && defined(OPT_ACCURACY) 38 | # error "cannot optimize for both speed and accuracy" 39 | # endif 40 | 41 | # if defined(OPT_SPEED) && !defined(OPT_SSO) 42 | # define OPT_SSO 43 | # endif 44 | 45 | # if defined(HAVE_UNISTD_H) && defined(HAVE_WAITPID) && \ 46 | defined(HAVE_FCNTL) && defined(HAVE_PIPE) && defined(HAVE_FORK) 47 | # define USE_ASYNC 48 | # endif 49 | 50 | # if !defined(HAVE_ASSERT_H) 51 | # if defined(NDEBUG) 52 | # define assert(x) /* nothing */ 53 | # else 54 | # define assert(x) do { if (!(x)) abort(); } while (0) 55 | # endif 56 | # endif 57 | 58 | # endif 59 | -------------------------------------------------------------------------------- /libmad/huffman.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2003 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | # ifndef LIBMAD_HUFFMAN_H 22 | # define LIBMAD_HUFFMAN_H 23 | 24 | #include 25 | 26 | union huffquad { 27 | struct { 28 | u16 final : 1; 29 | u16 bits : 3; 30 | u16 offset : 12; 31 | } ptr; 32 | struct { 33 | u16 final : 1; 34 | u16 hlen : 3; 35 | u16 v : 1; 36 | u16 w : 1; 37 | u16 x : 1; 38 | u16 y : 1; 39 | } value; 40 | u16 final : 1; 41 | }; 42 | 43 | union huffpair { 44 | struct { 45 | u16 final : 1; 46 | u16 bits : 3; 47 | u16 offset : 12; 48 | } ptr; 49 | struct { 50 | u16 final : 1; 51 | u16 hlen : 3; 52 | u16 x : 4; 53 | u16 y : 4; 54 | } value; 55 | u16 final : 1; 56 | }; 57 | 58 | struct hufftable { 59 | union huffpair const *table; 60 | u16 linbits; 61 | u16 startbits; 62 | }; 63 | 64 | extern union huffquad const *const mad_huff_quad_table[2]; 65 | extern struct hufftable const mad_huff_pair_table[32]; 66 | 67 | # endif 68 | -------------------------------------------------------------------------------- /libmad/imdct_s.dat: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2003 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | /* 0 */ { MAD_F(0x09bd7ca0) /* 0.608761429 */, 22 | -MAD_F(0x0ec835e8) /* -0.923879533 */, 23 | -MAD_F(0x0216a2a2) /* -0.130526192 */, 24 | MAD_F(0x0fdcf549) /* 0.991444861 */, 25 | -MAD_F(0x061f78aa) /* -0.382683432 */, 26 | -MAD_F(0x0cb19346) /* -0.793353340 */ }, 27 | 28 | /* 6 */ { -MAD_F(0x0cb19346) /* -0.793353340 */, 29 | MAD_F(0x061f78aa) /* 0.382683432 */, 30 | MAD_F(0x0fdcf549) /* 0.991444861 */, 31 | MAD_F(0x0216a2a2) /* 0.130526192 */, 32 | -MAD_F(0x0ec835e8) /* -0.923879533 */, 33 | -MAD_F(0x09bd7ca0) /* -0.608761429 */ }, 34 | 35 | /* 1 */ { MAD_F(0x061f78aa) /* 0.382683432 */, 36 | -MAD_F(0x0ec835e8) /* -0.923879533 */, 37 | MAD_F(0x0ec835e8) /* 0.923879533 */, 38 | -MAD_F(0x061f78aa) /* -0.382683432 */, 39 | -MAD_F(0x061f78aa) /* -0.382683432 */, 40 | MAD_F(0x0ec835e8) /* 0.923879533 */ }, 41 | 42 | /* 7 */ { -MAD_F(0x0ec835e8) /* -0.923879533 */, 43 | -MAD_F(0x061f78aa) /* -0.382683432 */, 44 | MAD_F(0x061f78aa) /* 0.382683432 */, 45 | MAD_F(0x0ec835e8) /* 0.923879533 */, 46 | MAD_F(0x0ec835e8) /* 0.923879533 */, 47 | MAD_F(0x061f78aa) /* 0.382683432 */ }, 48 | 49 | /* 2 */ { MAD_F(0x0216a2a2) /* 0.130526192 */, 50 | -MAD_F(0x061f78aa) /* -0.382683432 */, 51 | MAD_F(0x09bd7ca0) /* 0.608761429 */, 52 | -MAD_F(0x0cb19346) /* -0.793353340 */, 53 | MAD_F(0x0ec835e8) /* 0.923879533 */, 54 | -MAD_F(0x0fdcf549) /* -0.991444861 */ }, 55 | 56 | /* 8 */ { -MAD_F(0x0fdcf549) /* -0.991444861 */, 57 | -MAD_F(0x0ec835e8) /* -0.923879533 */, 58 | -MAD_F(0x0cb19346) /* -0.793353340 */, 59 | -MAD_F(0x09bd7ca0) /* -0.608761429 */, 60 | -MAD_F(0x061f78aa) /* -0.382683432 */, 61 | -MAD_F(0x0216a2a2) /* -0.130526192 */ } 62 | -------------------------------------------------------------------------------- /libmad/layer12.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2003 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | # ifndef LIBMAD_LAYER12_H 22 | # define LIBMAD_LAYER12_H 23 | 24 | # include "stream.h" 25 | # include "frame.h" 26 | 27 | int mad_layer_I(struct mad_stream *, struct mad_frame *); 28 | int mad_layer_II(struct mad_stream *, struct mad_frame *); 29 | 30 | # endif 31 | -------------------------------------------------------------------------------- /libmad/layer3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2003 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | # ifndef LIBMAD_LAYER3_H 22 | # define LIBMAD_LAYER3_H 23 | 24 | # include "stream.h" 25 | # include "frame.h" 26 | 27 | int mad_layer_III(struct mad_stream *, struct mad_frame *); 28 | 29 | # endif 30 | -------------------------------------------------------------------------------- /libmad/synth.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2003 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | # ifndef LIBMAD_SYNTH_H 22 | # define LIBMAD_SYNTH_H 23 | 24 | # include 25 | # include "fixed.h" 26 | # include "frame.h" 27 | 28 | struct mad_pcm { 29 | u32 samplerate; /* sampling frequency (Hz) */ 30 | u16 channels; /* number of channels */ 31 | u16 length; /* number of samples per channel */ 32 | mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ 33 | }; 34 | 35 | struct mad_synth { 36 | mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */ 37 | /* [ch][eo][peo][s][v] */ 38 | 39 | u32 phase; /* current processing phase */ 40 | 41 | struct mad_pcm pcm; /* PCM output */ 42 | }; 43 | 44 | /* single channel PCM selector */ 45 | enum { 46 | MAD_PCM_CHANNEL_SINGLE = 0 47 | }; 48 | 49 | /* dual channel PCM selector */ 50 | enum { 51 | MAD_PCM_CHANNEL_DUAL_1 = 0, 52 | MAD_PCM_CHANNEL_DUAL_2 = 1 53 | }; 54 | 55 | /* stereo PCM selector */ 56 | enum { 57 | MAD_PCM_CHANNEL_STEREO_LEFT = 0, 58 | MAD_PCM_CHANNEL_STEREO_RIGHT = 1 59 | }; 60 | 61 | void mad_synth_init(struct mad_synth *); 62 | 63 | # define mad_synth_finish(synth) /* nothing */ 64 | 65 | void mad_synth_mute(struct mad_synth *); 66 | 67 | void mad_synth_frame(struct mad_synth *, struct mad_frame const *); 68 | 69 | # endif 70 | -------------------------------------------------------------------------------- /libmad/version.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2003 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | # ifdef HAVE_CONFIG_H 22 | # include "config.h" 23 | # endif 24 | 25 | # include "global.h" 26 | 27 | # include "version.h" 28 | 29 | s8 const mad_version[] = "MPEG Audio Decoder " MAD_VERSION; 30 | s8 const mad_copyright[] = "Copyright (C) " MAD_PUBLISHYEAR " " MAD_AUTHOR; 31 | s8 const mad_author[] = MAD_AUTHOR " <" MAD_EMAIL ">"; 32 | 33 | s8 const mad_build[] = "" 34 | # if defined(DEBUG) 35 | "DEBUG " 36 | # elif defined(NDEBUG) 37 | "NDEBUG " 38 | # endif 39 | 40 | # if defined(EXPERIMENTAL) 41 | "EXPERIMENTAL " 42 | # endif 43 | 44 | # if defined(FPM_64BIT) 45 | "FPM_64BIT " 46 | # elif defined(FPM_INTEL) 47 | "FPM_INTEL " 48 | # elif defined(FPM_ARM) 49 | "FPM_ARM " 50 | # elif defined(FPM_MIPS) 51 | "FPM_MIPS " 52 | # elif defined(FPM_SPARC) 53 | "FPM_SPARC " 54 | # elif defined(FPM_PPC) 55 | "FPM_PPC " 56 | # elif defined(FPM_DEFAULT) 57 | "FPM_DEFAULT " 58 | # endif 59 | 60 | # if defined(ASO_IMDCT) 61 | "ASO_IMDCT " 62 | # endif 63 | # if defined(ASO_INTERLEAVE1) 64 | "ASO_INTERLEAVE1 " 65 | # endif 66 | # if defined(ASO_INTERLEAVE2) 67 | "ASO_INTERLEAVE2 " 68 | # endif 69 | # if defined(ASO_ZEROCHECK) 70 | "ASO_ZEROCHECK " 71 | # endif 72 | 73 | # if defined(OPT_SPEED) 74 | "OPT_SPEED " 75 | # elif defined(OPT_ACCURACY) 76 | "OPT_ACCURACY " 77 | # endif 78 | 79 | # if defined(OPT_SSO) 80 | "OPT_SSO " 81 | # endif 82 | 83 | # if defined(OPT_DCTO) /* never defined here */ 84 | "OPT_DCTO " 85 | # endif 86 | 87 | # if defined(OPT_STRICT) 88 | "OPT_STRICT " 89 | # endif 90 | ; 91 | -------------------------------------------------------------------------------- /libmad/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2003 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | # ifndef LIBMAD_VERSION_H 22 | # define LIBMAD_VERSION_H 23 | 24 | #include 25 | 26 | # define MAD_VERSION_MAJOR 0 27 | # define MAD_VERSION_MINOR 15 28 | # define MAD_VERSION_PATCH 0 29 | # define MAD_VERSION_EXTRA " (beta)" 30 | 31 | # define MAD_VERSION_STRINGIZE(str) #str 32 | # define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num) 33 | 34 | # define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ 35 | MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ 36 | MAD_VERSION_STRING(MAD_VERSION_PATCH) \ 37 | MAD_VERSION_EXTRA 38 | 39 | # define MAD_PUBLISHYEAR "2000-2003" 40 | # define MAD_AUTHOR "Underbit Technologies, Inc." 41 | # define MAD_EMAIL "info@underbit.com" 42 | 43 | extern s8 const mad_version[]; 44 | extern s8 const mad_copyright[]; 45 | extern s8 const mad_author[]; 46 | extern s8 const mad_build[]; 47 | 48 | # endif 49 | -------------------------------------------------------------------------------- /libmodplay/freqtab.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2002,2003, Christian Nowak 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are 6 | permitted provided that the following conditions are met: 7 | 8 | - Redistributions of source code must retain the above copyright notice, this list of 9 | conditions and the following disclaimer. 10 | - Redistributions in binary form must reproduce the above copyright notice, this list 11 | of conditions and the following disclaimer in the documentation and/or other 12 | materials provided with the distribution. 13 | - The names of the contributors may not be used to endorse or promote products derived 14 | from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 17 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 19 | THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 23 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 24 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #include "defines.h" 28 | 29 | u16 freqtab[] = { 30 | 27392, 25856, 24384, 23040, 21696, 20480,19328,18240,17216,16256,15360,14496, 31 | 32 | 13696, 12928, 12192, 11520, 10848, 10240, 9664, 9120, 8606, 8128, 7680, 7248, 33 | 6848, 6464, 6096, 5760, 5424, 5120, 4832, 4560, 4304, 4064, 3840, 3624, 34 | 3424, 3232, 3048, 2880, 2712, 2560, 2416, 2280, 2152, 2032, 1920, 1812, 35 | 1712, 1616, 1525, 1440, 1357, 1281, 1209, 1141, 1077, 1017, 961, 907, 36 | 856, 808, 762, 720, 678, 640, 604, 570, 538, 508, 480, 453, 37 | 428, 404, 381, 360, 339, 320, 302, 285, 269, 254, 240, 226, 38 | 214, 202, 190, 180, 170, 160, 151, 143, 135, 127, 120, 113, 39 | 107, 101, 95, 90, 85, 80, 76, 71, 67, 64, 60, 57, 40 | 54, 51, 48, 45, 42, 40, 38, 36, 34, 32, 30, 28, 41 | 27, 25, 24, 22, 21, 20, 19, 18, 17, 16, 15, 14, 42 | 43 | 13, 13, 12, 11, 11, 10, 9, 9 44 | }; 45 | -------------------------------------------------------------------------------- /libogc/argv.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------- 2 | 3 | Copyright (C) 2008 4 | Michael Wiedenbauer (shagkur) 5 | Dave Murphy (WinterMute) 6 | 7 | This software is provided 'as-is', without any express or implied 8 | warranty. In no event will the authors be held liable for any 9 | damages arising from the use of this software. 10 | 11 | Permission is granted to anyone to use this software for any 12 | purpose, including commercial applications, and to alter it and 13 | redistribute it freely, subject to the following restrictions: 14 | 15 | 1. The origin of this software must not be misrepresented; you 16 | must not claim that you wrote the original software. If you use 17 | this software in a product, an acknowledgment in the product 18 | documentation would be appreciated but is not required. 19 | 20 | 2. Altered source versions must be plainly marked as such, and 21 | must not be misrepresented as being the original software. 22 | 23 | 3. This notice may not be removed or altered from any source 24 | distribution. 25 | 26 | -------------------------------------------------------------*/ 27 | #include "gctypes.h" 28 | #include 29 | 30 | extern u8 __Arena1Lo[]; 31 | extern char *__argvArena1Lo; 32 | void build_argv (struct __argv* argstruct ); 33 | 34 | void __CheckARGV() { 35 | 36 | if ( __system_argv->argvMagic != ARGV_MAGIC ) { 37 | __system_argv->argc = 0; 38 | __system_argv->argv = NULL; 39 | return; 40 | } 41 | 42 | u8 *dest = (u8 *)( ((int)__Arena1Lo + 3) & ~3); 43 | 44 | memmove(dest, __system_argv->commandLine, __system_argv->length); 45 | __system_argv->commandLine = (char *)dest; 46 | build_argv(__system_argv); 47 | 48 | __argvArena1Lo = (char *)__system_argv->endARGV; 49 | 50 | } 51 | -------------------------------------------------------------------------------- /libogc/console.h: -------------------------------------------------------------------------------- 1 | #ifndef __CONSOLE_H__ 2 | #define __CONSOLE_H__ 3 | 4 | 5 | #define FONT_XSIZE 8 6 | #define FONT_YSIZE 16 7 | #define FONT_XFACTOR 1 8 | #define FONT_YFACTOR 1 9 | #define FONT_XGAP 0 10 | #define FONT_YGAP 0 11 | #define TAB_SIZE 4 12 | 13 | typedef struct _console_data_s { 14 | void *destbuffer; 15 | unsigned char *font; 16 | int con_xres,con_yres,con_stride; 17 | int target_x,target_y, tgt_stride; 18 | int cursor_row,cursor_col; 19 | int saved_row,saved_col; 20 | int con_rows, con_cols; 21 | 22 | unsigned int foreground,background; 23 | } console_data_s; 24 | 25 | extern int __console_write(struct _reent *r,int fd,const char *ptr,size_t len); 26 | extern void __console_init(void *framebuffer,int xstart,int ystart,int xres,int yres,int stride); 27 | 28 | //extern const devoptab_t dotab_stdout; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /libogc/console_font_8x16.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derek57/libogc/1d97726b06fed0e501569b4f755542123139e7ea/libogc/console_font_8x16.c -------------------------------------------------------------------------------- /libogc/coresem.inl: -------------------------------------------------------------------------------- 1 | /* inline/coresem.inl 2 | * 3 | * This include file contains all of the inlined routines associated 4 | * with the CORE semaphore. 5 | * 6 | * COPYRIGHT (c) 1989-1999. 7 | * On-Line Applications Research Corporation (OAR). 8 | * 9 | * The license and distribution terms for this file may be 10 | * found in the file LICENSE in this distribution or at 11 | * http://www.rtems.com/license/LICENSE. 12 | * 13 | * $Id$ 14 | */ 15 | 16 | #ifndef __INLINE_CORE_SEMAPHORE_inl 17 | #define __INLINE_CORE_SEMAPHORE_inl 18 | 19 | /*PAGE 20 | * 21 | * _CORE_semaphore_Is_priority 22 | * 23 | * DESCRIPTION: 24 | * 25 | * This function returns TRUE if the priority attribute is 26 | * enabled in the attribute_set and FALSE otherwise. 27 | */ 28 | 29 | RTEMS_INLINE_ROUTINE boolean _CORE_semaphore_Is_priority( 30 | CORE_semaphore_Attributes *the_attribute 31 | ) 32 | { 33 | return ( the_attribute->discipline == CORE_SEMAPHORE_DISCIPLINES_PRIORITY ); 34 | } 35 | 36 | /*PAGE 37 | * 38 | * _CORE_semaphore_Seize_isr_disable 39 | * 40 | * DESCRIPTION: 41 | * 42 | * This routine attempts to receive a unit from the_semaphore. 43 | * If a unit is available or if the wait flag is FALSE, then the routine 44 | * returns. Otherwise, the calling task is blocked until a unit becomes 45 | * available. 46 | * 47 | * NOTE: There is currently no MACRO version of this routine. 48 | */ 49 | 50 | RTEMS_INLINE_ROUTINE void _CORE_semaphore_Seize_isr_disable( 51 | CORE_semaphore_Control *the_semaphore, 52 | Objects_Id id, 53 | boolean wait, 54 | ISR_Level *level_p 55 | ) 56 | { 57 | Thread_Control *executing; 58 | ISR_Level level = *level_p; 59 | 60 | /* disabled when you get here */ 61 | 62 | executing = _Thread_Executing; 63 | executing->Wait.return_code = CORE_SEMAPHORE_STATUS_SUCCESSFUL; 64 | if ( the_semaphore->count != 0 ) { 65 | the_semaphore->count -= 1; 66 | _ISR_Enable( level ); 67 | return; 68 | } 69 | 70 | if ( !wait ) { 71 | _ISR_Enable( level ); 72 | executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT; 73 | return; 74 | } 75 | 76 | _Thread_Disable_dispatch(); 77 | _Thread_queue_Enter_critical_section( &the_semaphore->Wait_queue ); 78 | executing->Wait.queue = &the_semaphore->Wait_queue; 79 | executing->Wait.id = id; 80 | _ISR_Enable( level ); 81 | 82 | _Thread_queue_Enqueue( &the_semaphore->Wait_queue, 0 ); 83 | _Thread_Enable_dispatch(); 84 | } 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /libogc/decrementer.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------- 2 | 3 | decrementer.c -- PPC decrementer exception support 4 | 5 | Copyright (C) 2004 6 | Michael Wiedenbauer (shagkur) 7 | Dave Murphy (WinterMute) 8 | 9 | This software is provided 'as-is', without any express or implied 10 | warranty. In no event will the authors be held liable for any 11 | damages arising from the use of this software. 12 | 13 | Permission is granted to anyone to use this software for any 14 | purpose, including commercial applications, and to alter it and 15 | redistribute it freely, subject to the following restrictions: 16 | 17 | 1. The origin of this software must not be misrepresented; you 18 | must not claim that you wrote the original software. If you use 19 | this software in a product, an acknowledgment in the product 20 | documentation would be appreciated but is not required. 21 | 22 | 2. Altered source versions must be plainly marked as such, and 23 | must not be misrepresented as being the original software. 24 | 25 | 3. This notice may not be removed or altered from any source 26 | distribution. 27 | 28 | 29 | -------------------------------------------------------------*/ 30 | 31 | 32 | #include 33 | #include 34 | #include "asm.h" 35 | #include "processor.h" 36 | #include "thread.h" 37 | #include "watchdog.h" 38 | #include "context.h" 39 | 40 | //#define _DECEX_DEBUG 41 | 42 | #ifdef _DECEX_DEBUG 43 | extern int printk(const char *fmt,...); 44 | #endif 45 | 46 | void __decrementer_init() 47 | { 48 | #ifdef _DECEX_DEBUG 49 | printf("__decrementer_init()\n\n"); 50 | #endif 51 | } 52 | 53 | void c_decrementer_handler(Context_Control *ctx) 54 | { 55 | #ifdef _DECEX_DEBUG 56 | printk("c_decrementer_handler(%d)\n",_Watchdog_Ticks_since_boot); 57 | #endif 58 | _Watchdog_Tickle_ticks(); 59 | } 60 | -------------------------------------------------------------------------------- /libogc/exinit.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Initialization Manager 3 | * 4 | * COPYRIGHT (c) 1989-1998. 5 | * On-Line Applications Research Corporation (OAR). 6 | * Copyright assigned to U.S. Government, 1994. 7 | * 8 | * The license and distribution terms for this file may be 9 | * found in the file LICENSE in this distribution or at 10 | * http://www.OARcorp.com/rtems/license.html. 11 | * 12 | * $Id$ 13 | */ 14 | 15 | #include 16 | 17 | #include "lwp_config.h" 18 | 19 | /* 20 | * The following data items are the priority bit map. 21 | * Each of the sixteen bits used in the _Priority_Major_bit_map is 22 | * associated with one of the sixteen entries in the _Priority_Bit_map. 23 | * Each bit in the _Priority_Bit_map indicates whether or not there are 24 | * threads ready at a particular priority. The mapping of 25 | * individual priority levels to particular bits is processor 26 | * dependent as is the value of each bit used to indicate that 27 | * threads are ready at that priority. 28 | */ 29 | 30 | volatile Priority_Bit_map_control _Priority_Major_bit_map; 31 | Priority_Bit_map_control 32 | _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT; 33 | 34 | /*PAGE 35 | * 36 | * _Priority_Handler_initialization 37 | * 38 | * DESCRIPTION: 39 | * 40 | * This routine performs the initialization necessary for this handler. 41 | */ 42 | 43 | void _Priority_Handler_initialization( void ) 44 | { 45 | unsigned32 index; 46 | 47 | _Priority_Major_bit_map = 0; 48 | for ( index=0 ; index <16 ; index++ ) 49 | _Priority_Bit_map[ index ] = 0; 50 | } 51 | -------------------------------------------------------------------------------- /libogc/gx_regdef.h: -------------------------------------------------------------------------------- 1 | #ifndef __GX_REGDEF_H__ 2 | #define __GX_REGDEF_H__ 3 | 4 | #include 5 | 6 | #define STRUCT_REGDEF_SIZE 1440 7 | 8 | struct __gx_regdef 9 | { 10 | u16 cpSRreg; 11 | u16 cpCRreg; 12 | u16 cpCLreg; 13 | u16 xfFlush; 14 | u16 xfFlushExp; 15 | u16 xfFlushSafe; 16 | u32 gxFifoInited; 17 | u32 vcdClear; 18 | u32 VATTable; 19 | u32 mtxIdxLo; 20 | u32 mtxIdxHi; 21 | u32 texCoordManually; 22 | u32 vcdLo; 23 | u32 vcdHi; 24 | u32 vcdNrms; 25 | u32 dirtyState; 26 | u32 perf0Mode; 27 | u32 perf1Mode; 28 | u32 cpPerfMode; 29 | u32 VAT0reg[8]; 30 | u32 VAT1reg[8]; 31 | u32 VAT2reg[8]; 32 | u32 texMapSize[8]; 33 | u32 texMapWrap[8]; 34 | u32 sciTLcorner; 35 | u32 sciBRcorner; 36 | u32 lpWidth; 37 | u32 genMode; 38 | u32 suSsize[8]; 39 | u32 suTsize[8]; 40 | u32 tevTexMap[16]; 41 | u32 tevColorEnv[16]; 42 | u32 tevAlphaEnv[16]; 43 | u32 tevSwapModeTable[8]; 44 | u32 tevRasOrder[11]; 45 | u32 tevTexCoordEnable; 46 | u32 tevIndMask; 47 | u32 texCoordGen[8]; 48 | u32 texCoordGen2[8]; 49 | u32 dispCopyCntrl; 50 | u32 dispCopyDst; 51 | u32 dispCopyTL; 52 | u32 dispCopyWH; 53 | u32 texCopyCntrl; 54 | u32 texCopyDst; 55 | u32 texCopyTL; 56 | u32 texCopyWH; 57 | u32 peZMode; 58 | u32 peCMode0; 59 | u32 peCMode1; 60 | u32 peCntrl; 61 | u32 chnAmbColor[2]; 62 | u32 chnMatColor[2]; 63 | u32 chnCntrl[4]; 64 | GXTexRegion texRegion[24]; 65 | GXTlutRegion tlutRegion[20]; 66 | u8 saveDLctx; 67 | u8 gxFifoUnlinked; 68 | u8 texCopyZTex; 69 | u8 _pad; 70 | } __attribute__((packed)); 71 | 72 | struct __gxfifo { 73 | vu32 buf_start; 74 | vu32 buf_end; 75 | vu32 size; 76 | vu32 hi_mark; 77 | vu32 lo_mark; 78 | vu32 rd_ptr; 79 | vu32 wt_ptr; 80 | vu32 rdwt_dst; 81 | vu8 fifo_wrap; 82 | vu8 cpufifo_ready; 83 | vu8 gpfifo_ready; 84 | u8 _pad[93]; 85 | } __attribute__((packed)); 86 | 87 | struct __gx_litobj 88 | { 89 | u32 _pad[3]; 90 | u32 col; 91 | f32 a0; 92 | f32 a1; 93 | f32 a2; 94 | f32 k0; 95 | f32 k1; 96 | f32 k2; 97 | f32 px; 98 | f32 py; 99 | f32 pz; 100 | f32 nx; 101 | f32 ny; 102 | f32 nz; 103 | } __attribute__((packed)); 104 | 105 | struct __gx_texobj 106 | { 107 | u32 tex_filt; 108 | u32 tex_lod; 109 | u32 tex_size; 110 | u32 tex_maddr; 111 | u32 usr_data; 112 | u32 tex_fmt; 113 | u32 tex_tlut; 114 | u16 tex_tile_cnt; 115 | u8 tex_tile_type; 116 | u8 tex_flag; 117 | } __attribute__((packed)); 118 | 119 | struct __gx_tlutobj 120 | { 121 | u32 tlut_fmt; 122 | u32 tlut_maddr; 123 | u16 tlut_nentries; 124 | u8 _pad[2]; 125 | } __attribute__((packed)); 126 | 127 | struct __gx_texregion 128 | { 129 | u32 tmem_even; 130 | u32 tmem_odd; 131 | u16 size_even; 132 | u16 size_odd; 133 | u8 ismipmap; 134 | u8 iscached; 135 | u8 _pad[2]; 136 | } __attribute__((packed)); 137 | 138 | struct __gx_tlutregion 139 | { 140 | u32 tmem_addr_conf; 141 | u32 tmem_addr_base; 142 | u32 tlut_maddr; 143 | u16 tlut_nentries; 144 | u8 _pad[2]; 145 | } __attribute__((packed)); 146 | 147 | #endif 148 | -------------------------------------------------------------------------------- /libogc/lock_supp.c: -------------------------------------------------------------------------------- 1 | #include <_ansi.h> 2 | #include <_syslist.h> 3 | #include 4 | #include 5 | #include 6 | #ifndef REENTRANT_SYSCALLS_PROVIDED 7 | #include 8 | #endif 9 | #include 10 | 11 | #include "asm.h" 12 | #include "processor.h" 13 | #include "mutex.h" 14 | 15 | 16 | int __libogc_lock_init(int *lock,int recursive) 17 | { 18 | signed32 ret; 19 | pthread_mutex_t retlck = POSIX_CONDITION_VARIABLES_NO_MUTEX; 20 | 21 | if(!lock) return -1; 22 | 23 | *lock = 0; 24 | ret = pthread_mutex_init(&retlck,(recursive?TRUE:FALSE)); 25 | if(ret==0) *lock = (int)retlck; 26 | 27 | return ret; 28 | } 29 | 30 | int __libogc_lock_close(int *lock) 31 | { 32 | signed32 ret; 33 | pthread_mutex_t plock; 34 | 35 | if(!lock || *lock==0) return -1; 36 | 37 | plock = (pthread_mutex_t)*lock; 38 | ret = pthread_mutex_destroy(plock); 39 | if(ret==0) *lock = 0; 40 | 41 | return ret; 42 | } 43 | 44 | int __libogc_lock_acquire(int *lock) 45 | { 46 | pthread_mutex_t plock; 47 | 48 | if(!lock || *lock==0) return -1; 49 | 50 | plock = (pthread_mutex_t)*lock; 51 | return pthread_mutex_lock(plock); 52 | } 53 | 54 | 55 | int __libogc_lock_release(int *lock) 56 | { 57 | pthread_mutex_t plock; 58 | 59 | if(!lock || *lock==0) return -1; 60 | 61 | plock = (pthread_mutex_t)*lock; 62 | return pthread_mutex_unlock(plock); 63 | } 64 | 65 | -------------------------------------------------------------------------------- /libogc/lwp_stack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Thread Handler 3 | * 4 | * 5 | * COPYRIGHT (c) 1989-1999. 6 | * On-Line Applications Research Corporation (OAR). 7 | * 8 | * The license and distribution terms for this file may be 9 | * found in found in the file LICENSE in this distribution or at 10 | * http://www.OARcorp.com/rtems/license.html. 11 | * 12 | * $Id$ 13 | */ 14 | 15 | #include 16 | #include "stack.h" 17 | #include "wkspace.h" 18 | 19 | /*PAGE 20 | * 21 | * _Thread_Stack_Allocate 22 | * 23 | * Allocate the requested stack space for the thread. 24 | * return the actual size allocated after any adjustment 25 | * or return zero if the allocation failed. 26 | * Set the Start.stack field to the address of the stack 27 | */ 28 | 29 | unsigned32 _Thread_Stack_Allocate( 30 | Thread_Control *the_thread, 31 | unsigned32 stack_size 32 | ) 33 | { 34 | void *stack_addr = 0; 35 | 36 | if ( !_Stack_Is_enough( stack_size ) ) 37 | stack_size = STACK_MINIMUM_SIZE; 38 | 39 | /* 40 | * First pad the requested size so we allocate enough memory 41 | * so the context initialization can align it properly. The address 42 | * returned the workspace allocate must be directly stored in the 43 | * stack control block because it is later used in the free sequence. 44 | * 45 | * Thus it is the responsibility of the CPU dependent code to 46 | * get and keep the stack adjust factor, the stack alignment, and 47 | * the context initialization sequence in sync. 48 | */ 49 | 50 | stack_size = _Stack_Adjust_size( stack_size ); 51 | stack_addr = _Workspace_Allocate( stack_size ); 52 | 53 | if ( !stack_addr ) 54 | stack_size = 0; 55 | 56 | the_thread->stack = stack_addr; 57 | 58 | return stack_size; 59 | } 60 | 61 | /* 62 | * _Thread_Stack_Free 63 | * 64 | * Deallocate the Thread's stack. 65 | */ 66 | 67 | void _Thread_Stack_Free( 68 | Thread_Control *the_thread 69 | ) 70 | { 71 | /* 72 | * If the API provided the stack space, then don't free it. 73 | */ 74 | 75 | if ( !the_thread->core_allocated_stack ) 76 | return; 77 | 78 | _Workspace_Free( the_thread->stack ); 79 | } 80 | -------------------------------------------------------------------------------- /libogc/malloc_lock.c: -------------------------------------------------------------------------------- 1 | #include <_ansi.h> 2 | #include <_syslist.h> 3 | #ifndef REENTRANT_SYSCALLS_PROVIDED 4 | #include 5 | #endif 6 | #include 7 | #undef errno 8 | extern int errno; 9 | 10 | #include "asm.h" 11 | #include "processor.h" 12 | #include "coremutex.h" 13 | 14 | #define MEMLOCK_MUTEX_ID 0x00030040 15 | 16 | static int initialized = 0; 17 | static CORE_mutex_Control mem_lock; 18 | 19 | void __memlock_init() 20 | { 21 | _Thread_Disable_dispatch(); 22 | if(!initialized) { 23 | CORE_mutex_Attributes attr; 24 | 25 | initialized = 1; 26 | 27 | attr.discipline = CORE_MUTEX_DISCIPLINES_FIFO; 28 | attr.lock_nesting_behavior = CORE_MUTEX_NESTING_ACQUIRES; 29 | attr.only_owner_release = TRUE; 30 | attr.priority_ceiling = 1; 31 | _CORE_mutex_Initialize(&mem_lock,&attr,CORE_MUTEX_UNLOCKED); 32 | } 33 | _Thread_Unnest_dispatch(); 34 | } 35 | 36 | #ifndef REENTRANT_SYSCALLS_PROVIDED 37 | void _DEFUN(__libogc_malloc_lock,(r), 38 | struct _reent *r) 39 | { 40 | ISR_Level level; 41 | 42 | if(!initialized) return; 43 | 44 | _ISR_Disable(level); 45 | _CORE_mutex_Seize(&mem_lock,MEMLOCK_MUTEX_ID,TRUE,RTEMS_NO_TIMEOUT,level); 46 | } 47 | 48 | void _DEFUN(__libogc_malloc_unlock,(r), 49 | struct _reent *r) 50 | { 51 | if(!initialized) return; 52 | 53 | _Thread_Disable_dispatch(); 54 | _CORE_mutex_Surrender(&mem_lock); 55 | _Thread_Enable_dispatch(); 56 | } 57 | 58 | #else 59 | void _DEFUN(__libogc_malloc_lock,(ptr), 60 | struct _reent *ptr) 61 | { 62 | ISR_Level level; 63 | 64 | if(!initialized) return; 65 | 66 | _ISR_Disable(level); 67 | _CORE_mutex_Seize(&mem_lock,MEMLOCK_MUTEX_ID,TRUE,RTEMS_NO_TIMEOUT,level); 68 | ptr->_errno = _Thread_Executing->wait.ret_code; 69 | } 70 | 71 | void _DEFUN(__libogc_malloc_unlock,(ptr), 72 | struct _reent *ptr) 73 | { 74 | if(!initialized) return; 75 | 76 | _Thread_Disable_dispatch(); 77 | ptr->_errno = _CORE_mutex_Surrender(&mem_lock); 78 | _Thread_Enable_dispatch(); 79 | } 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /libogc/message.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derek57/libogc/1d97726b06fed0e501569b4f755542123139e7ea/libogc/message.c -------------------------------------------------------------------------------- /libogc/object.inl: -------------------------------------------------------------------------------- 1 | /* object.inl 2 | * 3 | * This include file contains the RTEMS_INLINE_ROUTINE implementation of all 4 | * of the inlined routines in the Object Handler. 5 | * 6 | * COPYRIGHT (c) 1989-2002. 7 | * On-Line Applications Research Corporation (OAR). 8 | * 9 | * The license and distribution terms for this file may be 10 | * found in the file LICENSE in this distribution or at 11 | * http://www.OARcorp.com/rtems/license.html. 12 | * 13 | * $Id$ 14 | */ 15 | 16 | #ifndef __OBJECTS_inl 17 | #define __OBJECTS_inl 18 | 19 | /** 20 | * This function sets the pointer to the local_table object 21 | * referenced by the index. 22 | * 23 | * @param[in] information points to an Object Information Table 24 | * @param[in] index is the index of the object the caller wants to access 25 | * @param[in] the_object is the local object pointer 26 | */ 27 | 28 | RTEMS_INLINE_ROUTINE void _Objects_Set_local_object( 29 | Objects_Information *information, 30 | unsigned32 index, 31 | Objects_Control *the_object 32 | ) 33 | { 34 | if ( index < information->maximum ) 35 | information->local_table[ index ] = the_object; 36 | } 37 | 38 | /*PAGE 39 | * 40 | * _Objects_Open 41 | * 42 | * DESCRIPTION: 43 | * 44 | * This function places the_object control pointer and object name 45 | * in the Local Pointer and Local Name Tables, respectively. 46 | */ 47 | 48 | RTEMS_INLINE_ROUTINE void _Objects_Open( 49 | Objects_Information *information, 50 | Objects_Control *the_object 51 | ) 52 | { 53 | _Objects_Set_local_object( information, the_object->id, the_object ); 54 | } 55 | 56 | /*PAGE 57 | * 58 | * _Objects_Close 59 | * 60 | * DESCRIPTION: 61 | * 62 | * This function removes the_object control pointer and object name 63 | * in the Local Pointer and Local Name Tables. 64 | */ 65 | 66 | RTEMS_INLINE_ROUTINE void _Objects_Close( 67 | Objects_Information *information, 68 | Objects_Control *the_object 69 | ) 70 | { 71 | _Objects_Set_local_object( information, the_object->id, NULL ); 72 | } 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /libogc/sbrk.c: -------------------------------------------------------------------------------- 1 | #include <_ansi.h> 2 | #include <_syslist.h> 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "asm.h" 9 | #include "processor.h" 10 | #include "system.h" 11 | 12 | #if defined(HW_RVL) 13 | u32 MALLOC_MEM2 __attribute__((weak)) = 1; 14 | #endif 15 | 16 | void* _DEFUN(__libogc_sbrk_r,(ptr,incr), 17 | struct _reent *ptr _AND 18 | ptrdiff_t incr) 19 | { 20 | ISR_Level level; 21 | char *heap_end = 0; 22 | char *prev_heap = 0; 23 | #if defined(HW_RVL) 24 | static char *mem2_start = NULL; 25 | #endif 26 | 27 | _ISR_Disable(level); 28 | #if defined(HW_RVL) 29 | if(MALLOC_MEM2) { 30 | // use MEM2 aswell for malloc 31 | if(mem2_start==NULL) 32 | heap_end = (char*)SYS_GetArenaLo(); 33 | else 34 | heap_end = (char*)SYS_GetArena2Lo(); 35 | 36 | if(mem2_start) { 37 | // we're in MEM2 38 | if((heap_end+incr)>(char*)SYS_GetArena2Hi()) { 39 | // out of MEM2 case 40 | ptr->_errno = ENOMEM; 41 | prev_heap = (char *)-1; 42 | } else if ((heap_end+incr) < mem2_start) { 43 | // trying to sbrk() back below the MEM2 start barrier 44 | ptr->_errno = EINVAL; 45 | prev_heap = (char *)-1; 46 | } else { 47 | // success case 48 | prev_heap = heap_end; 49 | SYS_SetArena2Lo((void*)(heap_end+incr)); 50 | } 51 | // if MEM2 area is exactly at the barrier, transition back to MEM1 again 52 | if(SYS_GetArena2Lo() == mem2_start) mem2_start = NULL; 53 | } else { 54 | // we're in MEM1 55 | if((heap_end+incr)>(char*)SYS_GetArenaHi()) { 56 | // out of MEM1, transition into MEM2 57 | if(((char*)SYS_GetArena2Lo() + incr) > (char*)SYS_GetArena2Hi()) { 58 | // this increment doesn't fit in available MEM2 59 | ptr->_errno = ENOMEM; 60 | prev_heap = (char *)-1; 61 | } else { 62 | // MEM2 is available, move into it 63 | mem2_start = heap_end = prev_heap = SYS_GetArena2Lo(); 64 | SYS_SetArena2Lo((void*)(heap_end+incr)); 65 | } 66 | } else { 67 | // MEM1 is available (or we're freeing memory) 68 | prev_heap = heap_end; 69 | SYS_SetArenaLo((void*)(heap_end+incr)); 70 | } 71 | } 72 | } else { 73 | #endif 74 | heap_end = (char*)SYS_GetArenaLo(); 75 | 76 | if((heap_end+incr)>(char*)SYS_GetArenaHi()) { 77 | 78 | ptr->_errno = ENOMEM; 79 | prev_heap = (char *)-1; 80 | 81 | } else { 82 | 83 | prev_heap = heap_end; 84 | SYS_SetArenaLo((void*)(heap_end+incr)); 85 | } 86 | #if defined(HW_RVL) 87 | } 88 | #endif 89 | _ISR_Enable(level); 90 | 91 | return (void*)prev_heap; 92 | } 93 | -------------------------------------------------------------------------------- /libogc/sdgecko_buf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "card_cmn.h" 5 | #include "card_buf.h" 6 | 7 | //#define _POOLBUFFER_DEBUG 8 | 9 | #define BUF_POOL_CNT 3 10 | 11 | typedef struct _buf_node { 12 | struct _buf_node *next; 13 | u8 data[SECTOR_SIZE+2]; 14 | 15 | } BufNode; 16 | 17 | static BufNode s_buf[BUF_POOL_CNT]; 18 | static BufNode *s_freepool; 19 | 20 | void sdgecko_initBufferPool() 21 | { 22 | u32 i; 23 | #ifdef _POOLBUFFER_DEBUG 24 | printf("card_initBufferPool()\n"); 25 | #endif 26 | for(i=0;idata; 39 | s_freepool = s_freepool->next; 40 | } 41 | 42 | return buf; 43 | } 44 | 45 | void sdgecko_freeBuffer(u8 *buf) 46 | { 47 | if(buf) { 48 | BufNode *node = (BufNode*)(buf-offsetof(BufNode,data)); 49 | node->next = s_freepool; 50 | s_freepool = node; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /libogc/stack.inl: -------------------------------------------------------------------------------- 1 | /* stack.inl 2 | * 3 | * This file contains the RTEMS_INLINE_ROUTINE implementation of the inlined 4 | * routines from the Stack Handler. 5 | * 6 | * COPYRIGHT (c) 1989-1999. 7 | * On-Line Applications Research Corporation (OAR). 8 | * 9 | * The license and distribution terms for this file may be 10 | * found in the file LICENSE in this distribution or at 11 | * http://www.OARcorp.com/rtems/license.html. 12 | * 13 | * $Id$ 14 | */ 15 | 16 | #ifndef __STACK_inl 17 | #define __STACK_inl 18 | 19 | /*PAGE 20 | * 21 | * _Stack_Is_enough 22 | * 23 | * DESCRIPTION: 24 | * 25 | * This function returns TRUE if size bytes is enough memory for 26 | * a valid stack area on this processor, and FALSE otherwise. 27 | */ 28 | 29 | RTEMS_INLINE_ROUTINE boolean _Stack_Is_enough ( 30 | unsigned32 size 31 | ) 32 | { 33 | return ( size >= STACK_MINIMUM_SIZE ); 34 | } 35 | 36 | /*PAGE 37 | * 38 | * _Stack_Adjust_size 39 | * 40 | * DESCRIPTION: 41 | * 42 | * This function increases the stack size to insure that the thread 43 | * has the desired amount of stack space after the initial stack 44 | * pointer is determined based on alignment restrictions. 45 | * 46 | * NOTE: 47 | * 48 | * The amount of adjustment for alignment is CPU dependent. 49 | */ 50 | 51 | RTEMS_INLINE_ROUTINE unsigned32 _Stack_Adjust_size ( 52 | unsigned32 size 53 | ) 54 | { 55 | return size + CPU_STACK_ALIGNMENT; 56 | } 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /libogc/sys_state.c: -------------------------------------------------------------------------------- 1 | #include "sysstate.h" 2 | 3 | /* 4 | * The following variable contains the current system state. 5 | */ 6 | 7 | System_state_Codes _System_state_Current; 8 | -------------------------------------------------------------------------------- /libogc/texconv.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------- 2 | 3 | texconv.c - Helper functions for GX texture conversion 4 | 5 | Copyright (C) 2008 6 | softdev 7 | Michael Wiedenbauer (shagkur) 8 | Dave Murphy (WinterMute) 9 | 10 | This software is provided 'as-is', without any express or implied 11 | warranty. In no event will the authors be held liable for any 12 | damages arising from the use of this software. 13 | 14 | Permission is granted to anyone to use this software for any 15 | purpose, including commercial applications, and to alter it and 16 | redistribute it freely, subject to the following restrictions: 17 | 18 | 1. The origin of this software must not be misrepresented; you 19 | must not claim that you wrote the original software. If you use 20 | this software in a product, an acknowledgment in the product 21 | documentation would be appreciated but is not required. 22 | 23 | 2. Altered source versions must be plainly marked as such, and 24 | must not be misrepresented as being the original software. 25 | 26 | 3. This notice may not be removed or altered from any source 27 | distribution. 28 | 29 | -------------------------------------------------------------*/ 30 | #include 31 | 32 | void MakeTexture565(const void *src,void *dst,s32 width,s32 height) 33 | { 34 | register u32 tmp0=0,tmp1=0,tmp2=0,tmp3=0; 35 | 36 | __asm__ __volatile__ ( 37 | " srwi %6,%6,2\n" 38 | " srwi %7,%7,2\n" 39 | " subi %3,%4,4\n" 40 | " subi %4,%4,8\n" 41 | 42 | "2: mtctr %6\n" 43 | " mr %0,%5\n" 44 | // 45 | "1: lwz %1,0(%5)\n" 46 | " stwu %1,8(%4)\n" 47 | " lwz %2,4(%5)\n" 48 | " stwu %2,8(%3)\n" 49 | 50 | " lwz %1,1024(%5)\n" 51 | " stwu %1,8(%4)\n" 52 | " lwz %2,1028(%5)\n" 53 | " stwu %2,8(%3)\n" 54 | 55 | " lwz %1,2048(%5)\n" 56 | " stwu %1,8(%4)\n" 57 | " lwz %2,2052(%5)\n" 58 | " stwu %2,8(%3)\n" 59 | 60 | " lwz %1,3072(%5)\n" 61 | " stwu %1,8(%4)\n" 62 | " lwz %2,3076(%5)\n" 63 | " stwu %2,8(%3)\n" 64 | 65 | " addi %5,%5,8\n" 66 | " bdnz 1b\n" 67 | 68 | " addi %5,%0,4096\n" 69 | " subic. %7,%7,1\n" 70 | " bne 2b" 71 | // 0 1 2 3 72 | : "=&b"(tmp0), "=&r"(tmp1), "=&r"(tmp2), "=&b"(tmp3) 73 | // 4 5 6 7 74 | : "b"(dst), "b"(src), "r"(width), "r"(height) 75 | : "memory" 76 | ); 77 | } 78 | -------------------------------------------------------------------------------- /libogc/timesupp.h: -------------------------------------------------------------------------------- 1 | #ifndef __TIMESUPP_H__ 2 | #define __TIMESUPP_H__ 3 | 4 | #define TB_REQ 250 5 | #define TB_SUCCESSFUL 0 6 | 7 | #define TB_SECSPERMIN 60 8 | #define TB_MINSPERHR 60 9 | #define TB_MONSPERYR 12 10 | #define TB_DAYSPERYR 365 11 | #define TB_HRSPERDAY 24 12 | #define TB_SECSPERDAY (TB_SECSPERMIN*TB_MINSPERHR*TB_HRSPERDAY) 13 | #define TB_SECSPERNYR (365*TB_SECSPERDAY) 14 | 15 | #define TB_MSPERSEC 1000 16 | #define TB_USPERSEC 1000000 17 | #define TB_NSPERSEC 1000000000 18 | #define TB_NSPERMS 1000000 19 | #define TB_NSPERUS 1000 20 | #define TB_USPERTICK 10000 21 | 22 | #include 23 | 24 | time_t time(time_t *timer); 25 | unsigned int nanosleep(struct timespec *tb); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /libogc/tqdata.inl: -------------------------------------------------------------------------------- 1 | /* tqdata.inl 2 | * 3 | * This file contains the RTEMS_INLINE_ROUTINE implementation of the inlined 4 | * routines needed to support the Thread Queue Data. 5 | * 6 | * COPYRIGHT (c) 1989-1999. 7 | * On-Line Applications Research Corporation (OAR). 8 | * 9 | * The license and distribution terms for this file may be 10 | * found in the file LICENSE in this distribution or at 11 | * http://www.OARcorp.com/rtems/license.html. 12 | * 13 | * $Id$ 14 | */ 15 | 16 | #ifndef __THREAD_QUEUE_DATA_inl 17 | #define __THREAD_QUEUE_DATA_inl 18 | 19 | /*PAGE 20 | * 21 | * _Thread_queue_Enter_critical_section 22 | * 23 | * DESCRIPTION: 24 | * 25 | * This routine is invoked to indicate that the specified thread queue is 26 | * entering a critical section. 27 | */ 28 | 29 | RTEMS_INLINE_ROUTINE void _Thread_queue_Enter_critical_section ( 30 | Thread_queue_Control *the_thread_queue 31 | ) 32 | { 33 | the_thread_queue->sync_state = THREAD_QUEUE_NOTHING_HAPPENED; 34 | } 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /libogc/video_asm.S: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------- 2 | 3 | video_asm.S -- VIDEO subsystem assembler support 4 | 5 | Copyright (C) 2004 6 | Michael Wiedenbauer (shagkur) 7 | Dave Murphy (WinterMute) 8 | 9 | This software is provided 'as-is', without any express or implied 10 | warranty. In no event will the authors be held liable for any 11 | damages arising from the use of this software. 12 | 13 | Permission is granted to anyone to use this software for any 14 | purpose, including commercial applications, and to alter it and 15 | redistribute it freely, subject to the following restrictions: 16 | 17 | 1. The origin of this software must not be misrepresented; you 18 | must not claim that you wrote the original software. If you use 19 | this software in a product, an acknowledgment in the product 20 | documentation would be appreciated but is not required. 21 | 22 | 2. Altered source versions must be plainly marked as such, and 23 | must not be misrepresented as being the original software. 24 | 25 | 3. This notice may not be removed or altered from any source 26 | distribution. 27 | 28 | -------------------------------------------------------------*/ 29 | 30 | 31 | #include 32 | 33 | .globl __VIClearFramebuffer 34 | //r3 = dst, r4 = length(bytes),r5 = color 35 | __VIClearFramebuffer: 36 | srwi. r0,r4,8 37 | beq 2f 38 | mtctr r0 39 | subi r3,r3,4 40 | 1: stwu r5,4(r3) 41 | stwu r5,4(r3) 42 | stwu r5,4(r3) 43 | stwu r5,4(r3) 44 | stwu r5,4(r3) 45 | stwu r5,4(r3) 46 | stwu r5,4(r3) 47 | stwu r5,4(r3) 48 | stwu r5,4(r3) 49 | stwu r5,4(r3) 50 | stwu r5,4(r3) 51 | stwu r5,4(r3) 52 | stwu r5,4(r3) 53 | stwu r5,4(r3) 54 | stwu r5,4(r3) 55 | stwu r5,4(r3) 56 | stwu r5,4(r3) 57 | stwu r5,4(r3) 58 | stwu r5,4(r3) 59 | stwu r5,4(r3) 60 | stwu r5,4(r3) 61 | stwu r5,4(r3) 62 | stwu r5,4(r3) 63 | stwu r5,4(r3) 64 | stwu r5,4(r3) 65 | stwu r5,4(r3) 66 | stwu r5,4(r3) 67 | stwu r5,4(r3) 68 | stwu r5,4(r3) 69 | stwu r5,4(r3) 70 | stwu r5,4(r3) 71 | stwu r5,4(r3) 72 | 73 | stwu r5,4(r3) 74 | stwu r5,4(r3) 75 | stwu r5,4(r3) 76 | stwu r5,4(r3) 77 | stwu r5,4(r3) 78 | stwu r5,4(r3) 79 | stwu r5,4(r3) 80 | stwu r5,4(r3) 81 | stwu r5,4(r3) 82 | stwu r5,4(r3) 83 | stwu r5,4(r3) 84 | stwu r5,4(r3) 85 | stwu r5,4(r3) 86 | stwu r5,4(r3) 87 | stwu r5,4(r3) 88 | stwu r5,4(r3) 89 | stwu r5,4(r3) 90 | stwu r5,4(r3) 91 | stwu r5,4(r3) 92 | stwu r5,4(r3) 93 | stwu r5,4(r3) 94 | stwu r5,4(r3) 95 | stwu r5,4(r3) 96 | stwu r5,4(r3) 97 | stwu r5,4(r3) 98 | stwu r5,4(r3) 99 | stwu r5,4(r3) 100 | stwu r5,4(r3) 101 | stwu r5,4(r3) 102 | stwu r5,4(r3) 103 | stwu r5,4(r3) 104 | stwu r5,4(r3) 105 | bdnz 1b 106 | 2: blr 107 | -------------------------------------------------------------------------------- /libogc/wkspace.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Workspace Handler 3 | * 4 | * XXX 5 | * 6 | * NOTE: 7 | * 8 | * COPYRIGHT (c) 1989-1999. 9 | * On-Line Applications Research Corporation (OAR). 10 | * 11 | * The license and distribution terms for this file may be 12 | * found in the file LICENSE in this distribution or at 13 | * http://www.OARcorp.com/rtems/license.html. 14 | * 15 | * $Id$ 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include "system.h" 24 | #include "wkspace.h" 25 | 26 | #define ROUND32UP(v) (((unsigned32)(v) + 31) & ~31) 27 | 28 | Heap_Control _Workspace_Area; 29 | static Heap_Information_block __wkspace_iblock; 30 | static unsigned32 memory_available = 0; 31 | 32 | unsigned32 __lwp_wkspace_heapsize( void ) 33 | { 34 | return memory_available; 35 | } 36 | 37 | unsigned32 __lwp_wkspace_heapfree( void ) 38 | { 39 | _Heap_Get_information( &_Workspace_Area, &__wkspace_iblock ); 40 | return __wkspace_iblock.free_size; 41 | } 42 | 43 | unsigned32 __lwp_wkspace_heapused( void ) 44 | { 45 | _Heap_Get_information( &_Workspace_Area, &__wkspace_iblock ); 46 | return __wkspace_iblock.used_size; 47 | } 48 | 49 | /*PAGE 50 | * 51 | * _Workspace_Handler_initialization 52 | */ 53 | 54 | void _Workspace_Handler_initialization( 55 | unsigned32 size 56 | ) 57 | { 58 | unsigned32 starting_address; 59 | ISR_Level level; 60 | unsigned32 dsize; 61 | 62 | // Get current ArenaLo and adjust to 32-byte boundary 63 | _ISR_Disable( level ); 64 | starting_address = ROUND32UP( SYS_GetArenaLo() ); 65 | dsize = (size - (starting_address - (unsigned32)SYS_GetArenaLo())); 66 | SYS_SetArenaLo( (void *)(starting_address + dsize) ); 67 | _ISR_Enable( level ); 68 | 69 | memset( (void *)starting_address, 0, dsize ); 70 | 71 | memory_available += _Heap_Initialize( 72 | &_Workspace_Area, 73 | (void *)starting_address, 74 | dsize, 75 | CPU_HEAP_ALIGNMENT 76 | ); 77 | } 78 | -------------------------------------------------------------------------------- /libogc/wkspace.inl: -------------------------------------------------------------------------------- 1 | /* wkspace.inl 2 | * 3 | * This include file contains the bodies of the routines which contains 4 | * information related to the RAM Workspace. 5 | * 6 | * COPYRIGHT (c) 1989-1999. 7 | * On-Line Applications Research Corporation (OAR). 8 | * 9 | * The license and distribution terms for this file may be 10 | * found in the file LICENSE in this distribution or at 11 | * http://www.OARcorp.com/rtems/license.html. 12 | * 13 | * $Id$ 14 | */ 15 | 16 | #ifndef __WORKSPACE_inl 17 | #define __WORKSPACE_inl 18 | 19 | /*PAGE 20 | * 21 | * _Workspace_Allocate 22 | * 23 | * DESCRIPTION: 24 | * 25 | * This routine returns the address of a block of memory of size 26 | * bytes. If a block of the appropriate size cannot be allocated 27 | * from the workspace, then NULL is returned. 28 | */ 29 | 30 | RTEMS_INLINE_ROUTINE void *_Workspace_Allocate( 31 | unsigned32 size 32 | ) 33 | { 34 | return _Heap_Allocate( &_Workspace_Area, size ); 35 | } 36 | 37 | /*PAGE 38 | * 39 | * _Workspace_Free 40 | * 41 | * DESCRIPTION: 42 | * 43 | * This function frees the specified block of memory. If the block 44 | * belongs to the Workspace and can be successfully freed, then 45 | * TRUE is returned. Otherwise FALSE is returned. 46 | */ 47 | 48 | RTEMS_INLINE_ROUTINE boolean _Workspace_Free( 49 | void *block 50 | ) 51 | { 52 | return _Heap_Free( &_Workspace_Area, block ); 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /libogc_license.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2004 - 2009 2 | Michael Wiedenbauer (shagkur) 3 | Dave Murphy (WinterMute) 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any 7 | damages arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any 10 | purpose, including commercial applications, and to alter it and 11 | redistribute it freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you 14 | must not claim that you wrote the original software. If you use 15 | this software in a product, an acknowledgment in the product 16 | documentation would be appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and 18 | must not be misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source 20 | distribution. 21 | -------------------------------------------------------------------------------- /libtinysmb/ntlm.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * TinySMB 3 | * Nintendo Wii/GameCube SMB implementation 4 | * 5 | * NTLM authentication 6 | ****************************************************************************/ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | typedef struct 15 | { 16 | uint32_t encrypt_subkeys[32]; 17 | uint32_t decrypt_subkeys[32]; 18 | } gl_des_ctx; 19 | 20 | extern void *md4_buffer(const char *buffer, size_t len, void *resblock); 21 | extern void gl_des_setkey(gl_des_ctx *ctx, const char * key); 22 | extern void gl_des_ecb_encrypt(gl_des_ctx *ctx, const char * from, char * to); 23 | 24 | /* C89 compliant way to cast 'char' to 'unsigned char'. */ 25 | static inline unsigned char to_uchar(char ch) 26 | { 27 | return ch; 28 | } 29 | 30 | /* 31 | * turns a 56 bit key into the 64 bit, and sets the key schedule ks. 32 | */ 33 | static void ntlm_convert_key(char *key_56, gl_des_ctx * ks) 34 | { 35 | char key[8]; 36 | 37 | key[0] = to_uchar(key_56[0]); 38 | key[1] = ((to_uchar(key_56[0]) << 7) & 0xFF) | (to_uchar(key_56[1]) >> 1); 39 | key[2] = ((to_uchar(key_56[1]) << 6) & 0xFF) | (to_uchar(key_56[2]) >> 2); 40 | key[3] = ((to_uchar(key_56[2]) << 5) & 0xFF) | (to_uchar(key_56[3]) >> 3); 41 | key[4] = ((to_uchar(key_56[3]) << 4) & 0xFF) | (to_uchar(key_56[4]) >> 4); 42 | key[5] = ((to_uchar(key_56[4]) << 3) & 0xFF) | (to_uchar(key_56[5]) >> 5); 43 | key[6] = ((to_uchar(key_56[5]) << 2) & 0xFF) | (to_uchar(key_56[6]) >> 6); 44 | key[7] = (to_uchar(key_56[6]) << 1) & 0xFF; 45 | 46 | gl_des_setkey(ks, key); 47 | 48 | memset(&key, 0, sizeof(key)); 49 | } 50 | 51 | /* 52 | * takes a 21 byte array and treats it as 3 56-bit DES keys. The 53 | * 8 byte plaintext is encrypted with each key and the resulting 24 54 | * bytes are stored in the results array. 55 | */ 56 | static void ntlm_encrypt_answer(char *hash, const char *challenge, char *answer) 57 | { 58 | gl_des_ctx ks; 59 | 60 | ntlm_convert_key(hash, &ks); 61 | gl_des_ecb_encrypt(&ks, challenge, answer); 62 | 63 | ntlm_convert_key(&hash[7], &ks); 64 | gl_des_ecb_encrypt(&ks, challenge, &answer[8]); 65 | 66 | ntlm_convert_key(&hash[14], &ks); 67 | gl_des_ecb_encrypt(&ks, challenge, &answer[16]); 68 | 69 | memset(&ks, 0, sizeof(ks)); 70 | } 71 | 72 | void ntlm_smb_nt_encrypt(const char *passwd, const u8 * challenge, u8 * answer) 73 | { 74 | size_t len, i; 75 | unsigned char hash[24]; 76 | unsigned char nt_pw[256]; 77 | 78 | /* NT resp */ 79 | len = strlen(passwd); 80 | if (len > 128) 81 | len = 128; 82 | for (i = 0; i < len; ++i) 83 | { 84 | nt_pw[2 * i] = passwd[i]; 85 | nt_pw[2 * i + 1] = 0; 86 | } 87 | 88 | md4_buffer((const char *) nt_pw, len * 2, hash); 89 | 90 | memset(hash + 16, 0, 5); 91 | ntlm_encrypt_answer((char *) hash, (const char *) challenge, 92 | (char *) answer); 93 | 94 | /* with security is best be pedantic */ 95 | memset(hash, 0, sizeof(hash)); 96 | memset(nt_pw, 0, sizeof(nt_pw)); 97 | } 98 | -------------------------------------------------------------------------------- /libwiikeyboard/wsksymvar.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1997 The NetBSD Foundation, Inc. 3 | * All rights reserved. 4 | * 5 | * This code is derived from software contributed to The NetBSD Foundation 6 | * by Juergen Hannken-Illjes. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 18 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef _DEV_WSCONS_WSKSYMVAR_H_ 31 | #define _DEV_WSCONS_WSKSYMVAR_H_ 32 | 33 | #include 34 | 35 | typedef u16 keysym_t; 36 | typedef u32 kbd_t; 37 | 38 | struct wscons_keymap { 39 | keysym_t command; 40 | keysym_t group1[2]; 41 | keysym_t group2[2]; 42 | }; 43 | 44 | struct wscons_keydesc { 45 | kbd_t name; /* name of this map */ 46 | kbd_t base; /* map this one is based on */ 47 | int map_size; /* size of map */ 48 | const keysym_t *map; /* the map itself */ 49 | }; 50 | 51 | struct wskbd_mapdata { 52 | const struct wscons_keydesc *keydesc; 53 | kbd_t layout; 54 | }; 55 | 56 | /* layout variant bits ignored by mapping code */ 57 | #define KB_HANDLEDBYWSKBD KB_METAESC 58 | 59 | /* 60 | * Utility functions. 61 | */ 62 | void wskbd_get_mapentry(const struct wskbd_mapdata *, int, 63 | struct wscons_keymap *); 64 | void wskbd_init_keymap(int, struct wscons_keymap **, int *); 65 | int wskbd_load_keymap(const struct wskbd_mapdata *, 66 | struct wscons_keymap **, int *); 67 | keysym_t wskbd_compose_value(keysym_t *); 68 | 69 | #endif /* !_DEV_WSCONS_WSKSYMVAR_H_ */ 70 | -------------------------------------------------------------------------------- /lwbt/btmemb.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "asm.h" 5 | #include "processor.h" 6 | 7 | #include "bt.h" 8 | #include "btmemb.h" 9 | 10 | void btmemb_init(struct memb_blks *blk) 11 | { 12 | MEMSET(blk->mem,0,(MEM_ALIGN_SIZE(blk->size)+sizeof(u32))*blk->num); 13 | } 14 | 15 | void* btmemb_alloc(struct memb_blks *blk) 16 | { 17 | s32 i; 18 | u32 *ptr; 19 | u32 level; 20 | void *p; 21 | 22 | _ISR_Disable(level); 23 | ptr = (u32*)blk->mem; 24 | for(i=0;inum;i++) { 25 | if(*ptr==0) { 26 | ++(*ptr); 27 | p = (ptr+1); 28 | _ISR_Enable(level); 29 | return p; 30 | } 31 | ptr = (u32*)((u8*)ptr+(MEM_ALIGN_SIZE(blk->size)+sizeof(u32))); 32 | } 33 | _ISR_Enable(level); 34 | return NULL; 35 | } 36 | 37 | u8 btmemb_free(struct memb_blks *blk,void *ptr) 38 | { 39 | u8 ref; 40 | s32 i; 41 | u32 level; 42 | u32 *ptr2,*ptr1; 43 | 44 | _ISR_Disable(level); 45 | ptr1 = ptr; 46 | ptr2 = (u32*)blk->mem; 47 | for(i=0;inum;i++) { 48 | if(ptr2==(ptr1 - 1)) { 49 | ref = --(*ptr2); 50 | _ISR_Enable(level); 51 | return ref; 52 | } 53 | ptr2 = (u32*)((u8*)ptr2+(MEM_ALIGN_SIZE(blk->size)+sizeof(u32))); 54 | } 55 | _ISR_Enable(level); 56 | return -1; 57 | } 58 | 59 | u8 btmemb_ref(struct memb_blks *blk,void *ptr) 60 | { 61 | u8 ref; 62 | u32 *pref; 63 | u32 level; 64 | 65 | _ISR_Disable(level); 66 | pref = ptr-sizeof(u32); 67 | ref = ++(*pref); 68 | _ISR_Enable(level); 69 | return ref; 70 | } 71 | -------------------------------------------------------------------------------- /lwbt/btmemb.h: -------------------------------------------------------------------------------- 1 | #ifndef __BTMEMB_H__ 2 | #define __BTMEMB_H__ 3 | 4 | #include 5 | 6 | #define MEMB(name,size,num) \ 7 | static u8 memb_mem_##name[(MEM_ALIGN_SIZE(size)+sizeof(u32))*num]; \ 8 | static struct memb_blks name = {size,num,memb_mem_##name} 9 | 10 | struct memb_blks { 11 | u16 size; 12 | u16 num; 13 | u8 *mem; 14 | }; 15 | 16 | void btmemb_init(struct memb_blks *blk); 17 | void* btmemb_alloc(struct memb_blks *blk); 18 | u8 btmemb_free(struct memb_blks *blk,void *ptr); 19 | u8 btmemb_ref(struct memb_blks *blk,void *ptr); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /lwbt/btmemr.h: -------------------------------------------------------------------------------- 1 | #ifndef __BTMEMR_H__ 2 | #define __BTMEMR_H__ 3 | 4 | #include 5 | 6 | void btmemr_init(); 7 | void* btmemr_malloc(u32 size); 8 | void btmemr_free(void *ptr); 9 | void* btmemr_realloc(void *ptr,u32 newsize); 10 | void* btmemr_reallocm(void *ptr,u32 newsize); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lwbt/btpbuf.h: -------------------------------------------------------------------------------- 1 | #ifndef __BTPBUF_H__ 2 | #define __BTPBUF_H__ 3 | 4 | #include "bt.h" 5 | 6 | /* Definitions for the pbuf flag field. These are NOT the flags that 7 | * are passed to pbuf_alloc(). */ 8 | #define PBUF_FLAG_RAM 0x00U /* Flags that pbuf data is stored in RAM */ 9 | #define PBUF_FLAG_ROM 0x01U /* Flags that pbuf data is stored in ROM */ 10 | #define PBUF_FLAG_POOL 0x02U /* Flags that the pbuf comes from the pbuf pool */ 11 | #define PBUF_FLAG_REF 0x04U /* Flags thet the pbuf payload refers to RAM */ 12 | 13 | typedef enum { 14 | PBUF_TRANSPORT, 15 | PBUF_LINK, 16 | PBUF_RAW 17 | } pbuf_layer; 18 | 19 | typedef enum { 20 | PBUF_POOL, 21 | PBUF_RAM, 22 | PBUF_ROM, 23 | PBUF_REF 24 | } pbuf_flag; 25 | 26 | struct pbuf { 27 | struct pbuf *next; 28 | void *payload; 29 | u16_t tot_len; 30 | u16_t len; 31 | u16_t flags; 32 | u16_t ref; 33 | }; 34 | 35 | void btpbuf_init(); 36 | struct pbuf* btpbuf_alloc(pbuf_layer layer,u16_t len,pbuf_flag flag); 37 | u8_t btpbuf_free(struct pbuf *p); 38 | void btpbuf_realloc(struct pbuf *p,u16_t new_len); 39 | u8_t btpbuf_header(struct pbuf *p,s16_t hdr_size_inc); 40 | void btpbuf_cat(struct pbuf *h,struct pbuf *t); 41 | u8_t btpbuf_clen(struct pbuf *p); 42 | void btpbuf_queue(struct pbuf *p,struct pbuf *n); 43 | void btpbuf_ref(struct pbuf *p); 44 | void btpbuf_chain(struct pbuf *h,struct pbuf *t); 45 | struct pbuf* btpbuf_dequeue(struct pbuf *p); 46 | struct pbuf* btpbuf_dechain(struct pbuf *p); 47 | struct pbuf* btpbuf_take(struct pbuf *p); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /lwbt/physbusif.h: -------------------------------------------------------------------------------- 1 | #ifndef __PHYSBUSIF_H__ 2 | #define __PHYSBUSIF_H__ 3 | 4 | #include "btpbuf.h" 5 | 6 | typedef struct _usb_p usb_p; 7 | typedef s32 (*pbcallback)(s32 state,s32 result,usb_p *usb); 8 | 9 | struct _usb_p 10 | { 11 | s32 fd; 12 | u8 acl_out; 13 | u8 acl_in; 14 | u8 hci_evt; 15 | u8 hci_ctrl; 16 | u32 vid; 17 | u32 pid; 18 | u8 openstate; 19 | pbcallback closecb; 20 | pbcallback unregcb; 21 | }; 22 | 23 | void physbusif_init(); 24 | void physbusif_close(); 25 | void physbusif_shutdown(); 26 | void physbusif_reset_all(); 27 | void physbusif_output(struct pbuf *p,u16_t len); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /lwip/netio.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #undef errno 6 | extern int errno; 7 | 8 | #include 9 | #include "lwip/ip_addr.h" 10 | #include "network.h" 11 | int netio_open(struct _reent *r, void *fileStruct, const char *path,int flags,int mode); 12 | int netio_close(struct _reent *r,int fd); 13 | int netio_write(struct _reent *r,int fd,const char *ptr,size_t len); 14 | int netio_read(struct _reent *r,int fd,char *ptr,size_t len); 15 | 16 | //--------------------------------------------------------------------------------- 17 | const devoptab_t dotab_stdnet = { 18 | //--------------------------------------------------------------------------------- 19 | "stdnet", // device name 20 | 0, // size of file structure 21 | netio_open, // device open 22 | netio_close, // device close 23 | netio_write, // device write 24 | netio_read, // device read 25 | NULL, // device seek 26 | NULL, // device fstat 27 | NULL, // device stat 28 | NULL, // device link 29 | NULL, // device unlink 30 | NULL, // device chdir 31 | NULL, // device rename 32 | NULL, // device mkdir 33 | 0, // dirStateSize 34 | NULL, // device diropen_r 35 | NULL, // device dirreset_r 36 | NULL, // device dirnext_r 37 | NULL, // device dirclose_r 38 | NULL // device statvfs_r 39 | }; 40 | 41 | int netio_open(struct _reent *r, void *fileStruct, const char *path,int flags,int mode) 42 | { 43 | char *cport = NULL; 44 | int optval = 1,nport = -1,udp_sock = INVALID_SOCKET; 45 | struct sockaddr_in name; 46 | socklen_t namelen = sizeof(struct sockaddr); 47 | 48 | if(net_init()==SOCKET_ERROR) return -1; 49 | 50 | udp_sock = net_socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); 51 | if(udp_sock==INVALID_SOCKET) return -1; 52 | 53 | cport = strchr(path,':'); 54 | if(cport) { 55 | *cport++ = '\0'; 56 | nport = atoi(cport); 57 | } 58 | if(nport==-1) nport = 7; //try to connect to the well known port 7 59 | 60 | name.sin_addr.s_addr = inet_addr(path); 61 | name.sin_port = htons(nport); 62 | name.sin_family = AF_INET; 63 | if(net_connect(udp_sock,(struct sockaddr*)&name,namelen)==-1) { 64 | net_close(udp_sock); 65 | return -1; 66 | } 67 | net_setsockopt(udp_sock,IPPROTO_TCP,TCP_NODELAY,&optval,sizeof(optval)); 68 | 69 | return udp_sock; 70 | } 71 | 72 | int netio_close(struct _reent *r,int fd) 73 | { 74 | if(fd<0) return -1; 75 | 76 | net_close(fd); 77 | 78 | return 0; 79 | } 80 | 81 | int netio_write(struct _reent *r,int fd,const char *ptr,size_t len) 82 | { 83 | int ret; 84 | 85 | if(fd<0) return -1; 86 | 87 | ret = net_write(fd,(void*)ptr,len); 88 | 89 | return ret; 90 | } 91 | 92 | int netio_read(struct _reent *r,int fd,char *ptr,size_t len) 93 | { 94 | int ret; 95 | 96 | if(fd<0) return -1; 97 | 98 | ret = net_read(fd,ptr,len); 99 | 100 | return ret; 101 | } 102 | -------------------------------------------------------------------------------- /wiiuse/classic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wiiuse 3 | * 4 | * Written By: 5 | * Michael Laforest < para > 6 | * Email: < thepara (--AT--) g m a i l [--DOT--] com > 7 | * 8 | * Copyright 2006-2007 9 | * 10 | * This file is part of wiiuse. 11 | * 12 | * This program is free software; you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation; either version 3 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program. If not, see . 24 | * 25 | * $Header: /lvm/shared/ds/ds/cvs/devkitpro-cvsbackup/libogc/wiiuse/classic.h,v 1.1 2008-05-08 09:42:14 shagkur Exp $ 26 | * 27 | */ 28 | 29 | /** 30 | * @file 31 | * @brief Classic controller expansion device. 32 | */ 33 | 34 | #ifndef CLASSIC_H_INCLUDED 35 | #define CLASSIC_H_INCLUDED 36 | 37 | #include "wiiuse_internal.h" 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | int classic_ctrl_handshake(struct wiimote_t* wm, struct classic_ctrl_t* cc, ubyte* data, uword len); 44 | 45 | void classic_ctrl_disconnected(struct classic_ctrl_t* cc); 46 | 47 | void classic_ctrl_event(struct classic_ctrl_t* cc, ubyte* msg); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif // CLASSIC_H_INCLUDED 54 | -------------------------------------------------------------------------------- /wiiuse/definitions.h: -------------------------------------------------------------------------------- 1 | #ifndef __DEFINITIONS_H__ 2 | #define __DEFINITIONS_H__ 3 | 4 | #include "os.h" 5 | 6 | #define WIIMOTE_PI 3.14159265f 7 | 8 | //#define WITH_WIIUSE_DEBUG 9 | 10 | /* Error output macros */ 11 | #define WIIUSE_ERROR(fmt, ...) fprintf(stderr, "[ERROR] " fmt "\n", ##__VA_ARGS__) 12 | 13 | /* Warning output macros */ 14 | #define WIIUSE_WARNING(fmt, ...) fprintf(stderr, "[WARNING] " fmt "\n", ##__VA_ARGS__) 15 | 16 | /* Information output macros */ 17 | #define WIIUSE_INFO(fmt, ...) fprintf(stderr, "[INFO] " fmt "\n", ##__VA_ARGS__) 18 | 19 | #ifdef WITH_WIIUSE_DEBUG 20 | #ifdef WIN32 21 | #define WIIUSE_DEBUG(fmt, ...) do { \ 22 | char* file = __FILE__; \ 23 | int i = strlen(file) - 1; \ 24 | for (; i && (file[i] != '\\'); --i); \ 25 | fprintf(stderr, "[DEBUG] %s:%i: " fmt "\n", file+i+1, __LINE__, ##__VA_ARGS__); \ 26 | } while (0) 27 | #else 28 | #define WIIUSE_DEBUG(fmt, ...) fprintf(stderr, "[DEBUG] " __FILE__ ":%i: " fmt "\n", __LINE__, ##__VA_ARGS__) 29 | #endif 30 | #else 31 | #define WIIUSE_DEBUG(fmt, ...) 32 | #endif 33 | 34 | #if 1 35 | #define WII_DEBUG(fmt, ...) do { \ 36 | printf("[WDEBUG] " __FILE__ ":%i: " fmt "\n", __LINE__, ##__VA_ARGS__); \ 37 | usleep(3000000); \ 38 | } while (0) 39 | #else 40 | #define WII_DEBUG(fmt, ...) 41 | #endif 42 | 43 | 44 | /* Convert between radians and degrees */ 45 | #define RAD_TO_DEGREE(r) ((r * 180.0f) / WIIMOTE_PI) 46 | #define DEGREE_TO_RAD(d) (d * (WIIMOTE_PI / 180.0f)) 47 | 48 | /* Convert to big endian */ 49 | #define BIG_ENDIAN_LONG(i) (htonl(i)) 50 | #define BIG_ENDIAN_SHORT(i) (htons(i)) 51 | 52 | #define absf(x) ((x >= 0) ? (x) : (x * -1.0f)) 53 | #define diff_f(x, y) ((x >= y) ? (absf(x - y)) : (absf(y - x))) 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /wiiuse/dynamics.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wiiuse 3 | * 4 | * Written By: 5 | * Michael Laforest < para > 6 | * Email: < thepara (--AT--) g m a i l [--DOT--] com > 7 | * 8 | * Copyright 2006-2007 9 | * 10 | * This file is part of wiiuse. 11 | * 12 | * This program is free software; you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation; either version 3 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program. If not, see . 24 | * 25 | * $Header: /lvm/shared/ds/ds/cvs/devkitpro-cvsbackup/libogc/wiiuse/dynamics.h,v 1.2 2008-11-14 13:34:57 shagkur Exp $ 26 | * 27 | */ 28 | 29 | /** 30 | * @file 31 | * @brief Handles the dynamics of the wiimote. 32 | * 33 | * The file includes functions that handle the dynamics 34 | * of the wiimote. Such dynamics include orientation and 35 | * motion sensing. 36 | */ 37 | 38 | #ifndef DYNAMICS_H_INCLUDED 39 | #define DYNAMICS_H_INCLUDED 40 | 41 | #include "wiiuse_internal.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | void calculate_orientation(struct accel_t* ac, struct vec3w_t* accel, struct orient_t* orient, int smooth); 48 | void calculate_gforce(struct accel_t* ac, struct vec3w_t* accel, struct gforce_t* gforce); 49 | void calc_joystick_state(struct joystick_t* js, float x, float y); 50 | void calc_balanceboard_state(struct wii_board_t *wb); 51 | void apply_smoothing(struct accel_t* ac, struct orient_t* orient, int type); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif // DYNAMICS_H_INCLUDED 58 | -------------------------------------------------------------------------------- /wiiuse/events.h: -------------------------------------------------------------------------------- 1 | #ifndef __EVENTS_H__ 2 | #define __EVENTS_H__ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | void wiiuse_pressed_buttons(struct wiimote_t* wm, ubyte* msg); 9 | 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /wiiuse/guitar_hero_3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wiiuse 3 | * 4 | * Written By: 5 | * Michael Laforest < para > 6 | * Email: < thepara (--AT--) g m a i l [--DOT--] com > 7 | * 8 | * Copyright 2006-2007 9 | * 10 | * This file is part of wiiuse. 11 | * 12 | * This program is free software; you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation; either version 3 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program. If not, see . 24 | * 25 | * $Header: /lvm/shared/ds/ds/cvs/devkitpro-cvsbackup/libogc/wiiuse/guitar_hero_3.h,v 1.1 2008-05-08 09:42:14 shagkur Exp $ 26 | * 27 | */ 28 | 29 | /** 30 | * @file 31 | * @brief Guitar Hero 3 expansion device. 32 | */ 33 | 34 | #ifndef GUITAR_HERO_3_H_INCLUDED 35 | #define GUITAR_HERO_3_H_INCLUDED 36 | 37 | #include "wiiuse_internal.h" 38 | 39 | #define GUITAR_HERO_3_JS_MASK 0x3F 40 | #define GUITAR_HERO_3_TOUCH_MASK 0x1F 41 | #define GUITAR_HERO_3_WHAMMY_MASK 0x1F 42 | 43 | #define GUITAR_HERO_3_JS_MIN_X 0x05 44 | #define GUITAR_HERO_3_JS_MAX_X 0x3C 45 | #define GUITAR_HERO_3_JS_CENTER_X 0x20 46 | #define GUITAR_HERO_3_JS_MIN_Y 0x05 47 | #define GUITAR_HERO_3_JS_MAX_Y 0x3A 48 | #define GUITAR_HERO_3_JS_CENTER_Y 0x20 49 | #define GUITAR_HERO_3_WHAMMY_BAR_MIN 0x0F 50 | #define GUITAR_HERO_3_WHAMMY_BAR_MAX 0x1A 51 | 52 | #ifdef __cplusplus 53 | extern "C" { 54 | #endif 55 | 56 | int guitar_hero_3_handshake(struct wiimote_t* wm, struct guitar_hero_3_t* gh3, ubyte* data, uword len); 57 | 58 | void guitar_hero_3_disconnected(struct guitar_hero_3_t* gh3); 59 | 60 | void guitar_hero_3_event(struct guitar_hero_3_t* gh3, ubyte* msg); 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif // GUITAR_HERO_3_H_INCLUDED 67 | -------------------------------------------------------------------------------- /wiiuse/io.h: -------------------------------------------------------------------------------- 1 | #ifndef __IO_H__ 2 | #define __IO_H__ 3 | 4 | #include "wiiuse_internal.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void wiiuse_handshake(struct wiimote_t* wm,ubyte *data,uword len); 11 | void wiiuse_handshake_expansion_start(struct wiimote_t *wm); 12 | void wiiuse_handshake_expansion(struct wiimote_t *wm,ubyte *data,uword len); 13 | void wiiuse_disable_expansion(struct wiimote_t *wm); 14 | 15 | int wiiuse_io_read(struct wiimote_t* wm); 16 | int wiiuse_io_write(struct wiimote_t* wm, ubyte* buf, int len); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /wiiuse/ir.h: -------------------------------------------------------------------------------- 1 | #ifndef __IR_H__ 2 | #define __IR_H__ 3 | 4 | #include "wiiuse_internal.h" 5 | 6 | #define WII_VRES_X 560 7 | #define WII_VRES_Y 340 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | void calculate_basic_ir(struct wiimote_t* wm, ubyte* data); 14 | void calculate_extended_ir(struct wiimote_t* wm, ubyte* data); 15 | float calc_yaw(struct ir_t* ir); 16 | void interpret_ir_data(struct ir_t* ir, struct orient_t *orient); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /wiiuse/motion_plus.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #ifdef WIN32 7 | #include 8 | #endif 9 | 10 | #include "definitions.h" 11 | #include "wiiuse_internal.h" 12 | #include "dynamics.h" 13 | #include "events.h" 14 | #include "wiiboard.h" 15 | #include "io.h" 16 | 17 | void wiiuse_motion_plus_check(struct wiimote_t *wm,ubyte *data,uword len) 18 | { 19 | u32 val; 20 | if(data == NULL) 21 | { 22 | wiiuse_read_data(wm, wm->motion_plus_id, WM_EXP_ID, 6, wiiuse_motion_plus_check); 23 | } 24 | else 25 | { 26 | WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP); 27 | WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_FAILED); 28 | WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE); 29 | val = (data[3] << 16) | (data[2] << 24) | (data[4] << 8) | data[5]; 30 | if(val == EXP_ID_CODE_MOTION_PLUS) 31 | { 32 | /* handshake done */ 33 | wm->event = WIIUSE_MOTION_PLUS_ACTIVATED; 34 | wm->exp.type = EXP_MOTION_PLUS; 35 | 36 | WIIMOTE_ENABLE_STATE(wm,WIIMOTE_STATE_EXP); 37 | wiiuse_set_ir_mode(wm); 38 | } 39 | } 40 | } 41 | 42 | static void wiiuse_set_motion_plus_clear2(struct wiimote_t *wm,ubyte *data,uword len) 43 | { 44 | WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP); 45 | WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_FAILED); 46 | WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE); 47 | wiiuse_set_ir_mode(wm); 48 | wiiuse_status(wm,NULL); 49 | } 50 | 51 | static void wiiuse_set_motion_plus_clear1(struct wiimote_t *wm,ubyte *data,uword len) 52 | { 53 | ubyte val = 0x00; 54 | wiiuse_write_data(wm,WM_EXP_MEM_ENABLE1,&val,1,wiiuse_set_motion_plus_clear2); 55 | } 56 | 57 | 58 | void wiiuse_set_motion_plus(struct wiimote_t *wm, int status) 59 | { 60 | ubyte val; 61 | 62 | if(WIIMOTE_IS_SET(wm,WIIMOTE_STATE_EXP_HANDSHAKE)) 63 | return; 64 | 65 | WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE); 66 | if(status) 67 | { 68 | val = 0x04; 69 | wiiuse_write_data(wm,WM_EXP_MOTION_PLUS_ENABLE,&val,1,wiiuse_motion_plus_check); 70 | } 71 | else 72 | { 73 | wiiuse_disable_expansion(wm); 74 | val = 0x55; 75 | wiiuse_write_data(wm,WM_EXP_MEM_ENABLE1,&val,1,wiiuse_set_motion_plus_clear1); 76 | } 77 | } 78 | 79 | void motion_plus_disconnected(struct motion_plus_t* mp) 80 | { 81 | WIIUSE_DEBUG("Motion plus disconnected"); 82 | memset(mp, 0, sizeof(struct motion_plus_t)); 83 | } 84 | 85 | void motion_plus_event(struct motion_plus_t* mp, ubyte* msg) 86 | { 87 | mp->rx = ((msg[5] & 0xFC) << 6) | msg[2]; // Pitch 88 | mp->ry = ((msg[4] & 0xFC) << 6) | msg[1]; // Roll 89 | mp->rz = ((msg[3] & 0xFC) << 6) | msg[0]; // Yaw 90 | 91 | mp->ext = msg[4] & 0x1; 92 | mp->status = (msg[3] & 0x3) | ((msg[4] & 0x2) << 1); // roll, yaw, pitch 93 | } 94 | -------------------------------------------------------------------------------- /wiiuse/motion_plus.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @brief Motion plus extension 4 | */ 5 | 6 | #ifndef MOTION_PLUS_H_INCLUDED 7 | #define MOTION_PLUS_H_INCLUDED 8 | 9 | #include "wiiuse_internal.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | void motion_plus_disconnected(struct motion_plus_t* mp); 16 | 17 | void motion_plus_event(struct motion_plus_t* mp, ubyte* msg); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /wiiuse/nunchuk.h: -------------------------------------------------------------------------------- 1 | #ifndef __NUNCHUK_H__ 2 | #define __NUNCHUK_H__ 3 | 4 | #include "wiiuse_internal.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | int nunchuk_handshake(struct wiimote_t* wm, struct nunchuk_t* nc, ubyte* data, uword len); 11 | void nunchuk_disconnected(struct nunchuk_t* nc); 12 | void nunchuk_event(struct nunchuk_t* nc, ubyte* msg); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /wiiuse/os.h: -------------------------------------------------------------------------------- 1 | #ifndef __OS_H__ 2 | #define __OS_H__ 3 | 4 | #ifdef WIN32 5 | /* windows */ 6 | #define isnan(x) _isnan(x) 7 | #define isinf(x) !_finite(x) 8 | 9 | /* disable warnings I don't care about */ 10 | #pragma warning(disable:4244) /* possible loss of data conversion */ 11 | #pragma warning(disable:4273) /* inconsistent dll linkage */ 12 | #pragma warning(disable:4217) 13 | #else 14 | /* nix/gekko */ 15 | #ifdef GEKKO 16 | #include 17 | #include 18 | #include "bte.h" 19 | #include "network.h" 20 | #include "chain.h" 21 | #include "asm.h" 22 | #include "processor.h" 23 | #include "wkspace.h" 24 | #else 25 | #endif 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /wiiuse/speaker.h: -------------------------------------------------------------------------------- 1 | #ifndef __SPEAKER_H__ 2 | #define __SPEAKER_H__ 3 | 4 | #include "wiiuse_internal.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | typedef struct _wencstatus 11 | { 12 | s32 predictor; 13 | s16 step_index; 14 | s32 step; 15 | s32 prev_sample; 16 | s16 sample1; 17 | s16 sample2; 18 | s32 coeff1; 19 | s32 coeff2; 20 | s32 idelta; 21 | } WENCStatus; 22 | 23 | u8 wencdata(WENCStatus *info,s16 sample); 24 | void set_speakervol(struct wiimote_t *wm,ubyte vol); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /wiiuse/wiiboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wiiuse 3 | * 4 | * Written By: 5 | * Michael Laforest < para > 6 | * Email: < thepara (--AT--) g m a i l [--DOT--] com > 7 | * 8 | * Copyright 2006-2007 9 | * 10 | * This file is part of wiiuse. 11 | * 12 | * This program is free software; you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation; either version 3 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program. If not, see . 24 | * 25 | * $Header: /cvsroot/devkitpro/libogc/wiiuse/wiiboard.h,v 1.1 2008/05/08 09:42:14 shagkur Exp $ 26 | * 27 | */ 28 | 29 | /** 30 | * @file 31 | * @brief Wii board expansion device. 32 | */ 33 | 34 | #ifndef WII_BOARD_H_INCLUDED 35 | #define WII_BOARD_H_INCLUDED 36 | 37 | #include "wiiuse_internal.h" 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | int wii_board_handshake(struct wiimote_t* wm, struct wii_board_t* wb, ubyte* data, uword len); 44 | 45 | void wii_board_disconnected(struct wii_board_t* wb); 46 | 47 | void wii_board_event(struct wii_board_t* wb, ubyte* msg); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif 54 | --------------------------------------------------------------------------------