Esempio n. 1
0
void *test_malloc(int bytes) {
	void *ptr = kmalloc(bytes);
	putstr("Memory address: ");
	puthexint((int)ptr);
	putch('\n');
	return ptr;
}
Esempio n. 2
0
void handle_time_tick(uint32_t status_reg) {
    icount++;
    if (icount & 1) {
        gpio[LED_GPCLR] = 1 << LED_GPIO_BIT;
    } else {
        gpio[LED_GPSET] = 1 << LED_GPIO_BIT;
    }
#if 1
    if (icount % 10 == 0) {
        uart_puts("ping. sp = ");
        inspect_reg("sp");
        uart_puts(", lr = ");
        inspect_reg("lr");
        uart_puts(", status_reg = ");
        puthexint(status_reg);
        uart_puts(", irq_basic_pending = ");
        puthexint(irq_controller()->irq_basic_pending);
        uart_puts(uart_newline);
    }
#else
    UNUSED(status_reg);
#endif
    arm_timer()->irq_clear = 1;
}
Esempio n. 3
0
// kernel main function, it all begins here
void kernel_main(uint32_t r0, uint32_t r1, uint32_t atags) {
    UNUSED(atags);

    uart_init();

    // Wait a bit
    Wait(1000000);

    uart_puts(ready);
    init_heap(r0, r1);
    print_heap_range();

    pr0 = new_process(fn0);
    uart_puts("pr0 = ");
    puthexint((uint32_t)pr0);
    uart_puts(uart_newline);

    setup_timer();

    interactive_kernel_loop();

    uart_puts(halting);
}
Esempio n. 4
0
void test_free(void *ptr) {
	putstr("Freeing: ");
	puthexint((int)ptr);
	putch('\n');
	kfree(ptr);
}