Exemple #1
0
int main(int argc, char *argv[])
{
  dynmem_init(&Dm);
  dynmem_add_pool(&Dm, Memory1, sizeof(Memory1));
  tlsf_init(&Tlsf);
  tlsf_add_pool(&Tlsf, Memory2, sizeof(Memory2));

  printf("\n\n");
  HEAD
  TEST(free(malloc(16)))
  TEST(free(malloc(200)))
  TEST(free(malloc(550)))
  TEST(free(malloc(65536)))
  TEST(free(malloc(65586)))
  TEST(dynmem_free(&Dm, dynmem_malloc(&Dm, 16)))
  TEST(dynmem_free(&Dm, dynmem_malloc(&Dm, 200)))
  TEST(dynmem_free(&Dm, dynmem_malloc(&Dm, 550)))
  TEST(dynmem_free(&Dm, dynmem_malloc(&Dm, 65536)))
  TEST(dynmem_free(&Dm, dynmem_malloc(&Dm, 65586)))
  TEST(tlsf_free(&Tlsf, tlsf_malloc(&Tlsf, 16)))
  TEST(tlsf_free(&Tlsf, tlsf_malloc(&Tlsf, 200)))
  TEST(tlsf_free(&Tlsf, tlsf_malloc(&Tlsf, 550)))
  TEST(tlsf_free(&Tlsf, tlsf_malloc(&Tlsf, 65536)))
  TEST(tlsf_free(&Tlsf, tlsf_malloc(&Tlsf, 65586)))

  return 0;
}
Exemple #2
0
int tlsf_add_global_pool(void *mem, size_t bytes)
{
    if (gheap == NULL) {
        gheap = tlsf_create_with_pool(mem, bytes);
        return gheap == NULL;
    }
    else {
        return tlsf_add_pool(gheap, mem, bytes) == NULL;
    }
}
Exemple #3
0
int main(void)
{
#ifndef BOARD_NATIVE
    tlsf_add_pool(_tlsf_heap, sizeof(_tlsf_heap));
#endif
    msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);

    puts("Basic CCN-Lite example");

    ccnl_core_init();

    char line_buf[SHELL_DEFAULT_BUFSIZE];
    shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
    return 0;
}
Exemple #4
0
void Allocator::addMemory(void *v, size_t mem_size)
{
    next_t *n = impl->pools;
    while(n->next) n = n->next;
    n->next = (next_t*)v;
    n->next->next = 0x0;
    n->next->pool_size = mem_size;
    //printf("Inserting '%p'\n", v);
    off_t off = sizeof(next_t) + tlsf_pool_overhead();
    void *result =
        tlsf_add_pool(impl->tlsf, ((char*)n->next)+off,
                //0x0eadbeef);
            mem_size-off-sizeof(size_t));
    if(!result)
        printf("FAILED TO INSERT MEMORY POOL\n");
};//{(void)mem_size;};
Exemple #5
0
void x86_startup(void)
{
    tlsf_add_pool(early_malloc_pool, sizeof early_malloc_pool);

    x86_early_init_uart();
    x86_init_threading();
    x86_init_interrupts();
    x86_init_pic();
    x86_init_uart();
    x86_init_memory();
    x86_init_rtc();
    x86_init_pit();
    x86_init_hwtimer();
    x86_init_pci();
    puts("RIOT x86 hardware initialization complete.");

    x86_init_board();
    puts("RIOT board initialization complete.");

    kernel_init(); /* should not return */
    puts("kernel_init returned");
    x86_hlt();
}