Home | History | Annotate | Download | only in health

Lines Matching refs:csp

51 #define MCAP_CSP_ERROR g_quark_from_static_string("mcap-csp-error-quark")
56 uint64_t base_tmstamp; /* CSP base timestamp */
57 struct timespec base_time; /* CSP base time when timestamp set */
58 guint local_caps; /* CSP-Master: have got remote caps */
59 guint remote_caps; /* CSP-Slave: remote master got caps */
60 guint rem_req_acc; /* CSP-Slave: accuracy required by master */
61 guint ind_expected; /* CSP-Master: indication expected */
62 MCAPCtrl csp_req; /* CSP-Master: Request control flag */
63 guint ind_timer; /* CSP-Slave: indication timer */
64 guint set_timer; /* CSP-Slave: delayed set timer */
65 void *set_data; /* CSP-Slave: delayed set data */
66 void *csp_priv_data; /* CSP-Master: In-flight request data */
141 static void reset_tmstamp(struct mcap_csp *csp, struct timespec *base_time,
144 csp->base_tmstamp = new_tmstamp;
146 csp->base_time = *base_time;
148 clock_gettime(CLK, &csp->base_time);
154 mcl->csp = NULL;
158 mcl->csp = g_new0(struct mcap_csp, 1);
160 mcl->csp->rem_req_acc = 10000; /* safe divisor */
161 mcl->csp->set_data = NULL;
162 mcl->csp->csp_priv_data = NULL;
164 reset_tmstamp(mcl->csp, NULL, 0);
169 if (!mcl->csp)
172 if (mcl->csp->ind_timer)
173 g_source_remove(mcl->csp->ind_timer);
175 if (mcl->csp->set_timer)
176 g_source_remove(mcl->csp->set_timer);
178 if (mcl->csp->set_data)
179 g_free(mcl->csp->set_data);
181 if (mcl->csp->csp_priv_data)
182 g_free(mcl->csp->csp_priv_data);
184 mcl->csp->ind_timer = 0;
185 mcl->csp->set_timer = 0;
186 mcl->csp->set_data = NULL;
187 mcl->csp->csp_priv_data = NULL;
189 g_free(mcl->csp);
190 mcl->csp = NULL;
257 DBG("CSP: retrying to read bt clock...");
275 DBG("CSP: could not read role");
286 if (!mcl->csp)
294 tmstamp = time_us(&now) - time_us(&mcl->csp->base_time)
295 + mcl->csp->base_tmstamp;
305 if (!mcl->csp)
452 mcl->csp->remote_caps = 1;
453 mcl->csp->rem_req_acc = required_accuracy;
569 if (!mcl->csp->set_data)
572 data = mcl->csp->set_data;
601 DBG("CSP: reset w/ delay %dus, compensated",
604 DBG("CSP: reset w/ delay %dus, uncompensated",
608 reset_tmstamp(mcl->csp, &base_time, new_tmstamp);
614 if (mcl->csp->ind_timer) {
615 g_source_remove(mcl->csp->ind_timer);
616 mcl->csp->ind_timer = 0;
621 mcl->csp->ind_timer = g_timeout_add(when,
666 if (!mcl->csp->remote_caps) {
713 ind_freq = (1000 * mcl->csp->rem_req_acc) / caps(mcl)->ts_acc;
722 DBG("CSP: indication every %dms", ind_freq);
726 if (mcl->csp->ind_timer) {
728 g_source_remove(mcl->csp->ind_timer);
729 mcl->csp->ind_timer = 0;
732 if (!mcl->csp->set_data)
733 mcl->csp->set_data = g_new0(struct sync_set_data, 1);
735 csp->set_data;
749 mcl->csp->set_timer = g_timeout_add(when,
772 if (mcl->csp->csp_req != MCAP_MD_SYNC_CAP_REQ) {
773 DBG("CSP: got unexpected cap respose");
777 if (!mcl->csp->csp_priv_data) {
778 DBG("CSP: no priv data for cap respose");
782 cbdata = mcl->csp->csp_priv_data;
787 mcl->csp->csp_priv_data = NULL;
788 mcl->csp->csp_req = 0;
791 DBG("CSP: got corrupted cap respose");
803 mcl->csp->local_caps = TRUE;
820 if (mcl->csp->csp_req != MCAP_MD_SYNC_SET_REQ) {
821 DBG("CSP: got unexpected set respose");
825 if (!mcl->csp->csp_priv_data) {
826 DBG("CSP: no priv data for set respose");
830 cbdata = mcl->csp->csp_priv_data;
835 mcl->csp->csp_priv_data = NULL;
836 mcl->csp->csp_req = 0;
839 DBG("CSP: got corrupted set respose");
861 if (!mcl->csp->ind_expected) {
862 DBG("CSP: received unexpected info indication");
886 if (!mcl->mi->csp_enabled || !mcl->csp) {
924 if (!mcl->mi->csp_enabled || !mcl->csp) {
928 "CSP not enabled for the instance");
932 if (mcl->csp->csp_req) {
936 "Pending CSP request");
940 mcl->csp->csp_req = MCAP_MD_SYNC_CAP_REQ;
949 mcl->csp->csp_priv_data = cbdata;
963 if (!mcl->mi->csp_enabled || !mcl->csp) {
967 "CSP not enabled for the instance");
971 if (!mcl->csp->local_caps) {
975 "Did not get CSP caps from slave yet");
979 if (mcl->csp->csp_req) {
983 "Pending CSP request");
987 mcl->csp->csp_req = MCAP_MD_SYNC_SET_REQ;
995 mcl->csp->ind_expected = update;
1000 mcl->csp->csp_priv_data = cbdata;