Ejemplo n.º 1
0
void putc(const char c)
{
#ifdef CONFIG_SANDBOX
	if (!gd) {
		os_putc(c);
		return;
	}
#endif
#ifdef CONFIG_SILENT_CONSOLE
	if (gd->flags & GD_FLG_SILENT)
		return;
#endif

#ifdef CONFIG_DISABLE_CONSOLE
	if (gd->flags & GD_FLG_DISABLE_CONSOLE)
		return;
#endif

	if (!gd->have_console)
		return pre_console_putc(c);

	if (gd->flags & GD_FLG_DEVINIT) {
		/* Send to the standard output */
		fputc(stdout, c);
	} else {
		/* Send directly to the handler */
		serial_putc(c);
	}
}
Ejemplo n.º 2
0
/* Makes fprintf(stdout) and stderr work. */
_ssize_t _write_r(struct _reent *r, int fd, void *buf, size_t len) {
  if (fd == 1 || fd == 2) {
    size_t i;
    for (i = 0; i < len; i++) {
      os_putc(((char *) buf)[i]);
    }
    return len;
  }
  return -1;
}
Ejemplo n.º 3
0
void ICACHE_FLASH_ATTR bi_print(const char *label, bigint *x) {
	int i, j;

	if (x == NULL) {
		ssl_printf("%s: (null)\n", label);
		return;
	}

	ssl_printf("%s: (size %d)\n", label, x->size);
	for (i = x->size - 1; i >= 0; i--) {
		for (j = COMP_NUM_NIBBLES - 1; j >= 0; j--) {
			comp mask = 0x0f << (j * 4);
			comp num = (x->comps[i] & mask) >> (j * 4);
			os_putc((num <= 9) ? (num + '0') : (num + 'A' - 10));
		}
	}

	ssl_printf("\n");
}
Ejemplo n.º 4
0
/*
 * Read at most len-1 chars from the UART
 * last char will in buf will be a null
 */
char * ICACHE_FLASH_ATTR
uart_gets(char *buf, int len)
{
	int i=0; 
	char *p=buf;
	int ch;
	while (i<len)
	{
		ch = uart_getchar();
		if (ch == '\r' || ch == '\n' || ch == -1 || ch == 0x03)
		{
			*p='\0';
			return buf;	
		}
		*p=(char)ch;
		os_putc(*p);
		p++;
		i++;
	}
	*p='\0';
	return buf;
}
Ejemplo n.º 5
0
void os_puts(const char *str)
{
	while (*str)
		os_putc(*str++);
}