//    LightMP3
//    Copyright (C) 2007 Sakya
//    sakya_tg@yahoo.it
//
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program; if not, write to the Free Software
//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay_kernel.h>
#include <pspimpose_driver.h>
#include <pspsysreg.h>
#include <pspctrl.h>
#include <pspsysmem_kernel.h>
#include <psploadexec_kernel.h>
#include <pspreg.h>
#include <psprtc.h>
#include <pspusb.h>
#include <pspusbstor.h>
#include <psppower.h>
#include <systemctrl.h>
#include <systemctrl_se.h>
#include <stdio.h>
#include <string.h>

PSP_MODULE_INFO("SIODriver", 0x1007, 1, 0);
void SIOInit(void)
{
	int k1 = pspSdkSetK1(0);
	/* Shut down the remote driver */
	sceHprmEnd();
	/* Enable UART 4 */
	sceSysregUartIoEnable(4);
	/* Enable remote control power */
	sceSysconCtrlHRPower(1);
	/* Delay thread for a but */
	sceKernelDelayThread(2000000);
	pspSdkSetK1(k1);
}

void SIOBaud(int baud)
{
	int k1 = pspSdkSetK1(0);
	pspDebugSioSetBaud(baud);
	pspSdkSetK1(k1);
}
void SIOSend(int ch)
{
	int k1 = pspSdkSetK1(0);
	pspDebugSioPutchar(ch);
	pspSdkSetK1(k1);
}
int SIORecv(void)
{
	int k1 = pspSdkSetK1(0);
	int ch = pspDebugSioGetchar();
	pspSdkSetK1(k1);
	return ch;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//module_start
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int module_start(SceSize args, void *argp){
	return 0;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//module_stop
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int module_stop(){
	return 0;
}
