static void die(paper_input_databuf_t *paper_input_databuf_p, block_info_t *binfo) { print_block_info(binfo); print_block_active(binfo); print_ring_mcnts(paper_input_databuf_p); #ifdef LOG_MCNTS dump_mcnt_log(); #endif abort(); // End process and generate core file (if ulimit allows) }
int DsLib::list_block(DsTask& ds_task) { uint64_t server_id = ds_task.server_id_; int32_t type = ds_task.list_block_type_; int ret_status = TFS_ERROR; ListBlockMessage req_lb_msg; int32_t xtype = type; if (type & 2) { xtype |= LB_PAIRS; } if (type & 4) { xtype |= LB_INFOS; } req_lb_msg.set_block_type(xtype); map < uint32_t, vector<uint32_t> >* logic_phy_pairs = NULL; map<uint32_t, BlockInfo>* block_infos = NULL; VUINT32* list_blocks = NULL; NewClient* client = NewClientManager::get_instance().create_client(); tbnet::Packet* ret_msg = NULL; ret_status = send_msg_to_server(server_id, client, &req_lb_msg, ret_msg); if (TFS_SUCCESS == ret_status && (RESP_LIST_BLOCK_MESSAGE == ret_msg->getPCode())) { printf("get message type: %d\n", ret_msg->getPCode()); RespListBlockMessage* resp_lb_msg = dynamic_cast<RespListBlockMessage*> (ret_msg); list_blocks = const_cast<VUINT32*> (resp_lb_msg->get_blocks()); logic_phy_pairs = const_cast< map < uint32_t, vector<uint32_t> >* > (resp_lb_msg->get_pairs()); block_infos = const_cast<map<uint32_t, BlockInfo>*> (resp_lb_msg->get_infos()); if (type & 1) { print_block_id(list_blocks); } if (type & 2) { print_block_pair(logic_phy_pairs); } if (type & 4) { print_block_info(block_infos); } ret_status = TFS_SUCCESS; } NewClientManager::get_instance().destroy_client(client); return ret_status; }
void nrf_mem_diagnose(void) { uint32_t in_use = 0; NRF_LOG_DEBUG ("\r\n"); NRF_LOG_DEBUG ("+------------+------------+------------+------------+------------+------------+\r\n"); NRF_LOG_DEBUG ("| Block | Size | Total | In Use | Min Alloc | Max Alloc |\r\n"); NRF_LOG_DEBUG ("+------------+------------+------------+------------+------------+------------+\r\n"); print_block_info(BLOCK_CAT_XXS, &in_use); print_block_info(BLOCK_CAT_XS, &in_use); print_block_info(BLOCK_CAT_SMALL, &in_use); print_block_info(BLOCK_CAT_MEDIUM, &in_use); print_block_info(BLOCK_CAT_LARGE, &in_use); print_block_info(BLOCK_CAT_XL, &in_use); print_block_info(BLOCK_CAT_XXL, &in_use); NRF_LOG_DEBUG ("+------------+------------+------------+------------+------------+------------+\r\n"); NRF_LOG_DEBUG ("| Total | %d | %d | %d\r\n", TOTAL_MEMORY_SIZE, TOTAL_BLOCK_COUNT,in_use); NRF_LOG_DEBUG ("+------------+------------+------------+------------+------------+------------+\r\n"); }
int main() { CLEAR_WRITE(); SET_STOPMOTOR(); CLEAR_SCANMEDIA(); CLEAR_MEDIASET(); CLEAR_READY(); //setup led and button gpio GPIO_SetMode(LED_G_PORT, LED_G_PIN, GPIO_PMD_OUTPUT); GPIO_SetMode(LED_R_PORT, LED_R_PIN, GPIO_PMD_OUTPUT); GPIO_SetMode(SWITCH_PORT, SWITCH_PIN, GPIO_PMD_INPUT); GPIO_SetMode(IRDATA_PORT, IRDATA_PIN, GPIO_PMD_INPUT); LED_GREEN(0); LED_RED(1); detect_board_version(); /* Unlock protected registers */ SYS_UnlockReg(); SYS_Init(); /* Lock protected registers */ SYS_LockReg(); UART0_Init(); SPI_Init(); TIMER_Open(TIMER0, TIMER_CONTINUOUS_MODE, 6000000); TIMER_Open(TIMER1, TIMER_PERIODIC_MODE, TRANSFER_RATE * 2); TIMER_Open(TIMER3, TIMER_PERIODIC_MODE, TRANSFER_RATE * 2); TIMER_EnableInt(TIMER1); TIMER_EnableInt(TIMER3); /* Open USB controller */ USBD_Open(&gsInfo, HID_ClassRequest, NULL); /* Init Endpoint configuration for HID */ HID_Init(); /* Start USB device */ USBD_Start(); /* Enable USB device interrupt */ NVIC_EnableIRQ(USBD_IRQn); LED_GREEN(1); LED_RED(0); printf("\n\nnuc123-fdsemu v%d.%02d build %d started. Compiled on "__DATE__" at "__TIME__"\n",version / 100,version % 100,BUILDNUM); printf("--CPU @ %0.3f MHz\n", (double)SystemCoreClock / 1000000.0f); printf("--SPI0 @ %0.3f MHz\n", (double)SPI_GetBusClock(SPI0) / 1000000.0f); printf("--SPI1 @ %0.3f MHz\n", (double)SPI_GetBusClock(SPI1) / 1000000.0f); printf("--Detected board version: %d (config = %d %d %d)\n", boardver,PA12,PA13,PA14); NVIC_SetPriority(USBD_IRQn,2); NVIC_SetPriority(TMR1_IRQn,1); NVIC_SetPriority(TMR2_IRQn,0); NVIC_SetPriority(TMR3_IRQn,0); NVIC_SetPriority(GPAB_IRQn,0); NVIC_SetPriority(EINT0_IRQn,0); flash_init(); sram_init(); fds_init(); print_block_info(0); while(1) { if(havepacket) { havepacket = 0; // process_send_feature(epdata,64); } console_tick(); fds_tick(); } }
void console_tick(void) { int ch = 0; if(read_char(&ch) == 0) { int n; char help[] = "help:\r\n" " 0-F : select block to read disk data from\r\n" " i : insert disk\r\n" " r : remove disk\r\n" " f : flip disk to next side/disk\r\n" " p : print disks stored in flash\r\n" " d : disk read mode\r\n" " t : transfer mode\r\n" "\r\n"; switch((char)ch) { case '?': printf("%s",help); printf("currently selected disk in block is %d.\r\n\r\n",diskblock); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': if(ch >= 'A' && ch <= 'F') { diskblock = 10 + (ch - 'A'); } else { diskblock = ch - '0'; } printf("selected disk in block %X.\r\n",diskblock); break; case 'i': fds_insert_disk(diskblock); break; case 'r': fds_remove_disk(); break; case 'p': for(n=0;n<0x10;n++) { print_block_info(n); } break; case 's': flash_init(); sram_init(); break; case 'd': fds_setup_diskread(); break; case 't': fds_setup_transfer(); if(IS_READY()) printf("drive is ready\n"); else printf("drive is not ready\n"); if(IS_MEDIASET()) printf("media is set\n"); else printf("media is not set\n"); if(IS_WRITABLE()) printf("media is writable\n"); else printf("media is not writable\n"); if(IS_MOTORON()) printf("motor is on\n"); else printf("motor is not on\n"); break; case 'c': sram_read(3537,crap,256); hexdump("crap",crap,256); break; case 'v': printf("stopping read\n"); CLEAR_WRITE(); CLEAR_SCANMEDIA(); SET_STOPMOTOR(); break; case 'I': printf("ident: '%s'\n",ident.ident); break; } } }