1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 #ifndef HDMI_NCTS_H
10 #define HDMI_NCTS_H
11 
12 #include "hdf_base.h"
13 
14 #ifdef __cplusplus
15 #if __cplusplus
16 extern "C" {
17 #endif
18 #endif /* __cplusplus */
19 
20 /* N/CTS(Cycle Time Stamp), see hdmi1.4 spec section 7.2. */
21 #define HDMI_NCTS_FACTOR 128
22 #define HDMI_NCTS_N_DEFAULT 6144
23 #define HDMI_NCTS_TMDS_DEVIATION 20
24 
25 struct HdmiAudioNCts {
26     uint32_t sampleRate;   /* audio sample rate(fs) */
27     uint32_t tmdsClock;
28     uint32_t n;
29     uint32_t cts;
30 };
31 
32 uint32_t HdmiGetN(uint32_t sampleRate, uint32_t tmdsClock);
33 uint32_t HdmiGetCts(uint32_t sampleRate, uint32_t tmdsClock);
34 
35 #ifdef __cplusplus
36 #if __cplusplus
37 }
38 #endif
39 #endif /* __cplusplus */
40 
41 #endif /* HDMI_NCTS_H */
42