Beispiel #1
0
Datei: main.c Projekt: wuwx/simba
int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_init, "test_init" },
        { test_write_escape, "test_write_escape" },
        { test_write_at, "test_write_at" },
        { test_write_tx_request, "test_write_tx_request" },
        { test_read_unescape, "test_read_unescape" },
        { test_frame_type_as_string, "test_frame_type_as_string" },
        { test_tx_status_as_string, "test_tx_status_as_string" },
        { test_modem_status_as_string, "test_modem_status_as_string" },
        {
            test_at_command_response_status_as_string,
            "test_at_command_response_status_as_string"
        },
        { test_frame_as_string, "test_frame_as_string" },
        { NULL, NULL }
    };

    sys_start();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}
Beispiel #2
0
Datei: main.c Projekt: wuwx/simba
int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_get_colon, "test_get_colon" },
        { test_get_equal_sign, "test_get_equal_sign" },
        { test_get_long, "test_get_long" },
        { test_get_float, "test_get_float" },
        { test_get_line_termination, "test_get_line_termination" },
        { test_get_null_after_section, "test_get_null_after_section" },
        { test_get_missing_section_termination, "test_get_missing_section_termination" },
        { test_get_comments, "test_get_comments" },
        { test_get_whitespace, "test_get_whitespace" },
        { test_get_bad_property_format, "test_get_bad_property_format" },
        { test_get_value_too_long, "test_get_value_too_long" },
        { test_get_complex, "test_get_complex" },
        { test_set, "test_set" },
        { NULL, NULL }
    };

    sys_start();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}
Beispiel #3
0
Datei: main.c Projekt: wuwx/simba
int main()
{
    sys_start();

    uart_soft_init(&uart,
                   &pin_d4_dev,
                   &pin_d3_dev,
                   &exti_d3_dev,
                   9600,
                   qinbuf,
                   sizeof(qinbuf));

    fs_command_init(&cmd_at,
                    CSTR("/at"),
                    cmd_at_cb,
                    NULL);
    fs_command_register(&cmd_at);

    std_printf(FSTR("Welcome to HC-0X configuration tool!\r\n"
                    "\r\n"
                    "SETUP: Connect pin34 to VCC so the device enters AT mode.\r\n"
                    "\r\n"
                    "Type 'at' to start communicating with the device.\r\n"));

    shell_init(&shell,
               sys_get_stdin(),
               sys_get_stdout(),
               NULL,
               NULL,
               NULL,
               NULL);
    shell_main(&shell);

    return (0);
}
Beispiel #4
0
int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_init, "test_init" },
        { test_format, "test_format" },
        { test_mount, "test_mount" },
        { test_print, "test_print" },
        { test_file_operations, "test_file_operations" },
        { test_create_multiple_files, "test_create_multiple_files" },
        { test_reopen, "test_reopen" },
        { test_directory, "test_directory" },
        { test_bad_file, "test_bad_file" },
        { test_truncate, "test_truncate" },
        { test_append, "test_append" },
        { test_seek, "test_seek" },
        { test_unmount, "test_unmount" },
        { NULL, NULL }
    };

    sys_start();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}
Beispiel #5
0
Datei: main.c Projekt: wuwx/simba
int main()
{
    int value;
    struct analog_output_pin_t pin;

    sys_start();
    analog_output_pin_module_init();

    /* Initialize the analog output pin. */
    analog_output_pin_init(&pin, &pin_d10_dev);

    value = 0;
    
    while (1) {
        /* Write a sawtooth wave to the analog output pin. */
        analog_output_pin_write(&pin, value);
        value += 5;
        value %= 1024;

        /* Wait ten milliseconds. */
        thrd_sleep_ms(10);
    }

    return (0);
}
Beispiel #6
0
Datei: main.c Projekt: wuwx/simba
int main()
{
    /* Start the system. */
    sys_start();

    return (0);
}
Beispiel #7
0
int main()
{
    int address;
    int number_of_slaves;
    
    sys_start();
    i2c_module_init();

    i2c_init(&i2c, &i2c_0_dev, I2C_BAUDRATE_100KBPS, -1);
    i2c_start(&i2c);
    
    std_printf(FSTR("Scanning the i2c bus for slaves...\r\n"
                    "\r\n"));

    number_of_slaves = 0;
    
    for (address = 0; address < 128; address++) {
        if (i2c_scan(&i2c, address) == 1) {
            std_printf(FSTR("Found slave with address 0x%x.\r\n"), address);
            number_of_slaves++;
        }
    }

    std_printf(FSTR("\r\n"
                    "Scan complete. Found %d slaves.\r\n"), number_of_slaves);
    
    return (0);
}
Beispiel #8
0
int user_startup (void)
{
	sys_start ();
	net_start ();
	io_start ();
	pm_start ();

	return 0;
}
Beispiel #9
0
static int test_all(struct harness_t *harness_p)
{
    struct time_t timeout = {
        .seconds = 0,
        .nanoseconds = 0
    };

    sem_init(&sem, 1, 1);
    sem_init(&sem2, 2, 2);
    
    /* 1. Take all resources. */
    BTASSERT(sem_take(&sem, &timeout) == -ETIMEDOUT);

    /* Create two thrds with higher priority than this thrd. */
    thrd_spawn(sem_main,
               NULL,
               -10,
               t0_stack,
               sizeof(t0_stack));
    thrd_spawn(sem_main,
               NULL,
               -10,
               t1_stack,
               sizeof(t1_stack));

    /* 3. Wait until both threads are waiting for sem. */
    sem_take(&sem2, NULL);
    sem_take(&sem2, NULL);

    /* 4. Start both threads. */
    sem_give(&sem, 2);

    /* 6. Wait for both threads. */
    sem_take(&sem2, NULL);
    sem_take(&sem2, NULL);

    return (0);
}

