Lines Matching refs:st
18 stack_init(int num_entries, uint32_t *items, struct stack *st) in stack_init() argument
20 if (items == NULL || st == NULL) in stack_init()
23 st->max = num_entries; in stack_init()
24 st->top = STACK_EMPTY; in stack_init()
25 st->items = items; in stack_init()
33 uint32_t *stack_items(struct stack *st) in stack_items() argument
35 return st->items; in stack_items()
41 stack_size(struct stack *st) in stack_size() argument
43 return st->top + 1; in stack_size()
49 stack_is_empty(struct stack *st) in stack_is_empty() argument
51 return st->top == STACK_EMPTY; in stack_is_empty()
57 stack_is_full(struct stack *st) in stack_is_full() argument
59 return st->top == st->max - 1; in stack_is_full()
65 stack_push(struct stack *st, uint32_t x) in stack_push() argument
67 if (stack_is_full(st)) in stack_push()
72 st->items[++st->top] = x; in stack_push()
81 stack_pop(struct stack *st, uint32_t *x) in stack_pop() argument
83 if (stack_is_empty(st)) in stack_pop()
86 *x = st->items[st->top]; in stack_pop()
87 st->top--; in stack_pop()
94 void stack_dump(struct stack *st) in stack_dump() argument
98 printf("top=%d\n", st->top); in stack_dump()
99 printf("max=%d\n", st->max); in stack_dump()
101 if (st->top == -1) { in stack_dump()
106 for (i = 0; i < st->max + 7 / 8; i++) { in stack_dump()
107 printf("item[%d] 0x%08x", i, st->items[i]); in stack_dump()
110 if (i++ < st->max - 1) in stack_dump()
111 printf(" 0x%08x", st->items[i]); in stack_dump()