mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-14 16:46:23 +00:00
npcx: CEC: Respect the present initiator free-time
When sending multiple frames, the free-time is a bit higher to make it easier for other senders to get a chance to send. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=none CQ-DEPEND=CL:1030370 Change-Id: I19e510ec0b6e987e0d8477fa5549e0b29ef594ee Reviewed-on: https://chromium-review.googlesource.com/1030371 Commit-Ready: Stefan Adolfsson <sadolfsson@chromium.org> Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
ad01d0518b
commit
64cf05b7e8
@@ -53,10 +53,15 @@
|
||||
#error "Buffer size must not exceed 255 since offsets are uint8_t"
|
||||
#endif
|
||||
|
||||
/* Free time timing (us). */
|
||||
/*
|
||||
* Free time timing (us). Our free-time is calculated from the end of
|
||||
* the last bit (not from the start). We compensate by having one
|
||||
* free-time period less than in the spec.
|
||||
*/
|
||||
#define NOMINAL_BIT_TIME APB1_TICKS(2400)
|
||||
#define FREE_TIME_RS (3 * (NOMINAL_BIT_TIME)) /* Resend */
|
||||
#define FREE_TIME_NI (5 * (NOMINAL_BIT_TIME)) /* New initiator */
|
||||
#define FREE_TIME_RS (2 * (NOMINAL_BIT_TIME)) /* Resend */
|
||||
#define FREE_TIME_NI (4 * (NOMINAL_BIT_TIME)) /* New initiator */
|
||||
#define FREE_TIME_PI (6 * (NOMINAL_BIT_TIME)) /* Present initiator */
|
||||
|
||||
/* Start bit timing (us) */
|
||||
#define START_BIT_LOW APB1_TICKS(3700)
|
||||
@@ -231,6 +236,11 @@ struct cec_tx {
|
||||
uint8_t resends;
|
||||
/* Acknowledge received from sink? */
|
||||
uint8_t ack;
|
||||
/*
|
||||
* When sending multiple concurrent frames,
|
||||
* the free-time is slightly higher
|
||||
*/
|
||||
int present_initiator;
|
||||
};
|
||||
|
||||
/* Single state for CEC. We are INITIATOR, FOLLOWER or IDLE */
|
||||
@@ -497,10 +507,13 @@ void enter_state(enum cec_state new_state)
|
||||
cap_edge = CAP_EDGE_FALLING;
|
||||
if (cec_tx.resends)
|
||||
timeout = FREE_TIME_RS;
|
||||
else if (cec_tx.present_initiator)
|
||||
timeout = FREE_TIME_PI;
|
||||
else
|
||||
timeout = FREE_TIME_NI;
|
||||
break;
|
||||
case CEC_STATE_INITIATOR_START_LOW:
|
||||
cec_tx.present_initiator = 1;
|
||||
cec_tx.msgt.bit = 0;
|
||||
cec_tx.msgt.byte = 0;
|
||||
gpio = 0;
|
||||
@@ -561,6 +574,7 @@ void enter_state(enum cec_state new_state)
|
||||
timeout = NOMINAL_BIT_TIME - NOMINAL_SAMPLE_TIME;
|
||||
break;
|
||||
case CEC_STATE_FOLLOWER_START_LOW:
|
||||
cec_tx.present_initiator = 0;
|
||||
cap_edge = CAP_EDGE_RISING;
|
||||
timeout = CAP_START_LOW;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user