@@ -114,6 +114,7 @@ static void hm2_read(void *void_hm2, long period) {
114114 hm2_sserial_process_tram_read (hm2 , period );
115115 hm2_bspi_process_tram_read (hm2 , period );
116116 hm2_absenc_process_tram_read (hm2 , period );
117+ hm2_oneshot_process_tram_read (hm2 );
117118 //UARTS PktUARTS need to be explicitly handled by an external component
118119
119120 hm2_tp_pwmgen_process_read (hm2 ); // check the status of the fault bit
@@ -135,6 +136,7 @@ static void hm2_write(void *void_hm2, long period) {
135136 hm2_watchdog_prepare_tram_write (hm2 );
136137 hm2_ioport_gpio_prepare_tram_write (hm2 );
137138 hm2_pwmgen_prepare_tram_write (hm2 );
139+ hm2_oneshot_prepare_tram_write (hm2 );
138140 hm2_rcpwmgen_prepare_tram_write (hm2 );
139141 hm2_inmux_prepare_tram_write (hm2 );
140142 hm2_inm_prepare_tram_write (hm2 );
@@ -152,6 +154,7 @@ static void hm2_write(void *void_hm2, long period) {
152154 hm2_ioport_write (hm2 ); // handles gpio.is_output but not gpio.out (that's done in tram_write() above)
153155 hm2_watchdog_write (hm2 , period ); // in case the user has written to the watchdog.timeout_ns param
154156 hm2_pwmgen_write (hm2 ); // update pwmgen registers if needed
157+ hm2_oneshot_write (hm2 ); // update oneshot registers if needed
155158 hm2_rcpwmgen_write (hm2 ); // update rcpwmgen registers if needed
156159 hm2_inmux_write (hm2 ); // update inmux control register if needed
157160 hm2_inm_write (hm2 ); // update inm control register if needed
@@ -317,6 +320,8 @@ const char *hm2_get_general_function_name(int gtag) {
317320 case HM2_GTAG_XY2MOD : return "xy2mod Galvo interface" ;
318321 case HM2_GTAG_DPAINTER : return "Data Painter" ;
319322 case HM2_GTAG_SSR : return "SSR" ;
323+ case HM2_GTAG_ONESHOT : return "OneShot" ;
324+
320325 default : {
321326 static char unknown [100 ];
322327 rtapi_snprintf (unknown , 100 , "(unknown-gtag-%d)" , gtag );
@@ -394,6 +399,7 @@ static int hm2_parse_config_string(hostmot2_t *hm2, char *config_string) {
394399 hm2 -> config .num_leds = -1 ;
395400 hm2 -> config .num_ssrs = -1 ;
396401 hm2 -> config .num_outms = -1 ;
402+ hm2 -> config .num_oneshots = -1 ;
397403 hm2 -> config .enable_raw = 0 ;
398404 hm2 -> config .firmware = NULL ;
399405
@@ -452,6 +458,10 @@ static int hm2_parse_config_string(hostmot2_t *hm2, char *config_string) {
452458 token += 10 ;
453459 hm2 -> config .num_outms = simple_strtol (token , NULL , 0 );
454460
461+ } else if (strncmp (token , "num_oneshots=" , 13 ) == 0 ) {
462+ token += 10 ;
463+ hm2 -> config .num_oneshots = simple_strtol (token , NULL , 0 );
464+
455465 } else if (strncmp (token , "num_ssrs=" , 9 ) == 0 ) {
456466 token += 9 ;
457467 hm2 -> config .num_ssrs = simple_strtol (token , NULL , 0 );
@@ -547,6 +557,7 @@ static int hm2_parse_config_string(hostmot2_t *hm2, char *config_string) {
547557 HM2_DBG (" num_inmuxs=%d\n" , hm2 -> config .num_inmuxs );
548558 HM2_DBG (" num_inms=%d\n" , hm2 -> config .num_inms );
549559 HM2_DBG (" num_outms=%d\n" , hm2 -> config .num_outms );
560+ HM2_DBG (" num_oneshots=%d\n" , hm2 -> config .num_oneshots );
550561 HM2_DBG (" num_ssrs=%d\n" , hm2 -> config .num_ssrs );
551562 HM2_DBG (" num_xy2mods=%d\n" , hm2 -> config .num_xy2mods );
552563 HM2_DBG (" num_3pwmgens=%d\n" , hm2 -> config .num_tp_pwmgens );
@@ -1046,6 +1057,10 @@ static int hm2_parse_module_descriptors(hostmot2_t *hm2) {
10461057 case HM2_GTAG_OUTM :
10471058 md_accepted = hm2_outm_parse_md (hm2 , md_index );
10481059 break ;
1060+
1061+ case HM2_GTAG_ONESHOT :
1062+ md_accepted = hm2_oneshot_parse_md (hm2 , md_index );
1063+ break ;
10491064
10501065 case HM2_GTAG_RCPWMGEN :
10511066 md_accepted = hm2_rcpwmgen_parse_md (hm2 , md_index );
@@ -1124,6 +1139,7 @@ static void hm2_cleanup(hostmot2_t *hm2) {
11241139 hm2_bspi_cleanup (hm2 );
11251140 hm2_ssr_cleanup (hm2 );
11261141 hm2_outm_cleanup (hm2 );
1142+ hm2_oneshot_cleanup (hm2 );
11271143 hm2_rcpwmgen_cleanup (hm2 );
11281144
11291145 // free all the tram entries
@@ -1145,6 +1161,7 @@ void hm2_print_modules(hostmot2_t *hm2) {
11451161 hm2_ioport_print_module (hm2 );
11461162 hm2_ssr_print_module (hm2 );
11471163 hm2_outm_print_module (hm2 );
1164+ hm2_oneshot_print_module (hm2 );
11481165 hm2_watchdog_print_module (hm2 );
11491166 hm2_inmux_print_module (hm2 );
11501167 hm2_inm_print_module (hm2 );
@@ -1806,6 +1823,7 @@ void hm2_force_write(hostmot2_t *hm2) {
18061823 hm2_inmux_force_write (hm2 );
18071824 hm2_inm_force_write (hm2 );
18081825 hm2_xy2mod_force_write (hm2 );
1826+ hm2_oneshot_force_write (hm2 );
18091827
18101828 // NOTE: It's important that the SSR is written *after* the
18111829 // ioport is written. Initialization of the SSR requires that
0 commit comments