flexPTP
1.0
An IEEE 1588 PTP implementation designed for microcontrollers
Loading...
Searching...
No Matches
flexptp_options_tm4c1294.h
Go to the documentation of this file.
1
#ifndef FLEXPTP_OPTIONS_TM4C1294_H_
2
#define FLEXPTP_OPTIONS_TM4C1294_H_
3
4
#define LWIP
5
#define PTP_ADDEND_INTERFACE
6
7
// -------------------------------------------
8
// --- DEFINES FOR PORTING IMPLEMENTATION ----
9
// -------------------------------------------
10
11
// Include LwIP headers here
12
13
#include "utils/lwiplib.h"
14
#include "utils/uartstdio.h"
15
16
#include "driverlib/emac.h"
17
#include "driverlib/gpio.h"
18
#include "inc/hw_memmap.h"
19
#include "driverlib/pin_map.h"
20
21
// Give a printf-like printing implementation MSG(...)
22
// Give a maskable printing implementation CLILOG(en,...)
23
24
#include "utils.h"
25
26
// Include hardware port files and fill the defines below to port the PTP stack to a physical hardware:
27
// - PTP_HW_INIT(increment, addend): function initializing timestamping hardware
28
// - PTP_MAIN_OSCILLATOR_FREQ_HZ: clock frequency fed into the timestamp unit [Hz]
29
// - PTP_INCREMENT_NSEC: hardware clock increment [ns]
30
// - PTP_UPDATE_CLOCK(s,ns): function jumping clock by defined value (negative time value means jumping backward)
31
// - PTP_SET_ADDEND(addend): function writing hardware clock addend register
32
33
34
#define PTP_MAIN_OSCILLATOR_FREQ_HZ (25000000)
35
#define PTP_INCREMENT_NSEC (50)
36
37
#define PTP_HW_INIT(increment, addend) ptphw_init(increment, addend)
38
#define PTP_UPDATE_CLOCK(s,ns) EMACTimestampSysTimeUpdate(EMAC0_BASE, labs(s), abs(ns), (s * NANO_PREFIX + ns) < 0)
39
#define PTP_SET_ADDEND(addend) EMACTimestampAddendSet(EMAC0_BASE, addend)
40
#define PTP_HW_GET_TIME(pt) ptphw_gettime(pt)
41
42
// Include the clock servo (controller) and define the following:
43
// - PTP_SERVO_INIT(): function initializing clock servo
44
// - PTP_SERVO_DEINIT(): function deinitializing clock servo
45
// - PTP_SERVO_RESET(): function reseting clock servo
46
// - PTP_SERVO_RUN(d): function running the servo, input: master-slave time difference (error), return: clock tuning value in PPB
47
//
48
49
#include <
flexptp/servo/pid_controller.h
>
50
51
#define PTP_SERVO_INIT() pd_ctrl_init()
52
#define PTP_SERVO_DEINIT() pd_ctrl_deinit()
53
#define PTP_SERVO_RESET() pd_ctrl_reset()
54
#define PTP_SERVO_RUN(d,pscd) pd_ctrl_run(d,pscd)
55
56
// Optionally add interactive, tokenizing CLI-support
57
// - CLI_REG_CMD(cmd_hintline,n_cmd,n_min_arg,cb): function for registering CLI-commands
58
// cmd_hintline: text line printed in the help beginning with the actual command, separated from help text by \t charaters
59
// n_cmd: number of tokens (words) the command consists of
60
// n_arg: minimal number of arguments must be passed with the command
61
// cb: callback function cb(const CliToken_Type *ppArgs, uint8_t argc)
62
// return: cmd id (can be null, if discarded)
63
64
#include "cli.h"
65
66
#define CLI_REG_CMD(cmd_hintline,n_cmd,n_min_arg,cb) CLI_REG_CMD(cmd_hintline, n_cmd, n_min_arg, cb)
67
68
// -------------------------------------------
69
70
#endif
// FLEXPTP_OPTIONS_TM4C1294_H_
pid_controller.h
src
flexptp
port
example_options
flexptp_options_tm4c1294.h
Generated by
1.9.6