]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
bk: 41c3b82dZQiu0Is7Q1WfVgSy4EHMRA
authorTakao Abe <abe@ntp.org>
Sat, 18 Dec 2004 04:55:09 +0000 (04:55 +0000)
committerTakao Abe <abe@ntp.org>
Sat, 18 Dec 2004 04:55:09 +0000 (04:55 +0000)
html/drivers/driver40.html
ntpd/refclock_jjy.c

index 4b0edeaaa19931d8bd35abd7473c6f07218591c8..33885f2b1ee58f1c4713d12d89ac07ff167e0b6e 100644 (file)
@@ -1,6 +1,6 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
-<html>
+<html lang ="en">
 
     <head>
         <meta name="generator" content="HTML Tidy, see www.w3.org">
     <body>
         <h3>JJY Receivers</h3>
         <hr>
+
         <h4>Synopsis</h4>
         Address: 127.127.40.<i>u</i><br>
         Reference ID: <tt>JJY</tt><br>
         Driver ID: <tt>JJY</tt><br>
         Serial Port: <tt>/dev/jjy<i>u</i></tt>; 9600 baud, 8-bits, no parity, 1 stop bit
+
         <h4>Description</h4>
         <p>This driver supports the following JJY receivers sold in Japan.</p>
         <ul>
+
             <li>Tristate Ltd. JJY01 <a href="http://www.tristate.ne.jp/">http://www.tristate.ne.jp/</a> (Japanese only)<br>
             <dl>
                 <dt>Time code format
                 <br>
                 <dt>NTP configuration ( ntp.conf )
                 <dd>
-                <p>server 127.127.40.X mode 1</p>
+                <p>server &nbsp; 127.127.40.X &nbsp; mode 1</p>
                 <br>
             </dl>
+</li>
+
             <li>C-DEX Co.,Ltd. JST2000 <a href="http://www.c-dex.co.jp/">http://www.c-dex.co.jp/</a> (Japanese only)<br>
             <dl>
                 <dt>Time code format
                 <br>
                 <dt>NTP configuration ( ntp.conf )
                 <dd>
-                <p>server 127.127.40.X mode 2</p>
+                <p>server &nbsp; 127.127.40.X &nbsp; mode 2</p>
                 <br>
             </dl>
+</li>
+
+<li><p>Echo Keisokuki Co.,Ltd. LT-2000 <a href="http://www.clock.co.jp/">http://www.clock.co.jp/</a> (Japanese only)</p>
+<dl>
+<dt>Time code format</dt>
+<dd><br>
+<table summary="CommandAndReply">
+<tr>
+<td>Command</td><td>&nbsp;</td><td>Reply</td>
+</tr>
+<tr>
+<td><code>C</code></td>
+<td></td>
+<td>( Mode 2 : Continuous ) </td>
+</tr>
+<tr>
+<td></td>
+<td></td>
+<td><code>YYMMDDWHHMMSS&lt;ST1&gt;&lt;ST2&gt;&lt;ST3&gt;&lt;ST4&gt;&lt;CR&gt;</code></td>
+</tr>
+<tr>
+<td><code>#</code></td>
+<td></td>
+<td>( Mode 1 : Request&Send )</td>
+</tr>
+</table>
+<br>
+</dd>
+<dt>NTP configuration ( ntp.conf )</dt>
+<dd>
+<p>server &nbsp; 127.127.40.X &nbsp; mode 3</p>
+</dd>
+</dl>
+</li>
+
         </ul>
-        <p>JJY is the radio station which transmites the JST (Japan Standard Time) in long wave radio. The station JJY is operated by the National Institute of Information and Communications Technology. An operating announcement and some information are avaiable from <a href="http://www.crl.go.jp/">http://www.nict.go.jp/</a> (English and Japanese) and <a href="http://jjy.crl.go.jp/">http://jjy.nict.go.jp/</a> (English and Japanese)</p>
+        <p>JJY is the radio station which transmites the JST (Japan Standard Time) in long wave radio. The station JJY is operated by the National Institute of Information and Communications Technology. An operating announcement and some information are avaiable from <a href="http://www.nict.go.jp/">http://www.nict.go.jp/</a> (English and Japanese) and <a href="http://jjy.nict.go.jp/">http://jjy.nict.go.jp/</a> (English and Japanese)</p>
         <p>The user is expected to provide a symbolic link to an available serial port device. This is typically performed by a command such as:</p>
         <p><tt>ln -s /dev/ttyS0 /dev/jjy0</tt></p>
         <p>Windows NT does not support symbolic links to device files. COM<i>X</i>: is the unit used by the driver, based on the refclock unit number, where unit 1 corresponds to COM1: and unit 3 corresponds to COM3:</p>
