コード例 #1
0
ファイル: sos_ping.c プロジェクト: nesl/sos-2x
void sos_start(void)
{
    int ch;
	ker_register_module(neighbor_get_header());
	ker_register_module(aodv_get_header());
	ker_register_module(ping_get_header());

	req.count = 0;
	req.addr  = BCAST_ADDRESS;

    optind = 0;
    while(1){
        int option_index = 0;
        ch = getopt_long_only(sos_argc, sos_argv, sos_emu_short_opts,
                              long_options, &option_index);
        if (ch == -1)
            break;
        switch(ch){
		case 1:
			req.addr = (uint16_t) atoi( optarg );
			break;
		case 2:
			req.count = (uint16_t) atoi( optarg );
			break;
        }
    }
	if( req.addr == BCAST_ADDRESS ) {
		printf("No address is defined\n");
		tool_help();
		exit(1);
	}
	
	post_long(PING_PID, PING_PID, MSG_SEND_PING, sizeof(ping_req_t), &req, 0);
}
コード例 #2
0
ファイル: main_app.c プロジェクト: nesl/saf-netcar
void sos_start(void) {
    ker_register_module(loader_get_header());
    ker_register_module(rats_get_header());
    ker_register_module(accel_sensor_get_header());
    ker_register_module(accel_test_app_get_header());
    ker_register_module(saf_get_header());
}
コード例 #3
0
ファイル: lightshow_test_app.c プロジェクト: nesl/ragobots
void sos_start(void)
{
  ker_register_module(cb2bus_hardware_get_header());
  ker_register_module(cb2bus_get_header());
  ker_register_module(pushbutton_get_header());
  ker_register_module(lightshow_get_header());
  ker_register_module(lightshow_test_get_header());
}
コード例 #4
0
ファイル: main_app.c プロジェクト: nesl/netcar
void sos_start(void) {
  ker_register_module(loader_get_header());
  ker_register_module(nic_get_header());
  ker_register_module(rats_get_header());
#ifndef SOS_SIM
  ker_register_module(accel_sensor_get_header());
#endif
  ker_register_module(accel_sampler_get_header());
}
コード例 #5
0
ファイル: adcm1700ctrlPatch.c プロジェクト: nesl/sos-2x
int8_t
adcm1700CtrlPatchInit ()
{
  controlState = CONTROL_STATE_PENDING_CONFIGURATION;
  ker_register_module (sos_get_header_address (mod_header));
  return SOS_OK;
}
コード例 #6
0
ファイル: vmac.c プロジェクト: nesl/sos-2x
/*************************************************************************
 * Initiate the radio and mac                                            *
 *************************************************************************/
