/* Model initialize function */ void beagleboard_communication_initialize(void) { /* Registration code */ /* initialize real-time model */ (void) memset((void *)beagleboard_communication_M, 0, sizeof(RT_MODEL_beagleboard_communicat)); /* block I/O */ (void) memset(((void *) &beagleboard_communication_B), 0, sizeof(BlockIO_beagleboard_communicati)); /* states (dwork) */ (void) memset((void *)&beagleboard_communication_DWork, 0, sizeof(D_Work_beagleboard_communicatio)); { char_T *sErr; /* Start for S-Function (sdspToNetwork): '<Root>/UDP Send' */ sErr = GetErrorBuffer(&beagleboard_communication_DWork.UDPSend_NetworkLib[0U]); CreateUDPInterface(&beagleboard_communication_DWork.UDPSend_NetworkLib[0U]); if (*sErr == 0) { LibCreate_Network(&beagleboard_communication_DWork.UDPSend_NetworkLib[0U], 1, "255.255.255.255", -1, "192.168.1.35", 25000, 8192, 8, 0); } if (*sErr == 0) { LibStart(&beagleboard_communication_DWork.UDPSend_NetworkLib[0U]); } if (*sErr != 0) { DestroyUDPInterface(&beagleboard_communication_DWork.UDPSend_NetworkLib[0U]); if (*sErr != 0) { rtmSetErrorStatus(beagleboard_communication_M, sErr); rtmSetStopRequested(beagleboard_communication_M, 1); } } /* End of Start for S-Function (sdspToNetwork): '<Root>/UDP Send' */ } }
/* ---------------------------------------------- */ int main(int argc, char *argv[]) { int c; struct Fuse_option fuse_options; /* Set up owlib */ LibSetup(program_type_filesystem); /* grab our executable name */ if (argc > 0) { Globals.progname = owstrdup(argv[0]); } //mtrace() ; /* process command line arguments */ while ((c = getopt_long(argc, argv, OWLIB_OPT, owopts_long, NULL)) != -1) { switch (c) { case 'V': fprintf(stderr, "%s version:\n\t" VERSION "\n", argv[0]); break; case e_fuse_opt: /* fuse_mnt_opt */ if (fuse_mnt_opt) { owfree(fuse_mnt_opt); } fuse_mnt_opt = Fuse_arg(optarg, "FUSE mount options"); if (fuse_mnt_opt == NULL) { ow_exit(0); } break; case e_fuse_open_opt: /* fuse_open_opt */ if (fuse_open_opt) { owfree(fuse_open_opt); } fuse_open_opt = Fuse_arg(optarg, "FUSE open options"); if (fuse_open_opt == NULL) { ow_exit(0); } break; } if ( BAD( owopt(c, optarg) ) ) { ow_exit(0); /* rest of message */ } } /* non-option arguments */ while (optind < argc - 1) { ARG_Generic(argv[optind]); ++optind; } while (optind < argc) { if (Outbound_Control.active) { ARG_Generic(argv[optind]); } else { ARG_Server(argv[optind]); } ++optind; } if (Outbound_Control.active == 0) { LEVEL_DEFAULT("No mount point specified.\nTry '%s -h' for help.", argv[0]); ow_exit(1); } // FUSE directory mounting LEVEL_CONNECT("fuse mount point: %s", Outbound_Control.head->name); // Signal handler is set in fuse library //set_signal_handlers(exit_handler); /* Set up adapters */ if ( BAD(LibStart()) ) { ow_exit(1); } #if FUSE_VERSION >= 14 /* Set up "command line" for main fuse routines */ Fuse_setup(&fuse_options); // command line setup Fuse_add(Outbound_Control.head->name, &fuse_options); // mount point #if FUSE_VERSION >= 22 Fuse_add("-o", &fuse_options); // add "-o direct_io" to prevent buffering Fuse_add("direct_io", &fuse_options); #endif /* FUSE_VERSION >= 22 */ if (!Globals.want_background) { Fuse_add("-f", &fuse_options); // foreground for fuse too if (Globals.error_level > 2) { Fuse_add("-d", &fuse_options); // debug for fuse too } } Fuse_parse(fuse_mnt_opt, &fuse_options); LEVEL_DEBUG("fuse_mnt_opt=[%s]", fuse_mnt_opt); Fuse_parse(fuse_open_opt, &fuse_options); LEVEL_DEBUG("fuse_open_opt=[%s]", fuse_open_opt); if (Globals.allow_other) { Fuse_add("-o", &fuse_options); // add "-o allow_other" to permit other users access Fuse_add("allow_other", &fuse_options); } #if OW_MT == 0 Fuse_add("-s", &fuse_options); // single threaded #endif /* OW_MT */ Globals.now_background = Globals.want_background; // tell "error" that we are background #if 0 { int i; for (i = 0; i < fuse_options.argc; i++) { LEVEL_DEBUG("fuse_options.argv[%d]=[%s]", i, fuse_options.argv[i]); } } #endif #if FUSE_VERSION > 25 fuse_main(fuse_options.argc, fuse_options.argv, &owfs_oper, NULL); #else /* FUSE_VERSION <= 25 */ fuse_main(fuse_options.argc, fuse_options.argv, &owfs_oper); #endif /* FUSE_VERSION <= 25 */ Fuse_cleanup(&fuse_options); #endif ow_exit(0); return 0; }
int main(int argc, char *argv[]) { int c; /* Set up owlib */ LibSetup(program_type_httpd); Setup_Systemd() ; // systemd? Setup_Launchd() ; // launchd? /* grab our executable name */ ArgCopy( argc, argv ) ; while ((c = getopt_long(argc, argv, OWLIB_OPT, owopts_long, NULL)) != -1) { switch (c) { case 'V': fprintf(stderr, "%s version:\n\t" VERSION "\n", argv[0]); break; default: break; } if ( BAD( owopt(c, optarg) ) ) { ow_exit(0); /* rest of message */ } } /* non-option arguments */ while (optind < argc) { ARG_Generic(argv[optind]); ++optind; } switch (Globals.daemon_status) { case e_daemon_sd: case e_daemon_sd_done: // systemd done later break ; default: if (Outbound_Control.active == 0) { if (Globals.zero == zero_none) { LEVEL_DEFAULT("%s would be \"locked in\" so will quit.\nBonjour and Avahi not available.", argv[0]); ow_exit(1); } else { LEVEL_CONNECT("%s will use an ephemeral port", argv[0]) ; } ARG_Server(NULL); // make an ephemeral assignment } break ; } /* become a daemon if not told otherwise */ if ( BAD(EnterBackground()) ) { ow_exit(1); } /* Set up adapters and systemd */ if ( BAD(LibStart(NULL)) ) { ow_exit(1); } set_exit_signal_handlers(exit_handler); set_signal_handlers(NULL); ServerProcess(Acceptor); LEVEL_DEBUG("ServerProcess done"); ow_exit(0); LEVEL_DEBUG("owhttpd done"); return 0; }
/* Model initialize function */ void udpRead_initialize(void) { /* Registration code */ /* initialize non-finites */ rt_InitInfAndNaN(sizeof(real_T)); /* initialize real-time model */ (void) memset((void *)udpRead_M, 0, sizeof(RT_MODEL_udpRead_T)); rtmSetTFinal(udpRead_M, -1); udpRead_M->Timing.stepSize0 = 0.001; /* External mode info */ udpRead_M->Sizes.checksums[0] = (597430241U); udpRead_M->Sizes.checksums[1] = (1019470990U); udpRead_M->Sizes.checksums[2] = (4143940322U); udpRead_M->Sizes.checksums[3] = (93090447U); { static const sysRanDType rtAlwaysEnabled = SUBSYS_RAN_BC_ENABLE; static RTWExtModeInfo rt_ExtModeInfo; static const sysRanDType *systemRan[5]; udpRead_M->extModeInfo = (&rt_ExtModeInfo); rteiSetSubSystemActiveVectorAddresses(&rt_ExtModeInfo, systemRan); systemRan[0] = &rtAlwaysEnabled; systemRan[1] = (sysRanDType *)&udpRead_DW.ForIteratorSubsystem_SubsysRanB; systemRan[2] = (sysRanDType *)&udpRead_DW.ForIteratorSubsystem1_SubsysRan; systemRan[3] = (sysRanDType *)&udpRead_DW.EnabledSubsystem_SubsysRanBC; systemRan[4] = &rtAlwaysEnabled; rteiSetModelMappingInfoPtr(udpRead_M->extModeInfo, &udpRead_M->SpecialInfo.mappingInfo); rteiSetChecksumsPtr(udpRead_M->extModeInfo, udpRead_M->Sizes.checksums); rteiSetTPtr(udpRead_M->extModeInfo, rtmGetTPtr(udpRead_M)); } /* block I/O */ (void) memset(((void *) &udpRead_B), 0, sizeof(B_udpRead_T)); /* states (dwork) */ (void) memset((void *)&udpRead_DW, 0, sizeof(DW_udpRead_T)); /* data type transition information */ { static DataTypeTransInfo dtInfo; (void) memset((char_T *) &dtInfo, 0, sizeof(dtInfo)); udpRead_M->SpecialInfo.mappingInfo = (&dtInfo); dtInfo.numDataTypes = 14; dtInfo.dataTypeSizes = &rtDataTypeSizes[0]; dtInfo.dataTypeNames = &rtDataTypeNames[0]; /* Block I/O transition table */ dtInfo.B = &rtBTransTable; /* Parameters transition table */ dtInfo.P = &rtPTransTable; } { char_T *sErr; /* Start for S-Function (sdspFromNetwork): '<Root>/UDP Receive' */ sErr = GetErrorBuffer(&udpRead_DW.UDPReceive_NetworkLib[0U]); CreateUDPInterface(&udpRead_DW.UDPReceive_NetworkLib[0U]); if (*sErr == 0) { LibCreate_Network(&udpRead_DW.UDPReceive_NetworkLib[0U], 0, "0.0.0.0", 25000, "0.0.0.0", -1, 8192, 4, 0); } if (*sErr == 0) { LibStart(&udpRead_DW.UDPReceive_NetworkLib[0U]); } if (*sErr != 0) { DestroyUDPInterface(&udpRead_DW.UDPReceive_NetworkLib[0U]); if (*sErr != 0) { rtmSetErrorStatus(udpRead_M, sErr); rtmSetStopRequested(udpRead_M, 1); } } /* End of Start for S-Function (sdspFromNetwork): '<Root>/UDP Receive' */ /* InitializeConditions for UnitDelay: '<S3>/FixPt Unit Delay2' */ udpRead_DW.FixPtUnitDelay2_DSTATE = udpRead_P.FixPtUnitDelay2_InitialConditio; /* InitializeConditions for UnitDelay: '<S3>/FixPt Unit Delay1' */ udpRead_DW.FixPtUnitDelay1_DSTATE = udpRead_P.UnitDelayResettable_vinit; } }