Пример #1
0
static int SMapInit ( IPAddr IP, IPAddr NM, IPAddr GW ) {

 int             i;
 iop_sys_clock_t ClockTicks;

 dev9IntrDisable ( INTR_BITMSK );
 EnableIntr ( IOP_IRQ_DEV9 );
 CpuEnableIntr ();

 UNKN_1464 = 3;

 if (   (  iSendMutex    = CreateMutex ( IOP_MUTEX_UNLOCKED )  ) < 0   ) return 0;
 if (   (  iSendReqMutex = CreateMutex ( IOP_MUTEX_UNLOCKED )  ) < 0   ) return	0;
 if	(   !SMap_Init ()                                                  ) return	0;

 for ( i = 2; i < 7; ++i ) dev9RegisterIntrCb ( i, SMapInterrupt );

 USec2SysClock ( TIMER_INTERVAL, &ClockTicks );
 SetAlarm (  &ClockTicks, Timer, ( void* )ClockTicks.lo  );

 netif_add ( &NIF, &IP, &NM, &GW, NULL, SMapIFInit, tcpip_input );
 netif_set_default ( &NIF );

 return 1;

}  /* end SMapInit */
Пример #2
0
/* ------------------------------------------------------------------------
   Main thread for the ezbgm module.
   After execution, initialize interrupt environment, register command, and
   then wait until there is a request from the EE.
   ------------------------------------------------------------------------ */
