static size_t do_stackcheck(uintptr_t alloc, size_t size) { FAR uint8_t *ptr; size_t mark; #if 0 int i; int j; #endif /* The AVR uses a push-down stack: the stack grows toward lower addresses * in memory. We need to start at the lowest address in the stack memory * allocation and search to higher addresses. The first byte we encounter * that does not have the magic value is the high water mark. */ for (ptr = (FAR uint8_t *)alloc, mark = size; *ptr == STACK_COLOR && mark > 0; ptr++, mark--); /* If the stack is completely used, then this might mean that the stack * overflowed from above (meaning that the stack is too small), or may * have been overwritten from below meaning that some other stack or data * structure overflowed. * * If you see returned values saying that the entire stack is being used * then enable the following logic to see it there are unused areas in the * middle of the stack. */ #if 0 if (mark + 16 > size) { ptr = (FAR uint8_t *)alloc; for (i = 0; i < size; i += 64) { for (j = 0; j < 64; j++) { int ch; if (*ptr++ == STACK_COLOR) { ch = '.'; } else { ch = 'X'; } up_putc(ch); } up_putc('\n'); } } #endif /* Return our guess about how much stack space was used */ return mark; }
size_t up_check_tcbstack(FAR struct tcb_s *tcb) { FAR uint32_t *ptr; size_t mark; /* The ARM uses a push-down stack: the stack grows toward lower addresses * in memory. We need to start at the lowest address in the stack memory * allocation and search to higher addresses. The first word we encounter * that does not have the magic value is the high water mark. */ for (ptr = (FAR uint32_t *)tcb->stack_alloc_ptr, mark = tcb->adj_stack_size/4; *ptr == 0xDEADBEEF && mark > 0; ptr++, mark--); /* If the stack is completely used, then this might mean that the stack * overflowed from above (meaning that the stack is too small), or may * have been overwritten from below meaning that some other stack or data * structure overflowed. * * If you see returned values saying that the entire stack is being used * then enable the following logic to see it there are unused areas in the * middle of the stack. */ #if 0 if (mark + 16 > tcb->adj_stack_size/4) { int i, j; ptr = (FAR uint32_t *)tcb->stack_alloc_ptr; for (i = 0; i < tcb->adj_stack_size; i += 4*64) { for (j = 0; j < 64; j++) { int ch; if (*ptr++ == 0xDEADBEEF) { ch = '.'; } else { ch = 'X'; } up_putc(ch); } up_putc('\n'); } } #endif /* Return our guess about how much stack space was used */ return mark*4; }
void misoc_puts(const char *str) { while (*str) { up_putc(*str++); } }
/************************************************************************************** * Name: ssd1289_dumprun * * Description: * Dump the contexts of the run buffer: * * run - The buffer in containing the run read to be dumped * npixels - The number of pixels to dump * **************************************************************************************/ #if 0 /* Sometimes useful */ static void ssd1289_dumprun(FAR const char *msg, FAR uint16_t *run, size_t npixels) { int i, j; lib_rawprintf("\n%s:\n", msg); for (i = 0; i < npixels; i += 16) { up_putc(' '); lib_rawprintf(" "); for (j = 0; j < 16; j++) { lib_rawprintf(" %04x", *run++); } up_putc('\n'); } }
void up_puts(__code char *ptr) { for (; *ptr; ptr++) { up_putc(*ptr); } }
/************************************************************************************** * Name: mio283qt2_dumprun * * Description: * Dump the contexts of the run buffer: * * run - The buffer in containing the run read to be dumped * npixels - The number of pixels to dump * **************************************************************************************/ #if 0 /* Sometimes useful */ static void mio283qt2_dumprun(FAR const char *msg, FAR uint16_t *run, size_t npixels) { int i, j; syslog("\n%s:\n", msg); for (i = 0; i < npixels; i += 16) { up_putc(' '); syslog(" "); for (j = 0; j < 16; j++) { syslog(" %04x", *run++); } up_putc('\n'); } }
static void readline_write(FAR struct rl_common_s *vtbl, FAR const char *buffer, size_t buflen) { for (; buflen > 0; buflen--) { up_putc(*buffer++); } }
static ssize_t lowconsole_write(struct file *filep, const char *buffer, size_t buflen) { ssize_t ret = buflen; for (; buflen; buflen--) { up_putc(*buffer++); } return ret; }
static void readline_putc(FAR struct rl_common_s *vtbl, int ch) { up_putc(ch); }