Commit 1249a57c authored by Ille, Ondrej, Ing.'s avatar Ille, Ondrej, Ing.

Merge branch '233-add-timestamp-support-to-driver' into 'master'

driver: Add timestamp read-out function.

Closes #233

See merge request !207
parents 8bbd5f8e 96eeed4f
Pipeline #5999 failed with stages
in 60 minutes and 53 seconds
......@@ -774,4 +774,21 @@ bool ctu_can_fd_insert_frame(struct ctucanfd_priv *priv,
return true;
}
u64 ctu_can_fd_read_timestamp(struct ctucanfd_priv *priv)
{
union ctu_can_fd_timestamp_low ts_low;
union ctu_can_fd_timestamp_high ts_high;
union ctu_can_fd_timestamp_high ts_high_2;
ts_high.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_HIGH);
ts_low.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_LOW);
ts_high_2.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_HIGH);
if (ts_high.u32 != ts_high_2.u32){
ts_low.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_LOW);
}
return (( (u64) ts_high_2.u32) << 32) | ( (u64) ts_low.u32);
}
// TODO: AL_CAPTURE and ERROR_CAPTURE
......@@ -955,6 +955,20 @@ static inline union ctu_can_fd_debug_register
return reg;
}
/*
* Read timestamp value which is used internally by CTU CAN FD Core.
* Reads timestamp twice and checks consistency betwen upper and
* lower timestamp word.
*
* Arguments:
* priv Private info
* Returns:
* Value of timestamp in CTU CAN FD Core
*/
u64 ctu_can_fd_read_timestamp(struct ctucanfd_priv *priv);
extern const struct can_bittiming_const ctu_can_fd_bit_timing_max;
extern const struct can_bittiming_const ctu_can_fd_bit_timing_data_max;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment