Exemplo n.º 1
0
void
	pf_convert(t_modifier *m, t_array *d, va_list ap)
{
	if (m->conversion == '%')
		fta_append(d, "%", 1);
	else
		pf_size(m, d, ap);
}
Exemplo n.º 2
0
int load_dtb(char *name, void *dest, int max_bytes) {
#if CONFIG_DEVTREE == 1
  FRESULT res = FR_OK;
  unsigned int len;
  unsigned long bytes_read;
  res = pf_open(name);
  if (res != FR_OK) {
    putstr("DTB not found\n");
    goto err;
  }
  char str[32];
  str[0] = '\0';
  _strcat(str, "Open "); _strcat(str, name); _strcat(str, " OK");
  _strcat(str, "\n");
  putstr(str);

  len = pf_size();
  if (len > max_bytes || len == 0) {
    putstr("Invalid DTB length\n");
    goto err;
  }

  res = pf_lseek(0);
  if (res != FR_OK) {
    putstr("DTB lseek(0) failed");
    goto err;
  }
  res = pf_read_long(dest, len, &bytes_read);
  if (res != FR_OK) {
    putstr("DTB read failed");
    goto err;
  }

  putstr("Loaded DTB\n");
  return 0;
 err:
  putstr("Failed to load DTB\n");
  return -1;
#else
  return -1;
#endif
}