/* PlanetCore passes information to the OS in the form of * a table of key=value strings, separated by newlines. * * The list is terminated by an empty string (i.e. two * consecutive newlines). * * To make it easier to parse, we first convert all the * newlines into null bytes.
*/
void planetcore_prepare_table(char *table)
{ do { if (*table == '\n')
*table = 0;
table++;
} while (*(table - 1) || *table != '\n');
*table = 0;
}
constchar *planetcore_get_key(constchar *table, constchar *key)
{ int keylen = strlen(key);
do { if (!strncmp(table, key, keylen) && table[keylen] == '=') return table + keylen + 1;
table += strlen(table) + 1;
} while (strlen(table) != 0);
return NULL;
}
int planetcore_get_decimal(constchar *table, constchar *key, u64 *val)
{ constchar *str = planetcore_get_key(table, key); if (!str) return 0;
*val = strtoull(str, NULL, 10); return 1;
}
int planetcore_get_hex(constchar *table, constchar *key, u64 *val)
{ constchar *str = planetcore_get_key(table, key); if (!str) return 0;
label = planetcore_get_key(table, PLANETCORE_KEY_SERIAL_PORT); if (!label) return;
node = find_node_by_prop_value_str(NULL, "linux,planetcore-label",
label); if (!node) return;
path = get_path(node, prop_buf, MAX_PROP_LEN); if (!path) return;
chosen = finddevice("/chosen"); if (!chosen)
chosen = create_node(NULL, "chosen"); if (!chosen) return;
setprop_str(chosen, "linux,stdout-path", path);
}
Messung V0.5
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.4Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.