int main(int argc, char *argv[]) #endif { FILE *fp; int i, j; A_UINT8 *pData = (A_UINT8 *)&EepromData; AR6000_EEPROM *pEepStruct = (AR6000_EEPROM*)&EepromData; if ((NULL != argv[1]) && (NULL != argv[2]) && (NULL != argv[3])) { } else { printf("Usage: eepromBin2Txt.out <eeprom template> <input eeprom text> <output eeprom bin>\n"); return -1; } #if !defined(_USE_AS_API) // read template if (FALSE == readTemplate(argv[1])) { printf("Error reading template file %s \n", argv[1]); return -1; } else { _printf(".reading template file %s \n", argv[1]); } #endif // parse eeprom txt and fill the binary data. if (FALSE == parseEepromTxtFile(argv[2], (A_UINT8 *)&EepromData)) { printf("Error reading EEPROM text file %s \n", argv[2]); return -1; } //for (i = 0; i < 10; ++i) //{ // printf("%04%x: ", i * 16); // for (j = 0; j < 16; ++j) // { // printf("%02x ", pData[i*16+j]); // } // printf("\n"); //} // generate binary file //if (FALSE == genEepromBinFile(argv[3], EepromData)) { if (FALSE == genEepromBinFile(argv[3], pEepStruct )) { printf("Error creating EEPROM bin file %s \n", argv[3]); return -1; } else { printf(".created EEPROM bin file %s \n", argv[3]); } return 0; }
int printf(char *fmt, ...) { va_list args; int i; va_start(args, fmt); i = _printf(fmt, args); va_end(args); fflush(stdout); return (i); }
void AP_AccelCal::cancel() { _printf("Calibration cancelled"); for(uint8_t i=0 ; i < _num_clients ; i++) { _clients[i]->_acal_event_cancellation(); } _last_result = ACCEL_CAL_NOT_STARTED; clear(); }
void AP_AccelCal::fail() { _printf("Calibration FAILED"); for(uint8_t i=0 ; i < _num_clients ; i++) { _clients[i]->_acal_event_failure(); } _last_result = ACCEL_CAL_FAILED; clear(); }
A_BOOL genEepromBinFile(char *fileName, A_UINT8 *pEepStruct) { A_UINT8 *pData = (A_UINT8 *)pEepStruct; FILE *fp; A_UINT16 eepromSize = sizeof(AR6000_EEPROM); prtSizes(); // re-computing checksum computeChecksum(pEepStruct, (A_UINT32)CHECKSUM_OFFSET, eepromSize ); if ( (fp = fopen(fileName, "wb")) == NULL) { _printf("Error: open to write eeprom bin %s \n", fileName); return FALSE; } if (eepromSize != fwrite((A_UCHAR *)pEepStruct, 1, eepromSize, fp)) { _printf("Error: writing to %s\n", fileName); } if (fp) fclose(fp); return(TRUE); }
void sig_child(int signo) { pid_t pid; int stat; /*pid = wait(&stat); _printf("processing signal %d : child process[pid=%d] terminated.\n", signo, pid);*/ while((pid = waitpid(-1, &stat, WNOHANG)) > 0) { _printf("processing signal %d : child process[pid=%d] terminated.\n", signo, pid); } }
void AP_AccelCal::success() { _printf("Calibration successful"); for(uint8_t i=0 ; i < _num_clients ; i++) { _clients[i]->_acal_event_success(); } _last_result = ACCEL_CAL_SUCCESS; clear(); }
int rpn(char *rpn) { mdk_context_t ctx; int r; if (rpn == NULL) return EINVAL; memset(&ctx, 0, sizeof(ctx)); r = rpn_token(&ctx, rpn); if (r) { _printf("fail: rpn_token()\n"); } r = generate_code(&ctx); if (r) { _printf("fail: generate_code()\n"); } return 0; }
static void _test_focus_on_entry(AtkObject *obj) { AtkObject *focused_obj = NULL; gboolean success = FALSE; _printf("Testing focus....\n"); /* changing focus */ g_assert(ATK_IS_COMPONENT(obj)); success = atk_component_grab_focus(ATK_COMPONENT(obj)); g_assert(success); /* now focus should point to our button*/ focused_obj = atk_get_focus_object(); g_assert(focused_obj); g_assert(focused_obj == obj); _printf("DONE. All focus test passed successfully \n"); eail_test_code_called = TRUE; }
A_BOOL parse_txt_uint8(char *pLine, A_UINT8 *pData, int entry, int *pos, int col) { A_UINT8 value; //PARSE_TXT_COMM(A_UINT8, 1); A_UINT32 readVal; if (EepTempEntries[entry].hex == EEP_HEX_VAL || strstr(pLine,"0x")) { if(!sscanf(pLine, "%x", &readVal)) { _printf("Error: unable to read value column %d at entry %d from %s\n", col, entry); } _printf("0x%x ", readVal); } else if (EepTempEntries[entry].hex == EEP_DEC_VAL) { if(!sscanf(pLine, "%d", &readVal)) { _printf("Error: unable to read value column %d at entry %d from %s\n", col, entry); } _printf("%d ", readVal); } value = (A_UINT8)readVal; memcpy((void*)&pData[*pos], (void*)&value, (size_t)1); (*pos) +=1; return TRUE; }
int cc_snprintf(char *str, size_t size, const char *format, ...) { va_list ap; DATASTREAM ds; va_start(ap, format); datastream_init (&ds, DSFLAG_DIRECT, NULL); datastream_set_limit (&ds, size); datastream_set_output (&ds, str); _printf (&ds, format, ap); str[ds.written] = 0; va_end(ap); return ds.written; }
int main(int argc, char* argv[]) { uint32_t pid = syscall_get_pid(); intptr_t ret = syscall_stack_trace_enable(pid, MAP_FILE_PATH); if (ret != M_OK) { _printf("syscall_stack_trace_enable failed%d\n", ret); } gnote::Controller c; if (argc > 1) { c.SetFile(String(argv[1])); } c.Run(); return 0; }
static void _evaluate_expression(char* p) { char pr[8]; int l = 0; int k = 0; bool_t a = true; char* e = 0; const char* const print = "PRINT "; if(!p) { _printf("Invalid expression.\n"); return; } l = (int)strlen(p); k = (int)strlen(print); if(l >= k) { memcpy(pr, p, k); pr[k] = '\0'; if(_str_eq(pr, print)) a = false; } if(a) { e = (char*)malloc(l + k + 1); memcpy(e, print, k); memcpy(e + k, p, l); e[l + k] = '\0'; p = e; } if(mb_load_string(bas, p, true) == MB_FUNC_OK) { mb_run(bas); } else { _printf("Invalid expression.\n"); } if(a) free(e); }
void dumpConnectionMappingTable() { #ifndef MAX_FQDN_SIZE #define MAX_FQDN_SIZE 256 #endif char temp_ip[MAX_FQDN_SIZE];/*IP Address String buffer*/ IMTCPMgr * ImInstance = IMTCPMgr::getInstance(); // now the max num of peerid 255, if larger than that, code should change here int16_t i,j,k; for( i = 0; i < POOL_TYPE_MAX; i++) { for( j = 0; j < POOL_ID_MAX; j++) { for( k = 0; k < FLOATER_NUMBER_MAX; k++) { ConMgrtbl* mgr_table; mgr_table = ImInstance->getPeerIdInfo((ImInstance->PoolIndex2pooltype(i)),j,k); if (IS_VALID_PTR(mgr_table) == FALSE) { _printf("mgr_table is invalid, mgr_table: %p", mgr_table); return; } if ( ImInstance->isIPValid(&mgr_table->peerid)) { //OSip2arpa(const OSIPADDR *osip,char *buf,unsigned int size) OSIPADDR tmp_osip; tmp_osip.addrtype = OSIPV4; tmp_osip.ipaddr[0] = NTOH_32(mgr_table->peerIP); OSip2arpa( &tmp_osip, temp_ip, sizeof(temp_ip)); _printf("pooltype is :%d, poolid is %d, poolmember is %d, IP is %s\n", i, j, k, temp_ip); } } } } }
static void _do_test(AtkObject *obj) { int child_count = 0; child_count = atk_object_get_n_accessible_children(obj); g_assert(child_count == 2); _printf("n_accessible_children - done\n"); AtkStateSet *state_set = atk_object_ref_state_set(obj); gboolean v_contains = atk_state_set_contains_state(state_set, ATK_STATE_VERTICAL); gboolean h_contains = atk_state_set_contains_state(state_set, ATK_STATE_HORIZONTAL); g_object_unref(state_set); g_assert(v_contains || h_contains); _printf("ref_state_set - done\n"); /*AtkValue iface tests*/ g_assert(ATK_IS_VALUE(obj)); GValue value = G_VALUE_INIT; double d_value; atk_value_get_maximum_value(ATK_VALUE(obj), &value); d_value = g_value_get_double(&value); g_assert(d_value == 1.0); atk_value_get_minimum_value(ATK_VALUE(obj), &value); d_value = g_value_get_double(&value); g_assert(d_value == 0.0); g_value_set_double(&value, 0.3); gboolean success = atk_value_set_current_value(ATK_VALUE(obj), &value); g_assert(success); atk_value_get_current_value(ATK_VALUE(obj), &value); g_assert(G_VALUE_HOLDS_DOUBLE(&value)); d_value = g_value_get_double(&value); g_assert(d_value == 0.3); _printf("atk_value - done\n"); eailu_test_atk_focus(obj, TRUE); }
static void _do_test_photo(AtkObject *obj) { const char *name = atk_object_get_name(obj); const char *type_name = g_type_name(G_TYPE_FROM_INSTANCE(obj)); const char * const desc_test = "top secret"; const char *desc; int height = 0, width = 0; int x = -1, y = -1; _printf("_get_name: %s\n", name ? name : "NULL"); _printf("_get_type_name: %s\n", type_name ? type_name : "NULL"); g_assert(ATK_IS_IMAGE(obj)); AtkStateSet *state_set = atk_object_ref_state_set(obj); g_object_unref(state_set); // test AtkImage atk_image_get_image_position(ATK_IMAGE(obj), &x, &y, ATK_XY_SCREEN); _printf("atk_image_get_image_position on screen: x: %d y %d\n", x, y); g_assert(NULL == atk_image_get_image_description(ATK_IMAGE(obj))); g_assert(TRUE == atk_image_set_image_description(ATK_IMAGE(obj), desc_test)); desc = atk_image_get_image_description(ATK_IMAGE(obj)); _printf("atk_image_get_image_description: %s\n", desc ? desc : "NULL"); g_assert(NULL != desc); g_assert_cmpstr(desc_test, ==, desc); atk_image_get_image_size(ATK_IMAGE(obj), &height, &width); _printf("atk_image_get_image_size: height %d width %d\n", height, width); // test AtkAction g_assert(ACTIONS_NUMBER == atk_action_get_n_actions(ATK_ACTION(obj))); eailu_test_action_activate(ATK_ACTION(obj), "click"); g_assert((eailu_get_action_number(ATK_ACTION(obj), "typo")) == -1); eailu_test_action_description_all(ATK_ACTION(obj)); }
static void _edit_program(const char* no) { char line[_MAX_LINE_LENGTH]; long lno = 0; int l = 0; mb_assert(no); lno = atoi(no); if(lno < 1 || lno > _code()->count) { _printf("Line number %ld out of bound.\n", lno); return; } --lno; memset(line, 0, _MAX_LINE_LENGTH); _printf("%ld]", lno + 1); mb_gets(line, _MAX_LINE_LENGTH); l = (int)strlen(line); _code()->lines[lno] = (char*)realloc(_code()->lines[lno], l + 2); strcpy(_code()->lines[lno], line); _code()->lines[lno][l] = '\n'; _code()->lines[lno][l + 1] = '\0'; }
void idle6() { //asm volatile("cli"); //int ij=0; //while(1) //ij++; //scheduler(); /**/ uint32_t i=0; while(1) { //asm volatile("cli"); if(i>1024*70) break; i++; if(i%2) _printf("6"); //asm volatile("sti"); } i=0; while(1) { //asm volatile("cli"); if(i%2) _printf("--6%x--",i); i++; //asm volatile("sti"); } _printf("\neverything worked fine :D MULTITASKING WORKS :D \n"); /**/ while(1) { asm volatile("cli"); _printf(" 6-x-"); asm volatile("sti"); }//*/ }
void image_load(game_files_t *g, ftdi_context_t *c) { int i; int cnt = 0; FILE *fp; for(i = 0; i < g->num_files; i++) { if(g->files[i][0]) { // load file fp = fopen(g->files[i], g->dump ? "wb" : "rb"); if(fp == NULL) die(err[DEV_ERR_NULL_FILE], __FUNCTION__); if(!g->dump){ // get file size fseek(fp, 0L, SEEK_END); g->sizes[i] = ftell(fp); fseek(fp, 0L, SEEK_SET); } // print status _printf("%s %s %s %s at 0x%x (%d kb)", g->dump ? "Dumping" : "Loading", g->files[i], g->dump ? "from" : "into", bank_desc[g->types[i]], g->addrs[i], g->sizes[i] / 1024); image_transfer(fp, c, g->dump, g->types[i], g->addrs[i], g->sizes[i]); if(g->sizes[i] < 1052672 && g->types[i] == BANK_CARTROM && g->addrs[i] == 0 && !g->dump){ // sanity check _printf("Image is smaller than 1028Kbyte, will probably fail boot CRC."); _printf("Please pad the image out to 1028KB."); } fclose(fp); cnt++; } if(g->save_types[i] > 0) { // set save type _printf("Setting save type to %s", save_desc[g->save_types[i]-1]); image_set_save(c, g->save_types[i] - 1); } } if(c->verbose) _printf(info[INFO_TOTALDONE], cnt); }
/** * Call netif_poll() in the main loop of your application. This is to prevent * reentering non-reentrant functions like tcp_input(). Packets passed to * netif_loop_output() are put on a list that is passed to netif->input() by * netif_poll(). */ void netif_poll(struct netif *netif) { _printf("<%s>", __func__); struct pbuf *in; SYS_ARCH_DECL_PROTECT(lev); do { /* Get a packet from the list. With SYS_LIGHTWEIGHT_PROT=1, this is protected */ SYS_ARCH_PROTECT(lev); in = netif->loop_first; if(in != NULL) { struct pbuf *in_end = in; #if LWIP_LOOPBACK_MAX_PBUFS u8_t clen = pbuf_clen(in); /* adjust the number of pbufs on queue */ LWIP_ASSERT("netif->loop_cnt_current underflow", ((netif->loop_cnt_current - clen) < netif->loop_cnt_current)); netif->loop_cnt_current -= clen; #endif /* LWIP_LOOPBACK_MAX_PBUFS */ while(in_end->len != in_end->tot_len) { LWIP_ASSERT("bogus pbuf: len != tot_len but next == NULL!", in_end->next != NULL); in_end = in_end->next; } /* 'in_end' now points to the last pbuf from 'in' */ if(in_end == netif->loop_last) { /* this was the last pbuf in the list */ netif->loop_first = netif->loop_last = NULL; } else { /* pop the pbuf off the list */ netif->loop_first = in_end->next; LWIP_ASSERT("should not be null since first != last!", netif->loop_first != NULL); } /* De-queue the pbuf from its successors on the 'loop_' list. */ in_end->next = NULL; } SYS_ARCH_UNPROTECT(lev); if(in != NULL) { /* loopback packets are always IP packets! */ if(ip_input(in, netif) != ERR_OK) { pbuf_free(in); } /* Don't reference the packet any more! */ in = NULL; } /* go on while there is a packet on the list */ } while(netif->loop_first != NULL); }
PUBLIC int fprintf(FILE *stream, const char *format, ...) { va_list ap; NOCLOBBER int res; va_start(ap, format); TRY res = _printf(stream->wr, format, ap); FINALLY va_end(ap); ENDTRY; return res; }
/*** Print formatted output for the user ***/ void _0x94_printf(void) { char *format = (char *)current_process->cpu.ebx; va_list args = (va_list)current_process->cpu.ecx; // verify that parameter addresses are in process memory range if (current_process->cpu.ebx > current_process->memory_limit || current_process->cpu.ecx > current_process->memory_limit) { current_process->cpu.edx = 0; // means error return; } _printf(format,args,current_process->memory_base); current_process->cpu.edx = 1; // success }
int main() { char buf[64]; _printf("\n----------------welcome------------------\n"); _printf("s5pv210 farsight:\n"); _printf("CPU cortex A8 1GHz\n"); while(1) { _printf("fs@farsight#"); _gets(buf); //if( strncmp(buf, "run buzzer.bin", 14) == 0) //{ // _run_buzzer(); //} //else { _printf("error cmd :%s\n", buf); } } }
// ************************************************************************************************* // @fn display_altitude // @brief Display routine. Supports display in meters and feet. // @param u8 line LINE1 // u8 update DISPLAY_LINE_UPDATE_FULL, // DISPLAY_LINE_UPDATE_PARTIAL, DISPLAY_LINE_CLEAR // @return none // ************************************************************************************************* void display_altitude(int16_t alt, uint8_t scr) { int16_t ft; uint16_t value; if(useMetric){ // Display altitude in xxxx m format, allow 3 leading blank digits if (alt >= 0) { value = alt; display_symbol(scr, LCD_SYMB_ARROW_UP, SEG_ON); display_symbol(scr, LCD_SYMB_ARROW_DOWN, SEG_OFF); } else { value = alt * (-1); display_symbol(scr, LCD_SYMB_ARROW_UP, SEG_OFF); display_symbol(scr, LCD_SYMB_ARROW_DOWN, SEG_ON); } display_symbol(scr, LCD_UNIT_L1_M, SEG_ON); }else{ // Convert from meters to feet ft = convert_m_to_ft(alt); // Limit to 9999ft (3047m) if (ft > 9999) ft = 9999; // Display altitude in xxxx ft format, allow 3 leading blank digits if (ft >= 0) { value = ft; display_symbol(scr, LCD_SYMB_ARROW_UP, SEG_ON); display_symbol(scr, LCD_SYMB_ARROW_DOWN, SEG_OFF); } else { value = ft * -1; display_symbol(scr, LCD_SYMB_ARROW_UP, SEG_OFF); display_symbol(scr, LCD_SYMB_ARROW_DOWN, SEG_ON); } display_symbol(scr, LCD_UNIT_L1_FT, SEG_ON); } _printf(scr, LCD_SEG_L1_3_0, "%4u", value); }
/* ============= RunThreadsOn ============= */ void RunThreadsOn (int workcnt, qboolean showpacifier, void(*func)(int)) { int i; int start, end; dispatch = 0; workcount = workcnt; oldf = -1; pacifier = showpacifier; start = I_FloatTime (); func(0); end = I_FloatTime (); if (pacifier) _printf (" (%i)\n", end-start); }
/* ============= RunThreadsOn ============= */ void RunThreadsOn (int workcnt, qboolean showpacifier, void(*func)(int)) { int threadid[MAX_THREADS]; HANDLE threadhandle[MAX_THREADS]; int i; int start, end; start = I_FloatTime (); dispatch = 0; workcount = workcnt; oldf = -1; pacifier = showpacifier; threaded = qtrue; // // run threads in parallel // InitializeCriticalSection (&crit); if (numthreads == 1) { // use same thread func (0); } else { for (i=0 ; i<numthreads ; i++) { threadhandle[i] = CreateThread( NULL, // LPSECURITY_ATTRIBUTES lpsa, 0, // DWORD cbStack, (LPTHREAD_START_ROUTINE)func, // LPTHREAD_START_ROUTINE lpStartAddr, (LPVOID)i, // LPVOID lpvThreadParm, 0, // DWORD fdwCreate, &threadid[i]); } for (i=0 ; i<numthreads ; i++) WaitForSingleObject (threadhandle[i], INFINITE); } DeleteCriticalSection (&crit); threaded = qfalse; end = I_FloatTime (); if (pacifier) _printf (" (%i)\n", end-start); }
static void _alter_program(const char* no) { long lno = 0; long i = 0; mb_assert(no); lno = atoi(no); if(lno < 1 || lno > _code()->count) { _printf("Line number %ld out of bound.\n", lno); return; } --lno; free(_code()->lines[lno]); for(i = lno; i < _code()->count - 1; i++) _code()->lines[i] = _code()->lines[i + 1]; _code()->count--; }
void drawStopWatchScreen(void) { if (sSwatch_conf.state != SWATCH_MODE_BACKGROUND) { sSwatch_time[SW_DISPLAYNG] = sSwatch_time[sSwatch_conf.lap_act]; if (SW_COUNTING == sSwatch_conf.lap_act) { if (sSwatch_conf.state == SWATCH_MODE_OFF) { display_chars(0, LCD_SEG_L1_3_0, "STOP", SEG_SET); } else { display_chars(0, LCD_SEG_L1_3_2, "LP", SEG_SET); _printf(0, LCD_SEG_L1_1_0, "%2u", sSwatch_conf.laps); } } else { display_chars(0, LCD_SEG_L1_3_2, "LP", SEG_SET); _printf(0, LCD_SEG_L1_1_0, "%2u", sSwatch_conf.lap_act +1); } if (sSwatch_time[SW_DISPLAYNG].minutes < 20 && sSwatch_time[SW_DISPLAYNG].hours == 0) { _printf(0, LCD_SEG_L2_5_4, "%02u", sSwatch_time[SW_DISPLAYNG].minutes); _printf(0, LCD_SEG_L2_3_2, "%02u", sSwatch_time[SW_DISPLAYNG].seconds); _printf(0, LCD_SEG_L2_1_0, "%02u", sSwatch_time[SW_DISPLAYNG].cents); } else { _printf(0, LCD_SEG_L2_5_4, "%02u", sSwatch_time[SW_DISPLAYNG].hours); _printf(0, LCD_SEG_L2_3_2, "%02u", sSwatch_time[SW_DISPLAYNG].minutes); _printf(0, LCD_SEG_L2_1_0, "%02u", sSwatch_time[SW_DISPLAYNG].seconds); } } if (sSwatch_conf.state != SWATCH_MODE_OFF) { if (sSwatch_time[SW_COUNTING].cents == 5) { display_symbol(0, LCD_ICON_STOPWATCH, SEG_ON); } else if (sSwatch_time[SW_COUNTING].cents == 55) { display_symbol(0, LCD_ICON_STOPWATCH, SEG_OFF); } } }
static void _do_test(AtkObject *obj) { int child_count = 0; atk_object_set_description(obj, "test"); g_assert_cmpstr(atk_object_get_description(obj), ==, "test"); atk_object_set_name(obj, "test name"); g_assert_cmpstr(atk_object_get_name(obj), ==, "test name"); child_count = atk_object_get_n_accessible_children(obj); g_assert(child_count == 0); eailu_test_atk_focus(obj, TRUE); _printf("DONE. All WEB tests passed successfully \n"); eailu_test_code_called = 1; }
// intialize callback that gets called once for intialization static void _init_gl(Evas_Object *obj) { GLData *gld = evas_object_data_get(obj, "gld"); Evas_GL_API *gl = gld->glapi; GLfloat vVertices[] = { 0.0f, 0.5f, 0.0f, -0.5f, -0.5f, 0.0f, 0.5f, -0.5f, 0.0f }; if (!init_shaders(gld)) { _printf("Error Initializing Shaders\n"); g_assert(FALSE); } gl->glGenBuffers(1, &gld->vbo); gl->glBindBuffer(GL_ARRAY_BUFFER, gld->vbo); gl->glBufferData(GL_ARRAY_BUFFER, 3 * 3 * 4, vVertices, GL_STATIC_DRAW); }