Add more (void) and remove more service handle parameters

This commit is contained in:
fincs 2015-11-05 11:48:23 +01:00
parent e4775572c2
commit 2ce51cf3d8
7 changed files with 17 additions and 22 deletions

View File

@ -12,10 +12,9 @@ Result acExit(void);
/** /**
* @brief Gets the current Wifi status. * @brief Gets the current Wifi status.
* @param servhandle Optional pointer to the service handle to use.
* @param out Pointer to output the current Wifi status to. (0 = not connected, 1 = O3DS Internet, 2 = N3DS Internet) * @param out Pointer to output the current Wifi status to. (0 = not connected, 1 = O3DS Internet, 2 = N3DS Internet)
*/ */
Result ACU_GetWifiStatus(Handle* servhandle, u32 *out); Result ACU_GetWifiStatus(u32 *out);
/// Waits for the system to connect to the internet. /// Waits for the system to connect to the internet.
Result ACU_WaitInternetConnection(void); Result ACU_WaitInternetConnection(void);

View File

@ -11,7 +11,7 @@
Result CFGNOR_Initialize(u8 value); Result CFGNOR_Initialize(u8 value);
/// Shuts down CFGNOR. /// Shuts down CFGNOR.
Result CFGNOR_Shutdown(); Result CFGNOR_Shutdown(void);
/** /**
* @brief Reads data from NOR. * @brief Reads data from NOR.

View File

@ -1,6 +1,6 @@
/** /**
* @file csnd.h * @file csnd.h
* @brief CSND service. * @brief CSND service. Usage of this service is deprecated in favor of NDSP.
*/ */
#pragma once #pragma once

View File

@ -11,10 +11,10 @@
#include <3ds/types.h> #include <3ds/types.h>
/// Initializes HB. /// Initializes HB.
Result hbInit(); Result hbInit(void);
/// Exits HB. /// Exits HB.
void hbExit(); void hbExit(void);
/// Flushes/invalidates the entire data/instruction cache. /// Flushes/invalidates the entire data/instruction cache.
Result HB_FlushInvalidateCache(void); Result HB_FlushInvalidateCache(void);

View File

@ -20,9 +20,8 @@ Result acExit(void)
} }
// ptr=0x200-byte outbuf // ptr=0x200-byte outbuf
Result ACU_CreateDefaultConfig(Handle* servhandle, u32 *ptr) Result ACU_CreateDefaultConfig(u32 *ptr)
{ {
if(!servhandle)servhandle=&acHandle;
Result ret=0; Result ret=0;
u32 *cmdbuf = getThreadCommandBuffer(); u32 *cmdbuf = getThreadCommandBuffer();
u32 *staticbufs = getThreadStaticBuffers(); u32 *staticbufs = getThreadStaticBuffers();
@ -34,7 +33,7 @@ Result ACU_CreateDefaultConfig(Handle* servhandle, u32 *ptr)
staticbufs[0] = IPC_Desc_StaticBuffer(0x200,0); staticbufs[0] = IPC_Desc_StaticBuffer(0x200,0);
staticbufs[1] = (u32)ptr; staticbufs[1] = (u32)ptr;
if((ret = svcSendSyncRequest(*servhandle))!=0)return ret; if((ret = svcSendSyncRequest(acHandle))!=0)return ret;
staticbufs[0] = savedValue0; staticbufs[0] = savedValue0;
staticbufs[1] = savedValue1; staticbufs[1] = savedValue1;
@ -43,9 +42,8 @@ Result ACU_CreateDefaultConfig(Handle* servhandle, u32 *ptr)
} }
// Unknown what this cmd does at the time of writing. (ptr=0x200-byte inbuf/outbuf) // Unknown what this cmd does at the time of writing. (ptr=0x200-byte inbuf/outbuf)
Result ACU_cmd26(Handle* servhandle, u32 *ptr, u8 val) Result ACU_cmd26(u32 *ptr, u8 val)
{ {
if(!servhandle)servhandle=&acHandle;
Result ret=0; Result ret=0;
u32 *cmdbuf = getThreadCommandBuffer(); u32 *cmdbuf = getThreadCommandBuffer();
u32 *staticbufs = getThreadStaticBuffers(); u32 *staticbufs = getThreadStaticBuffers();
@ -60,7 +58,7 @@ Result ACU_cmd26(Handle* servhandle, u32 *ptr, u8 val)
cmdbuf[2] = IPC_Desc_StaticBuffer(0x200,0); cmdbuf[2] = IPC_Desc_StaticBuffer(0x200,0);
cmdbuf[3] = (u32)ptr; cmdbuf[3] = (u32)ptr;
if((ret = svcSendSyncRequest(*servhandle))!=0)return ret; if((ret = svcSendSyncRequest(acHandle))!=0)return ret;
staticbufs[0] = savedValue0; staticbufs[0] = savedValue0;
staticbufs[1] = savedValue1; staticbufs[1] = savedValue1;
@ -68,15 +66,14 @@ Result ACU_cmd26(Handle* servhandle, u32 *ptr, u8 val)
return (Result)cmdbuf[1]; return (Result)cmdbuf[1];
} }
Result ACU_GetWifiStatus(Handle* servhandle, u32 *out) Result ACU_GetWifiStatus(u32 *out)
{ {
if(!servhandle)servhandle=&acHandle;
Result ret=0; Result ret=0;
u32 *cmdbuf = getThreadCommandBuffer(); u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0xD,0,0); // 0x000D0000 cmdbuf[0] = IPC_MakeHeader(0xD,0,0); // 0x000D0000
if((ret = svcSendSyncRequest(*servhandle))!=0)return ret; if((ret = svcSendSyncRequest(acHandle))!=0)return ret;
*out = cmdbuf[2]; *out = cmdbuf[2];
@ -85,19 +82,18 @@ Result ACU_GetWifiStatus(Handle* servhandle, u32 *out)
Result ACU_WaitInternetConnection(void) Result ACU_WaitInternetConnection(void)
{ {
Handle servhandle = 0;
Result ret=0; Result ret=0;
u32 outval=0; u32 outval=0;
if((ret = srvGetServiceHandle(&servhandle, "ac:u"))!=0)return ret; if((ret = acInit())!=0)return ret;
while(1) while(1)
{ {
ret = ACU_GetWifiStatus(&servhandle, &outval); ret = ACU_GetWifiStatus(&outval);
if(ret==0 && outval!=0)break; if(ret==0 && outval!=0)break;
} }
svcCloseHandle(servhandle); acExit();
return ret; return ret;
} }

View File

@ -24,7 +24,7 @@ Result CFGNOR_Initialize(u8 value)
return ret; return ret;
} }
Result CFGNOR_Shutdown() Result CFGNOR_Shutdown(void)
{ {
Result ret = 0; Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer(); u32 *cmdbuf = getThreadCommandBuffer();

View File

@ -6,12 +6,12 @@
static Handle hbHandle; static Handle hbHandle;
Result hbInit() Result hbInit(void)
{ {
return srvGetServiceHandle(&hbHandle, "hb:HB"); return srvGetServiceHandle(&hbHandle, "hb:HB");
} }
void hbExit() void hbExit(void)
{ {
svcCloseHandle(hbHandle); svcCloseHandle(hbHandle);
} }