예제 #1
0
파일: ndsp.c 프로젝트: Bownairo/ctrulib
static void ndspFinalize(bool suspend)
{
	LightLock_Lock(&ndspMutex);
	u16 val = suspend ? 3 : 1;
	DSP_WriteProcessPipe(2, &val, 4);
	for (;;)
	{
		bool ready;
		DSP_RecvDataIsReady(0, &ready);
		if (ready)
		{
			DSP_RecvData(0, &val);
			if (val == 1)
				break;
		}
	}
	if (suspend)
		memcpy(dspVar5Backup, ndspVars[5][0], sizeof(dspVar5Backup));

	DSP_RegisterInterruptEvents(0, 2, 2);
	svcCloseHandle(irqEvent);
	svcCloseHandle(dspSem);
	DSP_UnloadComponent();
	bComponentLoaded = false;
	bDspReady = false;
	LightLock_Unlock(&ndspMutex);
}
예제 #2
0
파일: ndsp.c 프로젝트: Bownairo/ctrulib
void ndspAuxSetVolume(int id, float volume)
{
	LightLock_Lock(&ndspMaster.lock);
	ndspMaster.aux[id].volume = volume;
	ndspMaster.flags |= MFLAG_AUX_VOLUME(id);
	LightLock_Unlock(&ndspMaster.lock);
}
예제 #3
0
파일: ndsp.c 프로젝트: Bownairo/ctrulib
void ndspSetMasterVol(float volume)
{
	LightLock_Lock(&ndspMaster.lock);
	ndspMaster.masterVol = volume;
	ndspMaster.flags |= MFLAG_MASTERVOL;
	LightLock_Unlock(&ndspMaster.lock);
}
예제 #4
0
파일: ndsp.c 프로젝트: Bownairo/ctrulib
void ndspSetOutputCount(int count)
{
	LightLock_Lock(&ndspMaster.lock);
	ndspMaster.outputCount = count;
	ndspMaster.flags |= MFLAG_OUTPUTCOUNT;
	LightLock_Unlock(&ndspMaster.lock);
}
예제 #5
0
파일: ndsp.c 프로젝트: Bownairo/ctrulib
void ndspSetClippingMode(ndspClippingMode mode)
{
	LightLock_Lock(&ndspMaster.lock);
	ndspMaster.clippingMode = mode;
	ndspMaster.flags |= MFLAG_CLIPPINGMODE;
	LightLock_Unlock(&ndspMaster.lock);
}
예제 #6
0
파일: ndsp.c 프로젝트: Bownairo/ctrulib
void ndspSurroundSetPos(ndspSpeakerPos pos)
{
	LightLock_Lock(&ndspMaster.lock);
	ndspMaster.surround.pos = pos;
	ndspMaster.flags |= MFLAG_SURR_POS;
	LightLock_Unlock(&ndspMaster.lock);
}
예제 #7
0
파일: ndsp.c 프로젝트: Bownairo/ctrulib
void ndspSurroundSetDepth(u16 depth)
{
	LightLock_Lock(&ndspMaster.lock);
	ndspMaster.surround.depth = depth;
	ndspMaster.flags |= MFLAG_SURR_DEPTH;
	LightLock_Unlock(&ndspMaster.lock);
}
예제 #8
0
파일: ndsp.c 프로젝트: Bownairo/ctrulib
void ndspAuxSetEnable(int id, bool enable)
{
	LightLock_Lock(&ndspMaster.lock);
	ndspMaster.aux[id].enable = enable ? 1 : 0;
	ndspMaster.flags |= MFLAG_AUX_ENABLE(id);
	LightLock_Unlock(&ndspMaster.lock);
}
예제 #9
0
파일: ndsp.c 프로젝트: Bownairo/ctrulib
void ndspSurroundSetRearRatio(u16 ratio)
{
	LightLock_Lock(&ndspMaster.lock);
	ndspMaster.surround.rearRatio = ratio;
	ndspMaster.flags |= MFLAG_SURR_RRATIO;
	LightLock_Unlock(&ndspMaster.lock);
}
예제 #10
0
파일: ndsp.c 프로젝트: Bownairo/ctrulib
void ndspAuxSetFrontBypass(int id, bool bypass)
{
	LightLock_Lock(&ndspMaster.lock);
	ndspMaster.aux[id].frontBypass = bypass ? 1 : 0;
	ndspMaster.flags |= MFLAG_AUX_BYPASS(id);
	LightLock_Unlock(&ndspMaster.lock);
}
예제 #11
0
파일: ndsp.c 프로젝트: Bownairo/ctrulib
void ndspSetOutputMode(ndspOutputMode mode)
{
	LightLock_Lock(&ndspMaster.lock);
	ndspMaster.outputMode = mode;
	ndspMaster.flags |= MFLAG_OUTPUTMODE;
	LightLock_Unlock(&ndspMaster.lock);
}
예제 #12
0
파일: ndsp.c 프로젝트: Bownairo/ctrulib
static inline void ndspWaitForIrq(void)
{
	LightLock_Lock(&ndspMutex);
	svcWaitSynchronization(irqEvent, U64_MAX);
	svcClearEvent(irqEvent);
	LightLock_Unlock(&ndspMutex);
}
예제 #13
0
파일: apt.c 프로젝트: botanyaki/ctrulib
u32 aptGetStatusPower(void)
{
	u32 ret;
	LightLock_Lock(&aptStatusMutex);
	ret = aptStatusPower;
	LightLock_Unlock(&aptStatusMutex);
	return ret;
}
예제 #14
0
파일: apt.c 프로젝트: botanyaki/ctrulib
APT_AppStatus aptGetStatus(void)
{
	APT_AppStatus ret;
	LightLock_Lock(&aptStatusMutex);
	ret = aptStatus;
	LightLock_Unlock(&aptStatusMutex);
	return ret;
}
예제 #15
0
void LightEvent_Clear(LightEvent* event)
{
	if (event->state == 1)
	{
		LightLock_Lock(&event->lock);
		LightEvent_SetState(event, -2);
		LightLock_Unlock(&event->lock);
	} else if (event->state == 0)
		LightEvent_SetState(event, -1);
}
예제 #16
0
void RecursiveLock_Lock(RecursiveLock* lock)
{
	u32 tag = (u32)getThreadLocalStorage();
	if (lock->thread_tag != tag)
	{
		LightLock_Lock(&lock->lock);
		lock->thread_tag = tag;
	}
	lock->counter ++;
}
예제 #17
0
static inline void debug(const char *format, ...)
{
#ifdef DEBUG
    LightLock_Lock(&debug_lock);
    consoleSelect(&bottomScreen);
    va_list ap;
    va_start(ap, format);
    vfprintf(stderr, format, ap);
    va_end(ap);
    LightLock_Unlock(&debug_lock);
#endif
}
예제 #18
0
void LightEvent_Signal(LightEvent* event)
{
	if (event->state == -1)
	{
		LightEvent_SetState(event, 0);
		svcArbitrateAddress(arbiter, (u32)event, ARBITRATION_SIGNAL, 1, 0);
	} else if (event->state == -2)
	{
		LightLock_Lock(&event->lock);
		LightEvent_SetState(event, 1);
		svcArbitrateAddress(arbiter, (u32)event, ARBITRATION_SIGNAL, -1, 0);
		LightLock_Unlock(&event->lock);
	}
}
예제 #19
0
static inline void print(const char *format, ...)
{
#ifdef DEBUG
    LightLock_Lock(&debug_lock);
#endif
    consoleSelect(&topScreen);
    va_list ap;
    va_start(ap, format);
    vprintf(format, ap);
    va_end(ap);
#ifdef DEBUG
    LightLock_Unlock(&debug_lock);
#endif
}
예제 #20
0
파일: apt.c 프로젝트: botanyaki/ctrulib
void aptSetStatus(APT_AppStatus status)
{
	LightLock_Lock(&aptStatusMutex);

	aptStatus = status;

	//if(prevstatus != APP_NOTINITIALIZED)
	//{
		if(status == APP_RUNNING)
			__ctru_speedup_config();
		if(status == APP_RUNNING || status == APP_EXITING || status == APP_APPLETSTARTED || status == APP_APPLETCLOSED)
			svcSignalEvent(aptStatusEvent);
	//}

	LightLock_Unlock(&aptStatusMutex);
}
예제 #21
0
파일: apt.c 프로젝트: botanyaki/ctrulib
void aptSetStatusPower(u32 status)
{
	LightLock_Lock(&aptStatusMutex);
	aptStatusPower = status;
	LightLock_Unlock(&aptStatusMutex);
}
예제 #22
0
파일: apt.c 프로젝트: botanyaki/ctrulib
void aptOpenSession(void)
{
	LightLock_Lock(&aptStatusMutex);
	__apt_initservicehandle();
}
예제 #23
0
파일: ndsp.c 프로젝트: Bownairo/ctrulib
static void ndspUpdateMaster(void)
{
	DspMasterStatus* m = ndspiGetMasterStatus();
	LightLock_Lock(&ndspMaster.lock);

	u32 flags = m->flags, mflags = ndspMaster.flags;
	int i;

	m->headsetConnected = *(vu8*)0x1FF810C0;
	flags |= 0x10000000;

	if (mflags & MFLAG_MASTERVOL)
	{
		m->masterVol = ndspMaster.masterVol;
		flags |= 0x00010000;
	}

	if (mflags & MFLAG_OUTPUTMODE)
	{
		m->outputMode = ndspMaster.outputMode;
		flags |= 0x04000000;
	}

	if (mflags & MFLAG_CLIPPINGMODE)
	{
		m->clippingMode = ndspMaster.clippingMode;
		flags |= 0x08000000;
	}

	if (mflags & MFLAG_OUTPUTCOUNT)
	{
		m->outBufCount = ndspMaster.outputCount;
		flags |= 0x00008000;
	}

	if (mflags & MFLAG_SYNCMODE)
	{
		m->syncMode = ndspMaster.syncMode;
		m->unknown |= 0x10000; //?
	}

	if (mflags & MFLAG_SURR_DEPTH)
	{
		m->surroundDepth = ndspMaster.surround.depth;
		flags |= 0x20000000;
	}

	if (mflags & MFLAG_SURR_POS)
	{
		m->surroundSpeakerPos = ndspMaster.surround.pos;
		flags |= 0x40000000;
	}

	if (mflags & MFLAG_SURR_RRATIO)
	{
		m->rearRatio = ndspMaster.surround.rearRatio;
		flags |= 0x80000000;
	}

	for (i = 0; i < 2; i ++)
	{
		if (mflags & MFLAG_AUX_ENABLE(i))
		{
			m->auxBusEnable[i] = ndspMaster.aux[i].enable;
			flags |= 0x00000100 << i;
		}

		if (mflags & MFLAG_AUX_BYPASS(i))
		{
			m->auxFrontBypass[i] = ndspMaster.aux[i].frontBypass;
			flags |= 0x00000040 << i;
		}

		if (mflags & MFLAG_AUX_VOLUME(i))
		{
			m->auxReturnVol[i] = ndspMaster.aux[i].volume;
			flags |= 0x01000000 << i;
		}
	}

	m->flags = flags;
	ndspMaster.flags = 0;

	LightLock_Unlock(&ndspMaster.lock);
}