Example #1
0
void app_start(int argc, char *argv[])
{
    tp_out("TinkerPal Application - FAT MMC Test\n");

    mmc_init(&board.mmc_params);

    cli_start(&fat_mmc_test_cli_client);
}
Example #2
0
int kernel_main(unsigned int r0, unsigned int r1, unsigned int atags)
{
    //int d = -116;
    //unsigned int val = 42;
    //char c1 = 'L';
    //char c2 = 'O';
    //char str[] = "Hello! This is a string.";
    
    enable_interrupts();
    cli_start();

    while(1);

    return 0;
}
static void * cli_server_listen(void *arg)
{

  struct sockaddr caddr;
  socklen_t clen;

  clen = sizeof(caddr);

  printf("[CLI] server thread started\n");

  // to be implemented
  while (1) {
    pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);

    if (listen(cli_cfg->sfd, MAX_NUM_CLIENTS) < 0) {
      perror("listen");
      exit(1);
    }

    pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
    printf("[CLI] server Started listening on %d\n", cli_cfg->sfd);

    if ((cli_cfg->cfd = accept(cli_cfg->sfd, &caddr, &clen)) <0) {
      if (cli_cfg->cfd == EINTR )
        continue;
      else {
        perror("error on accept\n");
        exit(1);
      }
    }

    printf("[CLI] server accepted the connection %d from a new client\n", cli_cfg->cfd);
    cli_cfg->exit = 0;
    cli_start(); // init

    do {
      clen = recv(cli_cfg->cfd, buffer, MAX_SOCK_BUFFER_SIZE, 0);

      if (cli_server_handler)
        cli_server_handler(buffer, clen);

    } while (cli_cfg->exit == 0);

    cli_finish();
  }

  pthread_exit(NULL);
}
Example #4
0
File: main.c Project: ayllon/dalek
void main(BootInformation* boot_info)
{
    asm("cli");
    // Memory
    mm_initialize(boot_info);
    // IDT and IRQ
    idt_install();
    irq_install();
    // Install handlers
    timer_init();
    // Re-enable interrupts
    asm("sti");
    // Initialize IO
    io_init();
    // Initialize modules
    mod_init_all();

    // Welcome
    printf("Stage 2 loaded from drive %i\n", boot_info->boot_drive);

    printf("%d entries found for the memory\n", boot_info->smap_size);
    int i = 0;
    for (i = 0; i < boot_info->smap_size; ++i) {
        SMAPEntry *ent = &(boot_info->smap_entries[i]);
        printf("\tACPI Flags 0x%x Type %d ",
                ent->acpi & 0x03, ent->type);
        printf("Base 0x%016llx\tSize %lld\n", ent->base, ent->length);
    }

    // Launch command line interpreter
    cli_start();

    // Should never reach this, but just in case...
    while (1)
        asm("hlt");
}