/* * Probe for CBM 153x tape device first. If found enter tape mode and * return. If not found or unsupported, continue device detection. * Try to find an IEEE device next. If not found or unsupported, fall * back to IEC. */ struct ProtocolFunctions * cbm_init(void) { struct ProtocolFunctions *protoFn = NULL; // Nothing going on with the device yet. currState = 0; #ifdef TAPE_SUPPORT if (Probe4TapeDevice() == Tape_Status_OK_Tape_Device_Present) { Enter_Tape_Mode(&protoFn); currState |= XUM1541_TAPE_PRESENT; return protoFn; } #endif #ifdef IEEE_SUPPORT protoFn = ieee_init(); if (protoFn != NULL) { currState |= XUM1541_IEEE488_PRESENT; return protoFn; } #endif // Always use IEC as last resort. board_init_iec(); protoFn = iec_init(); return protoFn; }
void device_init(void) { i2c_init(); // I2C bus rtc_init(); // real time clock sdcard_init(); // SD card ieeehw_init(); // IEEE-488 hardware ieee_init(8); // hardware-independent part; registers as bus }
PROCESS_THREAD(ieee_process, ev, data) { static void (*ieee_mlmehandler)(MAC_MlmeDcfmInd_s*); static void (*ieee_mcpshandler)(MAC_McpsDcfmInd_s*); PROCESS_BEGIN(); PUTS("ieee_process: starting\n"); ieee_init(); ieee_serial_init(); PT_INIT(&ieee_mlme); ieee_mlmehandler = ieee_mlmept; PT_INIT(&ieee_mcps); ieee_mcpshandler = ieee_mcpspt; /* start the mlme thread by requesting a scan. */ req_scan(MAC_MLME_SCAN_TYPE_ACTIVE,0); PUTS("ieee_process: started\n"); /* run until this process is exiting */ while(true) { size_t i; MAC_DcfmIndHdr_s *macev; for(i=0; i<RX_QUEUE_SIZE && (macev=rxq_peek())!=NULL; i++) { if(rxq_peektype()==MLME) { //ieee_serial_mlme((MAC_MlmeDcfmInd_s*) macev); ieee_mlmehandler((MAC_MlmeDcfmInd_s*) macev); } else if(rxq_peektype()==MCPS) { //ieee_serial_mcps((MAC_McpsDcfmInd_s*) macev); ieee_mcpshandler((MAC_McpsDcfmInd_s*) macev); } rxq_dequeue(); } if (ev==ieee_event && data == IEEE_STARTED) ieee_started = true; PROCESS_YIELD(); } PUTS("ieee_process: exiting\n"); PROCESS_END(); }
int zd_mac_init(struct zd_mac *mac, struct net_device *netdev, struct usb_interface *intf) { struct ieee80211_device *ieee = zd_netdev_ieee80211(netdev); memset(mac, 0, sizeof(*mac)); spin_lock_init(&mac->lock); mac->netdev = netdev; INIT_DELAYED_WORK(&mac->set_rts_cts_work, set_rts_cts_work); INIT_DELAYED_WORK(&mac->set_basic_rates_work, set_basic_rates_work); skb_queue_head_init(&mac->rx_queue); tasklet_init(&mac->rx_tasklet, do_rx, (unsigned long)mac); tasklet_disable(&mac->rx_tasklet); ieee_init(ieee); softmac_init(ieee80211_priv(netdev)); zd_chip_init(&mac->chip, netdev, intf); housekeeping_init(mac); INIT_WORK(&mac->set_multicast_hash_work, set_multicast_hash_handler); return 0; }
rt_public void eif_rtinit(int argc, EIF_NATIVE_CHAR **argv, EIF_NATIVE_CHAR **envp) { char *eif_timeout; /* Retrieve root argument if any and update `argc' accordingly. */ eif_retrieve_root(&argc, argv); #ifdef EIF_WINDOWS set_windows_exception_filter(); #if defined(_MSC_VER) && _MSC_VER >= 1400 /* version 14.0+ (MSVC 8.0+) */ /* Ensures consistent behavior across all our platforms where we * get 2-digit exponent up to 99 and then 3-digit exponent for 100 and * above. */ (void) _set_output_format(_TWO_DIGIT_EXPONENT); #endif #endif #ifdef BOEHM_GC GC_register_displacement (OVERHEAD); #endif ieee_init(); starting_working_directory = (char *) eif_malloc (PATH_MAX + 1); /* Initialize directory to an empty string by default. */ starting_working_directory [0] = '\0'; ufill(); /* Get urgent memory chunks */ #if defined(DEBUG) && (EIF_OS != EIF_OS_VXWORKS) && !defined(EIF_WINDOWS) /* The following install signal handlers for signals USR1 and USR2. Both * raise an immediate scanning of memory and dumping of the free list usage * and other statistics. The difference is that USR1 also performrs a full * GC cycle before runnning the diagnosis. If memck() is programmed to * panic when inconsistencies are detected, this may raise a system failure * due to race condition. There is nothing the user can do about it, except * pray--RAM. */ esignal(SIGUSR1, mem_diagnose); esignal(SIGUSR2, mem_diagnose); #endif /* Check if the user wants to override the default timeout value * for interprocess communications (IPC). This new value is specified in * the ISE_TIMEOUT environment variable */ eif_timeout = getenv("ISE_TIMEOUT"); if ((eif_timeout != NULL) && (strlen(eif_timeout) > 0)) { /* Environment variable set */ TIMEOUT = (unsigned) atoi(eif_timeout); } else { TIMEOUT = 30; } eoption = egc_foption; #ifdef WORKBENCH xinitint(); /* Interpreter initialization */ esystem = egc_fsystem; eif_par_table = egc_partab; eif_par_table_size = egc_partab_size; eorg_table = egc_forg_table; pattern = egc_fpattern; debug_initialize(); /* Initialize debug information (breakpoints ...) */ /* In workbench mode, we have a slight problem: when we link ewb in * workbench mode, since ewb is a child from ised, the run-time will * assume, wrongly, that the executable is started in debug mode. Therefore, * we need a special run-time, with no debugging hooks involved. */ #ifndef NOHOOK winit(); /* Did we start under ewb control? */ #endif /* Initialize dynamically computed variables (i.e. system dependent) * Then we may call update. Eventually, when debugging the * application, the values loaded from the update file will be overridden * by the workbench (via winit). */ egc_einit(); /* Various static initializations */ fcount = scount; { char temp = 0; int i; for (i=1;i<argc;i++) { if (0 == rt_nstrcmp (argv[i], rt_nmakestr("-ignore_updt"))) { temp = (char) 1; break; } } update(temp, argv[0]); } /* Read melted information * Note: the `update' function takes * care of the initialization of the * temporary descriptor structures */ create_desc(); /* Create descriptor (call) tables */ #else /* * Initialize the finalized system with the static data structures. */ esystem = egc_fsystem; eif_par_table = egc_partab; eif_par_table_size = egc_partab_size; eif_gen_conf_init (eif_par_table_size); nbref = egc_fnbref; esize = egc_fsize; #endif #if !defined CUSTOM || defined NEED_UMAIN_H umain(argc, argv, envp); /* User's initializations */ #endif #if !defined CUSTOM || defined NEED_ARGV_H rt_arg_init(argc, argv); /* Save copy for class ARGUMENTS */ #endif eif_environ = envp; /* Save pointer to environment variable storage */ once_init(); #if defined(EIF_THREADS) && defined(WORKBENCH) notify_root_thread(); #endif initprf(); /* Initialize profiler. */ init_emnger(); /* Initialize ISE_EXCEPTION_MANAGER */ init_scp_manager(); /* Initialize ISE_SCOOP_MANAGER */ /* Initialize our root class. */ eif_init_root(); }