* =================================================================
* #####DESCRIPTIONBEGIN####
*
- * Author(s): atonizzo@lycos.com
+ * Author(s): Anthony Tonizzo (atonizzo@gmail.com)
* Date: 2005-05-13
* Purpose:
* Description:
//==========================================================================
-MTAB_ENTRY( romfs_mte1,
+MTAB_ENTRY(romfs_mte1,
"/",
"romfs",
"",
- (CYG_ADDRWORD) &filedata[0] );
+ (CYG_ADDRWORD) &filedata[0]);
//==========================================================================
cyg_handle_t thread_a_hdl;
cyg_handle_t thread_b_hdl;
-#define SHOW_RESULT( _fn, _res ) \
+#define SHOW_RESULT(_fn, _res) \
diag_printf("<FAIL>: " #_fn "() returned %d %s\n", _res, _res<0?strerror(errno):"");
int weak_fn_called = 0;
-void weak_function( void )
+void weak_function(void)
{
- CYG_TEST_PASS( "Applications weak function called" );
+ CYG_TEST_PASS("Applications weak function called");
weak_fn_called++;
}
-void (*thread_a)( cyg_addrword_t );
-void (*thread_b)( cyg_addrword_t );
+void (*thread_a)(cyg_addrword_t);
+void (*thread_b)(cyg_addrword_t);
// This is the main starting point for our example application.
-void cyg_user_start( void )
+void cyg_user_start(void)
{
int err;
void* lib_handle;
- void (*fn)( void );
+ void (*fn)(void);
CYG_TEST_INIT();
- CYG_TEST_INFO( "Object loader module test started" );
+ CYG_TEST_INFO("Object loader module test started");
- err = chdir( "/" );
+ err = chdir("/");
- if( err < 0 )
- SHOW_RESULT( chdir, err );
+ 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" );
+ 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 = 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 = 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!" );
+ 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" );
+ 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,
+ 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 );
+ &thread_a_obj);
- cyg_thread_create( THREAD_PRIORITY + 1,
+ 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 );
+ &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_thread_resume(thread_a_hdl);
+ cyg_thread_resume(thread_b_hdl);
cyg_scheduler_start();
}
CYG_LDR_TABLE_INFRA_DIAG()
// Test case infrastructure function
-CYG_LDR_TABLE_ENTRY( cyg_test_output_entry, "cyg_test_output", cyg_test_output );
-CYG_LDR_TABLE_ENTRY( cyg_test_exit_entry, "cyg_test_exit", cyg_test_exit );
+CYG_LDR_TABLE_ENTRY(cyg_test_output_entry, "cyg_test_output", cyg_test_output);
+CYG_LDR_TABLE_ENTRY(cyg_test_exit_entry, "cyg_test_exit", cyg_test_exit);
// Test function
-CYG_LDR_TABLE_ENTRY( weak_function_entry, "weak_function", weak_function );
+CYG_LDR_TABLE_ENTRY(weak_function_entry, "weak_function", weak_function);
// Test Variable
-CYG_LDR_TABLE_ENTRY( weak_fn_called_entry, "weak_fn_called", &weak_fn_called );
+CYG_LDR_TABLE_ENTRY(weak_fn_called_entry, "weak_fn_called", &weak_fn_called);