void ft_print_memory(const void *addr, size_t size) { int *tab; char *str; size_t i[2]; i[0] = 0; str = (char *)addr; tab = (int *)addr; while (i[0] < size) { if (i[0] % (4 * sizeof(int)) == 0) print_hexa_value(*tab, 0); else print_hexa_value(*tab, 2); if ((TXEN % (4 * SOF(INT)) == 0 && TXEN) || (TXEN >= size)) { i[1] = i[0]; while (((i[0] + SOF(INT)) % (4 * SOF(INT))) && (i[0] += SOF(INT))) print_hexa_value(42, 1); print_text(&str, i[1]); } tab += 1; i[0] += sizeof(int); } }
int CMP3::PlayMP3( const char *pszSong ) { if( m_iIsPlaying ) { // sound system is already initialized SCL( m_Stream ); } else { SOP( FSOUND_OUTPUT_DSOUND ); SBS( 200 ); SDRV( 0 ); INIT( 44100, 1, 0 ); // we need just one channel, multiple mp3s at a time would be, erm, strange... }//AJH not for really cool effects, say walking past cars in a street playing different tunes, might change this later. char song[256]; sprintf( song, "%s/%s", gEngfuncs.pfnGetGameDirectory(), pszSong); //gEngfuncs.Con_Printf("Using fmod.dll version %f\n",VER()); if (SO) { m_Stream = SO( song, FSOUND_NORMAL | FSOUND_LOOP_NORMAL, 0 ,0); //AJH new version fmod uses Open } else if( SOF ) { m_Stream = SOF( song, FSOUND_NORMAL | FSOUND_LOOP_NORMAL, 1 ); //AJH old version fmod OpenFile } if(m_Stream) { SPLAY( 0, m_Stream ); m_iIsPlaying = 1; return 1; } else { m_iIsPlaying = 0; gEngfuncs.Con_Printf("Error: Could not load %s\n",song); return 0; } }
void USBHAL::usbisr(void) { // Start of frame if (LPC_USB->INTSTAT & FRAME_INT) { // Clear SOF interrupt LPC_USB->INTSTAT = FRAME_INT; // SOF event, read frame number SOF(FRAME_NR(LPC_USB->INFO)); } // Device state if (LPC_USB->INTSTAT & DEV_INT) { LPC_USB->INTSTAT = DEV_INT; if (LPC_USB->DEVCMDSTAT & DSUS_C) { // Suspend status changed LPC_USB->DEVCMDSTAT = devCmdStat | DSUS_C; if((LPC_USB->DEVCMDSTAT & DSUS) != 0) { suspendStateChanged(1); } } if (LPC_USB->DEVCMDSTAT & DRES_C) { // Bus reset LPC_USB->DEVCMDSTAT = devCmdStat | DRES_C; suspendStateChanged(0); // Disable endpoints > 0 disableEndpoints(); // Bus reset event busReset(); } } // Endpoint 0 if (LPC_USB->INTSTAT & EP(EP0OUT)) { // Clear EP0OUT/SETUP interrupt LPC_USB->INTSTAT = EP(EP0OUT); // Check if SETUP if (LPC_USB->DEVCMDSTAT & SETUP) { // Clear Active and Stall bits for EP0 // Documentation does not make it clear if we must use the // EPSKIP register to achieve this, Fig. 16 and NXP reference // code suggests we can just clear the Active bits - check with // NXP to be sure. ep[0].in[0] = 0; ep[0].out[0] = 0; // Clear EP0IN interrupt LPC_USB->INTSTAT = EP(EP0IN); // Clear SETUP (and INTONNAK_CI/O) in device status register LPC_USB->DEVCMDSTAT = devCmdStat | SETUP; // EP0 SETUP event (SETUP data received) EP0setupCallback(); } else { // EP0OUT ACK event (OUT data received) EP0out(); } } if (LPC_USB->INTSTAT & EP(EP0IN)) { // Clear EP0IN interrupt LPC_USB->INTSTAT = EP(EP0IN); // EP0IN ACK event (IN data sent) EP0in(); } for (uint8_t num = 2; num < 5*2; num++) { if (LPC_USB->INTSTAT & EP(num)) { LPC_USB->INTSTAT = EP(num); epComplete |= EP(num); if ((instance->*(epCallback[num - 2]))()) { epComplete &= ~EP(num); } } } }