int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_all, "test_all" },
        { NULL, NULL }
    };

    sys_start();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}
Beispiel #10
0
static int init()
{
    sys_start();

    http_server_init(&server,
                     &listener,
                     connections,
                     NULL,
                     routes,
                     no_route);

    http_server_start(&server);

    return (0);
}
Beispiel #11
0
int main()
{
    struct uart_driver_t uart;

    sys_start();

    uart_module_init();
    uart_init(&uart, &uart_device[0], 38400, NULL, 0);
    uart_start(&uart);
    sys_set_stdout(&uart.chout);

    std_printf(FSTR("Hello world!\n"));
    
    return (0);
}
Beispiel #12
0
Datei: main.c Projekt: wuwx/simba
int main()
{
    struct harness_t harness;
    struct harness_testcase_t testcases[] = {
        { test_list_devices, "test_list_devices" },
        { NULL, NULL }
    };

    sys_start();

    harness_init(&harness);
    harness_run(&harness, testcases);

    return (0);
}
Beispiel #13
0
int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_add_get_remove, "test_add_get_remove" },
        { NULL, NULL }
    };

    sys_start();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}
Beispiel #14
0
int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_read_write, "test_read_write" },
        { NULL, NULL }
    };

    sys_start();
    flash_module_init();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}
Beispiel #15
0
int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_automatic, "test_automatic" },
        { NULL, NULL }
    };

    sys_start();
    uart_module_init();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}
Beispiel #16
0
int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_client, "test_client" },
        { test_server, "test_server" },
        { NULL, NULL }
    };

    sys_start();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}
Beispiel #17
0
Datei: main.c Projekt: wuwx/simba
int main()
{
    struct harness_t harness;
    struct harness_testcase_t testcases[] = {
        { test_init, "test_init" },
        { test_read, "test_read" },
        { NULL, NULL }
    };

    sys_start();

    harness_init(&harness);
    harness_run(&harness, testcases);

    return (0);
}
Beispiel #18
0
int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_get_temp, "test_get_temp" },
        { NULL, NULL }
    };

    sys_start();
    ds18b20_module_init();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}
Beispiel #19
0
Datei: main.c Projekt: wuwx/simba
int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_exti, "test_exti" },
        { NULL, NULL }
    };

    sys_start();
    exti_module_init();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}
Beispiel #20
0
/**
 * The entry function for a Pumbaa application.
 */
int main()
{
    int stack_dummy;
    int res;

    /* Start the system. */
    sys_start();

    std_printf(sys_get_info());
    std_printf(FSTR("\r\n"));

    /* Initialize the thread module. */
#if MICROPY_PY_THREAD == 1
    module_thread_init();
#endif
    
    stack_top_p = (char*)&stack_dummy;
    mp_stack_set_limit(40000 * (BYTES_PER_WORD / 4));
    gc_init(heap, heap + sizeof(heap));
    mp_init();

    /* Initialize the keyboard interrupt object. */
    MP_STATE_VM(keyboard_interrupt_obj) =
        mp_obj_new_exception(&mp_type_KeyboardInterrupt);

    /* Initialize sys.path and sys.argv. */
    mp_obj_list_init(MP_OBJ_TO_PTR(mp_sys_path), 0);
    mp_obj_list_init(MP_OBJ_TO_PTR(mp_sys_argv), 0);

    /* 1. Execute the file main.py. */
    std_printf(FSTR("Executing file 'main.py'.\r\n"));
    res = pyexec_file("main.py");
    print_exit_message(res, "File 'main.py'");

    /* 2. Execute the frozen module main.py. */
    std_printf(FSTR("Executing frozen module 'main.py'.\r\n"));
    res = pyexec_frozen_module("main.py");
    print_exit_message(res, "Frozen module 'main.py'");

#if CONFIG_PUMBAA_MAIN_FRIENDLY_REPL == 1
    /* 3. Execute the interactive shell. */
    res = pyexec_friendly_repl();
    print_exit_message(res, "Interactive shell");
#endif

    return (res != 1);
}
Beispiel #21
0
int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_init, "test_init" },
        { test_write, "test_write" },
        { NULL, NULL }
    };

    sys_start();
    analog_output_pin_module_init();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}