+
         <h4>Monitor Data</h4>
         <p>The driver writes each timecode as received to the <tt>clockstats</tt> file.</p>
+
         <h4>Fudge Factors</h4>
         <dl>
             <dt><tt>time1 <i>time</i></tt>
index 09befd6c4f8cbd46f62cde94952d1c0667e8f927..40907be13fe1b4575876b1b126207b3d701646bf 100644 (file)
@@ -4,7 +4,7 @@
 
 /**********************************************************************/
 /*                                                                    */
-/*  Copyright (C) 2001, Takao Abe.  All rights reserved.              */
+/*  Copyright (C) 2001-2004, Takao Abe.  All rights reserved.         */
 /*                                                                    */
 /*  Permission to use, copy, modify, and distribute this software     */
 /*  and its documentation for any purpose is hereby granted           */
@@ -67,6 +67,9 @@
 /*             JJY-01 ( Firmware version 2.01 )                       */
 /*             Thanks to Andy Taki for testing under FreeBSD          */
 /*                                                                    */
+/*  2004/11/28                                                        */
+/*    [Add]    Support the Echo Keisokuki LT-2000 receiver            */
+/*                                                                    */
 /**********************************************************************/
 
 #ifdef HAVE_CONFIG_H
 /*  <ENQ>1J<ETX>   <STX>JYYMMDD HHMMSSS<ETX>                          */
 /*                                                                    */
 /**********************************************************************/
