/* * --------------------------------------------------------------------------- * display_dump * Displays a previously captured coredump to stdout * * Arguments: * fd - handle for open "/dev/unifiudiX" device * dump_index - index of the coredump buffer to display: * 0 = newest, -1 = oldest, 1 = next newest, etc. * Returns: * 0 on success, nonzero on error * * Notes: * --------------------------------------------------------------------------- */ static int display_dump(int fd, int dump_index) { int r = 0; int num_regs = -1; /* Dump all by default */ if (dump_index > MAX_DUMP) { fprintf(stderr, "Out of range (%d)\n", MAX_DUMP); return ERANGE; } if (brief != 0) { num_regs = BRIEF_LIMIT; } if (verbose) { printf("Dump buffer %d:\n", dump_index); } r = dump_range(fd, dump_index, UNIFIIO_COREDUMP_MAC_REG, 0, num_regs); if (r >= 0) { r = dump_range(fd, dump_index, UNIFIIO_COREDUMP_PHY_REG, 0, num_regs); } if (r >= 0) { r = dump_range(fd, dump_index, UNIFIIO_COREDUMP_SH_DMEM, 0, num_regs); } if (r >= 0) { r = dump_range(fd, dump_index, UNIFIIO_COREDUMP_MAC_DMEM, 0, num_regs); } if (r >= 0) { r = dump_range(fd, dump_index, UNIFIIO_COREDUMP_MAC_DMEM, HIGH_DATA_ADDR_MAC, num_regs); } if (r >= 0) { r = dump_range(fd, dump_index, UNIFIIO_COREDUMP_PHY_DMEM, 0, num_regs); } if (r >= 0) { r = dump_range(fd, dump_index, UNIFIIO_COREDUMP_PHY_DMEM, HIGH_DATA_ADDR_PHY, num_regs); } if (verbose) { printf("Done.\n"); } return r; }
/************************************************************************* Name: dump_parameter_definition Purpose: print out the parameter definitions *************************************************************************/ static void dump_parameter_definition ( const IAS_PARM_PARAMETER_DEFINITION *pd /* I: pointer to current item in the list */ ) { printf("Name: %s\n", pd->name); printf(" Description: %s\n", pd->description); if (pd->is_required) { printf(" Required: Yes\n"); } else { printf(" Required: No\n"); } dump_range(pd, 0, 0); dump_default(pd); }
int main (int argc, char **argv) { int i; assert(argc > 2); fp = fopen("tools/UnicodeData.txt", "r"); printf("#include <sophon_types.h>\n\n"); printf("static const Sophon_U32 %s_table[] = {", argv[1]); while (1) { char *begin; char *ptr; char *type; if (!fgets(line, sizeof(line), fp)) break; begin = line; ptr = strchr(begin, ';'); assert(ptr); *ptr = 0; code = strtol(begin, NULL, 16); begin = ptr + 1; ptr = strchr(begin, ';'); assert(ptr); begin = ptr + 1; ptr = strchr(begin, ';'); assert(ptr); type = begin; *ptr = 0; for (i = 0; i < argc; i++){ if (!strcmp(argv[i], type)) { if ((last != 0) && ((code - last) > 1)) { dump_range(); } if (range_begin == 0) range_begin = code; last = code; } } } if (range_begin ) { dump_range(); } printf("\n};\n"); fclose(fp); return 0; }
/************************************************************************* Name: dump_template Purposes: Print out the template *************************************************************************/ static void dump_template ( const IAS_PARM_PARAMETER_DEFINITION *pd /* I: pointer to current item in the list */ ) { int i; const IAS_PARM_TYPE_UNION_CONST *dv = &pd->default_values; printf(" /* %s */\n", pd->description); if (pd->is_required) { printf(" /* Required: Yes */\n"); } else { printf(" /* Required: No */\n"); } if (pd->number_valids) { printf(" "); dump_range(pd, 1, 1); } printf(" %s = ", pd->name); if (pd->number_defaults > 1) printf("("); if ((pd->type == IAS_PARM_INT) || (pd->type == IAS_PARM_BOOLEAN)) { for (i = 0; i < pd->number_defaults; i++) { if (i > 0) printf(", "); printf("%d", dv->type_int[i]); } } else if (pd->type == IAS_PARM_DOUBLE) { for (i = 0; i < pd->number_defaults; i++) { if (i > 0) printf(", "); printf("%f", dv->type_double[i]); } } else if (pd->type == IAS_PARM_STRING) { for (i = 0; i < pd->number_defaults; i++) { if (i > 0) printf(", "); printf("\"%s\"", dv->type_string_array[i]); } } if (pd->number_defaults > 1) printf(")"); printf("\n"); }