Beispiel #22
0
static int init()
{
    struct inet_ip_addr_t ipaddr;
    struct inet_ip_addr_t netmask;
    struct inet_ip_addr_t gw;

    sys_start();

    std_printf(sys_get_info());

    uart_init(&ipuart, &uart_device[1], 115200, iprxbuf, sizeof(iprxbuf));
    uart_start(&ipuart);

    inet_module_init();
    socket_module_init();
    network_interface_slip_module_init();

    inet_aton("169.254.1.2", &ipaddr);
    inet_aton("255.255.255.0", &netmask);
    inet_aton("0.0.0.0", &gw);

    network_interface_slip_init(&slip,
                                &ipaddr,
                                &netmask,
                                &gw,
                                &ipuart.chout);
    network_interface_add(&slip.network_interface);
    network_interface_start(&slip.network_interface);

    thrd_spawn(slip_reader,
               NULL,
               0,
               stack,
               sizeof(stack));

    http_server_init(&server,
                     &listener,
                     connections,
                     NULL,
                     routes,
                     no_route);

    http_server_start(&server);

    return (0);
}
Beispiel #23
0
Datei: main.c Projekt: wuwx/simba
int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_init, "test_init" },
        { test_rising, "test_rising" },
        { test_falling, "test_falling" },
        { test_both, "test_both" },
        { NULL, NULL }
    };

    sys_start();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}
Beispiel #24
0
Datei: main.c Projekt: wuwx/simba
int main()
{
    struct harness_t harness;
    struct harness_testcase_t testcases[] = {
        { test_ramp, "test_ramp" },
        { test_sine_440_hz, "test_sine_440_hz" },
        { test_pcm1611s, "test_pcm1611s" },
        { NULL, NULL }
    };

    sys_start();
    dac_module_init();

    harness_init(&harness);
    harness_run(&harness, testcases);

    return (0);
}
Beispiel #25
0
Datei: main.c Projekt: wuwx/simba
int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_init, "test_init" },
        { test_scan, "test_scan" },
        { test_read_write_sizes, "test_read_write_sizes" },
        { test_read_write_low_high, "test_read_write_low_high" },
        { test_read_write_bad_address, "test_read_write_bad_address" },
        { NULL, NULL }
    };

    sys_start();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}
Beispiel #26
0
Datei: main.c Projekt: wuwx/simba
int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_filter, "test_filter" },
        { test_null_channels, "test_null_channels" },
        { test_list, "test_list" },
        { test_getc, "test_getc" },
        { test_putc, "test_putc" },
        { NULL, NULL }
    };

    sys_start();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}
Beispiel #27
0
int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_print, "test_print" },
        { test_object, "test_object" },
        { test_handler, "test_handler" },
        { test_log_mask, "test_log_mask" },
        { test_fs, "test_fs" },
        { NULL, NULL }
    };

    sys_start();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}
Beispiel #28
0
int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_alloc_free, "test_alloc_free" },
        { test_double_free, "test_double_free" },
        { test_share, "test_share" },
        { test_big_buffer, "test_big_buffer" },
        { test_out_of_memory, "test_out_of_memory" },
        { NULL, NULL }
    };

    sys_start();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}
Beispiel #29
0
Datei: main.c Projekt: wuwx/simba
int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_host_by_ip_address, "test_host_by_ip_address" },
        { test_bad_reply_crc, "test_bad_reply_crc" },
        { test_cmd_ping, "test_cmd_ping" },
        { test_cmd_ping_bad_reply, "test_cmd_ping_bad_reply" },
        { test_cmd_ping_bad_input, "test_cmd_ping_bad_input" },
        { NULL, NULL }
    };

    sys_start();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}
Beispiel #30
0
int main()
{
    struct harness_t harness;
    struct harness_testcase_t harness_testcases[] = {
        { test_init, "test_init" },
        { test_duty_cycles, "test_duty_cycles" },
        { test_duty_cycle_min, "test_duty_cycle_min" },
        { test_duty_cycle_max, "test_duty_cycle_max" },
        { test_frequency, "test_frequency" },
        { test_duty_cycle_convert, "test_duty_cycle_convert" },
        { NULL, NULL }
    };

    sys_start();

    harness_init(&harness);
    harness_run(&harness, harness_testcases);

    return (0);
}