+/*                                                                    */
+/*  The Echo Keisokuki Co. Ltd. JJY receiver LT2000                   */
+/*                                                                    */
+/*  Command        Response                 Remarks                   */
+/*  ------------   ----------------------   ---------------------     */
+/*  #                                       Mode 1 (Request&Send)     */
+/*  T              YYMMDDWHHMMSS<BCC1><BCC2><CR>                      */
+/*  C                                       Mode 2 (Continuous)       */
+/*                 YYMMDDWHHMMSS<ST1><ST2><ST3><ST4><CR>              */
+/*                 <SUB>                    Second signal             */
+/*                                                                    */
+/**********************************************************************/
 
 /*
  * Interface definitions
  * JJY unit control structure
  */
 struct jjyunit {
-       char    unittype ;      /* UNITTYPE_XXXXXXXXXX */
+       char    unittype ;          /* UNITTYPE_XXXXXXXXXX */
+    short   operationmode ;     /* Echo Keisokuki LT-2000 : 1 or 2 */
        short   version ;
        short   linediscipline ;        /* LDISC_CLK or LDISC_RAW */
        int     linecount ;
@@ -143,6 +159,7 @@ struct jjyunit {
 
 #define        UNITTYPE_TRISTATE_JJY01 1
 #define        UNITTYPE_CDEX_JST2000   2
+#define        UNITTYPE_ECHOKEISOKUKI_LT2000   3
 
 /*
  * Function prototypes
@@ -152,9 +169,11 @@ static     void    jjy_shutdown                P((int, struct peer *));
 static void    jjy_poll                    P((int, struct peer *));
 static void    jjy_poll_tristate_jjy01     P((int, struct peer *));
 static void    jjy_poll_cdex_jst2000       P((int, struct peer *));
+static void    jjy_poll_echokeisokuki_lt2000    P((int, struct peer *));
 static void    jjy_receive                 P((struct recvbuf *));
 static int     jjy_receive_tristate_jjy01  P((struct recvbuf *));
 static int     jjy_receive_cdex_jst2000    P((struct recvbuf *));
+static int     jjy_receive_echokeisokuki_lt2000 P((struct recvbuf *));
 
 /*
  * Transfer vector
@@ -217,6 +236,7 @@ jjy_start ( int unit, struct peer *peer )
        case 0 :
        case 1 : iDiscipline = LDISC_CLK ; break ;
        case 2 : iDiscipline = LDISC_RAW ; break ;
+       case 3 : iDiscipline = LDISC_CLK ; break ;
        default :
                msyslog ( LOG_ERR, "JJY receiver [ %s mode %d ] : Unsupported mode",
                          ntoa(&peer->srcadr), peer->ttl ) ;
@@ -261,6 +281,18 @@ jjy_start ( int unit, struct peer *peer )
                up->unittype = UNITTYPE_CDEX_JST2000 ;
                up->lineexpect = 1 ;
                up->charexpect[0] = 15 ; /* <STX>JYYMMDD HHMMSSS<ETX> */
+       case 3 :
+               up->unittype = UNITTYPE_ECHOKEISOKUKI_LT2000 ;
+               up->operationmode = 2 ;  /* Mode 2 : Continuous mode */
+               up->lineexpect = 1 ;
+        switch ( up->operationmode ) {
+        case 1 :
+                       up->charexpect[0] = 15 ; /* YYMMDDWHHMMSS<BCC1><BCC2><CR> */
+                       break ;
+               case 2 :
+                       up->charexpect[0] = 17 ; /* YYMMDDWHHMMSS<ST1><ST2><ST3><ST4><CR> */
+                       break ;
+               }
                break ;
        default :
                msyslog ( LOG_ERR, "JJY receiver [ %s mode %d ] : Unsupported mode",
@@ -393,6 +425,10 @@ jjy_receive ( struct recvbuf *rbufp )
                rc = jjy_receive_cdex_jst2000 ( rbufp ) ;
                break ;
 
+       case UNITTYPE_ECHOKEISOKUKI_LT2000 :
+               rc = jjy_receive_echokeisokuki_lt2000 ( rbufp ) ;
+               break ;
+
        default :
                rc = 0 ;
                break ;
@@ -447,10 +483,10 @@ jjy_receive ( struct recvbuf *rbufp )
        }
 #ifdef DEBUG
        if ( debug ) {
-               printf ( "jjy_receive (refclock_jjy.c) : %04d/%02d/%02d %02d:%02d:%02d JST   ", 
-                         up->year, up->month, up->day, up->hour, up->minute, up->second ) ;
-               printf ( "( %04d/%03d %02d:%02d:%02d UTC )\n",
-                         pp->year, pp->day, pp->hour, pp->minute, pp->second ) ;
+               printf ( "jjy_receive (refclock_jjy.c) : %04d/%02d/%02d %02d:%02d:%02d.%1d JST   ", 
+                         up->year, up->month, up->day, up->hour, up->minute, up->second, up->msecond/100 ) ;
+               printf ( "( %04d/%03d %02d:%02d:%02d.%1d UTC )\n",
+                         pp->year, pp->day, pp->hour, pp->minute, pp->second, (int)(pp->nsec/100000000) ) ;
        }
 #endif
 
@@ -458,19 +494,19 @@ jjy_receive ( struct recvbuf *rbufp )
         * Process the new sample in the median filter and determine the
         * timecode timestamp.
         */
+
+       sprintf ( sLogText, "%04d/%02d/%02d %02d:%02d:%02d.%1d JST",
+                 up->year, up->month, up->day, up->hour, up->minute, up->second, up->msecond/100 ) ;
+       record_clock_stats ( &peer->srcadr, sLogText ) ;
+
        if ( ! refclock_process ( pp ) ) {
                refclock_report(peer, CEVNT_BADTIME);
-               sprintf ( sLogText, "BAD TIME %04d/%02d/%02d %02d:%02d:%02d JST",
-                         up->year, up->month, up->day, up->hour, up->minute, up->second ) ;
-               record_clock_stats ( &peer->srcadr, sLogText ) ;
                return ;
        }
 
-       sprintf ( sLogText, "%04d/%02d/%02d %02d:%02d:%02d JST",
-                 up->year, up->month, up->day, up->hour, up->minute, up->second ) ;
        pp->lastref = pp->lastrec;
        refclock_receive(peer);
-       record_clock_stats ( &peer->srcadr, sLogText ) ;
+
 }
 
 /**************************************************************************************************/
@@ -479,6 +515,8 @@ static int
 jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
 {
 
+       static  char    *sFunctionName = "jjy_receive_tristate_jjy01" ;
+
        struct jjyunit      *up ;
        struct refclockproc *pp ;
        struct peer         *peer;
@@ -504,14 +542,24 @@ jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
 
        switch ( up->linecount ) {
 
-       case 1 : /* YYYY/MM/DD */
+       case 1 : /* YYYY/MM/DD WWW */
 
-               if ( iLen < 10 ) {
+               if ( iLen != 14 ) {
+#ifdef DEBUG
+               if ( debug >= 2 ) {
+                       printf ( "%s (refclock_jjy.c) : Reply length error ( up->linecount=%d  iLen=%d )\n", sFunctionName, up->linecount, iLen ) ;
+               }
+#endif
                        up->lineerror = 1 ;
                        break ;
                }
                rc = sscanf ( pBuf, "%4d/%2d/%2d", &up->year, &up->month, &up->day ) ;
                if ( rc != 3 || up->year < 2000 || up->month < 1 || up->month > 12 || up->day < 1 || up->day > 31 ) {
+#ifdef DEBUG
+               if ( debug >= 2 ) {
+                       printf ( "%s (refclock_jjy.c) : Date error ( up->linecount=%d )\n", sFunctionName, up->linecount ) ;
+               }
+#endif
                        up->lineerror = 1 ;
                        break ;
                }
@@ -521,7 +569,7 @@ jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
                 * Following codes are moved from the function jjy_poll_tristate_jjy01 in this source.
                 * The Tristate JJY-01 ( Firmware version 1.01 ) accepts "time" and "stim" commands without any delay.
                 * But the JJY-01 ( Firmware version 2.01 ) does not accept these commands continuously,
-                * so this driver issues the second command "stim" after the reply of the first command "time".
+                * so this driver issues the second command "stim" after the reply of the first command "date".
                 */
 
                /*
@@ -532,7 +580,7 @@ jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
                if ( up->version >= 100 ) {
 #ifdef DEBUG
                        if ( debug ) {
-                               printf ( "jjy_receive_tristate_jjy01 (refclock_jjy.c) : send 'stim<CR><LF>'\n" ) ;
+                               printf ( "%s (refclock_jjy.c) : send 'stim<CR><LF>'\n", sFunctionName ) ;
                        }
 #endif
                        if ( write ( pp->io.fd, "stim\r\n",6 ) != 6  ) {
@@ -541,7 +589,7 @@ jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
                } else {
 #ifdef DEBUG
                        if ( debug ) {
-                               printf ( "jjy_receive_tristate_jjy01 (refclock_jjy.c) : send 'time<CR><LF>'\n" ) ;
+                               printf ( "%s (refclock_jjy.c) : send 'time<CR><LF>'\n", sFunctionName ) ;
                        }
 #endif
                        if ( write ( pp->io.fd, "time\r\n",6 ) != 6  ) {
@@ -554,12 +602,22 @@ jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
 
        case 2 : /* HH:MM:SS */
 
-               if ( iLen < 8 ) {
+               if ( iLen != 8 ) {
+#ifdef DEBUG
+               if ( debug >= 2 ) {
+                       printf ( "%s (refclock_jjy.c) : Reply length error ( up->linecount=%d  iLen=%d )\n", sFunctionName, up->linecount, iLen ) ;
+               }
+#endif
                        up->lineerror = 1 ;
                        break ;
                }
                rc = sscanf ( pBuf, "%2d:%2d:%2d", &up->hour, &up->minute, &up->second ) ;
                if ( rc != 3 || up->hour > 23 || up->minute > 59 || up->second > 60 ) {
+#ifdef DEBUG
+               if ( debug >= 2 ) {
+                       printf ( "%s (refclock_jjy.c) : Time error ( up->linecount=%d )\n", sFunctionName, up->linecount ) ;
+               }
+#endif
                        up->lineerror = 1 ;
                        break ;
                }
@@ -591,6 +649,8 @@ static int
 jjy_receive_cdex_jst2000 ( struct recvbuf *rbufp )
 {
 
+       static  char    *sFunctionName = "jjy_receive_cdex_jst2000" ;
+
        struct jjyunit      *up ;
        struct refclockproc *pp ;
        struct peer         *peer;
@@ -618,7 +678,12 @@ jjy_receive_cdex_jst2000 ( struct recvbuf *rbufp )
 
        case 1 : /* JYYMMDD HHMMSSS */
 
-               if ( iLen < 15 ) {
+               if ( iLen != 15 ) {
+#ifdef DEBUG
+               if ( debug >= 2 ) {
+                       printf ( "%s (refclock_jjy.c) : Reply length error ( iLen=%d )\n", sFunctionName, iLen ) ;
+               }
+#endif
                        up->lineerror = 1 ;
                        break ;
                }
@@ -626,6 +691,12 @@ jjy_receive_cdex_jst2000 ( struct recvbuf *rbufp )
                              &up->year, &up->month, &up->day, &up->hour, &up->minute, &up->second, &up->msecond ) ;
                if ( rc != 7 || up->month < 1 || up->month > 12 || up->day < 1 || up->day > 31
                  || up->hour > 23 || up->minute > 59 || up->second > 60 ) {
+#ifdef DEBUG
+               if ( debug >= 2 ) {
+                       printf ( "%s (refclock_jjy.c) : Time error (rc=%d) [ %02d %02d %02d * %02d %02d %02d.%1d ]\n", sFunctionName,
+                                                rc, up->year, up->month, up->day, up->hour, up->minute, up->second, up->msecond ) ;
+               }
+#endif
                        up->lineerror = 1 ;
                        break ;
                }
@@ -644,6 +715,151 @@ jjy_receive_cdex_jst2000 ( struct recvbuf *rbufp )
 
 }
 
+/**************************************************************************************************/
+
+static int
+jjy_receive_echokeisokuki_lt2000 ( struct recvbuf *rbufp )
+{
+
+       static  char    *sFunctionName = "jjy_receive_echokeisokuki_lt2000" ;
+
+       struct jjyunit      *up ;
+       struct refclockproc *pp ;
+       struct peer         *peer;
+
+       char    *pBuf ;
+       int     iLen ;
+       int     rc ;
+    int     i, ibcc, ibcc1, ibcc2 ;
+
+       /*
+        * Initialize pointers and read the timecode and timestamp
+        */
+       peer = (struct peer *) rbufp->recv_srcclock ;
+       pp = peer->procptr ;
+       up = (struct jjyunit *) pp->unitptr ;
+
+       if ( up->linediscipline == LDISC_RAW ) {
+               pBuf = up->rawbuf ;
+               iLen = up->charcount ;
+       } else {
+           pBuf = pp->a_lastcode ;
+           iLen = pp->lencode ;
+       }
+
+       switch ( up->linecount ) {
+
+       case 1 : /* YYMMDDWHHMMSS<BCC1><BCC2> or YYMMDDWHHMMSS<ST1><ST2><ST3><ST4> */
+
+               if ( ( up->operationmode == 1 && iLen != 15 ) || ( up->operationmode == 2 && iLen != 17 ) ) {
+#ifdef DEBUG
+               if ( debug >= 2 ) {
+                       printf ( "%s (refclock_jjy.c) : Reply length error ( iLen=%d )\n", sFunctionName, iLen ) ;
+               }
+#endif
+                       if ( up->operationmode == 1 ) {
+#ifdef DEBUG
+                               if ( debug ) {
+                                       printf ( "%s (refclock_jjy.c) : send '#'\n", sFunctionName ) ;
+                               }
+#endif
+                               if ( write ( pp->io.fd, "#",1 ) != 1  ) {
+                                       refclock_report ( peer, CEVNT_FAULT ) ;
+                               }
+                       }
+                       up->lineerror = 1 ;
+                       break ;
+               }
+
+               if ( up->operationmode == 1 ) {
+
+               for ( i = ibcc = 0 ; i < 13 ; i ++ ) ibcc ^= pBuf[i] ;
+               ibcc1 = 0x30 | ( ( ibcc >> 4 ) & 0xF ) ;
+               ibcc2 = 0x30 | ( ( ibcc      ) & 0xF ) ;
+               if ( pBuf[13] != ibcc1 || pBuf[14] != ibcc2 ) {
+#ifdef DEBUG
+                       if ( debug >= 2 ) {
+                               printf ( "%s (refclock_jjy.c) : BCC error ( Recv=%02X,%02X / Calc=%02X,%02X)\n", sFunctionName, pBuf[13]&0xFF, pBuf[14]&0xFF, ibcc1, ibcc2 ) ;
+                       }
+#endif
+                               up->lineerror = 1 ;
+                               break ;
+                       }
+
+        }
+
+               rc = sscanf ( pBuf, "%2d%2d%2d%*1d%2d%2d%2d",
+                      &up->year, &up->month, &up->day, &up->hour, &up->minute, &up->second ) ;
+               if ( rc != 6 || up->month < 1 || up->month > 12 || up->day < 1 || up->day > 31
+                 || up->hour > 23 || up->minute > 59 || up->second > 60 ) {
+#ifdef DEBUG
+               if ( debug >= 2 ) {
+                       printf ( "%s (refclock_jjy.c) : Time error (rc=%d) [ %02d %02d %02d * %02d %02d %02d ]\n", sFunctionName,
+                                                rc, up->year, up->month, up->day, up->hour, up->minute, up->second ) ;
+               }
+#endif
+                       up->lineerror = 1 ;
+                       break ;
+               }
+
+               up->year += 2000 ;
+
+               if ( up->operationmode == 2 ) {
+
+                       /* A time stamp comes on every 0.5 seccond in the mode 2 of the LT-2000. */
+                       up->msecond = 500 ;
+                       pp->second -- ;
+                       if ( pp->second < 0 ) {
+                               pp->second = 59 ;
+                               pp->minute -- ;
+                               if ( pp->minute < 0 ) {
+                                       pp->minute = 59 ;
+                                       pp->hour -- ;
+                                       if ( pp->hour < 0 ) {
+                                               pp->hour = 23 ;
+                                               pp->day -- ;
+                                               if ( pp->day < 1 ) {
+                                                       pp->year -- ;
+                                                       pp->day  = ymd2yd ( pp->year, 12, 31 ) ;
+                                               }
+                                       }
+                               }
+                       }
+
+                       /* Switch from mode 2 to mode 1 in order to restraint of useless time stamp. */
+#ifdef DEBUG
+                       if ( debug ) {
+                               printf ( "%s (refclock_jjy.c) : send '#'\n", sFunctionName ) ;
+                       }
+#endif
+                       if ( write ( pp->io.fd, "#",1 ) != 1  ) {
+                               refclock_report ( peer, CEVNT_FAULT ) ;
+                       }
+
+               }
+
+               break ;
+
+       default : /*  Unexpected reply */
+
+#ifdef DEBUG
+               if ( debug ) {
+                       printf ( "%s (refclock_jjy.c) : send '#'\n", sFunctionName ) ;
+               }
+#endif
+               if ( write ( pp->io.fd, "#",1 ) != 1  ) {
+                       refclock_report ( peer, CEVNT_FAULT ) ;
+               }
+
+               up->lineerror = 1 ;
+               break ;
+
+       }
+
+       return 1 ;
+
+}
+
 /**************************************************************************************************/
 /*  jjy_poll - called by the transmit procedure                                                   */
 /**************************************************************************************************/
@@ -686,6 +902,10 @@ jjy_poll ( int unit, struct peer *peer )
                jjy_poll_cdex_jst2000 ( unit, peer ) ;
                break ;
 
+       case UNITTYPE_ECHOKEISOKUKI_LT2000 :
+               jjy_poll_echokeisokuki_lt2000 ( unit, peer ) ;
+               break ;
+
        default :
                break ;
 
@@ -699,11 +919,9 @@ static void
 jjy_poll_tristate_jjy01  ( int unit, struct peer *peer )
 {
 
-       struct jjyunit      *up;
        struct refclockproc *pp;
 
        pp = peer->procptr;
-       up = (struct jjyunit *) pp->unitptr ;
 
        /*
         * Send "date<CR><LF>" command
@@ -747,6 +965,42 @@ jjy_poll_cdex_jst2000 ( int unit, struct peer *peer )
 
 }
 
+/**************************************************************************************************/
+
+static void
+jjy_poll_echokeisokuki_lt2000 ( int unit, struct peer *peer )
+{
+
+       struct jjyunit      *up;
+       struct refclockproc *pp;
+
+       char    sCmd[2] ;
+
+       pp = peer->procptr;
+       up = (struct jjyunit *) pp->unitptr ;
+
+       /*
+        * Send "T" or "C" command
+        */
+
+       switch ( up->operationmode ) {
+       case 1 : sCmd[0] = 'T' ; break ;
+       case 2 : sCmd[0] = 'C' ; break ;
+       }
+       sCmd[1] = 0 ;
+
+#ifdef DEBUG
+       if ( debug ) {
+               printf ( "jjy_poll_echokeisokuki_lt2000 (refclock_jjy.c) : send '%s'\n", sCmd ) ;
+       }
+#endif
+
+       if ( write ( pp->io.fd, sCmd, 1 ) != 1  ) {
+               refclock_report ( peer, CEVNT_FAULT ) ;
+       }
+
+}
+
 #else
 int refclock_jjy_bs ;
 #endif /* REFCLOCK */