diff options
Diffstat (limited to 'include/usb_pd_timer.h')
-rw-r--r-- | include/usb_pd_timer.h | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/include/usb_pd_timer.h b/include/usb_pd_timer.h index 5746e76430..1ed268f14d 100644 --- a/include/usb_pd_timer.h +++ b/include/usb_pd_timer.h @@ -10,6 +10,8 @@ #include <stdbool.h> +#include "atomic.h" + /* * List of all timers that will be managed by usb_pd_timer */ @@ -36,6 +38,15 @@ enum pd_task_timer { PE_TIMER_CHUNKING_NOT_SUPPORTED, /* + * PD 3.0, rev. 3.1, v. 1.2, section 6.6.10.3: The DataResetFailTimer + * Shall be used by the DFP’s Policy Engine to ensure the Data Reset + * process completes within tDataResetFail of the last bit of the + * GoodCRC acknowledging the Accept Message in response to the + * Data_Reset Message. + */ + PE_TIMER_DATA_RESET_FAIL, + + /* * This timer is used during an Explicit Contract when discovering * whether a Port Partner is PD Capable using SOP'. */ @@ -122,11 +133,25 @@ enum pd_task_timer { PE_TIMER_TIMEOUT, /* + * The amount of timer that the DFP shall wait for the UFP to discharge + * VCONN (and send PS_RDY) during Data Reset. See PD 3.0, rev. 3.1, v. + * 1.2, section 6.6.10.1 VCONNDischargeTimer. + */ + PE_TIMER_VCONN_DISCHARGE, + + /* * This timer is used during a VCONN Swap. */ PE_TIMER_VCONN_ON, /* + * The amount of time that VCONN shall remain off during the cable reset + * portion of a Data Reset. See PD 3.0, rev. 3.1, v. 1.2, section 7.1.15 + * VCONN Power Cycle. + */ + PE_TIMER_VCONN_REAPPLIED, + + /* * This timer is used by the Initiator’s Policy Engine to ensure that * a Structured VDM Command request needing a response (e.g. Discover * Identity Command request) is responded to within a bounded time of @@ -320,28 +345,28 @@ extern uint32_t timer_disabled[MAX_PD_PORTS][TIMER_FIELD_NUM_UINT32S]; /* exported: do not call directly, only for the defined macros */ extern void pd_timer_atomic_op( atomic_val_t (*op)(atomic_t*, atomic_val_t), - uint32_t *const timer_field, const uint64_t mask); + atomic_t *const timer_field, const uint64_t mask); /* exported: set/clear/check the current timer_active for a timer */ -#define PD_SET_ACTIVE(p, m) pd_timer_atomic_op( \ - atomic_or, \ - timer_active[p], \ +#define PD_SET_ACTIVE(p, m) pd_timer_atomic_op( \ + atomic_or, \ + (atomic_t *)timer_active[p], \ (m)) -#define PD_CLR_ACTIVE(p, m) pd_timer_atomic_op( \ - atomic_clear_bits, \ - timer_active[p], \ +#define PD_CLR_ACTIVE(p, m) pd_timer_atomic_op( \ + atomic_clear_bits, \ + (atomic_t *)timer_active[p], \ (m)) #define PD_CHK_ACTIVE(p, m) ((timer_active[p][0] & ((m) >> 32)) | \ (timer_active[p][1] & (m))) /* exported: set/clear/check the current timer_disabled for a timer */ -#define PD_SET_DISABLED(p, m) pd_timer_atomic_op( \ - atomic_or, \ - timer_disabled[p], \ +#define PD_SET_DISABLED(p, m) pd_timer_atomic_op( \ + atomic_or, \ + (atomic_t *)timer_disabled[p], \ (m)) -#define PD_CLR_DISABLED(p, m) pd_timer_atomic_op( \ - atomic_clear_bits, \ - timer_disabled[p], \ +#define PD_CLR_DISABLED(p, m) pd_timer_atomic_op( \ + atomic_clear_bits, \ + (atomic_t *)timer_disabled[p], \ (m)) #define PD_CHK_DISABLED(p, m) ((timer_disabled[p][0] & ((m) >> 32)) | \ (timer_disabled[p][1] & (m))) |