int sce_bgm_loop()
{
    sceSifQueueData qd;
    sceSifServeData sd;

    //-- Initialize interrupt environment in advance.

    CpuEnableIntr();
    EnableIntr( INUM_DMA_4 );
    EnableIntr( INUM_DMA_7 );

    //--- Register function that is called according to request


    sceSifInitRpc(0);

    sceSifSetRpcQueue( &qd, GetThreadId() );
    sceSifRegisterRpc( &sd, EZBGM_DEV, bgmFunc, (void*)gRpcArg, NULL, NULL, &qd );
    PRINTF(("goto bgm cmd loop\n"));

    //--- Command-wait loop

    sceSifRpcLoop(&qd);

    return 0;
}
Пример #3
0
void *allocMem(int size)
{
    int intrStat;
    void *mem;

    CpuDisableIntr(&intrStat);
    mem = AllocSysMemory(ALLOC_FIRST, size, NULL);
    CpuEnableIntr(intrStat);

    return mem;
}
Пример #4
0
int _start(int argc, char *argv[])
{
	iop_event_t event;
	int semid, evflg, res;

	if ((semid = CreateMutex(IOP_MUTEX_UNLOCKED)) < 0) {
		E_PRINTF("Unable to create %s (error %d).\n", "semaphore", semid);
		return 1;
	}

	eng_args.semid = semid;

	event.attr = event.bits = 0;
	if ((evflg = CreateEventFlag(&event)) < 0) {
		E_PRINTF("Unable to create %s (error %d).\n", "event flag", evflg);
		return 1;
	}

	eng_args.evflg = evflg;

	CpuEnableIntr();
	DisableIntr(IOP_IRQ_DMA_DEV9, NULL);
	if ((res = RegisterIntrHandler(IOP_IRQ_DMA_DEV9, 1, dev9_dma_handler, &eng_args.evflg))) {
		E_PRINTF("Unable to register 0x%02x intr handler (error %d).\n", IOP_IRQ_DMA_DEV9, res);
		return 1;
	}

	_sw(_lw(0xbf801570) | 0x80, 0xbf801570);

	if ((res = ata_engine_init(&eng_args)) < 0) {
		E_PRINTF("Unable to initialize the %s DMA engine.\n", "ATA");
		return 1;
	}

	if ((res = smap_engine_init(&eng_args)) < 0) {
		E_PRINTF("Unable to initialize the %s DMA engine.\n", "SMAP");
		return 1;
	}

	M_PRINTF("ATA/SMAP DMA relay module initialized.\n");
	return 0;
}
Пример #5
0
//-------------------------------------------------------------------------
int _start(int argc, char** argv)
{
	iop_thread_t thread_param;

	RegisterLibraryEntries(&_exp_cdvdfsv);

	FlushDcache();
	CpuEnableIntr();

	thread_param.attr = TH_C;
	thread_param.option = 0;
	thread_param.thread = (void *)init_thread;
	thread_param.stacksize = 0x800;
	thread_param.priority = 0x50;

	init_thread_id = CreateThread(&thread_param);
	StartThread(init_thread_id, 0);

	return MODULE_RESIDENT_END;
}
Пример #6
0
int _start(int argc, char *argv[])
{
	iop_thread_t thread;
	int threadid;

	FlushDcache();
	CpuEnableIntr(0);

	if (argc>=1)
	{
		switch(argv[1][0])
		{
		case 'e': debug_level = OUT_ERROR;   break; /* only errors */
		case 'w': debug_level = OUT_WARNING; break; /* warnings too */
		case 'i': debug_level = OUT_INFO;    break; /* and info */
		case 'd': debug_level = OUT_DEBUG;   break; /* and debuging */
		}
		printf("debug_level = %d (%c)\n", debug_level, argv[1][0]);
	}
	
	thread.attr      = TH_C;
	thread.thread    = rpc_thread;
	thread.priority  = 40;
	thread.stacksize = 0x800;
	thread.option    = 0;
	threadid = CreateThread(&thread);
	if (threadid < 0)
	{
		dprintf(OUT_ERROR, "Failed to make thread\n");
		return(1);
	}

  	StartThread(threadid, 0);

	return(0);
}
Пример #7
0
//--------------------------------------------------------------
int _start(int argc, const char **argv)
{
	iop_thread_t thread_param;
	register int thread_id;
	iop_library_t *libptr;
	int i, mcman_loaded;
	void **export_tab;

#ifdef SIO_DEBUG
	sio_init(38400, 0, 0, 0, 0);
#endif
#ifdef DEBUG
	DPRINTF("mcserv: _start...\n");
#endif

	// Get mcman lib ptr
	mcman_loaded = 0;
	libptr = GetLoadcoreInternalData()->let_next;
	while (libptr != 0) {
		for (i=0; i<8; i++) {
			if (libptr->name[i] != mcman_modname[i])
				break;
		}
		if (i == 8) {
			mcman_loaded = 1;
			break;
		}
		libptr = libptr->prev;
	}

	if (!mcman_loaded) {
#ifdef DEBUG
		DPRINTF("mcserv: mcman module is not loaded...\n");
#endif
		goto err_out;
	}

#ifdef DEBUG
	DPRINTF("mcserv: mcman version=%03x\n", libptr->version);
#endif
	if (libptr->version > 0x200)
		mcman_type = XMCMAN;

	// Get mcman export table
	export_tab = (void **)(((struct irx_export_table *)libptr)->fptrs);

	// Set functions pointers to match MCMAN exports
	McDetectCard = export_tab[5];
	McOpen = export_tab[6];
	McClose = export_tab[7];
	McRead = export_tab[8];
	McWrite = export_tab[9];
	McSeek = export_tab[10];
	McFormat = export_tab[11];
	McGetDir = export_tab[12];
	McDelete = export_tab[13];
	McFlush = export_tab[14];
	McChDir = export_tab[15];
	McSetFileInfo = export_tab[16];
	McEraseBlock = export_tab[17];
	McReadPage = export_tab[18];
	McWritePage = export_tab[19];
	McDataChecksum = export_tab[20];
	McReplaceBadBlock = export_tab[24]; // dummy in MCMAN !!!
	McReadPS1PDACard = export_tab[29];
	McWritePS1PDACard = export_tab[30];
	McUnformat = export_tab[36];
	McRetOnly = export_tab[37];
	McGetFreeClusters = export_tab[38];
	McGetMcType = export_tab[39];
	McSetPS1CardFlag = export_tab[40];

	// Set functions pointers to match XMCMAN exports if needed
	if (mcman_type == XMCMAN) {
	McDetectCard2 = export_tab[21];
	McGetFormat = export_tab[22];
	McGetEntSpace = export_tab[23];
	McGetModuleInfo = export_tab[42];
	McCheckBlock = export_tab[45];
	}

	// Register mcserv dummy export table
#ifdef DEBUG
	DPRINTF("mcserv: registering exports...\n");
#endif
	if (RegisterLibraryEntries(&_exp_mcserv) != 0)
		goto err_out;

	CpuEnableIntr();

#ifdef DEBUG
	DPRINTF("mcserv: starting RPC thread...\n");
#endif
 	thread_param.attr = TH_C;
 	thread_param.thread = (void *)thread_rpc_S_0400;
 	thread_param.priority = 0x68;
 	thread_param.stacksize = 0x1000;
 	thread_param.option = 0;

	thread_id = CreateThread(&thread_param);
	mcserv_tidS_0400 = thread_id;

	StartThread(thread_id, 0);

#ifdef DEBUG
	DPRINTF("mcserv: _start returns MODULE_RESIDENT_END...\n");
#endif

	return MODULE_RESIDENT_END;

err_out:

#ifdef DEBUG
	DPRINTF("mcserv: _start returns MODULE_NO_RESIDENT_END...\n");
#endif

	return MODULE_NO_RESIDENT_END;
}