void mac_init()
{
	Radio_Init();
#ifdef RADIO_CHANNEL
	Radio_Set_Channel(RADIO_CHANNEL);
#else
	Radio_Set_Channel(13);
#endif

#ifdef SOS_USE_PREEMPTION
	ker_register_module(sos_get_header_address(mod_header));
#else
	sched_register_kernel_module(&vmac_module, sos_get_header_address(mod_header), NULL);
#endif

	// Timer needs to be done after reigsteration
	ker_permanent_timer_init(&wakeup_timer, RADIO_PID, WAKEUP_TIMER_TID, TIMER_ONE_SHOT);

	mq_init(&vmac_pq);	//! Initialize sending queue
	resetSeq();		//set seq_count 0
	resetRetries(); 	//set retries 0

	//enable interrupt for receiving data
	Radio_SetPackRecvedCallBack(_MacRecvCallBack);
	Radio_Enable_Interrupt();
}
コード例 #7
0
ファイル: sos_module_fetcher.c プロジェクト: nesl/sos-2x
int8_t fetcher_init()
{
#ifdef SOS_USE_PREEMPTION
	ker_register_module(sos_get_header_address(mod_header));
#else
	sched_register_kernel_module(&fetcher_module, sos_get_header_address(mod_header), NULL);
#endif
	return SOS_OK;
}
コード例 #8
0
ファイル: sos_tool.c プロジェクト: nesl/sos-2x
void sos_start(void)
{
    int ch;
    ker_register_module(loader_get_header());
    
    optind = 0;
    while(1){
        int option_index = 0;
        ch = getopt_long_only(sos_argc, sos_argv, sos_emu_short_opts,
                              long_options, &option_index);
        if (ch == -1)
            break;
        switch(ch){
        case INSMOD_OPT: 
            tool_insmod(optarg);
            return;
        case RMMOD_OPT:
            tool_rmmod(optarg);
            return;
        case LSMOD_OPT:
            tool_lsmod();
            return;
        case LDMOD_OPT:
            tool_ldmod(optarg);
            return;
        case SEND_MESSAGE_OPT:
            tool_send_message(optarg);
            sleep(1);
            exit(0);
        case HELP_OPT:
            tool_help();
            exit(0);
        case LDDATA_OPT:
            tool_lddata(optarg);
            return;
        case RMDATA_OPT:
            //printf("get rmdata, option_indx = %d\n", option_index);
			tool_rmdata(optarg);
            return;
        case LSDATA_OPT:
            //printf("get lsdata, option_indx = %d\n", option_index);
			tool_lsdata();
            return;
        }
    }
    tool_help();
    exit(1);
}
コード例 #9
0
ファイル: blank.c プロジェクト: nesl/sos-2x
void sos_start(void){
	ker_register_module(loader_get_header());

#if 0
	//#ifdef SOS_SIM
	module_headers[0] = blink_get_header();
	module_headers[1] = surge_get_header();
	module_headers[2] = tree_routing_get_header();
	module_headers[3] = test_param_get_header();
	

	/*
	 * Upto MAX_NETWORK_MODULES header can be defined.
	 * MAX_NETWORK_MODULES is defined in platform/sim/include/sim_interface.h 
	 */
	//module_headers[MAX_NETWORK_MODULES] = ...
#endif
}
コード例 #10
0
ファイル: uartTxTest_app.c プロジェクト: nesl/umpu
/**
 * application start
 * This function is called once at the end od SOS initialization
 */
void sos_start(void)
{
ker_register_module(uartTxTest_get_header());
}
コード例 #11
0
ファイル: cyclops_nic_app.c プロジェクト: nesl/sos-2x
/**
 * application start
 * This function is called once at the end od SOS initialization
 */
