Пример #1
0
// This is the main starting point for our example application.
void cyg_user_start(void)
{
    int err;
    void* lib_handle;
    void (*fn)(void);
    
    CYG_TEST_INIT();

    CYG_TEST_INFO("Object loader module test started");

    err = chdir("/");

    if(err < 0) 
        SHOW_RESULT(chdir, err);

    lib_handle = cyg_ldr_open_library((CYG_ADDRWORD)"/hello.o", 0);
    CYG_TEST_CHECK(lib_handle , "Unable to load object file to load");

    fn = cyg_ldr_find_symbol(lib_handle, "print_message");
    CYG_TEST_CHECK(fn , "Unable to find print_message function");

    fn();

    fn = cyg_ldr_find_symbol(lib_handle, "weak_function");
    CYG_TEST_CHECK(fn , "Unable to find weak_function");
    
    fn();

    fn = cyg_ldr_find_symbol (lib_handle, "unresolvable_symbol");
    CYG_TEST_CHECK(!fn , "Found none existing symbol!");
    
    thread_a = cyg_ldr_find_symbol(lib_handle, "thread_a");
    thread_b = cyg_ldr_find_symbol(lib_handle, "thread_b");
    CYG_TEST_CHECK(thread_a && thread_b , "Unable to find thread functions");
    
    // Create our two threads.
    cyg_thread_create(THREAD_PRIORITY,
                       thread_a,
                       (cyg_addrword_t) 75,
                       "Thread A",
                       (void *)thread_a_stack,
                       THREAD_STACK_SIZE,
                       &thread_a_hdl,
                       &thread_a_obj);

    cyg_thread_create(THREAD_PRIORITY + 1,
                       thread_b,
                       (cyg_addrword_t) 68,
                       "Thread B",
                       (void *)thread_b_stack,
                       THREAD_STACK_SIZE,
                       &thread_b_hdl,
                       &thread_b_obj);

    // Resume the threads so they start when the scheduler begins.
    cyg_thread_resume(thread_a_hdl);
    cyg_thread_resume(thread_b_hdl);

    cyg_scheduler_start();
}
Пример #2
0
void
cyg_start(void)
{
    CYG_TEST_INIT();

    cyg_thread_create(MAIN_THREAD_PRIORITY,     // Priority
                      tcp_server,               // entry
                      0,                        // entry parameter
                      "TCP loopback server",    // Name
                      &stack_server[0],         // Stack
                      STACK_SIZE,               // Size
                      &server_thread_handle,    // Handle
                      &server_thread_data       // Thread data structure
            );
    cyg_thread_resume(server_thread_handle);    // Start it

    cyg_thread_create(MAIN_THREAD_PRIORITY,     // Priority
                      tcp_client,               // entry
                      0,                        // entry parameter
                      "TCP loopback client",    // Name
                      &stack_client[0],         // Stack
                      STACK_SIZE,               // Size
                      &client_thread_handle,    // Handle
                      &client_thread_data       // Thread data structure
            );
    cyg_scheduler_start();
}
Пример #3
0
void timeslice_main( void )
{
    CYG_TEST_INIT();

    // Work out how many CPUs we actually have.
    ncpus = CYG_KERNEL_CPU_COUNT();

    cyg_thread_create(0,              // Priority - just a number
                      run_tests, // entry
                      0,               // index
                      "run_tests",     // Name
                      test_stack,   // Stack
                      STACK_SIZE,      // Size
                      &main_thread,     // Handle
                      &test_thread // Thread data structure
        );
    cyg_thread_resume( main_thread);

    cyg_thread_create(5,               // Priority - just a number
                      hipri_test,      // entry
                      0,               // index
                      "hipri_run",     // Name
                      hipri_stack,   // Stack
                      STACK_SIZE,      // Size
                      &hipri_thread,     // Handle
                      &hipri_thread_obj // Thread data structure
        );
    cyg_thread_resume( hipri_thread);
    
    cyg_scheduler_start();
}
Пример #4
0
void
cyg_start(void)
{
    CYG_TEST_INIT();
    
    //
    // open flexcan device driver
    //
    if (ENOERR != cyg_io_lookup("/dev/can0", &hDrvFlexCAN)) 
    {
        CYG_TEST_FAIL_FINISH("Error opening /dev/can0");
    }
    
   
    //
    // create the two threads which access the CAN device driver
    // a reader thread with a higher priority and a writer thread
    // with a lower priority
    //
    cyg_thread_create(4, can0_thread, 
                        (cyg_addrword_t) 0,
		                "can0_thread", 
		                (void *) can0_thread_data.stack, 
		                1024 * sizeof(long),
		                &can0_thread_data.hdl, 
		                &can0_thread_data.obj);
		                
    cyg_thread_resume(can0_thread_data.hdl);
    
    cyg_scheduler_start();
}
Пример #5
0
externC void
cyg_start( void )
{
    int i;
    
    diag_init();

    diag_write_string("Philosophers\n");
    diag_write_string("Started\n");

    // Zero last element in state so it acts like
    // a string.
    pstate[PHILOSOPHERS] = 0;

#if 1
    for( i = 0; i < PHILOSOPHERS; i++ )
    {
        change_state(i,'T');            // starting state

        cyg_thread_create(4, Philosopher, (cyg_addrword_t)i, "philosopher",
            (void *)(&thread_stack[i]), STACKSIZE,
            &thread_handle[i], &thread[i]);

        // resume it
        cyg_thread_resume(thread_handle[i]);

        // and make the matching chopstick present
        cyg_semaphore_init( &chopstick[i], 1);
    }
#endif
    
    // Get the world going
    cyg_scheduler_start();

}
Пример #6
0
externC void
cyg_start( void )
{
    // Fill in the BSP memory info
    if (cygmon_memsize != 0)
        ecos_bsp_set_memsize(cygmon_memsize);

#ifdef CYGPKG_KERNEL
    // Create a main thread, so we can run the scheduler and have time 'pass'
    cyg_thread_create(10,                // Priority - just a number
                      (cyg_thread_entry_t*)cygmon_main,       // entry
                      0,                 // entry parameter
                      "Cygmon",          // Name
                      &stack[0],         // Stack
                      STACK_SIZE,        // Size
                      &thread_handle,    // Handle
                      &thread_data       // Thread data structure
                     );
    cyg_thread_resume(thread_handle);  // Start it
    cyg_scheduler_start();
#else
#ifdef HAL_ARCH_FUNCALL_NEW_STACK
    HAL_ARCH_FUNCALL_NEW_STACK(cygmon_main, &stack[0], STACK_SIZE);
#else
#error Need to define HAL_ARCH_FUNCALL_NEW_STACK
#endif
#endif
} // cyg_package_start()
Пример #7
0
void
cyg_start(void)
{
    CYG_TEST_INIT();
    
    //
    // open CAN device driver
    //
    if (ENOERR != cyg_io_lookup("/dev/can0", &hCAN0)) 
    {
        CYG_TEST_FAIL_FINISH("Error opening /dev/can0");
    }
    
    //
    // create the thread that accesses the CAN device driver
    //
    cyg_thread_create(4, can0_thread, 
                        (cyg_addrword_t) 0,
                        "can0_thread", 
                        (void *) can0_thread_data.stack, 
                        1024 * sizeof(long),
                        &can0_thread_data.hdl, 
                        &can0_thread_data.obj);
                        
    cyg_thread_resume(can0_thread_data.hdl);
    
    cyg_scheduler_start();
}
Пример #8
0
void
cyg_start(void)
{
    CYG_TEST_INIT();
    
    //
    // create the two threads which access the CAN device driver
    //
    cyg_thread_create(4, can0_thread, 
                        (cyg_addrword_t) 0,
		                "can0_thread", 
		                (void *) can0_thread_data.stack, 
		                1024 * sizeof(long),
		                &can0_thread_data.hdl, 
		                &can0_thread_data.obj);
		                
    cyg_thread_create(5, can1_thread, 
                        (cyg_addrword_t) can0_thread_data.hdl,
		                "can1_thread", 
		                (void *) can1_thread_data.stack, 
		                1024 * sizeof(long),
		                &can1_thread_data.hdl, 
		                &can1_thread_data.obj);
		                
    cyg_thread_resume(can0_thread_data.hdl);
    cyg_thread_resume(can1_thread_data.hdl);
    
    cyg_scheduler_start();
}
Пример #9
0
void kmutex1_main( void )
{
    CYG_TEST_INIT();

    cyg_thread_create(4, entry0 , (cyg_addrword_t)0, "kmutex1-0",
        (void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
    cyg_thread_resume(thread[0]);

    cyg_thread_create(4, entry1 , (cyg_addrword_t)1, "kmutex1-1",
        (void *)stack[1], STACKSIZE, &thread[1], &thread_obj[1]);
    cyg_thread_resume(thread[1]);

    cyg_thread_create(4, entry2 , (cyg_addrword_t)2, "kmutex1-2",
        (void *)stack[2], STACKSIZE, &thread[2], &thread_obj[2]);
    cyg_thread_resume(thread[2]);

    cyg_mutex_init( &m0 );
    cyg_mutex_init( &m1 );

    cyg_cond_init( &cvar0, &m0 );
    cyg_cond_init( &cvar1, &m0 );
    cyg_cond_init( &cvar2, &m1 );

    cyg_scheduler_start();

    CYG_TEST_FAIL_FINISH("Not reached");
}
Пример #10
0
void fptest_main( void )
{
    
    CYG_TEST_INIT();

    if( cyg_test_is_simulator )
    {
        run_ticks = RUN_TICKS_SIM;
    }

    CYG_TEST_INFO("Run fptest in cyg_start");
    do_test( fpt3_values, FP3_COUNT, 1000, 0, "start" );
    CYG_TEST_INFO( "cyg_start run done");
    
    cyg_thread_create( BASE_PRI-1,
                       fptest1,
                       0,
                       "fptest1",
                       &stacks[0][0],
                       STACK_SIZE,
                       &thread[0],
                       &thread_struct[0]);

    cyg_thread_resume( thread[0] );

    cyg_thread_create( BASE_PRI,
                       fptest2,
                       1,
                       "fptest2",
                       &stacks[1][0],
                       STACK_SIZE,
                       &thread[1],
                       &thread_struct[1]);

    cyg_thread_resume( thread[1] );

    cyg_thread_create( BASE_PRI,
                       fptest3,
                       2,
                       "fptest3",
                       &stacks[2][0],
                       STACK_SIZE,
                       &thread[2],
                       &thread_struct[2]);

    cyg_thread_resume( thread[2] );

    cyg_alarm_create( cyg_real_time_clock(),
                      alarm_fn,
                      0,
                      &alarm,
                      &alarm_struct );

    cyg_alarm_initialize( alarm, cyg_current_time()+1, 1 );
    
    cyg_scheduler_start();

}
Пример #11
0
int cyg_start(void)
{
#if defined(CYGPKG_FS_FAT)
  int err;
  int existingdirents=-1;
#endif

  DBG("Start USB MSD application\n\r");

#if defined(CYGPKG_FS_FAT)

  // Mount RAM disk partition 1
  err = mount( "/dev/ramdisk0/1", "/", "fatfs" );

  if( err < 0 )
     SHOW_RESULT( mount, err );

  err = chdir( "/" );
  if( err < 0 )
     SHOW_RESULT( chdir, err );

  checkcwd( "/" );

  // Display list of all files/directories from root
  listdir( "/", true, -1, &existingdirents );

  // Play around with the file-system, create / copy /
  // compare files
  createfile( "/foo", 1000 );
  checkfile( "foo" );
  copyfile( "foo", "fee" );
  checkfile( "fee" );
  comparefiles( "foo", "/fee" );
  DBG("<INFO>: mkdir bar\n");

  // Create new directory
  err = mkdir( "/bar", 0 );
  if( err < 0 )
     SHOW_RESULT( mkdir, err );

  // Display list of all files/directories from root
  listdir( "/" , true, existingdirents+3, NULL );

  // Umount file-system
  err = umount( "/" );

  if( err < 0 )
     SHOW_RESULT( umount, err );

#endif

  // Start Mass Storage Service
  usbs_msd_start();

  // Start scheduler
  cyg_scheduler_start();

}
Пример #12
0
void kcache2_main( void )
{
    CYG_TEST_INIT();

    cyg_thread_create(4, entry0 , (cyg_addrword_t)0, "kcache1",
        (void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
    cyg_thread_resume(thread[0]);

    cyg_scheduler_start();
}
Пример #13
0
externC void
cyg_start( void )
{
    CYG_TEST_INIT();

    cyg_thread_create(4, entry0 , (cyg_addrword_t)0, "intr",
        (void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
    cyg_thread_resume(thread[0]);

    cyg_scheduler_start();
}
Пример #14
0
void zlib2_main( void )
{
    CYG_TEST_INIT();

    cyg_thread_create(4, entry0 , (cyg_addrword_t)0, "zlib1",
        (void *)stack[0], STACKSIZE,&thread[0], &thread_obj[0]);
    cyg_thread_resume(thread[0]);

    cyg_scheduler_start();

    CYG_TEST_FAIL_FINISH("Not reached");
}
Пример #15
0
Файл: main.c Проект: VEROS/VEROS
/* --------------------------------------------------------------------------
 *  cyg_start
 *
 *  ARM entry function
 *
 *  @param	: void
 *  @return	: void
 *  @see	: start_thread
 *
 *    ARM entry function, start thread.
 * --------------------------------------------------------------------------
 */
void cyg_start(void)
{

#ifdef MVBPROJ_BASIC_INFO_SUPPORT
	printf("\n\n\n\n\nMVB ARM monitor for T113 (build%04d)\n\n", MVB_BUILD_DEFINITION);
#endif // ifdef MVBPROJ_BASIC_INFO_SUPPORT

#ifdef MVBPROJ_LED_SUPPORT
	mvb_arm_init_led(0);
#endif

	cyg_thread_create(START_WORKTHREAD_PRI, start_thread, 0, "START ARM", &start_stack, STACK_SIZE, &start_thread_handle, &start_thread_data);
    cyg_thread_resume(start_thread_handle);
	cyg_scheduler_start();
}
Пример #16
0
void
cyg_start(void)
{
    CYG_TEST_INIT();
    cyg_thread_create(10,                   // Priority - just a number
                      (cyg_thread_entry_t*)serial_test,         // entry
                      0,                    // 
                      "serial_thread",     // Name
                      &stack[0],            // Stack
                      CYGNUM_HAL_STACK_SIZE_TYPICAL,           // Size
                      &thread_handle,       // Handle
                      &thread_data          // Thread data structure
        );
    cyg_thread_resume(thread_handle);
    cyg_scheduler_start();
}
Пример #17
0
extern void cyg_start(void)
{
    //CYG_TEST_INIT();
    //CYG_TEST_NA("Kernel C API layer disabled");
    GL_Status_t res;

    diag_printf("GSL test beginning\n");

    GL_Init();

    res = GL_QueueCreate("queue1", 511, 10, 5, &queue_id1);
    CHECK_RES((res == GL_SUCCESS)) res = GL_TaskCreate("Task1", entry1, NULL, 12, 4 * 1024, true, &task1);
    CHECK_RES((res == GL_SUCCESS)) res = GL_TaskCreate("Task2", entry2, NULL, 12, 4 * 1024, true, &task2);
    CHECK_RES((res == GL_SUCCESS)) res = GL_TaskCreate("Task3", entry3, NULL, 12, 4 * 1024, true, &task3);
    CHECK_RES((res == GL_SUCCESS)) cyg_scheduler_start();
}
Пример #18
0
externC void
cyg_start( void )
{
    // Create a main thread, so we can run the scheduler and have time 'pass'
    cyg_thread_create(10,                // Priority - just a number
                      program_flash,     // entry
                      1,                 // index
                      "program_thread",  // Name
                      &stack[0],         // Stack
                      STACK_SIZE,        // Size
                      &thread_handle,    // Handle
                      &thread_data       // Thread data structure
            );
    cyg_thread_resume(thread_handle);  // Start it
    cyg_scheduler_start();
} // cyg_package_start()
Пример #19
0
void kthread1_main( void )
{
    CYG_TEST_INIT();

    cyg_thread_create(4, entry0, (cyg_addrword_t)222, "kthread1-0",
        (void *)stack[0], STACKSIZE, &pt0, &thread[0] );
    cyg_thread_create(4, entry1, (cyg_addrword_t)333, "kthread1-1",
        (void *)stack[1], STACKSIZE, &pt1, &thread[1] );

    cyg_thread_resume(pt0);
    cyg_thread_resume(pt1);

    cyg_scheduler_start();

    CYG_TEST_FAIL_FINISH("Not reached");
}
Пример #20
0
void cyg_user_start(void)
{
    CYG_TEST_INIT();
    cyg_thread_create(
        10,                                   // Arbitrary priority
        (cyg_thread_entry_t*) run_tests,      // Thread entry point
        0,                                    //
        "test_thread",                        // Thread name
        &stack[0],                            // Stack
        CYGNUM_HAL_STACK_SIZE_TYPICAL,        // Stack size
        &thread_handle,                       // Thread handle
        &thread_data                          // Thread data structure
    );
    cyg_thread_resume(thread_handle);
    cyg_scheduler_start();
}
Пример #21
0
void
cyg_start(void)
{
    // Create a main thread, so we can run the scheduler and have time 'pass'
    cyg_thread_create(10,                // Priority - just a number
                      net_test,          // entry
                      0,                 // entry parameter
                      "Network test",    // Name
                      &stack[0],         // Stack
                      STACK_SIZE,        // Size
                      &thread_handle,    // Handle
                      &thread_data       // Thread data structure
            );
    cyg_thread_resume(thread_handle);  // Start it
    cyg_scheduler_start();
}
Пример #22
0
void
nc_slave_main(void)
{
	int i;	
	
	CYG_TEST_INIT();
   // Create the idle thread environment
    cyg_semaphore_init(&idle_thread_sem, 0);
    cyg_thread_create(IDLE_THREAD_PRIORITY,     // Priority
                      net_idle,                 // entry
                      0,                        // entry parameter
                      "Network idle",           // Name
                      &idle_thread_stack[0],    // Stack
                      STACK_SIZE,               // Size
                      &idle_thread_handle,      // Handle
                      &idle_thread_data         // Thread data structure
            );
    cyg_thread_resume(idle_thread_handle);      // Start it
    // Create the load threads and their environment(s)
    for (i = 0;  i < NUM_LOAD_THREADS;  i++) {
        cyg_semaphore_init(&load_thread_sem[i], 0);
        cyg_thread_create(LOAD_THREAD_PRIORITY,     // Priority
                          net_load,                 // entry
                          i,                        // entry parameter
                          "Background load",        // Name
                          &load_thread_stack[i][0], // Stack
                          STACK_SIZE,               // Size
                          &load_thread_handle[i],   // Handle
                          &load_thread_data[i]      // Thread data structure
            );
        cyg_thread_resume(load_thread_handle[i]);   // Start it
    }
    // Create a main thread, so we can run the scheduler and have time 'pass'
    cyg_thread_create(10,                // Priority - just a number
                      tmain,          // entry
                      0,                 // entry parameter
                      "socket echo test",        // Name
                      &stack[0],         // Stack
                      STACK_SIZE,        // Size
                      &thread_handle,    // Handle
                      &thread_data       // Thread data structure
            );
    cyg_thread_resume(thread_handle);  // Start it
    cyg_scheduler_start();
    CYG_TEST_FAIL_FINISH("Not reached");
}
Пример #23
0
externC void
cyg_start( void )
{
    // Create a main thread, so we can run the scheduler and have time 'pass'
    cyg_thread_create(11,                // Priority - just a number
                      audio_exercise,    // entry
                      0,                 // initial parameter
                      "AUDIO_thread",    // Name
                      &stack[0],         // Stack
                      STACK_SIZE,        // Size
                      &thread_handle,    // Handle
                      &thread_data       // Thread data structure
            );
    cyg_thread_resume(thread_handle);  // Start it
    // Let 'em fly...
    cyg_scheduler_start();
} // cyg_package_start()
Пример #24
0
void
cyg_start(void *n)
{
    int i;
    // Create processing threads
    for (i = 0;  i < CYGHWR_NET_DRIVERS;  i++) {
        cyg_thread_create(MAIN_THREAD_PRIORITY,     // Priority
                          net_test,                 // entry
                          i,                        // entry parameter
                          "Network test",           // Name
                          &main_thread_stack[i][0], // Stack
                          STACK_SIZE,               // Size
                          &main_thread_handle[i],   // Handle
                          &main_thread_data[i]      // Thread data structure
            );
    }
    cyg_thread_resume(main_thread_handle[0]);   // Start first one
    // Create the idle thread environment
    cyg_semaphore_init(&idle_thread_sem, 0);
    cyg_thread_create(IDLE_THREAD_PRIORITY,     // Priority
                      net_idle,                 // entry
                      0,                        // entry parameter
                      "Network idle",           // Name
                      &idle_thread_stack[0],    // Stack
                      STACK_SIZE,               // Size
                      &idle_thread_handle,      // Handle
                      &idle_thread_data         // Thread data structure
            );
    cyg_thread_resume(idle_thread_handle);      // Start it
    // Create the load threads and their environment(s)
    for (i = 0;  i < NUM_LOAD_THREADS;  i++) {
        cyg_semaphore_init(&load_thread_sem[i], 0);
        cyg_thread_create(LOAD_THREAD_PRIORITY,     // Priority
                          net_load,                 // entry
                          i,                        // entry parameter
                          "Background load",        // Name
                          &load_thread_stack[i][0], // Stack
                          STACK_SIZE,               // Size
                          &load_thread_handle[i],   // Handle
                          &load_thread_data[i]      // Thread data structure
            );
        cyg_thread_resume(load_thread_handle[i]);   // Start it
    }
    cyg_scheduler_start();
}
Пример #25
0
void
cyg_start(void)
{
    CYG_TEST_INIT();

    // Create a main thread, so we can run the scheduler and have time 'pass'
    cyg_thread_create(CYGPKG_NET_THREAD_PRIORITY-4,// Priority - just a number
                      net_test,                 // entry
                      0,                        // entry parameter
                      "Loopback ping  test",    // Name
                      &stack[0],                // Stack
                      STACK_SIZE,               // Size
                      &thread_handle,           // Handle
                      &thread_data              // Thread data structure
            );
    cyg_thread_resume(thread_handle);           // Start it
    cyg_scheduler_start();
}
Пример #26
0
void
cyg_start(void)
{
    CYG_TEST_INIT();
    
    //
    // open flexcan device driver
    //
    if (ENOERR != cyg_io_lookup("/dev/can0", &hDrvFlexCAN)) 
    {
        CYG_TEST_FAIL_FINISH("Error opening /dev/can0");
    }
    
    //
    // setup CAN baudrate 250 KBaud
    // We do not setup baud rate and use the default baud rate instead
    /*
    cyg_uint32     len;
    cyg_can_info_t can_cfg;
    can_cfg.baud = CYGNUM_CAN_KBAUD_250;
    len = sizeof(can_cfg);
    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_INFO ,&can_cfg, &len))
    {
        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
    }*/
    
    //
    // create the two threads which access the CAN device driver
    // a reader thread with a higher priority and a writer thread
    // with a lower priority
    //
    cyg_thread_create(4, can0_thread, 
                        (cyg_addrword_t) 0,
		                "can0_thread", 
		                (void *) can0_thread_data.stack, 
		                1024 * sizeof(long),
		                &can0_thread_data.hdl, 
		                &can0_thread_data.obj);
		                
    cyg_thread_resume(can0_thread_data.hdl);
    
    cyg_scheduler_start();
}
Пример #27
0
void
cyg_start(void)
{
    int i;
    // Create a main thread which actually runs the test
    cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority
                      net_test,             // entry
                      0,                    // entry parameter
                      "Network test",       // Name
                      &stack[0],            // Stack
                      STACK_SIZE,           // Size
                      &thread_handle,       // Handle
                      &thread_data          // Thread data structure
            );
    cyg_thread_resume(thread_handle);  // Start it
    // Create the idle thread environment
    cyg_semaphore_init(&idle_thread_sem, 0);
    cyg_thread_create(IDLE_THREAD_PRIORITY,     // Priority
                      net_idle,                 // entry
                      0,                        // entry parameter
                      "Network idle",           // Name
                      &idle_thread_stack[0],    // Stack
                      STACK_SIZE,               // Size
                      &idle_thread_handle,      // Handle
                      &idle_thread_data         // Thread data structure
            );
    cyg_thread_resume(idle_thread_handle);      // Start it
    // Create the load threads and their environment(s)
    for (i = 0;  i < NUM_LOAD_THREADS;  i++) {
        cyg_semaphore_init(&load_thread_sem[i], 0);
        cyg_thread_create(LOAD_THREAD_PRIORITY,     // Priority
                          net_load,                 // entry
                          i,                        // entry parameter
                          "Background load",        // Name
                          &load_thread_stack[i][0], // Stack
                          STACK_SIZE,               // Size
                          &load_thread_handle[i],   // Handle
                          &load_thread_data[i]      // Thread data structure
            );
        cyg_thread_resume(load_thread_handle[i]);   // Start it
    }
    cyg_scheduler_start();
}
Пример #28
0
void
cyg_start(void)
{
    CYG_TEST_INIT();

    // Create the main ADC test thread
    cyg_thread_create(
        4,
        adc_thread,
        (cyg_addrword_t) 0,
        "adc1",
        thread_stack,
        sizeof(thread_stack),
        &thread_handle,
        &thread_data
    );
    cyg_thread_resume(thread_handle);
    cyg_scheduler_start();
}
Пример #29
0
void except0_main( void )
{
    // Use CYG_TEST_GDBCMD _before_ CYG_TEST_INIT()
    CYG_TEST_GDBCMD("handle SIGBUS nostop");
    CYG_TEST_GDBCMD("handle SIGSEGV nostop");
    CYG_TEST_GDBCMD("handle SIGFPE nostop");

    CYG_TEST_INIT();

#ifdef HAL_VSR_SET_TO_ECOS_HANDLER
    // Reclaim the VSR off CygMon possibly
#ifdef CYGNUM_HAL_EXCEPTION_DATA_ACCESS
    HAL_VSR_SET_TO_ECOS_HANDLER( CYGNUM_HAL_EXCEPTION_DATA_ACCESS, NULL );
#endif
#ifdef CYGNUM_HAL_EXCEPTION_DATA_TLBMISS_ACCESS
    HAL_VSR_SET_TO_ECOS_HANDLER( CYGNUM_HAL_EXCEPTION_DATA_TLBMISS_ACCESS, NULL );
#endif
#ifdef CYGNUM_HAL_EXCEPTION_DATA_UNALIGNED_ACCESS
    HAL_VSR_SET_TO_ECOS_HANDLER( CYGNUM_HAL_EXCEPTION_DATA_UNALIGNED_ACCESS, NULL );
#endif
#ifdef CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION
    HAL_VSR_SET_TO_ECOS_HANDLER( CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION, NULL );
#endif
#ifdef CYGNUM_HAL_EXCEPTION_DIV_BY_ZERO
    HAL_VSR_SET_TO_ECOS_HANDLER( CYGNUM_HAL_EXCEPTION_DIV_BY_ZERO, NULL );
#endif
#ifdef CYGNUM_HAL_EXCEPTION_FPU
    HAL_VSR_SET_TO_ECOS_HANDLER( CYGNUM_HAL_EXCEPTION_FPU, NULL );
#endif
#ifdef CYGNUM_HAL_EXCEPTION_FPU_DIV_BY_ZERO
    HAL_VSR_SET_TO_ECOS_HANDLER( CYGNUM_HAL_EXCEPTION_FPU_DIV_BY_ZERO, NULL );
#endif
#endif

    cyg_thread_create(4, entry0 , (cyg_addrword_t)0, "kexcept1",
        (void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
    cyg_thread_resume(thread[0]);

    cyg_scheduler_start();

    CYG_TEST_FAIL_FINISH("Not reached");
}
Пример #30
0
void ksem1_main( void )
{
    CYG_TEST_INIT();

    cyg_semaphore_init( &s0, 0);
    cyg_semaphore_init( &s1, 2);
    cyg_semaphore_init( &s2, 0);

    cyg_thread_create(4, entry0 , (cyg_addrword_t)0, "ksem1-0",
        (void *)stack[0], STACKSIZE,&thread[0], &thread_obj[0]);
    cyg_thread_resume(thread[0]);

    cyg_thread_create(4, entry1 , (cyg_addrword_t)1, "ksem1-1",
        (void *)stack[1], STACKSIZE, &thread[1], &thread_obj[1]);
    cyg_thread_resume(thread[1]);

    cyg_scheduler_start();

    CYG_TEST_FAIL_FINISH("Not reached");
}