initial support for syncing master thread to dc

This commit is contained in:
Sascha Ittner
2018-03-09 10:34:50 +01:00
parent d30391f231
commit 2912343b9b
2 changed files with 138 additions and 23 deletions

View File

@@ -61,8 +61,8 @@ do { \
#define LCEC_STOEBER_VID 0x000000b9
#define LCEC_DELTA_VID 0x000001dd
// SDO request timeout (ms)
#define LCEC_SDO_REQ_TIMEOUT LCEC_MS_TO_TICKS(1000)
// State update period (ns)
#define LCEC_STATE_UPDATE_PERIOD 1000000000LL
struct lcec_master;
struct lcec_slave;
@@ -79,6 +79,10 @@ typedef struct lcec_master_data {
hal_bit_t *state_op;
hal_bit_t *link_up;
hal_bit_t *all_op;
hal_s32_t *pll_err;
hal_s32_t *pll_out;
hal_float_t pll_p;
hal_float_t pll_i;
} lcec_master_data_t;
typedef struct lcec_slave_state {
@@ -105,10 +109,16 @@ typedef struct lcec_master {
struct lcec_slave *first_slave;
struct lcec_slave *last_slave;
lcec_master_data_t *hal_data;
uint64_t app_time;
uint64_t app_time_base;
uint32_t app_time_period;
int app_time_period_check;
int sync_ref_cnt;
int sync_ref_cycles;
uint64_t dc_ref;
uint32_t dc_time_last;
long long state_update_timer;
double pll_isum;
} lcec_master_t;
typedef struct {