void sos_start(void)
{
    ker_register_module(cyclops_nic_get_header());
    ker_register_module(loader_get_header());
}
コード例 #12
0
static int8_t handle_fetcher_done( Message *msg ) 
{
	fetcher_state_t *f = (fetcher_state_t*) msg->data;
	if( is_fetcher_succeed( f ) == true ) {
		//mod_header_ptr p;
		loader_cam_t *cam;
		fetcher_commit(f, true);

		st.blocked = 0;
		restartInterval( 0 );

		cam = ker_cam_lookup( f->map.key );
		if( cam->fetcher.fetchtype == FETCHTYPE_DATA) {
			uint8_t buf[2];
			ker_codemem_read( cam->fetcher.cm, KER_DFT_LOADER_PID, buf, 2, 0);
			post_short(buf[0], KER_DFT_LOADER_PID, MSG_LOADER_DATA_AVAILABLE,
					buf[1], cam->fetcher.cm, 0);
			DEBUG_PID(KER_DFT_LOADER_PID, "Data Ready\n" );
#ifdef LOADER_NET_EXPERIMENT
			ker_led(LED_GREEN_TOGGLE);
#endif
		} else {
		  uint8_t mcu_type;
#ifndef SOS_SIM
		  uint8_t plat_type;
#endif
		  mod_header_ptr p;
#ifdef MINIELF_LOADER
		  // Link and load the module here
		  melf_load_module(cam->fetcher.cm);
#endif//MINIELF_LOADER		  
		  // Get the address of the module header
		  p = ker_codemem_get_header_address( cam->fetcher.cm ); 

		  // get processor type and platform type
		  mcu_type = sos_read_header_byte(p, 
										  offsetof( mod_header_t, processor_type )); 
#ifdef SOS_SIM
		  if( (mcu_type == MCU_TYPE) )
			// In simulation, we don't check for platform
#else
			plat_type = sos_read_header_byte(p, 
											 offsetof( mod_header_t, platform_type )); 
		  if( (mcu_type == MCU_TYPE) && 
			  ( plat_type == HW_TYPE || plat_type == PLATFORM_ANY) )
#endif
			{
			  
			  /*
			   * If MCU is matched, this means we are using the same 
			   * instruction set.
			   * And if this module is for this *specific* platform or 
			   * simply for all platform with the same MCU
			   */
			  // mark module executable
			  ker_codemem_mark_executable( cam->fetcher.cm );
			  if (cam->version & 0x80) {
#ifdef SOS_SFI
#ifdef MINIELF_LOADER
				sfi_modtable_register(cam->fetcher.cm);
				if (SOS_OK == ker_verify_module(cam->fetcher.cm)){
				  sfi_modtable_flash(p);
				  ker_register_module(p);
				}
				else
				  sfi_exception(KER_VERIFY_FAIL_EXCEPTION);
#else				
				uint16_t init_offset, code_size, handler_addr;
				uint32_t handler_byte_addr, module_start_byte_addr;
				uint16_t handler_sfi_addr;
				handler_sfi_addr = sos_read_header_ptr(p, offsetof(mod_header_t, module_handler));
				handler_addr = sfi_modtable_get_real_addr(handler_sfi_addr);				
				handler_byte_addr = (handler_addr * 2);
				module_start_byte_addr = (p * 2);
				init_offset = (uint16_t)(handler_byte_addr - module_start_byte_addr);
				code_size = cam->code_size * LOADER_SIZE_MULTIPLIER;
				if (SOS_OK == ker_verify_module(cam->fetcher.cm, init_offset, code_size)){
				  sfi_modtable_flash(p);				  
				  ker_register_module(p);
				}
				else
				  sfi_exception(KER_VERIFY_FAIL_EXCEPTION);
#endif //MINIELF_LOADER
#else
				ker_register_module(p);
#endif //SOS_SFI
			  }
			}

		}
		process_version_data( st.version_data, st.recent_neighbor);
	} else {
	  DEBUG_PID( KER_DFT_LOADER_PID, "Fetch failed!, request %d\n", st.recent_neighbor);
	  f = (fetcher_state_t*) ker_msg_take_data(KER_DFT_LOADER_PID, msg);
	  fetcher_restart( f, st.recent_neighbor );
	}
	return SOS_OK;
}
コード例 #13
0
ファイル: module_test_app.c プロジェクト: nesl/splt
/**
 * application start
 * This function is called once at the end od SOS initialization
 */
void sos_start(void)
{
ker_register_module(blink_get_header());
ker_register_module(uart_mod_get_header());
ker_register_module(rfid_get_header());
}
コード例 #14
0
ファイル: matrixArithmeticsModule.c プロジェクト: nesl/sos-2x
int8_t
matrixArithmetic_init ()
{
  ker_register_module (sos_get_header_address (mod_header));
  return SOS_OK;
}
コード例 #15
0
ファイル: vm_config.c プロジェクト: nesl/umpu
void sos_start(void)
{
  ker_register_module(dvm_get_header());
  ker_register_module(script_loader_get_header());
}
コード例 #16
0
ファイル: object_detection_app.c プロジェクト: nesl/sos-2x
/**
 * application start
 * This function is called once at the end od SOS initialization
 */
void
sos_start (void)
{
  ker_register_module (loader_get_header ());
  ker_register_module (object_detection_get_header ());
}
コード例 #17
0
ファイル: capture_test_app.c プロジェクト: nesl/sos-2x
/**
 * application start
 * This function is called once at the end od SOS initialization
 */
void
sos_start (void)
{
  ker_register_module (loader_get_header ());
  ker_register_module (capture_test_get_header ());
}