extern void switch_g_job_suspend_info_get(switch_jobinfo_t *jobinfo, void **suspend_info) { if ( switch_init() < 0 ) return; (*(ops.job_suspend_info_get)) (jobinfo, suspend_info); }
extern int switch_g_get_jobinfo(switch_jobinfo_t *jobinfo, int data_type, void *data) { if ( switch_init() < 0 ) return SLURM_ERROR; return (*(ops.get_jobinfo))( jobinfo, data_type, data); }
extern char *switch_g_sprint_jobinfo( switch_jobinfo_t *jobinfo, char *buf, size_t size) { if ( switch_init() < 0 ) return NULL; return (*(ops.string_jobinfo)) (jobinfo, buf, size); }
extern int switch_g_unpack_jobinfo(switch_jobinfo_t *jobinfo, Buf buffer, uint16_t protocol_version) { if ( switch_init() < 0 ) return SLURM_ERROR; return (*(ops.unpack_jobinfo))( jobinfo, buffer, protocol_version ); }
extern int switch_g_alloc_jobinfo(switch_jobinfo_t **jobinfo, uint32_t job_id, uint32_t step_id) { if ( switch_init() < 0 ) return SLURM_ERROR; return (*(ops.alloc_jobinfo))( jobinfo, job_id, step_id ); }
extern void switch_p_job_suspend_info_free(void *suspend_info) { if ( switch_init() < 0 ) return; nrt_suspend_job_info_free(suspend_info); return; }
extern int switch_g_unpack_node_info(switch_node_info_t **switch_node, Buf buffer, uint16_t protocol_version) { if ( switch_init(0) < 0 ) return SLURM_ERROR; return (*(ops[switch_context_default].unpack_nodeinfo)) (switch_node, buffer, protocol_version); }
extern void switch_p_job_suspend_info_pack(void *suspend_info, Buf buffer, uint16_t protocol_version) { if ( switch_init() < 0 ) return; nrt_suspend_job_info_pack(suspend_info, buffer, protocol_version); return; }
extern int switch_p_job_suspend_info_unpack(void **suspend_info, Buf buffer, uint16_t protocol_version) { if ( switch_init() < 0 ) return SLURM_ERROR; return nrt_suspend_job_info_unpack(suspend_info, buffer, protocol_version); }
extern int switch_g_job_suspend_info_unpack(void **suspend_info, Buf buffer, uint16_t protocol_version) { if ( switch_init(0) < 0 ) return SLURM_ERROR; return (*(ops[switch_context_default].job_suspend_info_unpack)) (suspend_info, buffer, protocol_version); }
extern char*switch_g_sprintf_node_info(switch_node_info_t *switch_node, char *buf, size_t size) { if ( switch_init(0) < 0 ) return NULL; return (*(ops[switch_context_default].sprintf_nodeinfo)) ( switch_node, buf, size ); }
extern void switch_g_job_suspend_info_pack(void *suspend_info, Buf buffer, uint16_t protocol_version) { if ( switch_init(0) < 0 ) return; (*(ops[switch_context_default].job_suspend_info_pack)) (suspend_info, buffer, protocol_version); }
extern int switch_g_build_jobinfo(switch_jobinfo_t *jobinfo, slurm_step_layout_t *step_layout, char *network) { if ( switch_init() < 0 ) return SLURM_ERROR; return (*(ops.build_jobinfo))( jobinfo, step_layout, network ); }
extern int switch_g_job_postfini(switch_jobinfo_t *jobinfo, uid_t pgid, uint32_t job_id, uint32_t step_id ) { if ( switch_init() < 0 ) return SLURM_ERROR; return (*(ops.job_postfini)) (jobinfo, pgid, job_id, step_id); }
extern int switch_g_job_attach(switch_jobinfo_t *jobinfo, char ***env, uint32_t nodeid, uint32_t procid, uint32_t nnodes, uint32_t nprocs, uint32_t gid) { if ( switch_init() < 0 ) return SLURM_ERROR; return (*(ops.job_attach)) (jobinfo, env, nodeid, procid, nnodes, nprocs, gid); }
int main(void) { switch_init(); switch_add_callback(SWITCH_ALL_EVENTS, print_hello); printf("Switch callback are now active for 15 seconds.\n"); printf("Press a switch to print \"hello\" on screen.\n"); sleep(15); switch_release(); return 0; }
extern void switch_g_free_jobinfo(dynamic_plugin_data_t *jobinfo) { if ( switch_init(0) < 0 ) return; if (jobinfo) { if (jobinfo->data) (*(ops[jobinfo->plugin_id].free_jobinfo)) (jobinfo->data); xfree(jobinfo); } }
void init_octopus(void) { sysclk_init(); ioport_init(); leds_init(); bluetooth_init(); //bluetooth_init_interrupt(); switch_init(); //usb_init(); }
void init(){ led_init(); motor_init(); switch_init(); ground_init(); dist_init(); servo_init(); if(DEBUG) usart_init(); motor1 = Motor(&OCR1A, &MOTOR1_DIR_PORT, MOTOR1_DIR_PIN, MAX_POWER); motor2 = Motor(&OCR1B, &MOTOR2_DIR_PORT, MOTOR2_DIR_PIN, MAX_POWER); }
void set_mt7620_esw_broadcast_rate(int bsr) { #if 0 if ((bsr < 0) || (bsr > 255)) return; if (switch_init() < 0) return; printf("set broadcast strom control rate as: %d\n", bsr); switch_fini(); #endif }
extern int switch_g_alloc_jobinfo(dynamic_plugin_data_t **jobinfo, uint32_t job_id, uint32_t step_id) { dynamic_plugin_data_t *jobinfo_ptr = NULL; if ( switch_init(0) < 0 ) return SLURM_ERROR; jobinfo_ptr = xmalloc(sizeof(dynamic_plugin_data_t)); jobinfo_ptr->plugin_id = switch_context_default; *jobinfo = jobinfo_ptr; return (*(ops[jobinfo_ptr->plugin_id].alloc_jobinfo)) ((switch_jobinfo_t **)&jobinfo_ptr->data, job_id, step_id); }
extern void switch_g_print_jobinfo(FILE *fp, dynamic_plugin_data_t *jobinfo) { void *data = NULL; uint32_t plugin_id; if ( switch_init(0) < 0 ) return; if (jobinfo) { data = jobinfo->data; plugin_id = jobinfo->plugin_id; } else plugin_id = switch_context_default; (*(ops[plugin_id].print_jobinfo))(fp, data); }
extern int switch_g_job_fini(dynamic_plugin_data_t *jobinfo) { void *data = NULL; uint32_t plugin_id; if ( switch_init(0) < 0 ) return SLURM_ERROR; if (jobinfo) { data = jobinfo->data; plugin_id = jobinfo->plugin_id; } else plugin_id = switch_context_default; return (*(ops[plugin_id].job_fini)) (data); }
/** @brief The main function */ int main(void) { uint32_t err_code; switch_init(); utils_setup(); softdevice_setup(); sf_init(); // Enter main loop for (;;) { err_code = sd_app_evt_wait(); APP_ERROR_CHECK(err_code); } }
extern int switch_g_get_jobinfo(dynamic_plugin_data_t *jobinfo, int data_type, void *data) { void *jobdata = NULL; uint32_t plugin_id; if ( switch_init(0) < 0 ) return SLURM_ERROR; if (jobinfo) { jobdata = jobinfo->data; plugin_id = jobinfo->plugin_id; } else plugin_id = switch_context_default; return (*(ops[plugin_id].get_jobinfo))(jobdata, data_type, data); }
extern char *switch_g_sprint_jobinfo(dynamic_plugin_data_t *jobinfo, char *buf, size_t size) { void *data = NULL; uint32_t plugin_id; if ( switch_init(0) < 0 ) return NULL; if (jobinfo) { data = jobinfo->data; plugin_id = jobinfo->plugin_id; } else plugin_id = switch_context_default; return (*(ops[plugin_id].string_jobinfo))(data, buf, size); }
extern int switch_g_job_step_allocated(dynamic_plugin_data_t *jobinfo, char *nodelist) { void *data = NULL; uint32_t plugin_id; if ( switch_init(0) < 0 ) return SLURM_ERROR; if (jobinfo) { data = jobinfo->data; plugin_id = jobinfo->plugin_id; } else plugin_id = switch_context_default; return (*(ops[plugin_id].step_allocated))(data, nodelist); }
extern void switch_g_job_suspend_info_get(dynamic_plugin_data_t *jobinfo, void **suspend_info) { void *data = NULL; uint32_t plugin_id; if ( switch_init(0) < 0 ) return; if (jobinfo) { data = jobinfo->data; plugin_id = jobinfo->plugin_id; } else plugin_id = switch_context_default; (*(ops[plugin_id].job_suspend_info_get)) (data, suspend_info); }
extern int switch_g_build_jobinfo(dynamic_plugin_data_t *jobinfo, slurm_step_layout_t *step_layout, char *network) { void *data = NULL; uint32_t plugin_id; if ( switch_init(0) < 0 ) return SLURM_ERROR; if (jobinfo) { data = jobinfo->data; plugin_id = jobinfo->plugin_id; } else plugin_id = switch_context_default; return (*(ops[plugin_id].build_jobinfo))(data, step_layout, network); }
int main(void){ /* Initialises the switches and LEDs using the LetMeCreate library */ switch_init(); led_init(); /* The first parameter is the event for which a callback function will be triggered. The second is a pointer to the function that will run when the event occurs */ switch_add_callback(SWITCH_1_PRESSED, led_toggle); switch_add_callback(SWITCH_2_PRESSED, end_program); /* running is true until switch 2 is pressed */ while(running) ; /* The LEDs are no longer accessible by the program */ led_release(); /* Removes all of the callback functions */ switch_release(); return 0; }