tte_clock_sync.h

Go to the documentation of this file.
00001 /* -*- coding: iso-8859-1 -*-
00002  * Copyright (C) 2008 TTTech Computertechnik AG
00003  * ****************************************************************************
00004  * Name
00005  *    tte_tt_traffic.h
00006  *
00007  * Purpose
00008  *    TT traffic functions of the TTE protocol
00009  *
00010  * Revision Dates
00011  *   18-Jun-2008 (AAD) Creation
00012  *   22-Sep-2008 (AAD) implementation of TTTech und MISRA coding guidlines
00013  *   02-Dec-2008 (KSE) [29628] Changed include names
00014  *   04-Jun-2010 (JWO) Added #define for Integration Cycle offset
00015  *--
00016  */
00017 
00018 #ifndef TTE_CLOCK_SYNC_H_
00019 #define TTE_CLOCK_SYNC_H_
00020 
00021 #include "tte_common.h"
00022 #include "tte_config.h"
00023 #include "tte_core.h"
00024 #include "tte_hw_timer.h"
00025 
00026 
00027 /* Protocol control frame (PCF) field offsets */
00028 #define TTE_PCF_IC_OFF        ( 3u) /* only 1B of SW Protocol Layer */
00029 #define TTE_PCF_MEMB_OFF      ( 4u)
00030 #define TTE_PCF_SYNC_PRIO_OFF (12u)
00031 #define TTE_PCF_SYNC_DOM_OFF  (13u)
00032 #define TTE_PCF_PCF_TYPE_OFF  (14u)
00033 #define TTE_PCF_TC_OFF        (20u)
00034 
00035 
00036 #define TTE_DAMP_DIVIDENT             (9)
00037 #define TTE_DAMP_DIVISOR              (10)
00038 #define TTE_STARTUP_CHECK_CYCLE       ((TTE_HZ)/1000)
00039 
00040 /* Maximum number of received BG before clock sync. At least
00041  * two buffers shall be  free in order that a sync frame is received.
00042  * Consider to make parameter as a part of configuration */
00043 #define TTE_RX_BUFFERS_BEFORE_SYNC (2u)
00044 
00046 extern int32_t tte_clock_sync(void);
00047 
00050 int32_t tte_tt_sched_rx_bg(void);
00051 
00052 /* Convert HW time-stamp into transparent clock.
00053    The bits 0-16 and bits 48-63 of TC must be set to 0 outside of this routine. */
00054 extern void ns_to_tc(uint64_t ns, uint8_t *tc);
00055 
00056 /* convert transparent clock to HW timestamp */
00057 extern void tc_to_ns(const uint8_t *tc, uint64_t *ns);
00058 
00059 
00060 #endif  /* TTE_CLOCK_SYNC_H_ */
Generated on Tue Nov 29 14:09:18 2011 for TTEthernet Model for INET Framework by  doxygen 1.6.3