-void comediEnableMaster(comedi_t* dev){
- comedi_insn configCmd;
- lsampl_t configData[2];
- int ret;
- unsigned int d = 0;
- static const unsigned rtsi_subdev = 10;
- static const unsigned rtsi_clock_line = 7;
-
- /* Route RTSI clock to line 7 (not needed on pre-m-series boards since their
- clock is always on line 7). */
- memset(&configCmd, 0, sizeof(configCmd));
- memset(&configData, 0, sizeof(configData));
- configCmd.insn = INSN_CONFIG;
- configCmd.subdev = rtsi_subdev;
- configCmd.chanspec = rtsi_clock_line;
- configCmd.n = 2;
- configCmd.data = configData;
- configCmd.data[0] = INSN_CONFIG_SET_ROUTING;
- configCmd.data[1] = NI_RTSI_OUTPUT_RTSI_OSC;
- ret = comedi_do_insn(dev, &configCmd);
- if(ret < 0){
- comedi_perror("comedi_do_insn: INSN_CONFIG");
- exit(1);
- }
- // Set clock RTSI line as output
- ret = comedi_dio_config(dev, rtsi_subdev, rtsi_clock_line, INSN_CONFIG_DIO_OUTPUT);
- if(ret < 0){
- comedi_perror("comedi_dio_config");
- exit(1);
- }
-
- /* Set routing of the 3 main AI RTSI signals and their direction to output.
- We're reusing the already initialized configCmd instruction here since
- it's mostly the same. */
- configCmd.chanspec = 0;
- configCmd.data[1] = NI_RTSI_OUTPUT_ADR_START1;
- ret = comedi_do_insn(dev, &configCmd);
- if(ret < 0){
- comedi_perror("comedi_do_insn: INSN_CONFIG");
- exit(1);
- }
- ret = comedi_dio_config(dev, rtsi_subdev, 0, INSN_CONFIG_DIO_OUTPUT);
- if(ret < 0){
- comedi_perror("comedi_dio_config");
- exit(1);
- }
-
- configCmd.chanspec = 1;
- configCmd.data[1] = NI_RTSI_OUTPUT_ADR_START2;
- ret = comedi_do_insn(dev, &configCmd);
- if(ret < 0){
- comedi_perror("comedi_do_insn: INSN_CONFIG");
- exit(1);
- }
- ret = comedi_dio_config(dev, rtsi_subdev, 1, INSN_CONFIG_DIO_OUTPUT);
- if(ret < 0){
- comedi_perror("comedi_dio_config");
- exit(1);
- }
-
- configCmd.chanspec = 2;
- configCmd.data[1] = NI_RTSI_OUTPUT_SCLKG;
- ret = comedi_do_insn(dev, &configCmd);
- if(ret < 0){
- comedi_perror("comedi_do_insn: INSN_CONFIG");
- exit(1);
- }
- ret = comedi_dio_config(dev, rtsi_subdev, 2, INSN_CONFIG_DIO_OUTPUT);
- if(ret < 0){
- comedi_perror("comedi_dio_config");
- exit(1);
- }
+void comediEnableMaster(comedi_t *dev){
+ comedi_insn configCmd;
+ lsampl_t configData[2];
+ int ret;
+ unsigned int d = 0;
+ static const unsigned rtsi_subdev = 10;
+ static const unsigned rtsi_clock_line = 7;
+
+ /* Route RTSI clock to line 7 (not needed on pre-m-series boards since their
+ clock is always on line 7). */
+ memset(&configCmd, 0, sizeof(configCmd));
+ memset(&configData, 0, sizeof(configData));
+ configCmd.insn = INSN_CONFIG;
+ configCmd.subdev = rtsi_subdev;
+ configCmd.chanspec = rtsi_clock_line;
+ configCmd.n = 2;
+ configCmd.data = configData;
+ configCmd.data[0] = INSN_CONFIG_SET_ROUTING;
+ configCmd.data[1] = NI_RTSI_OUTPUT_RTSI_OSC;
+ ret = comedi_do_insn(dev, &configCmd);
+ if(ret < 0){
+ comedi_perror("comedi_do_insn: INSN_CONFIG");
+ exit(1);
+ }
+ // Set clock RTSI line as output
+ ret = comedi_dio_config(dev, rtsi_subdev, rtsi_clock_line, INSN_CONFIG_DIO_OUTPUT);
+ if(ret < 0){
+ comedi_perror("comedi_dio_config");
+ exit(1);
+ }
+
+ /* Set routing of the 3 main AI RTSI signals and their direction to output.
+ We're reusing the already initialized configCmd instruction here since
+ it's mostly the same. */
+ configCmd.chanspec = 0;
+ configCmd.data[1] = NI_RTSI_OUTPUT_ADR_START1;
+ ret = comedi_do_insn(dev, &configCmd);
+ if(ret < 0){
+ comedi_perror("comedi_do_insn: INSN_CONFIG");
+ exit(1);
+ }
+ ret = comedi_dio_config(dev, rtsi_subdev, 0, INSN_CONFIG_DIO_OUTPUT);
+ if(ret < 0){
+ comedi_perror("comedi_dio_config");
+ exit(1);
+ }
+
+ configCmd.chanspec = 1;
+ configCmd.data[1] = NI_RTSI_OUTPUT_ADR_START2;
+ ret = comedi_do_insn(dev, &configCmd);
+ if(ret < 0){
+ comedi_perror("comedi_do_insn: INSN_CONFIG");
+ exit(1);
+ }
+ ret = comedi_dio_config(dev, rtsi_subdev, 1, INSN_CONFIG_DIO_OUTPUT);
+ if(ret < 0){
+ comedi_perror("comedi_dio_config");
+ exit(1);
+ }
+
+ configCmd.chanspec = 2;
+ configCmd.data[1] = NI_RTSI_OUTPUT_SCLKG;
+ ret = comedi_do_insn(dev, &configCmd);
+ if(ret < 0){
+ comedi_perror("comedi_do_insn: INSN_CONFIG");
+ exit(1);
+ }
+ ret = comedi_dio_config(dev, rtsi_subdev, 2, INSN_CONFIG_DIO_OUTPUT);
+ if(ret < 0){
+ comedi_perror("comedi_dio_config");
+ exit(1);
+ }