diff --git a/gc/ogc/timesupp.h b/gc/ogc/timesupp.h index 14592a42..ab5ceac6 100644 --- a/gc/ogc/timesupp.h +++ b/gc/ogc/timesupp.h @@ -48,18 +48,20 @@ extern "C" { #endif -extern u32 gettick(void); -extern u64 gettime(void); -extern void settime(u64); +u32 gettick(void); +u64 gettime(void); +void settime(u64 time); -extern void __SYS_SetTime(s64 time); -extern s64 __SYS_GetSystemTime(void); +void __SYS_SetTime(s64 time); +s64 __SYS_GetSystemTime(void); u32 diff_sec(u64 start,u64 end); u32 diff_msec(u64 start,u64 end); u32 diff_usec(u64 start,u64 end); u32 diff_nsec(u64 start,u64 end); +void udelay(u32 usec); + #ifdef __cplusplus } #endif diff --git a/libasnd/asndlib.c b/libasnd/asndlib.c index dfc966e4..8636ac12 100644 --- a/libasnd/asndlib.c +++ b/libasnd/asndlib.c @@ -98,8 +98,6 @@ static t_sound_data sound_data_dma ATTRIBUTE_ALIGN(32); static s16 mute_buf[SND_BUFFERSIZE] ATTRIBUTE_ALIGN(32); static s16 audio_buf[2][SND_BUFFERSIZE] ATTRIBUTE_ALIGN(32); -extern u32 gettick(); - static __inline__ char* snd_set0b( char *p, int n) { while(n>0) {*p++=0;n--;} diff --git a/libdb/tcpip.c b/libdb/tcpip.c index 997d0644..697bc7a6 100644 --- a/libdb/tcpip.c +++ b/libdb/tcpip.c @@ -4,6 +4,7 @@ #include "asm.h" #include "processor.h" +#include "timesupp.h" #include "uIP/bba.h" #include "uIP/memr.h" @@ -49,9 +50,6 @@ static struct uip_netif netif; static struct dbginterface netif_device; static struct tcpip_sock *tcpip_accepted_sockets = NULL; -extern s64 gettime(void); -extern u32 diff_msec(s64 start,s64 end); - static s32_t tcpip_allocsocket(struct uip_tcp_pcb *pcb) { s32_t i; diff --git a/libdb/uIP/bba.c b/libdb/uIP/bba.c index 97d345ab..69454b50 100644 --- a/libdb/uIP/bba.c +++ b/libdb/uIP/bba.c @@ -6,6 +6,7 @@ #include "exi.h" #include "cache.h" #include "bba.h" +#include "timesupp.h" #include "uip_pbuf.h" #include "uip_netif.h" #include "uip_arp.h" @@ -230,11 +231,6 @@ static void bba_outs(u32 reg,void *val,u32 len); static void bba_devpoll(u16 *pstatus); -extern void udelay(int us); -extern u32 diff_msec(long long start,long long end); -extern u32 diff_usec(long long start,long long end); -extern long long gettime(); - static __inline__ void bba_cmd_insnosel(u32 reg,void *val,u32 len) { u16 req; diff --git a/libdb/uIP/uip_ip.c b/libdb/uIP/uip_ip.c index 80324d73..fa625054 100644 --- a/libdb/uIP/uip_ip.c +++ b/libdb/uIP/uip_ip.c @@ -45,8 +45,6 @@ static u8_t uip_reassflags; static u8_t uip_reasstmr; static s64 uip_reasstime = 0; -extern s64 gettime(void); - static struct uip_pbuf* uip_copyfrom_pbuf(struct uip_pbuf *p,u16_t *offset,u8_t *buffer,u16_t len) { u16_t l; diff --git a/libmodplay/gcmodplay.c b/libmodplay/gcmodplay.c index bc777587..62dbca85 100644 --- a/libmodplay/gcmodplay.c +++ b/libmodplay/gcmodplay.c @@ -35,8 +35,6 @@ static AESNDPB *modvoice = NULL; #ifdef _GCMOD_DEBUG static u64 mixtime = 0; static u64 reqcbtime = 0; -extern u32 diff_usec(unsigned long long start,unsigned long long end); -extern u32 diff_msec(unsigned long long start,unsigned long long end); #endif static void* player(void *arg) diff --git a/libogc/card.c b/libogc/card.c index d7ecef69..bc42f8fd 100644 --- a/libogc/card.c +++ b/libogc/card.c @@ -41,9 +41,9 @@ distribution. #include "cache.h" #include "dsp.h" #include "lwp.h" -#include "timesupp.h" #include "exi.h" #include "card.h" +#include "timesupp.h" //#define _CARD_DEBUG diff --git a/libogc/dvd.c b/libogc/dvd.c index 6a1aa9a3..a1f18b46 100644 --- a/libogc/dvd.c +++ b/libogc/dvd.c @@ -45,6 +45,7 @@ distribution. #include "ogcsys.h" #include "system.h" #include "dvd.h" +#include "timesupp.h" //#define _DVD_DEBUG @@ -412,13 +413,8 @@ s32 DVD_GcodeLowRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb); s32 DVD_GcodeLowWriteBuffer(void *buf,u32 len,dvdcallbacklow cb); s32 DVD_GcodeLowWrite(u32 len,u32 offset,dvdcallbacklow cb); -extern void udelay(int us); -extern u32 diff_msec(unsigned long long start,unsigned long long end); -extern void __MaskIrq(u32); -extern void __UnmaskIrq(u32); extern syssramex* __SYS_LockSramEx(void); extern u32 __SYS_UnlockSramEx(u32 write); -extern s64 __SYS_GetSystemTime(void); static u8 err2num(u32 errorcode) { diff --git a/libogc/exception.c b/libogc/exception.c index b9c32105..417d1db2 100644 --- a/libogc/exception.c +++ b/libogc/exception.c @@ -63,7 +63,6 @@ static int reload_timer = -1; void __exception_sethandler(u32 nExcept, void (*pHndl)(frame_context*)); -extern void udelay(int us); extern void fpu_exceptionhandler(frame_context*); extern void irq_exceptionhandler(frame_context*); extern void dec_exceptionhandler(frame_context*); diff --git a/libogc/ios.c b/libogc/ios.c index a2ac7eb6..0eea529c 100644 --- a/libogc/ios.c +++ b/libogc/ios.c @@ -40,6 +40,7 @@ distribution. #include "es.h" #include "ios.h" #include "irq.h" +#include "timesupp.h" #define IOS_HEAP_SIZE 0x1000 #define MAX_IPC_RETRIES 400 @@ -50,7 +51,6 @@ distribution. #define IOS_MIN_VERSION 28 static s32 __ios_hid = -1; -extern void udelay(int us); s32 __IOS_InitHeap(void) { diff --git a/libogc/ipc.c b/libogc/ipc.c index 4dc7bd6d..b20eca2f 100644 --- a/libogc/ipc.c +++ b/libogc/ipc.c @@ -45,6 +45,7 @@ distribution. #include "ipc.h" #include "cache.h" #include "system.h" +#include "timesupp.h" #include "lwp_heap.h" #include "lwp_wkspace.h" @@ -170,13 +171,9 @@ static struct _ipcheap _ipc_heaps[IPC_NUMHEAPS] = static vu32* const _ipcReg = (u32*)0xCD000000; -extern void __MaskIrq(u32 nMask); -extern void __UnmaskIrq(u32 nMask); extern void* __SYS_GetIPCBufferLo(void); extern void* __SYS_GetIPCBufferHi(void); -extern u32 gettick(void); - static __inline__ u32 IPC_ReadReg(u32 reg) { return _ipcReg[reg]; diff --git a/libogc/pad.c b/libogc/pad.c index 9ab0639f..811b1641 100644 --- a/libogc/pad.c +++ b/libogc/pad.c @@ -78,8 +78,6 @@ static sys_resetinfo pad_resetinfo = { 127 }; -extern void udelay(int); - static s32 __pad_onreset(s32 final) { u32 ret; diff --git a/libogc/sdgecko_io.c b/libogc/sdgecko_io.c index ed959d86..de60a053 100644 --- a/libogc/sdgecko_io.c +++ b/libogc/sdgecko_io.c @@ -13,6 +13,7 @@ #include "card_cmn.h" //#include "card_fat.h" #include "card_io.h" +#include "timesupp.h" //#define _CARDIO_DEBUG #ifdef _CARDIO_DEBUG @@ -86,8 +87,6 @@ static u32 _initType[MAX_DRIVE]; static u32 _ioAddressingType[MAX_DRIVE]; static u32 _ioTransferMode[MAX_DRIVE]; -extern unsigned long gettick(void); - static __inline__ u32 __check_response(s32 drv_no,u8 res) { if(drv_no<0 || drv_no>=MAX_DRIVE) return CARDIO_ERROR_NOCARD; diff --git a/libogc/timesupp.c b/libogc/timesupp.c index b2376723..373e60b8 100644 --- a/libogc/timesupp.c +++ b/libogc/timesupp.c @@ -139,14 +139,14 @@ int __syscall_clock_getres(clockid_t clock_id, struct timespec *res) } // this function spins till timeout is reached -void udelay(unsigned us) +void udelay(u32 usec) { - unsigned long long start, end; + u64 start, end; start = gettime(); while (1) { end = gettime(); - if (diff_usec(start,end) >= us) + if (diff_usec(start,end) >= usec) break; } } diff --git a/libogc/video.c b/libogc/video.c index 62782a54..2014defd 100644 --- a/libogc/video.c +++ b/libogc/video.c @@ -45,6 +45,7 @@ video.c -- VIDEO subsystem #include "system.h" #include "video.h" #include "video_types.h" +#include "timesupp.h" //#define _VIDEO_DEBUG @@ -1653,8 +1654,6 @@ static vu16* const _viReg = (u16*)0xCC002000; extern void __VIClearFramebuffer(void*,u32,u32); -extern void udelay(int us); - #ifdef _VIDEO_DEBUG static u32 messages$128 = 0; static u32 printregs = 1; diff --git a/lwip/arch/gc/netif/gcif.c b/lwip/arch/gc/netif/gcif.c index aaeea6b8..da35d0db 100644 --- a/lwip/arch/gc/netif/gcif.c +++ b/lwip/arch/gc/netif/gcif.c @@ -208,8 +208,6 @@ static struct netif *gc_netif = NULL; static err_t __bba_link_tx(struct netif *dev,struct pbuf *p); static u32 __bba_rx_err(u8 status,struct bba_priv *priv); -extern void udelay(int us); - /* new functions */ #define bba_select() EXI_Select(EXI_CHANNEL_0,EXI_DEVICE_2,EXI_SPEED32MHZ) #define bba_deselect() EXI_Deselect(EXI_CHANNEL_0)