/home/hillier_g/checkout/most4linux/libnetservices/include/smsc/mostns1.h

00001 /*
00002 ==============================================================================
00003 
00004 Project:        MOST NetServices 
00005 Module:         Header File of MOST NetServices API (Basic Layer)
00006 File:           MostNS1.h
00007 Version:        1.10.03 
00008 Language:       C
00009 Author(s):      S.Kerber
00010 Date:           25.Feb.2005
00011 
00012 FileGroup:      Layer I
00013 Customer ID:    20D0FF0B011003.N.SIERE
00014 FeatureCode:    FCR1
00015 ------------------------------------------------------------------------------
00016 
00017                 (c) Copyright 1998-2005
00018                 Oasis SiliconSystems AG
00019                 All Rights Reserved
00020 
00021 ------------------------------------------------------------------------------
00022 
00023 
00024 
00025 Modifications
00026 ~~~~~~~~~~~~~
00027 Date        By      Description
00028 ==============================================================================
00029 */
00030 
00031 
00032 #ifndef _MOSTNS1_H
00033 #define _MOSTNS1_H
00034 
00035 
00036 
00037 
00038 #include "mostdef1.h"                           // General Definitions and Macros of MOST NetService API (Basic Layer)
00039 #include "mostreg.h"                            // MOST Transceiver Register Definitions
00040 
00041 
00042 
00043 
00044 
00045 
00046 #ifdef __cplusplus                  // All API functions are C-Functions
00047 extern "C" {
00048 #endif
00049 
00050 
00051 
00052 
00053 /********************************************************************************************************************
00054 
00055                             GLOBAL DEFINITIONS OF MOST NETSERVICES (BASIC LAYER)
00056 
00057 ********************************************************************************************************************/
00058 
00059 
00060 
00061 
00062 //-----------------------------------------------------------------//
00063 //  Definitions of Extended MOST Supervisor                        //
00064 //-----------------------------------------------------------------//
00065 
00066 #if (defined MSV_EXTENDED) || (defined MSV_VIRTUAL)
00067 
00068 /* states of MOST Supervisor state machine */
00069 #define START_UP        0x01
00070 #define ZERO_POWER      0x00
00071 #define CONFIRM_M       0x02
00072 #define CONFIRM_S       0x03
00073 #define NET_ON          0x04
00074 #define NET_OFF         0x05
00075 #define VIRTUAL_ZERO    0x06
00076 
00077 
00078 /* values for MostStartUp(byte Dev_Mode, byte Options) */
00079 
00080 // Dev_Mode
00081 
00082 #define MASTER          0x01
00083 #define SLAVE           0x00
00084 
00085 
00086 // Options
00087 #define STATIC_MASTER   0x80
00088 #define SET_BYPASS      0x40
00089 #define ZERO_WAKEUP     0x20
00090 #define ZERO_REQUEST    0x10
00091 #define FAKE_OFF        0x08
00092 #define SLAVE_WAKEUP    0x04
00093 #define DIAGNOSIS       0x02
00094 #define RESET           0x01
00095 
00096 
00097 // Options2
00098 // ... reserved
00099 
00100 
00101 /* values for MostSetOffMode(byte Off_Mode) */
00102 #define OFF_BY_REQUEST  0x00                    // NET_OFF only by application request
00103 #define OFF_BY_LIGHT    0x01                    // NET_OFF by request and no light
00104 #define OFF_BY_LOCK     0x02                    // NET_OFF by request, no light and no lock
00105 
00106 
00107 /* error ids */
00108 #define MSV_ERROR_1     0x80
00109 #define MSV_ERROR_2     0x81
00110 #define MSV_ERROR_3     0x86
00111 #define MSV_ERROR_4     0x87
00112 #define MSV_ERROR_5     0x83
00113 #define MSV_ERROR_6     0x88
00114 #define MSV_ERROR_7     0x89
00115 #define MSV_ERROR_8     0x82
00116 #define MSV_ERROR_9     0x84
00117 #define MSV_ERROR_10    0x85
00118 #define MSV_ERROR_11    0x8A
00119 #define MSV_ERROR_12    0x8B
00120 #define MSV_ERROR_13    0x8C
00121 #define MSV_ERROR_14    0x8D
00122 #define MSV_ERROR_15    0x8E
00123 
00124 /* lock states */
00125 #define LOCK                0x01
00126 #define UN_LOCK             0x00
00127 #define MSV_UNLOCK          0x00                // MostLock = FALSE, SysLock = TRUE
00128 #define MSV_LOCK_SHORT      0x01                // MostLock = TRUE, but not yet stable
00129 #define MSV_LOCK_STABLE     0x02                // MostLock = TRUE, stable
00130 #define MSV_UNLOCK_CRITICAL 0x03                // SysLock  = FALSE (NetOff or critical unlock detected)
00131 
00132 
00133 /* Diagnosis Info */
00134 #define DIAG_OK             0xFF                // Diagnosis Info: no error detected
00135 #define DIAG_MULTIMASTER    0xFE                // Diagnosis Info: diagnosis ok, but the device, which should be
00136                                                 // configured as timing master is configured as
00137                                                 // slave device, since there is another master in the network
00138 
00139 #define DIAG_ALLSLAVE       0xFD                // Diagnosis Info: no timing master existing
00140 #define DIAG_POOR           0xFC                // Diagnosis Info: fatal error, no relative position value available
00141 
00142 
00143 
00144 
00145 
00146 #endif
00147 
00148 
00149 
00150 //-----------------------------------------------------------------//
00151 //  Definitions of Minimum MOST Supervisor                         //
00152 //-----------------------------------------------------------------//
00153 #ifdef MSV_MINIMUM
00154 
00155 /* states of MOST Supervisor state machine */
00156 #define INITIAL_STATE   0x00
00157 #define START_UP        0x01
00158 #define SWITCH_ON       0x10
00159 #define NET_ON          0x04
00160 #define NET_OFF         0x05
00161 #define ZERO_POWER      INITIAL_STATE   // workaround since macro ZERO_POWER is used
00162                                         // by module MNS.C even if only the Minimum
00163                                         // Supervisor is implemented
00164 
00165 /* values for MostStartUp(byte Dev_Mode, byte Options) */
00166 
00167 // Dev_Mode
00168 #define MASTER          0x01
00169 #define SLAVE           0x00
00170 
00171 // Options
00172 #define ZERO_WAKEUP     0x20    //  ignored
00173 #define ZERO_REQUEST    0x10    //  ignored
00174 #define FAKE_OFF        0x08    //  ignored
00175 #define SLAVE_WAKEUP    0x04    //  ignored
00176 #define DIAGNOSIS       0x02    //  ignored
00177 #define RESET           0x01    //  available
00178 
00179 #endif
00180 
00181 
00182 
00183 //-----------------------------------------------------------------//
00184 //  Definitions of MOST NetService Kernel (MNS)                    //
00185 //-----------------------------------------------------------------//
00186 
00187 // Flags of MnsPending:
00188 //----------------------
00189 #define MNS_P_MSV_STATE     (word)0x0001        // MSV: State changed event
00190 #define MNS_P_MSV_TIMEOUT   (word)0x0002        // MSV: Timeout event
00191 #define MNS_P_MSV_VZERO     (word)0x0004        // MSV: Polling Net Activity required (state VIRTUAL_ZERO)
00192 #define MNS_P_CMS_RXBUF_IN  (word)0x0008        // CMS: Rx Buffer overflow (ingoing)
00193 #define MNS_P_CMS_RXBUF_OUT (word)0x0010        // CMS: Rx Buffer request re-trigger (outgoing)
00194 #define MNS_P_AMS_RXBUF_OUT (word)0x0020        // AMS: Rx Buffer request re-trigger    (outgoing)
00195 #define MNS_P_CMS_TX        (word)0x0040        // CMS: Tx Buffer not empty
00196 #define MNS_P_AMS_TX        (word)0x0080        // AMS: Tx Buffer not empty
00197 #define MNS_P_MSV_SBC       (word)0x0100        // MSV: Polling of SBC required or stable lock/light off while initialization
00198 #define MNS_P_MSV_UNLOCK    (word)0x0200        // MSV: Polling required, since error interrupt disabled
00199 #define MNS_P_CMS_TX_FIN    (word)0x0400        // CMS: Request to complete tx process
00200 #define MNS_P_INFO_BUF      (word)0x0800        // MNS: MNS Control Interface (Info Msg) must be re-triggered
00201 #define MNS_P_MSV_LIGHT     (word)0x1000        // MSV: Polling Net Activity required
00202 
00203 
00204 // Define group of flags:
00205 //------------------------
00206 #if (defined MSV_EXTENDED || defined MSV_MINIMUM)
00207  #define MNS_P_MASK_MSV     ((MNS_P_MSV_STATE)|(MNS_P_MSV_TIMEOUT)|(MNS_P_MSV_VZERO)|(MNS_P_MSV_UNLOCK)|(MNS_P_MSV_SBC)|(MNS_P_MSV_LIGHT))
00208 #else
00209  #define MNS_P_MASK_MSV     0
00210 #endif
00211 
00212 #ifdef CMS_TX_MIN
00213  #define MNS_P_MASK_CMS_TX  ((MNS_P_CMS_TX)|(MNS_P_CMS_TX_FIN))
00214 #else
00215  #define MNS_P_MASK_CMS_TX  0
00216 #endif
00217 
00218 #ifdef CMS_RX_MIN
00219  #define MNS_P_MASK_CMS_RX  ((MNS_P_CMS_RXBUF_IN)|(MNS_P_CMS_RXBUF_OUT))
00220 #else
00221  #define MNS_P_MASK_CMS_RX  0
00222 #endif
00223 
00224 #ifdef AMS_TX_MIN
00225  #define MNS_P_MASK_AMS_TX  (MNS_P_AMS_TX)
00226 #else
00227  #define MNS_P_MASK_AMS_TX  0
00228 #endif
00229 
00230 #ifdef AMS_RX_MIN
00231  #define MNS_P_MASK_AMS_RX (MNS_P_AMS_RXBUF_OUT)
00232 #else
00233  #define MNS_P_MASK_AMS_RX  0
00234 #endif
00235 
00236 #ifdef MNS_MSG_INTF
00237  #define MNS_P_MASK_MNS     (MNS_P_INFO_BUF)
00238 #else
00239  #define MNS_P_MASK_MNS     0
00240 #endif
00241 
00242 
00243 
00244 // Mask of used flags (control section):
00245 //---------------------------------------------
00246 #define MNS_P_MASK_CS       (MNS_P_MASK_MSV | MNS_P_MASK_CMS_TX | MNS_P_MASK_CMS_RX | MNS_P_MASK_AMS_TX | MNS_P_MASK_AMS_RX | MNS_P_MASK_MNS)
00247 
00248 // Mask of all flags, that are serviced only in case of NetOn:
00249 //------------------------------------------------------------
00250 #ifndef MNS_TX_NETOFF
00251  #define MNS_P_MASK_CS_NETON    (MNS_P_CMS_RXBUF_IN | MNS_P_MASK_CMS_TX | MNS_P_MASK_AMS_TX | MNS_P_CMS_TX_FIN)
00252 #else
00253  #define MNS_P_MASK_CS_NETON    (MNS_P_CMS_RXBUF_IN)
00254 #endif
00255 
00256 // Mask of all flags, that are serviced only in case of state != ZERO_POWER
00257 //-------------------------------------------------------------------------
00258  #define MNS_P_MASK_CS_NOTZERO  (MNS_P_CMS_RXBUF_IN | MNS_P_MASK_CMS_TX | MNS_P_MASK_AMS_TX | MNS_P_CMS_TX_FIN | MNS_P_CMS_RXBUF_OUT | MNS_P_AMS_RXBUF_OUT )
00259 
00260 
00261 
00262 
00263 
00264 // Options for MostService:
00265 //--------------------------
00266 #define MNS_O_NO_CMSRX              0x0001      // don't distribute received messages (CMS RX section)
00267 #define MNS_O_NO_AMSRX              0x0002      // don't interprete received AMS messages (AMS RX section)
00268 #define MNS_O_NO_CMSTX              0x0004      // don't send control messages
00269 #define MNS_O_NO_AMSTX              0x0008      // don't service AMS TX section
00270 #define MNS_O_NO_SECRX              0x0010      // don't service RX buffer of secondary node
00271 #define MNS_O_ALL                   0x0000      // service all pending requests
00272 #define MNS_O_INT                   0x001F      // service only the interrupt requests
00273 
00274 
00275 // Events for MostService:
00276 //--------------------------
00277 #define MNS_E_TIMER                 ((MNS_P_MSV_TIMEOUT)|(MNS_P_CMS_TX_FIN))// Event forced by MnsRequestTimer()
00278 #define MNS_E_PEN                   0x8000                                  // Event forced by return value of MostService()
00279 #define MNS_E_REQ                   0x4000                                  // Event forced by MnsRequest()
00280 #define MNS_E_INT                   0x2000                                  // Event forced by MOST Interrupt (INT)
00281 #define MNS_E_MASK                  MNS_E_TIMER // Mask for events, which must be captured by "MnsPending"
00282 
00283 
00284 
00285 
00286 // Flags of MnsPendingAsync:
00287 //---------------------------
00288 #define MNS_P_ADS_RXBUF_IN          (byte)0x01        // ADS Rx Buffer overflow (ingoing)
00289 #define MNS_P_ADS_RXBUF_OUT         (byte)0x02        // ADS Rx Buffer request re-trigger (outgoing)
00290 #define MNS_P_ADS_TX                (byte)0x04        // ADS Tx Buffer not empty or timeout (tx pending)
00291 #define MNS_P_ADS_PCTC              (byte)0x08        // ADS register PCTC pending
00292 #define MNS_P_ADS_UNLOCK            (byte)0x10        // Retrigger required since unlock while being in state NET_ON
00293 
00294 // Define group of flags:
00295 //------------------------
00296 #ifdef ADS_RX_MIN
00297  #define MNS_P_MASK_ADS_RX          ( MNS_P_ADS_RXBUF_IN | MNS_P_ADS_RXBUF_OUT )
00298 #else
00299  #define MNS_P_MASK_ADS_RX          0
00300 #endif
00301 
00302 #ifdef ADS_TX_MIN
00303  #define MNS_P_MASK_ADS_TX          ( MNS_P_ADS_TX )
00304 #else
00305  #define MNS_P_MASK_ADS_TX          0
00306 #endif
00307 
00308 #if (defined ADS_TX_MIN) || (defined ADS_RX_MIN)
00309  #define MNS_P_MASK_ADS_GEN         ( MNS_P_ADS_PCTC | MNS_P_ADS_UNLOCK)
00310 #else
00311  #define MNS_P_MASK_ADS_GEN         0
00312 #endif
00313 
00314 // Mask of used flags (async section):
00315 //---------------------------------------------
00316 #define MNS_P_MASK_ADS              (MNS_P_MASK_ADS_RX | MNS_P_MASK_ADS_TX | MNS_P_MASK_ADS_GEN)
00317 
00318 
00319 
00320 // Options for MostServiceAsync:
00321 //-------------------------------
00322 #define MNS_O_NO_ADSRX              0x01            // don't interprete received packets (ADS RX section)
00323 #define MNS_O_NO_ADSTX              0x02            // don't transmit packets
00324 #define MNS_O_ADS_ALL               0x00            // service all pending requests
00325 #define MNS_O_ADS_INT               0x03            // service only the interrupt requests
00326 
00327 
00328 // Events for MostServiceAsync:
00329 //-------------------------------
00330 #define MNSA_E_TIMER                MNS_P_ADS_TX    // Event forced by MnsRequestAsyncTimer()
00331 #define MNSA_E_PEN                  0x80            // Event forced by return value of MostServiceAsync()
00332 #define MNSA_E_REQ                  0x40            // Event forced by MnsRequestAsync()
00333 #define MNSA_E_INT                  0x20            // Event forced by MOST Async Interrupt (AINT)
00334 #define MNSA_E_MASK                 MNSA_E_TIMER    // Mask for events, which must be captured by "MnsPendingAsync"
00335 
00336 
00337 
00338 
00339 //-----------------------------------------------------------------//
00340 //  Command Message Interface between MNS and HW Layer             //
00341 //-----------------------------------------------------------------//
00342 #define MOSTCTRL_MSV_STARTUP                0x0100
00343 #define MOSTCTRL_MSV_OFFMODE                0x0101
00344 #define MOSTCTRL_MSV_SHUTDOWN               0x0102
00345 #define MOSTCTRL_MSV_ZEROPOWER              0x0103
00346 #define MOSTCTRL_MSV_STARTUP_EXT            0x0104
00347 #define MOSTCTRL_MSV_DIAG_GET_RES           0x0105
00348 #define MOSTCTRL_MSV_DIAG_SHUT_DOWN         0x0106
00349 #define MOSTCTRL_MSV_COUNT_CODING_ERRORS    0x0107
00350 
00351 #define MOSTCTRL_CMS_SETRBEMODE             0x0200
00352 #define MOSTCTRL_CMS_SETRBENABLE            0x0201
00353 
00354 #define MOSTCTRL_READ_CP                    0x0300
00355 #define MOSTCTRL_WRITE_CP                   0x0301
00356 #define MOSTCTRL_WRITE_BIT_CP               0x0302
00357 #define MOSTCTRL_WRITE_BITFIELD_CP          0x0303
00358 
00359 #define MOSTCTRL_MCS_FIND_CHANNELS          0x0310
00360 
00361 #define MOSTCTRL_NBMIN_MODE                 0x0400
00362 
00363 #define MOSTCTRL_SYNC_IN_CONNECT            0x0500
00364 #define MOSTCTRL_SYNC_OUT_CONNECT           0x0501
00365 #define MOSTCTRL_SYNC_OUT_DISCONNECT        0x0502
00366 #define MOSTCTRL_SYNC_IN_DISCONNECT         0x0503
00367 #define MOSTCTRL_SYNC_IN_MUTE               0x0504
00368 #define MOSTCTRL_SYNC_MOVE_BOUNDARY         0x0505
00369 
00370 //-----------------------------------------------------------------//
00371 //  Info Message Interface between MNS and HW Layer                //
00372 //-----------------------------------------------------------------//
00373 #define MOSTINFO_MSV_STATE          0x0100
00374 #define MOSTINFO_MSV_MPR            0x0101
00375 #define MOSTINFO_MSV_MPR_DELAYED    0x0102
00376 #define MOSTINFO_MSV_LOCK           0x0103
00377 #define MOSTINFO_MSV_DIAG           0x0104
00378 #define MOSTINFO_MSV_ERROR          0x0105
00379 #define MOSTINFO_MSV_NPR            0x0106
00380 #define MOSTINFO_MSV_MOSTREV        0x0107
00381 #define MOSTINFO_MSV_RESET_INFO     0x0109
00382 #define MOSTINFO_MSV_CODING_ERROR   0x0110
00383 
00384 #define MOSTINFO_MSVAL_INFO         0x0180
00385 
00386 #define MOSTINFO_MMSG_RESULT        0x0201
00387 #define MOSTINFO_MSG_TX_RESULT      0x0202  // AMS TX Result
00388 #define MOSTINFO_MH_TX_RESULT       0x0203  // MHP TX Result
00389 #define MOSTINFO_MH_RX_CONSTATUS    0x0204  // MHP RX ConStatus
00390 #define MOSTINFO_MH_TX_CONSTATUS    0x0205  // MHP TX ConStatus
00391 
00392 #define MOSTINFO_READ_CP            0x0300
00393 #define MOSTINFO_WRITE_CP           0x0301
00394 #define MOSTINFO_WRITE_BIT_CP       0x0302
00395 #define MOSTINFO_WRITE_BITFIELD_CP  0x0303
00396 
00397 #define MOSTINFO_MCS_FIND_CHANNELS  0x0310
00398 
00399 #define MOSTINFO_SYNC_MOVE_BOUNDARY 0x0505
00400 
00401 
00402 
00403 //-----------------------------------------------------------------//
00404 //  MOST Message Interface between Layer I and HW Layer            //
00405 //-----------------------------------------------------------------//
00406 #define MSG_HANDLE_CMS              0x0001
00407 #define MSG_HANDLE_AMS              0x0004
00408 #define MSG_HANDLE_SCS              0x0007
00409 #define MSG_HANDLE_RCS              0x000A
00410 #define MSG_HANDLE_MHP              0x000D
00411 
00412 
00413 //-----------------------------------------------------------------//
00414 //  Debug Interface                                                //
00415 //-----------------------------------------------------------------//
00416 
00417 #define MNS_DBG_BUF_SIZE    30  // maximum size of debug message
00418 
00419 // Debug Level IDs:
00420 //-----------------
00421 #define MNS_DBG_LEVEL_MSV_1         (1<<0)
00422 #define MNS_DBG_LEVEL_MSV_2         (1<<1)
00423 #define MNS_DBG_LEVEL_AMS_TX_1      (1<<2)
00424 #define MNS_DBG_LEVEL_AMS_RX_1      (1<<3)
00425 
00426 
00427 // Dbg Msg IDs:
00428 //--------------
00429 #define MNS_DBG_MSV                 0x0100
00430 #define MNS_DBG_AMS_RXBUF_STATUS    0x0200
00431 #define MNS_DBG_AMS_RXBUF_NUM       0x0201
00432 
00433 
00434 
00435 
00436 //-----------------------------------------------------------------//
00437 //  Definitions of Control Message Service (CMS)                   //
00438 //-----------------------------------------------------------------//
00439 
00440 #ifdef CMS_TX_MIN
00441 
00442 // Xmit Status
00443 //------------------
00444 #define XMIT_SUCCESS        (byte)0x10
00445 #define XMIT_TYPEFAILED     (byte)0x11
00446 #define XMIT_WRONGTARGET    (byte)0x00
00447 #define XMIT_CRC            (byte)0x20
00448 #define XMIT_BUF            (byte)0x21
00449 #define XMIT_FIFO           (byte)0x40    // no free TX buffer in the driver layer
00450 #define XMIT_TIMEOUT        (byte)0x80
00451 //------------------
00452 
00453 #endif
00454 
00455 
00456 
00457 
00458 //-----------------------------------------------------------------//
00459 //  Definitions of Application Message Service (AMS)               //
00460 //-----------------------------------------------------------------//
00461 
00462 #if (defined AMS_TX_ADD6) || (defined AMS_RX_ADD4)
00463 #define MOST_TGT_INTERN     (word)0x0000                // target address of local FBlock
00464 #define MOST_SRC_INTERN     (word)0x0000                // source address of local FBlock
00465 #endif
00466 
00467 
00468 
00469 
00470 #ifdef AMS_RX_MIN
00471 
00472 // Possible errors while receiving a telegram
00473 //-------------------------------------------
00474 #define MSG_ERR_1   (byte)0x01    // > CMS            // missing the first telegram of a segmented message
00475 #define MSG_ERR_2   (byte)0x02    // > CMS            // buffer overflow (bufferline not long enough)
00476 #define MSG_ERR_3   (byte)0x03    // > CMS            // invalid telegram (corresponding bufferline not found)
00477                                                 // since wrong blockcounter or wrong source address
00478 #define MSG_ERR_4   (byte)0x04    // > CMS            // buffer overflow (no free bufferline)
00479 #define MSG_ERR_5   (byte)0x85    // > AMS            // missing last telegram(s), garbage collector will clean the bufferline
00480 #define MSG_ERR_6   (byte)0x06    // > CMS            // device is not able to receive a segmented message
00481 #define MSG_ERR_7   (byte)0x87    // > AMS            // missing last telegram(s); message is cleared, since new message from
00482                                                 // same source address has been received
00483 #define MSG_ERR_8   (byte)0x88    // > AMS            // buffer overflow (report first part of message in AMS)
00484 
00485 #define MSG_ERR_MASK_AMS    (byte)0x80                // mask that indicates AMS buffer pointer
00486 //-------------------------------------------
00487 
00488 #endif
00489 
00490 
00491 
00492 
00493 //-----------------------------------------------------------------//
00494 //  Definitions of Synchronous Channel Allocation Service (SCS)    //
00495 //-----------------------------------------------------------------//
00496 
00497 #ifdef SCS_SOURCE_ALLOC_MIN
00498 
00499 // Answers used for callback function
00500 // (XmitStatus | AllocAnswer)
00501 //-----------------------------------------
00502 #define ALLOC_XMIT_GRANT    0x11                // Xmit Success and Alloc Grant (all requested channels allocated)
00503 #define ALLOC_XMIT_BUSY     0x12                // Xmit Success but master is busy (no channels allocated)
00504 #define ALLOC_XMIT_DENY     0x13                // Xmit Success but there a not enough free channels (no channels allocated)
00505 #define ALLOC_XMIT_CRC      0x20                // Xmit failed since a CRC error (no channels allocated)
00506 #define ALLOC_XMIT_TIMEOUT  0x80                // Timeout error
00507 
00508 
00509 // Answers used for callback function
00510 // (XmitStatus | DeAllocAnswer)
00511 //-----------------------------------------
00512 #define DEALLOC_XMIT_GRANT   0x11               // Xmit Success and DeAlloc Grant (Deallocation successful)
00513 #define DEALLOC_XMIT_BUSY    0x12               // Xmit Success but master is busy (Deallocation failed)
00514 #define DEALLOC_XMIT_WRONG   0x14               // Xmit Success but the label had a value > 0x3B (Deallocation failed)
00515 #define DEALLOC_XMIT_CRC     0x20               // Xmit failed since a CRC error (Deallocation failed)
00516 #define DEALLOC_XMIT_TIMEOUT 0x80               // Timeout error
00517 
00518 
00519 // return values for boundary change functions
00520 //-----------------------------------------
00521 #define BD_FAILED  0
00522 #define BD_SUCCESS 1
00523 #define BD_INIT    2
00524 
00525 #endif
00526 
00527 
00528 
00529 
00530 //-----------------------------------------------------------------//
00531 //  Definitions of MOST Transceiver Control Service                //
00532 //-----------------------------------------------------------------//
00533 
00534 // values for: void MostSelectClockInput(byte pll_in)
00535 #define     PLL_SPDIF       0x01                                        // Source: SR0 (S/PDIF)
00536 #define     PLL_CRYSTAL     0x02                                        //         Crystal
00537 #define     PLL_SCK         0x03                                        //         SCK
00538 
00539 // values for: void MostSelectClockOutput(byte rmck_divide)
00540 
00541 #define     RMCK_1536       0x40                                        // Frmck = 1536 * Fs
00542 #define     RMCK_1024       0x50                                        //         1024 * Fs
00543 #define     RMCK_768        0x60                                        //          768 * Fs
00544 #define     RMCK_512        0x70                                        //          512 * Fs
00545 #define     RMCK_384        0x00                                        //          384 * Fs
00546 #define     RMCK_256        0x10                                        //          256 * Fs
00547 #define     RMCK_128        0x20                                        //          128 * Fs
00548 #define     RMCK_64         0x30                                        //           64 * Fs
00549 #define     RMCK_OFF        0xFF                                        // disable RMCK output
00550 
00551 #define     RMCK_MASK       0x70                                        // mask for RMCK bit in bCM2/cmcs register
00552 
00553 
00554 // values for: void MostEnableInt(byte interrupts)
00555 //             void MostDisableInt(byte interrupts)
00556 #define     INT_ALC         0x08                                        // Interrupt on change of register MPR or MDR
00557 #define     INT_ERR         0x04                                        // Interrupt on Error or Power-on after start-up
00558 #define     INT_MTX         0x02                                        // Interrupt on Message transmitted
00559 #define     INT_MRX         0x01                                        // Interrupt on Message received
00560 
00561 
00562 
00563 
00564 
00565 //-----------------------------------------------------------------//
00566 //  Definitions of MOST Event Combiner                             //
00567 //-----------------------------------------------------------------//
00568 
00569 #ifdef MSVAL_MIN
00570 
00571 // State change events
00572 #define MSVAL_S_OFF                 0x00
00573 #define MSVAL_S_INIT                0x01
00574 #define MSVAL_S_RBD                 0x02
00575 #define MSVAL_S_ON                  0x03
00576 #define MSVAL_S_BYPASS              0x04
00577 #define MSVAL_S_ZERO_POWER          0x05
00578 
00579 
00580 // Lock events
00581 #define MSVAL_LS_UNLOCK             0x00
00582 #define MSVAL_LS_LOCK               0x01
00583 #define MSVAL_LS_LOCKSTABLE         0x02
00584 #define MSVAL_LS_UNLOCKCRITICAL     0x03
00585 
00586 
00587 // Events
00588 #define MSVAL_E_UNLOCK              0x00
00589 #define MSVAL_E_LOCKSTABLE          0x01
00590 #define MSVAL_E_UNLOCK_CRITICAL     0x02
00591 #define MSVAL_E_MPR                 0x10
00592 #define MSVAL_E_MPRDEL_INC          0x11
00593 #define MSVAL_E_MPRDEL_DEC          0x12
00594 #define MSVAL_E_MPRDEL_EQUAL        0x13
00595 #define MSVAL_E_NETON               0x20
00596 #define MSVAL_E_SHUTDOWN            0x21
00597 #define MSVAL_E_RESET               0x40
00598 #define MSVAL_E_LIGHT_OFF           0x41
00599 #define MSVAL_E_LIGHT_ON            0x42
00600 #define MSVAL_E_BYPASS_CLOSED       0x43
00601 #define MSVAL_E_BYPASS_OPEN         0x44
00602 #define MSVAL_E_AUTOMUTE            0x50
00603 #define MSVAL_E_AUTODEMUTE          0x51
00604 
00605 // Errors
00606 #define MSVAL_ERR_UNLOCK_SHORT      0x00
00607 #define MSVAL_ERR_UNLOCK_CRITICAL   0x01
00608 #define MSVAL_ERR_INIT_ERROR        0x04
00609 
00610 // Diag Result
00611 #define MSVAL_DIAG_OK               0x00
00612 #define MSVAL_DIAG_POS              0x01
00613 #define MSVAL_DIAG_FAILED           0x02
00614 #define MSVAL_DIAG_LOCKLIGHT        0x03
00615 
00616 // Diag parameters
00617 #define MSVAL_D_MULTIMASTER         0x00
00618 #define MSVAL_D_ALLSLAVE            0x01
00619 #define MSVAL_D_POOR                0x02
00620 #define MSVAL_D_NOLOCK              0x00
00621 #define MSVAL_D_NOLIGHT             0x01
00622 
00623 
00624 #endif
00625 
00626 
00627 
00628 
00629 /********************************************************************************************************************
00630 
00631                             GLOBAL TYPE DECLARATIONS OF MOST NETSERVICES (BASIC LAYER)
00632 
00633 ********************************************************************************************************************/
00634 
00635 
00636 
00637 //-----------------------------------------------------------------//
00638 //  Type Declaration of MOSTNetServices Kernel (MNS)               //
00639 //-----------------------------------------------------------------//
00640 #if (defined MNS_MSG_INTF) || (defined MKC_MIN) || (defined MCS_ADD8)
00641 #define MNS_CTRL_SIZE_DATA 32   // maximum length of a command or info message (length of data field)
00642 typedef struct _TMnsCtrl
00643 {
00644     word    Command;
00645     word    Flags;
00646     byte    NumBytes;
00647     byte    Data[MNS_CTRL_SIZE_DATA];
00648 }TMnsCtrl, *pTMnsCtrl;
00649 #endif
00650 
00651 #ifdef MNS_OPT_3
00652 typedef word TTimerDiff;    // Type of parameter of function MostTimerIntDiff()
00653 #else
00654 typedef byte TTimerDiff;
00655 #endif
00656 
00657 #if  (MNS_DBG_LEVEL > 0)
00658 typedef struct _TMnsDbgMsg
00659 {
00660     word    ID;
00661     word    Flags;
00662     word    Length;
00663     byte    Data[MNS_DBG_BUF_SIZE];
00664 }TMnsDbgMsg, *pTMnsDbgMsg;
00665 #endif
00666 
00667 
00668 
00669 //-----------------------------------------------------------------//
00670 //  Type Declaration of MOST Supervisor (MSV)                      //
00671 //-----------------------------------------------------------------//
00672 typedef struct _TMsvParam
00673 {
00674     byte    mode;
00675     byte    opt;
00676     word    opt2;
00677     byte    sbc;
00678     byte    xsr2;
00679 }TMsvParam, *pTMsvParam;
00680 
00681 
00682 //-----------------------------------------------------------------//
00683 //  Type Declaration of Control Message Service (CMS)              //
00684 //-----------------------------------------------------------------//
00685 #ifdef CMS_TX_MIN
00686 typedef struct Ctrl_Tx_Type
00687 {
00688     byte Status;
00689     byte Priority;
00690     byte MsgType;
00691     byte Tgt_Adr_H;
00692     byte Tgt_Adr_L;
00693     byte Data[17];
00694     byte Length;
00695     #if  (MAX_TX_HANDLE > 0)
00696     byte TxHandle[MAX_TX_HANDLE];
00697     #endif
00698     #ifdef CTRL_FILTER_ID
00699     byte Filter_ID;
00700     #endif
00701 } TCtrlTx, *pTCtrlTx;
00702 #endif
00703 
00704 
00705 #ifdef CMS_RX_MIN
00706 typedef struct Ctrl_Rx_Type
00707 {
00708     byte Status;
00709     byte Rcv_Type;
00710     byte Src_Adr_H;
00711     byte Src_Adr_L;
00712     byte Data[17];
00713     #if  (MAX_EXT_DATA > 0)
00714     byte ExtData[MAX_EXT_DATA];
00715     #endif
00716     #ifdef CTRL_FILTER_ID
00717     byte Filter_ID;
00718     #endif
00719 } TCtrlRx, *pTCtrlRx;
00720 #endif
00721 
00722 
00723 
00724 //-----------------------------------------------------------------//
00725 //  Type Declaration of Application Message Service (AMS)          //
00726 //-----------------------------------------------------------------//
00727 
00728 typedef struct Most_Header_Type
00729 {
00730     word Device_ID; // can be Scr_Adr or Tgt_Adr
00731     byte FBlock_ID;
00732     byte Inst_ID;
00733     word Func_ID;
00734     byte Operation;
00735     word Length;
00736 
00737 } TMostHeader, *pTMostHeader;
00738 
00739 
00740 #ifdef AMS_TX_MIN
00741 typedef struct Msg_Tx_Type
00742 {
00743     byte Status;
00744     byte Priority;
00745     word Tgt_Adr;
00746     byte FBlock_ID;
00747     byte Inst_ID;
00748     word Func_ID;
00749     byte Operation;
00750     word Length;
00751     byte Data[MAX_MSG_TX_DATA];
00752     #if  (MAX_TX_HANDLE > 0)
00753     byte TxHandle[MAX_TX_HANDLE];
00754     #endif
00755     #ifdef CTRL_FILTER_ID
00756     byte Filter_ID;
00757     #endif
00758     #ifdef AMS_TX_ADD8
00759     byte *PtrDataExt;
00760     #endif
00761     #ifdef AMS_TX_ADD9
00762     byte MidLevelRetries;
00763     #endif
00764 } TMsgTx, *pTMsgTx;
00765 
00766 typedef struct Msg_TxOpt_Type
00767 {
00768     byte Priority;
00769     #if  (MAX_TX_HANDLE > 0)
00770     byte TxHandle[MAX_TX_HANDLE];
00771     #endif
00772     #ifdef CTRL_FILTER_ID
00773     byte Filter_ID;
00774     #endif
00775     #ifdef AMS_TX_ADD9
00776     byte MidLevelRetries;
00777     #endif
00778 } TMsgTxOpt, *pTMsgTxOpt;
00779 
00780 #endif  // AMS_TX_MIN
00781 
00782 
00783 #ifdef AMS_RX_MIN
00784 typedef struct Msg_Rx_Type
00785 {
00786     byte Status;
00787     byte BlckCnt;
00788     byte UsageCnt;
00789     word Src_Adr;
00790     byte FBlock_ID;
00791     byte Inst_ID;
00792     word Func_ID;
00793     byte Operation;
00794     word Length;
00795     byte Data[MAX_MSG_RX_DATA];
00796     #if  (MAX_EXT_DATA > 0)
00797     byte ExtData[MAX_EXT_DATA];
00798     #endif
00799     #ifdef CTRL_FILTER_ID
00800     byte Filter_ID;
00801     #endif
00802     byte *DPtrIn;
00803     byte Rcv_Type;
00804 
00805     #ifdef AMS_RX_ADD5
00806     byte* PtrData;                              // pointer at data field
00807     word  SizeBuffer;                           // size of data field
00808     struct Msg_Rx_ExtBuf_Type* PtrNext;         // pointer at next field
00809     struct Msg_Rx_ExtBuf_Type* PtrCurBufExt;    // pointer at current buffer extension (Last extension)
00810     word CurSizeMsgBuf;                         // current size of buffer
00811     #endif
00812 
00813 } TMsgRx, *pTMsgRx;
00814 
00815 typedef struct Msg_RxOpt_Type
00816 {
00817     #if  (MAX_EXT_DATA > 0)
00818     byte ExtData[MAX_EXT_DATA];
00819     #endif
00820     #ifdef CTRL_FILTER_ID
00821     byte Filter_ID;
00822     #endif
00823     byte Rcv_Type;
00824 
00825 } TMsgRxOpt, *pTMsgRxOpt;
00826 
00827 #endif // AMS_RX_MIN
00828 
00829 
00830 #ifdef AMS_RX_ADD5
00831 typedef struct Msg_Rx_ExtBuf_Type
00832 {
00833     byte* PtrData;                          // pointer at data field
00834     word  SizeBuffer;                       // size of data field
00835     struct Msg_Rx_ExtBuf_Type* PtrNext;     // pointer at next field
00836     struct Msg_Rx_ExtBuf_Type* PtrPrev;     // pointer at previous field
00837 
00838 } TMsgRxExtBuf, *pTMsgRxExtBuf;
00839 
00840 #endif
00841 
00842 
00843 
00844 //-----------------------------------------------------------------//
00845 //  Type Declaration of Synchronous Channel Allocation Service     //
00846 //-----------------------------------------------------------------//
00847 
00848 #ifndef SCS_NO_ADDR_CALC
00849 
00850     #ifdef SP_SER
00851     typedef struct SrcData_Type                                            // Source Data ID in serial mode
00852     {
00853         byte Port;
00854         byte Byte;
00855     } TSrcData, *pTSrcData;
00856     #endif
00857 
00858     #ifdef SP_PAR
00859     typedef struct SrcData_Type                                            // Source Data ID in parallel mode
00860     {
00861         byte SF;
00862         byte Byte;
00863     } TSrcData, *pTSrcData;
00864     #endif
00865 
00866     #ifdef SP_SERPAR
00867     typedef struct SrcData_Type                                            // Source Data mode in mini kernel
00868     {
00869         byte Port_SF;
00870         byte Byte;
00871     } TSrcData, *pTSrcData;
00872     #endif
00873 
00874 #else
00875 
00876     typedef struct SrcData_Type                                            // Address Reference is calculated
00877     {                                                                      // by application or before compilation
00878         byte AddrRef;
00879     } TSrcData, *pTSrcData;
00880 
00881 #endif
00882 
00883 
00884 //-----------------------------------------------------------------//
00885 //  Type Declaration of Async. Data Transmission Service (ADS)     //
00886 //-----------------------------------------------------------------//
00887 
00888 #ifdef ADS_TX_MIN
00889 typedef struct Data_Tx_Type
00890 {
00891     byte Status;
00892     byte Priority;
00893     byte Tgt_Adr_H;
00894     byte Tgt_Adr_L;
00895     byte Data[48];
00896     byte Length;
00897     #if  (MAX_DATA_TX_HANDLE > 0)
00898     byte TxHandle[MAX_DATA_TX_HANDLE];
00899     #endif
00900 } TDataTx, *pTDataTx;
00901 #endif
00902 
00903 
00904 #ifdef ADS_RX_MIN
00905 typedef struct Data_Rx_Type
00906 {
00907     byte Status;
00908     byte Tgt_Adr_H;
00909     byte Tgt_Adr_L;
00910     byte Src_Adr_H;
00911     byte Src_Adr_L;
00912     byte Data[48];
00913     #if (MAX_DATA_EXT_DATA > 0)
00914     byte ExtData[MAX_DATA_EXT_DATA];
00915     #endif
00916 } TDataRx, *pTDataRx;
00917 #endif
00918 
00919 
00920 
00921 
00922 
00923 
00924 /********************************************************************************************************************
00925 
00926                             GLOBAL VARIABLES OF MOST NETSERVICES (BASIC LAYER)
00927 
00928 ********************************************************************************************************************/
00929 
00930 
00931 
00932 //-----------------------------------------------------------------//
00933 //  Global variables of Extended MOST Supervisor                   //
00934 //-----------------------------------------------------------------//
00935 #ifdef MSV_EXTENDED
00936 extern byte Most_State;                                                 // current state of the state machine
00937 
00938 extern byte Sys_Lock;                                                   // provides information about lock
00939 extern byte Most_Lock;                                                  // provides information about lock
00940 extern byte Most_StableLock;                                            // provides information about lock
00941 
00942 extern byte Net_Activity;
00943 extern byte Xsr_Reg;
00944 extern byte Cm2_Reg;
00945 extern byte Mpr_Reg;
00946 extern byte Mpr_Reg_Old;
00947 extern byte Npr_Reg;
00948 #endif
00949 
00950 //-----------------------------------------------------------------//
00951 //  Global variables of Virtual MOST Supervisor                    //
00952 //-----------------------------------------------------------------//
00953 #ifdef MSV_VIRTUAL
00954 extern byte Most_State;
00955 extern byte Lock_State;
00956 extern byte Mpr_Reg;
00957 extern byte Npr_Reg;
00958 //extern byte Mpr_Reg_Old;
00959 #endif
00960 
00961 
00962 //-----------------------------------------------------------------//
00963 //  Global variables of Minimum MOST Supervisor                    //
00964 //-----------------------------------------------------------------//
00965 #ifdef MSV_MINIMUM
00966 extern byte Most_State;                                                 // current state of the state machine
00967 #endif
00968 
00969 
00970 //-----------------------------------------------------------------//
00971 //  Global variables of MOST Transceiver Control Service (MCS)     //
00972 //-----------------------------------------------------------------//
00973 #if (defined MCS_MIN) || (defined MSV_EXTENDED) || (defined MSV_MINIMUM)
00974 extern byte Most_Revision[3];                                           // MOST Transceiver Revision Date: Day, Month, Year
00975 #endif
00976 
00977 
00978 
00979 
00980 
00981 
00982 
00983 
00984 
00985 
00986 /********************************************************************************************************************
00987 
00988                             API FUNCTIONS OF MOST NETSERVICES (BASIC LAYER)
00989 
00990 ********************************************************************************************************************/
00991 
00992 
00993 
00994 
00995 //-----------------------------------------------------------------//
00996 //  API Functions of MOST NetService Kernel (MNS)                  //
00997 //-----------------------------------------------------------------//
00998 
00999 #ifdef MNS_0                                                                // Init all modules of netservices
01000  void  InitNetServices(void);
01001 #endif
01002 
01003 #ifdef MNS_1                                                                // Trigger function for MOST NetServices
01004  word  MostService(word opt, word events);
01005 #endif
01006 
01007 #ifdef MNS_2                                                                // Has to be called one time in 1, 10 or 25ms
01008  void  MostTimerInt(void);                               // (adjustable in adjust.h)
01009 #endif
01010 
01011 #ifdef MNS_4
01012  void  MostTimerIntDiff(TTimerDiff diff);                        // Has to be called with time difference as parameter
01013 #endif
01014 
01015 
01016 #ifdef MNS_3
01017  byte  MostServiceAsync(byte opt, byte events);          // Trigger function for MOST NetServices Async Section
01018 #endif
01019 
01020 #ifdef MNS_41
01021  word  MostGetMinTimeout(void);
01022 #endif
01023 
01024 
01025 
01026 
01027 
01028 //-----------------------------------------------------------------//
01029 //  API Functions of Extended MOST Supervisor                      //
01030 //  and Virtual MOST Supervisor                                    //
01031 //-----------------------------------------------------------------//
01032 
01033 #if (defined MSV_E1) || (defined MSV_V1)                                    // init state machine
01034  void  MostStartUp(byte mode, byte options);
01035 #endif
01036 
01037 #if (defined MSV_E2) || (defined MSV_V2)                                    // set property off_mode
01038  void  MostSetOffMode(byte mode);
01039 #endif
01040 
01041 #if (defined MSV_E3) || (defined MSV_V3)                                    // switch net off
01042  void  MostShutDown( void );
01043 #endif
01044 
01045 #if (defined MSV_E5) || (defined MSV_V5)                                    // zero power request
01046  byte  MostZeroPower(byte mode, byte opt);
01047 #endif
01048 
01049 #if (defined MSV_E14) || (defined MSV_V14)                                  // get current state of MOST Supervisor
01050  byte  MostGetState(void);
01051 #endif
01052 
01053 #if (defined MSV_E17) || (defined MSV_V17)                                  // get current device mode of MOST Supervisor
01054  byte  MostGetDevMode(void);
01055 #endif
01056 
01057 
01058 #if (defined MSV_E21) || (defined MSV_V21)                                  // init state machine
01059  void  MostStartUpExt (pTMsvParam parms);
01060 #endif
01061 
01062 #if (defined MSV_E22) || (defined MSV_V22)                                  // switch net off
01063  byte  MostDiagnosisGetResult(void);
01064 #endif
01065 
01066 #if (defined MSV_E23) || (defined MSV_V23)                                  // get current state of MOST Supervisor
01067  void  MostDiagnosisShutDown(void);
01068 #endif
01069 
01070 
01071 #if (defined MSV_E27) || (defined MSV_V27)                                 // enable/disable counting of Coding Errors
01072  void  MostCountCodingErrors(bool switch_on);
01073 #endif
01074 
01075 #if (defined MSV_E28) || (defined MSV_V28)                                                              // get number of Coding Errors
01076  word  MostGetCodingErrors(void);
01077 #endif
01078 
01079 
01080 //-----------------------------------------------------------------//
01081 //  Additional API Functions of Extended MOST Supervisor           //
01082 //-----------------------------------------------------------------//
01083 
01084 #ifdef MSV_E20
01085  void  MostPASPAccess(void);                             // enable supervision of unlocks after PASP access
01086 #endif
01087 
01088 
01089 //-----------------------------------------------------------------//
01090 //  API Functions of Minimum MOST Supervisor                       //
01091 //-----------------------------------------------------------------//
01092 
01093 #ifdef MSV_M1                                                               // init state machine
01094  void  MostStartUp(byte mode, byte options);
01095 #endif
01096 
01097 #ifdef MSV_M3                                                               // switch net off
01098  void  MostShutDown( void );
01099 #endif
01100 
01101 #ifdef MSV_M14                                                              // get current state of MOST Supervisor
01102  byte  MostGetState(void);
01103 #endif
01104 
01105 #ifdef MSV_M17                                                              // get current device mode of MOST Supervisor
01106  byte  MostGetDevMode(void);
01107 #endif
01108 
01109 
01110 
01111 
01112 
01113 
01114 //-----------------------------------------------------------------//
01115 //  API Functions of Control Message Service (CMS)                 //
01116 //-----------------------------------------------------------------//
01117 
01118 #ifdef CMS_0                                                                // Init the Control Message Service
01119  void  CtrlInit(void);
01120 #endif
01121 
01122 #ifdef CMS_T1                                                               // Get pointer to free tx buffer line
01123  struct Ctrl_Tx_Type*  CtrlGetTxPtr(void);
01124 #endif
01125 
01126 #ifdef CMS_T2                                                               // Mark buffer line as ready to send
01127  void  CtrlSend(struct Ctrl_Tx_Type *ptbuf);
01128 #endif
01129 
01130 #ifdef CMS_T3                                                               // Retry Tx Message
01131  void  CtrlTxRetry(void);
01132 #endif
01133 
01134 #ifdef CMS_T4                                                               // Cancel current job
01135  void  CtrlFreeTxMsg(void);
01136 #endif
01137 
01138 #ifdef CMS_T8                                                               // Transmit Ctrl Message (Single Call)
01139  byte  CtrlTransmit(byte priority, byte type, word tgt_adr, byte *ptbuf, byte length);
01140 #endif
01141 
01142 #ifdef CMS_T9                                                               // Get the number of free tx buffer lines
01143  byte  CtrlCheckTxBuffer(void);
01144 #endif
01145 
01146 #ifdef CMS_T10                                                              // Set the priority for xmit control message
01147  byte  CtrlSetTransPriority(byte priority);
01148 #endif
01149 
01150 #ifdef CMS_T11                                                              // Set the time between transmisson retries
01151  byte  CtrlSetTransTime(byte time);
01152 #endif
01153 
01154 #ifdef CMS_T12                                                              // Set the total transmission attempts
01155  byte  CtrlSetTransRetry(byte retry);
01156 #endif
01157 
01158 #ifdef CMS_T13                                                              // Get low level retry time
01159  byte  CtrlGetTransTime(void);
01160 #endif
01161 
01162 #ifdef CMS_T14                                                              // Get number of low level retries
01163  byte  CtrlGetTransRetry(void);
01164 #endif
01165 
01166 
01167 #ifdef CMS_T15                                                              // Set the time between short transmisson retries (OS8104A)
01168  byte  CtrlSetTransShortTime(byte short_time);
01169 #endif
01170 
01171 #ifdef CMS_T16                                                              // Set the number of long transmission attempts (OS8104A)
01172  byte  CtrlSetTransLongRetry(byte long_retry);
01173 #endif
01174 
01175 #ifdef CMS_T17                                                              // Get low level short retry time (OS8104A)
01176  byte  CtrlGetTransShortTime(void);
01177 #endif
01178 
01179 #ifdef CMS_T18                                                              // Get number of low level long retries (OS8104A)
01180  byte  CtrlGetTransLongRetry(void);
01181 #endif
01182 
01183 
01184 
01185 #ifdef CMS_R1                                                               // Get number to stored rx messages
01186  byte  CtrlGetMsgCnt(void);
01187 #endif
01188 
01189 #ifdef CMS_R2                                                               // Get pointer to next rx message
01190  struct Ctrl_Rx_Type*  CtrlGetRxPtr(void);
01191 #endif
01192 
01193 #ifdef CMS_R3                                                               // Free rx buffer line
01194  void  CtrlFreeRxMsg(struct Ctrl_Rx_Type *prbuf);
01195 #endif
01196 
01197 #ifdef CMS_R4                                                               // get rx message from rx buffer
01198  byte  CtrlReceive(struct Ctrl_Rx_Type *prbuf);
01199 #endif
01200 
01201 #ifdef CMS_R30
01202  pTCtrlRx  CtrlGetRxInPtr(void);
01203 #endif
01204 
01205 #ifdef CMS_R32
01206  void  CtrlRxInReady(pTCtrlRx rx_ptr);
01207 #endif
01208 
01209 
01210 
01211 
01212 //-----------------------------------------------------------------//
01213 //  API Functions of Application Message Service (AMS)             //
01214 //-----------------------------------------------------------------//
01215 
01216 #ifdef AMS_0                                                                // Inits Application Message Service
01217  void  MsgInit(void);
01218 #endif
01219 
01220 
01221 #ifdef AMS_T1                                                               // Get ptr at next tx buffer entry
01222  struct Msg_Tx_Type*  MsgGetTxPtr(void);
01223 #endif
01224 
01225 #ifdef AMS_T13                                                              // Get ptr at reserved tx buffer entry
01226  struct Msg_Tx_Type*  MsgGetTxPtrRes(void);
01227 #endif
01228 
01229 
01230 #ifdef AMS_T2                                                               // Get number of free tx buffer lines
01231  byte  MsgCheckTxBuffer(void);
01232 #endif
01233 
01234 #ifdef AMS_T3                                                               // Mark buffer line as ready to send
01235  void  MsgSend(struct Msg_Tx_Type *ptbuf);
01236 #endif
01237                                                                             // Send a Message after address was verified
01238 #ifdef AMS_T14                                                              // (called by AMS and AH)
01239  void  MsgSend2(struct Msg_Tx_Type *ptbuf);
01240 #endif
01241 
01242 
01243 #ifdef AMS_T4                                                               // abort failed transmission
01244  void  MsgFreeTxMsg(void);
01245 #endif
01246 
01247 #ifdef AMS_T9                                                               // retry failed transmission
01248  void  MsgTxRetry(void);
01249 #endif
01250 
01251 #ifdef AMS_T12                                                              // Free unused buffer line
01252  void  MsgTxUnused(struct Msg_Tx_Type *Tx_Ptr);
01253 #endif
01254 
01255 #ifdef AMS_T20                                                              // Encoding type byte
01256  void  MsgTxDataByte(byte **pptr_tgt, byte *ptr_src);
01257 #endif
01258 
01259 #ifdef AMS_T21                                                              // Encoding type word
01260  void  MsgTxDataWord(byte **pptr_tgt, word *ptr_src);
01261 #endif
01262 
01263 #ifdef AMS_T22                                                              // Encoding type dword
01264  void  MsgTxDataLong(byte **pptr_tgt, dword *ptr_src);
01265 #endif
01266 
01267 #ifdef AMS_T23                                                              // Encoding BCD coded number
01268  void  MsgTxBcdToAscII(byte** pptr_tgt, byte number);
01269 #endif
01270 
01271 #ifdef AMS_T40
01272  void  MsgTxPostpone(void);
01273 #endif
01274 
01275 #ifdef AMS_T50
01276  byte  MsgTransmit(pTMostHeader pHeader, byte* pData , pTMsgTxOpt pOptions);
01277 #endif
01278 
01279 
01280 
01281 #ifdef AMS_R3                                                               // Get number to stored rx messages
01282  byte  MsgGetMsgCnt(void);
01283 #endif
01284 
01285 #ifdef AMS_R4                                                               // Get pointer to next rx message
01286  struct Msg_Rx_Type*  MsgGetRxPtr(void);
01287 #endif
01288 
01289 #ifdef AMS_R5                                                               // Free rx buffer line
01290  void  MsgFreeRxMsg(struct Msg_Rx_Type *prbuf);
01291 #endif
01292 
01293 #ifdef AMS_R6                                                               // get rx message from rx buffer
01294  byte  MsgReceive(struct Msg_Rx_Type *prbuf);
01295 #endif
01296 
01297 #ifdef AMS_R13
01298  word  MsgCheckRxBuffer(void);                           // get number of free RX buffers
01299 #endif
01300 
01301 
01302 #ifdef AMS_R20                                                              // Decoding type byte
01303  void  MsgRxDataByte(byte *ptr_tgt, byte **pptr_src);
01304 #endif
01305 
01306 #ifdef AMS_R21                                                              // Decoding type word
01307  void  MsgRxDataWord(word *ptr_tgt, byte **pptr_src);
01308 #endif
01309 
01310 #ifdef AMS_R22                                                              // Decoding type dword
01311  void  MsgRxDataLong(dword *ptr_tgt, byte **pptr_src);
01312 #endif
01313 
01314 
01315 
01316 #ifdef AMS_R30
01317  struct Msg_Rx_Type*  MsgGetRxInPtr(void);
01318 #endif
01319 
01320 #ifdef AMS_R32
01321  void  MsgRxInReady(struct Msg_Rx_Type *rx_in_ptr);
01322 #endif
01323 
01324 
01325 #ifdef AMS_R41
01326  byte  MsgRxAssemble(pTMsgRx rx_ptr, byte* pdata, word size);
01327 #endif
01328 
01329 #ifdef AMS_R42
01330  byte  MsgRxAssembleExt(pTMsgRx rx_ptr, byte* pData, word size_data,
01331                                            pTMostHeader pHeader, pTMsgRxOpt pOptions);
01332 #endif
01333 
01334 #ifdef AMS_R43                                                               
01335  void  MsgRxQuitMsg(void);
01336 #endif
01337 
01338 
01339 
01340 //-----------------------------------------------------------------//
01341 //  API Functions of Remote Control Service (RCS)                  //
01342 //-----------------------------------------------------------------//
01343 #ifdef RCS_0                                                                // Inits the Remote Control Service
01344  void  RemoteInit(void);
01345 #endif
01346 
01347 #ifdef RCS_1                                                                // Send a remote write system message
01348  byte  RemoteWrite(word tgt_adr, byte map, byte *ptbuf, byte num_bytes);
01349 #endif
01350 
01351 #ifdef RCS_2                                                                // Send a remote read system message
01352  byte  RemoteRead(word tgt_adr, byte map, byte num_bytes, byte *prbuf);
01353 #endif
01354 
01355 
01356 
01357 
01358 //-----------------------------------------------------------------//
01359 //  API Functions of Synchronous Channel Allocation Service (SCS)  //
01360 //-----------------------------------------------------------------//
01361 
01362 #ifdef SCS_0
01363  void  SyncInit(void);
01364 #endif
01365 
01366 #ifdef SCS_A1                                                               // Allocating only
01367  byte  SyncAllocOnly(byte num_channels, byte *prbuf);
01368 #endif
01369 
01370 #ifdef SCS_A5                                                               // Allocating and Connecting
01371  byte  SyncAlloc(byte num_channels, byte *prbuf, struct SrcData_Type *ptrsrc);
01372 #endif
01373 
01374 #ifdef SCS_A7                                                               // Enable Source Data Input Ports (OS8104A)
01375  byte  SyncSourcePortEnable(void);
01376 #endif
01377 
01378 #ifdef SCS_A8                                                               // Disable Source Data Input Ports (OS8104A)
01379  byte  SyncSourcePortDisable(void);
01380 #endif
01381 
01382 #ifdef SCS_D1                                                               // Deallocating only
01383  byte  SyncDeallocOnly(byte label);
01384 #endif
01385 
01386 #ifdef SCS_D3                                                               // Deallocating and Disconnecting
01387  byte  SyncDealloc(byte num_channels, byte *ptrch);
01388 #endif
01389 
01390 #ifdef SCS_G1                                                               // looking for source
01391  byte  SyncGetSource(byte channel);
01392 #endif
01393 
01394 #ifdef SCS_R2                                                               // Connecting (Source)
01395  void  SyncInConnect(byte num_channels, byte *ptrch, struct SrcData_Type *ptrsrc);
01396 #endif
01397 
01398 #ifdef SCS_R3                                                               // Disconnecting (Source)
01399  void  SyncInDisconnect(byte num_channels, byte *ptrch);
01400 #endif
01401 
01402 #ifdef SCS_R5                                                               // Connecting (Sink)
01403  void  SyncOutConnect(byte num_channels, byte *ptrch, struct SrcData_Type *ptrsrc);
01404 #endif
01405 
01406 #ifdef SCS_R6                                                               // Disconnecting (Sink)
01407  void  SyncOutDisconnect(byte num_channels, struct SrcData_Type *ptrsrc);
01408 #endif
01409 
01410 #ifdef SCS_R7                                                               // Detects channels by label
01411  byte  SyncFindChannels(byte num_channels, byte label, byte *pchrbuf);
01412 #endif
01413 
01414 #ifdef SCS_R8                                                               // Mute (Source)
01415  void  SyncInMute(byte num_channels, byte *ptrch);
01416 #endif
01417 
01418 #ifdef SCS_R9                                                               // Mute all Source Data Input Ports
01419  byte  SyncInMuteAll(void);
01420 #endif
01421 
01422 #ifdef SCS_R10                                                               // Demute all Source Data Input Ports
01423  byte  SyncInDemuteAll(void);
01424 #endif
01425 
01426 //-----------------------------------------------------------------//
01427 //  API Functions of Transparent Channel Allocation Service        //
01428 //-----------------------------------------------------------------//
01429 
01430 #ifdef TCS_0                                                                // Init the Transp. Channel Allocation Service
01431  void  TransInit(void);
01432 #endif
01433 
01434 #ifdef TCS_1                                                                // Enables/Disables transparent mode
01435  void  TransEnable(byte mode);
01436 #endif
01437 
01438 
01439 #ifdef TCS_A1                                                               // Allocating only
01440  byte  TransAllocOnly(byte num_channels, byte *ptrch);
01441 #endif
01442 
01443 #ifdef TCS_A5                                                               // Allocating and Connecting
01444  byte  TransAlloc(byte num_channels, byte *ptrch, byte *ptrsrc);
01445 #endif
01446 
01447 
01448 #ifdef TCS_D1                                                               // Deallocating only
01449  byte  TransDeallocOnly(byte label);
01450 #endif
01451 
01452 #ifdef TCS_D3                                                               // Deallocating and Disconnecting
01453  byte  TransDealloc(byte num_channels, byte *ptrch);
01454 #endif
01455 
01456 
01457 #ifdef TCS_R2                                                               // Connecting (Source)
01458  void  TransInConnect(byte num_channels, byte *ptrch, byte *ptrsrc);
01459 #endif
01460 
01461 #ifdef TCS_R3                                                               // Disconnecting (Source)
01462  void  TransInDisconnect(byte num_channels, byte *ptrch);
01463 #endif
01464 
01465 
01466 #ifdef TCS_R5                                                               // Connecting (Sink)
01467  void  TransOutConnect(byte num_channels, byte *ptrch, byte *ptrsrc);
01468 #endif
01469 
01470 #ifdef TCS_R6                                                               // Disconnecting (Sink)
01471  void  TransOutDisconnect(byte num_channels, byte *ptrsrc);
01472 #endif
01473 
01474 
01475 //-----------------------------------------------------------------//
01476 //  API Functions of Async Data Transmission Service               //
01477 //-----------------------------------------------------------------//
01478 
01479 #ifdef ADS_0                                                                // Init the Async Data Transmission Service
01480  void  DataInit(void);
01481 #endif
01482 
01483 
01484 #ifdef ADS_T1                                                               // Get pointer on free tx buffer line
01485  struct Data_Tx_Type*  DataGetTxPtr(void);
01486 #endif
01487 
01488 #ifdef ADS_T2                                                               // Mark buffer line as ready to send
01489  void  DataSend(struct Data_Tx_Type *ptbuf);
01490 #endif
01491 
01492 #ifdef ADS_T8                                                               // Transmit data packet (Single Call)
01493  byte  DataTransmit(byte priority, word tgt_adr, byte *ptbuf, byte length);
01494 #endif
01495 
01496 #ifdef ADS_T9                                                               // Get the number of free tx buffer lines
01497  byte  DataCheckTxBuffer(void);
01498 #endif
01499 
01500 #ifdef ADS_T10                                                              // Set the default priority
01501  byte  DataSetTransPriority(byte priority);
01502 #endif
01503 
01504 
01505 #ifdef ADS_R1                                                               // Get number of stored rx packets
01506  byte  DataGetMsgCnt(void);
01507 #endif
01508 
01509 #ifdef ADS_R2                                                               // Get pointer on next rx packet
01510  struct Data_Rx_Type*  DataGetRxPtr(void);
01511 #endif
01512 
01513 #ifdef ADS_R3                                                               // Free rx buffer line
01514  void  DataFreeRxMsg(struct Data_Rx_Type *prbuf);
01515 #endif
01516 
01517 #ifdef ADS_R4                                                               // get packet from rx buffer
01518  byte  DataReceive(struct Data_Rx_Type *prbuf);
01519 #endif
01520 
01521 
01522 
01523 //-----------------------------------------------------------------//
01524 //  API Functions of MOST Transceiver Control Service (MCS)        //
01525 //-----------------------------------------------------------------//
01526 
01527 #ifdef MCS_0                                                                // Init Most Transceiver Control Service
01528  void  MostInit(void);
01529 #endif
01530 
01531 #ifdef MCS_1                                                                // Enable MOST Interrupts
01532  void  MostEnableInt(byte interrupts);
01533 #endif
01534 
01535 #ifdef MCS_2                                                                // Disable MOST Interrupts
01536  void  MostDisableInt(byte interrupts);
01537 #endif
01538 
01539 #ifdef MCS_3                                                                // Set the node address
01540  void  MostSetNodeAdr(word adr);
01541 #endif
01542 
01543 #ifdef MCS_4                                                                // Set the group address
01544  void  MostSetGroupAdr(byte group_adr);
01545 #endif
01546 
01547 #ifdef MCS_5                                                                // Select RMCK frequency
01548  void  MostSelectClockOutput(byte rmck_divide);
01549 #endif
01550 
01551 #ifdef MCS_6                                                                // Mute source data outputs
01552  void  MostMute(void);
01553 #endif
01554 
01555 #ifdef MCS_7                                                                // Demute source data outputs
01556  void  MostDemute(void);
01557 #endif
01558 
01559 #ifdef MCS_8                                                                // Read the current node position
01560  byte  MostGetNodePos(void);
01561 #endif
01562 
01563 #ifdef MCS_9                                                                // Read MOST Transceiver Revision (Bcd coded)
01564  void  MostGetRevision(byte* tgt_ptr);
01565 #endif
01566 
01567 #ifdef MCS_10                                                               // Read Node Delay Register
01568  byte  MostGetNodeDelay(void);
01569 #endif
01570 
01571 #ifdef MCS_11                                                               // Read Maximum Delay Register
01572  byte  MostGetMaxDelay(void);
01573 #endif
01574 
01575 #ifdef MCS_12                                                               // Read Maximum Position Register
01576  byte  MostGetMaxPos(void);
01577 #endif
01578 
01579 #ifdef MCS_13                                                               // Set alternative packet address
01580  void  MostSetAltPAdr(word adr);
01581 #endif
01582 
01583 #ifdef MCS_21                                                               // Prepare error message in a secondary node
01584  void  MostSecNodePrepErr(void);
01585 #endif
01586 
01587 #if (defined MCS_30) || (defined MCS_40)
01588  short  MostWriteReg(word handle, byte page, byte map, byte num, byte* pdata);
01589 #endif
01590 
01591 #if (defined MCS_31) || (defined MCS_41)
01592  short  MostReadReg(word handle, byte page, byte map, byte num);
01593 #endif
01594 
01595 #if (defined MCS_32) || (defined MCS_42)
01596  short  MostWriteRegBit(word handle, byte cmd, byte map, byte bitmask);
01597 #endif
01598 
01599 #if (defined MCS_33) || (defined MCS_43)
01600  short  MostWriteRegBitfield(word handle, byte page, byte map, byte mask, byte bitfield);
01601 #endif
01602 
01603 #ifdef MCS_50
01604  short  MostFindChannels(byte num_channels, byte label);
01605 #endif
01606 
01607 
01608 
01609 
01610 // functions only available in a Master device
01611 //----------------------------------------------
01612 #ifdef MCS_M1                                                               // Select the PLL input
01613  void  MostSelectClockInput(byte pll_in);
01614 #endif
01615 
01616 #ifdef MCS_M2                                                               // Set the synchronous bandwith
01617  byte  MostSetBoundary(byte sync_quad);
01618 #endif
01619 
01620 
01621 
01622 
01623 
01624 
01625 /********************************************************************************************************************
01626 
01627                             CALLBACK FUNCTIONS OF MOST NETSERVICES (BASIC LAYER)
01628 
01629 ********************************************************************************************************************/
01630 
01631 
01632 
01633 //-----------------------------------------------------------------//
01634 // Callback Functions of MOST NetServices Kernel (MNS)             //
01635 // Can be an empty function block if the application has not to    //
01636 // react to this calls.                                            //
01637 //-----------------------------------------------------------------//
01638 #ifdef MNS_CB1
01639 void MnsRequest(word flags);
01640 #endif
01641 
01642 #ifdef MNS_CB2
01643 void MnsRequestAsync(byte flags);
01644 #endif
01645 
01646 #ifdef MNS_CB3
01647 void MnsRequestTimer(void);
01648 #endif
01649 
01650 #ifdef MNS_CB4
01651 void MnsRequestAsyncTimer(void);
01652 #endif
01653 
01654 #ifdef MNS_CB10
01655 void MnsPrintDbgMsg(pTMnsDbgMsg pmsg);
01656 #endif
01657 
01658 
01659 
01660 
01661 
01662 
01663 
01664 //-----------------------------------------------------------------//
01665 // Callback Functions of Extended MOST Supervisor                  //
01666 // Can be an empty function block if the application has not to    //
01667 // react to this calls.                                            //
01668 //-----------------------------------------------------------------//
01669 #if (defined MSV_EXTENDED) || (defined MSV_VIRTUAL)
01670 void Go_Confirm_S(void);                                                // called by transition to Confirm_Slave state
01671 void Go_Confirm_M(void);                                                // called by transition to Confirm_Master state
01672 void Go_Net_On(void);                                                   // called by transition to On state
01673 void Go_Net_Off(void);                                                  // called by transition to Off state
01674 void Go_Virtual_Zero(void);                                             // called by transition to virtual zero power state
01675 void Go_Zero_Power(void);                                               //
01676 void Go_Start(void);                                                    // called by restart after virtual zero-power
01677 void MostMprChanged(byte new_mpr, byte mpr_old);                        // called if MPR register has changed
01678 void MostMprChangedDelayed(byte new_mpr, byte mpr_old);                 // called if MPR register has changed and MPR is valid
01679 
01680 
01681 void MostUnlock(void);                                                  // called on temporary unlock
01682 void MostUnlockCritical(void);                                          // called on critical unlock
01683 void MostLock(void);                                                    // called whenever lock gained after unlock
01684 void MostLockStable(void);                                              // called after stable lock gained
01685 void Store_Error_Info(byte);                                            // called to send an error info
01686 void Store_Diag_Info(byte);                                             // called to send the diagnosis info
01687 void MostUpdateNpr(byte npr);                                           // only available, if MSV_ADD2 is defined
01688 void MostUpdateMostRevision(byte* pMostRev);                            // only available, if MSV_ADD2 is defined
01689 void MostInfoReset(void);                                               // only available, if MSV_ADD5 is defined
01690 #ifdef MSV_CB28
01691 void MostCodingError(void);
01692 #endif
01693 
01694 
01695 #endif  // (defined MSV_EXTENDED) || (defined MSV_VIRTUAL)
01696 
01697 
01698 //-----------------------------------------------------------------//
01699 // Callback Functions of Extended MOST Supervisor                  //
01700 // These functions MUST work along the discription since needed    //
01701 // by this Service.                                                //
01702 //-----------------------------------------------------------------//
01703 #ifdef MSV_EXTENDED
01704 byte Most_Por_Int(void);                                                // Get POR-Int Pin
01705 void Most_Reset(void);                                                  // Reset MOST Transceiver
01706 #endif
01707 
01708 
01709 //-----------------------------------------------------------------//
01710 // Callback Functions of Minimum MOST Supervisor                   //
01711 // Can be an empty function block if the application has not to    //
01712 // react to this calls.                                            //
01713 //-----------------------------------------------------------------//
01714 #ifdef MSV_MINIMUM
01715 void Go_Net_On(void);                                                   // called by transition to On state
01716 void Go_Net_Off(void);                                                  // called by transition to Off state
01717 void MostInfoReset(void);                                               // only available, if MSV_ADD5 is defined
01718 #endif
01719 
01720 
01721 //-----------------------------------------------------------------//
01722 // Callback Functions of Minimum MOST Supervisor                   //
01723 // These functions MUST work along the discription since needed    //
01724 // by this Service.                                                //
01725 //-----------------------------------------------------------------//
01726 #ifdef MSV_MINIMUM
01727 byte Most_Por_Int(void);                                                // Get POR-Int Pin
01728 void Most_Reset(void);                                                  // Reset MOST Transceiver
01729 #endif
01730 
01731 
01732 
01733 //-----------------------------------------------------------------//
01734 // Callback Functions of Event Combiner                            //
01735 // Can be an empty function block if the application has not to    //
01736 // react to this calls.                                            //
01737 //-----------------------------------------------------------------//
01738 #ifdef MSVAL_CB1
01739 void MsvalStateChanged(byte state);
01740 #endif
01741 
01742 #ifdef MSVAL_CB2
01743 void MsvalLockChanged(byte lock_state);
01744 #endif
01745 
01746 #ifdef MSVAL_CB3
01747 void MsvalEvent(byte event, byte *info);
01748 #endif
01749 
01750 #ifdef MSVAL_CB4
01751 void MsvalError(byte error, byte *info);
01752 #endif
01753 
01754 #ifdef MSVAL_CB5
01755 void MsvalDiagResult(byte diag_result, byte *info);
01756 #endif
01757 
01758 
01759 
01760 
01761 //-----------------------------------------------------------------//
01762 // Callback Functions of Control Message Service (CMS)             //
01763 // Can be an empty function block if the application has not to    //
01764 // react to this calls.                                            //
01765 //-----------------------------------------------------------------//
01766 #ifdef CMS_CB2
01767 void CtrlGetExtData(struct Ctrl_Rx_Type *prbuf);                        // application can attach extended bytes
01768 #endif                                                                  // on every received message (timestamp,...),
01769                                                                         // but take care that MAX_EXT_DATA is defined
01770                                                                         // as great as you need
01771 
01772 
01773 
01774 
01775 //-----------------------------------------------------------------//
01776 // Callback Functions of Control Message Service (CMS)             //
01777 // These functions MUST work along the discription since needed    //
01778 // by this Service.                                                //
01779 //-----------------------------------------------------------------//
01780 #ifdef CMS_CB1
01781 void CtrlTxStatus(byte Status, struct Ctrl_Tx_Type *ptbuf);             // Function will be called, if a transmission
01782 #endif                                                                  // failed
01783                                                                         // The application HAS to react on this event
01784                                                                         // by deleting or retrieing the last transmission
01785 
01786 #ifdef CMS_CB3
01787 byte CtrlRxOutMsg(struct Ctrl_Rx_Type *prbuf);                          // function is called whenever a message was received
01788 #endif                                                                  // and CMS output is selected
01789                                                                         // possible return values:
01790                                                                         //      0x00 = using polling and/or copy method
01791                                                                         //      0x01 = acknowledge (pointer grabbed)
01792                                                                         //      0x02 = force a retrigger
01793 
01794 #ifdef CMS_CB4
01795 byte CtrlRxFilter(struct Ctrl_Rx_Type *prbuf);                          // function is called whenever a message was received
01796 #endif                                                                  // and this optional rx filter is enabled
01797                                                                         // possible return values:
01798                                                                         //      0x00 = default output (AMS if available / or CMS)
01799                                                                         //      0x01 = telegram is passed to a further service;
01800                                                                         //             buffer entry can be cleared
01801                                                                         //      0x02 = telegram will be passed to a further service;
01802                                                                         //             buffer entry cannot be cleared, since service busy
01803                                                                         //      0x03 = CMS output is forced, although AMS is available
01804 
01805 
01806 #ifdef CMS_CB5                                                          // function is called, before transmission of a CMS telegram.
01807 byte CtrlTxFilter(struct Ctrl_Tx_Type *ptbuf);                          // In this callback function the application can monitor, modify
01808 #endif                                                                  // or dispatch the outgoing telegram.
01809                                                                         // Possible return values:
01810                                                                         //      0x00 = Tx message was checked and was modified if required.
01811                                                                         //             The message is send in an ordinary way
01812                                                                         //      0x01 = Tx message will be processed by another service.
01813                                                                         //             The CMS buffer entry is cleared after returning from
01814                                                                         //             callback function.
01815                                                                         //      0x02 = Tx message will be processed by another service,
01816                                                                         //             but the service is busy at that time. The entry
01817                                                                         //             is not cleared. The callback function will be re-called.
01818 
01819 
01820 
01821 
01822 
01823 //-----------------------------------------------------------------//
01824 // Callback Functions of Application Message Service (AMS)         //
01825 // Can be an empty function block if the application has not to    //
01826 // react to this calls.                                            //
01827 //-----------------------------------------------------------------//
01828 #ifdef AMS_CB3
01829 void MsgRxError(byte Error_ID, void *prbuf);                            // error appeared while receiving a telegram;
01830 #endif                                                                  // rx buffers are cleared automatically
01831 
01832 
01833 
01834 
01835 
01836 
01837 
01838 
01839 //-----------------------------------------------------------------//
01840 // Callback Functions of Application Message Service (AMS)         //
01841 // These functions MUST work along the discription since needed    //
01842 // by this Service.                                                //
01843 //-----------------------------------------------------------------//
01844 #ifdef AMS_CB1
01845 void MsgTxStatus(byte Status, struct Msg_Tx_Type *ptbuf);               // Message successfully transmitted
01846 #endif                                                                  // or transmission of last telegram failed.
01847                                                                         // If any error occurred, there are two
01848                                                                         // possible ways to react:
01849                                                                         //      a) deleting the message
01850                                                                         //      b) retry transmission
01851 
01852 #ifdef AMS_CB2
01853 byte MsgRxOutMsg(struct Msg_Rx_Type *prbuf);                            // function is called when a message was received
01854 #endif                                                                  // by Application Message Service
01855                                                                         // possible return value:
01856                                                                         //      0x00 = using polling and/or copy method
01857                                                                         //      0x01 = acknowledge (pointer grabbed)
01858                                                                         //      0x02 = force a retrigger
01859 
01860 
01861 #ifdef AMS_CB4                                                          // function is called, whenever the application
01862 void MsgTxRefill(struct Msg_Tx_Type *tx_ptr, word partition_cnt);       // must refill the data fields after last partition
01863 #endif                                                                  // was transmitted
01864 
01865 
01866 #ifdef AMS_CB5                                                          // function is called, before transmission of a AMS message.
01867 byte MsgTxFilter(struct Msg_Tx_Type *tx_ptr);                           // In this callback function the application can monitor, modify
01868 #endif                                                                  // or dispatch the outgoing message.
01869                                                                         // Possible return values:
01870                                                                         //      0x00 = Tx message was checked and was modified if required.
01871                                                                         //             The message is send in an ordinary way
01872                                                                         //      0x01 = Tx message will be processed by another service.
01873                                                                         //             The AMS buffer entry is cleared after returning from
01874                                                                         //             callback function.
01875                                                                         //      0x02 = Tx message will be processed by another service,
01876                                                                         //             but the service is busy at that time. The entry
01877                                                                         //             is not cleared. The callback function will be re-called.
01878 
01879 #ifdef AMS_CB6
01880 bool MsgTxBypassFilter(struct Msg_Tx_Type *ptbuf);                      // function is called, when calling MsgSend().
01881 #endif                                                                  // The application has the possibility to bypass certain messages
01882                                                                         // directly to the CMS TX service.
01883                                                                         // Possible return values:
01884                                                                         //      TRUE  = bypass application message to CMS TX service
01885                                                                         //      FALSE = message has to be send via AMS TX service
01886 
01887 
01888 #ifdef AMS_CB7
01889 pTMsgRxExtBuf MsgRxAllocBuf(pTMsgRx rx_ptr);                            // Function to allocate a receive buffer extension
01890 #endif
01891 
01892 #ifdef AMS_CB8
01893 void MsgRxDeallocBuf(pTMsgRxExtBuf ptr);                                // Function to deallocate a receive buffer extension and respective data field
01894 #endif
01895 
01896 
01897 
01898 
01899 //-----------------------------------------------------------------//
01900 // Callback Functions of Remote Control Service (RCS)              //
01901 // These functions MUST work along the discription since needed    //
01902 // by this Service.                                                //
01903 //-----------------------------------------------------------------//
01904 #ifdef RCS_CB1
01905 void  RemoteWriteComplete(byte XmitStatus,struct Ctrl_Tx_Type *ptrbuf);
01906 #endif
01907 
01908 #ifdef RCS_CB2
01909 void RemoteReadComplete(byte XmitStatus, struct Ctrl_Tx_Type *ptrbuf);
01910 #endif
01911 
01912 
01913 
01914 
01915 //-----------------------------------------------------------------//
01916 // Callback Functions of Synchronous Channel Alloc. Service (SCS)  //
01917 // These functions MUST work along the discription since needed    //
01918 // by this Service.                                                //
01919 //-----------------------------------------------------------------//
01920 #ifdef SCS_CB1
01921 void SyncAllocComplete(byte Status, byte Num_Channels_Req, byte Num_Channels_Free);     // is called when allocation procedure
01922 #endif                                                                                  // has been finished (bad or ok)
01923 
01924 #ifdef SCS_CB2
01925 void SyncDeallocComplete(byte Status, byte Label);                                      // is called when de-allocation procedure
01926 #endif                                                                                  // has been finished (bad or ok)
01927 
01928 #ifdef SCS_CB3
01929 void SyncGetSourceComplete(byte status, byte channel, byte node_pos, byte group_adr, word node_adr);    // is called when get source procedure
01930 #endif                                                                                              // has been finished (bad or ok)
01931 
01932 #ifdef SCS_CB4
01933 void SyncMoveBoundaryComplete(byte status, byte boundary);                              // is called when boundary change is complete
01934 #endif                                                                                              
01935 
01936 
01937 //-----------------------------------------------------------------//
01938 // Callback Functions of Async. Data Transmission Service (ADS)    //
01939 // These functions MUST work along the discription since needed    //
01940 // by this Service.                                                //
01941 //-----------------------------------------------------------------//
01942 
01943 #ifdef ADS_CB1
01944 byte DataRxOutMsg(struct Data_Rx_Type *prbuf);                          // function is called when a packet was received
01945 #endif                                                                  // possible return value:
01946                                                                         //      0x00 = using polling and/or copy method
01947                                                                         //      0x01 = acknowledge (pointer grabbed)
01948                                                                         //      0x02 = force a retrigger
01949 
01950 
01951 
01952 #ifdef ADS_CB2
01953 bool DataGetInt(void);                                                  // Polling of AsyncInterrupt Pin (/AINT)
01954 #endif                                                                  // or polling of Bit4 in the Control Port Status Register (bCP)
01955                                                                         // Application has to return TRUE, whenever status of pin /AINT
01956                                                                         // is low. If the signal is not available, since the pin is not
01957                                                                         // connected to your uC, Bit4 of bCP can be returned.
01958                                                                         // Whenever this functions returns TRUE, register bPCTC will be
01959                                                                         // read to check what kind of interrupt occurred.
01960 
01961 #ifdef ADS_CB3
01962 void DataTxComplete(struct Data_Tx_Type *ptbuf);                        // Function will be called, whenever a packet
01963 #endif                                                                  // was transmitted
01964 
01965 
01966 #ifdef ADS_CB4
01967 byte DataRxFilter(struct Data_Rx_Type *rx_ptr);                         // external rx filter to check kind of protocol
01968 #endif
01969 
01970 #ifdef ADS_CB5
01971 void DataRxError(byte error);                                           // notify captured error events
01972 #endif
01973 
01974 
01975 
01976 
01977 //-----------------------------------------------------------------//
01978 // Callback Functions of MOST Transceiver Control Service (MCS)    //
01979 // Can be an empty function block if the application has not to    //
01980 // react to this calls.                                            //
01981 //-----------------------------------------------------------------//
01982 
01983 #if (defined MCS_CB30) || (defined MCS_CB40)
01984 void MostWriteRegComplete(pTMnsCtrl pinfo);
01985 #endif
01986 
01987 #if (defined MCS_CB31) || (defined MCS_CB41)
01988 void MostReadRegComplete(pTMnsCtrl pinfo);
01989 #endif
01990 
01991 #if (defined MCS_CB32) || (defined MCS_CB42)
01992 void MostWriteRegBitComplete(pTMnsCtrl pinfo);
01993 #endif
01994 
01995 #if (defined MCS_CB33) || (defined MCS_CB43)
01996 void MostWriteRegBitfieldComplete(pTMnsCtrl pinfo);
01997 #endif
01998 
01999 #ifdef MCS_CB50
02000 void MostFindChannelsResult(byte num_channels, byte* ptr_result);
02001 #endif
02002 
02003 
02004 
02005 
02006 
02007 
02008 
02009 
02010 
02011 
02012 
02013 
02014 
02015 /********************************************************************************************************************
02016 
02017                             THE FOLLOWING FUNCTIONS OF LAYER II ARE CALLED BY LAYER I
02018 
02019 ********************************************************************************************************************/
02020 
02021 
02022 //-----------------------------------------------------------------//
02023 //  Functions of Address Handler Module (AH)                       //
02024 //-----------------------------------------------------------------//
02025 
02026 #ifdef NS_AMS_AH
02027 void AddrHSearchStart(struct Msg_Tx_Type *ptbuf);                       // Starts searching process, called by AMS
02028 #endif                                                                  //   - Search in decentral registry (if avail.)
02029                                                                         //   - Search in central registry (if avail.)
02030                                                                         //   - Search using property NetBlock.FBlockIDs
02031 
02032 
02033 
02034 //-----------------------------------------------------------------//
02035 //  Functions of MOST NetService Kernel Layer II                   //
02036 //-----------------------------------------------------------------//
02037 
02038 #ifdef NS_MNS_MNS2
02039 void MostTimerInt2(void);                                               // called by MNS
02040 void MostTimerInt2Diff(TTimerDiff diff);                                        // called by MNS
02041 #endif
02042 
02043 
02044 
02045 
02046 //-----------------------------------------------------------------//
02047 //  Functions of NetBlock Module (NB)                              //
02048 //-----------------------------------------------------------------//
02049 
02050 #ifdef NS_SCS_NB
02051 void NbSyncFinalAlloc(byte handle);                                     // Called by SCS
02052 #endif
02053 
02054 #ifdef NS_SCS_NB
02055 void NbSyncFinalDealloc(byte handle);                                   // Called by SCS
02056 #endif
02057 
02058 #ifdef NS_SCS_NB
02059 void NbSyncMoveBoundaryComplete(byte status, byte boundary);            // Called by SCS
02060 #endif
02061 
02062 #ifdef NS_MSV_NB
02063 void NbRefreshNodePos(void);                                            // Called by MSV
02064 #endif
02065 
02066 #ifdef NS_MSV_NB
02067 void NbGoNetOff(void);                                                  // Called by MSV
02068 #endif
02069 
02070 
02071 #ifdef __cplusplus
02072 }
02073 #endif
02074 
02075 
02076 
02077 
02078 #endif // _MOSTNS1_H

Generated on Fri Mar 9 14:48:59 2007 for MOST Adaption Layer for Netservices Library by  doxygen 1.5.0