tte_core.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_core.h
00006  *
00007  * Purpose
00008  *    Core functions of the TTE protocol
00009  *
00010  * Revision Dates
00011  *   18-Jun-2008 Creation
00012  *   01-Dec-2008 (KSE) [29628] Remove execution_times
00013  *   02-Dec-2008 (KSE) [29628] Remove debug code
00014  *   02-Dec-2008 (KSE) [29628] Changed include names
00015  *   04-Jun-2010 (JWO) Added IC to prot_dev and tte_integrate params
00016  *--
00017  */
00018 
00019 #ifndef TTE_CORE_H_
00020 #define TTE_CORE_H_
00021 
00022 #include "tte_config.h"
00023 #include "tte_common.h"
00024 #include "tte_api.h"
00025 #include "tte_clock_sync.h"
00026 
00027 
00028 #define TTE_STAT_FREEZE   (0)
00029 #define TTE_STAT_SYNC     (1)
00030 
00031 
00032 typedef void (* tte_error_callback_t)(int32_t err_code);
00033 
00034 
00035 extern int32_t tte_get_sync_master(void);
00036 
00037 
00038 #ifdef TTE_INTERNAL
00039 
00040 /* structure for the TTE protocol status and control fields */
00041 typedef struct {
00042    uint32_t        state;
00043    uint32_t        slot;
00044    uint8_t         integration_cycle;
00045    uint64_t        rounds;
00046    uint32_t        lost_cs_frames;
00047    int32_t         rate;
00048    tte_task_conf_t tte_app_cb;    /* cb to the current app task in execution */
00049    uint32_t        init_done;
00050    uint32_t        started;
00051    int64_t        last_slot_time;
00052    hwtime_t        round_start_time;
00053    hwtime_t        next_slot_time;
00054    tte_buffer_t    pcf_buf;
00055    uint8_t         pcf_frame[60];   /* PCF frame template */
00056    eth_mac_addr_t  mac_addr;
00057 } tte_prot_t;
00058 
00059 
00060 /* general cluster conf */
00061 extern const tte_swes_conf_t *tt_conf;
00062 extern tte_prot_t  tte_prot_dev;
00063 
00064 extern int32_t tte_get_init_state(void);
00065 
00066 extern void tte_integrate(hwtime_t ts, uint64_t tc_ns, uint8_t ic);
00067 
00068 extern void tte_register_multicast_addresses(void);
00069 
00070 extern int32_t tte_core_check_configure(const tte_swes_conf_t * config);
00071 
00072 extern int32_t tte_core_eth_err_callback(uint8_t ctrl, int32_t err_code);
00073 
00074 extern void tte_core_timer_callback(const uint8_t ctrl);
00075 
00076 extern int32_t tte_core_configure_bg(const uint8_t ctrl);
00077 
00078 extern int32_t tte_core_configure_tt(void);
00079 
00080 extern void tte_free_tt_buffers(void);
00081 
00082 extern void tte_core_init_prot_dev(tte_prot_t * my_tte_prot_dev);
00083 
00084 extern void tte_core_switch_state(uint8_t state);
00085 
00086 extern void tte_core_master_startup(void);
00087 
00088 extern void tte_flush_tt(const uint8_t ctrl_id);
00089 
00090 #endif
00091 
00092 #endif /* TTE_CORE_H_ */
Generated on Tue Nov 29 14:09:18 2011 for TTEthernet Model for INET Framework by  doxygen 1.6.3