int network_device_read(void) { s32 status; if( (status=MIOS32_ENC28J60_PackageReceive((u8 *)uip_buf, UIP_BUFSIZE)) < 0 ) { netdev_available = 0; #if DEBUG_VERBOSE_LEVEL >= 1 MIOS32_MIDI_SendDebugMessage("[network_device_read] ERROR %d\n", status); #endif return 0; } #if DEBUG_VERBOSE_LEVEL >= 2 if( status ) { MIOS32_MIDI_SendDebugMessage("[network_device_read] received %d bytes\n", status); } #endif #if DEBUG_VERBOSE_LEVEL >= 3 if( status ) { MIOS32_MIDI_SendDebugHexDump((u8 *)uip_buf, status); } #endif return status; }
static void TASK_SPI_Handler(void *pvParameters) { // fill Tx Buffer with housenumbers { int i; for(i=0; i<TRANSFER_BUFFER_SIZE; ++i) tx_buffer[i] = i; } while( 1 ) { int i; for(i=0; i<TRANSFER_BUFFER_SIZE; ++i) { // toggle Status LED to as a sign of live MIOS32_BOARD_LED_Set(1, ~MIOS32_BOARD_LED_Get()); // receive byte rx_buffer[i] = MIOS32_SPI_TransferByte(SLAVE_SPI, tx_buffer[i]); } SPI_Callback(); // print received bytes MIOS32_MIDI_SendDebugHexDump((u8 *)rx_buffer, TRANSFER_BUFFER_SIZE); } }
s32 SEQ_TERMINAL_PrintCurrentSong(void *_output_function) { void (*out)(char *format, ...) = _output_function; u8 song = SEQ_SONG_NumGet(); MUTEX_MIDIOUT_TAKE; out("Song #%2d\n", song+1); out("========\n"); out("Name: '%s'\n", seq_song_name); MIOS32_MIDI_SendDebugHexDump((u8 *)&seq_song_steps[0], SEQ_SONG_NUM_STEPS*sizeof(seq_song_step_t)); out("done.\n"); MUTEX_MIDIOUT_GIVE; return 0; // no error }
void *umm_info( void *ptr, int force ) { unsigned short int blockNo = 0; // Protect the critical section... // UMM_CRITICAL_ENTRY(); // Clear out all of the entries in the heapInfo structure before doing // any calculations.. // memset( &heapInfo, 0, sizeof( heapInfo ) ); DBG_LOG_FORCE( force, "\n\nDumping the umm_heap...\n" ); DBG_LOG_FORCE( force, "|0x%08x|B %5d|NB %5d|PB %5d|Z %5d|NF %5d|PF %5d|\n", &UMM_BLOCK(blockNo), blockNo, UMM_NBLOCK(blockNo) & UMM_BLOCKNO_MASK, UMM_PBLOCK(blockNo), (UMM_NBLOCK(blockNo) & UMM_BLOCKNO_MASK )-blockNo, UMM_NFREE(blockNo), UMM_PFREE(blockNo) ); // Now loop through the block lists, and keep track of the number and size // of used and free blocks. The terminating condition is an nb pointer with // a value of zero... blockNo = UMM_NBLOCK(blockNo) & UMM_BLOCKNO_MASK; while( UMM_NBLOCK(blockNo) & UMM_BLOCKNO_MASK ) { ++heapInfo.totalEntries; heapInfo.totalBlocks += (UMM_NBLOCK(blockNo) & UMM_BLOCKNO_MASK )-blockNo; // Is this a free block? if( UMM_NBLOCK(blockNo) & UMM_FREELIST_MASK ) { ++heapInfo.freeEntries; heapInfo.freeBlocks += (UMM_NBLOCK(blockNo) & UMM_BLOCKNO_MASK )-blockNo; DBG_LOG_FORCE( force, "|0x%08x|B %5d|NB %5d|PB %5d|Z %5d|NF %5d|PF %5d|\n", &UMM_BLOCK(blockNo), blockNo, UMM_NBLOCK(blockNo) & UMM_BLOCKNO_MASK, UMM_PBLOCK(blockNo), (UMM_NBLOCK(blockNo) & UMM_BLOCKNO_MASK )-blockNo, UMM_NFREE(blockNo), UMM_PFREE(blockNo) ); // Does this block address match the ptr we may be trying to free? if( ptr == &UMM_BLOCK(blockNo) ) { // Release the critical section... // UMM_CRITICAL_EXIT(); return( ptr ); } } else { ++heapInfo.usedEntries; unsigned usedBlocks = (UMM_NBLOCK(blockNo) & UMM_BLOCKNO_MASK )-blockNo; heapInfo.usedBlocks += usedBlocks; DBG_LOG_FORCE( force, "|0x%08x|B %5d|NB %5d|PB %5d|Z %5d|\n", &UMM_BLOCK(blockNo), blockNo, UMM_NBLOCK(blockNo) & UMM_BLOCKNO_MASK, UMM_PBLOCK(blockNo), (UMM_NBLOCK(blockNo) & UMM_BLOCKNO_MASK )-blockNo ); MIOS32_MIDI_SendDebugHexDump((unsigned char *)&UMM_BLOCK(blockNo), usedBlocks * sizeof(umm_block)); } blockNo = UMM_NBLOCK(blockNo) & UMM_BLOCKNO_MASK; } // Update the accounting totals with information from the last block, the // rest must be free! heapInfo.freeBlocks += UMM_NUMBLOCKS-blockNo; heapInfo.totalBlocks += UMM_NUMBLOCKS-blockNo; DBG_LOG_FORCE( force, "|0x%08x|B %5d|NB %5d|PB %5d|Z %5d|NF %5d|PF %5d|\n", &UMM_BLOCK(blockNo), blockNo, UMM_NBLOCK(blockNo) & UMM_BLOCKNO_MASK, UMM_PBLOCK(blockNo), UMM_NUMBLOCKS-blockNo, UMM_NFREE(blockNo), UMM_PFREE(blockNo) ); DBG_LOG_FORCE( force, "Total Entries %5d Used Entries %5d Free Entries %5d\n", heapInfo.totalEntries, heapInfo.usedEntries, heapInfo.freeEntries ); DBG_LOG_FORCE( force, "Total Blocks %5d Used Blocks %5d Free Blocks %5d\n", heapInfo.totalBlocks, heapInfo.usedBlocks, heapInfo.freeBlocks ); DBG_LOG_FORCE( force, "Size of umm_heap is %d bytes, used: %d bytes, free: %d bytes\n", sizeof(umm_heap), heapInfo.usedBlocks*sizeof(umm_block), heapInfo.freeBlocks*sizeof(umm_block)); // Release the critical section... // UMM_CRITICAL_EXIT(); return( NULL ); }