CCGx FW API Guide v2.1

EZ-PDTM CCGx Firmware Stack
API Reference Guide
Version 2.1
Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
Phone (USA): 800.858.1810
Phone (Intnl): 408.943.2600
http://www.cypress.com
ii
Copyright © 2015-2016 Cypress Semiconductor Corporation. All rights reserved.
EZ-PDTM is a trademark of Cypress Semiconductor. All other trademarks or registered trademarks referenced
herein are the property of their respective owners.
The information in this document is subject to change without notice and should not be construed as a commitment
by Cypress. While reasonable precautions have been taken, Cypress assumes no responsibility for any errors that
may appear in this document. No part of this document may be copied or reproduced in any form or by any means
without the prior written consent of Cypress. Made in the U.S.A.
Disclaimer
CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE. Cypress reserves the right to make changes without further notice to the materials
described herein. Cypress does not assume any liability arising out of the application or use of any product or
circuit described herein. Cypress does not authorize its products for use as critical components in life-support
systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The
inclusion of Cypress’ product in a life-support systems application implies that the manufacturer assumes all risk of
such use and in doing so indemnifies Cypress against all charges.
License Agreement
Please read the license agreement during SDK installation.
Generated for CCGx Firmware Stack by Doxygen
Contents
1
CCGx Firmware Stack: API Reference Guide
1
1.1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
1.1.1
USB Type-C Highlights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
Cypress EZ-PD™ Type-C Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
1.2.1
CCGx Product Families . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
CCGx Firmware Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2
1.3.1
2
1.2
1.3
2
CCGx Firmware Architecture
3
2.1
CCGx Firmware Solution Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4
2.2
Public API Summary
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
2.2.1
Device Policy Manager (DPM) API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
2.2.2
Host Processor Interface (HPI) API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6
2.2.3
Application Layer API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6
2.2.3.1
Solution Layer Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7
2.2.4
Alternate Mode Manager API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
2.2.5
Hardware Abstraction Layer (HAL) API . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
2.2.5.1
GPIO API
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
2.2.5.2
I2C Driver API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
2.2.5.3
Flash Module API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
2.2.5.4
Soft Timer API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
Firmware Update API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
2.2.6
3
4
5
Firmware Stack Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Data Structure Index
11
3.1
11
Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
File Index
13
4.1
13
File List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Data Structure Documentation
15
5.1
alt_mode_cmd_info_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
5.1.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
5.1.2
Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
iv
CONTENTS
5.1.2.1
alt_mode_id . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
5.1.2.2
app_evt_data
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
5.1.2.3
app_evt_needed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
5.1.2.4
cbk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
5.1.2.5
cbl_obj_pos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
5.1.2.6
custom_att_obj_pos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
5.1.2.7
data_role . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
5.1.2.8
eval_app_cmd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
5.1.2.9
is_active . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
5.1.2.10 mode_state
5.2
5.3
5.4
5.5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
5.1.2.11 obj_pos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
5.1.2.12 sop_state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
5.1.2.13 vdm_header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
5.1.2.14 vdo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
5.1.2.15 vdo_max_numb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
5.1.2.16 vdo_numb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
alt_mode_evt_t::ALT_MODE_EVT Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . .
17
5.2.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
5.2.2
Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
5.2.2.1
alt_mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
5.2.2.2
alt_mode_evt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
5.2.2.3
data_role . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
5.2.2.4
svid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
alt_mode_evt_t::ALT_MODE_EVT_DATA Struct Reference . . . . . . . . . . . . . . . . . . . . .
18
5.3.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
5.3.2
Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
5.3.2.1
evt_data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
5.3.2.2
evt_type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
alt_mode_evt_t Union Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
5.4.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
5.4.2
Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
5.4.2.1
alt_mode_event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
5.4.2.2
alt_mode_event_data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
5.4.2.3
val . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
alt_mode_hw_evt_t::ALT_MODE_HW_EVT Struct Reference . . . . . . . . . . . . . . . . . . . .
19
5.5.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
5.5.2
Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
5.5.2.1
data_role . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
5.5.2.2
evt_data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
5.5.2.3
hw_type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
Generated for CCGx Firmware Stack by Doxygen
CONTENTS
5.6
v
alt_mode_hw_evt_t Union Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
5.6.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
5.6.2
Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
5.6.2.1
hw_evt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
5.6.2.2
val . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
5.7
app_cbk_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
5.8
app_resp_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
5.9
app_status_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
5.9.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
5.9.2
Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
5.9.2.1
alt_mode_entered . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
5.9.2.2
alt_mode_trigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
5.9.2.3
app_resp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
5.9.2.4
cbl_disc_id_finished . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
5.9.2.5
disc_id_resp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
5.9.2.6
is_vbus_on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
5.9.2.7
is_vconn_on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
5.9.2.8
psrc_rising . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
5.9.2.9
psrc_volt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
5.9.2.10 psrc_volt_old . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
5.9.2.11 pwr_ready_cbk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
5.9.2.12 ufp_alt_mode_allowed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
5.9.2.13 vdm_resp
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
5.9.2.14 vdm_task_en . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
5.10 ar_reg_t Union Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
5.10.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
5.10.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
5.10.2.1 ar_status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
5.10.2.2 usbpd_cmd_reg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
5.10.2.3 val . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
5.11 atch_tgt_info_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
5.11.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
5.11.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
5.11.2.1 ama_vdo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
5.11.2.2 cbl_svid
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
5.11.2.3 cbl_vdo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
5.11.2.4 tgt_id_header
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
5.11.2.5 tgt_svid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
5.12 pd_do_t::BAT_SNK Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
5.13 pd_do_t::BAT_SRC Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25
Generated for CCGx Firmware Stack by Doxygen
vi
CONTENTS
5.14 bb_handle_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.14.1 Detailed Description
25
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25
5.14.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25
5.14.2.1 alt_status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25
5.14.2.2 ep0_buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25
5.14.2.3 num_alt_modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25
5.14.2.4 queue_disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
5.14.2.5 queue_enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
5.14.2.6 queue_state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
5.14.2.7 state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
5.14.2.8 timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
5.14.2.9 type
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
5.14.2.10 usb_port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
5.15 pd_do_t::BIST_DO Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
5.16 bm_alt_modes_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
5.16.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
5.16.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
5.16.2.1 active_modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
5.16.2.2 exited_modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
5.16.2.3 supported_modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
5.17 cc_state_t Union Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
5.18 ccg_timer_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
5.18.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
5.18.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
5.18.2.1 cb
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
5.18.2.2 count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
5.18.2.3 id . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
5.18.2.4 period . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
5.19 comp_tbl_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
5.19.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
5.19.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
5.19.2.1 alt_mode_id . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
5.19.2.2 svid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
5.20 contract_t Union Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
5.20.1 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
5.20.1.1 val . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
5.21 disc_mode_info_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
5.21.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
5.21.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
5.21.2.1 alt_mode_id . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
Generated for CCGx Firmware Stack by Doxygen
CONTENTS
vii
5.21.2.2 app_evt
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
5.21.2.3 atch_tgt_info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
5.21.2.4 atch_type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
5.21.2.5 cbl_sop_flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
5.21.2.6 data_role . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
5.21.2.7 svid_emca_vdo
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
5.21.2.8 svid_vdo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
5.21.2.9 vdo_pos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
5.22 pd_do_t::DP_CONFIG_VDO Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
5.23 pd_do_t::DP_STATUS_VDO Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
5.24 dpm_pd_cmd_buf_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
5.24.1 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
5.24.1.1 cmd_do
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
5.24.1.2 cmd_sop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
5.24.1.3 no_of_cmd_do . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
5.25 dpm_status_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
32
5.25.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33
5.25.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33
5.25.2.1 app_cbk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33
5.25.2.2 attach
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
5.25.2.3 attached_dev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
5.25.2.4 bootup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
5.25.2.5 cbl_dsc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
5.25.2.6 cbl_soft_reset_tried . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
5.25.2.7 cbl_state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
5.25.2.8 cbl_type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
5.25.2.9 cbl_vdo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
5.25.2.10 cbl_wait
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
5.25.2.11 cc_live . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
5.25.2.12 cc_old_status
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
5.25.2.13 cc_rd_status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
5.25.2.14 cc_status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
5.25.2.15 cmd_p . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
5.25.2.16 connect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
5.25.2.17 contract
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
5.25.2.18 contract_exist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
5.25.2.19 cur_port_role . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
5.25.2.20 cur_port_type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
5.25.2.21 cur_snk_max_min . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
5.25.2.22 cur_snk_pdo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
Generated for CCGx Firmware Stack by Doxygen
viii
CONTENTS
5.25.2.23 cur_snk_pdo_count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
5.25.2.24 cur_src_pdo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
5.25.2.25 cur_src_pdo_count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
5.25.2.26 db_support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
5.25.2.27 dead_bat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
5.25.2.28 dflt_port_role . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
5.25.2.29 dpm_cmd_buf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
5.25.2.30 dpm_enabled
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
5.25.2.31 dpm_pd_cbk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
5.25.2.32 dpm_pd_cmd
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
5.25.2.33 dpm_pd_cmd_active . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
5.25.2.34 dpm_safe_disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
5.25.2.35 dpm_typec_cbk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
5.25.2.36 dpm_typec_cmd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
5.25.2.37 dpm_typec_cmd_active . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
5.25.2.38 drp_period . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
5.25.2.39 emca_present . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
5.25.2.40 err_recov . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
5.25.2.41 is_snk_bat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
5.25.2.42 is_src_bat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
5.25.2.43 pd_connected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
5.25.2.44 pd_disabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
5.25.2.45 pd_support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
5.25.2.46 pe_bcm2_ams_state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
5.25.2.47 pe_btd_ams_state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
5.25.2.48 pe_dr_ams_state
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
5.25.2.49 pe_evt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
5.25.2.50 pe_fsm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
5.25.2.51 pe_gn_ams_state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
5.25.2.52 pe_hr_ams_state
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
5.25.2.53 pe_pr_ams_state
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
5.25.2.54 pe_snk_ams_state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
5.25.2.55 pe_sr_ams_state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
5.25.2.56 pe_src_ams_state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
5.25.2.57 pe_vs_ams_state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
5.25.2.58 polarity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
5.25.2.59 port_disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
5.25.2.60 port_role . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
5.25.2.61 ra_present . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
5.25.2.62 reserved_2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
Generated for CCGx Firmware Stack by Doxygen
CONTENTS
ix
5.25.2.63 reserved_3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
5.25.2.64 rev_pol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
5.25.2.65 role_at_connect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
5.25.2.66 rp_supported . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
5.25.2.67 skip_scan
39
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.25.2.68 snk_cur_level
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
5.25.2.69 snk_max_min . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
5.25.2.70 snk_pdo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
5.25.2.71 snk_pdo_count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
5.25.2.72 snk_pdo_mask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
5.25.2.73 snk_period . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
5.25.2.74 snk_rdo
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
5.25.2.75 snk_sel_pdo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
5.25.2.76 snk_usb_comm_en . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
5.25.2.77 snk_usb_susp_en . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
5.25.2.78 src_cur_level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
5.25.2.79 src_pdo
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
5.25.2.80 src_pdo_count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
5.25.2.81 src_pdo_mask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
5.25.2.82 src_period . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
5.25.2.83 src_rdo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
5.25.2.84 src_sel_pdo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
5.25.2.85 swap_response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
5.25.2.86 toggle
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
5.25.2.87 try_src . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
5.25.2.88 typec_evt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
5.25.2.89 typec_fsm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
5.25.2.90 typec_gn_fsm_state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
5.25.2.91 vconn_actual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
5.25.2.92 vconn_logical
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
5.26 contract_t::FIELD Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
5.26.1 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
5.26.1.1 cur_pwr
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
5.26.1.2 volt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
5.27 pd_do_t::FIXED_SNK Struct Reference
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
5.28 pd_do_t::FIXED_SRC Struct Reference
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
43
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
43
5.29.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
43
5.29.2.1 status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
43
5.29 fw_img_status_t Union Reference
5.29.1 Detailed Description
Generated for CCGx Firmware Stack by Doxygen
x
CONTENTS
5.29.2.2 val . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
43
5.30 fw_img_status_t::FwModeReason Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . .
43
5.30.1 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44
5.30.1.1 boot_mode_request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44
5.30.1.2 fw1_invalid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44
5.30.1.3 fw2_invalid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44
5.30.1.4 reserved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44
5.30.1.5 reserved1
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44
5.31 i2c_scb_config_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44
5.31.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44
5.31.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
5.31.2.1 buf_size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
5.31.2.2 buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
5.31.2.3 cb_fun_ptr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
5.31.2.4 clock_freq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
5.31.2.5 i2c_state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
5.31.2.6 i2c_write_count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
5.31.2.7 mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
5.31.2.8 slave_address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
5.31.2.9 slave_mask
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
5.32 pd_config_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
5.33 pd_contract_info_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
46
5.34 pd_do_t Union Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
46
5.35 pd_hdr_t::PD_HDR Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
47
5.36 pd_hdr_t Union Reference
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
48
5.37 pd_packet_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
48
5.38 pd_port_config_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
48
5.39 pd_do_t::RDO_BAT Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
50
5.40 pd_do_t::RDO_BAT_GIVEBACK Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . .
50
5.41 pd_do_t::RDO_FIXED_VAR Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . .
50
5.42 pd_do_t::RDO_FIXED_VAR_GIVEBACK Struct Reference . . . . . . . . . . . . . . . . . . . . .
51
5.43 pd_do_t::RDO_GEN Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
51
5.44 pd_do_t::RDO_GEN_GVB Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
51
5.45 pd_do_t::SLICE_SUBHDR Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
52
5.46 pd_do_t::SLICE_VDO Struct Reference
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
52
5.47 pd_do_t::SRC_GEN Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
52
5.48 pd_do_t::STD_AMA_VDO Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
52
5.49 pd_do_t::STD_CBL_VDO Struct Reference
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
53
5.50 pd_do_t::STD_CERT_VDO Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
53
5.51 pd_do_t::STD_DP_VDO Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
53
Generated for CCGx Firmware Stack by Doxygen
CONTENTS
xi
5.52 pd_do_t::STD_PROD_VDO Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . .
54
5.53 pd_do_t::STD_SVID_RESP_VDO Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . .
54
5.54 pd_do_t::STD_VDM_HDR Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
54
5.55 pd_do_t::STD_VDM_ID_HDR Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . .
55
5.56 sys_fw_metadata_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
55
5.56.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
55
5.56.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
55
5.56.2.1 active_boot_app . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
55
5.56.2.2 boot_app_id . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
55
5.56.2.3 boot_app_ver_status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56
5.56.2.4 boot_app_version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56
5.56.2.5 boot_last_row . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56
5.56.2.6 boot_seq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56
5.56.2.7 fw_checksum
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56
5.56.2.8 fw_entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56
5.56.2.9 fw_size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56
5.56.2.10 fw_version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56
5.56.2.11 metadata_valid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56
5.56.2.12 reserved1
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56
5.56.2.13 reserved2
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56
5.57 pd_do_t::TBT_VDO Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
57
5.58 ar_reg_t::USBPD_CMD_REG Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . .
57
5.58.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
57
5.58.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
57
5.58.2.1 host_conn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
57
5.58.2.2 intrpt_ack
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
57
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
57
5.58.2.4 soft_rst . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
58
5.59 ar_reg_t::USBPD_STATUS_REG Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . .
58
5.58.2.3 rsvd
5.59.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
58
5.59.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
58
5.59.2.1 act_link_train . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
58
5.59.2.2 active_cbl
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
58
5.59.2.3 cbl_type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
5.59.2.4 conn_orien . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
5.59.2.5 data_conn_pres . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
5.59.2.6 dp_conn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
5.59.2.7 dp_pin_assign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
5.59.2.8 dp_role . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
5.59.2.9 force_lsx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
Generated for CCGx Firmware Stack by Doxygen
xii
CONTENTS
5.59.2.10 ovc_indn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
5.59.2.11 rsvd1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
5.59.2.12 rsvd2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
5.59.2.13 rsvd3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
5.59.2.14 rsvd4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
5.59.2.15 rsvd5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
60
5.59.2.16 tbt_cbl_gen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
60
5.59.2.17 tbt_cbl_spd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
60
5.59.2.18 tbt_conn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
60
5.59.2.19 tbt_type
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
60
5.59.2.20 usb2_conn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
60
5.59.2.21 usb3_conn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
60
5.59.2.22 usb3_speed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
60
5.59.2.23 usb_dr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
60
5.60 pd_do_t::USTD_VDM_HDR Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . .
60
5.61 pd_do_t::VAR_SNK Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
61
5.62 pd_do_t::VAR_SRC Struct Reference
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
61
5.63 vdm_msg_info_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
61
5.63.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
61
5.63.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
62
5.63.2.1 cmd
6
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
62
5.63.2.2 obj_pos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
62
5.63.2.3 sop_type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
62
5.63.2.4 svid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
62
5.63.2.5 vdo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
62
5.63.2.6 vdo_numb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
62
5.64 vdm_resp_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
62
File Documentation
63
6.1
app/alt_mode/alp_ridge.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
63
6.1.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
63
6.1.2
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
63
6.1.2.1
ar_set_mux(uint8_t port, mux_select_t cfg, uint8_t polarity, uint32_t ar_cfg) . . .
63
app/alt_mode/alt_mode_hw.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
64
6.2.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
64
6.2.2
Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
64
6.2.2.1
alt_mode_hw_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
64
6.2.2.2
mux_select_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
65
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
65
6.2.3.1
65
6.2
6.2.3
alt_mode_hw_deinit(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . .
Generated for CCGx Firmware Stack by Doxygen
CONTENTS
6.3
6.2.3.2
alt_mode_hw_is_idle(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . .
65
6.2.3.3
alt_mode_hw_set_cbk(uint8_t port, alt_mode_hw_cmd_cbk_t cbk)
. . . . . . .
66
6.2.3.4
alt_mode_hw_sleep(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . .
66
6.2.3.5
alt_mode_hw_wakeup(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . .
66
6.2.3.6
eval_app_alt_hw_cmd(uint8_t port, uint8_t ∗cmd_param)
. . . . . . . . . . . .
66
6.2.3.7
eval_hpd_cmd(uint8_t port, uint32_t cmd) . . . . . . . . . . . . . . . . . . . . .
67
6.2.3.8
eval_mux_cmd(uint8_t port, uint32_t cmd) . . . . . . . . . . . . . . . . . . . .
67
6.2.3.9
set_mux(uint8_t port, mux_select_t cfg, uint32_t custom_data) . . . . . . . . . .
67
app/alt_mode/alt_modes_mngr.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . .
67
6.3.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
69
6.3.2
Typedef Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
69
6.3.2.1
alt_mode_app_cbk_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
69
6.3.2.2
alt_mode_cbk_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
70
Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
70
6.3.3.1
alt_mode_app_cmd_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
70
6.3.3.2
alt_mode_app_evt_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
70
6.3.3.3
alt_mode_mngr_state_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
71
6.3.3.4
alt_mode_state_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
71
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
71
6.3.4.1
dfp_alt_mode_mngr_sleep(uint8_t port) . . . . . . . . . . . . . . . . . . . . . .
71
6.3.4.2
dfp_alt_mode_mngr_wakeup(uint8_t port)
71
6.3.4.3
eval_app_alt_mode_cmd(uint8_t port, uint8_t ∗cmd, uint8_t ∗data)
. . . . . . .
72
6.3.4.4
eval_rec_vdm(uint8_t port, const pd_packet_t ∗vdm) . . . . . . . . . . . . . . .
72
6.3.4.5
form_alt_mode_event(uint8_t port, uint16 svid, uint8_t am_idx, alt_mode_app_←evt_t evt, uint32_t data) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
72
6.3.4.6
get_vdm_buff(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
73
6.3.4.7
is_dfp_alt_mode_mngr_idle(uint8_t port) . . . . . . . . . . . . . . . . . . . . .
73
6.3.4.8
is_svid_supported(uint16_t svid)
. . . . . . . . . . . . . . . . . . . . . . . . .
73
6.3.4.9
reg_src_alt_mode(uint8_t port, atch_tgt_info_t ∗atch_tgt_info, vdm_msg_info_←t ∗vdm_msg_info) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
73
6.3.4.10 reset_alt_mode_info(alt_mode_cmd_info_t ∗info) . . . . . . . . . . . . . . . . .
74
6.3.4.11 ufp_alt_mode_idle(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . .
74
6.3.4.12 ufp_alt_mode_mng_deinit(uint8_t port) . . . . . . . . . . . . . . . . . . . . . .
74
6.3.4.13 ufp_alt_mode_mngr(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . .
74
6.3.4.14 vdm_task_mng_alt_mode_process(uint8_t port, dfp_vdm_evt_t vdm_evt) . . . .
75
app/alt_mode/dfp_vdm_task_mngr.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . .
75
6.4.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
76
6.4.2
Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
76
6.4.2.1
dfp_vdm_evt_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
76
6.4.2.2
dfp_vdm_task_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
76
6.3.3
6.3.4
6.4
xiii
Generated for CCGx Firmware Stack by Doxygen
. . . . . . . . . . . . . . . . . . . .
xiv
CONTENTS
6.4.3
6.5
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
76
6.4.3.1
dfp_vdm_task_idle(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . .
76
6.4.3.2
dfp_vdm_task_mngr(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . .
77
6.4.3.3
enable_vdm_task_mng(uint8_t port)
. . . . . . . . . . . . . . . . . . . . . . .
77
6.4.3.4
eval_attention(uint8_t port, const pd_packet_t ∗vdm_rcv) . . . . . . . . . . . . .
77
6.4.3.5
vdm_task_mng_deinit(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . .
77
app/alt_mode/dp_sid.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
78
6.5.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
6.5.2
Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
6.5.2.1
dp_conn_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
6.5.2.2
dp_port_cap_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
6.5.2.3
dp_state_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
6.5.3
6.5.3.1
6.6
. . . . . . . .
79
app/alt_mode/intel_vid.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
80
6.6.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
80
6.6.2
Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
80
6.6.2.1
tbt_cbl_status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
80
6.6.2.2
tbt_state_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
81
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
81
reg_intel_modes(uint8_t port, disc_mode_info_t ∗disc_mode_info) . . . . . . . .
81
app/app.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
81
6.7.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
82
6.7.2
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
82
6.7.2.1
app_event_handler(uint8_t port, app_evt_t evt, const void ∗dat) . . . . . . . . .
82
6.7.2.2
app_get_callback_ptr(uint8_t port)
. . . . . . . . . . . . . . . . . . . . . . . .
82
6.7.2.3
app_get_resp_buf(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . .
83
6.7.2.4
app_get_status(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . .
83
6.7.2.5
app_init(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
83
6.7.2.6
app_is_cbl_disc_done(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . .
83
6.7.2.7
app_sleep(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
83
6.7.2.8
app_task(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
84
6.7.2.9
app_wakeup(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
84
6.7.2.10 mux_ctrl_init(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
84
6.7.2.11 mux_ctrl_set_cfg(uint8_t port, mux_select_t cfg, uint8_t polarity) . . . . . . . . .
84
6.7.2.12 sln_pd_event_handler(uint8_t port, app_evt_t evt, const void ∗data) . . . . . . .
85
6.7.2.13 system_sleep(void)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
85
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
85
6.6.3
6.6.3.1
6.7
6.8
reg_dp_modes(uint8_t port, disc_mode_info_t ∗disc_mode_info)
app/billboard.h File Reference
6.8.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
86
6.8.2
Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
86
Generated for CCGx Firmware Stack by Doxygen
CONTENTS
xv
6.8.2.1
BB_ALT_MODE_STATUS_INIT_VAL . . . . . . . . . . . . . . . . . . . . . . .
86
6.8.2.2
BB_MAX_EP0_XFER_SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . .
86
6.8.2.3
BB_ON_TIMER_PERIOD . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
86
Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
87
6.8.3.1
bb_alt_mode_status_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
87
6.8.3.2
bb_cause_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
87
6.8.3.3
bb_state_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
87
6.8.3.4
bb_type_t
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
87
6.8.3.5
bb_usb_string_index_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
88
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
88
6.8.4.1
bb_disable(uint8_t port, bool force) . . . . . . . . . . . . . . . . . . . . . . . .
88
6.8.4.2
bb_enable(uint8_t port, bb_cause_t cause) . . . . . . . . . . . . . . . . . . . .
88
6.8.4.3
bb_enabling_flashing(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . .
89
6.8.4.4
bb_init(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
89
6.8.4.5
bb_is_present(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . .
89
6.8.4.6
bb_task(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
90
6.8.4.7
bb_update_alt_status(uint8_t port, uint8_t mode_index, bb_alt_mode_status_←t alt_status) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
90
app/hal_ccgx.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
90
6.9.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
91
6.9.2
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
91
6.9.2.1
system_init(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
91
6.9.2.2
system_vbus_ocp_dis(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . .
91
6.9.2.3
system_vbus_ocp_en(uint8_t port, vbus_ocp_cbk_t cbk) . . . . . . . . . . . . .
91
6.9.2.4
vbus_ocp_handler(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . .
91
6.10 app/pdo.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
92
6.8.3
6.8.4
6.9
6.10.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
92
6.10.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
92
6.10.2.1 eval_rdo(uint8_t port, pd_do_t rdo, app_resp_cbk_t app_resp_handler) . . . . .
92
6.10.2.2 eval_src_cap(uint8_t port, const pd_packet_t ∗src_cap, app_resp_cbk_t app_←resp_handler) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
92
6.11 app/psink.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
93
6.11.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
93
6.11.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
93
6.11.2.1 psnk_disable(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
93
6.11.2.2 psnk_enable(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
93
6.11.2.3 psnk_set_current(uint8_t port, uint16_t cur_10mA) . . . . . . . . . . . . . . . .
93
6.11.2.4 psnk_set_voltage(uint8_t port, uint16_t volt_50mV) . . . . . . . . . . . . . . . .
94
6.12 app/psource.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
94
6.12.1 Detailed Description
Generated for CCGx Firmware Stack by Doxygen
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
94
xvi
CONTENTS
6.12.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
94
6.12.2.1 psrc_disable(uint8_t port, pwr_ready_cbk_t pwr_ready_handler) . . . . . . . . .
94
6.12.2.2 psrc_enable(uint8_t port, pwr_ready_cbk_t pwr_ready_handler) . . . . . . . . .
95
6.12.2.3 psrc_set_current(uint8_t port, uint16_t cur_10mA) . . . . . . . . . . . . . . . .
95
6.12.2.4 psrc_set_voltage(uint8_t port, uint16_t volt_50mV) . . . . . . . . . . . . . . . .
95
6.12.2.5 system_vconn_ocp_dis(uint8_t port)
. . . . . . . . . . . . . . . . . . . . . . .
95
6.12.2.6 system_vconn_ocp_en(uint8_t port, PD_ADC_CB_T cbk) . . . . . . . . . . . .
96
6.12.2.7 vbus_discharge_off(uint8_t port)
. . . . . . . . . . . . . . . . . . . . . . . . .
96
6.12.2.8 vbus_discharge_on(uint8_t port)
. . . . . . . . . . . . . . . . . . . . . . . . .
96
6.12.2.9 vbus_is_present(uint8_t port, uint16_t volt, int8 per)
. . . . . . . . . . . . . . .
96
. . . . . . . . . . . . . . . . . . .
97
6.12.2.11 vconn_enable(uint8_t port, uint8_t channel) . . . . . . . . . . . . . . . . . . . .
97
6.12.2.12 vconn_is_present(uint8_t port)
. . . . . . . . . . . . . . . . . . . . . . . . . .
97
6.13 app/swap.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
97
6.12.2.10 vconn_disable(uint8_t port, uint8_t channel)
6.13.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
98
6.13.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
98
6.13.2.1 eval_dr_swap(uint8_t port, app_resp_cbk_t app_resp_handler)
. . . . . . . . .
98
6.13.2.2 eval_pr_swap(uint8_t port, app_resp_cbk_t app_resp_handler)
. . . . . . . . .
98
6.13.2.3 eval_vconn_swap(uint8_t port, app_resp_cbk_t app_resp_handler) . . . . . . .
98
6.14 app/usb_vendor.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
99
6.14.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
99
6.14.2 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
99
6.14.2.1 usb_vendor_cmd_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
99
6.14.3 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
6.14.3.1 usb_vendor_flashing_rqt_handler(usb_setup_pkt_t ∗pkt) . . . . . . . . . . . . . 100
6.14.3.2 usb_vendor_get_ep0_buffer(void) . . . . . . . . . . . . . . . . . . . . . . . . . 101
6.15 app/uvdm.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
6.15.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
6.15.2 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
6.15.2.1 uvdm_response_state_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
6.15.3 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
6.15.3.1 uvdm_enter_cy_alt_mode(void) . . . . . . . . . . . . . . . . . . . . . . . . . . 102
6.15.3.2 uvdm_exit_cy_alt_mode(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
6.15.3.3 uvdm_get_flashing_mode(void) . . . . . . . . . . . . . . . . . . . . . . . . . . 103
6.15.3.4 uvdm_handle_cmd(uint16_t vid, uvdm_cmd_opcode_t cmd_opCode, uint8_←t ∗cmd_param, uint8_t cmd_length, uint8_t seq_num, pd_do_t ∗∗vdm_rspn_pkt,
uint8_t ∗vdo_count) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
6.16 app/vdm.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
6.16.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
6.16.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Generated for CCGx Firmware Stack by Doxygen
CONTENTS
xvii
6.16.2.1 eval_vdm(uint8_t port, const pd_packet_t ∗vdm, vdm_resp_cbk_t vdm_resp_←handler) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
6.16.2.2 vdm_data_init(uint8_t port)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
6.16.2.3 vdm_update_data(uint8_t port, uint8_t id_vdo_cnt, uint8_t ∗id_vdo_p, uint8_←t svid_vdo_cnt, uint8_t ∗svid_vdo_p, uint16_t mode_resp_len, uint8_t ∗mode_←resp_p) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
6.17 ar_slave/ar_slave.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
6.17.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
6.17.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6.17.2.1 AR_SLAVE_ADDR_MASK
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6.17.3 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6.17.3.1 ar_slave_reg_addr_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6.17.4 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6.17.4.1 ar_slave_init(uint8_t ar_scbnum)
. . . . . . . . . . . . . . . . . . . . . . . . . 106
6.17.4.2 ar_slave_sleep(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6.17.4.3 ar_slave_status_update(uint8_t port, uint32_t status) . . . . . . . . . . . . . . . 107
6.18 hpiss/hpi.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
6.18.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.18.2 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.18.2.1 hpi_reg_part_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.18.2.2 hpi_reg_section_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.18.3 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.18.3.1 hpi_get_port_enable(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.18.3.2 hpi_init(uint8_t scb_idx) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.18.3.3 hpi_is_ec_ready(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
6.18.3.4 hpi_is_vdm_ec_ctrl_enabled(uint8_t port) . . . . . . . . . . . . . . . . . . . . . 109
6.18.3.5 hpi_pd_event_handler(uint8_t port, app_evt_t evt, const void ∗data) . . . . . . . 109
6.18.3.6 hpi_reg_enqueue_event(hpi_reg_section_t section, uint8_t status, uint8_t length,
uint8_t ∗data) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
6.18.3.7 hpi_send_fw_ready_event(void) . . . . . . . . . . . . . . . . . . . . . . . . . . 110
6.18.3.8 hpi_set_fixed_slave_address(uint8_t slave_addr) . . . . . . . . . . . . . . . . . 110
6.18.3.9 hpi_set_mode_regs(uint8_t dev_mode, uint8_t mode_reason) . . . . . . . . . . 110
6.18.3.10 hpi_set_no_boot_mode(bool enable) . . . . . . . . . . . . . . . . . . . . . . . 110
6.18.3.11 hpi_set_reserved_reg(uint8_t offset, uint8_t value) . . . . . . . . . . . . . . . . 111
6.18.3.12 hpi_sleep(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
6.18.3.13 hpi_sleep_allowed(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
6.18.3.14 hpi_task(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
6.18.3.15 hpi_update_fw_locations(uint16_t fw1_location, uint16_t fw2_location)
. . . . . 112
6.18.3.16 hpi_update_versions(uint8_t ∗bl_version, uint8_t ∗fw1_version, uint8_t ∗fw2_←version) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
6.18.3.17 hpid_get_ec_active_modes(uint8_t port) . . . . . . . . . . . . . . . . . . . . . 112
Generated for CCGx Firmware Stack by Doxygen
xviii
CONTENTS
6.19 pd_common/dpm.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
6.19.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
6.19.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
6.19.2.1 dpm_deepsleep(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
6.19.2.2 dpm_get_info(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
6.19.2.3 dpm_get_polarity(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
6.19.2.4 dpm_init(uint8_t port, app_cbk_t ∗app_cbk) . . . . . . . . . . . . . . . . . . . . 114
6.19.2.5 dpm_is_rdo_valid(uint8_t port, pd_do_t rdo)
. . . . . . . . . . . . . . . . . . . 114
6.19.2.6 dpm_pd_command(uint8_t port, dpm_pd_cmd_t cmd, dpm_pd_cmd_buf_←t ∗buf_ptr, dpm_pd_cmd_cbk_t cmd_cbk) . . . . . . . . . . . . . . . . . . . . . 114
6.19.2.7 dpm_sleep(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
6.19.2.8 dpm_start(uint8_t port)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
6.19.2.9 dpm_stop(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
6.19.2.10 dpm_task(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
6.19.2.11 dpm_typec_command(uint8_t port, dpm_typec_cmd_t cmd, dpm_typec_cmd_←cbk_t cmd_cbk) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
6.19.2.12 dpm_typec_deassert_rp_rd(uint8_t port, uint8_t channel)
. . . . . . . . . . . . 116
6.19.2.13 dpm_update_db_support(uint8_t port, bool enable) . . . . . . . . . . . . . . . . 116
6.19.2.14 dpm_update_port_config(uint8_t port, uint8_t role, uint8_t dflt_role, uint8_←t toggle_en, uint8_t try_src_en) . . . . . . . . . . . . . . . . . . . . . . . . . . 117
6.19.2.15 dpm_update_snk_cap(uint8_t port, uint8_t count, pd_do_t ∗pdo) . . . . . . . . . 117
6.19.2.16 dpm_update_snk_cap_mask(uint8_t port, uint8_t mask) . . . . . . . . . . . . . 117
6.19.2.17 dpm_update_snk_max_min(uint8_t port, uint8_t count, uint16_t ∗max_min) . . . 118
6.19.2.18 dpm_update_src_cap(uint8_t port, uint8_t count, pd_do_t ∗pdo) . . . . . . . . . 118
6.19.2.19 dpm_update_src_cap_mask(uint8_t port, uint8_t mask) . . . . . . . . . . . . . 118
6.19.2.20 dpm_update_swap_response(uint8_t port, uint8_t value) . . . . . . . . . . . . . 118
6.19.2.21 dpm_wakeup(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
6.20 pd_common/dpm_intern.h File Reference
6.20.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
6.20.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
6.20.2.1 dpm_get_evtno_n_clear(uint8_t max_events, volatile uint32_t ∗evt_ptr) . . . . . 119
6.20.2.2 dpm_get_status(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
6.20.2.3 dpm_is_prev_contract_valid(uint8_t port) . . . . . . . . . . . . . . . . . . . . . 120
6.20.2.4 dpm_refresh_snk_cap(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . 120
6.20.2.5 dpm_refresh_src_cap(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . 120
6.21 pd_common/hpd.h File Reference
6.21.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
6.21.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
6.21.2.1 HPD_EVENT_MASK
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
6.21.3 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
6.21.3.1 hpd_event_type_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Generated for CCGx Firmware Stack by Doxygen
CONTENTS
xix
6.21.4 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
6.21.4.1 hpd_deinit(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
6.21.4.2 hpd_receive_init(uint8_t port, hpd_event_cbk_t cbk) . . . . . . . . . . . . . . . 122
6.21.4.3 hpd_sleep_entry(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
6.21.4.4 hpd_transmit_init(uint8_t port, hpd_event_cbk_t cbk) . . . . . . . . . . . . . . . 123
6.21.4.5 hpd_transmit_sendevt(uint8_t port, hpd_event_type_t evtype, bool wait) . . . . . 123
6.21.4.6 hpd_wakeup(uint8_t port, bool value) . . . . . . . . . . . . . . . . . . . . . . . 123
6.22 pd_common/pd.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
6.22.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
6.22.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
6.22.2.1 DRP_TOGGLE_PERIOD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
6.22.2.2 PD_HEADER
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
6.22.2.3 SRC_DRP_MIN_DC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
6.22.2.4 STD_VDM_HEADER_IDENTITY_REQ . . . . . . . . . . . . . . . . . . . . . . 132
6.22.2.5 STD_VDM_HEADER_SVID_REQ . . . . . . . . . . . . . . . . . . . . . . . . . 132
6.22.3 Typedef Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
6.22.3.1 pd_cbk_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
6.22.4 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
6.22.4.1 typec_generic_fsm_state_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
6.22.5 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
6.22.5.1 get_pd_config(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
6.22.5.2 get_pd_port_config(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . 133
6.23 pd_common/pd_policy_engine.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
6.23.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
6.23.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
6.23.2.1 pe_fsm(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
6.23.2.2 pe_init(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
6.23.2.3 pe_is_busy(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
6.23.2.4 pe_start(uint8_t port)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
6.23.2.5 pe_stop(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
6.24 pd_common/pd_protocol.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
6.24.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
6.24.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
6.24.2.1 pd_prot_dis_bist_cm2(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . 135
6.24.2.2 pd_prot_dis_bist_test_data(uint8_t port)
. . . . . . . . . . . . . . . . . . . . . 135
6.24.2.3 pd_prot_en_bist_cm2(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . 136
6.24.2.4 pd_prot_en_bist_test_data(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . 136
6.24.2.5 pd_prot_get_rx_packet(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . 136
6.24.2.6 pd_prot_init(uint8_t port, pd_cbk_t cbk) . . . . . . . . . . . . . . . . . . . . . . 136
6.24.2.7 pd_prot_is_busy(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Generated for CCGx Firmware Stack by Doxygen
xx
CONTENTS
6.24.2.8 pd_prot_refresh_roles(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . 137
6.24.2.9 pd_prot_reset(uint8_t port, sop_t sop) . . . . . . . . . . . . . . . . . . . . . . . 137
6.24.2.10 pd_prot_reset_all(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
6.24.2.11 pd_prot_rx_dis(uint8_t port, uint8_t hard_reset_en) . . . . . . . . . . . . . . . . 138
6.24.2.12 pd_prot_rx_en(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
6.24.2.13 pd_prot_send_cable_reset(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . 138
6.24.2.14 pd_prot_send_ctrl_msg(uint8_t port, sop_t sop, ctrl_msg_t msg_type) . . . . . . 138
6.24.2.15 pd_prot_send_data_msg(uint8_t port, sop_t sop, data_msg_t msg_type, uint8_t
count, pd_do_t ∗dobj) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
6.24.2.16 pd_prot_send_hard_reset(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . 139
6.24.2.17 pd_prot_set_avoid_retry(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . 139
6.24.2.18 pd_prot_start(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
6.24.2.19 pd_prot_stop(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
6.25 pd_common/pdss_hal.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
6.25.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
6.25.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
6.25.2.1 AUTO_CTRL_MESSAGE_GOODCRC_MASK_CFG . . . . . . . . . . . . . . . 143
6.25.2.2 BUS_IDLE_CNT_VAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
6.25.2.3 CRC_COUNTER_CFG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
6.25.2.4 EXPECTED_GOOD_CRC_CLEAR_MASK . . . . . . . . . . . . . . . . . . . . 143
6.25.2.5 EXPECTED_GOOD_CRC_HDR_MASK . . . . . . . . . . . . . . . . . . . . . 143
6.25.2.6 LOWER_LIMIT_IDX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
6.25.2.7 PD_ADC_BAND_GAP_VOLT_MV
. . . . . . . . . . . . . . . . . . . . . . . . 143
6.25.2.8 PD_ADC_DEFAULT_VDDD_VOLT_MV
. . . . . . . . . . . . . . . . . . . . . 143
6.25.2.9 PD_ADC_LEVEL_MIN_THRESHOLD . . . . . . . . . . . . . . . . . . . . . . . 143
6.25.2.10 PD_ADC_MAX_VALUE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
6.25.2.11 PD_ADC_NUM_LEVELS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
6.25.2.12 PD_ADC_TIMEOUT_COUNT . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
6.25.2.13 PD_CMP_VSEL_0_2_V . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
6.25.2.14 PD_INTR_MASK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
6.25.2.15 RCV_INTR_MASK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
6.25.2.16 RD_ROW_NO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
6.25.2.17 RP_COL_WIDTH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
6.25.2.18 RST_TX_INTERRUPTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
6.25.2.19 RX_CC_CFG
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
6.25.2.20 RX_CNT_MAX_VAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
6.25.2.21 RX_INTERRUPTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
6.25.2.22 RX_ORDER_SET_CTRL_CFG . . . . . . . . . . . . . . . . . . . . . . . . . . 145
6.25.2.23 RX_SOP_GOOD_CRC_EN_CTRL_CFG . . . . . . . . . . . . . . . . . . . . . 145
6.25.2.24 TX_INTERRUPTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Generated for CCGx Firmware Stack by Doxygen
CONTENTS
xxi
6.25.3 Typedef Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
6.25.3.1 PD_ADC_CB_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
6.25.4 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
6.25.4.1 PD_ADC_ID_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
6.25.4.2 PD_ADC_INPUT_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
6.25.4.3 PD_ADC_INT_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
6.25.4.4 pd_phy_evt_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
6.25.5 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
6.25.5.1 pd_adc_calibrate(uint8_t port, PD_ADC_ID_T adc_id) . . . . . . . . . . . . . . 147
6.25.5.2 pd_adc_comparator_ctrl(uint8_t port, PD_ADC_ID_T adc_id, PD_ADC_INPU←T_T input, uint8_t level, PD_ADC_INT_T int_cfg, PD_ADC_CB_T cb) . . . . . . 147
6.25.5.3 pd_adc_comparator_sample(uint8_t port, PD_ADC_ID_T adc_id, PD_ADC_IN←PUT_T input, uint8_t level) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
6.25.5.4 pd_adc_get_comparator_status(uint8_t port, PD_ADC_ID_T adc_id) . . . . . . 148
6.25.5.5 pd_adc_init(uint8_t port, PD_ADC_ID_T adc_id) . . . . . . . . . . . . . . . . . 148
6.25.5.6 pd_adc_level_to_volt(uint8_t port, PD_ADC_ID_T adc_id, uint8_t level) . . . . . 149
6.25.5.7 pd_adc_sample(uint8_t port, PD_ADC_ID_T adc_id, PD_ADC_INPUT_T input) . 149
6.25.5.8 pd_adc_volt_to_level(uint8_t port, PD_ADC_ID_T adc_id, uint16_t volt) . . . . . 149
6.25.5.9 pd_get_vbus_adc_level(uint8_t port, PD_ADC_ID_T adc_id, uint16_t volt, int8_t
per) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
6.25.5.10 pd_hal_init(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
6.25.5.11 pd_hal_set_vbus_detach_params(PD_ADC_ID_T adc_id, PD_ADC_INPUT_←T adc_inp) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
6.25.5.12 pd_hal_set_vbus_mon_divider(uint8_t divider) . . . . . . . . . . . . . . . . . . 150
6.25.5.13 pd_hal_set_vbus_off_margin(int8_t margin) . . . . . . . . . . . . . . . . . . . . 151
6.25.5.14 pd_is_vconn_present(uint8_t port, uint8_t channel) . . . . . . . . . . . . . . . . 151
6.25.5.15 pd_phy_abort_bist_cm2(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . 151
6.25.5.16 pd_phy_abort_tx_msg(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . 151
6.25.5.17 pd_phy_deepsleep(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . 152
6.25.5.18 pd_phy_get_rx_packet(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . 152
6.25.5.19 pd_phy_init(uint8_t port, pd_phy_cbk_t cbk)
. . . . . . . . . . . . . . . . . . . 152
6.25.5.20 pd_phy_is_busy(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
6.25.5.21 pd_phy_load_msg(uint8_t port, sop_t sop, uint8_t retries, uint32_t ∗buf) . . . . . 153
6.25.5.22 pd_phy_refresh_roles(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . 153
6.25.5.23 pd_phy_send_bist_cm2(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . 153
6.25.5.24 pd_phy_send_msg(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . 154
6.25.5.25 pd_phy_send_reset(uint8_t port, sop_t sop)
. . . . . . . . . . . . . . . . . . . 154
6.25.5.26 pd_phy_wakeup(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
6.25.5.27 pd_typec_dis_dpslp_rp(uint8_t port)
. . . . . . . . . . . . . . . . . . . . . . . 154
6.25.5.28 pd_typec_dis_rd(uint8_t port, uint8_t channel) . . . . . . . . . . . . . . . . . . 155
6.25.5.29 pd_typec_dis_rp(uint8_t port, uint8_t channel) . . . . . . . . . . . . . . . . . . 155
Generated for CCGx Firmware Stack by Doxygen
xxii
CONTENTS
6.25.5.30 pd_typec_en_dpslp_rp(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . 155
6.25.5.31 pd_typec_en_rd(uint8_t port, uint8_t channel)
. . . . . . . . . . . . . . . . . . 155
6.25.5.32 pd_typec_en_rp(uint8_t port, uint8_t channel, rp_term_t rp_val) . . . . . . . . . 156
6.25.5.33 pd_typec_get_cc_status(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . 156
6.25.5.34 pd_typec_init(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
6.25.5.35 pd_typec_set_polarity(uint8_t port, bool polarity) . . . . . . . . . . . . . . . . . 156
6.25.5.36 pd_typec_snk_update_trim(uint8_t port)
. . . . . . . . . . . . . . . . . . . . . 157
6.25.5.37 pd_typec_start(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
6.25.5.38 pd_typec_stop(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
6.25.5.39 pd_vconn_disable(uint8_t port, uint8_t channel)
. . . . . . . . . . . . . . . . . 157
6.25.5.40 pd_vconn_enable(uint8_t port, uint8_t channel) . . . . . . . . . . . . . . . . . . 158
6.26 pd_common/typec_manager.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
6.26.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
6.26.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
6.26.2.1 typec_assert_rd(uint8_t port, uint8_t channel)
. . . . . . . . . . . . . . . . . . 158
6.26.2.2 typec_assert_rp(uint8_t port, uint8_t channel)
. . . . . . . . . . . . . . . . . . 159
6.26.2.3 typec_deepsleep(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
6.26.2.4 typec_fsm(uint8_t port)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
6.26.2.5 typec_init(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
6.26.2.6 typec_is_busy(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
6.26.2.7 typec_start(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
6.26.2.8 typec_stop(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
6.26.2.9 typec_wakeup(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
6.27 scb/i2c.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
6.27.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
6.27.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
6.27.2.1 I2C_BLOCK_COUNT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
6.27.3 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
6.27.3.1 i2c_cb_cmd_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
6.27.3.2 i2c_scb_clock_freq_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
6.27.3.3 i2c_scb_mode_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
6.27.3.4 i2c_scb_state_t
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
6.27.4 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
6.27.4.1 i2c_reset(uint8_t scb_index) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
6.27.4.2 i2c_scb_enable_wakeup(uint8_t scb_index) . . . . . . . . . . . . . . . . . . . . 163
6.27.4.3 i2c_scb_init(uint8_t scb_index, i2c_scb_mode_t mode, i2c_scb_clock_freq_←t clock_freq, uint8_t slave_addr, uint8_t slave_mask, i2c_cb_fun_t cb_fun_ptr,
uint8_t ∗scratch_buffer, uint16_t scratch_buffer_size) . . . . . . . . . . . . . . . 163
6.27.4.4 i2c_scb_is_idle(uint8_t scb_index)
. . . . . . . . . . . . . . . . . . . . . . . . 164
6.27.4.5 i2c_scb_write(uint8_t scb_index, uint8_t ∗source_ptr, uint8_t size, uint8_t ∗count) 164
Generated for CCGx Firmware Stack by Doxygen
CONTENTS
xxiii
6.27.4.6 i2c_slave_ack_ctrl(uint8_t scb_index, bool enable) . . . . . . . . . . . . . . . . 164
6.28 system/boot.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
6.28.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
6.28.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
6.28.2.1 boot_check_for_valid_fw(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
6.28.2.2 boot_get_boot_seq(uint8_t fwid) . . . . . . . . . . . . . . . . . . . . . . . . . . 166
6.28.2.3 boot_get_wait_time(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
6.28.2.4 boot_handle_validate_fw_cmd(uint8_t fw_mode) . . . . . . . . . . . . . . . . . 166
6.28.2.5 boot_jump_to_fw(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
6.28.2.6 boot_start(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
6.28.2.7 boot_validate_configtable(uint8_t ∗table_p) . . . . . . . . . . . . . . . . . . . . 167
6.28.2.8 boot_validate_fw(sys_fw_metadata_t ∗fw_metadata) . . . . . . . . . . . . . . . 167
6.28.2.9 get_boot_mode_reason(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
6.29 system/ccg4_version.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
6.29.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
6.29.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
6.29.2.1 FW_BASE_VERSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
6.30 system/ccgx_api_desc.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
6.30.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
6.31 system/flash.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
6.31.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
6.31.2 Typedef Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
6.31.2.1 flash_cbk_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
6.31.3 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
6.31.3.1 flash_app_priority_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
6.31.3.2 flash_interface_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
6.31.3.3 flash_write_status_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
6.31.4 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
6.31.4.1 flash_access_enabled(uint8_t modes) . . . . . . . . . . . . . . . . . . . . . . . 170
6.31.4.2 flash_enter_mode(bool is_enable, flash_interface_t mode) . . . . . . . . . . . . 171
6.31.4.3 flash_row_clear(uint16_t row_num) . . . . . . . . . . . . . . . . . . . . . . . . 171
6.31.4.4 flash_row_read(uint16_t row_num, uint8_t ∗data) . . . . . . . . . . . . . . . . . 171
6.31.4.5 flash_row_write(uint16_t row_num, uint8_t ∗data, flash_cbk_t cbk) . . . . . . . . 172
6.31.4.6 flash_set_access_limits(uint16_t start_row, uint16_t last_row, uint16_t md_row,
uint16_t bl_last_row) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
6.31.4.7 flash_set_app_priority(flash_app_priority_t app_priority) . . . . . . . . . . . . . 172
6.32 system/gpio.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
6.32.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
6.32.2 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
6.32.2.1 gpio_dm_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Generated for CCGx Firmware Stack by Doxygen
xxiv
CONTENTS
6.32.2.2 gpio_intr_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
6.32.2.3 gpio_port_pin_t
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
6.32.2.4 hsiom_mode_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
6.32.3 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
6.32.3.1 gpio_clear_intr(gpio_port_pin_t port_pin) . . . . . . . . . . . . . . . . . . . . . 176
6.32.3.2 gpio_get_intr(gpio_port_pin_t port_pin) . . . . . . . . . . . . . . . . . . . . . . 176
6.32.3.3 gpio_hsiom_set_config(gpio_port_pin_t port_pin, hsiom_mode_t hsiom_mode,
gpio_dm_t drv_mode, bool value) . . . . . . . . . . . . . . . . . . . . . . . . . 178
6.32.3.4 gpio_int_set_config(gpio_port_pin_t port_pin, uint8_t int_mode) . . . . . . . . . 178
6.32.3.5 gpio_read_value(gpio_port_pin_t port_pin) . . . . . . . . . . . . . . . . . . . . 178
6.32.3.6 gpio_set_drv_mode(gpio_port_pin_t port_pin, gpio_dm_t drv_mode) . . . . . . 179
6.32.3.7 gpio_set_lvttl_mode(uint8_t port) . . . . . . . . . . . . . . . . . . . . . . . . . 179
6.32.3.8 gpio_set_value(gpio_port_pin_t port_pin, bool value) . . . . . . . . . . . . . . . 179
6.32.3.9 hsiom_set_config(gpio_port_pin_t port_pin, hsiom_mode_t hsiom_mode) . . . . 180
6.33 system/status.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
6.33.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
6.33.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
6.33.2.1 CCG_STATUS_CODE_OFFSET . . . . . . . . . . . . . . . . . . . . . . . . . 181
6.33.3 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
6.33.3.1 ccg_status_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
6.34 system/system.h File Reference
6.34.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
6.34.2 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
6.34.2.1 sys_fw_mode_t
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
6.34.3 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
6.34.3.1 sys_get_boot_version(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
6.34.3.2 sys_get_device_mode(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
6.34.3.3 sys_get_fw_img1_start_addr(void) . . . . . . . . . . . . . . . . . . . . . . . . 183
6.34.3.4 sys_get_fw_img2_start_addr(void) . . . . . . . . . . . . . . . . . . . . . . . . 183
6.34.3.5 sys_get_img1_fw_version(void) . . . . . . . . . . . . . . . . . . . . . . . . . . 183
6.34.3.6 sys_get_img2_fw_version(void) . . . . . . . . . . . . . . . . . . . . . . . . . . 184
6.34.3.7 sys_get_recent_fw_image(void) . . . . . . . . . . . . . . . . . . . . . . . . . . 184
6.34.3.8 sys_get_silicon_id(uint32_t ∗silicon_id) . . . . . . . . . . . . . . . . . . . . . . 184
6.34.3.9 sys_set_device_mode(sys_fw_mode_t fw_mode) . . . . . . . . . . . . . . . . . 184
6.35 system/timer.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
6.35.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
6.35.2 Typedef Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
6.35.2.1 timer_cb_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
6.35.2.2 timer_id_t
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
6.35.3 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Generated for CCGx Firmware Stack by Doxygen
CONTENTS
xxv
6.35.3.1 timer_enter_sleep(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
6.35.3.2 timer_get_count(uint8_t instance, timer_id_t id) . . . . . . . . . . . . . . . . . . 186
6.35.3.3 timer_init(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
6.35.3.4 timer_is_running(uint8_t instance, timer_id_t id)
. . . . . . . . . . . . . . . . . 186
6.35.3.5 timer_num_active(uint8_t instance) . . . . . . . . . . . . . . . . . . . . . . . . 187
6.35.3.6 timer_start(uint8_t instance, timer_id_t id, uint16_t period, timer_cb_t cb) . . . . 187
6.35.3.7 timer_stop(uint8_t instance, timer_id_t id) . . . . . . . . . . . . . . . . . . . . . 187
6.35.3.8 timer_stop_all(uint8_t instance) . . . . . . . . . . . . . . . . . . . . . . . . . . 187
6.35.3.9 timer_stop_range(uint8_t instance, timer_id_t start, timer_id_t stop) . . . . . . . 188
6.36 system/utils.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
6.36.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.36.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.36.2.1 MAKE_DWORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.36.3 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.36.3.1 crc16(uint16_t crc, uint8_t data) . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.36.3.2 mem_calculate_byte_checksum(uint8_t ∗ptr, uint32_t size) . . . . . . . . . . . . 189
6.36.3.3 mem_calculate_dword_checksum(uint32_t ∗ptr, uint32_t size) . . . . . . . . . . 190
6.36.3.4 mem_calculate_word_checksum(uint16_t ∗ptr, uint32_t size) . . . . . . . . . . . 190
Index
Generated for CCGx Firmware Stack by Doxygen
191
Chapter 1
CCGx Firmware Stack: API Reference Guide
1.1
Introduction
USB Type-C is the new USB-IF standard that solves several challenges faced when using today's Type-A and TypeB cables and connectors. USB Type-C uses a slimmer connector (measuring only 2.4-mm in height) to allow for
increasing miniaturization of consumer and industrial products. The USB Type-C standard is gaining rapid support
by enabling small form-factor, easy-to-use connectors and cables with the ability to transmit multiple protocols and
offer power delivery up to 100 W – a significant improvement over the 7.5 W possible using previous standards.
1.1.1
USB Type-C Highlights
• Brand new reversible connector, measuring only 2.4-mm in height.
• Compliant with USB Power Delivery 2.0, providing up to 100 W.
• Double the bandwidth of USB 3.0, increasing to 10 Gbps with SuperSpeedPlus USB3.1.
• Combines multiple protocols in a single cable, including DisplayPort™, PCIe® or Thunderbolt™.
1.2
Cypress EZ-PD™ Type-C Controllers
Cypress provides the EZ-PD™ family of USB Type-C controllers which can help implement various Type-C applications. Cypress’s Type-C controllers are based on Cypress’s PSoC® 4 programmable system-on-chip architecture,
which includes programmable analog and digital blocks, an ARM® Cortex®-M0 core and 32 to 128 KB of flash
memory.
This product family is driving the industry’s first Type-C products with top-tier PC makers, enabling them to bring
these USB Type-C benefits to market. Cypress has reference designs readily available for EMCA and dongle
applications. These are available online and could be used to speed-up our customers design cycle.
1.2.1
CCGx Product Families
The EZ-PD CCGx product line consists of the following product families:
• EZ-PD™ CCG1: Industry’s First Programmable Type-C Port Controller
• EZ-PD™ CCG2: Industry’s Smallest Programmable Type-C Port Controller
• EZ-PD™ CCG3: Industry’s Most Integrated Type-C Port Controller
• EZ-PD™ CCG4: Industry’s First Dual-Port Type-C Port Controller
2
CCGx Firmware Stack: API Reference Guide
1.3
CCGx Firmware Stack
The CCGx product families are supported by a robust firmware stack which includes:
1. USB Type-C and USB-PD specification compliant PD stack.
2. Drivers for the various hardware blocks on the CCGx controllers.
3. Implementation of a Host Processor Interface (HPI) that allows an external embedded controller to monitor
and control the CCGx device operation.
4. Implementation of the DisplayPort Alternate Mode that allows transfer of video signals over the Type-C data
lanes.
The CCGx firmware stack has been certified as Type-C and USB-PD revision 2.0 specification compliant during
USB-IF inter-operability workshops.
This version of the CCGx Firmware Stack supports the CCG4 product family and is targeted at implementing U←SB-PD port controllers for desktops and notebooks. Future versions of the firmware stack will add support for the
CCG3 product family and other USB-PD applications such as Power Adapters and Dock designs.
1.3.1
Firmware Stack Organization
The CCGx firmware stack is provided in source form with the SDK. The firmware files are organized into the following
directory structure:
• system: The system folder contains header and source files relating to the CCGx device hardware and
registers, boot-loader and flash access functions, low level drivers for the GPIO and USB-PD blocks on the
CCGx device, and a soft timer implementation that is used by the firmware stack.
• scb: The scb folder contains the header files implementing the public interfaces provided by the I2C slave
mode driver module. This slave mode module is used by the HPI Protocol layer as well as the Intel Alpine
Ridge slave module.
• hpiss: The hpiss folder contains header files implementing the public interfaces provided by the HPI protocol
module. HPI provides a register based interface through which the EC can manage the power contracts, send
and receive VDMs and perform flash read/write operations. Please contact Cypress for more details about
the HPI interface and its capabilities.
• ar_slave: The ar_slave folder contains the I2C slave based implementation of the PD controller interface
module to an Intel Alpine Ridge controller.
• pd_common: The pd_common folder contains the header files implementing the public interfaces provided
by the PD stack module. This includes the Hardware Adaptation Layer (HAL), the Type-C port manager, the
USB-PD protocol layer, the USB-PD policy engine and the Device Policy Manager. As the CYPD4225-40←LQXI device has two USB-PD ports, the stack allows both of these ports to function and be managed in a
completely independent manner.
• app: The app folder contains the top-level application layer functionality that implements the USB-PD controller functions required. This includes functionality such as PDO evaluation and contract negotiation, VDM
handling for both DFP and UFP roles, handling of control messages like role swap; and alternate mode
discovery and negotiation. The alternate mode specific implementation can be found in the app/alt_mode
directory.
Generated for CCGx Firmware Stack by Doxygen
Chapter 2
CCGx Firmware Architecture
The CCGx firmware solution allows users to implement a variety of USB-PD applications using the CCG4 device
and a fully tested firmware stack.
The CCGx firmware solution contains the following components:
• Hardware Abstraction Layer (HAL): This includes the low level drivers for the various hardware blocks on the
CCG4 device. This includes drivers for the Type-C and USB-PD block, Serial Communication Blocks (SCBs),
GPIOs, flash module and timer module.
• USB Type-C and USB-PD Protocol Stack: This is the complete USB-PD protocol stack that includes the
Type-C and USB-PD port managers, USB-PD protocol layer, the USB-PD policy engine and the device policy
manager. The device policy manager is designed to allow all policy decisions to be made at the application
level, either on an external Embedded Controller (EC) or in the CCG4 firmware itself.
• Firmware update module: This is a firmware module that allows the device firmware maintained in internal
flash to be updated. In Notebook PD port controller applications, the firmware update will be done from the
EC side through an I2C interface.
• Host Processor Interface (HPI): The Host Processor Interface (HPI) is an I2C based control interface that
allows an Embedded Controller (EC) to monitor and control the USB-PD port on the CCG4 device. The HPI
is the means to allow the PC platform to control the PD policy management.
• Port Management: This module handles all of the PD port management functions including the algorithm for
optimal contract negotiations, source and sink power control, source voltage selection, port role assignment
and swap request handling.
• Alternate Modes: This module implements the alternate mode handling for CCG4 as a DFP and UFP. A fully
tested implementation of DisplayPort alternate mode with CCG4 as DFP is provided. The module also allows
users to implement their own alternate mode support in both DFP and UFP modes.
• Low Power: This module attempts to keep the CCG4 device in the low power standby mode as often as
possible to minimize power consumption.
• External Hardware Control: This is an hardware design dependent module which controls the external hardware blocks such as FETs, regulators and Type-C switches.
• Solution specific tasks: This is an application layer module where any custom tasks required by the user
solution can be implemented.
A block diagram of the CCGx firmware architecture is shown below.
4
CCGx Firmware Architecture
Figure 2.1: CCGx Firmware Stack Block Diagram
2.1
CCGx Firmware Solution Structure
The CCGx firmware solution is broken down into multiple layers:
• Hardware Adaptation Layer: The HAL is the lowest driver layer for the CCG4 device. The HAL code is
provided in source form and can be located under the system folder in the CCGx firmware project.
• USB-PD Stack: The USB-PD stack includes the Type-C and PD managers, the PD protocol, policy engine
and device policy manager blocks. The USB-PD stack is provided in the form of a pre-compiled library.
• Application Layer: The application layer includes the PD port management, HPI implementation, alternate
modes and low power mode support. The HPI module is privided in the form of a pre-compiled library. The
rest of the application layer is provided in source form; and can be located under the app and alt_mode folders
in the CCGx firmware project.
• Solution Layer: The solution layer includes external hardware management, the main task loop and any user
application specific functionality. A reference implementation is provided under the solution folder in the CCGx
firmware project; and is expected to be customized by users.
The CCGx firmware solution structure is shown below.
Generated for CCGx Firmware Stack by Doxygen
2.2 Public API Summary
5
Figure 2.2: CCGx Firmware Solution Structure
2.2
Public API Summary
This document describes all of the data structures and functions that are part of the CCGx firmware stack. Many of
these functions are intended to be used internally by the stack layers. The main public interfaces that are expected
to be used by user code are summarized in this section.
2.2.1
Device Policy Manager (DPM) API
The Device Policy Manager (DPM) APIs are the public interfaces to the PD stack. These APIs include:
• dpm_init()
• dpm_start()
• dpm_stop()
• dpm_deepsleep()
• dpm_wakeup()
• dpm_task()
• dpm_pd_command()
• dpm_typec_command()
Generated for CCGx Firmware Stack by Doxygen
6
CCGx Firmware Architecture
• dpm_get_info()
• dpm_update_swap_response()
• dpm_update_src_cap()
• dpm_update_src_cap_mask()
• dpm_update_snk_cap()
• dpm_update_snk_cap_mask()
• dpm_update_snk_max_min()
• dpm_update_port_config()
• dpm_get_polarity()
• dpm_update_db_support()
• dpm_typec_deassert_rp_rd()
2.2.2
Host Processor Interface (HPI) API
The Host Processor Interface (HPI) API are functions that initialize the HPI register values and help perform message exchanges between CCG and the Embedded Controller (EC).
• hpi_init()
• hpi_send_fw_ready_event()
• hpi_set_no_boot_mode()
• hpi_set_fixed_slave_address()
• hpi_task()
• hpi_reg_enqueue_event()
• hpi_pd_event_handler()
• hpi_update_versions()
• hpi_set_mode_regs()
• hpi_update_fw_locations()
• hpi_sleep_allowed()
• hpi_sleep()
• hpi_get_port_enable()
2.2.3
Application Layer API
The application layer is where the policy management for the CCGx application are implemented. The default
implementations of these functions are based on the configuration table and the parameters provided by EC through
the HPI registers.
• app_init()
• app_task()
• app_event_handler()
Generated for CCGx Firmware Stack by Doxygen
2.2 Public API Summary
7
• app_get_status()
• app_sleep()
• app_wakeup()
• system_sleep()
• eval_src_cap()
• eval_rdo()
• psnk_set_voltage()
• psnk_set_current()
• psnk_enable()
• psnk_disable()
• psrc_set_voltage()
• psrc_set_current()
• psrc_enable()
• psrc_disable()
• vconn_enable()
• vconn_disable()
• vconn_is_present()
• vbus_is_present()
• vbus_discharge_on()
• vbus_discharge_off()
• eval_dr_swap()
• eval_vconn_swap()
• eval_pr_swap()
• vdm_data_init()
• vdm_update_data()
• eval_vdm()
2.2.3.1
Solution Layer Functions
The PD stack requires the user to provide a set of functions that provide the stack configuration and also handle
operations that are hardware dependent. The following functions are expected to be implemented at the solution
layer in user code.
• mux_ctrl_init()
• mux_ctrl_set_cfg()
• sln_pd_event_handler()
• app_get_callback_ptr()
Generated for CCGx Firmware Stack by Doxygen
8
CCGx Firmware Architecture
2.2.4
Alternate Mode Manager API
The following APIs are provided by the CCG Alternate Mode Manager module. Some of these APIs are for use
when CCG is a DFP, and the others are for use when CCG is an UFP.
• enable_vdm_task_mng()
• vdm_task_mng_deinit()
• dfp_vdm_task_idle()
• dfp_vdm_task_mngr()
• eval_attention()
• ufp_alt_mode_mng_deinit()
• ufp_alt_mode_idle()
• ufp_alt_mode_mngr()
• eval_rec_vdm()
2.2.5
Hardware Abstraction Layer (HAL) API
This section documents the API provided as part of the Hardware Adaptation Layer (HAL) which provides drivers
for various hardware blocks on the CCG device.
2.2.5.1
GPIO API
• hsiom_set_config()
• gpio_set_drv_mode()
• gpio_hsiom_set_config()
• gpio_int_set_config()
• gpio_set_value()
• gpio_read_value()
• gpio_get_intr()
• gpio_clear_intr()
2.2.5.2
I2C Driver API
• i2c_scb_init()
• i2c_scb_write()
• i2c_reset()
• i2c_slave_ack_ctrl()
• i2c_scb_is_idle()
• i2c_scb_enable_wakeup()
Generated for CCGx Firmware Stack by Doxygen
2.2 Public API Summary
2.2.5.3
9
Flash Module API
• flash_enter_mode()
• flash_access_enabled()
• flash_set_access_limits()
• flash_row_clear()
• flash_row_write()
• flash_row_read()
2.2.5.4
Soft Timer API
• timer_init()
• timer_start()
• timer_stop()
• timer_is_running()
• timer_stop_all()
• timer_stop_range()
• timer_num_active()
• timer_enter_sleep()
2.2.6
Firmware Update API
These APIs provide the basic boot and firmware upgrade related functions that are used by various firmware update
protocol implementations like HPI and CC unstructured command handlers.
• boot_validate_fw()
• boot_validate_configtable()
• get_boot_mode_reason()
• boot_get_boot_seq()
• sys_set_device_mode()
• sys_get_device_mode()
Please see the detailed description of the APIs in the following chapters. You can also refer to the CCGx SDK User
Guide document that provides some usage examples and guidelines.
Generated for CCGx Firmware Stack by Doxygen
10
CCGx Firmware Architecture
Generated for CCGx Firmware Stack by Doxygen
Chapter 3
Data Structure Index
3.1
Data Structures
Here are the data structures with brief descriptions:
alt_mode_cmd_info_t
This structure holds all necessary information for interaction between alt modes manager and
selected alternative mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
alt_mode_evt_t::ALT_MODE_EVT
Struct containing alternate modes manager event/command . . . . . . . . . . . . . . . . . .
alt_mode_evt_t::ALT_MODE_EVT_DATA
Struct containing alternate modes manager event/command data . . . . . . . . . . . . . . . .
alt_mode_evt_t
Alt modes manager application event/command structure . . . . . . . . . . . . . . . . . . . .
alt_mode_hw_evt_t::ALT_MODE_HW_EVT
Struct containing alternate modes HW event/command . . . . . . . . . . . . . . . . . . . . .
alt_mode_hw_evt_t
Alt mode HW application event/command structure . . . . . . . . . . . . . . . . . . . . . . .
app_cbk_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
app_resp_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
app_status_t
This structure hold all variables related to application layer functionality . . . . . . . . . . . . .
ar_reg_t
Union to hold AR Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
atch_tgt_info_t
Struct holds Discovery info for alt modes manager . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::BAT_SNK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::BAT_SRC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
bb_handle_t
Internal billboard module handle structure . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::BIST_DO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
bm_alt_modes_t
This structure holds bit masks used by alt modes mngr . . . . . . . . . . . . . . . . . . . . .
cc_state_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ccg_timer_t
Structure encapsulating information relating to a software timer . . . . . . . . . . . . . . . . .
comp_tbl_t
This structure are used in alt_modes_config.h file to set alternative modes compatibility and
priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
contract_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
disc_mode_info_t
This structure holds all necessary information on Discovery Mode stage for supported alternative
mode when alt modes manager registers new alt mode . . . . . . . . . . . . . . . . . . . . .
15
17
18
18
19
20
20
21
21
23
23
24
25
25
26
26
27
27
28
29
29
12
Data Structure Index
pd_do_t::DP_CONFIG_VDO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::DP_STATUS_VDO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
dpm_pd_cmd_buf_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
dpm_status_t
PD Device Policy Status structure . . . . . . . . . . . . . . . . . . . . . . .
contract_t::FIELD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::FIXED_SNK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::FIXED_SRC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
fw_img_status_t
Boot mode reason structure . . . . . . . . . . . . . . . . . . . . . . . . . .
fw_img_status_t::FwModeReason . . . . . . . . . . . . . . . . . . . . . . . . . . . .
i2c_scb_config_t
This structure holds all configuration associated with each I2C block . . . . .
pd_config_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_contract_info_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_hdr_t::PD_HDR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_hdr_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_packet_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_port_config_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::RDO_BAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::RDO_BAT_GIVEBACK . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::RDO_FIXED_VAR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::RDO_FIXED_VAR_GIVEBACK . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::RDO_GEN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::RDO_GEN_GVB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::SLICE_SUBHDR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::SLICE_VDO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::SRC_GEN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::STD_AMA_VDO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::STD_CBL_VDO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::STD_CERT_VDO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::STD_DP_VDO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::STD_PROD_VDO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::STD_SVID_RESP_VDO . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::STD_VDM_HDR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::STD_VDM_ID_HDR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
sys_fw_metadata_t
CCGx Firmware metadata structure . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::TBT_VDO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ar_reg_t::USBPD_CMD_REG
Struct containing USB-PD controller command register fields for Alpine Ridge
ar_reg_t::USBPD_STATUS_REG
Struct containing USB-PD controller status to be reported to Alpine Ridge . .
pd_do_t::USTD_VDM_HDR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::VAR_SNK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
pd_do_t::VAR_SRC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vdm_msg_info_t
Struct holds received/sent VDM info . . . . . . . . . . . . . . . . . . . . . .
vdm_resp_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
30
31
31
.
.
.
.
.
.
.
.
32
42
42
42
. . . . . . . . .
. . . . . . . . .
43
43
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
44
45
46
46
47
48
48
48
50
50
50
51
51
51
52
52
52
52
53
53
53
54
54
54
55
. . . . . . . . .
. . . . . . . . .
55
57
. . . . . . . . .
57
.
.
.
.
.
.
.
.
58
60
61
61
. . . . . . . . .
. . . . . . . . .
61
62
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Generated for CCGx Firmware Stack by Doxygen
Chapter 4
File Index
4.1
File List
Here is a list of all documented files with brief descriptions:
app/app.h
PD application handler header file . . . . . . . . . . . . . . . .
app/billboard.h
Billboard control interface header file . . . . . . . . . . . . . . .
app/hal_ccgx.h
PD and Type-C HAL layer for CCG3/CCG4 . . . . . . . . . . .
app/pdo.h
PDO evaluation and handler definitions . . . . . . . . . . . . .
app/psink.h
Power Sink (Consumer) manager header file . . . . . . . . . .
app/psource.h
Power source (Provider) manager header file . . . . . . . . . .
app/swap.h
Swap request (PR_SWAP, DR_SWAP, VCONN_SWAP) handlers
app/usb_vendor.h
USB vendor interface (flashing) header file . . . . . . . . . . . .
app/uvdm.h
Unstructured VDM handler header file . . . . . . . . . . . . . .
app/vdm.h
Vendor Defined Message (VDM) handler header file . . . . . . .
app/alt_mode/alp_ridge.h
Alpine Ridge control interface header file . . . . . . . . . . . . .
app/alt_mode/alt_mode_hw.h
Hardware control for Alternate mode implementation . . . . . .
app/alt_mode/alt_modes_mngr.h
Alternate Mode Manager header file . . . . . . . . . . . . . . .
app/alt_mode/dfp_vdm_task_mngr.h
DFP VDM task manager header file . . . . . . . . . . . . . . .
app/alt_mode/dp_sid.h
DisplayPort alternate mode handler header file . . . . . . . . .
app/alt_mode/intel_vid.h
Thunderbolt (Intel VID) alternate mode handler header file . . .
ar_slave/ar_slave.h
Alpine Ridge I2C slave interface header file . . . . . . . . . . .
hpiss/hpi.h
Host Processor Interface (HPI) header file . . . . . . . . . . . .
pd_common/dpm.h
Device Policy Manager (DPM) header file . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
81
. . . . . . . . . . . . . . . .
85
. . . . . . . . . . . . . . . .
90
. . . . . . . . . . . . . . . .
92
. . . . . . . . . . . . . . . .
93
. . . . . . . . . . . . . . . .
94
. . . . . . . . . . . . . . .
97
. . . . . . . . . . . . . . . .
99
. . . . . . . . . . . . . . . . 101
. . . . . . . . . . . . . . . . 103
. . . . . . . . . . . . . . . .
63
. . . . . . . . . . . . . . . .
64
. . . . . . . . . . . . . . . .
67
. . . . . . . . . . . . . . . .
75
. . . . . . . . . . . . . . . .
78
. . . . . . . . . . . . . . . .
80
. . . . . . . . . . . . . . . . 105
. . . . . . . . . . . . . . . . 107
. . . . . . . . . . . . . . . . 112
14
File Index
pd_common/dpm_intern.h
Stack internal definitions for the Device Policy Manager (DPM) . .
pd_common/hpd.h
Hotplug Detect (HPD) driver header file . . . . . . . . . . . . . .
pd_common/pd.h
Common definitions and structures used in the CCG USB-PD stack
pd_common/pd_policy_engine.h
USB-PD policy engine header file . . . . . . . . . . . . . . . . .
pd_common/pd_protocol.h
USB-PD protocol layer header file . . . . . . . . . . . . . . . . .
pd_common/pdss_hal.h
CCG PD PHY driver module header file . . . . . . . . . . . . . .
pd_common/typec_manager.h
Type-C manager header file . . . . . . . . . . . . . . . . . . . .
scb/i2c.h
I2C slave driver header file . . . . . . . . . . . . . . . . . . . . .
system/boot.h
Boot-loader support header file . . . . . . . . . . . . . . . . . . .
system/ccg4_version.h
This file defines the base firmware stack version for CCG4 . . . .
system/ccgx_api_desc.h
CCGx Firmware API Reference Guide Introduction . . . . . . . .
system/flash.h
Flash command handler header file . . . . . . . . . . . . . . . .
system/gpio.h
GPIO and IO mapping control functions . . . . . . . . . . . . . .
system/status.h
API return status definitions . . . . . . . . . . . . . . . . . . . .
system/system.h
Support functions and definitions for boot-loader and flash updates
system/timer.h
Soft timer header file . . . . . . . . . . . . . . . . . . . . . . . .
system/utils.h
General utility macros and definitions for CCGx firmware stack . .
. . . . . . . . . . . . . . . 119
. . . . . . . . . . . . . . . 121
. . . . . . . . . . . . . . 124
. . . . . . . . . . . . . . . 133
. . . . . . . . . . . . . . . 134
. . . . . . . . . . . . . . . 140
. . . . . . . . . . . . . . . 158
. . . . . . . . . . . . . . . 160
. . . . . . . . . . . . . . . 165
. . . . . . . . . . . . . . . 168
. . . . . . . . . . . . . . . 168
. . . . . . . . . . . . . . . 169
. . . . . . . . . . . . . . . 173
. . . . . . . . . . . . . . . 180
. . . . . . . . . . . . . . . 181
. . . . . . . . . . . . . . . 185
. . . . . . . . . . . . . . . 188
Generated for CCGx Firmware Stack by Doxygen
Chapter 5
Data Structure Documentation
5.1
alt_mode_cmd_info_t Struct Reference
#include <alt_modes_mngr.h>
Data Fields
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
5.1.1
alt_mode_state_t mode_state
pd_do_t vdm_header
alt_mode_state_t sop_state [SOP_DPRIME+1]
pd_do_t ∗ vdo [SOP_DPRIME+1]
uint8_t vdo_numb [SOP_DPRIME+1]
uint8_t vdo_max_numb
alt_mode_cbk_t cbk
uint8_t obj_pos
uint8_t cbl_obj_pos
bool custom_att_obj_pos
uint8_t alt_mode_id
uint8_t data_role
bool is_active
bool app_evt_needed
alt_mode_evt_t app_evt_data
alt_mode_app_cbk_t eval_app_cmd
Detailed Description
This structure holds all necessary information for interaction between alt modes manager and selected alternative
mode.
5.1.2
Field Documentation
5.1.2.1
uint8_t alt_mode_id
Alternative mode ID.
5.1.2.2 alt_mode_evt_t app_evt_data
APP event data.
16
5.1.2.3
Data Structure Documentation
bool app_evt_needed
APP event flag.
5.1.2.4 alt_mode_cbk_t cbk
Alternate mode callback function.
5.1.2.5
uint8_t cbl_obj_pos
Cabel object position.
5.1.2.6
bool custom_att_obj_pos
Object position field in Att VDM used by alt mode as custom.
5.1.2.7
uint8_t data_role
Data role.
5.1.2.8 alt_mode_app_cbk_t eval_app_cmd
APP command cbk.
5.1.2.9
bool is_active
Active mode flag.
5.1.2.10 alt_mode_state_t mode_state
Alternate mode state.
5.1.2.11
uint8_t obj_pos
Alternate mode object position.
5.1.2.12 alt_mode_state_t sop_state[SOP_DPRIME+1]
VDM state for SOP/SOP'/SOP" packets.
5.1.2.13 pd_do_t vdm_header
Buffer to hold VDM header.
5.1.2.14 pd_do_t∗ vdo[SOP_DPRIME+1]
Pointers array to alt mode VDO buffers
Generated for CCGx Firmware Stack by Doxygen
5.2 alt_mode_evt_t::ALT_MODE_EVT Struct Reference
5.1.2.15
uint8_t vdo_max_numb
Maximum number of VDO that alt mode can handle
5.1.2.16
uint8_t vdo_numb[SOP_DPRIME+1]
Current number of VDOs used for processing in VDO buffers
The documentation for this struct was generated from the following file:
• app/alt_mode/alt_modes_mngr.h
5.2
alt_mode_evt_t::ALT_MODE_EVT Struct Reference
#include <alt_modes_mngr.h>
Data Fields
• uint32_t data_role: 1
• uint32_t alt_mode_evt: 7
• uint32_t alt_mode: 8
• uint32_t svid: 16
5.2.1
Detailed Description
Struct containing alternate modes manager event/command .
5.2.2
Field Documentation
5.2.2.1
uint32_t alt_mode
Alt mode ID.
5.2.2.2
uint32_t alt_mode_evt
Alt mode event index from alt_mode_app_evt_t structure.
5.2.2.3
uint32_t data_role
Current event sender data role.
5.2.2.4
uint32_t svid
Alt mode related SVID.
The documentation for this struct was generated from the following file:
• app/alt_mode/alt_modes_mngr.h
Generated for CCGx Firmware Stack by Doxygen
17
18
Data Structure Documentation
5.3
alt_mode_evt_t::ALT_MODE_EVT_DATA Struct Reference
#include <alt_modes_mngr.h>
Data Fields
• uint32_t evt_data: 24
• uint32_t evt_type: 8
5.3.1
Detailed Description
Struct containing alternate modes manager event/command data.
5.3.2
Field Documentation
5.3.2.1
uint32_t evt_data
Alt mode event's data.
5.3.2.2
uint32_t evt_type
Alt mode event's type.
The documentation for this struct was generated from the following file:
• app/alt_mode/alt_modes_mngr.h
5.4
alt_mode_evt_t Union Reference
#include <alt_modes_mngr.h>
Data Structures
• struct ALT_MODE_EVT
• struct ALT_MODE_EVT_DATA
Data Fields
• uint32_t val
• struct alt_mode_evt_t::ALT_MODE_EVT alt_mode_event
• struct alt_mode_evt_t::ALT_MODE_EVT_DATA alt_mode_event_data
5.4.1
Detailed Description
Alt modes manager application event/command structure.
Generated for CCGx Firmware Stack by Doxygen
5.5 alt_mode_hw_evt_t::ALT_MODE_HW_EVT Struct Reference
5.4.2
Field Documentation
5.4.2.1
struct alt_mode_evt_t::ALT_MODE_EVT alt_mode_event
Union containing the alt mode event value.
5.4.2.2
struct alt_mode_evt_t::ALT_MODE_EVT_DATA alt_mode_event_data
Union containing the alt mode event's data value.
5.4.2.3
uint32_t val
Integer field used for direct manipulation of reason code.
The documentation for this union was generated from the following file:
• app/alt_mode/alt_modes_mngr.h
5.5
alt_mode_hw_evt_t::ALT_MODE_HW_EVT Struct Reference
#include <alt_mode_hw.h>
Data Fields
• uint32_t evt_data: 16
• uint32_t hw_type: 8
• uint32_t data_role: 8
5.5.1
Detailed Description
Struct containing alternate modes HW event/command .
5.5.2
Field Documentation
5.5.2.1
uint32_t data_role
Current data role.
5.5.2.2
uint32_t evt_data
Current event/command data.
5.5.2.3
uint32_t hw_type
HW type event/command related to.
The documentation for this struct was generated from the following file:
• app/alt_mode/alt_mode_hw.h
Generated for CCGx Firmware Stack by Doxygen
19
20
Data Structure Documentation
5.6
alt_mode_hw_evt_t Union Reference
#include <alt_mode_hw.h>
Data Structures
• struct ALT_MODE_HW_EVT
Data Fields
• uint32_t val
• struct alt_mode_hw_evt_t::ALT_MODE_HW_EVT hw_evt
5.6.1
Detailed Description
Alt mode HW application event/command structure.
5.6.2
Field Documentation
5.6.2.1
struct alt_mode_hw_evt_t::ALT_MODE_HW_EVT hw_evt
Union containing the application HW event/command value.
5.6.2.2
uint32_t val
Integer field used for direct manipulation of reason code.
The documentation for this union was generated from the following file:
• app/alt_mode/alt_mode_hw.h
5.7
app_cbk_t Struct Reference
Data Fields
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
uint8_t(∗ app_event_handler )(uint8_t port, app_evt_t evt, const void ∗dat)
uint8_t(∗ psrc_set_voltage )(uint8_t port, uint16_t volt_50mV)
uint8_t(∗ psrc_set_current )(uint8_t port, uint16_t cur_10mA)
uint8_t(∗ psrc_enable )(uint8_t port, pwr_ready_cbk_t pwr_ready_handler)
uint8_t(∗ psrc_disable )(uint8_t port, pwr_ready_cbk_t pwr_ready_handler)
uint8_t(∗ vconn_enable )(uint8_t port, uint8_t channel)
uint8_t(∗ vconn_disable )(uint8_t port, uint8_t channel)
uint8_t(∗ vconn_is_present )(uint8_t port)
uint8_t(∗ vbus_is_present )(uint8_t port, uint16_t volt, int8_t per)
uint8_t(∗ vbus_discharge_on )(uint8_t port)
uint8_t(∗ vbus_discharge_off )(uint8_t port)
uint8_t(∗ psnk_set_voltage )(uint8_t port, uint16_t volt_50mV)
uint8_t(∗ psnk_set_current )(uint8_t port, uint16_t cur_10mA)
uint8_t(∗ psnk_enable )(uint8_t port)
uint8_t(∗ psnk_disable )(uint8_t port)
uint8_t(∗ eval_src_cap )(uint8_t port, const pd_packet_t ∗src_cap, app_resp_cbk_t app_resp_handler)
Generated for CCGx Firmware Stack by Doxygen
5.8 app_resp_t Struct Reference
•
•
•
•
•
uint8_t(∗ eval_rdo )(uint8_t port, pd_do_t rdo, app_resp_cbk_t app_resp_handler)
uint8_t(∗ eval_dr_swap )(uint8_t port, app_resp_cbk_t app_resp_handler)
uint8_t(∗ eval_pr_swap )(uint8_t port, app_resp_cbk_t app_resp_handler)
uint8_t(∗ eval_vconn_swap )(uint8_t port, app_resp_cbk_t app_resp_handler)
uint8_t(∗ eval_vdm )(uint8_t port, const pd_packet_t ∗vdm, vdm_resp_cbk_t vdm_resp_handler)
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.8
app_resp_t Struct Reference
Data Fields
• pd_do_t resp_buf [MAX_NO_OF_DO]
• app_req_status_t req_status
• uint8_t do_count
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.9
app_status_t Struct Reference
#include <app.h>
Data Fields
•
•
•
•
•
•
•
•
•
•
•
•
•
•
5.9.1
pwr_ready_cbk_t pwr_ready_cbk
pd_packet_t disc_id_resp
app_resp_t app_resp
vdm_resp_t vdm_resp
uint8_t vdm_task_en
uint8_t ufp_alt_mode_allowed
uint8_t cbl_disc_id_finished
bool alt_mode_trigger
bool alt_mode_entered
bool is_vbus_on
bool is_vconn_on
uint16_t psrc_volt
uint16_t psrc_volt_old
bool psrc_rising
Detailed Description
This structure hold all variables related to application layer functionality.
5.9.2
Field Documentation
5.9.2.1
bool alt_mode_entered
Flag to indicate is alternate modes currently entered.
Generated for CCGx Firmware Stack by Doxygen
21
22
5.9.2.2
Data Structure Documentation
bool alt_mode_trigger
Flag to indicate whether alt mode trigger is enabled by EC.
5.9.2.3 app_resp_t app_resp
Buffer for APP responses.
5.9.2.4
uint8_t cbl_disc_id_finished
Flag to indicate that cable disc id finished.
5.9.2.5 pd_packet_t disc_id_resp
Discover Id response from peer.
5.9.2.6
bool is_vbus_on
Is supplying VBUS flag.
5.9.2.7
bool is_vconn_on
Is supplying VCONN flag.
5.9.2.8
bool psrc_rising
Voltage ramp up/down.
5.9.2.9
uint16_t psrc_volt
Current Psource voltage.
5.9.2.10
uint16_t psrc_volt_old
Old Psource voltage.
5.9.2.11
pwr_ready_cbk_t pwr_ready_cbk
Registered Power source callback.
5.9.2.12
uint8_t ufp_alt_mode_allowed
Flag to indicate whether UFP alt modes could be runned.
5.9.2.13 vdm_resp_t vdm_resp
Buffer for VDM responses.
Generated for CCGx Firmware Stack by Doxygen
5.10 ar_reg_t Union Reference
5.9.2.14
uint8_t vdm_task_en
Flag to indicate is vdm task manager enabled.
The documentation for this struct was generated from the following file:
• app/app.h
5.10
ar_reg_t Union Reference
#include <alp_ridge.h>
Data Structures
• struct USBPD_CMD_REG
• struct USBPD_STATUS_REG
Data Fields
• uint32_t val
• struct ar_reg_t::USBPD_STATUS_REG ar_status
• struct ar_reg_t::USBPD_CMD_REG usbpd_cmd_reg
5.10.1
Detailed Description
Union to hold AR Registers.
5.10.2
Field Documentation
5.10.2.1
struct ar_reg_t::USBPD_STATUS_REG ar_status
PD-controller status.
5.10.2.2
struct ar_reg_t::USBPD_CMD_REG usbpd_cmd_reg
PD-controller command register.
5.10.2.3
uint32_t val
Integer field used for direct manipulation of reason code.
The documentation for this union was generated from the following file:
• app/alt_mode/alp_ridge.h
5.11
atch_tgt_info_t Struct Reference
#include <dfp_vdm_task_mngr.h>
Generated for CCGx Firmware Stack by Doxygen
23
24
Data Structure Documentation
Data Fields
•
•
•
•
•
pd_do_t tgt_id_header
pd_do_t ama_vdo
const pd_do_t ∗ cbl_vdo
uint16_t tgt_svid [MAX_SVID_VDO_SUPP]
uint16_t cbl_svid [MAX_SVID_VDO_SUPP]
5.11.1
Detailed Description
Struct holds Discovery info for alt modes manager.
This struct holds Discovery information which uses by alt modes manager.
5.11.2
Field Documentation
5.11.2.1 pd_do_t ama_vdo
Holds AMA discovery ID response VDO .
5.11.2.2
uint16_t cbl_svid[MAX_SVID_VDO_SUPP]
Holds received SVID for cable .
5.11.2.3
const pd_do_t∗ cbl_vdo
Pointer to cable VDO .
5.11.2.4 pd_do_t tgt_id_header
Holds dev/ama discovery ID header .
5.11.2.5
uint16_t tgt_svid[MAX_SVID_VDO_SUPP]
Holds received SVID for dev/ama .
The documentation for this struct was generated from the following file:
• app/alt_mode/dfp_vdm_task_mngr.h
5.12
pd_do_t::BAT_SNK Struct Reference
Data Fields
•
•
•
•
uint32_t op_power: 10
uint32_t min_voltage: 10
uint32_t max_voltage: 10
uint32_t supply_type: 2
The documentation for this struct was generated from the following file:
• pd_common/pd.h
Generated for CCGx Firmware Stack by Doxygen
5.13 pd_do_t::BAT_SRC Struct Reference
5.13
pd_do_t::BAT_SRC Struct Reference
Data Fields
• uint32_t max_power: 10
• uint32_t min_voltage: 10
• uint32_t max_voltage: 10
• uint32_t supply_type: 2
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.14
bb_handle_t Struct Reference
#include <billboard.h>
Data Fields
• bb_type_t type
• bb_state_t state
• uint8_t num_alt_modes
• uint32_t alt_status
• uint32_t timeout
• uint8_t usb_port
• uint8_t ∗ ep0_buffer
• bool queue_enable
• bool queue_disable
• bb_state_t queue_state
5.14.1
Detailed Description
Internal billboard module handle structure.
No explicit structure for the handle is expected to be created outside of the billboard module implementation.
5.14.2
Field Documentation
5.14.2.1
uint32_t alt_status
Current alternate mode status - The status can hold a maximum of 16 alternate modes (2bits each).
5.14.2.2
uint8_t∗ ep0_buffer
EP0 data buffer pointer in case of internal billboard implementation
5.14.2.3
uint8_t num_alt_modes
Number of valid alternate modes
Generated for CCGx Firmware Stack by Doxygen
25
26
Data Structure Documentation
5.14.2.4
bool queue_disable
Billboard interface disable request queued. Valid only for internal billboard implementation.
5.14.2.5
bool queue_enable
Billboard interface enable request queued. Valid only for internal billboard implementation.
5.14.2.6 bb_state_t queue_state
New billboard interface mode request. Valid only for internal billboard implementaion.
5.14.2.7 bb_state_t state
Billboard current state
5.14.2.8
uint32_t timeout
Pending timeout count in ms for billboard interface disable.
5.14.2.9 bb_type_t type
Billboard implementation type
5.14.2.10
uint8_t usb_port
USB port index used in case the device has multiple USB ports.
The documentation for this struct was generated from the following file:
• app/billboard.h
5.15
pd_do_t::BIST_DO Struct Reference
Data Fields
• uint32_t rsvd1: 16
• uint32_t rsvd2: 12
• uint32_t mode: 4
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.16
bm_alt_modes_t Struct Reference
#include <alt_modes_mngr.h>
Generated for CCGx Firmware Stack by Doxygen
5.17 cc_state_t Union Reference
27
Data Fields
• uint32_t supported_modes
• uint32_t exited_modes
• uint32_t active_modes
5.16.1
Detailed Description
This structure holds bit masks used by alt modes mngr.
Appropriate bit positions of bit masks are set in accordance on positions of alternative modes in compatibility tables
in alt_modes_config.h file.
5.16.2
Field Documentation
5.16.2.1
uint32_t active_modes
bit mask of active/running alternative modes.
5.16.2.2
uint32_t exited_modes
bit mask of exited alternative modes.
5.16.2.3
uint32_t supported_modes
bit mask of supported alternative modes.
The documentation for this struct was generated from the following file:
• app/alt_mode/alt_modes_mngr.h
5.17
cc_state_t Union Reference
Data Fields
• uint16_t state
• uint8_t cc [2]
The documentation for this union was generated from the following file:
• pd_common/pd.h
5.18
ccg_timer_t Struct Reference
#include <timer.h>
Data Fields
•
•
•
•
uint16_t period
uint32_t count
timer_id_t id
timer_cb_t cb
Generated for CCGx Firmware Stack by Doxygen
28
Data Structure Documentation
5.18.1
Detailed Description
Structure encapsulating information relating to a software timer.
This structure encapsulates all information related to a software timer object. The timer module maintains a list of
these objects corresponding to the active software timers at any given point of time.
5.18.2
Field Documentation
5.18.2.1 timer_cb_t cb
The callback function pointer for the timer object.
5.18.2.2
uint32_t count
The actual count value.
5.18.2.3 timer_id_t id
The ID handle associated with the timer object.
5.18.2.4
uint16_t period
Period of operation for the timer instance.
The documentation for this struct was generated from the following file:
• system/timer.h
5.19
comp_tbl_t Struct Reference
#include <alt_modes_mngr.h>
Data Fields
• uint16_t svid
• uint8_t alt_mode_id
5.19.1
Detailed Description
This structure are used in alt_modes_config.h file to set alternative modes compatibility and priority.
5.19.2
Field Documentation
5.19.2.1
uint8_t alt_mode_id
Alternative mode ID.
Generated for CCGx Firmware Stack by Doxygen
5.20 contract_t Union Reference
5.19.2.2
29
uint16_t svid
Alternative mode SVID.
The documentation for this struct was generated from the following file:
• app/alt_mode/alt_modes_mngr.h
5.20
contract_t Union Reference
Data Structures
• struct FIELD
Data Fields
• uint32_t val
• struct contract_t::FIELD field
5.20.1
Field Documentation
5.20.1.1
uint32_t val
absolute value
The documentation for this union was generated from the following file:
• pd_common/pd.h
5.21
disc_mode_info_t Struct Reference
#include <alt_modes_mngr.h>
Data Fields
• uint8_t atch_type
• pd_do_t svid_emca_vdo
• sop_t cbl_sop_flag
• const atch_tgt_info_t ∗ atch_tgt_info
• uint8_t data_role
• uint8_t alt_mode_id
• pd_do_t svid_vdo
• uint8_t vdo_pos
• alt_mode_app_evt_t app_evt
5.21.1
Detailed Description
This structure holds all necessary information on Discovery Mode stage for supported alternative mode when alt
modes manager registers new alt mode.
Generated for CCGx Firmware Stack by Doxygen
30
Data Structure Documentation
5.21.2
Field Documentation
5.21.2.1
uint8_t alt_mode_id
Alt mode ID.
5.21.2.2 alt_mode_app_evt_t app_evt
APP event.
5.21.2.3
const atch_tgt_info_t∗ atch_tgt_info
Attached trgets info (dev/ama/cbl) from Discovery ID response.
5.21.2.4
uint8_t atch_type
Target of disc svid (cable or device/ama).
5.21.2.5 sop_t cbl_sop_flag
Sop indication flag.
5.21.2.6
uint8_t data_role
Current data role.
5.21.2.7 pd_do_t svid_emca_vdo
SVID VDO from cable Discovery mode response.
5.21.2.8 pd_do_t svid_vdo
SVID VDO from Discovery mode SOP response.
5.21.2.9
uint8_t vdo_pos
Object position in DISC SVID response.
The documentation for this struct was generated from the following file:
• app/alt_mode/alt_modes_mngr.h
5.22
pd_do_t::DP_CONFIG_VDO Struct Reference
Data Fields
•
•
•
•
uint32_t sel_conf: 2
uint32_t sign: 4
uint32_t rsvd1: 2
uint32_t dfp_asgmnt: 8
Generated for CCGx Firmware Stack by Doxygen
5.23 pd_do_t::DP_STATUS_VDO Struct Reference
• uint32_t ufp_asgmnt: 8
• uint32_t rsvd2: 8
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.23
pd_do_t::DP_STATUS_VDO Struct Reference
Data Fields
•
•
•
•
•
•
•
•
•
uint32_t dfp_ufp_conn: 2
uint32_t pwr_low: 1
uint32_t en: 1
uint32_t mult_fun: 1
uint32_t usb_cfg: 1
uint32_t exit: 1
uint32_t hpd_state: 1
uint32_t hpd_irq: 1
uint32_t rsvd: 23
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.24
dpm_pd_cmd_buf_t Struct Reference
Data Fields
•
•
•
•
pd_do_t cmd_do [MAX_NO_OF_DO]
sop_t cmd_sop
uint8_t no_of_cmd_do
uint8_t timeout
5.24.1
Field Documentation
5.24.1.1 pd_do_t cmd_do[MAX_NO_OF_DO]
Command data objects
5.24.1.2 sop_t cmd_sop
SOP type
5.24.1.3
uint8_t no_of_cmd_do
No of data objects including VDM header
The documentation for this struct was generated from the following file:
• pd_common/pd.h
Generated for CCGx Firmware Stack by Doxygen
31
32
Data Structure Documentation
5.25
dpm_status_t Struct Reference
#include <pd.h>
Data Fields
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
port_role_t port_role
port_role_t dflt_port_role
uint8_t src_cur_level
uint8_t is_src_bat
uint8_t is_snk_bat
uint8_t snk_usb_susp_en
uint8_t snk_usb_comm_en
uint8_t swap_response
uint8_t toggle
uint8_t src_pdo_count
uint8_t src_pdo_mask
uint8_t snk_pdo_count
uint8_t snk_pdo_mask
uint8_t rp_supported
uint8_t pd_support
uint8_t try_src
uint8_t cbl_dsc
uint8_t db_support
uint8_t err_recov
uint8_t port_disable
uint8_t reserved_2 [2]
uint16_t reserved_3 [5]
pd_do_t src_pdo [MAX_NO_OF_PDO]
pd_do_t snk_pdo [MAX_NO_OF_PDO]
uint16_t snk_max_min [MAX_NO_OF_PDO]
port_type_t cur_port_type
port_role_t cur_port_role
uint8_t volatile snk_cur_level
uint8_t volatile bootup
uint8_t volatile dead_bat
uint8_t drp_period
uint8_t src_period
uint8_t snk_period
uint8_t volatile skip_scan
uint8_t polarity
uint8_t rev_pol
uint8_t volatile connect
uint8_t volatile attach
port_role_t role_at_connect
pd_devtype_t attached_dev
uint8_t volatile contract_exist
uint8_t volatile pd_connected
uint8_t volatile pd_disabled
uint8_t volatile ra_present
uint8_t volatile emca_present
uint8_t volatile vconn_logical
uint8_t volatile vconn_actual
uint8_t cur_src_pdo_count
Generated for CCGx Firmware Stack by Doxygen
5.25 dpm_status_t Struct Reference
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
5.25.1
uint8_t cur_snk_pdo_count
pe_hard_reset_ams_state_t pe_hr_ams_state
pe_bist_test_data_ams_state_t pe_btd_ams_state
pe_bist_cm2_ams_state_t pe_bcm2_ams_state
pe_soft_reset_ams_state_t pe_sr_ams_state
pe_src_contract_ams_state_t pe_src_ams_state
pe_snk_contract_ams_state_t pe_snk_ams_state
pe_pr_swap_ams_state_t pe_pr_ams_state
pe_dr_swap_ams_state_t pe_dr_ams_state
pe_vconn_swap_ams_state_t pe_vs_ams_state
pe_generic_ams_state_t pe_gn_ams_state
uint8_t cbl_wait
pe_cbl_state_t cbl_state
uint8_t cbl_soft_reset_tried
typec_generic_fsm_state_t typec_gn_fsm_state
dpm_pd_cmd_t dpm_pd_cmd
uint8_t dpm_pd_cmd_active
uint8_t dpm_typec_cmd_active
bool dpm_enabled
uint8_t dpm_safe_disable
dpm_typec_cmd_t dpm_typec_cmd
cc_state_t volatile cc_live
cc_state_t volatile cc_status
cc_state_t volatile cc_old_status
cc_state_t volatile cc_rd_status
app_cbk_t ∗ app_cbk
dpm_pd_cmd_cbk_t dpm_pd_cbk
dpm_typec_cmd_cbk_t dpm_typec_cbk
dpm_pd_cmd_buf_t ∗ cmd_p
dpm_pd_cmd_buf_t dpm_cmd_buf
pd_do_t cur_src_pdo [MAX_NO_OF_PDO]
pd_do_t cur_snk_pdo [MAX_NO_OF_PDO]
uint16_t cur_snk_max_min [MAX_NO_OF_PDO]
pd_do_t src_rdo
pd_do_t snk_rdo
pd_do_t snk_sel_pdo
pd_do_t src_sel_pdo
contract_t contract
pd_do_t cbl_vdo
std_vdm_prod_t cbl_type
uint32_t volatile typec_evt
uint32_t volatile pe_evt
uint32_t pe_fsm
uint32_t typec_fsm
Detailed Description
PD Device Policy Status structure.
5.25.2
Field Documentation
5.25.2.1 app_cbk_t∗ app_cbk
Application callback pointer.
Generated for CCGx Firmware Stack by Doxygen
33
34
5.25.2.2
Data Structure Documentation
uint8_t volatile attach
Port attached indication.
5.25.2.3 pd_devtype_t attached_dev
Type of device attached.
5.25.2.4
uint8_t volatile bootup
Flag to indicate chip bootup, used to check dead battery.
5.25.2.5
uint8_t cbl_dsc
Cable discovery control knob.
5.25.2.6
uint8_t cbl_soft_reset_tried
Stores number of cable soft reset tries.
5.25.2.7 pe_cbl_state_t cbl_state
Store cable disocvery state and check if cable discovery is ongoing. Cable discovery is ongoing when cbl_state is
set to CBL_FSM_DISABLED.
5.25.2.8 std_vdm_prod_t cbl_type
Stores the cable type.
5.25.2.9 pd_do_t cbl_vdo
Stores the last received cable VDO.
5.25.2.10
uint8_t cbl_wait
Flag to indicate cable discovery is waiting for some event.
5.25.2.11 cc_state_t volatile cc_live
Live CC status.
5.25.2.12 cc_state_t volatile cc_old_status
Old CC status.
5.25.2.13 cc_state_t volatile cc_rd_status
Rd status.
Generated for CCGx Firmware Stack by Doxygen
5.25 dpm_status_t Struct Reference
5.25.2.14 cc_state_t volatile cc_status
Current debounced CC status.
5.25.2.15 dpm_pd_cmd_buf_t∗ cmd_p
Pointer to DPM command buffer.
5.25.2.16
uint8_t volatile connect
Port connected but not debounced yet.
5.25.2.17 contract_t contract
Current pd contract.
5.25.2.18
uint8_t volatile contract_exist
PD contract exists indication.
5.25.2.19 port_role_t cur_port_role
Current Port role: Sink or Source.
5.25.2.20 port_type_t cur_port_type
Current port type: UFP or DFP.
5.25.2.21
uint16_t cur_snk_max_min[MAX_NO_OF_PDO]
Max min current/power of current sink capabilities.
5.25.2.22 pd_do_t cur_snk_pdo[MAX_NO_OF_PDO]
Current sink PDOs sent in sink cap messages, these may be updated as per sink PDO mask.
5.25.2.23
uint8_t cur_snk_pdo_count
Sink PDO count in the last sent sink cap.
5.25.2.24 pd_do_t cur_src_pdo[MAX_NO_OF_PDO]
Current source PDOs sent in source cap messages, these may be updated due to cable caps or PDO mask.
5.25.2.25
uint8_t cur_src_pdo_count
Source PDO count in the last sent source cap.
Generated for CCGx Firmware Stack by Doxygen
35
36
5.25.2.26
Data Structure Documentation
uint8_t db_support
Dead battery support control knob.
5.25.2.27
uint8_t volatile dead_bat
Flag to indicate dead battery operation.
5.25.2.28 port_role_t dflt_port_role
Default port role: Sink or Source.
5.25.2.29 dpm_pd_cmd_buf_t dpm_cmd_buf
Local DPM command buffer.
5.25.2.30
bool dpm_enabled
DPM enabled flag.
5.25.2.31
dpm_pd_cmd_cbk_t dpm_pd_cbk
Pointer to DPM PD callback function.
5.25.2.32 dpm_pd_cmd_t dpm_pd_cmd
Current DPM PD command.
5.25.2.33
uint8_t dpm_pd_cmd_active
Indicate DPM PD command was registered.
5.25.2.34
uint8_t dpm_safe_disable
DPM safe disable flag, used to make sure the port is disabled once again. Since OCP/OVP are handled in interrupt
context and the state machine is in the main loop it may happen that some unnecessary steps are carried out by
the state machine after an OCP/OVP event.
5.25.2.35
dpm_typec_cmd_cbk_t dpm_typec_cbk
Pointer to DPM Type C callback function.
5.25.2.36 dpm_typec_cmd_t dpm_typec_cmd
Current DPM Type C command.
5.25.2.37
uint8_t dpm_typec_cmd_active
Indicate DPM Type C command was registered.
Generated for CCGx Firmware Stack by Doxygen
5.25 dpm_status_t Struct Reference
5.25.2.38
uint8_t drp_period
Time period for DRP toggling.
5.25.2.39
uint8_t volatile emca_present
EMCA cable present indication, set when the cable responded to a discover id.
5.25.2.40
uint8_t err_recov
Error recovery control knob.
5.25.2.41
uint8_t is_snk_bat
Power sink is connected to a battery.
5.25.2.42
uint8_t is_src_bat
Power source is connected to a battery.
5.25.2.43
uint8_t volatile pd_connected
Ports are PD connected indication.
5.25.2.44
uint8_t volatile pd_disabled
PD disabled indication.
5.25.2.45
uint8_t pd_support
USB-PD supported.
5.25.2.46 pe_bist_cm2_ams_state_t pe_bcm2_ams_state
PE Bist Carrier mode 2 AMS current state.
5.25.2.47 pe_bist_test_data_ams_state_t pe_btd_ams_state
PE Bist Test data AMS current state.
5.25.2.48 pe_dr_swap_ams_state_t pe_dr_ams_state
PE Data role swap AMS current state.
5.25.2.49
uint32_t volatile pe_evt
Stores policy engine events.
Generated for CCGx Firmware Stack by Doxygen
37
38
Data Structure Documentation
5.25.2.50
uint32_t pe_fsm
Holds the enable/disable states of all Policy Engine (PE) Atomic Message Sequences (AMS).
5.25.2.51 pe_generic_ams_state_t pe_gn_ams_state
PE Generic AMS state.
5.25.2.52 pe_hard_reset_ams_state_t pe_hr_ams_state
PE Hard Reset AMS current state.
5.25.2.53 pe_pr_swap_ams_state_t pe_pr_ams_state
PE Power role swap AMS current state.
5.25.2.54 pe_snk_contract_ams_state_t pe_snk_ams_state
PE Sink Contract AMS current state.
5.25.2.55
pe_soft_reset_ams_state_t pe_sr_ams_state
PE Soft Reset AMS current state.
5.25.2.56 pe_src_contract_ams_state_t pe_src_ams_state
PE Source contract AMS current state.
5.25.2.57
pe_vconn_swap_ams_state_t pe_vs_ams_state
PE VCONN swap AMS current state.
5.25.2.58
uint8_t polarity
CC channel polarity.
• CC1 = 0
• CC2 = 1
5.25.2.59
uint8_t port_disable
PD port disable flag.
5.25.2.60 port_role_t port_role
Port role: Sink, Source or Dual.
Generated for CCGx Firmware Stack by Doxygen
5.25 dpm_status_t Struct Reference
5.25.2.61
uint8_t volatile ra_present
Ra present indication.
5.25.2.62
uint8_t reserved_2[2]
Reserved bytes for padding to 2-byte aligned address.
5.25.2.63
uint16_t reserved_3[5]
Reserved words for padding to 4-byte aligned address.
5.25.2.64
uint8_t rev_pol
CC channel reverse polarity.
5.25.2.65 port_role_t role_at_connect
Port role when the port moved to the attached state.
5.25.2.66
uint8_t rp_supported
Supported Rp values. This is a bit mask where each bit is interpreted as below. Multiple bits may be set.
• Bit 0 => Default current
• Bit 1 => 1.5 A
• Bit 2 => 3 A
5.25.2.67
uint8_t volatile skip_scan
Skip CC scanning control knob.
5.25.2.68
uint8_t volatile snk_cur_level
Type C current level in sink role.
5.25.2.69
uint16_t snk_max_min[MAX_NO_OF_PDO]
Max min current from the config table or updated at runtime by the EC.
Array of sink PDO parameters. For each element, the format is as below:
• Bit 15 => Give Back support flag
• Bits 14:0 => Minimum sink operating current in 10 mA units
5.25.2.70 pd_do_t snk_pdo[MAX_NO_OF_PDO]
Sink PDO loaded from the config table or updated at runtime by the EC.
Generated for CCGx Firmware Stack by Doxygen
39
40
5.25.2.71
Data Structure Documentation
uint8_t snk_pdo_count
Sink PDO count from the config table or updated at runtime by the EC.
5.25.2.72
uint8_t snk_pdo_mask
Sink PDO mask from the config table or updated at runtime by the EC.
5.25.2.73
uint8_t snk_period
Time period for which to stay as a SNK for a DRP device.
5.25.2.74 pd_do_t snk_rdo
last RDO sent, when operating as a sink, that resulted in a contract.
5.25.2.75 pd_do_t snk_sel_pdo
Selected PDO (from the source cap), when operating as a sink, that resulted in a contract.
5.25.2.76
uint8_t snk_usb_comm_en
USB communication supported indication.
5.25.2.77
uint8_t snk_usb_susp_en
USB suspend supported indication.
5.25.2.78
uint8_t src_cur_level
Type C current level in the source role.
5.25.2.79 pd_do_t src_pdo[MAX_NO_OF_PDO]
Source PDO loaded from the config table or updated at runtime by the EC.
5.25.2.80
uint8_t src_pdo_count
Source PDO count from the config table or updated at runtime by the EC.
5.25.2.81
uint8_t src_pdo_mask
Source PDO mask from the config table or updated at runtime by the EC.
5.25.2.82
uint8_t src_period
Time period for which to stay as a SRC for a DRP device.
Generated for CCGx Firmware Stack by Doxygen
5.25 dpm_status_t Struct Reference
5.25.2.83 pd_do_t src_rdo
Last RDO received, when operating as a source, that resulted in a contract.
5.25.2.84 pd_do_t src_sel_pdo
Selected PDO (from the source cap), when operating as a source, that resulted in a contract.
5.25.2.85
uint8_t swap_response
Response to be sent for each USB-PD SWAP command:
• Bits 1:0 => DR_SWAP response
• Bits 3:2 => PR_SWAP response
• Bits 5:4 => VCONN_SWAP response
Allowed values are: 0 = ACCEPT, 1 = REJECT, 2 = WAIT
5.25.2.86
uint8_t toggle
DRP toggle is enabled.
5.25.2.87
uint8_t try_src
Try Source control knob.
5.25.2.88
uint32_t volatile typec_evt
Stores Type C events.
5.25.2.89
uint32_t typec_fsm
Holds the enable/disable state of all Type C sequences.
5.25.2.90 typec_generic_fsm_state_t typec_gn_fsm_state
Type C generic FSM state.
5.25.2.91
uint8_t volatile vconn_actual
Actual VCONN status of hardware.
5.25.2.92
uint8_t volatile vconn_logical
VCONN logical status.
The documentation for this struct was generated from the following file:
• pd_common/pd.h
Generated for CCGx Firmware Stack by Doxygen
41
42
Data Structure Documentation
5.26
contract_t::FIELD Struct Reference
Data Fields
• uint32_t cur_pwr: 10
• uint32_t volt: 10
5.26.1
Field Documentation
5.26.1.1
uint32_t cur_pwr
PD contract current/power
5.26.1.2
uint32_t volt
PD contract voltage
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.27
pd_do_t::FIXED_SNK Struct Reference
Data Fields
•
•
•
•
•
•
•
•
•
uint32_t op_current: 10
uint32_t voltage: 10
uint32_t rsrvd: 5
uint32_t dr_swap: 1
uint32_t usb_comm_cap: 1
uint32_t ext_powered: 1
uint32_t high_cap: 1
uint32_t dual_role_power: 1
uint32_t supply_type: 2
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.28
pd_do_t::FIXED_SRC Struct Reference
Data Fields
•
•
•
•
•
•
•
•
uint32_t max_current: 10
uint32_t voltage: 10
uint32_t pk_current: 2
uint32_t reserved: 3
uint32_t dr_swap: 1
uint32_t usb_comm_cap: 1
uint32_t ext_powered: 1
uint32_t usb_suspend_sup: 1
Generated for CCGx Firmware Stack by Doxygen
5.29 fw_img_status_t Union Reference
43
• uint32_t dual_role_power: 1
• uint32_t supply_type: 2
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.29
fw_img_status_t Union Reference
#include <boot.h>
Data Structures
• struct FwModeReason
Data Fields
• uint8_t val
• struct fw_img_status_t::FwModeReason status
5.29.1
Detailed Description
Boot mode reason structure.
This structure holds status of FW images and boot mode request. If the CCGx device is running in Boot-loader
mode, this register can be used to identify the reason for this. The register will report the validity of FW1 and FW2
binaries even in the case where the device is already running in FW1 or FW2 mode.
5.29.2
Field Documentation
5.29.2.1
struct fw_img_status_t::FwModeReason status
Union containing the status fields in the boot mode reason value.
5.29.2.2
uint8_t val
Integer field used for direct manipulation of reason code.
The documentation for this union was generated from the following file:
• system/boot.h
5.30
fw_img_status_t::FwModeReason Struct Reference
Data Fields
•
•
•
•
•
uint8_t boot_mode_request: 1
uint8_t reserved: 1
uint8_t fw1_invalid: 1
uint8_t fw2_invalid: 1
uint8_t reserved1: 4
Generated for CCGx Firmware Stack by Doxygen
44
Data Structure Documentation
5.30.1
Field Documentation
5.30.1.1
uint8_t boot_mode_request
Boot mode request made by FW.
5.30.1.2
uint8_t fw1_invalid
FW1 image invalid: 0=Valid, 1=Invalid.
5.30.1.3
uint8_t fw2_invalid
FW2 image invalid: 0=Valid, 1=Invalid.
5.30.1.4
uint8_t reserved
Reserved field: Will be zero.
5.30.1.5
uint8_t reserved1
Reserved for later use.
The documentation for this struct was generated from the following file:
• system/boot.h
5.31
i2c_scb_config_t Struct Reference
#include <i2c.h>
Data Fields
• i2c_scb_mode_t mode
• uint8_t slave_address
• uint8_t slave_mask
• i2c_scb_clock_freq_t clock_freq
• i2c_scb_state_t i2c_state
• uint8_t ∗ buffer
• uint16_t buf_size
• i2c_cb_fun_t cb_fun_ptr
• uint16_t i2c_write_count
5.31.1
Detailed Description
This structure holds all configuration associated with each I2C block.
This structure is used internally by the driver, and is not expected to be manipulated directly by the caller.
Generated for CCGx Firmware Stack by Doxygen
5.32 pd_config_t Struct Reference
5.31.2
Field Documentation
5.31.2.1
uint16_t buf_size
Size of receive buffer.
5.31.2.2
uint8_t∗ buffer
Buffer to be used to receive data.
5.31.2.3 i2c_cb_fun_t cb_fun_ptr
Callback function pointer.
5.31.2.4 i2c_scb_clock_freq_t clock_freq
Clock frequency. Only valid in master mode.
5.31.2.5 i2c_scb_state_t i2c_state
Current state of the I2C block.
5.31.2.6
uint16_t i2c_write_count
Current index into receive buffer.
5.31.2.7 i2c_scb_mode_t mode
I2C operating mode.
5.31.2.8
uint8_t slave_address
Slave address. Only valid in slave modes.
5.31.2.9
uint8_t slave_mask
Slave address mask. Only valid in slave modes.
The documentation for this struct was generated from the following file:
• scb/i2c.h
5.32
pd_config_t Struct Reference
Data Fields
•
•
•
•
uint16_t table_sign
uint8_t table_type
uint8_t application
uint16_t table_version
Generated for CCGx Firmware Stack by Doxygen
45
46
Data Structure Documentation
•
•
•
•
•
•
•
•
•
uint16_t table_size
uint8_t table_checksum
uint8_t flash_checksum
uint16_t flashing_vid
uint16_t flashing_mode
uint8_t pd_port_cnt
uint8_t reserved_0
uint16_t reserved_1 [8]
pd_port_config_t port_conf [NO_OF_TYPEC_PORTS]
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.33
pd_contract_info_t Struct Reference
Data Fields
• pd_do_t rdo
• pd_contract_status_t status
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.34
pd_do_t Union Reference
Data Structures
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
struct BAT_SNK
struct BAT_SRC
struct BIST_DO
struct DP_CONFIG_VDO
struct DP_STATUS_VDO
struct FIXED_SNK
struct FIXED_SRC
struct RDO_BAT
struct RDO_BAT_GIVEBACK
struct RDO_FIXED_VAR
struct RDO_FIXED_VAR_GIVEBACK
struct RDO_GEN
struct RDO_GEN_GVB
struct SLICE_SUBHDR
struct SLICE_VDO
struct SRC_GEN
struct STD_AMA_VDO
struct STD_CBL_VDO
struct STD_CERT_VDO
struct STD_DP_VDO
struct STD_PROD_VDO
struct STD_SVID_RESP_VDO
struct STD_VDM_HDR
Generated for CCGx Firmware Stack by Doxygen
5.35 pd_hdr_t::PD_HDR Struct Reference
•
•
•
•
•
struct STD_VDM_ID_HDR
struct TBT_VDO
struct USTD_VDM_HDR
struct VAR_SNK
struct VAR_SRC
Data Fields
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
uint32_t val
struct pd_do_t::BIST_DO bist_do
struct pd_do_t::FIXED_SRC fixed_src
struct pd_do_t::VAR_SRC var_src
struct pd_do_t::BAT_SRC bat_src
struct pd_do_t::SRC_GEN src_gen
struct pd_do_t::FIXED_SNK fixed_snk
struct pd_do_t::VAR_SNK var_snk
struct pd_do_t::BAT_SNK bat_snk
struct pd_do_t::RDO_FIXED_VAR rdo_fix_var
struct pd_do_t::RDO_FIXED_VAR_GIVEBACK rdo_fix_var_gvb
struct pd_do_t::RDO_BAT rdo_bat
struct pd_do_t::RDO_BAT_GIVEBACK rdo_bat_gvb
struct pd_do_t::RDO_GEN rdo_gen
struct pd_do_t::RDO_GEN_GVB rdo_gen_gvb
struct pd_do_t::STD_VDM_HDR std_vdm_hdr
struct pd_do_t::USTD_VDM_HDR ustd_vdm_hdr
struct pd_do_t::STD_VDM_ID_HDR std_id_hdr
struct pd_do_t::STD_CERT_VDO std_cert_vdo
struct pd_do_t::STD_PROD_VDO std_prod_vdo
struct pd_do_t::STD_CBL_VDO std_cbl_vdo
struct pd_do_t::STD_AMA_VDO std_ama_vdo
struct pd_do_t::STD_SVID_RESP_VDO std_svid_res
struct pd_do_t::STD_DP_VDO std_dp_vdo
struct pd_do_t::DP_STATUS_VDO dp_stat_vdo
struct pd_do_t::DP_CONFIG_VDO dp_cfg_vdo
struct pd_do_t::TBT_VDO tbt_vdo
struct pd_do_t::SLICE_VDO slice_vdo
struct pd_do_t::SLICE_SUBHDR slice_subhdr
The documentation for this union was generated from the following file:
• pd_common/pd.h
5.35
pd_hdr_t::PD_HDR Struct Reference
Data Fields
•
•
•
•
•
•
•
uint32_t msg_type: 4
uint32_t rsvd1: 1
uint32_t data_role: 1
uint32_t spec_rev: 2
uint32_t pwr_role: 1
uint32_t msg_id: 3
uint32_t len: 3
Generated for CCGx Firmware Stack by Doxygen
47
48
Data Structure Documentation
• uint32_t rsvd2: 1
• uint32_t rsvd3: 16
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.36
pd_hdr_t Union Reference
Data Structures
• struct PD_HDR
Data Fields
• uint32_t val
• struct pd_hdr_t::PD_HDR hdr
The documentation for this union was generated from the following file:
• pd_common/pd.h
5.37
pd_packet_t Struct Reference
Data Fields
•
•
•
•
•
•
uint8_t sop
uint8_t len
uint8_t msg
uint8_t data_role
pd_hdr_t hdr
pd_do_t dat [MAX_NO_OF_DO]
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.38
pd_port_config_t Struct Reference
Data Fields
•
•
•
•
•
•
•
•
•
uint16_t id_vdm_offset
uint16_t id_vdm_length
uint16_t svid_vdm_offset
uint16_t svid_vdm_length
uint16_t mode_vdm_offset
uint16_t mode_vdm_length
uint16_t reserved_0 [6]
uint16_t ra_timeout
uint16_t reserved_1 [3]
Generated for CCGx Firmware Stack by Doxygen
5.38 pd_port_config_t Struct Reference
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
uint8_t port_role
uint8_t default_role
uint8_t current_level
uint8_t is_src_bat
uint8_t is_snk_bat
uint8_t snk_usb_susp_en
uint8_t snk_usb_comm_en
uint8_t swap_response
uint8_t drp_toggle_en
uint8_t src_pdo_cnt
uint8_t default_src_pdo_mask
uint8_t snk_pdo_cnt
uint8_t default_sink_pdo_mask
uint8_t rp_supported
uint8_t pd_operation_en
uint8_t try_src_en
uint8_t cable_disc_en
uint8_t dead_bat_support
uint8_t err_recovery_en
uint8_t port_disable
uint8_t reserved_2 [2]
uint16_t reserved_3 [5]
uint32_t src_pdo_list [MAX_NO_OF_PDO]
uint32_t snk_pdo_list [MAX_NO_OF_PDO]
uint16_t snk_pdo_max_min_current_pwr [MAX_NO_OF_PDO]
uint16_t reserved_4
uint8_t protect_en
uint8_t ovp_threshold
uint8_t ovp_debounce
uint8_t ocp_threshold
uint8_t ocp_debounce
uint8_t ocp_offtime
uint8_t ocp_retry_cnt
uint8_t ocp_sample_period
uint8_t muxsel_gpio_map [8]
uint8_t reserved_5 [8]
uint8_t dp_config_supported
uint8_t dp_mux_control
uint8_t dp_mode_trigger
uint8_t reserved_6 [9]
uint8_t bb_enable
uint8_t bb_always_on
uint8_t bb_option
uint8_t reserved_7
uint16_t bb_timeout
uint8_t reserved_8 [2]
uint8_t bb_bus_power
uint8_t bb_unique_container_id
uint8_t reserved_9 [2]
uint16_t bb_bos_dscr_offset
uint16_t bb_string_dscr_offset [15]
uint8_t reserved_10 [24]
The documentation for this struct was generated from the following file:
• pd_common/pd.h
Generated for CCGx Firmware Stack by Doxygen
49
50
Data Structure Documentation
5.39
pd_do_t::RDO_BAT Struct Reference
Data Fields
•
•
•
•
•
•
•
•
•
uint32_t max_op_power: 10
uint32_t op_power: 10
uint32_t rsrvd1: 4
uint32_t no_usb_suspend: 1
uint32_t usb_comm_cap: 1
uint32_t cap_mismatch: 1
uint32_t give_back_flag: 1
uint32_t obj_pos: 3
uint32_t rsrvd2: 1
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.40
pd_do_t::RDO_BAT_GIVEBACK Struct Reference
Data Fields
•
•
•
•
•
•
•
•
•
uint32_t min_op_power: 10
uint32_t op_power: 10
uint32_t rsrvd1: 4
uint32_t no_usb_suspend: 1
uint32_t usb_comm_cap: 1
uint32_t cap_mismatch: 1
uint32_t give_back_flag: 1
uint32_t obj_pos: 3
uint32_t rsrvd2: 1
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.41
pd_do_t::RDO_FIXED_VAR Struct Reference
Data Fields
•
•
•
•
•
•
•
•
•
uint32_t max_op_current: 10
uint32_t op_current: 10
uint32_t rsrvd1: 4
uint32_t no_usb_suspend: 1
uint32_t usb_comm_cap: 1
uint32_t cap_mismatch: 1
uint32_t give_back_flag: 1
uint32_t obj_pos: 3
uint32_t rsrvd2: 1
The documentation for this struct was generated from the following file:
• pd_common/pd.h
Generated for CCGx Firmware Stack by Doxygen
5.42 pd_do_t::RDO_FIXED_VAR_GIVEBACK Struct Reference
5.42
pd_do_t::RDO_FIXED_VAR_GIVEBACK Struct Reference
Data Fields
•
•
•
•
•
•
•
•
•
uint32_t min_op_current: 10
uint32_t op_current: 10
uint32_t rsrvd1: 4
uint32_t no_usb_suspend: 1
uint32_t usb_comm_cap: 1
uint32_t cap_mismatch: 1
uint32_t give_back_flag: 1
uint32_t obj_pos: 3
uint32_t rsrvd2: 1
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.43
pd_do_t::RDO_GEN Struct Reference
Data Fields
•
•
•
•
•
•
•
•
•
uint32_t min_max_power_cur: 10
uint32_t op_power_cur: 10
uint32_t rsrvd1: 4
uint32_t no_usb_suspend: 1
uint32_t usb_comm_cap: 1
uint32_t cap_mismatch: 1
uint32_t give_back_flag: 1
uint32_t obj_pos: 3
uint32_t rsrvd2: 1
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.44
pd_do_t::RDO_GEN_GVB Struct Reference
Data Fields
•
•
•
•
•
•
•
•
•
uint32_t max_power_cur: 10
uint32_t op_power_cur: 10
uint32_t rsrvd1: 4
uint32_t no_usb_suspend: 1
uint32_t usb_comm_cap: 1
uint32_t cap_mismatch: 1
uint32_t give_back_flag: 1
uint32_t obj_pos: 3
uint32_t rsrvd2: 1
The documentation for this struct was generated from the following file:
• pd_common/pd.h
Generated for CCGx Firmware Stack by Doxygen
51
52
Data Structure Documentation
5.45
pd_do_t::SLICE_SUBHDR Struct Reference
Data Fields
•
•
•
•
uint32_t am_addr: 20
uint32_t vdo_cnt: 3
uint32_t multi_part: 1
uint32_t data_cnt: 8
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.46
pd_do_t::SLICE_VDO Struct Reference
Data Fields
• uint32_t slice_mode: 16
• uint32_t module_type: 2
• uint32_t rsvd: 2
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.47
pd_do_t::SRC_GEN Struct Reference
Data Fields
•
•
•
•
uint32_t max_cur_power: 10
uint32_t min_voltage: 10
uint32_t max_voltage: 10
uint32_t supply_type: 2
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.48
pd_do_t::STD_AMA_VDO Struct Reference
Data Fields
•
•
•
•
•
•
•
•
uint32_t usb_ss_sup: 3
uint32_t vbus_req: 1
uint32_t vcon_req: 1
uint32_t vcon_pwr: 3
uint32_t ssrx2: 1
uint32_t ssrx1: 1
uint32_t sstx2: 1
uint32_t sstx1: 1
Generated for CCGx Firmware Stack by Doxygen
5.49 pd_do_t::STD_CBL_VDO Struct Reference
• uint32_t rsvd1: 12
• uint32_t cbl_fw_ver: 4
• uint32_t cbl_hw_ver: 4
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.49
pd_do_t::STD_CBL_VDO Struct Reference
Data Fields
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
uint32_t usb_ss_sup: 3
uint32_t sop_dp: 1
uint32_t vbus_thru_cbl: 1
uint32_t vbus_cur: 2
uint32_t ssrx2: 1
uint32_t ssrx1: 1
uint32_t sstx2: 1
uint32_t sstx1: 1
uint32_t cbl_term: 2
uint32_t cbl_latency: 4
uint32_t typec_plug: 1
uint32_t typec_abc: 2
uint32_t rsvd1: 4
uint32_t cbl_fw_ver: 4
uint32_t cbl_hw_ver: 4
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.50
pd_do_t::STD_CERT_VDO Struct Reference
Data Fields
• uint32_t usb_cmpl: 20
• uint32_t rsvd1: 12
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.51
pd_do_t::STD_DP_VDO Struct Reference
Data Fields
•
•
•
•
uint32_t port_cap: 2
uint32_t signal: 4
uint32_t recep: 1
uint32_t usb2_0: 1
Generated for CCGx Firmware Stack by Doxygen
53
54
Data Structure Documentation
• uint32_t dfp_d_pin: 8
• uint32_t ufp_d_pin: 8
• uint32_t rsvd: 8
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.52
pd_do_t::STD_PROD_VDO Struct Reference
Data Fields
• uint32_t bcd_dev: 16
• uint32_t usb_pid: 16
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.53
pd_do_t::STD_SVID_RESP_VDO Struct Reference
Data Fields
• uint32_t svid_n1: 16
• uint32_t svid_n: 16
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.54
pd_do_t::STD_VDM_HDR Struct Reference
Data Fields
• uint32_t cmd: 5
• uint32_t rsvd1: 1
• uint32_t cmd_type: 2
• uint32_t obj_pos: 3
• uint32_t rsvd2: 2
• uint32_t st_ver: 2
• uint32_t vdm_type: 1
• uint32_t svid: 16
The documentation for this struct was generated from the following file:
• pd_common/pd.h
Generated for CCGx Firmware Stack by Doxygen
5.55 pd_do_t::STD_VDM_ID_HDR Struct Reference
5.55
55
pd_do_t::STD_VDM_ID_HDR Struct Reference
Data Fields
•
•
•
•
•
•
uint32_t usb_vid: 16
uint32_t rsvd1: 10
uint32_t mod_support: 1
uint32_t prod_type: 3
uint32_t usb_dev: 1
uint32_t usb_host: 1
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.56
sys_fw_metadata_t Struct Reference
#include <boot.h>
Data Fields
•
•
•
•
•
•
•
•
•
•
•
•
•
uint8_t fw_checksum
uint32_t fw_entry
uint16_t boot_last_row
uint8_t reserved1 [2]
uint32_t fw_size
uint8_t reserved2 [3]
uint8_t active_boot_app
uint8_t boot_app_ver_status
uint16_t boot_app_version
uint16_t boot_app_id
uint16_t metadata_valid
uint32_t fw_version
uint32_t boot_seq
5.56.1
Detailed Description
CCGx Firmware metadata structure.
This structure defines the format of the firmware metadata that is stored on device flash. The boot-loader uses
the metadata to identify the firmware validity. location, size, start address etc. The metadata for the two runtime
firmware images (FW1 and FW2) are located at fixed addresses (for each CCGx part), allowing the boot-loader to
precisely locate and validate the flash content during boot-up.
5.56.2
Field Documentation
5.56.2.1
uint8_t active_boot_app
Creator specific field. Not used in this implementation.
5.56.2.2
uint16_t boot_app_id
Creator specific field. Not used in this implementation.
Generated for CCGx Firmware Stack by Doxygen
56
Data Structure Documentation
5.56.2.3
uint8_t boot_app_ver_status
Creator specific field. Not used in this implementation.
5.56.2.4
uint16_t boot_app_version
Creator specific field. Not used in this implementation.
5.56.2.5
uint16_t boot_last_row
Last Flash row of Bootloader or previous firmware.
5.56.2.6
uint32_t boot_seq
Boot sequence number field. Boot-loader will load the valid FW copy that has the higher sequence number associated with it.
5.56.2.7
uint8_t fw_checksum
Single Byte FW Checksum.
5.56.2.8
uint32_t fw_entry
FW Entry Address
5.56.2.9
uint32_t fw_size
Size of Firmware.
5.56.2.10
uint32_t fw_version
Creator specific field. Not used in this implementation.
5.56.2.11
uint16_t metadata_valid
Metadata Valid field. Valid if contains "CY".
5.56.2.12
uint8_t reserved1[2]
Reserved.
5.56.2.13
uint8_t reserved2[3]
Reserved.
The documentation for this struct was generated from the following file:
• system/boot.h
Generated for CCGx Firmware Stack by Doxygen
5.57 pd_do_t::TBT_VDO Struct Reference
5.57
pd_do_t::TBT_VDO Struct Reference
Data Fields
• uint32_t intel_mode: 16
• uint32_t cbl_speed: 3
• uint32_t cbl_gen: 2
• uint32_t cbl_type: 1
• uint32_t cbl: 1
• uint32_t link_training: 1
• uint32_t leg_adpt: 1
• uint32_t rsvd: 7
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.58
ar_reg_t::USBPD_CMD_REG Struct Reference
#include <alp_ridge.h>
Data Fields
• uint32_t host_conn: 1
• uint32_t soft_rst: 1
• uint32_t intrpt_ack: 1
• uint32_t rsvd: 29
5.58.1
Detailed Description
Struct containing USB-PD controller command register fields for Alpine Ridge.
5.58.2
Field Documentation
5.58.2.1
uint32_t host_conn
B0: No host connected.
5.58.2.2
uint32_t intrpt_ack
B2: Alpine Ridge acknowledge for the interrupt.
5.58.2.3
uint32_t rsvd
B[31-3]: No host connected.
Generated for CCGx Firmware Stack by Doxygen
57
58
Data Structure Documentation
5.58.2.4
uint32_t soft_rst
B1: Issue USB-PD Controller soft reset.
The documentation for this struct was generated from the following file:
• app/alt_mode/alp_ridge.h
5.59
ar_reg_t::USBPD_STATUS_REG Struct Reference
#include <alp_ridge.h>
Data Fields
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
uint32_t data_conn_pres: 1
uint32_t conn_orien: 1
uint32_t active_cbl: 1
uint32_t ovc_indn: 1
uint32_t usb2_conn: 1
uint32_t usb3_conn: 1
uint32_t usb3_speed: 1
uint32_t usb_dr: 1
uint32_t dp_conn: 1
uint32_t dp_role: 1
uint32_t dp_pin_assign: 2
uint32_t rsvd1: 4
uint32_t tbt_conn: 1
uint32_t tbt_type: 1
uint32_t cbl_type: 1
uint32_t rsvd2: 1
uint32_t act_link_train: 1
uint32_t rsvd3: 2
uint32_t force_lsx: 1
uint32_t rsvd4: 1
uint32_t tbt_cbl_spd: 3
uint32_t tbt_cbl_gen: 2
uint32_t rsvd5: 2
5.59.1
Detailed Description
Struct containing USB-PD controller status to be reported to Alpine Ridge.
5.59.2
Field Documentation
5.59.2.1
uint32_t act_link_train
B20: Active TBT link training. From B23 of Cable MODE Response.
5.59.2.2
uint32_t active_cbl
B2: Active cable. From B22 of Cable MODE Response.
Generated for CCGx Firmware Stack by Doxygen
5.59 ar_reg_t::USBPD_STATUS_REG Struct Reference
5.59.2.3
uint32_t cbl_type
B18: TBT cable type. From B21 of Cable MODE Response.
5.59.2.4
uint32_t conn_orien
B1: CC polarity.
5.59.2.5
uint32_t data_conn_pres
B0: Whether data connection is present.
5.59.2.6
uint32_t dp_conn
B8: DP connection status.
5.59.2.7
uint32_t dp_pin_assign
B[11-10]: DP pin assignment. 4-lane='b00 2-lane='b01
5.59.2.8
uint32_t dp_role
B9: DP direction. Source=0, Sink=1.
5.59.2.9
uint32_t force_lsx
B23: Set to zero.
5.59.2.10
uint32_t ovc_indn
B3: Over-Current indication.
5.59.2.11
uint32_t rsvd1
B[15-12]: Reserved.
5.59.2.12
uint32_t rsvd2
B19: Reserved.
5.59.2.13
uint32_t rsvd3
B[22-21]: Reserved.
5.59.2.14
uint32_t rsvd4
B24: Reserved.
Generated for CCGx Firmware Stack by Doxygen
59
60
Data Structure Documentation
5.59.2.15
uint32_t rsvd5
B[31-30]: Reserved.
5.59.2.16
uint32_t tbt_cbl_gen
B[29-28]: Cable generation. From B20-19 of Cable MODE Response.
5.59.2.17
uint32_t tbt_cbl_spd
B[27-25]: Cable speed. From B18-B16 of Cable MODE Response.
5.59.2.18
uint32_t tbt_conn
B16: TBT connection status.
5.59.2.19
uint32_t tbt_type
B17: TBT type. From B16 of UFP MODE Response.
5.59.2.20
uint32_t usb2_conn
B4: USB 2.0 connection. Set when no ALT MODES are active.
5.59.2.21
uint32_t usb3_conn
B5: USB 3.1 connection. Set when no ALT MODES are active.
5.59.2.22
uint32_t usb3_speed
B6: USB Gen2/Gen1 speed. From B18-B16 of Cable MODE Response.
5.59.2.23
uint32_t usb_dr
B7: Data role. DFP=0, UFP=1.
The documentation for this struct was generated from the following file:
• app/alt_mode/alp_ridge.h
5.60
pd_do_t::USTD_VDM_HDR Struct Reference
Data Fields
•
•
•
•
•
•
uint32_t cmd: 5
uint32_t seq_num: 3
uint32_t rsvd1: 3
uint32_t cmd_type: 2
uint32_t vdm_ver: 2
uint32_t vdm_type: 1
Generated for CCGx Firmware Stack by Doxygen
5.61 pd_do_t::VAR_SNK Struct Reference
• uint32_t svid: 16
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.61
pd_do_t::VAR_SNK Struct Reference
Data Fields
•
•
•
•
uint32_t op_current: 10
uint32_t min_voltage: 10
uint32_t max_voltage: 10
uint32_t supply_type: 2
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.62
pd_do_t::VAR_SRC Struct Reference
Data Fields
•
•
•
•
uint32_t max_current: 10
uint32_t min_voltage: 10
uint32_t max_voltage: 10
uint32_t supply_type: 2
The documentation for this struct was generated from the following file:
• pd_common/pd.h
5.63
vdm_msg_info_t Struct Reference
#include <dfp_vdm_task_mngr.h>
Data Fields
•
•
•
•
•
•
5.63.1
uint8_t sop_type
uint8_t vdo_numb
uint8_t cmd
uint16_t svid
uint8_t obj_pos
pd_do_t vdo [MAX_NO_OF_VDO]
Detailed Description
Struct holds received/sent VDM info.
This struct holds received/sent VDM information which uses by DFP VDM alternative modes managers.
Generated for CCGx Firmware Stack by Doxygen
61
62
Data Structure Documentation
5.63.2
Field Documentation
5.63.2.1
uint8_t cmd
VDM command number.
5.63.2.2
uint8_t obj_pos
Object position for alt mode specific commands.
5.63.2.3
uint8_t sop_type
VDM SOP type .
5.63.2.4
uint16_t svid
VDM's SVID.
5.63.2.5 pd_do_t vdo[MAX_NO_OF_VDO]
VDO objects buffer.
5.63.2.6
uint8_t vdo_numb
Number of received VDOs in VDM.
The documentation for this struct was generated from the following file:
• app/alt_mode/dfp_vdm_task_mngr.h
5.64
vdm_resp_t Struct Reference
Data Fields
• pd_do_t resp_buf [MAX_NO_OF_DO]
• uint8_t do_count
• uint8_t no_resp
The documentation for this struct was generated from the following file:
• pd_common/pd.h
Generated for CCGx Firmware Stack by Doxygen
Chapter 6
File Documentation
6.1
app/alt_mode/alp_ridge.h File Reference
#include <project.h>
#include <alt_mode_hw.h>
Data Structures
• union ar_reg_t
• struct ar_reg_t::USBPD_STATUS_REG
• struct ar_reg_t::USBPD_CMD_REG
Functions
• bool ar_set_mux (uint8_t port, mux_select_t cfg, uint8_t polarity, uint32_t ar_cfg)
6.1.1
Detailed Description
Alpine Ridge control interface header file.
6.1.2
Function Documentation
6.1.2.1
bool ar_set_mux ( uint8_t port, mux_select_t cfg, uint8_t polarity, uint32_t ar_cfg )
This function set AR registers in accordance to input parameters.
Parameters
port
Port index the AR settings are performed for.
cfg
MUX configuration.
polarity
Attached target Type-C Polarity.
ar_cfg
Contains AR register settings in case of TBT alt mode is active.
Returns
true if AR was set successful, in the other case - false
64
File Documentation
6.2
app/alt_mode/alt_mode_hw.h File Reference
#include <project.h>
#include <stdbool.h>
Data Structures
• union alt_mode_hw_evt_t
• struct alt_mode_hw_evt_t::ALT_MODE_HW_EVT
Macros
• #define NO_DATA (0u)
• #define HPD_ENABLE_CMD (0u)
• #define HPD_DISABLE_CMD (4u)
Typedefs
• typedef void(∗ alt_mode_hw_cmd_cbk_t) (uint8_t port, uint32_t command)
Enumerations
• enum alt_mode_hw_t { ALT_MODE_MUX = 1, ALT_MODE_HPD }
• enum mux_select_t {
MUX_CONFIG_ISOLATE, MUX_CONFIG_2_0, MUX_CONFIG_SS_ONLY, MUX_CONFIG_DP_2_LANE,
MUX_CONFIG_DP_4_LANE, MUX_CONFIG_AR_CUSTOM, MUX_CONFIG_INIT, MUX_CONFIG_DEINIT
}
Functions
•
•
•
•
•
•
•
•
•
6.2.1
void alt_mode_hw_set_cbk (uint8_t port, alt_mode_hw_cmd_cbk_t cbk)
void alt_mode_hw_deinit (uint8_t port)
bool eval_app_alt_hw_cmd (uint8_t port, uint8_t ∗cmd_param)
bool eval_hpd_cmd (uint8_t port, uint32_t cmd)
bool eval_mux_cmd (uint8_t port, uint32_t cmd)
bool set_mux (uint8_t port, mux_select_t cfg, uint32_t custom_data)
bool alt_mode_hw_is_idle (uint8_t port)
void alt_mode_hw_sleep (uint8_t port)
void alt_mode_hw_wakeup (uint8_t port)
Detailed Description
Hardware control for Alternate mode implementation.
6.2.2
Enumeration Type Documentation
6.2.2.1
enum alt_mode_hw_t
Application HW type values which are used in alt_mode_hw_evt_t structure.
Generated for CCGx Firmware Stack by Doxygen
6.2 app/alt_mode/alt_mode_hw.h File Reference
65
Enumerator
ALT_MODE_MUX HW type - MUX.
ALT_MODE_HPD HW type - HPD transceiver/receiver.
6.2.2.2
enum mux_select_t
@ typedef mux_select_t @ brief Possible settings for the Type-C Data MUX. @ note This type should be extended
to cover all possible modes for the MUX.
Enumerator
MUX_CONFIG_ISOLATE Isolate configuration.
MUX_CONFIG_2_0 USB 2.0 configuration.
MUX_CONFIG_SS_ONLY USB SS configuration.
MUX_CONFIG_DP_2_LANE Two lane DP configuration.
MUX_CONFIG_DP_4_LANE Four lane DP configuration.
MUX_CONFIG_AR_CUSTOM AlpineRidge custom configuration.
MUX_CONFIG_INIT Enables MUX functionality.
MUX_CONFIG_DEINIT Disables MUX functionality.
6.2.3
Function Documentation
6.2.3.1
void alt_mode_hw_deinit ( uint8_t port )
This function deinits all HW related to alt modes.
Parameters
port
Port index the function is performed for.
Returns
None.
6.2.3.2
bool alt_mode_hw_is_idle ( uint8_t port )
Check whether the ALT. MODE hardware block is idle.
This function is part of the deep-sleep entry checks for the CCG device, and checks whether there are any pending
ALT. MODE hardware commands that require the device to be active.
Parameters
port
Port on which the hardware status is to be checked.
Returns
true if the block is idle, false otherwise.
Generated for CCGx Firmware Stack by Doxygen
66
File Documentation
6.2.3.3
void alt_mode_hw_set_cbk ( uint8_t port, alt_mode_hw_cmd_cbk_t cbk )
This function registers an ALT. MODE hardware callback function.
Parameters
port
Port for which the callback is registered.
cbk
Callback function for ALT. MODE hardware events.
Returns
None.
6.2.3.4
void alt_mode_hw_sleep ( uint8_t port )
Prepare the Alt. Mode hardware state for device deep-sleep.
Parameters
port
The port whose hardware state is to be configured.
Returns
None.
6.2.3.5
void alt_mode_hw_wakeup ( uint8_t port )
Restore Alt. Mode hardware state after device resumes from deep-sleep.
Parameters
port
The port whose hardware state is to be restored.
Returns
None
6.2.3.6
bool eval_app_alt_hw_cmd ( uint8_t port, uint8_t ∗ cmd_param )
This function evaluates received application HW command.
Parameters
port
Port index the function is performed for.
cmd_param
Pointer to received application HW command data.
Returns
true if APP command passed successful, false if APP command is invalid or contain unacceptable fields.
Generated for CCGx Firmware Stack by Doxygen
6.3 app/alt_mode/alt_modes_mngr.h File Reference
6.2.3.7
67
bool eval_hpd_cmd ( uint8_t port, uint32_t cmd )
This function evaluates received HPD application command.
Parameters
port
Port index the function is performed for.
cmd
Pointer to received HPD application command data.
Returns
true if HPD APP command passed successful, false if HPD APP command is invalid or contain unacceptable
fields.
6.2.3.8
bool eval_mux_cmd ( uint8_t port, uint32_t cmd )
This function evaluates received MUX application command.
Parameters
port
Port index the function is performed for.
cmd
Pointer to received MUX application command data.
Returns
true if MUX APP command passed successful, false if MUX APP command is invalid or contain unacceptable
fields.
6.2.3.9
bool set_mux ( uint8_t port, mux_select_t cfg, uint32_t custom_data )
This function sex appropriate MUX configuration based on the function parameters.
Parameters
port
Port index the function is performed for.
cfg
Required MUX configuration.
custom_data
Additional data in case of custom AR MUX configuration.
Returns
true if MUX set passed successful, false if MUX setting is invalid or contain unacceptable fields.
6.3
app/alt_mode/alt_modes_mngr.h File Reference
#include
#include
#include
#include
<project.h>
<pd.h>
<config.h>
<dfp_vdm_task_mngr.h>
Generated for CCGx Firmware Stack by Doxygen
68
File Documentation
Data Structures
• union alt_mode_evt_t
• struct alt_mode_evt_t::ALT_MODE_EVT
• struct alt_mode_evt_t::ALT_MODE_EVT_DATA
• struct comp_tbl_t
• struct bm_alt_modes_t
• struct disc_mode_info_t
• struct alt_mode_cmd_info_t
Macros
• #define ATCH_TGT (1u)
• #define CABLE (2u)
• #define MODE_NOT_SUPPORTED (0xFFu)
• #define EMPTY_VDO (0x00000000u)
• #define NONE_VDO (0xFFFFFFFFu)
• #define MAX_SUPP_ALT_MODES (4u)
• #define VDO_START_IDX (1u)
• #define NONE_MODE_MASK (0x00000000u)
• #define FULL_MASK (0xFFFFFFFFu)
• #define EN_FLAG_MASK (0x00000001u)
• #define EXIT_ALL_MODES (0x7u)
• #define CBL_DIR_SUPP_MASK (0x780u)
• #define USB_2_0_SUPP (0u)
• #define USB_GEN_1_SUPP (1u)
• #define USB_GEN_2_SUPP (2u)
• #define ALT_MODE_EVT_SIZE (2u)
• #define ALT_MODE_EVT_IDX (0u)
• #define ALT_MODE_EVT_DATA_IDX (1u)
• #define NO_DATA (0u)
• #define MAX_RETRY_CNT (3u)
• #define MAX_BUSY_RETRY_CNT (10u)
• #define SET_FLAG(status, bit_idx) ((status) |= (1 << ((uint32_t)(bit_idx))))
• #define REMOVE_FLAG(status, bit_idx) ((status) &= (∼(1 << ((uint32_t)(bit_idx)))))
• #define IS_FLAG_CHECKED(status, bit_idx) (((status) >> (uint32_t)(bit_idx)) & EN_FLAG_MASK)
Typedefs
• typedef void(∗ alt_mode_cbk_t) (uint8_t port)
• typedef bool(∗ alt_mode_app_cbk_t) (uint8_t port, alt_mode_evt_t app_cmd)
Enumerations
• enum alt_mode_mngr_state_t { ALT_MODE_MNGR_STATE_DISC_MODE = 0, ALT_MODE_MNGR_WA←IT_EC_TRIGGER, ALT_MODE_MNGR_STATE_PROCESS, ALT_MODE_MNGR_STATE_EXIT }
• enum alt_mode_state_t {
ALT_MODE_STATE_IDLE = 0, ALT_MODE_STATE_INIT, ALT_MODE_STATE_SEND, ALT_MODE_ST←ATE_WAIT_FOR_RESP,
ALT_MODE_STATE_FAIL, ALT_MODE_STATE_RUN, ALT_MODE_STATE_EXIT, ALT_MODE_STATE←_DISABLE }
Generated for CCGx Firmware Stack by Doxygen
6.3 app/alt_mode/alt_modes_mngr.h File Reference
69
• enum alt_mode_app_evt_t {
AM_NO_EVT = 0, AM_EVT_SVID_NOT_FOUND, AM_EVT_ALT_MODE_ENTERED, AM_EVT_ALT_MO←DE_EXITED,
AM_EVT_DISC_FINISHED, AM_EVT_SVID_NOT_SUPP, AM_EVT_SVID_SUPP, AM_EVT_ALT_MODE←_SUPP,
AM_EVT_SOP_RESP_FAILED, AM_EVT_CBL_RESP_FAILED, AM_EVT_CBL_NOT_SUPP_ALT_MODE,
AM_EVT_NOT_SUPP_PARTNER_CAP,
AM_EVT_DATA_EVT }
• enum alt_mode_app_cmd_t {
AM_NO_CMD = 0, AM_CMD_EN_TRIG, AM_CMD_DIS_TRIG, AM_CMD_ENTER,
AM_CMD_EXIT, AM_CMD_SPEC }
Functions
• dfp_vdm_task_t reg_src_alt_mode (uint8_t port, atch_tgt_info_t ∗atch_tgt_info, vdm_msg_info_t ∗vdm_←msg_info)
• dfp_vdm_task_t vdm_task_mng_alt_mode_process (uint8_t port, dfp_vdm_evt_t vdm_evt)
• void ufp_alt_mode_mngr (uint8_t port)
• bool eval_rec_vdm (uint8_t port, const pd_packet_t ∗vdm)
• void ufp_alt_mode_mng_deinit (uint8_t port)
• bool ufp_alt_mode_idle (uint8_t port)
• const uint32_t ∗ form_alt_mode_event (uint8_t port, uint16 svid, uint8_t am_idx, alt_mode_app_evt_t evt,
uint32_t data)
• bool eval_app_alt_mode_cmd (uint8_t port, uint8_t ∗cmd, uint8_t ∗data)
• bool is_dfp_alt_mode_mngr_idle (uint8_t port)
• void dfp_alt_mode_mngr_sleep (uint8_t port)
• void dfp_alt_mode_mngr_wakeup (uint8_t port)
• void reset_alt_mode_info (alt_mode_cmd_info_t ∗info)
• dpm_pd_cmd_buf_t ∗ get_vdm_buff (uint8_t port)
• uint8_t is_svid_supported (uint16_t svid)
6.3.1
Detailed Description
Alternate Mode Manager header file.
6.3.2
Typedef Documentation
6.3.2.1
typedef bool(∗ alt_mode_app_cbk_t) (uint8_t port, alt_mode_evt_t app_cmd)
This type of the function is used by alt modes manager to run alternative mode analisys of received APP command
.
Parameters
port
Port index the function is performed for.
hpi_cmd
Received APP command data.
Returns
true if APP command passed successful, false if APP command is invalid or contain unacceptable fields.
Generated for CCGx Firmware Stack by Doxygen
70
File Documentation
6.3.2.2
typedef void(∗ alt_mode_cbk_t) (uint8_t port)
This type of the function is used by alt modes manager to communicate with any of supported alt modes.
Parameters
port
Port index the function is performed for .
Returns
None.
6.3.3
Enumeration Type Documentation
6.3.3.1
enum alt_mode_app_cmd_t
This enumeration holds all possible APP command related to Alt modes handling.
Enumerator
AM_NO_CMD Empty command.
AM_CMD_EN_TRIG Set alt modes manager to wait for EC command to enter alt mode after discovery is
done.
AM_CMD_DIS_TRIG Set alt modes manager to handle supported alternative modes automaticaly after discovery is done.
AM_CMD_ENTER Enter to selected alternative mode.
AM_CMD_EXIT Exit from selected alternative mode.
AM_CMD_SPEC Specific alternative EC mode command with data.
6.3.3.2
enum alt_mode_app_evt_t
This enumeration holds all possible application events related to Alt modes handling.
Enumerator
AM_NO_EVT Empty event.
AM_EVT_SVID_NOT_FOUND Sends to EC if UFP doesn't support any SVID.
AM_EVT_ALT_MODE_ENTERED Alternative mode entered.
AM_EVT_ALT_MODE_EXITED Alternative mode exited.
AM_EVT_DISC_FINISHED Discovery process was finished.
AM_EVT_SVID_NOT_SUPP CCGx doesn't support received SVID.
AM_EVT_SVID_SUPP CCGx supports received SVID.
AM_EVT_ALT_MODE_SUPP CCGx supports alternate mode.
AM_EVT_SOP_RESP_FAILED UFP VDM response failed.
AM_EVT_CBL_RESP_FAILED Cable response failed.
AM_EVT_CBL_NOT_SUPP_ALT_MODE Cable capabilities couldn't provide alternative mode hanling.
AM_EVT_NOT_SUPP_PARTNER_CAP CCGx and UFP capabilities not consistent.
AM_EVT_DATA_EVT Specific alternative mode event with data.
Generated for CCGx Firmware Stack by Doxygen
6.3 app/alt_mode/alt_modes_mngr.h File Reference
6.3.3.3
71
enum alt_mode_mngr_state_t
This enumeration holds all possible Alt modes manager states when DFP.
Enumerator
ALT_MODE_MNGR_STATE_DISC_MODE Alt modes manager discovery mode state.
ALT_MODE_MNGR_WAIT_EC_TRIGGER Alt modes manager is waiting for EC command to enter alt
mode.
ALT_MODE_MNGR_STATE_PROCESS Alt modes manager alternative modes processing state.
ALT_MODE_MNGR_STATE_EXIT Alt modes manager exits and resets its own variables on this state.
6.3.3.4
enum alt_mode_state_t
This enumeration holds all possible states of each alt mode which is handled by Alt modes manager.
Enumerator
ALT_MODE_STATE_IDLE State when alternative mode is idle.
ALT_MODE_STATE_INIT State when alternative mode initiate its functionality.
ALT_MODE_STATE_SEND State when alternative mode needs to send VDM message.
ALT_MODE_STATE_WAIT_FOR_RESP State while alternative mode wait for VDM response.
ALT_MODE_STATE_FAIL State when alternative mode VDM response fails.
ALT_MODE_STATE_RUN State when alternative mode need to be running.
ALT_MODE_STATE_EXIT State when alternative mode exits and resets all related variables.
ALT_MODE_STATE_DISABLE State when alternative mode functionality is disabled.
6.3.4
Function Documentation
6.3.4.1
void dfp_alt_mode_mngr_sleep ( uint8_t port )
Prepare the DFP alt modes manager for device deep sleep.
Parameters
port
Index of USB-PD port to be prepared for sleep.
Returns
None
6.3.4.2
void dfp_alt_mode_mngr_wakeup ( uint8_t port )
Restore the DFP alt modes manager state after waking from deep sleep.
Parameters
port
Index of USB-PD port to be restored.
Generated for CCGx Firmware Stack by Doxygen
72
File Documentation
Returns
None
6.3.4.3
bool eval_app_alt_mode_cmd ( uint8_t port, uint8_t ∗ cmd, uint8_t ∗ data )
This function analises, parses and run alternative mode analisys function if received command is specific alt mode
command.
Parameters
port
Port index the function is performed for.
cmd
data
Pointer to received alt mode APP command.
Pointer to received alt mode APP command additional data.
Returns
true if APP command passed successful, false if APP command is invalid or contain unacceptable fields.
6.3.4.4
bool eval_rec_vdm ( uint8_t port, const pd_packet_t ∗ vdm )
This function run received VDM analisys if CCG is UFP.
Parameters
port
Port index the function is performed for.
vdm
Pointer to pd packet which contains received VDM.
Returns
true if received VDM could handled successful and VDM response need to be sent with ACK. If received VDM
should be NACKed then returns false
6.3.4.5
const uint32_t∗ form_alt_mode_event ( uint8_t port, uint16 svid, uint8_t am_idx, alt_mode_app_evt_t evt,
uint32_t data )
Fill alt mode APP event fields with appropriate values.
Parameters
port
Port index the event is performed for.
svid
am_idx
SVID of alternative mode which event refers to.
Index of alternative mode in compatibility table which event refers to.
evt
data
Alternative mode APP event.
Alternative mode APP event data.
Returns
pointer to the event related data.
Generated for CCGx Firmware Stack by Doxygen
6.3 app/alt_mode/alt_modes_mngr.h File Reference
6.3.4.6 dpm_pd_cmd_buf_t∗ get_vdm_buff ( uint8_t port )
Returns pointer to VDM buffer.
Parameters
port
Index of Type-C port.
Returns
Pointer to VDM buffer.
6.3.4.7
bool is_dfp_alt_mode_mngr_idle ( uint8_t port )
Check whether the DFP VDM manager for the selected port is idle.
Parameters
port
Port index the function is performed for.
Returns
true if manager is busy, false - if idle.
6.3.4.8
uint8_t is_svid_supported ( uint16_t svid )
Check for presence of alt modes for given svid in alt modes compatibility table.
Parameters
svid
Received SVID.
Returns
True if SVID is supported by CCG.
6.3.4.9 dfp_vdm_task_t reg_src_alt_mode ( uint8_t port, atch_tgt_info_t ∗ atch_tgt_info, vdm_msg_info_t ∗
vdm_msg_info )
This function register pointers to attached dev/ama/cable info and run alt modes manager if success.
Parameters
port
Port index the function is performed for.
atch_tgt_info
Pointer to struct which holds discovery info about attached targets.
vdm_msg_info
Pointer to struct which holds info of received/sent VDM
Generated for CCGx Firmware Stack by Doxygen
73
74
File Documentation
Returns
DFP VDM manager task DFP_TASK_ALT_MODE if CCG support any alternative mode. If CCG doesn't
support alternative modes function returns DFP_TASK_EXIT.
6.3.4.10
void reset_alt_mode_info ( alt_mode_cmd_info_t ∗ info )
Resets alternative mode command info structure.
Parameters
info
Pointer to alternative mode info structure.
Returns
None.
6.3.4.11
bool ufp_alt_mode_idle ( uint8_t port )
Check whether the UFP VDM manager for the selected port is idle.
Parameters
port
Port index the function is performed for.
Returns
true if manager is busy, false - if idle.
6.3.4.12
void ufp_alt_mode_mng_deinit ( uint8_t port )
This function resets all UFP alt modes manager variables and disables all related functionality.
Parameters
port
Port index the function is performed for.
Returns
None
6.3.4.13
void ufp_alt_mode_mngr ( uint8_t port )
This main UFP alt mode manager functions which is used to manage alternative modes when CCG is UFP.
Parameters
port
Port index the function is performed for.
Generated for CCGx Firmware Stack by Doxygen
6.4 app/alt_mode/dfp_vdm_task_mngr.h File Reference
75
Returns
None
6.3.4.14 dfp_vdm_task_t vdm_task_mng_alt_mode_process ( uint8_t port, dfp_vdm_evt_t vdm_evt )
This function uses by DFP VDM manager to run alt modes manager processing.
Parameters
port
Port index the function is performed for.
vdm_evt
Current DFP VDM manager event.
Returns
DFP VDM manager task based on alt modes manager processing results.
6.4
app/alt_mode/dfp_vdm_task_mngr.h File Reference
#include <project.h>
#include <pd.h>
#include <config.h>
Data Structures
• struct atch_tgt_info_t
• struct vdm_msg_info_t
Macros
•
•
•
•
•
#define PD_SVID_ID_HDR_VDO_START_IDX (4u)
#define MAX_SVID_VDO_SUPP (32u)
#define MAX_CABLE_SVID_SUPP (8u)
#define ATT_QUEUE_SIZE (12u)
#define STD_SVID (0xFF00u)
Enumerations
• enum dfp_vdm_task_t {
DFP_TASK_WAIT = 0, DFP_TASK_INIT, DFP_TASK_DISC_ID, DFP_TASK_DISC_SVID,
DFP_TASK_REG_ATCH_TGT_INFO, DFP_TASK_EXIT, DFP_TASK_SEND_MSG, DFP_TASK_ALT_M←ODE }
• enum dfp_vdm_evt_t { VDM_EVT_RUN = 0, VDM_EVT_EVAL, VDM_EVT_FAIL, VDM_EVT_EXIT }
Functions
•
•
•
•
•
void enable_vdm_task_mng (uint8_t port)
void dfp_vdm_task_mngr (uint8_t port)
void eval_attention (uint8_t port, const pd_packet_t ∗vdm_rcv)
void vdm_task_mng_deinit (uint8_t port)
bool dfp_vdm_task_idle (uint8_t port)
Generated for CCGx Firmware Stack by Doxygen
76
File Documentation
6.4.1
Detailed Description
DFP VDM task manager header file.
6.4.2
Enumeration Type Documentation
6.4.2.1
enum dfp_vdm_evt_t
DFP VDM manager events definition.
This enumeration lists the various DFP VDM mngr events to handle VDMs.
Enumerator
VDM_EVT_RUN This event is responsible for running any of DFP VDM manager task .
VDM_EVT_EVAL This event is responsible for eveluating VDM response .
VDM_EVT_FAIL This event notifies task manager task if VDM rersponse fails .
VDM_EVT_EXIT This event runs exiting from DFP VDM task manager task .
6.4.2.2
enum dfp_vdm_task_t
DFP VDM manager tasks definition.
This enumeration lists the various DFP VDM mngr tasks to handle VDMs.
Enumerator
DFP_TASK_WAIT DFP manager wait task while waiting for UFP response.
DFP_TASK_INIT This task is responsible for inializing of DFP VDM manager.
DFP_TASK_DISC_ID This task is responsible for VDM Discovery ID flow.
DFP_TASK_DISC_SVID This task is responsible for VDM Discovery SVID flow.
DFP_TASK_REG_ATCH_TGT_INFO This task is responsible for registering of Discovery result information
in alt mode manager.
DFP_TASK_EXIT This task deinits DFP VDM task manager.
DFP_TASK_SEND_MSG This task is responsible for forming and sending VDM message .
DFP_TASK_ALT_MODE This task is responsible for running of alt mode manager .
6.4.3
Function Documentation
6.4.3.1
bool dfp_vdm_task_idle ( uint8_t port )
Check whether the DFP VDM task for the port is idle.
Parameters
port
PD port corresponding to the VDM task manager.
Returns
None.
Generated for CCGx Firmware Stack by Doxygen
6.4 app/alt_mode/dfp_vdm_task_mngr.h File Reference
6.4.3.2
void dfp_vdm_task_mngr ( uint8_t port )
Main VDM task mngr function.
Parameters
port
PD port corresponding to the VDM task manager.
Returns
None.
6.4.3.3
void enable_vdm_task_mng ( uint8_t port )
Enables VDM task mngr functionality.
Parameters
port
PD port corresponding to the VDM task manager.
Returns
None.
6.4.3.4
void eval_attention ( uint8_t port, const pd_packet_t ∗ vdm_rcv )
This function uses to process received Attention message .
Parameters
port
PD port corresponding to the received Attention message.
vdm_rcv
PD packet that contains the received Attention message.
Returns
None.
6.4.3.5
void vdm_task_mng_deinit ( uint8_t port )
This function deinits VDM task manager and resets all related variables.
Parameters
port
PD port corresponding to the VDM task manager.
Returns
None.
Generated for CCGx Firmware Stack by Doxygen
77
78
File Documentation
6.5
app/alt_mode/dp_sid.h File Reference
#include <project.h>
#include <pd.h>
#include <alt_modes_mngr.h>
Macros
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
#define DP_SVID (0xFF01u)
#define DP_ALT_MODE_ID (0u)
#define MAX_DP_VDO_NUMB (1u)
#define DP_VDO_IDX (0u)
#define GET_DP_SVID_ALT_MODE(status) (status & 0xFF000000)
#define STATUS_UPDATE_VDO (0x01u)
#define DP_1_3_SIGNALING (0x0001u)
#define DP_CONFIG_SELECT (2u)
#define DP_USB_SS_CONFIG (0b00000000u)
#define DP_DFP_D_CONFIG_C (0b00000100u)
#define DP_DFP_D_CONFIG_D (0b00001000u)
#define DP_DFP_D_CONFIG_E (0b00010000u)
#define DP_DFP_D_CONFIG_F (0b00100000u)
#define DP_INVALID_CFG (0b11111111u)
#define HPD_LOW_IRQ_LOW (0x0u)
#define HPD_HIGH_IRQ_LOW (0x1u)
#define HPD_LOW_IRQ_HIGH (0x2u)
#define HPD_HIGH_IRQ_HIGH (0x3u)
#define DP_QUEUE_STATE_SIZE (2u)
#define DP_HPD_STATE_MASK (0x0003u)
#define DP_QUEUE_EMPTY_INDEX (0x0u)
#define DP_QUEUE_FULL_INDEX (15u)
#define GET_HPD_IRQ_STAT(status) (((status) >> 7u)& 0x3 )
#define EC_DP_MUX_CTRL_CMD (1u)
#define DP_EC_CFG_CMD (2u)
#define DP_EC_CFG_USB_IDX (6u)
#define DP_EC_CFG_CMD_MAX_NUMB (6u)
#define DP_ALLOWED_MUX_CONFIG_EVT (1u)
#define DP_STATUS_UPDATE_EVT (2u)
#define DP_EC_CFG_CMD_ACK_MASK (0x200)
Enumerations
• enum dp_state_t {
DP_STATE_IDLE = 0, DP_STATE_ENTER = 4, DP_STATE_STATUS_UPDATE = 16, DP_STATE_CON←FIG = 17,
DP_STATE_ATT = 6, DP_STATE_EXIT = 5 }
• enum dp_port_cap_t { DP_PORT_CAP_RSVD = 0, DP_PORT_CAP_UFP_D, DP_PORT_CAP_DFP_D, D←P_PORT_CAP_BOTH }
• enum dp_conn_t { DP_CONN_NONE = 0, DP_CONN_DFP_D, DP_CONN_UFP_D, DP_CONN_BOTH }
Functions
• alt_mode_cmd_info_t ∗ reg_dp_modes (uint8_t port, disc_mode_info_t ∗disc_mode_info)
Generated for CCGx Firmware Stack by Doxygen
6.5 app/alt_mode/dp_sid.h File Reference
6.5.1
79
Detailed Description
DisplayPort alternate mode handler header file.
6.5.2
Enumeration Type Documentation
6.5.2.1
enum dp_conn_t
This enumeration holds possible DFP_D/UFP_D Connected status (Status Update Messege).
Enumerator
DP_CONN_NONE Neither DFP_D nor UFP_D is connected.
DP_CONN_DFP_D DFP_D is connected.
DP_CONN_UFP_D UFP_D is connected.
DP_CONN_BOTH Both DFP_D and UFP_D are connected.
6.5.2.2
enum dp_port_cap_t
This enumeration holds possible DP capabilities.
Enumerator
DP_PORT_CAP_RSVD Reserved capability.
DP_PORT_CAP_UFP_D UFP is UFP_D-capable.
DP_PORT_CAP_DFP_D UFP is DFP_D-capable.
DP_PORT_CAP_BOTH UFP is DFP_D and UFP-D capable.
6.5.2.3
enum dp_state_t
This enumeration holds all possible DP states.
Enumerator
DP_STATE_IDLE Idle state.
DP_STATE_ENTER Enter mode state.
DP_STATE_STATUS_UPDATE DP Status Update state.
DP_STATE_CONFIG DP Configure state.
DP_STATE_ATT DP Attention state.
DP_STATE_EXIT Exit mode state.
6.5.3
Function Documentation
6.5.3.1
alt_mode_cmd_info_t∗ reg_dp_modes ( uint8_t port, disc_mode_info_t ∗ disc_mode_info )
This function analyses Discovery ID/SVID/MODE information to find out if further DP alternative mode processing
is allowed.
Parameters
port
Port index the function is performed for.
disc_mode_info
Pointer to structure which holds Discovery info.
Generated for CCGx Firmware Stack by Doxygen
80
File Documentation
Returns
Pointer to DP alternative mode command structure if analisys passed successful. In other case function
returns NULL pointer
6.6
app/alt_mode/intel_vid.h File Reference
#include <project.h>
#include <pd.h>
#include <alt_modes_mngr.h>
Macros
• #define INTEL_VID (0x8087u)
• #define TBT_ALT_MODE_ID (1u)
• #define MAX_TBT_VDO_NUMB (1u)
• #define TBT_VDO_IDX (0u)
• #define GET_LEGACY_TBT_ADAPTER(status) ((status >> 16) & 0x1)
• #define TBT_EXIT(status) ((status >> 4) & 0x1)
• #define BB_STATUS(status) ((status >> 3) & 0x1)
• #define USB2_ENABLE(status) ((status >> 2) & 0x1)
Enumerations
• enum tbt_state_t { TBT_STATE_IDLE = 0, TBT_STATE_ENTER = 4, TBT_STATE_ATT = 6, TBT_STATE←_EXIT = 5 }
• enum tbt_cbl_status { NO_CBL_CONN = 0, TBT_CBL, DP_CBL, OTHER_CBL_AMA }
Functions
• alt_mode_cmd_info_t ∗ reg_intel_modes (uint8_t port, disc_mode_info_t ∗disc_mode_info)
6.6.1
Detailed Description
Thunderbolt (Intel VID) alternate mode handler header file.
6.6.2
Enumeration Type Documentation
6.6.2.1
enum tbt_cbl_status
This enumeration holds all possible Legacy TBT mDP Cable Statuses field from Attention VDO.
Enumerator
NO_CBL_CONN No Cable connected.
TBT_CBL TBT Cable.
DP_CBL DP Cable.
OTHER_CBL_AMA Other Cable/Adapter.
Generated for CCGx Firmware Stack by Doxygen
6.7 app/app.h File Reference
6.6.2.2
81
enum tbt_state_t
This enumeration holds all possible TBT states.
Enumerator
TBT_STATE_IDLE Idle state.
TBT_STATE_ENTER Enter mode state.
TBT_STATE_ATT Attention state.
TBT_STATE_EXIT Exit mode state.
6.6.3
Function Documentation
6.6.3.1 alt_mode_cmd_info_t∗ reg_intel_modes ( uint8_t port, disc_mode_info_t ∗ disc_mode_info )
This function analyses Discovery ID/SVID/MODE information to find out if further TBT alternative mode processing
is allowed.
Parameters
port
Port index the function is performed for.
disc_mode_info
Pointer to structure which holds Discovery info.
Returns
Pointer to TBT alternative mode command structure if analisys passed successful. In other case function
returns NULL pointer
6.7
app/app.h File Reference
#include
#include
#include
#include
<project.h>
<pd.h>
<pdss_hal.h>
<alt_mode_hw.h>
Data Structures
• struct app_status_t
Macros
•
•
•
•
•
•
•
•
•
•
#define APP_PSOURCE_EN_TIMER (APP_TIMERS_START_ID)
#define APP_PSOURCE_EN_MONITOR_TIMER (31u)
#define APP_PSOURCE_EN_HYS_TIMER (32u)
#define APP_PSOURCE_DIS_TIMER (33u)
#define APP_PSOURCE_DIS_MONITOR_TIMER (34u)
#define APP_DB_SNK_FET_DIS_DELAY_TIMER (35u)
#define APP_VDM_BUSY_TIMER (40u)
#define APP_AME_TIMEOUT_TIMER (41u)
#define APP_BB_TIMEOUT_TIMER (42u)
#define APP_VDM_BUSY_TIMER_PERIOD (50u)
Generated for CCGx Firmware Stack by Doxygen
82
File Documentation
• #define APP_AME_TIMEOUT_TIMER_PERIOD (1000u)
• #define APP_DB_SNK_FET_DIS_DELAY_TIMER_PERIOD (50u)
Functions
•
•
•
•
•
•
•
•
•
•
•
•
•
void app_init (void)
void sln_pd_event_handler (uint8_t port, app_evt_t evt, const void ∗data)
uint8_t app_task (uint8_t port)
app_cbk_t ∗ app_get_callback_ptr (uint8_t port)
uint8_t app_event_handler (uint8_t port, app_evt_t evt, const void ∗dat)
app_resp_t ∗ app_get_resp_buf (uint8_t port)
app_status_t ∗ app_get_status (uint8_t port)
bool app_sleep (void)
void app_wakeup (void)
bool app_is_cbl_disc_done (uint8_t port)
bool system_sleep (void)
bool mux_ctrl_init (uint8_t port)
bool mux_ctrl_set_cfg (uint8_t port, mux_select_t cfg, uint8_t polarity)
6.7.1
Detailed Description
PD application handler header file.
6.7.2
Function Documentation
6.7.2.1
uint8_t app_event_handler ( uint8_t port, app_evt_t evt, const void ∗ dat )
Handler for event notifications from the PD stack.
Parameters
port
Port on which events are to be handled.
evt
Type of event to be handled.
dat
Data associated with the event.
Returns
1 in case of successful event handling, 0 otherwise.
6.7.2.2 app_cbk_t∗ app_get_callback_ptr ( uint8_t port )
This function return the App callback structure pointer.
Parameters
port
port index
Returns
Application callback structure pointer
Generated for CCGx Firmware Stack by Doxygen
6.7 app/app.h File Reference
83
6.7.2.3 app_resp_t∗ app_get_resp_buf ( uint8_t port )
Get a handle to the application provide PD command response buffer.
Parameters
port
PD port corresponding to the command and response.
Returns
Pointer to the response buffer.
6.7.2.4 app_status_t∗ app_get_status ( uint8_t port )
Get handle to structure containing information about the system status for a PD port.
Parameters
port
PD port to be queried.
Returns
Pointer to the system information structure.
6.7.2.5
void app_init ( void )
Application level init function.
This function performs any Application level initialization required for the CCG solution. This should be called before
calling the dpm_init function.
Returns
None.
6.7.2.6
bool app_is_cbl_disc_done ( uint8_t port )
Check whether cable discovery has been completed.
This function is used by the DFP Alt. modes manager to check whether cable discovery has been completed.
Parameters
port
Port for which the check is to be performed.
Returns
true if cable discovery is complete, false if not.
6.7.2.7
bool app_sleep ( void )
Check whether the APP handlers are ready to allow device deep sleep.
Generated for CCGx Firmware Stack by Doxygen
84
File Documentation
Returns
true if APP handler is idle, false otherwise.
6.7.2.8
uint8_t app_task ( uint8_t port )
Handler for application level asynchronous tasks.
Parameters
port
USB-PD port for which tasks are to be handled.
Returns
1 in case of success, 0 in case of task handling error.
6.7.2.9
void app_wakeup ( void )
Restore the APP handler state after CCG device wakes from deep-sleep.
Returns
None
6.7.2.10
bool mux_ctrl_init ( uint8_t port )
Initialize the Type-C Data Mux for a specific PD port.
Parameters
port
USB-PD port for which the MUX is to be initialized.
Returns
Returns true if the MUX is initialized successfully, false otherwise.
6.7.2.11
bool mux_ctrl_set_cfg ( uint8_t port, mux_select_t cfg, uint8_t polarity )
Set the Type-C MUX to the desired configuration.
Parameters
port
PD port on which MUX is to be configured.
cfg
Desired MUX configuration.
polarity
Polarity of the Type-C connection.
Returns
Returns true if the operation is successful, false otherwise.
Generated for CCGx Firmware Stack by Doxygen
6.8 app/billboard.h File Reference
85
void sln_pd_event_handler ( uint8_t port, app_evt_t evt, const void ∗ data )
6.7.2.12
Solution handler for PD events reported from the stack.
The function provides all PD events to the solution. For a solution supporting HPI, the solution function should
re-direct the calls to hpi_pd_event_handler. If no HPI is supported, the function can be a simple dummy function.
Parameters
port
PD port corresponding to the event.
evt
Event that is being notified.
data
Data associated with the event. This is an opaque pointer that needs to be de-referenced based on
event type.
Returns
None
6.7.2.13
bool system_sleep ( void )
Function to place CCG device in power saving mode if possible.
This function places the CCG device in power saving deep sleep mode if possible. The function checks for each
interface (PD, HPI etc.) being idle and then enters sleep mode with the appropriate wake-up triggers. If the device
enters sleep mode, the function will only return after the device has woken up.
Returns
true if the device went into sleep, false otherwise.
6.8
app/billboard.h File Reference
#include
#include
#include
#include
"config.h"
"stdint.h"
"stdbool.h"
"status.h"
Data Structures
• struct bb_handle_t
Macros
•
•
•
•
•
•
•
•
•
•
#define BB_MAX_ALT_MODES (8)
#define BB_ALT_MODE_STATUS_INIT_VAL (0x5555)
#define BB_ALT_MODE_STATUS_MASK (0x03)
#define BB_ON_TIMER (0x60)
#define BB_ON_TIMER_PERIOD (250)
#define BB_OFF_TIMER (0x61)
#define BB_OFF_TIMER_MAX_INTERVAL (1000)
#define BB_OFF_TIMER_NO_DISABLE (0xFFFF)
#define BB_OFF_TIMER_MIN_VALUE (60)
#define BB_MAX_EP0_XFER_SIZE (256)
Generated for CCGx Firmware Stack by Doxygen
86
File Documentation
Enumerations
• enum bb_type_t { BB_TYPE_NONE, BB_TYPE_EXTERNAL, BB_TYPE_INTERNAL }
• enum bb_state_t { BB_STATE_DEINITED, BB_STATE_DISABLED, BB_STATE_BILLBOARD, BB_STAT←E_FLASHING }
• enum bb_cause_t { BB_CAUSE_AME_TIMEOUT, BB_CAUSE_AME_SUCCESS, BB_CAUSE_AME_FAI←LURE }
• enum bb_alt_mode_status_t { BB_ALT_MODE_STAT_ERROR, BB_ALT_MODE_STAT_NOT_ATTEMPT←ED, BB_ALT_MODE_STAT_UNSUCCESSFUL, BB_ALT_MODE_STAT_SUCCESSFUL }
• enum bb_usb_string_index_t {
BB_LANG_ID_STRING_INDEX, BB_MFG_STRING_INDEX, BB_PROD_STRING_INDEX, BB_SERIAL_←STRING_INDEX,
BB_CONFIG_STRING_INDEX, BB_BB_INF_STRING_INDEX, BB_HID_INF_STRING_INDEX, BB_URL_←STRING_INDEX,
BB_ALT_MODE1_STRING_INDEX, BB_ALT_MODE2_STRING_INDEX, BB_ALT_MODE3_STRING_IN←DEX, BB_ALT_MODE4_STRING_INDEX,
BB_ALT_MODE5_STRING_INDEX, BB_ALT_MODE6_STRING_INDEX, BB_ALT_MODE7_STRING_IN←DEX, BB_ALT_MODE8_STRING_INDEX }
Functions
• ccg_status_t bb_init (uint8_t port)
• ccg_status_t bb_enable (uint8_t port, bb_cause_t cause)
• ccg_status_t bb_disable (uint8_t port, bool force)
• ccg_status_t bb_update_alt_status (uint8_t port, uint8_t mode_index, bb_alt_mode_status_t alt_status)
• bool bb_is_present (uint8_t port)
• void bb_task (uint8_t port)
• ccg_status_t bb_enabling_flashing (uint8_t port)
6.8.1
Detailed Description
Billboard control interface header file.
6.8.2
Macro Definition Documentation
6.8.2.1
#define BB_ALT_MODE_STATUS_INIT_VAL (0x5555)
Initialisation value for mode status register.
TODO: Need to enable only for the valid mode index.
6.8.2.2
#define BB_MAX_EP0_XFER_SIZE (256)
Maximum buffering for EP0 transactions inside the billboard module.
This definition is valid only for internal billboard implementation.
6.8.2.3
#define BB_ON_TIMER_PERIOD (250)
Billboard ON delay timer period.
If billboard needs to re-started, delay start by specified time to ensure that the host can detect the device going
away correctly.
Generated for CCGx Firmware Stack by Doxygen
6.8 app/billboard.h File Reference
6.8.3
Enumeration Type Documentation
6.8.3.1
enum bb_alt_mode_status_t
USB Billboard alternate mode status.
The enumeration lists the different status values as defined by the billboard class specification.
Enumerator
BB_ALT_MODE_STAT_ERROR Undefined error / alternate mode does not exist
BB_ALT_MODE_STAT_NOT_ATTEMPTED Alternate mode entry not attempted
BB_ALT_MODE_STAT_UNSUCCESSFUL Alternate mode entry attempted but failed
BB_ALT_MODE_STAT_SUCCESSFUL Alternate mode entry succeeded
6.8.3.2
enum bb_cause_t
USB Billboard cause for enumeration.
The enumeration lists all the supported causes for billboard enumeration.
Enumerator
BB_CAUSE_AME_TIMEOUT AME timeout event
BB_CAUSE_AME_SUCCESS Successful alternate mode entry
BB_CAUSE_AME_FAILURE Failed alternate mode entry
6.8.3.3
enum bb_state_t
Billboard module states.
Enumerator
BB_STATE_DEINITED Module is not initialized
BB_STATE_DISABLED Module is initialized but not enabled
BB_STATE_BILLBOARD Module is active with billboard enumeration
BB_STATE_FLASHING Module is active with flashing mode enumeration
6.8.3.4
enum bb_type_t
Billboard implementation model.
Enumerator
BB_TYPE_NONE No billboard device
BB_TYPE_EXTERNAL External billboard device
BB_TYPE_INTERNAL Device supports internal USB module to implement billboard
Generated for CCGx Firmware Stack by Doxygen
87
88
File Documentation
6.8.3.5
enum bb_usb_string_index_t
USB Billboard string descriptor indices.
The enumeration lists the different string indices used in the billboard implementation.
Enumerator
BB_LANG_ID_STRING_INDEX Language ID index
BB_MFG_STRING_INDEX Manufacturer string index
BB_PROD_STRING_INDEX Product string index
BB_SERIAL_STRING_INDEX Serial string index
BB_CONFIG_STRING_INDEX Configuration string index
BB_BB_INF_STRING_INDEX Billboard interface string index
BB_HID_INF_STRING_INDEX HID interface string index
BB_URL_STRING_INDEX Additional info URL string index
BB_ALT_MODE1_STRING_INDEX Alternate mode 1 string index
BB_ALT_MODE2_STRING_INDEX Alternate mode 2 string index
BB_ALT_MODE3_STRING_INDEX Alternate mode 3 string index
BB_ALT_MODE4_STRING_INDEX Alternate mode 4 string index
BB_ALT_MODE5_STRING_INDEX Alternate mode 5 string index
BB_ALT_MODE6_STRING_INDEX Alternate mode 6 string index
BB_ALT_MODE7_STRING_INDEX Alternate mode 7 string index
BB_ALT_MODE8_STRING_INDEX Alternate mode 8 string index
6.8.4
Function Documentation
6.8.4.1 ccg_status_t bb_disable ( uint8_t port, bool force )
The function queues a billboard interface disable.
The API disables the billboard device and disconnects the terminations. For internal implementation of billboard,
the USB module is controlled from the bb_task() and this function only queues the request. It should be noted that
only one pending request is honoured. If more than one request is queued, only the latest is handled. A disable call
clears any pending enable.
Parameters
port
Index of port. Caller is expected to ensure that only valid port index is provided.
force
Whether to force a disable. false = Interface not disabled when in flashing mode. true = Interface disabled
regardless of the operation mode.
Returns
Status of the call.
6.8.4.2 ccg_status_t bb_enable ( uint8_t port, bb_cause_t cause )
The function queues a billboard enumeration / re-enumeration.
The API queues the billboard enumeration as per the configuration information provided. Enumeration details are
retreived from the configuration table.
Generated for CCGx Firmware Stack by Doxygen
6.8 app/billboard.h File Reference
89
The function can be called multiple times applications to trigger a re-enumeration without explicit disable call.
For internal implementation of billboard, the USB module is controlled from the bb_task() and this function only
queues the request. It should be noted that only one pending request is honoured. If more than one request is
queued, only the latest is handled. This request is failed if the flashing mode is in progress.
Parameters
port
Index of port. Caller is expected to ensure that only valid port index is provided.
cause
Cause for billboard enumeration.
Returns
Status of the call.
6.8.4.3 ccg_status_t bb_enabling_flashing ( uint8_t port )
Function requests for flashing mode enumeration.
The function puts the billboard interface in USB flashing mode. This function is valid only for internal billboard
implementation. This should be invoked only if the solution requires to start the flashing mode. This request shall
disconnect the billboard enumeration if active.
Parameters
port
Index of port. Caller is expected to ensure that only valid port index is provided.
Returns
Status of the call.
6.8.4.4 ccg_status_t bb_init ( uint8_t port )
Initialize the billboard module.
The API initializes the billboard module. This is mainly a software state machine initialization. The USB device is
not enabled at this point. The API helps to cleanup previous state information.
Parameters
port
Port index of port to initialize. Caller is expected to ensure that only valid port index is provided.
Returns
Status of the call.
6.8.4.5
bool bb_is_present ( uint8_t port )
Checks whether a billboard interface is present.
The function checks the configuration information and identifies if a billboard device exists.
Generated for CCGx Firmware Stack by Doxygen
90
File Documentation
Parameters
port
Index of port. Caller is expected to ensure that only valid port index is provided.
Returns
Returns true if billboard is present and false if absent.
6.8.4.6
void bb_task ( uint8_t port )
Billboard module task function.
The function implements the billboard state machine and needs to be invoked in the main task loop. The task
handler allows deferring interrupts and improves interrupt latency of the system.
Parameters
port
Index of port. Caller is expected to ensure that only valid port index is provided.
Returns
None
6.8.4.7 ccg_status_t bb_update_alt_status ( uint8_t port, uint8_t mode_index, bb_alt_mode_status_t alt_status )
The function updates the alternate mode status.
The function updates the alternate mode status information for the specified alternate mode index. The altnerate
mode index should match the DISCOVER_SVID and DISCOVER_MODES response for the device.
Parameters
port
Index of port. Caller is expected to ensure that only valid port index is provided.
mode_index
Index of the mode as defined by the alternate mode manager.
alt_status
Current altenate mode status.
Returns
Status of the call.
6.9
app/hal_ccgx.h File Reference
#include
#include
#include
#include
<pd.h>
"config.h"
"stdint.h"
"stdbool.h"
Typedefs
• typedef void(∗ vbus_ocp_cbk_t) (uint8_t port)
Generated for CCGx Firmware Stack by Doxygen
6.9 app/hal_ccgx.h File Reference
91
Functions
•
•
•
•
void system_init (void)
uint8_t system_vbus_ocp_en (uint8_t port, vbus_ocp_cbk_t cbk)
uint8_t system_vbus_ocp_dis (uint8_t port)
void vbus_ocp_handler (uint8_t port)
6.9.1
Detailed Description
PD and Type-C HAL layer for CCG3/CCG4.
6.9.2
Function Documentation
6.9.2.1
void system_init ( void )
USB-PD system initialization.
This function initializes the PD block clocks by setting the divider values for PERI registers and enabling the corresponding control registers.
6.9.2.2
uint8_t system_vbus_ocp_dis ( uint8_t port )
Disables VBus OCP checks on the specified port.
Parameters
port
USB-PD port on which to disable VBus OCP checks.
Returns
Returns 1 if params are ok else return 0
6.9.2.3
uint8_t system_vbus_ocp_en ( uint8_t port, vbus_ocp_cbk_t cbk )
Enables VBus OCP checks on the specified port.
Parameters
port
USB-PD port on which to enable VBus OCP checks.
cbk
Function to be called when OCP event is detected.
Returns
Returns 1 if params are ok else return 0
6.9.2.4
void vbus_ocp_handler ( uint8_t port )
Vbus OCP interrupt handler.
Parameters
port
USB-PD port on which the OCP interrupt was triggered.
Generated for CCGx Firmware Stack by Doxygen
92
File Documentation
Returns
None
6.10
app/pdo.h File Reference
#include <project.h>
#include <pd.h>
Functions
• uint8_t eval_src_cap (uint8_t port, const pd_packet_t ∗src_cap, app_resp_cbk_t app_resp_handler)
• uint8_t eval_rdo (uint8_t port, pd_do_t rdo, app_resp_cbk_t app_resp_handler)
6.10.1
Detailed Description
PDO evaluation and handler definitions.
6.10.2
Function Documentation
6.10.2.1
uint8_t eval_rdo ( uint8_t port, pd_do_t rdo, app_resp_cbk_t app_resp_handler )
This function can be used to ask EC to evaluate a request message For now evaluating here and executing the
callback in this function itself This function can be changed as per customer design.
Parameters
port
Port index the function is performed for.
rdo
Pointer to pd packet wich contais request data object.
app_resp_handler
Application handler callback function.
Returns
always true
6.10.2.2
uint8_t eval_src_cap ( uint8_t port, const pd_packet_t ∗ src_cap, app_resp_cbk_t app_resp_handler )
This function can be used to ask EC to evaluate a src cap message For now evaluating here and executing the
callback in this function itself This function can be changed as per customer design.
Parameters
port
Port index the function is performed for.
src_cap
Pointer to pd packet wich contais source capability.
app_resp_handler
Application handler callback function.
Returns
always true
Generated for CCGx Firmware Stack by Doxygen
6.11 app/psink.h File Reference
6.11
app/psink.h File Reference
#include <project.h>
Functions
•
•
•
•
uint8_t psnk_set_voltage (uint8_t port, uint16_t volt_50mV)
uint8_t psnk_set_current (uint8_t port, uint16_t cur_10mA)
uint8_t psnk_enable (uint8_t port)
uint8_t psnk_disable (uint8_t port)
6.11.1
Detailed Description
Power Sink (Consumer) manager header file.
6.11.2
Function Documentation
6.11.2.1
uint8_t psnk_disable ( uint8_t port )
Set VBus FET Off.
Parameters
port
Port index the function is performed for.
Returns
always true
6.11.2.2
uint8_t psnk_enable ( uint8_t port )
Set VBus FET On if device policy manager is enabled.
Parameters
port
Port index the function is performed for.
Returns
true if DPM is enabled, false - if DPM disabled
6.11.2.3
uint8_t psnk_set_current ( uint8_t port, uint16_t cur_10mA )
This is empty function.
Parameters
port
Port index the function is performed for.
cur_10mA
Current value in 10mA
Generated for CCGx Firmware Stack by Doxygen
93
94
File Documentation
Returns
always true
6.11.2.4
uint8_t psnk_set_voltage ( uint8_t port, uint16_t volt_50mV )
This function configures the ADC block as a comparator.
Parameters
port
Port index the function is performed for.
volt_50mV
Comparator voltage level in 50mV
Returns
always true
6.12
app/psource.h File Reference
#include <project.h>
#include <pd.h>
#include <pdss_hal.h>
Functions
•
•
•
•
•
•
•
•
•
•
•
•
uint8_t psrc_set_voltage (uint8_t port, uint16_t volt_50mV)
uint8_t psrc_set_current (uint8_t port, uint16_t cur_10mA)
uint8_t psrc_enable (uint8_t port, pwr_ready_cbk_t pwr_ready_handler)
uint8_t psrc_disable (uint8_t port, pwr_ready_cbk_t pwr_ready_handler)
uint8_t vconn_enable (uint8_t port, uint8_t channel)
uint8_t vconn_disable (uint8_t port, uint8_t channel)
uint8_t vconn_is_present (uint8_t port)
uint8_t vbus_is_present (uint8_t port, uint16_t volt, int8 per)
uint8_t vbus_discharge_on (uint8_t port)
uint8_t vbus_discharge_off (uint8_t port)
uint8_t system_vconn_ocp_en (uint8_t port, PD_ADC_CB_T cbk)
uint8_t system_vconn_ocp_dis (uint8_t port)
6.12.1
Detailed Description
Power source (Provider) manager header file.
6.12.2
Function Documentation
6.12.2.1
uint8_t psrc_disable ( uint8_t port, pwr_ready_cbk_t pwr_ready_handler )
This function disables VBus power.
Parameters
port
Port index the function is performed for.
pwr_ready_handler
Application handler callback function.
Generated for CCGx Firmware Stack by Doxygen
6.12 app/psource.h File Reference
Returns
always true
6.12.2.2
uint8_t psrc_enable ( uint8_t port, pwr_ready_cbk_t pwr_ready_handler )
This function enables VBus power.
Parameters
port
Port index the function is performed for.
pwr_ready_handler
Application handler callback function.
Returns
true if VBus enabled successful, else returns false
6.12.2.3
uint8_t psrc_set_current ( uint8_t port, uint16_t cur_10mA )
This function set VBus current.
Parameters
port
Port index the function is performed for.
cur_10mA
Current in 10mA units.
Returns
always true
6.12.2.4
uint8_t psrc_set_voltage ( uint8_t port, uint16_t volt_50mV )
This function set VBus voltage.
Parameters
port
Port index the function is performed for.
volt_50mV
Voltage in 50mV units.
Returns
always true
6.12.2.5
uint8_t system_vconn_ocp_dis ( uint8_t port )
This function disable vconn ocp.
Parameters
port
Port index
Generated for CCGx Firmware Stack by Doxygen
95
96
File Documentation
Returns
Returns 1 if params are ok else return 0
6.12.2.6
uint8_t system_vconn_ocp_en ( uint8_t port, PD_ADC_CB_T cbk )
This function enable vconn ocp.
Parameters
port
Port index
cbk
OCP callback
Returns
Returns 1 if params are ok else return 0
6.12.2.7
uint8_t vbus_discharge_off ( uint8_t port )
This function turns off dischange FET on selected port.
Parameters
port
Port index the function is performed for.
Returns
always true
6.12.2.8
uint8_t vbus_discharge_on ( uint8_t port )
This function turns on dischange FET on selected port.
Parameters
port
Port index the function is performed for.
Returns
always true
6.12.2.9
uint8_t vbus_is_present ( uint8_t port, uint16_t volt, int8 per )
This function checks if power is present on VBus.
Parameters
port
Port index the function is performed for.
volt
Voltage in 50mV units.
per
Threshold margin.
Generated for CCGx Firmware Stack by Doxygen
6.13 app/swap.h File Reference
Returns
true if power is present on VBus, else returns false
6.12.2.10
uint8_t vconn_disable ( uint8_t port, uint8_t channel )
This function disables VConn power.
Parameters
port
Port index the function is performed for.
channel
Selected CC line.
Returns
always true
6.12.2.11
uint8_t vconn_enable ( uint8_t port, uint8_t channel )
This function enables VConn power.
Parameters
port
Port index the function is performed for.
channel
Selected CC line.
Returns
always true
6.12.2.12
uint8_t vconn_is_present ( uint8_t port )
This function checks if power is present on VConn.
Parameters
port
Port index the function is performed for.
Returns
true if power is present on VConn, else returns false
6.13
app/swap.h File Reference
#include <project.h>
#include <pd.h>
Generated for CCGx Firmware Stack by Doxygen
97
98
File Documentation
Functions
• uint8_t eval_dr_swap (uint8_t port, app_resp_cbk_t app_resp_handler)
• uint8_t eval_pr_swap (uint8_t port, app_resp_cbk_t app_resp_handler)
• uint8_t eval_vconn_swap (uint8_t port, app_resp_cbk_t app_resp_handler)
6.13.1
Detailed Description
Swap request (PR_SWAP, DR_SWAP, VCONN_SWAP) handlers.
6.13.2
Function Documentation
6.13.2.1
uint8_t eval_dr_swap ( uint8_t port, app_resp_cbk_t app_resp_handler )
This function evaluates Data role swap request.
Parameters
port
Port index the function is performed for.
app_resp_handler
Application handler callback function.
Returns
always true
6.13.2.2
uint8_t eval_pr_swap ( uint8_t port, app_resp_cbk_t app_resp_handler )
This function evaluates Power role swap request.
Parameters
port
Port index the function is performed for.
app_resp_handler
Application handler callback function.
Returns
always true
6.13.2.3
uint8_t eval_vconn_swap ( uint8_t port, app_resp_cbk_t app_resp_handler )
This function evaluates VConn swap request.
Parameters
port
Port index the function is performed for.
app_resp_handler
Application handler callback function.
Returns
always true
Generated for CCGx Firmware Stack by Doxygen
6.14 app/usb_vendor.h File Reference
6.14
99
app/usb_vendor.h File Reference
#include "stdint.h"
#include "stdbool.h"
#include "status.h"
Macros
• #define FW_VERSION_SIZE (8)
• #define USB_VENDOR_DEVICE_RESET_SIG_VALUE (0xA6BC)
• #define USB_VENDOR_DEVICE_RESET_SIG_INDEX (0xADBA)
• #define USB_VENDOR_JUMP_TO_BOOT_SIG_VALUE (0xA6BC)
• #define USB_VENDOR_JUMP_TO_BOOT_SIG_INDEX (0xB9B2)
• #define USB_VENDOR_ENTER_FLASHING_SIG_VALUE (0xA6BC)
• #define USB_VENDOR_ENTER_FLASHING_SIG_INDEX (0xB1B0)
Enumerations
• enum usb_vendor_cmd_t {
USB_VENDOR_CMD_GET_VERSION = 0xB0, USB_VENDOR_CMD_GET_SILICON_ID, USB_VENDO←R_CMD_FLASH_READ, USB_VENDOR_CMD_FLASH_WRITE,
USB_VENDOR_CMD_GET_DEVICE_ID, USB_VENDOR_CMD_VALIDATE_FW = 0xBA, USB_VENDOR←_CMD_GET_DEVICE_MODE = 0xBD, USB_VENDOR_CMD_JUMP_TO_BOOT,
USB_VENDOR_CMD_ENTER_FLASHING_MODE = 0xE2, USB_VENDOR_CMD_DEVICE_RESET, US←B_VENDOR_CMD_GET_ALL_VERSION, USB_VENDOR_CMD_BOOT_FAIL_REASON = 0xE5,
USB_VENDOR_CMD_GET_FW_LOCATION, USB_VENDOR_CMD_SET_APP_PRIORITY, USB_VEND←OR_CMD_SEND_SIGNATURE }
Functions
• ccg_status_t usb_vendor_flashing_rqt_handler (usb_setup_pkt_t ∗pkt)
• uint8_t ∗ usb_vendor_get_ep0_buffer (void)
6.14.1
Detailed Description
USB vendor interface (flashing) header file.
6.14.2
Enumeration Type Documentation
6.14.2.1
enum usb_vendor_cmd_t
List of all flashing vendor commands.
Enumerator
USB_VENDOR_CMD_GET_VERSION Get the version of the firmware value = 0, index = 0, length = 8
data_in = version of current firmware: Byte0 = Major version Byte1 = Minor version Byte2:3 = Patch
version Byte4:5 = Build number
USB_VENDOR_CMD_GET_SILICON_ID Get the silicon ID for the device. value = 0, index = 0, length = 4
data_in = 32 bit silicon id.
Generated for CCGx Firmware Stack by Doxygen
100
File Documentation
USB_VENDOR_CMD_FLASH_READ Read flash content: Not supported by secure boot firmware. value =
MS word of address, index = LS word of address(4 byte aligned), length = length of read (4 byte multiple)
data_in = requested data from flash.
USB_VENDOR_CMD_FLASH_WRITE Program the data to flash. value = MS word of address, index = LS
word of address(flash row aligned), length = length of write (flash row size multiple) data_out = data to
be written to flash.
USB_VENDOR_CMD_GET_DEVICE_ID Retreive the unique silicon ID value = 0, index = 0, length = 8
data_in: byte 0 - 2: Die ID and lot number byte 3 : Wafer number byte 4 : Bit[0:5] - Die X position Bit[6:7]
- CRI pass / fail byte 5 : Bit[0:5] - Die Y position Bit[6:7] - CRI pass / fail byte 6: : Bit [0:1],[2:3],[4:5] - Sort
1/2/3 pass/fail bin. byte 7: Minor revision
USB_VENDOR_CMD_VALIDATE_FW Validate the firmware image value = fw_mode (1, 2), index = 0,
length = 0
USB_VENDOR_CMD_GET_DEVICE_MODE Return the device mode of operation value = 0, index = 0,
length = 1 data_in = Mode of operation
USB_VENDOR_CMD_JUMP_TO_BOOT Jump to boot-loader mode. value = ∼"CY" = 0xA6BC, index =
∼"MF" = 0xB9B2 length = 0
USB_VENDOR_CMD_ENTER_FLASHING_MODE Initiate flashing mode operation. This request needs to
be sent before any of the flashing related vendor commands are supported by the device (0xB0 to 0xBF).
value = ∼"CY" = 0xA6BC, index = ∼"OF" = 0xB9B0: for disable, value = ∼"CY" = 0xA6BC, ∼"ON" =
0xB1B0: for enable length = 0.
USB_VENDOR_CMD_DEVICE_RESET Request for a device reset. If request is supported, the device shall
ACK the request and then initiate a reset. value = ∼"CY" = 0xA6BC, index = ∼"RE" = 0xADBA, length
= 0.
USB_VENDOR_CMD_GET_ALL_VERSION Return all CCG firmware version info value = 0, index = 0,
length = 24. Byte 0:7 = Boot-loader version Byte 8:15 = Firmware1 version Byte 16:23 = Firmware2
version
USB_VENDOR_CMD_BOOT_FAIL_REASON Request for identifying the boot-mode failure value = 0, index
= 0, length = 1 data_in: Boot-failure reason
USB_VENDOR_CMD_GET_FW_LOCATION Retreive the firmware start location value = 0, index = 0,
length = 8 data_in: byte[0:3] = FW1 start byte[4:7] = FW2 start
USB_VENDOR_CMD_SET_APP_PRIORITY Set the application priority option value = fw_priority, index =
0, length = 0
USB_VENDOR_CMD_SEND_SIGNATURE Send the signature data to the device for secure boot flashing.
TODO: Needs definition.
6.14.3
Function Documentation
6.14.3.1 ccg_status_t usb_vendor_flashing_rqt_handler ( usb_setup_pkt_t ∗ pkt )
USB vendor command handler for USB flashing requests.
The function provides the default vendor command handler for flashing. This function is expected to be invoked
when a USB vendor command is received from the USB module. If there are no additional vendor commands
supported by the application, then this function can be directly registered for handling vendor commands with USB
module.
Parameters
pkt
USB setup packet received for the request
Returns
Status of the call
Generated for CCGx Firmware Stack by Doxygen
6.15 app/uvdm.h File Reference
6.14.3.2
101
uint8_t∗ usb_vendor_get_ep0_buffer ( void )
Get a buffer for USB EP0 vendor request handling.
The function is expected to be implemented by the application. This allows a common buffer to be re-used for all EP0
transactions. It is expected that the buffer is always available through out the USB vendor command transaction.
The function should always return a valid pointer with sufficient buffering for a single flash row.
Returns
Pointer to the buffer
6.15
app/uvdm.h File Reference
Macros
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
#define UVDM_RESPONSE_MAX_NO_OF_VDO (0x07)
#define UVDM_HEADER_INDEX (0x00)
#define UVDM_SIGNATURE_BYTE_OFFSET (0x00)
#define UVDM_DEVICE_MODE_VDO_INDEX (0x01)
#define UVDM_BOOT_LAST_ROW_VDO_INDEX (0x02)
#define UVDM_BOOT_VERSION_VDO_INDEX (0x01)
#define UVDM_IMG1_VERSION_VDO_INDEX (0x03)
#define UVDM_IMG2_VERSION_VDO_INDEX (0x05)
#define UVDM_VERSION_NUM_SIZE_BYTES (0x08)
#define UVDM_GET_VERSION_U_VDM_NO_OF_VDO (0x06)
#define UVDM_GET_SILICON_ID_CMD_SIZE (0x04)
#define UVDM_GET_SILICON_ID_CMD_SIG (0x53)
#define UVDM_FW1_START_ADDR_VDO_INDEX (0x01)
#define UVDM_FW2_START_ADDR_VDO_INDEX (0x02)
#define UVDM_GET_FW_START_ADDR_UVDM_NO_OF_VDO (0x02)
#define UVDM_SILICON_ID_VDO_INDEX (0x02)
#define UVDM_DEVICE_RESET_CMD_SIZE (0x04)
#define UVDM_DEVICE_RESET_CMD_SIG (0x52)
#define UVDM_JUMP_TO_BOOT_CMD_SIZE (0x04)
#define UVDM_JUMP_TO_BOOT_CMD_SIG (0x4A)
#define UVDM_ENTER_FLASHING_MODE_CMD_SIZE (0x04)
#define UVDM_ENTER_FLASHING_MODE_CMD_SIG (0x50)
#define UVDM_FLASH_READ_WRITE_CMD_SIZE (0x04)
#define UVDM_FLASH_READ_WRITE_CMD_SIG (0x46)
#define UVDM_FLASH_ROW_NUM_LSB_OFFSET (0x01)
#define UVDM_FLASH_ROW_NUM_MSB_OFFSET (0x02)
#define UVDM_READ_DATA_RESPONSE_VDO_INDEX (0x01)
#define UVDM_RESPONSE_VDO_INDEX (0x01)
#define UVDM_READ_DATA_NO_OF_VDO_ERROR_CASE (0x02)
#define UVDM_VALIDATE_FW_CMD_SIZE (0x04)
#define UVDM_VALIDATE_FW_MODE_INDEX (0x00)
#define UVDM_REASON_FOR_BOOT_MODE_VDO_INDEX (0x01)
#define UVDM_GET_CHECKSUM_CMD_SIZE (0x08)
#define UVDM_FLASH_ADDR_LSB_OFFSET (0x00)
#define UVDM_FLASH_SIZE_LSB_OFFSET (0x04)
#define UVDM_CHEKCSUM_VDO_INDEX (0x01)
#define UVDM_SET_APP_PRIORITY_CMD_SIZE (0x04)
#define UVDM_SET_APP_PRIORITY_INDEX (0x00)
Generated for CCGx Firmware Stack by Doxygen
102
File Documentation
•
•
•
•
•
#define UVDM_SEND_SIGN_SEQUENCE_1 (0x01)
#define UVDM_SEND_SIGN_SEQUENCE_2 (0x02)
#define UVDM_SEND_SIGN_SEQUENCE_3 (0x03)
#define UVDM_SEND_SIGN_SEC_1_2_SIZE (0x18)
#define UVDM_SEND_SIGN_SEC_3_SIZE (0x10)
Enumerations
• enum uvdm_cmd_opcode_t {
UVDM_CMD_RESERVED, UVDM_CMD_GET_DEVICE_MODE_OPCODE, UVDM_CMD_GET_DEVICE←_VERSION_OPCODE, UVDM_CMD_GET_SILICON_ID_OPCODE,
UVDM_CMD_DEVICE_RESET_OPCODE, UVDM_CMD_JUMP_TO_BOOT_OPCDOE, UVDM_CMD_E←NTER_FLASHING_MODE_OPCODE, UVDM_CMD_SEND_DATA_OPCODE,
UVDM_CMD_FLASH_WRITE_OPCODE, UVDM_CMD_READ_DATA_OPCODE, UVDM_CMD_FLASH←_READ_OPCODE, UVDM_CMD_VALIDATE_FW_OPCODE,
UVDM_CMD_REASON_FOR_BOOT_MODE, UVDM_CMD_GET_CHECKSUM, UVDM_CMD_GET_FW←_START_ADDRESS_OPCODE, UVDM_CMD_SET_APP_PRIORITY_OPCODE,
UVDM_CMD_RESERVED_16, UVDM_CMD_SEND_SIGNATURE_OPCODE }
• enum uvdm_response_state_t { UVDM_NOT_HANDLED, UVDM_HANDLED_RESPONSE_READY, UVD←M_HANDLED_NO_RESPONSE, UVDM_HANDLED_RESPONSE_NOT_READY }
Functions
•
•
•
•
void uvdm_enter_cy_alt_mode (void)
void uvdm_exit_cy_alt_mode (void)
bool uvdm_get_flashing_mode (void)
uvdm_response_state_t uvdm_handle_cmd (uint16_t vid, uvdm_cmd_opcode_t cmd_opCode, uint8_←t ∗cmd_param, uint8_t cmd_length, uint8_t seq_num, pd_do_t ∗∗vdm_rspn_pkt, uint8_t ∗vdo_count)
6.15.1
Detailed Description
Unstructured VDM handler header file.
6.15.2
Enumeration Type Documentation
6.15.2.1
enum uvdm_response_state_t
List of possible stateso of UVDM Response.
Enumerator
UVDM_NOT_HANDLED UVDM not recognised, can't be handled.
UVDM_HANDLED_RESPONSE_READY UVDM handled and response is ready to be sent.
UVDM_HANDLED_NO_RESPONSE UVDM handled but no response required.
UVDM_HANDLED_RESPONSE_NOT_READY UVDM Handled but response will be sent later, potential
non-blocking command.
6.15.3
Function Documentation
6.15.3.1
void uvdm_enter_cy_alt_mode ( void )
CY Flashing Mode Entry Handler.
Description This function is called from PD Stack when CCG enters CY Flashing Altenrate mode. CY UVDM
commands are handled only when CCG has entered CY Flashing Alternate mode.
Generated for CCGx Firmware Stack by Doxygen
6.16 app/vdm.h File Reference
103
Returns
None
6.15.3.2
void uvdm_exit_cy_alt_mode ( void )
CY Flashing Mode Exit Handler.
Description This function is called from PD Stack when CCG exits CY Flashing Altenrate mode.
Returns
None
6.15.3.3
bool uvdm_get_flashing_mode ( void )
Return CY Flashing Mode Status.
Description This function returns the current state of CY Flashing Alternate Mode.
Returns
TRUE if CY Flashing Mode active,FALSE Otherwise
6.15.3.4 uvdm_response_state_t uvdm_handle_cmd ( uint16_t vid, uvdm_cmd_opcode_t cmd_opCode, uint8_t ∗
cmd_param, uint8_t cmd_length, uint8_t seq_num, pd_do_t ∗∗ vdm_rspn_pkt, uint8_t ∗ vdo_count )
CY Flashing Alternate Mode UVDM Command Handler.
Description Handles all CY Flashing Alternate Mode UVDM Commands.
Parameters
vid
cmd_opCode
VID of UVDM Command
UVDM Command Opcode
cmd_param
Pointer to Command data
cmd_length
Length of Command data
seq_num
Sequence number of data packets (REFER SEND_DATA and READ_DATA)
vdm_rspn_pkt
Pointer to the VDM response packet
vdo_count
Number of VDOs in VDM response, 0 if no VDM Response
Returns
uvdm_response_state_t
6.16
app/vdm.h File Reference
#include <project.h>
#include <pd.h>
Generated for CCGx Firmware Stack by Doxygen
104
File Documentation
Functions
• void vdm_data_init (uint8_t port)
• void vdm_update_data (uint8_t port, uint8_t id_vdo_cnt, uint8_t ∗id_vdo_p, uint8_t svid_vdo_cnt, uint8_←t ∗svid_vdo_p, uint16_t mode_resp_len, uint8_t ∗mode_resp_p)
• uint8_t eval_vdm (uint8_t port, const pd_packet_t ∗vdm, vdm_resp_cbk_t vdm_resp_handler)
6.16.1
Detailed Description
Vendor Defined Message (VDM) handler header file.
6.16.2
Function Documentation
6.16.2.1
uint8_t eval_vdm ( uint8_t port, const pd_packet_t ∗ vdm, vdm_resp_cbk_t vdm_resp_handler )
This function is responsible for analysing and processing received VDM. This function also makes a decision about
necessity of response to the received VDM.
Parameters
port
Port index the function is performed for.
vdm
Pointer to pd packet which contains received VDM.
vdm_resp_handler
VDM handler callback function.
Returns
Always returns true.
6.16.2.2
void vdm_data_init ( uint8_t port )
Store the VDM data from the configuration table.
This function retrieves the VDM data (for CCG as UFP) that is stored in the configuration table and stores it in the
run-time data structures.
Parameters
port
USB-PD port for which the data is to be stored.
Returns
None.
6.16.2.3
void vdm_update_data ( uint8_t port, uint8_t id_vdo_cnt, uint8_t ∗ id_vdo_p, uint8_t svid_vdo_cnt, uint8_t ∗
svid_vdo_p, uint16_t mode_resp_len, uint8_t ∗ mode_resp_p )
This function allows the VDM data for CCG to be changed.
This function allows the user to change the VDM responses that CCG sends for D_ID, D_SVID and D_MODE
requests. The default responses are taken from the configuration table. This function allows the user to change
the response data. The caller is responsible to ensure that the responses are not changed while CCG is already in
contract as a UFP.
Generated for CCGx Firmware Stack by Doxygen
6.17 ar_slave/ar_slave.h File Reference
Parameters
port
PD port for which responses are to be changed.
id_vdo_cnt
Number of VDOs in the D_ID response.
id_vdo_p
Pointer to the actual D_ID response in memory.
svid_vdo_cnt
Number of VDOs in the D_SVID response. Should be less than 8.
svid_vdo_p
Pointer to the actual D_SVID response in memory.
mode_resp_len
Total length of mode response. This includes the D_MODE responses for each supported
SVID, along with the corresponding header fields.
mode_resp_p
Pointer to all of the mode responses in memory.
Returns
None
6.17
ar_slave/ar_slave.h File Reference
#include
#include
#include
#include
#include
#include
<project.h>
<stdbool.h>
<stdint.h>
"config.h"
"status.h"
"i2c.h"
Macros
•
•
•
•
•
•
•
•
•
#define AR_SLAVE_SCB_INDEX (0x1)
#define AR_SLAVE_SCB_CLOCK_FREQ (I2C_SCB_CLOCK_FREQ_1_MHZ)
#define AR_SLAVE_MIN_WRITE_SIZE (2)
#define AR_SLAVE_MAX_WRITE_SIZE (72)
#define AR_SLAVE_ADDR_P0 (0x38)
#define AR_SLAVE_ADDR_P1 (0x3F)
#define AR_SLAVE_ADDR_MASK (0xF0)
#define AR_CMD_CCG_RESET (0x02)
#define AR_CMD_INT_CLEAR (0x04)
Enumerations
• enum ar_slave_reg_addr_t { AR_REG_CCG_COMMAND = 0x50, AR_REG_CCG_STATUS = 0x5F }
Functions
• void ar_slave_init (uint8_t ar_scbnum)
• void ar_slave_status_update (uint8_t port, uint32_t status)
• bool ar_slave_sleep (void)
6.17.1
Detailed Description
Alpine Ridge I2C slave interface header file.
Generated for CCGx Firmware Stack by Doxygen
105
106
File Documentation
6.17.2
Macro Definition Documentation
6.17.2.1
#define AR_SLAVE_ADDR_MASK (0xF0)
I2C slave address mask to be applied on the incoming slave address.
Since a single I2C block is used to handle transaction on two different slave addresses, a mask needs to be applied
while checking the incoming preamble for an address match. This mask allows comparison of only the address bits
that do not change across the two addresses.
6.17.3
Enumeration Type Documentation
6.17.3.1
enum ar_slave_reg_addr_t
List of Alpine Ridge slave interface registers.
The Thunderbolt Alternate Mode specification defines the following set of registers that should be implemented by
a USB-PD port controller in Thunderbolt enabled systems.
Enumerator
AR_REG_CCG_COMMAND CCG command register.
AR_REG_CCG_STATUS CCG status register.
6.17.4
Function Documentation
6.17.4.1
void ar_slave_init ( uint8_t ar_scbnum )
Initialize the Alpine Ridge slave interface module.
This function initializes the Alpine Ridge slave interface module and configures it to use the specified SCB block.
The SCB will be configured as an I2C slave block, and the interrupt output will also be initialized to a de-asserted
state.
Since only two registers are to be implemented, and the commands to be implemented are simple, the complete
module is implemented using the I2C command callbacks.
Parameters
ar_scbnum
SCB index to be used for the Alpine Ridge slave interface.
Returns
None
6.17.4.2
bool ar_slave_sleep ( void )
Check whether the AR slave interface is idle so that device can be placed into sleep.
This function should be called prior to placing the CCG device in deep sleep. Deep sleep entry is only allowed if
this function returns true.
Returns
true if the interface is idle, false otherwise.
Generated for CCGx Firmware Stack by Doxygen
6.18 hpiss/hpi.h File Reference
6.17.4.3
107
void ar_slave_status_update ( uint8_t port, uint32_t status )
Update the AR status register and send an event to the Alpine Ridge.
This function is used by the application layer to update the content of the Alpine Ridge status register. If the content
of the register is changing, CCG asserts the corresponding interrupt to notify Alpine Ridge about the status change.
Parameters
port
USB-PD port index corresponding to the status update.
status
Value to be written into the status register.
Returns
None
6.18
hpiss/hpi.h File Reference
#include
#include
#include
#include
#include
#include
#include
<stdbool.h>
<stdint.h>
<config.h>
"status.h"
"i2c.h"
"pd.h"
"dpm.h"
Enumerations
• enum hpi_reg_section_t { HPI_REG_SECTION_DEV = 0, HPI_REG_SECTION_PORT_0, HPI_REG_SE←CTION_PORT_1, HPI_REG_SECTION_ALL }
• enum hpi_reg_part_t {
HPI_REG_PART_REG = 0, HPI_REG_PART_DATA = 1, HPI_REG_PART_FLASH = 2, HPI_REG_PART←_PDDATA_READ = 4,
HPI_REG_PART_PDDATA_WRITE = 8 }
Functions
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
void hpi_init (uint8_t scb_idx)
void hpi_task (void)
bool hpi_reg_enqueue_event (hpi_reg_section_t section, uint8_t status, uint8_t length, uint8_t ∗data)
void hpi_pd_event_handler (uint8_t port, app_evt_t evt, const void ∗data)
bool hpi_is_ec_ready (void)
void hpi_update_versions (uint8_t ∗bl_version, uint8_t ∗fw1_version, uint8_t ∗fw2_version)
void hpi_set_mode_regs (uint8_t dev_mode, uint8_t mode_reason)
void hpi_update_fw_locations (uint16_t fw1_location, uint16_t fw2_location)
void hpi_set_reserved_reg (uint8_t offset, uint8_t value)
bool hpi_is_vdm_ec_ctrl_enabled (uint8_t port)
uint8_t hpid_get_ec_active_modes (uint8_t port)
bool hpi_sleep_allowed (void)
bool hpi_sleep (void)
uint8_t hpi_get_port_enable (void)
void hpi_set_no_boot_mode (bool enable)
void hpi_set_fixed_slave_address (uint8_t slave_addr)
void hpi_send_fw_ready_event (void)
Generated for CCGx Firmware Stack by Doxygen
108
File Documentation
6.18.1
Detailed Description
Host Processor Interface (HPI) header file.
6.18.2
Enumeration Type Documentation
6.18.2.1
enum hpi_reg_part_t
Types of HPI register/memory regions.
Enumerator
HPI_REG_PART_REG Register region.
HPI_REG_PART_DATA Data memory for device section.
HPI_REG_PART_FLASH Flash memory.
HPI_REG_PART_PDDATA_READ Read Data memory for port section.
HPI_REG_PART_PDDATA_WRITE Write Data memory for port section.
6.18.2.2
enum hpi_reg_section_t
SCB index used for HPI interface.
HPI register section definitions.
HPI registers are grouped into sections corresponding to the functions that are supported.
Enumerator
HPI_REG_SECTION_DEV Device information registers.
HPI_REG_SECTION_PORT_0 USB-PD Port 0 related registers.
HPI_REG_SECTION_PORT_1 USB-PD Port 1 related registers.
HPI_REG_SECTION_ALL Special definition to select all register spaces.
6.18.3
Function Documentation
6.18.3.1
uint8_t hpi_get_port_enable ( void )
Get the Port Enable register value.
Returns
The Port Enable HPI register value.
6.18.3.2
void hpi_init ( uint8_t scb_idx )
Initialize the HPI interface.
This function initializes the I2C interface and EC_INT GPIO used for HPI hardware interface, and initializes all HPI
registers to their default values.
Parameters
scb_idx
Index of SCB block to be used for HPI. Please note that this parameter is not validated, and it is the
caller's responsibility to pass the correct value.
Generated for CCGx Firmware Stack by Doxygen
6.18 hpiss/hpi.h File Reference
109
Returns
None
6.18.3.3
bool hpi_is_ec_ready ( void )
Check whether EC init complete event has been received.
This function is used by the application to check whether the EC has sent the EC initialization complete event
notification.
Returns
true if EC init has been received, false otherwise.
6.18.3.4
bool hpi_is_vdm_ec_ctrl_enabled ( uint8_t port )
Check whether EC control of VDMs is enabled.
Parameters
port
USB-PD to check the configuration for.
Returns
true if EC control is enabled, false otherwise.
6.18.3.5
void hpi_pd_event_handler ( uint8_t port, app_evt_t evt, const void ∗ data )
Handler for PD events reported from the stack.
Internal function used to receive PD events from the stack and to update the HPI registers.
Parameters
port
PD port corresponding to the event.
evt
Event that is being notified.
data
Data associated with the event. This is an opaque pointer that needs to be de-referenced based on
event type.
Returns
None
6.18.3.6
bool hpi_reg_enqueue_event ( hpi_reg_section_t section, uint8_t status, uint8_t length, uint8_t ∗ data )
Enqueue an event to the EC through the HPI interface.
This function is used by the PD stack and application layers to send event notifications to the EC through the HPI
registers.
Parameters
section
Register section through which event is to be reported.
Generated for CCGx Firmware Stack by Doxygen
110
File Documentation
Parameters
status
The event code to be stored into the response register.
length
Length of the data associated with the event.
data
Pointer to buffer containing data associated with the event.
Returns
true if the event queue has space for the event, false if there is an overflow.
6.18.3.7
void hpi_send_fw_ready_event ( void )
Send a FW ready notification through HPI to the EC.
Returns
None
6.18.3.8
void hpi_set_fixed_slave_address ( uint8_t slave_addr )
Configure HPI interface with a fixed slave address.
Parameters
slave_addr
Fixed slave address to be used.
Returns
None
6.18.3.9
void hpi_set_mode_regs ( uint8_t dev_mode, uint8_t mode_reason )
Set device mode and reason register values.
This is an internal function used to update the device mode and boot mode reason HPI registers.
Parameters
dev_mode
Value to be set into the device mode register.
mode_reason
Value to be set into the boot mode reason register.
Returns
void
6.18.3.10
void hpi_set_no_boot_mode ( bool enable )
Configure HPI to operate in No-boot support mode.
Generated for CCGx Firmware Stack by Doxygen
6.18 hpiss/hpi.h File Reference
111
Parameters
enable
Whether to enable no-boot mode.
Returns
None
6.18.3.11
void hpi_set_reserved_reg ( uint8_t offset, uint8_t value )
Debug function to set reserved register values.
This is an internal function that is used to write debug data to one of the HPI reserved registers. This can be used
as a logging mechanism for firmware debugging.
Parameters
offset
Offset of the reserved register to be set.
value
Value to be set into the reserved register.
Returns
None
6.18.3.12
bool hpi_sleep ( void )
Prepare the HPI interface for device deep sleep.
This function checks whether the I2C interface is idle so that the CCG device can enter deep sleep mode. It also
enables an I2C address match as a wake-up trigger from deep sleep. hpi_sleep_allowed should have been called
prior to calling this function.
Returns
true if the HPI interface is ready for sleep, false otherwise.
6.18.3.13
bool hpi_sleep_allowed ( void )
Check if the CCG device can be put into deep-sleep.
Returns
true if deep sleep is possible, false otherwise.
6.18.3.14
void hpi_task ( void )
HPI task handler.
This function handles the commands from the EC through the HPI registers. HPI writes from the EC are handled in
interrupt context, and any associated work is queued to be handled by this function. The hpi_task is expected to be
called periodically from the main task loop of the firmware application.
Returns
None
Generated for CCGx Firmware Stack by Doxygen
112
File Documentation
6.18.3.15
void hpi_update_fw_locations ( uint16_t fw1_location, uint16_t fw2_location )
Update the firmware location HPI registers.
This is an internal function used to update the firmware binary location HPI registers.
Parameters
fw1_location
Flash row where FW1 is located.
fw2_location
Flash row where FW2 is located.
Returns
void
void hpi_update_versions ( uint8_t ∗ bl_version, uint8_t ∗ fw1_version, uint8_t ∗ fw2_version )
6.18.3.16
Update firmware version information in HPI registers.
This is an internal function used to update the firmware version information in the HPI registers.
Parameters
bl_version
Buffer containing Bootloader version information.
fw1_version
Buffer containing firmware-1 version information.
fw2_version
Buffer containing firmware-2 version information.
Returns
void
6.18.3.17
uint8_t hpid_get_ec_active_modes ( uint8_t port )
Get the active EC alternate modes value.
Parameters
port
USB-PD to check the configuration for.
Returns
The Active EC modes setting programmed by EC.
6.19
pd_common/dpm.h File Reference
#include "pd.h"
#include "status.h"
Functions
• uint8_t dpm_init (uint8_t port, app_cbk_t ∗app_cbk)
Generated for CCGx Firmware Stack by Doxygen
6.19 pd_common/dpm.h File Reference
•
•
•
•
•
•
•
113
uint8_t dpm_start (uint8_t port)
uint8_t dpm_stop (uint8_t port)
uint8_t dpm_deepsleep (void)
uint8_t dpm_wakeup (void)
bool dpm_sleep (void)
uint8_t dpm_task (uint8_t port)
ccg_status_t dpm_pd_command (uint8_t port, dpm_pd_cmd_t cmd, dpm_pd_cmd_buf_t ∗buf_ptr, dpm_←pd_cmd_cbk_t cmd_cbk)
ccg_status_t dpm_typec_command (uint8_t port, dpm_typec_cmd_t cmd, dpm_typec_cmd_cbk_t cmd_cbk)
const dpm_status_t ∗ dpm_get_info (uint8_t port)
void dpm_update_swap_response (uint8_t port, uint8_t value)
uint8_t dpm_update_src_cap (uint8_t port, uint8_t count, pd_do_t ∗pdo)
uint8_t dpm_update_src_cap_mask (uint8_t port, uint8_t mask)
uint8_t dpm_update_snk_cap (uint8_t port, uint8_t count, pd_do_t ∗pdo)
uint8_t dpm_update_snk_cap_mask (uint8_t port, uint8_t mask)
uint8_t dpm_update_snk_max_min (uint8_t port, uint8_t count, uint16_t ∗max_min)
uint8_t dpm_update_port_config (uint8_t port, uint8_t role, uint8_t dflt_role, uint8_t toggle_en, uint8_t try_←src_en)
uint8_t dpm_is_rdo_valid (uint8_t port, pd_do_t rdo)
uint8_t dpm_get_polarity (uint8_t port)
void dpm_update_db_support (uint8_t port, bool enable)
void dpm_typec_deassert_rp_rd (uint8_t port, uint8_t channel)
•
•
•
•
•
•
•
•
•
•
•
•
•
6.19.1
Detailed Description
Device Policy Manager (DPM) header file.
6.19.2
Function Documentation
6.19.2.1
uint8_t dpm_deepsleep ( void )
This function configures the device policy manager, for all ports, so that the system can go to deepsleep. This
function does not put the system into deepsleep but only performs the necessary tasks to enter deepsleep, if entry
is possible.
Returns
Returns 1 if deepsleep is possible and configured, 0 otherwise.
6.19.2.2
const dpm_status_t∗ dpm_get_info ( uint8_t port )
This function returns device policy manager status information for the specified port.
Parameters
port
Port index.
Returns
Pointer to a structure containing the DPM status information.
Generated for CCGx Firmware Stack by Doxygen
114
File Documentation
Warning
The information provided by this API must not be altered by the application.
6.19.2.3
uint8_t dpm_get_polarity ( uint8_t port )
Get the CC polarity of the Type-C connection.
Parameters
port
Port index.
Returns
Returns 0 if CC1 is used, and 1 if CC2 is used.
6.19.2.4
uint8_t dpm_init ( uint8_t port, app_cbk_t ∗ app_cbk )
This function initializes the device policy manager with callback pointers and loads the system info from config table.
This function also initializes policy engine and type c manager. This function must be called once on system init.
Parameters
port
Port index.
app_cbk
Application callback function pointer.
Returns
Returns 1 if successful, 0 otherwise.
6.19.2.5
uint8_t dpm_is_rdo_valid ( uint8_t port, pd_do_t rdo )
This generic function is provided by the device policy manager to evaluate any RDO with respect to current source
cap of the specified port.
Parameters
port
Port index.
rdo
Request data object.
Returns
Returns 1 if the request can be met, 0 otherwise.
6.19.2.6 ccg_status_t dpm_pd_command ( uint8_t port, dpm_pd_cmd_t cmd, dpm_pd_cmd_buf_t ∗ buf_ptr,
dpm_pd_cmd_cbk_t cmd_cbk )
This function provides an interface for the application module to send PD commands.
Generated for CCGx Firmware Stack by Doxygen
6.19 pd_common/dpm.h File Reference
115
Parameters
port
Port index.
cmd
buf_ptr
Command name.
Pointer to the command buffer.
cmd_cbk
Pointer to the callback function.
Returns
Returns CCG_STAT_SUCCESS if the command is registered, CCG_STAT_CMD_FAILURE if the PD port is
not ready for a command and CCG_STAT_BUSY if there is another pending command.
Warning
Data received via the callback should be copied out by the application, because the buffer will be reused by
the stack to store data on new message reception.
6.19.2.7
bool dpm_sleep ( void )
This function checks if the device policy manager can go into sleep mode.
Returns
Returns true if possible to go into sleep mode, false otherwise.
6.19.2.8
uint8_t dpm_start ( uint8_t port )
This function makes the specified port operational.
Parameters
port
Port index.
Returns
Returns 1 if successful, 0 otherwise.
6.19.2.9
uint8_t dpm_stop ( uint8_t port )
This function stops the port operation. The port will be put into the lowest power state and and will not be operational.
Parameters
port
Port index.
Returns
Returns 1 if successful, 0 otherwise.
Generated for CCGx Firmware Stack by Doxygen
116
File Documentation
6.19.2.10
uint8_t dpm_task ( uint8_t port )
This function runs the device policy manager task for the specified port.
Parameters
port
Port index.
Returns
Returns 1 if successful, 0 otherwise.
6.19.2.11 ccg_status_t dpm_typec_command ( uint8_t port, dpm_typec_cmd_t cmd, dpm_typec_cmd_cbk_t cmd_cbk )
This function provides an interface for the application module to control the Type C interface.
Parameters
port
Port index.
cmd
cmd_cbk
Command name.
Pointer to the callback function.
Returns
Returns CCG_STAT_SUCCESS if the command is registered, CCG_STAT_BUSY if a previous command is
still active and CCG_STAT_CMD_FAILURE if the port is in a disabled state.
6.19.2.12
void dpm_typec_deassert_rp_rd ( uint8_t port, uint8_t channel )
This function removes Rp and Rd from the specified CC channel.
Parameters
port
Port index.
channel
CC channel.
6.19.2.13
void dpm_update_db_support ( uint8_t port, bool enable )
Enable / disable dead battery operation.
If dead battery operation is enabled and if Vbus voltage is detected before going through PD contract, CCG will
assume that the device is operating under dead battery condition. If dead battery operation is disabled, CCG will
disable the consumer FET as part of link start-up.
Parameters
port
Port index.
enable
Enable / disable flag for dead battery operation.
Generated for CCGx Firmware Stack by Doxygen
6.19 pd_common/dpm.h File Reference
117
Returns
None
6.19.2.14
uint8_t dpm_update_port_config ( uint8_t port, uint8_t role, uint8_t dflt_role, uint8_t toggle_en, uint8_t try_src_en )
Change the PD port configuration at runtime.
This function allows changing the PD port configuration parameters like port role, default port role, DRP toggle
enable and Try.Src enable at runtime. These changes are only allowed while the corresponding PD port is disabled.
Parameters
port
USB-PD port to be configured.
role
New port role selection (0 = Sink, 1 = Source, 2 = Dual Role).
dflt_role
New default port role selection (0 = Sink, 1 = Source).
toggle_en
New value for DRP toggle enable flag.
try_src_en
New value for Try.SRC enable flag.
Returns
Returns 1 if the configuration update is successful, 0 in case of failure.
6.19.2.15
uint8_t dpm_update_snk_cap ( uint8_t port, uint8_t count, pd_do_t ∗ pdo )
This function updates the sink PDOs at runtime thereby overriding the sink PDOs in the config table.
Parameters
port
Port index.
count
pdo
Count of PDOs.
Pointer to the PDO array.
Returns
Returns 1 if successful, 0 otherwise.
6.19.2.16
uint8_t dpm_update_snk_cap_mask ( uint8_t port, uint8_t mask )
This function updates the sink PDO mask at runtime thereby overriding the sink PDO mask specified in the config
table.
Parameters
port
Port index.
mask
PDO mask.
Returns
Returns 1 if successful, 0 otherwise.
Generated for CCGx Firmware Stack by Doxygen
118
File Documentation
6.19.2.17
uint8_t dpm_update_snk_max_min ( uint8_t port, uint8_t count, uint16_t ∗ max_min )
This function updates the sink max/min current/power at runtime thereby overriding the sink max/min current/power
specified in the config table.
Parameters
port
Port index.
count
max_min
Count of PDOs.
Pointer to max/min cur/power array.
Returns
Returns 1 if successful, 0 otherwise.
6.19.2.18
uint8_t dpm_update_src_cap ( uint8_t port, uint8_t count, pd_do_t ∗ pdo )
This function updates the source PDOs at runtime thereby overriding the source PDOs in the config table.
Parameters
port
Port index.
count
pdo
Count of PDOs.
Pointer to the PDO array.
Returns
Returns 1 if successful, 0 otherwise.
6.19.2.19
uint8_t dpm_update_src_cap_mask ( uint8_t port, uint8_t mask )
This function updates the source PDO mask at runtime thereby overriding the source PDO mask in the config table.
Parameters
port
Port index.
mask
PDO mask.
Returns
Returns 1 if successful, 0 otherwise.
6.19.2.20
void dpm_update_swap_response ( uint8_t port, uint8_t value )
Update the SWAP_RESPONSE setting for the device policy manager.
Parameters
port
Port index.
value
New value for swap response.
Generated for CCGx Firmware Stack by Doxygen
6.20 pd_common/dpm_intern.h File Reference
119
Returns
None
6.19.2.21
uint8_t dpm_wakeup ( void )
This function configures the device policy manager, for all ports, after the system comes out of deepsleep.
Returns
Returns 1 if successful, 0 otherwise.
6.20
pd_common/dpm_intern.h File Reference
#include <pd.h>
Macros
• #define PORT_INFO_COPY_SIZE (102u)
Functions
dpm_status_t ∗ dpm_get_status (uint8_t port)
uint8_t dpm_refresh_src_cap (uint8_t port)
uint8_t dpm_refresh_snk_cap (uint8_t port)
uint8_t dpm_is_prev_contract_valid (uint8_t port)
uint8_t dpm_get_evtno_n_clear (uint8_t max_events, volatile uint32_t ∗evt_ptr)
•
•
•
•
•
6.20.1
Detailed Description
Stack internal definitions for the Device Policy Manager (DPM).
6.20.2
Function Documentation
6.20.2.1
uint8_t dpm_get_evtno_n_clear ( uint8_t max_events, volatile uint32_t ∗ evt_ptr )
This function retrieve the event number from event bitmask and also clears the original event variable. PE and Type
C state machines use bitmask event variable. Maximum no of events possible. Pointer to the event variable.
Returns
Returns event number
Warning
This function should not be called if event is equal to zero.
6.20.2.2 dpm_status_t∗ dpm_get_status ( uint8_t port )
This function returns the DPM status of the specified port.
Generated for CCGx Firmware Stack by Doxygen
120
File Documentation
Parameters
port
Port index.
Returns
Returns pointer to the DPM status structure.
6.20.2.3
uint8_t dpm_is_prev_contract_valid ( uint8_t port )
This function checks if the previous contract is valid. Previous contract may become invalid due to runtime update
of source caps by the Embedded Controller (EC).
Parameters
port
Port index.
Returns
Returns 1 if previous contract is valid, 0 otherwise.
6.20.2.4
uint8_t dpm_refresh_snk_cap ( uint8_t port )
This function refreshes the sink cap at runtime. Sink cap may be changed due to Embedded Controller (EC)
updates.
Parameters
port
Port index.
Returns
Returns 1 if successful, 0 otherwise.
6.20.2.5
uint8_t dpm_refresh_src_cap ( uint8_t port )
This function refreshes the source cap at runtime. Source cap may be changed due to Embedded Controller (EC)
updates.
Parameters
port
Port index.
Generated for CCGx Firmware Stack by Doxygen
6.21 pd_common/hpd.h File Reference
121
Returns
Returns 1 if successful, 0 otherwise.
6.21
pd_common/hpd.h File Reference
#include
#include
#include
#include
#include
<stdint.h>
<stdbool.h>
<ccgx_regs.h>
<status.h>
<pdss_hal.h>
Macros
•
•
•
•
•
•
•
•
#define HPD_IP_DIRECTION (0)
#define HPD_OP_DIRECTION (PDSS_CTRL_HPD_DIRECTION)
#define HPD_EVENT_MASK (3u)
#define HPD_EVENT_0_POS (0)
#define HPD_EVENT_1_POS (2)
#define HPD_EVENT_2_POS (4)
#define HPD_EVENT_3_POS (6)
#define HPD_GET_EVENT_0(hpd_queue) (((hpd_queue) >> HPD_EVENT_0_POS) & HPD_EVENT_M←ASK)
• #define HPD_GET_EVENT_1(hpd_queue) (((hpd_queue) >> HPD_EVENT_1_POS) & HPD_EVENT_M←ASK)
• #define HPD_GET_EVENT_2(hpd_queue) (((hpd_queue) >> HPD_EVENT_2_POS) & HPD_EVENT_M←ASK)
• #define HPD_GET_EVENT_3(hpd_queue) (((hpd_queue) >> HPD_EVENT_3_POS) & HPD_EVENT_M←ASK)
Typedefs
• typedef void(∗ hpd_event_cbk_t) (uint8_t port, hpd_event_type_t event)
Enumerations
• enum hpd_event_type_t {
HPD_EVENT_NONE = 0, HPD_EVENT_UNPLUG, HPD_EVENT_PLUG, HPD_EVENT_IRQ,
HPD_COMMAND_DONE }
Functions
•
•
•
•
•
•
6.21.1
ccg_status_t hpd_receive_init (uint8_t port, hpd_event_cbk_t cbk)
ccg_status_t hpd_transmit_init (uint8_t port, hpd_event_cbk_t cbk)
ccg_status_t hpd_deinit (uint8_t port)
ccg_status_t hpd_transmit_sendevt (uint8_t port, hpd_event_type_t evtype, bool wait)
void hpd_sleep_entry (uint8_t port)
void hpd_wakeup (uint8_t port, bool value)
Detailed Description
Hotplug Detect (HPD) driver header file.
Generated for CCGx Firmware Stack by Doxygen
122
File Documentation
6.21.2
Macro Definition Documentation
6.21.2.1
#define HPD_EVENT_MASK (3u)
HPD HW register event mask
6.21.3
Enumeration Type Documentation
6.21.3.1
enum hpd_event_type_t
List of HPD events detected by USBPD block.
Enumerator
HPD_EVENT_NONE No event.
HPD_EVENT_UNPLUG DP Unplug event.
HPD_EVENT_PLUG DP Plug event.
HPD_EVENT_IRQ DP IRQ event.
HPD_COMMAND_DONE Requested HPD command is complete.
6.21.4
Function Documentation
6.21.4.1 ccg_status_t hpd_deinit ( uint8_t port )
Disable the HPD functionality on the specified PD port.
Parameters
port
pd port index
Returns
Return CCG_STAT_SUCCESS in case of success, error code otherwise.
6.21.4.2 ccg_status_t hpd_receive_init ( uint8_t port, hpd_event_cbk_t cbk )
Enable the HPD-Receive functionality for the specified PD port.
Parameters
port
pd port index
cbk
callback function to be called when there is an HPD event.
Returns
Returns CCG_STAT_SUCCESS in case of success, error code otherwise.
6.21.4.3
void hpd_sleep_entry ( uint8_t port )
Prepare the HPD transmit block for deep-sleep.
Generated for CCGx Firmware Stack by Doxygen
6.21 pd_common/hpd.h File Reference
123
When CCG enters deep-sleep, the HPD transmit block is not active and leaves the HPD output floating. The APP
layer needs to manage this by updating the IO settings of the HPD signal before deep-sleep entry and after device
wake-up.
Parameters
port
Port whose HPD output is to be updated. return None
6.21.4.4 ccg_status_t hpd_transmit_init ( uint8_t port, hpd_event_cbk_t cbk )
Enable the HPD-Transmit functionality for the specified PD port.
Parameters
port
pd port index.
cbk
callback to be used for command completion event.
Returns
Returns CCG_STAT_SUCCESS in case of success, error code otherwise.
6.21.4.5 ccg_status_t hpd_transmit_sendevt ( uint8_t port, hpd_event_type_t evtype, bool wait )
Send the desired HPD event out through the HPD GPIO.
Parameters
port
Port on which HPD event is to be sent.
evtype
Type of HPD event to be sent.
wait
Whether function should wait until command is complete.
Returns
Returns CCG_STAT_SUCCESS in case of success, error code otherwise.
6.21.4.6
void hpd_wakeup ( uint8_t port, bool value )
Restore the HPD signal driver after CCG wakes from deep-sleep.
Parameters
port
Port whose HPD signal is to be restored.
value
Startup value for the HPD signal.
Generated for CCGx Firmware Stack by Doxygen
124
File Documentation
Returns
None
6.22
pd_common/pd.h File Reference
#include
#include
#include
#include
#include
<config.h>
<stdint.h>
<stdbool.h>
<stddef.h>
<utils.h>
Data Structures
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
union cc_state_t
union pd_hdr_t
struct pd_hdr_t::PD_HDR
union pd_do_t
struct pd_do_t::BIST_DO
struct pd_do_t::FIXED_SRC
struct pd_do_t::VAR_SRC
struct pd_do_t::BAT_SRC
struct pd_do_t::SRC_GEN
struct pd_do_t::FIXED_SNK
struct pd_do_t::VAR_SNK
struct pd_do_t::BAT_SNK
struct pd_do_t::RDO_FIXED_VAR
struct pd_do_t::RDO_FIXED_VAR_GIVEBACK
struct pd_do_t::RDO_BAT
struct pd_do_t::RDO_BAT_GIVEBACK
struct pd_do_t::RDO_GEN
struct pd_do_t::RDO_GEN_GVB
struct pd_do_t::STD_VDM_HDR
struct pd_do_t::USTD_VDM_HDR
struct pd_do_t::STD_VDM_ID_HDR
struct pd_do_t::STD_CERT_VDO
struct pd_do_t::STD_PROD_VDO
struct pd_do_t::STD_CBL_VDO
struct pd_do_t::STD_AMA_VDO
struct pd_do_t::STD_SVID_RESP_VDO
struct pd_do_t::STD_DP_VDO
struct pd_do_t::DP_STATUS_VDO
struct pd_do_t::DP_CONFIG_VDO
struct pd_do_t::TBT_VDO
struct pd_do_t::SLICE_VDO
struct pd_do_t::SLICE_SUBHDR
struct pd_port_config_t
struct pd_config_t
struct app_resp_t
struct vdm_resp_t
struct dpm_pd_cmd_buf_t
union contract_t
struct contract_t::FIELD
Generated for CCGx Firmware Stack by Doxygen
6.22 pd_common/pd.h File Reference
•
•
•
•
125
struct pd_contract_info_t
struct pd_packet_t
struct app_cbk_t
struct dpm_status_t
Macros
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
#define PD_EXTERNALLY_POWERED_BIT_POS (7u)
#define CFG_TABLE_OCP_METHOD_MASK (0x1u)
#define CFG_TABLE_OCP_EN_MASK (0x2u)
#define CFG_TABLE_OVP_EN_MASK (0x4u)
#define GIVE_BACK_MASK (0x8000u)
#define SNK_MIN_MAX_MASK (0x3FFu)
#define GET_DR_SWAP_RESP(resp) ((resp) & 0x3u)
#define GET_PR_SWAP_RESP(resp) (((resp) & 0xCu) >> 2u)
#define GET_VCONN_SWAP_RESP(resp) (((resp) & 0x30u) >> 4u)
#define APP_RESP_ACCEPT (0u)
#define APP_RESP_REJECT (1u)
#define APP_RESP_WAIT (2u)
#define MAX_SRC_CAP_COUNT (50u)
#define MAX_HARD_RESET_COUNT (3u)
#define MAX_CBL_DSC_ID_COUNT (20u)
#define MAX_NO_OF_DO (7u)
#define MAX_NO_OF_PDO (MAX_NO_OF_DO)
#define MAX_NO_OF_VDO (MAX_NO_OF_DO)
#define VDM_HEADER_IDX (0u)
#define BDO_HDR_IDX (0u)
#define ID_HEADER_IDX (1u)
#define RDO_IDX (0u)
#define CBL_VDO_INDEX (4u)
#define CBL_VDO_COUNT (5u)
#define PD_REV (1u) /∗ Version 2.0 ∗/
#define PD_REV_POS (6u)
#define TX_SOP_GD_CRC_HDR_DFLT ((PD_REV << PD_REV_POS) | 0x0001u)
#define TX_SOP_PRIME_DPRIME_GD_CRC_HDR_DFLT ((TX_SOP_GD_CRC_HDR_DFLT <<16u) |T←X_SOP_GD_CRC_HDR_DFLT)
#define MAX_PD_PKT_WORDS (8u)
#define PD_WORD_SIZE (4u)
#define MAX_PD_PKT_BYTES (MAX_PD_PKT_WORDS ∗ PD_WORD_SIZE)
#define MAX_MESSAGE_ID (7u)
#define PD_HEADER(type, id, cnt)
#define PD_DR_PR_ROLE(data_role, pwr_role) (((pwr_role) << 8)|((data_role) << 5))
#define GET_PD_HDR_CNT(header) (((header) >> 12) & 0x7)
#define GET_PD_HDR_PR_ROLE(header) (((header) >> 8) & 0x1)
#define GET_PD_HDR_CBL_PLUG(header) (((header) >> 8) & 0x1)
#define GET_PD_HDR_SPEC_REV(header) (((header) >> 6) & 0x3)
#define GET_PD_HDR_DR_ROLE(header) (((header) >> 5) & 0x1)
#define GET_PD_HDR_ID(header) (((header) >> 9) & 0x7)
#define GET_PD_HDR_TYPE(header) ((header) & 0xF)
#define PD_HDR_MASK (0x0000FFFFu)
#define MSG_ID_MASK ((0x7u) << 9u)
#define GET_PD_HDR(buf0) ((buf0) & PD_HDR_MASK)
#define MAX_SOP_TYPES (3)
#define GET_RDO_OBJ_POS(rdo) (((rdo) >> 28) & 0x7)
Generated for CCGx Firmware Stack by Doxygen
126
File Documentation
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
#define GET_RDO_GV_BACK(rdo) (((rdo) >> 27) & 0x1)
#define GET_RDO_CAP_MIS(rdo) (((rdo) >> 26) & 0x1)
#define GET_RDO_USB_COM(rdo) (((rdo) >> 25) & 0x1)
#define GET_RDO_NO_SSPND(rdo) (((rdo) >> 24) & 0x1)
#define GET_RDO_OP_CUR(rdo) (((rdo) >> 10) & 0x3FF)
#define GET_RDO_OP_PWR(rdo) (((rdo) >> 10) & 0x3FF)
#define GET_RDO_MAX_OP_CUR(rdo) (((rdo)) & 0x3FF)
#define GET_RDO_MIN_OP_CUR(rdo) (((rdo)) & 0x3FF)
#define GET_RDO_MAX_OP_PWR(rdo) (((rdo)) & 0x3FF)
#define GET_RDO_MIN_OP_PWR(rdo) (((rdo)) & 0x3FF)
#define STD_SVID (0xFF00u)
#define DP_SVID (0xFF01u)
#define CY_VID (0x04B4u)
#define TBT_SVID (0x8087u)
#define GET_VID(vdm_hdr) ((vdm_hdr) >> 16)
#define GET_VDM_TYPE(vdm_hdr) (((vdm_hdr) >> 15) & 0x1)
#define GET_SVDM_VDM_VER(vdm_hdr) (((vdm_hdr) >> 13) & 0x3)
#define GET_SVDM_OBJ_POS(vdm_hdr) (((vdm_hdr) >> 8) & 0x7)
#define GET_SVDM_CMD_TYPE(vdm_hdr) (((vdm_hdr) >> 6) & 0x3)
#define GET_SVDM_CMD(vdm_hdr) (((vdm_hdr)) & 0x1F)
#define STD_VDM_VERSION (0u)
#define STD_VDM_HEADER_IDENTITY_REQ
#define STD_VDM_HEADER_SVID_REQ
#define GET_BIST_MODE(bist_hdr) ((bist_hdr) >> 28)
#define DEFAULT_CBL_CAP (CBL_CAP_3A)
#define CBL_CAP_0A (0u) /∗ 0A ∗/
#define CBL_CAP_3A (300u) /∗ 3A ∗/
#define CBL_CAP_5A (500u) /∗ 5A ∗/
#define VSAFE_0V (16u) /∗ 0.8V ∗/
#define VSAFE_5V (100u) /∗ 5V ∗/
#define VSAFE_9V (180u) /∗ 9V ∗/
#define VSAFE_12V (240u) /∗ 12V ∗/
#define VSAFE_13V (260u) /∗ 13V ∗/
#define VSAFE_15V (300u) /∗ 15V ∗/
#define VSAFE_19V (380u) /∗ 19V ∗/
#define VSAFE_20V (400u) /∗ 20V ∗/
#define VSAFE_0V_PR_SWAP_SNK_SRC (60u) /∗ 3V ∗/
#define VSAFE_0V_HARD_RESET (60u) /∗ 3V ∗/
#define PD_VOLT_PER_UNIT (50u)
#define I_SAFE_0mA (0u)
#define ISAFE_DEF (50u)
#define VSAFE_0V_SNK_MARGIN (0)
#define VSAFE_0V_PR_SWAP_SNK_SRC_MARGIN (0)
#define VSAFE_0V_HARD_RESET_MARGIN (0)
#define VSAFE_0V_SRC_MARGIN (-50)
#define VSAFE_0V_SRC_TURN_ON_MARGIN (0)
#define VSAFE_5V_SNK_TURN_ON_MARGIN (-20)
#define VSAFE_5V_SRC_TURN_ON_MARGIN (-20)
#define PE_EVT_NONE (0x00000000u)
#define PE_EVT_HARD_RESET_RCVD (0x00000001u)
#define PE_EVT_SOFT_RESET_RCVD (0x00000002u)
#define PE_EVT_ENTRY (0x00000004u)
#define PE_EVT_TX_SUCCESS (0x00000008u)
#define PE_EVT_TX_DISCARDED (0x00000010u)
#define PE_EVT_TX_FAIL (0x00000020u)
Generated for CCGx Firmware Stack by Doxygen
6.22 pd_common/pd.h File Reference
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
#define PE_EVT_PKT_RCVD (0x00000040u)
#define PE_EVT_PWR_RDY (0x00000080u)
#define PE_EVT_TIMEOUT (0x00000100u)
#define PE_EVT_DPM_CMD_RCVD (0x00000200u)
#define PE_EVT_APP_RESP_RCVD (0x00000400u)
#define PE_EVT_VDM_RESP_RCVD (0x00000800u)
#define PE_EVT_CABLE_TIMEOUT (0x00001000u)
#define PE_EVT_NO_RESPONSE_TIMEOUT (0x00002000u)
#define PE_EVT_ALL_MASK (0xFFFFFFFFu)
#define PE_FSM_NONE (0x00000000u)
#define PE_FSM_HARD_RESET_AMS (0x00000001u)
#define PE_FSM_BTD_AMS (0x00000002u)
#define PE_FSM_BCM2_AMS (0x00000004u)
#define PE_FSM_SOFT_RESET_AMS (0x00000008u)
#define PE_FSM_SRC_CONTRACT_AMS (0x00000010u)
#define PE_FSM_SNK_CONTRACT_AMS (0x00000020u)
#define PE_FSM_PR_SWAP_AMS (0x00000040u)
#define PE_FSM_DR_SWAP_AMS (0x00000080u)
#define PE_FSM_VCONN_SWAP_AMS (0x00000100u)
#define PE_FSM_GO_TO_MIN_AMS (0x00000200u)
#define PE_FSM_GENERIC_AMS (0x00000400u)
#define PE_FSM_ALL_AMS_MASKS (0xFFFFFFFFu)
#define DRP_TOGGLE_PERIOD (75u) /∗ 75ms ∗/
#define SRC_DRP_MIN_DC (34) /∗ 34% ∗/
#define CC_CHANNEL_1 (0u)
#define CC_CHANNEL_2 (1u)
#define RP_CC1_OPEN_CC2_OPEN (((RP_OPEN) << 8)|RP_OPEN)
#define RP_CC1_OPEN_CC2_RD (((RP_RD) << 8)|RP_OPEN)
#define RP_CC1_OPEN_CC2_RA (((RP_RA) << 8)|RP_OPEN)
#define RP_CC1_RD_CC2_OPEN (((RP_OPEN) << 8)|RP_RD)
#define RP_CC1_RA_CC2_OPEN (((RP_OPEN) << 8)|RP_RA)
#define RP_CC1_RA_CC2_RD (((RP_RD) << 8)|RP_RA)
#define RP_CC1_RA_CC2_RA (((RP_RA) << 8)|RP_RA)
#define RP_CC1_RD_CC2_RA (((RP_RA) << 8)|RP_RD)
#define RP_CC1_RD_CC2_RD (((RP_RD) << 8)|RP_RD)
#define RD_CC1_RA_CC2_USB (((RD_USB) << 8)|RD_RA)
#define RD_CC1_RA_CC2_1_5A (((RD_1_5A) << 8)|RD_RA)
#define RD_CC1_RA_CC2_3A (((RD_3A) << 8)|RD_RA)
#define RD_CC1_USB_CC2_RA (((RD_RA) << 8)|RD_USB)
#define RD_CC1_1_5A_CC2_RA (((RD_RA) << 8)|RD_1_5A)
#define RD_CC1_3A_CC2_RA (((RD_RA) << 8)|RD_3A)
#define RD_CC1_RA_CC2_RA (((RD_RA) << 8)|RD_RA)
#define RD_CC1_ERR_CC2_ERR (((RD_ERR) << 8)|RD_ERR)
#define TYPEC_EVT_NONE (0x00000000u)
#define TYPEC_EVT_ERR_RECOVERY (0x00000001u)
#define TYPEC_EVT_ENTRY (0x00000002u)
#define TYPEC_EVT_TIMEOUT (0x00000004u)
#define TYPEC_EVT_DETACH (0x00000008u)
#define TYPEC_EVT_ATTACH (0x00000010u)
#define TYPEC_EVT_PWR_RDY (0x00000020u)
#define TYPEC_EVT_DPM_CMD_RCVD (0x00000040u)
#define TYPEC_EVT_ALL_MASK (0xFFFFFFFFu)
#define TYPEC_FSM_NONE (0x00000000u)
#define TYPEC_FSM_GENERIC (0x00000001u)
#define TYPEC_FSM_ALL_MASKS (0xFFFFFFFFu)
Generated for CCGx Firmware Stack by Doxygen
127
128
File Documentation
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
#define PD_TIMERS_START_ID (0u)
#define PD_TIMERS_END_ID (14u)
#define TYPEC_TIMERS_START_ID (15u)
#define TYPEC_TIMERS_END_ID (24u)
#define APP_TIMERS_START_ID (30u)
#define PD_GENERIC_TIMER (0u)
#define PD_CABLE_TIMER (1u)
#define PD_NO_RESPONSE_TIMER (2u)
#define PD_CBL_DSC_ID_TIMER (3u)
#define PD_CBL_DELAY_TIMER (4u)
#define PD_PHY_BUSY_TIMER (5u)
#define PD_HARD_RESET_TX_TIMER (6u)
#define PD_NO_RESPONSE_TIMER_PERIOD (5000u)
#define PD_CBL_DSC_ID_TIMER_PERIOD (49u)
#define PD_CBL_DSC_ID_START_TIMER_PERIOD (43u)
#define PD_CBL_DELAY_TIMER_PERIOD (2u)
#define PD_PHY_BUSY_TIMER_PERIOD (10u)
#define PD_HARD_RESET_TX_TIMER_PERIOD (5u)
#define PD_VBUS_TURN_ON_TIMER_PERIOD (275u)
#define PD_VBUS_TURN_OFF_TIMER_PERIOD (625u)
#define PD_PS_SRC_TRANS_TIMER_PERIOD (400u)
#define PD_PS_SRC_OFF_TIMER_PERIOD (900u)
#define PD_PS_SRC_ON_TIMER_PERIOD (450u)
#define PD_PS_SNK_TRANSITION_TIMER_PERIOD (500u)
#define PD_SRC_RECOVER_TIMER_PERIOD (750u)
#define PD_RP_ASSERT_TIMER_PERIOD (100u)
#define PD_SENDER_RESPONSE_TIMER_PERIOD (27u)
#define PD_RECEIVER_RESPONSE_TIMER_PERIOD (15u)
#define PD_SINK_WAIT_CAP_TIMER_PERIOD (500u)
#define PD_SRC_CAP_TIMER_PERIOD (110u)
#define PD_SRC_HARD_RESET_TRANS_TIMER_PERIOD (720u)
#define PD_SWAP_SRC_START_TIMER_PERIOD (55u)
#define PD_SOURCE_TRANSITION_TIMER_PERIOD (28u)
#define PD_VCONN_OFF_TIMER_PERIOD (25u)
#define PD_VCONN_ON_TIMER_PERIOD (100u)
#define PD_VCONN_TURN_ON_TIMER_PERIOD (10u)
#define PD_CBL_READY_TIMER_PERIOD (50u)
#define PD_VDM_RESPONSE_TIMER_PERIOD (25u)
#define PD_VDM_ENTER_MODE_RESPONSE_TIMER_PERIOD (42u)
#define PD_VDM_EXIT_MODE_RESPONSE_TIMER_PERIOD (42u)
#define PD_CBL_RESPONSE_TIMER_PERIOD (5u)
#define PD_DPM_RESP_TIMER_PERIOD (13u)
#define PD_DPM_RESP_REC_RESP_PERIOD (13u)
#define PD_BIST_CONT_MODE_TIMER_PERIOD (55u)
#define PD_HARD_RESET_COMPLETE_TIMER_PERIOD (5u)
#define PD_CC_BUSY_TIMER_PERIOD (5u)
#define PD_SINK_VBUS_TURN_OFF_TIMER_PERIOD (700u)
#define PD_SINK_VBUS_TURN_ON_TIMER_PERIOD (1300u)
#define PD_PS_HARD_RESET_TIMER_PERIOD (27u)
#define TYPEC_CC1_DEBOUNCE_TIMER (15u)
#define TYPEC_CC2_DEBOUNCE_TIMER (16u)
#define TYPEC_RD_DEBOUNCE_TIMER (17u)
#define TYPEC_VBUS_DISCHARGE_TIMER (18u)
#define TYPEC_GENERIC_TIMER (20u)
#define TYPEC_CC_DEBOUNCE_TIMER_PERIOD (140u)
Generated for CCGx Firmware Stack by Doxygen
6.22 pd_common/pd.h File Reference
•
•
•
•
•
•
•
•
•
•
129
#define TYPEC_PD_DEBOUNCE_TIMER_PERIOD (10u)
#define TYPEC_RD_DEBOUNCE_TIMER_PERIOD (12u)
#define TYPEC_ERROR_RECOVERY_TIMER_PERIOD (50u)
#define TYPEC_DRP_TRY_TIMER_PERIOD (130u)
#define TYPEC_DRP_TRY_WAIT_TIMER_PERIOD (550u)
#define TYPEC_DRP_TIMER_PERIOD (37u)
#define TYPEC_VBUS_DISCHARGE_TIMER_PERIOD (10u)
#define VBUS_TURN_ON_TIMER_PERIOD (250u)
#define VBUS_TURN_OFF_TIMER_PERIOD (625u)
#define VCONN_TURN_ON_TIMER_PERIOD (10u)
Typedefs
•
•
•
•
•
•
typedef void(∗ pd_cbk_t) (uint8_t port, uint32_t event)
typedef void(∗ dpm_pd_cmd_cbk_t) (uint8_t port, resp_status_t resp, const pd_packet_t ∗pkt_ptr)
typedef void(∗ app_resp_cbk_t) (uint8_t port, app_resp_t ∗resp)
typedef void(∗ vdm_resp_cbk_t) (uint8_t port, vdm_resp_t ∗resp)
typedef void(∗ pwr_ready_cbk_t) (uint8_t port)
typedef void(∗ dpm_typec_cmd_cbk_t) (uint8_t port, dpm_typec_cmd_resp_t resp)
Enumerations
• enum rdo_type_t { FIXED_VAR_RDO = 0, BAT_RDO }
• enum ctrl_msg_t {
CTRL_MSG_RSRVD = 0, CTRL_MSG_GOOD_CRC = 1, CTRL_MSG_GO_TO_MIN, CTRL_MSG_ACC←EPT,
CTRL_MSG_REJECT, CTRL_MSG_PING, CTRL_MSG_PS_RDY, CTRL_MSG_GET_SOURCE_CAP,
CTRL_MSG_GET_SINK_CAP, CTRL_MSG_DR_SWAP, CTRL_MSG_PR_SWAP, CTRL_MSG_VCON←N_SWAP,
CTRL_MSG_WAIT, CTRL_MSG_SOFT_RESET }
• enum data_msg_t {
DATA_MSG_SRC_CAP = 1, DATA_MSG_REQUEST, DATA_MSG_BIST, DATA_MSG_SNK_CAP,
DATA_MSG_VDM = 15 }
• enum pdo_t { PDO_FIXED_SUPPLY = 0, PDO_BATTERY, PDO_VARIABLE_SUPPLY, PDO_RESERVED
}
• enum peak_cur_cap_t { IMAX_EQ_IOC = 0, IMAX_EQ_130_IOC, IMAX_EQ_150_IOC, IMAX_EQ_200_IOC
}
• enum bist_mode_t {
BIST_RX_MODE = 0, BIST_TX_MODE, BIST_RETURN_COUNTERS_MODE, BIST_CARRIER_MODE_0,
BIST_CARRIER_MODE_1, BIST_CARRIER_MODE_2, BIST_CARRIER_MODE_3, BIST_EYE_PATTE←RN_MODE,
BIST_TEST_DATA_MODE }
• enum sop_t {
SOP = 0, SOP_PRIME, SOP_DPRIME, SOP_P_DEBUG,
SOP_DP_DEBUG, HARD_RESET, CABLE_RESET, SOP_INVALID }
• enum port_role_t { PRT_ROLE_SINK = 0, PRT_ROLE_SOURCE, PRT_DUAL }
• enum port_type_t { PRT_TYPE_UFP = 0, PRT_TYPE_DFP, PRT_TYPE_DRP }
• enum typec_cur_t { TYPE_C_CUR_DEF, TYPE_C_CUR_1_5A, TYPE_C_CUR_3_A, TYPE_C_CUR_DI←SABLED }
• enum app_req_status_t { REQ_SEND_HARD_RESET = 1, REQ_ACCEPT = 3, REQ_REJECT = 4, REQ←_WAIT = 12 }
• enum resp_status_t {
SEQ_ABORTED = 0, CMD_FAILED, RES_TIMEOUT, CMD_SENT,
RES_RCVD }
Generated for CCGx Firmware Stack by Doxygen
130
File Documentation
• enum dpm_pd_cmd_t {
DPM_CMD_SRC_CAP_CHNG = 0, DPM_CMD_SNK_CAP_CHNG, DPM_CMD_SEND_GO_TO_MIN, D←PM_CMD_GET_SNK_CAP,
DPM_CMD_GET_SRC_CAP, DPM_CMD_SEND_HARD_RESET, DPM_CMD_SEND_SOFT_RESET, D←PM_CMD_SEND_CABLE_RESET,
DPM_CMD_SEND_SOFT_RESET_EMCA, DPM_CMD_SEND_DR_SWAP, DPM_CMD_SEND_PR_SW←AP, DPM_CMD_SEND_VCONN_SWAP,
DPM_CMD_SEND_VDM, DPM_CMD_SEND_INVALID = 0xFFu }
• enum pd_devtype_t {
DEV_SNK = 1, DEV_SRC, DEV_DBG_ACC, DEV_AUD_ACC,
DEV_PWRD_ACC, DEV_UNSUPORTED_ACC }
• enum vdm_type_t { VDM_TYPE_UNSTRUCTURED = 0, VDM_TYPE_STRUCTURED }
• enum std_vdm_cmd_t {
VDM_CMD_DSC_IDENTITY = 1, VDM_CMD_DSC_SVIDS, VDM_CMD_DSC_MODES, VDM_CMD_EN←TER_MODE,
VDM_CMD_EXIT_MODE, VDM_CMD_ATTENTION, VDM_CMD_DP_STATUS_UPDT = 16, VDM_CMD←_DP_CONFIGURE = 17 }
• enum std_vdm_cmd_type_t { CMD_TYPE_INITIATOR = 0, CMD_TYPE_RESP_ACK, CMD_TYPE_RES←P_NAK, CMD_TYPE_RESP_BUSY }
• enum std_vdm_prod_t {
PROD_TYPE_UNDEF = 0, PROD_TYPE_HUB, PROD_TYPE_PERI, PROD_TYPE_PAS_CBL,
PROD_TYPE_ACT_CBL, PROD_TYPE_AMA }
• enum cbl_vbus_cur_t { CBL_VBUS_CUR_0A = 0, CBL_VBUS_CUR_3A, CBL_VBUS_CUR_5A }
• enum cbl_term_t { CBL_TERM_BOTH_PAS_VCONN_NOT_REQ = 0, CBL_TERM_BOTH_PAS_VCON←N_REQ, CBL_TERM_ONE_ACT_ONE_PAS_VCONN_REQ, CBL_TERM_BOTH_ACT_VCONN_REQ }
• enum pe_hard_reset_ams_state_t {
PE_HR_AMS_SEND_HARD_RESET = 0, PE_HR_AMS_SRC_TRANS_TO_DFLT, PE_HR_AMS_SRC_←RECOVER, PE_HR_AMS_SRC_APPLY_VBUS,
PE_HR_AMS_SNK_TRANS_TO_DFLT, PE_HR_AMS_SNK_WAIT_VBUS_OFF, PE_HR_AMS_SNK_W←AIT_VBUS_ON, PE_HR_AMS_MAX_STATES }
• enum pe_bist_test_data_ams_state_t { PE_BTD_AMS_ENABLED = 0, PE_BTD_AMS_MAX_STATES }
• enum pe_bist_cm2_ams_state_t { PE_BCM2_ENABLED = 0, PE_BCM2_AMS_MAX_STATES }
• enum pe_soft_reset_ams_state_t { PE_SR_AMS_SEND_SOFT_RESET = 0, PE_SR_AMS_RCVD_SO←FT_RESET, PE_SR_AMS_MAX_STATES }
• enum pe_src_contract_ams_state_t {
PE_SRC_AMS_SRC_STARTUP = 0, PE_SRC_AMS_SRC_SEND_CBL_SOFT_RESET, PE_SRC_AMS←_SRC_SEND_CBL_DSC_ID, PE_SRC_AMS_SRC_SEND_CAP,
PE_SRC_AMS_SRC_DISCOVERY, PE_SRC_AMS_SRC_NEG_CAP, PE_SRC_AMS_SRC_TRANS_S←UPPLY, PE_SRC_AMS_SRC_SEND_PS_RDY,
PE_SRC_AMS_SRC_WAIT_NEW_CAP, PE_SRC_AMS_MAX_STATES }
• enum pe_snk_contract_ams_state_t {
PE_SNK_AMS_SNK_STARTUP = 0, PE_SNK_AMS_WAIT_FOR_CAP, PE_SNK_AMS_SNK_EVAL_C←AP, PE_SNK_AMS_SNK_SEL_CAP,
PE_SNK_AMS_SNK_TRANS_SINK, PE_SNK_AMS_MAX_STATES }
• enum pe_pr_swap_ams_state_t {
PE_PR_AMS_EVAL_PR_SWAP = 0, PE_PR_AMS_SEND_PR_SWAP, PE_PR_AMS_SRC_SNK_TRA←NSITION, PE_PR_AMS_SRC_SNK_REMOVE_VBUS,
PE_PR_AMS_SRC_SNK_WAIT_PS_RDY, PE_PR_AMS_SNK_SRC_WAIT_PS_RDY, PE_PR_AMS_S←NK_SRC_APPLY_VBUS, PE_PR_AMS_MAX_STATES }
• enum pe_dr_swap_ams_state_t { PE_DR_AMS_EVAL_DR_SWAP = 0, PE_DR_AMS_SEND_DR_SWAP,
PE_DR_AMS_DFP_CHNG_DATA_ROLE, PE_DR_AMS_MAX_STATES }
• enum pe_vconn_swap_ams_state_t {
PE_VS_AMS_EVAL_VCONN_SWAP = 0, PE_VS_AMS_SEND_VCONN_SWAP, PE_VS_AMS_TURN_←ON_VCONN, PE_VS_AMS_TURN_OFF_VCONN,
PE_VS_AMS_MAX_STATES }
Generated for CCGx Firmware Stack by Doxygen
6.22 pd_common/pd.h File Reference
131
• enum pe_generic_ams_state_t {
PE_GN_AMS_READY = 0, PE_GN_AMS_REJECT, PE_GN_AMS_GIVE_SRC_CAP, PE_GN_AMS_GI←VE_SNK_CAP,
PE_GN_AMS_GET_SRC_CAP, PE_GN_AMS_GET_SNK_CAP, PE_GN_AMS_SEND_SR_SP_DP, PE←_GN_AMS_SEND_CABLE_RESET,
PE_GN_AMS_EVAL_VDM, PE_GN_AMS_SEND_VDM, PE_GN_AMS_MAX_STATES }
• enum pe_cbl_state_t { CBL_FSM_DISABLED = 0, CBL_FSM_ENTRY, CBL_FSM_SEND_SOFT_RESET,
CBL_FSM_SEND_DSC_ID }
• enum rp_cc_status_t { RP_RA = 0, RP_RD, RP_OPEN }
• enum rd_cc_status_t {
RD_RA = 0, RD_USB, RD_1_5A, RD_3A,
RD_ERR }
• enum rp_term_t { RP_TERM_RP_CUR_DEF = 0, RP_TERM_RP_CUR_1_5A, RP_TERM_RP_CUR_3A }
• enum dpm_typec_cmd_t {
DPM_CMD_SET_RP_DFLT = 0, DPM_CMD_SET_RP_1_5A, DPM_CMD_SET_RP_3A, DPM_CMD_PO←RT_DISABLE,
DPM_CMD_TYPEC_INVALID }
• enum dpm_typec_cmd_resp_t { DPM_RESP_FAIL = 0, DPM_RESP_SUCCESS }
• enum typec_generic_fsm_state_t {
TYPEC_GN_FSM_ERR_RECOV = 0, TYPEC_GN_FSM_ERR_RECOV_CMPLT, TYPEC_GN_FSM_ATT←ACH_WAIT, TYPEC_GN_FSM_TRY_SRC,
TYPEC_GN_FSM_TRY_WAIT_SNK, TYPEC_GN_FSM_UNATTACHED_SRC, TYPEC_GN_FSM_UNA←TTACHED_SNK, TYPEC_GN_FSM_AUD_ACC,
TYPEC_GN_FSM_DBG_ACC, TYPEC_GN_FSM_ATTACHED_SRC, TYPEC_GN_FSM_ATTACHED_S←NK, TYPEC_GN_FSM_MAX_STATES }
• enum pd_contract_status_t {
PD_CONTRACT_NEGOTIATION_SUCCESSFUL = 0x01, PD_CONTRACT_CAP_MISMATCH_DETEC←TED = 0x03, PD_CONTRACT_REJECT_CONTRACT_VALID = 0x00, PD_CONTRACT_REJECT_CONT←RACT_NOT_VALID = 0x04,
PD_CONTRACT_REJECT_NO_CONTRACT = 0x08, PD_CONTRACT_REJECT_EXPLICIT_CONTRACT
= 0x0C, PD_CONTRACT_REJECT_NO_EXPLICIT_CONTRACT = 0x10, PD_CONTRACT_PS_READY←_NOT_RECEIVED = 0x14,
PD_CONTRACT_PS_READY_NOT_SENT = 0x18 }
• enum app_evt_t {
APP_EVT_UNEXPECTED_VOLTAGE_ON_VBUS, APP_EVT_TYPE_C_ERROR_RECOVERY, APP_E←VT_CONNECT, APP_EVT_DISCONNECT,
APP_EVT_EMCA_DETECTED, APP_EVT_EMCA_NOT_DETECTED, APP_EVT_ALT_MODE, APP_E←VT_APP_HW,
APP_EVT_RP_CHANGE, APP_EVT_HARD_RESET_RCVD, APP_EVT_HARD_RESET_COMPLETE,
APP_EVT_PKT_RCVD,
APP_EVT_PR_SWAP_COMPLETE, APP_EVT_DR_SWAP_COMPLETE, APP_EVT_VCONN_SWAP_←COMPLETE, APP_EVT_SENDER_RESPONSE_TIMEOUT,
APP_EVT_VENDOR_RESPONSE_TIMEOUT, APP_EVT_HARD_RESET_SENT, APP_EVT_SOFT_RE←SET_SENT, APP_EVT_CBL_RESET_SENT,
APP_EVT_PE_DISABLED, APP_EVT_PD_CONTRACT_NEGOTIATION_COMPLETE, APP_EVT_VBU←S_OVP_FAULT, APP_EVT_VBUS_OCP_FAULT,
APP_EVT_VCONN_OCP_FAULT, APP_EVT_VBUS_PORT_DISABLE, APP_EVT_TYPEC_STARTED }
Functions
• const pd_config_t ∗ get_pd_config (void)
• const pd_port_config_t ∗ get_pd_port_config (uint8_t port)
6.22.1
Detailed Description
Common definitions and structures used in the CCG USB-PD stack.
Generated for CCGx Firmware Stack by Doxygen
132
File Documentation
6.22.2
Macro Definition Documentation
6.22.2.1
#define DRP_TOGGLE_PERIOD (75u) /∗ 75ms ∗/
Minimum period for DRP toggling, See Table 4-16 Type C spec Rev1
6.22.2.2
#define PD_HEADER( type, id, cnt )
Value:
((type) | (PD_REV << 6) | \
((id) << 9) | ((cnt) << 12))
6.22.2.3
#define SRC_DRP_MIN_DC (34) /∗ 34% ∗/
Minimum % of DRP period for SRC, See Table 4-16 Type C spec Rev1
6.22.2.4
#define STD_VDM_HEADER_IDENTITY_REQ
Value:
\
(
\
\
\
\
(STD_SVID << 16) |
(VDM_TYPE_STRUCTURED << 15) |
(VDM_CMD_DSC_IDENTITY) |
(STD_VDM_VERSION << 13)
)
6.22.2.5
#define STD_VDM_HEADER_SVID_REQ
Value:
\
(
(STD_SVID << 16) |
(VDM_TYPE_STRUCTURED << 15) |
(VDM_CMD_DSC_SVIDS) |
(STD_VDM_VERSION << 13)
\
\
\
\
)
6.22.3
Typedef Documentation
6.22.3.1
: pd_cbk_t
: PD callback prototype
This is a stack internal callback function used by the USB-PD Protocol layer to send events to the Policy Engine.
The events notified correspond to Policy Engine events such as HARD RESET or SOFT RESET received.
6.22.4
Enumeration Type Documentation
6.22.4.1
enum typec_generic_fsm_state_t
Enum to hold TypeC Generic FSM states.
Warning
Order of elements must not be altered otherwise state table also need modification
Generated for CCGx Firmware Stack by Doxygen
6.23 pd_common/pd_policy_engine.h File Reference
6.22.5
Function Documentation
6.22.5.1
const pd_config_t∗ get_pd_config ( void )
This function gets the config table data. Port index.
Returns
Returns a pointer to the config table info structure.
Warning
The information provided by this API must not be altered by the application.
6.22.5.2
const pd_port_config_t∗ get_pd_port_config ( uint8_t port )
This function gets the config info for the specified port. Port index.
Returns
Returns a pointer to the config table port info structure.
Warning
The information provided by this API must not be altered by the application.
6.23
pd_common/pd_policy_engine.h File Reference
#include <stdint.h>
#include <stdbool.h>
Functions
•
•
•
•
•
void pe_init (uint8_t port)
void pe_fsm (uint8_t port)
void pe_start (uint8_t port)
void pe_stop (uint8_t port)
bool pe_is_busy (uint8_t port)
6.23.1
Detailed Description
USB-PD policy engine header file.
6.23.2
Function Documentation
6.23.2.1
void pe_fsm ( uint8_t port )
This function runs pe state machine.
Generated for CCGx Firmware Stack by Doxygen
133
134
File Documentation
Parameters
port
port index
6.23.2.2
void pe_init ( uint8_t port )
This function initializes the policy engine. This function also initializes the pd protocol module.
Parameters
port
port index
6.23.2.3
bool pe_is_busy ( uint8_t port )
Checks if policy engine is busy in some task.
Parameters
port
port index
Returns
Returns true if busy else return false
6.23.2.4
void pe_start ( uint8_t port )
This function initialize the internal variables of policy engine to known state and start the pd phy.
Parameters
port
6.23.2.5
port index
void pe_stop ( uint8_t port )
Completely stops the policy engine. This will stop pd phy as well.
Parameters
port
6.24
port index
pd_common/pd_protocol.h File Reference
#include <pd.h>
Generated for CCGx Firmware Stack by Doxygen
6.24 pd_common/pd_protocol.h File Reference
135
Functions
•
•
•
•
•
•
•
•
•
•
•
uint8_t pd_prot_init (uint8_t port, pd_cbk_t cbk)
uint8_t pd_prot_start (uint8_t port)
uint8_t pd_prot_refresh_roles (uint8_t port)
uint8_t pd_prot_stop (uint8_t port)
uint8_t pd_prot_rx_en (uint8_t port)
uint8_t pd_prot_rx_dis (uint8_t port, uint8_t hard_reset_en)
uint8_t pd_prot_is_busy (uint8_t port)
uint8_t pd_prot_reset_all (uint8_t port)
uint8_t pd_prot_reset (uint8_t port, sop_t sop)
uint8_t pd_prot_send_ctrl_msg (uint8_t port, sop_t sop, ctrl_msg_t msg_type)
uint8_t pd_prot_send_data_msg (uint8_t port, sop_t sop, data_msg_t msg_type, uint8_t count, pd_do_←t ∗dobj)
uint8_t pd_prot_send_hard_reset (uint8_t port)
uint8_t pd_prot_send_cable_reset (uint8_t port)
uint8_t pd_prot_en_bist_cm2 (uint8_t port)
uint8_t pd_prot_dis_bist_cm2 (uint8_t port)
uint8_t pd_prot_en_bist_test_data (uint8_t port)
uint8_t pd_prot_dis_bist_test_data (uint8_t port)
uint8_t pd_prot_set_avoid_retry (uint8_t port)
pd_packet_t ∗ pd_prot_get_rx_packet (uint8_t port)
•
•
•
•
•
•
•
•
6.24.1
Detailed Description
USB-PD protocol layer header file.
6.24.2
Function Documentation
6.24.2.1
uint8_t pd_prot_dis_bist_cm2 ( uint8_t port )
This function disable sending bist carrier mode 2. There is no call back for this function This function returns after
registering the request.
Parameters
port
port index
Returns
Returns 1 when request is registered else return 0.
6.24.2.2
uint8_t pd_prot_dis_bist_test_data ( uint8_t port )
This function disables the bist test data mode.
Parameters
port
port index
Generated for CCGx Firmware Stack by Doxygen
136
File Documentation
Returns
Returns 1 if params are ok else return 0
6.24.2.3
uint8_t pd_prot_en_bist_cm2 ( uint8_t port )
This function enables sending bist carrier mode 2. There is no call back for this function This function returns after
registering the request.
Parameters
port
port index
Returns
Returns 1 when request is registered else return 0.
6.24.2.4
uint8_t pd_prot_en_bist_test_data ( uint8_t port )
This function puts the receiver in bist test data mode.
Parameters
port
port index
Returns
Returns 1 if params are ok else return 0
6.24.2.5 pd_packet_t∗ pd_prot_get_rx_packet ( uint8_t port )
This function returns pointer to received pd packet.
Parameters
port
port index
Returns
Returns pointer to received data if port param is not correct return null
6.24.2.6
uint8_t pd_prot_init ( uint8_t port, pd_cbk_t cbk )
This function sets the clock and necessary registers for PD hw ip to function and initializes the PD protocol layer.
Parameters
port
port index
cbk
pd event handler callback
Generated for CCGx Firmware Stack by Doxygen
6.24 pd_common/pd_protocol.h File Reference
137
Returns
Returns 1 if params are ok else return 0
6.24.2.7
uint8_t pd_prot_is_busy ( uint8_t port )
This function checks if protocol layer is busy.
Parameters
port
port index
Returns
Return 1 when busy else return 0
6.24.2.8
uint8_t pd_prot_refresh_roles ( uint8_t port )
This function configures pd phy as per current port role /data role/contract status of port. This API does not enable
the receiver.
Parameters
port
port index
Returns
Returns 1 if params are ok else return 0
6.24.2.9
uint8_t pd_prot_reset ( uint8_t port, sop_t sop )
This function resets protocol layer counter for a specific sop type.
Parameters
port
port index
sop
sop type
Returns
Returns 1 if params are ok else return 0
6.24.2.10
uint8_t pd_prot_reset_all ( uint8_t port )
This function resets the protocol layer counters for each sop type.
Parameters
port
port index
Generated for CCGx Firmware Stack by Doxygen
138
File Documentation
Returns
Returns 1 if params are ok else return 0
6.24.2.11
uint8_t pd_prot_rx_dis ( uint8_t port, uint8_t hard_reset_en )
This function disables the bmc receiver.
Parameters
port
port index
hard_reset_en
When 0 means rx is completely disabled, When 1 means only hard reset can be received.
Returns
Returns 1 if params are ok else return 0
6.24.2.12
uint8_t pd_prot_rx_en ( uint8_t port )
This function enables the bmc receiver.
Parameters
port
port index
Returns
Returns 1 if params are ok else return 0
6.24.2.13
uint8_t pd_prot_send_cable_reset ( uint8_t port )
This function sends a cable reset. Results will be known to caller via callback function registered in pd_phy_init().
This function returns after registering the request.
Parameters
port
port index
Returns
Returns 1 when request is registered else return 0.
6.24.2.14
uint8_t pd_prot_send_ctrl_msg ( uint8_t port, sop_t sop, ctrl_msg_t msg_type )
This function sends a control message. Results will be known to caller via callback function registered in pd_prot←_int(). This function returns after registering the request.
Parameters
port
port index
sop
sop type
msg_type
control message type.
Generated for CCGx Firmware Stack by Doxygen
6.24 pd_common/pd_protocol.h File Reference
139
Returns
Returns 1 when request is registered else return 0.
6.24.2.15
uint8_t pd_prot_send_data_msg ( uint8_t port, sop_t sop, data_msg_t msg_type, uint8_t count, pd_do_t ∗
dobj )
This function sends a data message. Results will be known to caller via callback function registered in pd_phy_init().
This function returns after registering the request.
Parameters
port
port index
sop
sop type
msg_type
data message type
count
data objects count
dobj
pointer to data objects
Returns
Returns 1 when request is registered else return 0.
6.24.2.16
uint8_t pd_prot_send_hard_reset ( uint8_t port )
This function sends a hard reset. Results will be known to caller via callback function registered in pd_phy_init().
This function returns after registering the request.
Parameters
port
port index
Returns
Returns 1 when request is registered else return 0.
6.24.2.17
uint8_t pd_prot_set_avoid_retry ( uint8_t port )
This function can be used by higher layers to avoid retry on CRC expire for a particular message. When this flag is
set before calling pd_prot_send_data_msg() or pd_send_crtl_msg() APIs, retry is avoided on CRC failure. This is
one time only. Flag is automatically cleared after transmission(success or fail).
Parameters
port
port index
Returns
Returns 1 if params are ok else return 0
Generated for CCGx Firmware Stack by Doxygen
140
File Documentation
6.24.2.18
uint8_t pd_prot_start ( uint8_t port )
This function starts the protocol layer and configures pd phy as per current port role /data role/contract status of
port. This API does not enable the receiver.
Parameters
port
port index
Returns
Returns 1 if params are ok else return 0
6.24.2.19
uint8_t pd_prot_stop ( uint8_t port )
This function completely stops the pd hw and put it in lowest power state.
Parameters
port
port index
Returns
Returns 1 if params are ok else return 0
6.25
pd_common/pdss_hal.h File Reference
#include <ccgx_regs.h>
#include <pd.h>
Macros
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
#define SILICON_TRIM6_V1P575_TRIM_VALUE (3u)
#define SILICON_TRIM3_V0P55_TRIM_VALUE (2u)
#define TRIM0_TX_TRIM_VALUE_3A (2u)
#define TRIM0_TX_TRIM_VALUE_900MA (0u)
#define AUTO_CTRL_MESSAGE_GOODCRC_MASK_CFG (0xFFFFFFFDu)
#define AUTO_DATA_MESSAGE_GOODCRC_MASK_CFG (0xFFFFFFFFu)
#define EXPECTED_GOOD_CRC_HDR_MASK (0x7E0Fu)
#define EXPECTED_GOOD_CRC_CLEAR_MASK (0xF1FFu)
#define RX_CNT_MAX_VAL (0xFu)
#define RX_UI_BOUNDARY_DELTA_VAL (0x2u)
#define RX_CNT_MAX_CFG (RX_CNT_MAX_VAL << PDSS_RX_CC_RX_CNT_MAX_POS)
#define RX_UI_BOUNDARY_DELTA_CFG (RX_UI_BOUNDARY_DELTA_VAL << PDSS_RX_CC_RX_←UI_BOUNDARY_DELTA_POS)
#define RX_CC_CFG
#define RX_SOP_GOOD_CRC_EN_CTRL_CFG
#define RX_ORDER_SET_CTRL_CFG
#define CRC_COUNTER_CFG (300u)
#define BUS_IDLE_CNT_VAL (10u)
Generated for CCGx Firmware Stack by Doxygen
6.25 pd_common/pdss_hal.h File Reference
141
• #define IDLE_COUNTER_VAL (40u)
• #define IFG_COUNTER_VAL (10u)
• #define BUS_IDLE_CNT_CFG (BUS_IDLE_CNT_VAL << PDSS_INTER_PACKET_COUNTER_BUS_I←DLE_CNT_POS)
• #define IDLE_COUNTER_CFG (IDLE_COUNTER_VAL << PDSS_INTER_PACKET_COUNTER_IDLE_←COUNTER_POS)
• #define IFG_COUNTER_CFG (IFG_COUNTER_VAL << PDSS_INTER_PACKET_COUNTER_IFG_CO←UNTER_POS)
• #define INTER_PACKET_COUNTER_CFG (BUS_IDLE_CNT_CFG | IDLE_COUNTER_CFG | IFG_COU←NTER_CFG)
• #define PD_INTR_MASK (0x3FF7FBFFu)
• #define RX_INTERRUPTS
• #define RCV_INTR_MASK
• #define TX_INTERRUPTS
• #define RST_TX_INTERRUPTS
• #define EN_DEFAULT_SOP_DET_VAL (1u << PDSS_RX_ORDER_SET_CTRL_SOP_RST_EN_POS)
• #define EN_PRIME_SOP_DET_VAL (2u << PDSS_RX_ORDER_SET_CTRL_SOP_RST_EN_POS)
• #define EN_DBL_SOP_DET_VAL (4u << PDSS_RX_ORDER_SET_CTRL_SOP_RST_EN_POS)
• #define EN_DEBUG_PRIME_DET_VAL (8u << PDSS_RX_ORDER_SET_CTRL_SOP_RST_EN_POS)
• #define EN_DEBUG_DBL_DET_VAL (16u << PDSS_RX_ORDER_SET_CTRL_SOP_RST_EN_POS)
• #define EN_RX_CABLE_RESET_DET_VAL (32u << PDSS_RX_ORDER_SET_CTRL_SOP_RST_EN_←POS)
• #define EN_RX_HARD_RESET_DET_VAL (64u << PDSS_RX_ORDER_SET_CTRL_SOP_RST_EN_P←OS)
• #define PDSS_CC_CTRL_0_CMP_LA_VSEL_CFG (7u)
• #define PD_CMP_VSEL_0_2_V (0u)
• #define PD_CMP_VSEL_0_4_V (1u)
• #define PD_CMP_VSEL_1_43_V (2u)
• #define PD_CMP_VSEL_0_655_V (3u)
• #define PD_CMP_VSEL_0_8_V (4u)
• #define PD_CMP_VSEL_1_235_V (5u)
• #define PD_CMP_VSEL_1_77_V (6u)
• #define PD_CMP_VSEL_2_6_V (7u)
• #define DN_COMP_IDX (0u)
• #define UP_COMP_IDX (1u)
• #define LOWER_LIMIT_IDX (0u)
• #define HIGHER_LIMIT_IDX (1u)
• #define RD_ROW_NO (3u)
• #define RD_COL_WIDTH (4u)
• #define RP_COL_WIDTH (2u)
• #define PD_ADC_DEFAULT_VDDD_VOLT_MV (5000u)
• #define PD_ADC_MAX_VALUE (0xFFu)
• #define PD_ADC_NUM_LEVELS (PD_ADC_MAX_VALUE + 1u)
• #define PD_ADC_BAND_GAP_VOLT_MV (1200u)
• #define PD_ADC_LEVEL_MIN_THRESHOLD (4u)
• #define PD_ADC_LEVEL_MAX_THRESHOLD (254u)
• #define PD_ADC_TIMEOUT_COUNT (200u)
Typedefs
• typedef void(∗ PD_ADC_CB_T) (uint8_t port, bool comp_out)
• typedef void(∗ pd_phy_cbk_t) (uint8_t port, pd_phy_evt_t event)
Generated for CCGx Firmware Stack by Doxygen
142
File Documentation
Enumerations
• enum PD_ADC_ID_T { PD_ADC_ID_0, PD_ADC_ID_1, PD_ADC_NUM_ADC }
• enum PD_ADC_INPUT_T {
PD_ADC_INPUT_AMUX_A, PD_ADC_INPUT_AMUX_B, PD_ADC_INPUT_BANDGAP, PD_ADC_INPUT←_BJT,
PD_ADC_NUM_INPUT }
• enum PD_ADC_INT_T { PD_ADC_INT_DISABLED, PD_ADC_INT_FALLING, PD_ADC_INT_RISING, PD←_ADC_INT_BOTH }
• enum pd_phy_evt_t {
PD_PHY_EVT_TX_MSG_COLLISION, PD_PHY_EVT_TX_MSG_PHY_IDLE, PD_PHY_EVT_TX_MSG_←FAILED, PD_PHY_EVT_TX_MSG_SUCCESS,
PD_PHY_EVT_TX_RST_COLLISION, PD_PHY_EVT_TX_RST_SUCCESS, PD_PHY_EVT_RX_MSG, P←D_PHY_EVT_RX_MSG_CMPLT,
PD_PHY_EVT_RX_MSG_CMPLT_COL2, PD_PHY_EVT_RX_RST }
Functions
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
uint8_t pd_hal_init (uint8_t port)
uint8_t pd_phy_deepsleep (uint8_t port)
uint8_t pd_phy_wakeup (void)
uint8_t pd_phy_init (uint8_t port, pd_phy_cbk_t cbk)
uint8_t pd_phy_refresh_roles (uint8_t port)
uint8_t pd_phy_load_msg (uint8_t port, sop_t sop, uint8_t retries, uint32_t ∗buf)
uint8_t pd_phy_send_msg (uint8_t port)
uint8_t pd_phy_send_bist_cm2 (uint8_t port)
uint8_t pd_phy_abort_bist_cm2 (uint8_t port)
uint8_t pd_phy_abort_tx_msg (uint8_t port)
uint8_t pd_phy_send_reset (uint8_t port, sop_t sop)
pd_packet_t ∗ pd_phy_get_rx_packet (uint8_t port)
uint8_t pd_phy_is_busy (uint8_t port)
uint8_t pd_typec_init (uint8_t port)
uint8_t pd_typec_start (uint8_t port)
uint8_t pd_typec_stop (uint8_t port)
uint8_t pd_typec_en_rp (uint8_t port, uint8_t channel, rp_term_t rp_val)
uint8_t pd_typec_dis_rp (uint8_t port, uint8_t channel)
uint8_t pd_typec_en_dpslp_rp (uint8_t port)
uint8_t pd_typec_dis_dpslp_rp (uint8_t port)
uint8_t pd_typec_en_rd (uint8_t port, uint8_t channel)
uint8_t pd_typec_dis_rd (uint8_t port, uint8_t channel)
uint8_t pd_typec_snk_update_trim (uint8_t port)
cc_state_t pd_typec_get_cc_status (uint8_t port)
uint8_t pd_typec_set_polarity (uint8_t port, bool polarity)
uint8_t pd_vconn_enable (uint8_t port, uint8_t channel)
uint8_t pd_vconn_disable (uint8_t port, uint8_t channel)
bool pd_is_vconn_present (uint8_t port, uint8_t channel)
uint8_t pd_adc_volt_to_level (uint8_t port, PD_ADC_ID_T adc_id, uint16_t volt)
uint16_t pd_adc_level_to_volt (uint8_t port, PD_ADC_ID_T adc_id, uint8_t level)
uint8_t pd_adc_comparator_ctrl (uint8_t port, PD_ADC_ID_T adc_id, PD_ADC_INPUT_T input, uint8_t level,
PD_ADC_INT_T int_cfg, PD_ADC_CB_T cb)
bool pd_adc_comparator_sample (uint8_t port, PD_ADC_ID_T adc_id, PD_ADC_INPUT_T input, uint8_←t level)
bool pd_adc_get_comparator_status (uint8_t port, PD_ADC_ID_T adc_id)
uint8_t pd_adc_sample (uint8_t port, PD_ADC_ID_T adc_id, PD_ADC_INPUT_T input)
uint8_t pd_adc_calibrate (uint8_t port, PD_ADC_ID_T adc_id)
Generated for CCGx Firmware Stack by Doxygen
6.25 pd_common/pdss_hal.h File Reference
•
•
•
•
•
143
uint8_t pd_adc_init (uint8_t port, PD_ADC_ID_T adc_id)
uint8_t pd_get_vbus_adc_level (uint8_t port, PD_ADC_ID_T adc_id, uint16_t volt, int8_t per)
void pd_hal_set_vbus_detach_params (PD_ADC_ID_T adc_id, PD_ADC_INPUT_T adc_inp)
void pd_hal_set_vbus_mon_divider (uint8_t divider)
void pd_hal_set_vbus_off_margin (int8_t margin)
6.25.1
Detailed Description
CCG PD PHY driver module header file.
6.25.2
Macro Definition Documentation
6.25.2.1
#define AUTO_CTRL_MESSAGE_GOODCRC_MASK_CFG (0xFFFFFFFDu)
Auto GoodCRC message mask configuration must be enabled for all messages except goodcrc itself as per Rev2
spec. If Rev3 spec, then all 32 bits needs to be configured.
6.25.2.2
#define BUS_IDLE_CNT_VAL (10u)
INTER_PACKET_COUNTER register configuration.
6.25.2.3
#define CRC_COUNTER_CFG (300u)
CRC_COUNTER register configuration, 1ms.
6.25.2.4
#define EXPECTED_GOOD_CRC_CLEAR_MASK (0xF1FFu)
Mask to clear expected GoodCRC header field.
6.25.2.5
#define EXPECTED_GOOD_CRC_HDR_MASK (0x7E0Fu)
Mask representing header bits that should be matched for expected GoodCRC detection.
6.25.2.6
#define LOWER_LIMIT_IDX (0u)
Rp threshold index limits in the thresholds LUT.
6.25.2.7
#define PD_ADC_BAND_GAP_VOLT_MV (1200u)
Bandgap voltage in millivolt.
6.25.2.8
#define PD_ADC_DEFAULT_VDDD_VOLT_MV (5000u)
VDDD voltage level in millivolt.
6.25.2.9
#define PD_ADC_LEVEL_MIN_THRESHOLD (4u)
The minimum comparator output shall be limited to this value to guard against ground bounce and other ADC noise.
Generated for CCGx Firmware Stack by Doxygen
144
6.25.2.10
File Documentation
#define PD_ADC_MAX_VALUE (0xFFu)
Maximum ADC count.
6.25.2.11
#define PD_ADC_NUM_LEVELS (PD_ADC_MAX_VALUE + 1u)
Number of ADC levels.
6.25.2.12
#define PD_ADC_TIMEOUT_COUNT (200u)
Loop timeout count for ADC.
6.25.2.13
#define PD_CMP_VSEL_0_2_V (0u)
CC threshold definitions.
6.25.2.14
#define PD_INTR_MASK (0x3FF7FBFFu)
PD block interrupt vector numbers.
6.25.2.15
#define RCV_INTR_MASK
Value:
(PDSS_INTR0_RX_STATE_IDLE
6.25.2.16
|\
PDSS_INTR0_EOP_ERROR
PDSS_INTR0_RCV_GOOD_PACKET_COMPLETE
PDSS_INTR0_RCV_BAD_PACKET_COMPLETE
PDSS_INTR0_RCV_GOODCRC_MSG_COMPLETE
PDSS_INTR0_RCV_EXPT_GOODCRC_MSG_COMPLETE
PDSS_INTR0_RX_SOP
PDSS_INTR0_RX_OVER_RUN)
|\
|\
|\
|\
|\
|\
#define RD_ROW_NO (3u)
No of Rd rows and entries per row, in the thresholds LUT.
6.25.2.17
#define RP_COL_WIDTH (2u)
No of entries per Rp row in the thresholds LUT.
6.25.2.18
#define RST_TX_INTERRUPTS
Value:
(PDSS_INTR0_TX_HARD_RST_DONE
|
\
PDSS_INTR0_COLLISION_TYPE4)
Reception detected at reset transmit.
Generated for CCGx Firmware Stack by Doxygen
6.25 pd_common/pdss_hal.h File Reference
6.25.2.19
145
#define RX_CC_CFG
Value:
(RX_CNT_MAX_CFG
| \
RX_UI_BOUNDARY_DELTA_CFG
PDSS_RX_CC_DELAY_AUTO)
6.25.2.20
| \
#define RX_CNT_MAX_VAL (0xFu)
RX CC register config for 12Mhz Rx clock.
6.25.2.21
#define RX_INTERRUPTS
Value:
(PDSS_INTR0_TX_GOODCRC_MSG_DONE |
\
PDSS_INTR0_RX_STATE_IDLE
PDSS_INTR0_RCV_RST
\
PDSS_INTR0_COLLISION_TYPE3)
\
|
|
Reception detected at GoodCRC transmit.
6.25.2.22
#define RX_ORDER_SET_CTRL_CFG
Value:
(PDSS_RX_ORDER_SET_CTRL_SOP_CMP_OPT | \
PDSS_RX_ORDER_SET_CTRL_RST_CMP_OPT)
RX_ORDER_SET_CTRL register configuration.
6.25.2.23
#define RX_SOP_GOOD_CRC_EN_CTRL_CFG
Value:
(PDSS_RX_SOP_GOOD_CRC_EN_CTRL_TX_SEND_DEFAULT_SOP_GOOD_CRC_EN
| \
PDSS_RX_SOP_GOOD_CRC_EN_CTRL_TX_SEND_PRIME_SOP_GOOD_CRC_EN
| \
PDSS_RX_SOP_GOOD_CRC_EN_CTRL_TX_SEND_DBL_PRIME_SOP_GOOD_CRC_EN)
6.25.2.24
#define TX_INTERRUPTS
Value:
(PDSS_INTR0_RCV_GOODCRC_MSG_COMPLETE |
\
PDSS_INTR0_CRC_RX_TIMER_EXP
PDSS_INTR0_COLLISION_TYPE1
PDSS_INTR0_TX_PACKET_DONE
\
PDSS_INTR0_COLLISION_TYPE2)
Reception detected at message retransmit.
Generated for CCGx Firmware Stack by Doxygen
|
|
|
\
\
146
File Documentation
6.25.3
Typedef Documentation
6.25.3.1
typedef void(∗ PD_ADC_CB_T) (uint8_t port, bool comp_out)
PD ADC comparator interrupt callback type
Available events,
• true : Input voltage is higher than the reference.
• false : Input voltage is lower than the reference.
6.25.4
Enumeration Type Documentation
6.25.4.1
enum PD_ADC_ID_T
HPD Port and pin macros.
PD PD_ADC_ID enumeration.
6.25.4.2
enum PD_ADC_INPUT_T
PD ADC input source enumeration.
Enumerator
PD_ADC_INPUT_AMUX_A AMUX_A bus
PD_ADC_INPUT_AMUX_B AMUX_B bus
PD_ADC_INPUT_BANDGAP BANDGAP
PD_ADC_INPUT_BJT BJT
PD_ADC_NUM_INPUT Total number of ADC input sources.
6.25.4.3
enum PD_ADC_INT_T
PD comparator interrupt configuration enumeration. These are the settings for INTR_1_CFG ADC output, not A←DC_SAR_CTRL.
Enumerator
PD_ADC_INT_DISABLED Comparator interrupt disabled.
PD_ADC_INT_FALLING Comparator interrupt on falling edge.
PD_ADC_INT_RISING Comparator interrrupt on rising edge.
PD_ADC_INT_BOTH Comparator interrupt on both edges.
6.25.4.4
enum pd_phy_evt_t
PD phy state enumeration.
Enumerator
PD_PHY_EVT_TX_MSG_COLLISION Bus busy at message transmission.
PD_PHY_EVT_TX_MSG_PHY_IDLE Bus idle, ready for message transmission.
PD_PHY_EVT_TX_MSG_FAILED Message transmission was not successful.
PD_PHY_EVT_TX_MSG_SUCCESS Message transmission was successful.
Generated for CCGx Firmware Stack by Doxygen
6.25 pd_common/pdss_hal.h File Reference
147
PD_PHY_EVT_TX_RST_COLLISION Bus busy just before reset transmission.
PD_PHY_EVT_TX_RST_SUCCESS Reset transmission was successful. Message received.
PD_PHY_EVT_RX_MSG_CMPLT Message received and GoodCRC sent aka collision type 3.
PD_PHY_EVT_RX_MSG_CMPLT_COL2 Message received and collision type 2, special case when Good←CRC was dropped due to internal silicon defect noted in CDT 229976.
PD_PHY_EVT_RX_RST Reset was received.
6.25.5
Function Documentation
6.25.5.1
uint8_t pd_adc_calibrate ( uint8_t port, PD_ADC_ID_T adc_id )
This function calibrates the specified ADC for operation.
This function calibrates the specified ADC by identifying the VDDD voltage for reference. It should be noted that by
calling the function, the previously calculated threshold levels may have to be changed based on the VDDD reading.
The VDDD level is calculated based on the bandgap voltage which is expected to be constant.
Parameters
port
Port index.
adc←_id
ADC ID.
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.2
uint8_t pd_adc_comparator_ctrl ( uint8_t port, PD_ADC_ID_T adc_id, PD_ADC_INPUT_T input, uint8_t level,
PD_ADC_INT_T int_cfg, PD_ADC_CB_T cb )
This function configures the ADC for comparator functionality with the requested threshold.
This function configures the ADC block as a comparator. The function takes the input to be configured and the
ADC comparator threshold. It also takes a callback. If the callback is not NULL, then the threshold is configured
and interrupts are enabled. If the callback is NULL, then the ADC / comparator is set to the low power state and
interrupts are disabled.
Parameters
port
Port index.
adc←_id
ADC ID.
input
ADC input source.
level
Comparator level.
int_cfg
Interrupt configuration.
cb
Callback on interrupt.
Returns
Returns 1 if successful, 0 otherwise.
Generated for CCGx Firmware Stack by Doxygen
148
File Documentation
6.25.5.3
bool pd_adc_comparator_sample ( uint8_t port, PD_ADC_ID_T adc_id, PD_ADC_INPUT_T input, uint8_t level )
This function temporarily configures the comparator as requested and takes a sample.
This function restores the state of the comparator after operation. This is useful when the comparator is already
configured to function with a certain input and level with interrupt and another reading needs to be done without
having to re-configure the block after the sampling.
Parameters
port
Port index.
adc←_id
ADC ID.
input
ADC input source.
Returns
Returns true if voltage > level, false otherwise.
6.25.5.4
bool pd_adc_get_comparator_status ( uint8_t port, PD_ADC_ID_T adc_id )
This function gets the current comparator status.
This function does not configure the ADC / comparator. It just returns the current state of the comparator. If true
is returned, then the input voltage is greater than the reference and if false, the input voltage is lower than the
reference.
Parameters
port
Port index.
adc←_id
ADC ID.
Returns
Returns the comparator output.
6.25.5.5
uint8_t pd_adc_init ( uint8_t port, PD_ADC_ID_T adc_id )
This function initializes the PD ADC block.
This function enables the PD block and the registers required for ADC operation. It then calibrates the ADC to
identify the VDDD voltage. This function does not start any ADC operations.
Parameters
port
Port index.
adc←_id
ADC ID.
Returns
Returns 1 if successful, 0 otherwise.
Generated for CCGx Firmware Stack by Doxygen
6.25 pd_common/pdss_hal.h File Reference
6.25.5.6
149
uint16_t pd_adc_level_to_volt ( uint8_t port, PD_ADC_ID_T adc_id, uint8_t level )
This function converts the ADC units to voltage in millivolts.
It takes an 8-bit ADC reading and returns the corresponding 16-bit voltage value in millivolts. This function does not
perform any ADC operations.
Parameters
port
Port index.
adc←_id
ADC ID.
level
The 8-bit ADC reading.
Returns
Returns voltage in mV.
6.25.5.7
uint8_t pd_adc_sample ( uint8_t port, PD_ADC_ID_T adc_id, PD_ADC_INPUT_T input )
This function samples the ADC.
This function enables the ADC block to function as an ADC and returns the sample value in ADC units. This
function disables any previously configured comparator interrupts / settings before sampling and restores them after
the sampling is done. If any interrupt scenario happens across the sampling, the information is lost.
Parameters
port
Port index.
adc←_id
ADC ID.
input
ADC input source.
Returns
Returns the ADC sample.
6.25.5.8
uint8_t pd_adc_volt_to_level ( uint8_t port, PD_ADC_ID_T adc_id, uint16_t volt )
This function converts the voltage in millivolt to ADC units.
It takes a 16-bit voltage value in millivolts and returns the corresponding 8-bit ADC reading. This function does not
perform any ADC operations.
The minimum value is limited by the PD_ADC_LEVEL_MIN_THRESHOLD value.
Parameters
port
Port index.
adc←_id
ADC ID.
volt
Voltage in mV.
Generated for CCGx Firmware Stack by Doxygen
150
File Documentation
Returns
Returns the 8-bit ADC reading.
6.25.5.9
uint8_t pd_get_vbus_adc_level ( uint8_t port, PD_ADC_ID_T adc_id, uint16_t volt, int8_t per )
This function gets the ADC level that corresponds to the actual voltage on vbus. It also takes into account the VBus
monitor divider.
Parameters
port
Port index.
adc←_id
ADC ID.
volt
Voltage in 50mV units.
per
Percentage margin on the voltage.
Returns
Returns the ADC level.
6.25.5.10
uint8_t pd_hal_init ( uint8_t port )
This function initializes the PDSS IP with necessary clock and interrupt handlers.
Parameters
port
Port index.
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.11
void pd_hal_set_vbus_detach_params ( PD_ADC_ID_T adc_id, PD_ADC_INPUT_T adc_inp )
Select the comparator block and input setting used for VBus detach detection. CCG will use the selected settings
to detect Type-C disconnection based on removal of the VBus power.
Parameters
adc_id
Select the comparator (ADC) block to be used.
adc_inp
Select the comparator input to be used.
Returns
None
6.25.5.12
void pd_hal_set_vbus_mon_divider ( uint8_t divider )
Specify the voltage division ratio between the voltage applied on VBUS_MON and the actual VBus voltage. The
commonly used resistor divider ratio used is 1:10, giving a voltage division ratio of 1/11.
Generated for CCGx Firmware Stack by Doxygen
6.25 pd_common/pdss_hal.h File Reference
151
Parameters
divider
Ratio between VBUS_MON voltage and VBus voltage.
Returns
None
6.25.5.13
void pd_hal_set_vbus_off_margin ( int8_t margin )
Specify the VBus validity range (in percentage of expected voltage) that CCG4 should use for VBus removal detection.
Parameters
margin
VBus validity range in percentage of expected voltage.
Returns
None
6.25.5.14
bool pd_is_vconn_present ( uint8_t port, uint8_t channel )
This function gets Vconn status for the specified channel.
Parameters
port
Port index.
channel
Channel index, where CC1 = 0, CC2 = 1.
Returns
Returns true if Vconn is turned on, false otherwise.
6.25.5.15
uint8_t pd_phy_abort_bist_cm2 ( uint8_t port )
This function stops transmission of BIST Carrier Mode 2.
Parameters
port
Port index.
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.16
uint8_t pd_phy_abort_tx_msg ( uint8_t port )
This function stops transmission of a message.
Generated for CCGx Firmware Stack by Doxygen
152
File Documentation
Parameters
port
Port index.
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.17
uint8_t pd_phy_deepsleep ( uint8_t port )
This function configures the PD block for deepsleep entry.
Parameters
port
Port index.
Returns
Returns 1 if the port is not busy and has been configured to go to deepsleep, 0 otherwise. Also returns 1 if
the block was not enabled.
6.25.5.18 pd_packet_t∗ pd_phy_get_rx_packet ( uint8_t port )
This function returns the received packet.
Parameters
port
Port index.
Returns
Pointer to the received PD packet.
6.25.5.19
uint8_t pd_phy_init ( uint8_t port, pd_phy_cbk_t cbk )
This function initializes the PD phy registers.
Parameters
port
Port index.
cbk
The phy event handler callback.
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.20
uint8_t pd_phy_is_busy ( uint8_t port )
This function checks if the PD phy is busy for the specified port.
Generated for CCGx Firmware Stack by Doxygen
6.25 pd_common/pdss_hal.h File Reference
153
Parameters
port
Port index.
Returns
Returns 1 if the phy is busy, 0 otherwise.
6.25.5.21
uint8_t pd_phy_load_msg ( uint8_t port, sop_t sop, uint8_t retries, uint32_t ∗ buf )
This function loads the PD message in FIFO and configures the necessary registers.
Parameters
port
Port index.
sop
Sop type.
retries
buf
Number of retries.
Pointer to message. Message buffer is an array of uint32_t.
• buf[0] = Header with upper 16 bits 0.
• buf[1]..buf[6] = Data, if data message.
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.22
uint8_t pd_phy_refresh_roles ( uint8_t port )
This function configures the PD phy as per current port role / data role / contract status of the specified port. This
API does not enable the receiver.
Parameters
port
Port index.
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.23
uint8_t pd_phy_send_bist_cm2 ( uint8_t port )
This function starts transmission of BIST Carrier Mode 2.
Parameters
port
Port index.
Generated for CCGx Firmware Stack by Doxygen
154
File Documentation
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.24
uint8_t pd_phy_send_msg ( uint8_t port )
This function starts the transmission of a message already loaded in FIFO.
Parameters
port
Port index.
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.25
uint8_t pd_phy_send_reset ( uint8_t port, sop_t sop )
This function starts transmission of a cable reset or a hard reset as requested.
Parameters
port
Port index.
sop
Sop type = Cable Reset or Hard Reset.
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.26
uint8_t pd_phy_wakeup ( void )
This function configures the PD block on deepsleep exit.
Parameters
port
Port index.
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.27
uint8_t pd_typec_dis_dpslp_rp ( uint8_t port )
This function disables deepsleep Rp.
Parameters
port
Port index.
Generated for CCGx Firmware Stack by Doxygen
6.25 pd_common/pdss_hal.h File Reference
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.28
uint8_t pd_typec_dis_rd ( uint8_t port, uint8_t channel )
This function disables Rd.
Parameters
port
Port index.
channel
Channel index, where CC1 = 0, CC2 = 1.
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.29
uint8_t pd_typec_dis_rp ( uint8_t port, uint8_t channel )
This function disables Rp.
Parameters
port
Port index.
channel
Channel index, where CC1 = 0, CC2 = 1.
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.30
uint8_t pd_typec_en_dpslp_rp ( uint8_t port )
This function enables deepsleep Rp.
Parameters
port
Port index.
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.31
uint8_t pd_typec_en_rd ( uint8_t port, uint8_t channel )
This function enables Rd.
Parameters
port
Port index.
channel
Channel index, where CC1 = 0, CC2 = 1.
Generated for CCGx Firmware Stack by Doxygen
155
156
File Documentation
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.32
uint8_t pd_typec_en_rp ( uint8_t port, uint8_t channel, rp_term_t rp_val )
This function configures and enables Rp.
Parameters
port
Port index.
channel
Channel index, where CC1 = 0, CC2 = 1.
rp_val
Rp value.
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.33 cc_state_t pd_typec_get_cc_status ( uint8_t port )
This function returns current CC status.
Parameters
port
Port index.
Returns
CC status
6.25.5.34
uint8_t pd_typec_init ( uint8_t port )
This function initializes the Type C registers in the PD block.
Parameters
port
Port index.
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.35
uint8_t pd_typec_set_polarity ( uint8_t port, bool polarity )
This function sets the CC polarity for the receiver circuit.
Parameters
port
Port index.
Generated for CCGx Firmware Stack by Doxygen
6.25 pd_common/pdss_hal.h File Reference
157
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.36
uint8_t pd_typec_snk_update_trim ( uint8_t port )
This function updates the tx trim settings when in the sink role. It must be called when Rp is changed by the peer.
Parameters
port
Port index.
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.37
uint8_t pd_typec_start ( uint8_t port )
This function starts the Type C line comparators. pdss_typec_init() should have been called before calls to this
function.
Parameters
port
Port index.
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.38
uint8_t pd_typec_stop ( uint8_t port )
: This function stops the Type-C line comparators.
Parameters
port
Port index.
Returns
: Returns 1 if successful, 0 otherwise.
6.25.5.39
uint8_t pd_vconn_disable ( uint8_t port, uint8_t channel )
This function turns off Vconn for the specified channel.
Parameters
port
Port index.
channel
Channel index, where CC1 = 0, CC2 = 1.
Generated for CCGx Firmware Stack by Doxygen
158
File Documentation
Returns
Returns 1 if successful, 0 otherwise.
6.25.5.40
uint8_t pd_vconn_enable ( uint8_t port, uint8_t channel )
This function turns on Vconn for the specified channel.
Parameters
port
Port index.
channel
Channel index, where CC1 = 0, CC2 = 1.
Returns
Returns 1 if successful, 0 otherwise.
6.26
pd_common/typec_manager.h File Reference
#include <stdint.h>
#include <stdbool.h>
Functions
•
•
•
•
•
•
•
•
•
•
void typec_init (uint8_t port)
void typec_start (uint8_t port)
void typec_stop (uint8_t port)
bool typec_is_busy (uint8_t port)
void typec_sync_toggle (void)
void typec_deepsleep (uint8_t port)
void typec_wakeup (void)
void typec_fsm (uint8_t port)
void typec_assert_rp (uint8_t port, uint8_t channel)
void typec_assert_rd (uint8_t port, uint8_t channel)
6.26.1
Detailed Description
Type-C manager header file.
6.26.2
Function Documentation
6.26.2.1
void typec_assert_rd ( uint8_t port, uint8_t channel )
This function asserts Rd and deasserts Rp for the specified CC line.
Parameters
port
Port index.
channel
CC line.
Generated for CCGx Firmware Stack by Doxygen
6.26 pd_common/typec_manager.h File Reference
6.26.2.2
void typec_assert_rp ( uint8_t port, uint8_t channel )
This function asserts Rp and deasserts Rd for the specified CC line.
Parameters
port
Port index.
channel
CC line.
6.26.2.3
void typec_deepsleep ( uint8_t port )
This function configures Type C functionality in the PD block when entering deepsleep.
Parameters
port
Port index.
6.26.2.4
void typec_fsm ( uint8_t port )
This function implements the Type C state machine.
Parameters
port
Port index.
6.26.2.5
void typec_init ( uint8_t port )
This function initializes the Type C manager. This function must be called once during system init.
Parameters
port
Port index.
6.26.2.6
bool typec_is_busy ( uint8_t port )
This function checks if the Type C FSM is busy.
Parameters
port
Port index.
Returns
Returns true if busy, false otherwise.
6.26.2.7
void typec_start ( uint8_t port )
This function starts the Type C functionality in the PD hardware block.
Generated for CCGx Firmware Stack by Doxygen
159
160
File Documentation
Parameters
port
6.26.2.8
Port index.
void typec_stop ( uint8_t port )
This function completely disables the Type C FSM and the Type C functionality in the PD hardware block.
Parameters
port
6.26.2.9
Port index.
void typec_wakeup ( void )
This function configures Type C functionality in the PD block when coming out of deepsleep.
Parameters
port
6.27
Port index.
scb/i2c.h File Reference
#include <config.h>
#include <stdbool.h>
Data Structures
• struct i2c_scb_config_t
Macros
• #define I2C_BLOCK_COUNT (4)
• #define I2C_CLEAR_INTR_MASK (0x00000000)
• #define I2C_CLEAR_INTR_REQUEST_REG (0xFFFFFFFFu)
• #define I2C_SCB_FIFO_SIZE (8u)
• #define I2C_SCB_RX_FIFO_SIZE (I2C_SCB_FIFO_SIZE)
• #define I2C_SCB_TX_FIFO_SIZE (I2C_SCB_FIFO_SIZE)
• #define I2C_SLAVE_ADDR_MASK_DEFAULT (0xFE)
• #define I2C_SLAVE_TIMER_BASE (0xD0)
• #define I2C_SLAVE_TIMER_PERIOD (500)
Typedefs
• typedef bool(∗ i2c_cb_fun_t) (i2c_cb_cmd_t cmd, i2c_scb_state_t i2c_state, uint16_t count)
Generated for CCGx Firmware Stack by Doxygen
6.27 scb/i2c.h File Reference
161
Enumerations
• enum i2c_scb_state_t {
I2C_SCB_STATE_DISABLED = 0, I2C_SCB_STATE_INIT, I2C_SCB_STATE_IDLE, I2C_SCB_STATE_←PREAMBLE,
I2C_SCB_STATE_READ, I2C_SCB_STATE_WRITE, I2C_SCB_STATE_CLK_STRETCH, I2C_SCB_ST←ATE_ERROR,
I2C_SCB_NUM_STATES }
• enum i2c_scb_mode_t { I2C_SCB_MODE_MASTER = 0, I2C_SCB_MODE_HPI, I2C_SCB_MODE_ALP_←RIDGE }
• enum i2c_scb_clock_freq_t { I2C_SCB_CLOCK_FREQ_100_KHZ = 0, I2C_SCB_CLOCK_FREQ_400_KHZ,
I2C_SCB_CLOCK_FREQ_1_MHZ }
• enum i2c_cb_cmd_t { I2C_CB_CMD_READ = 0, I2C_CB_CMD_WRITE, I2C_CB_CMD_XFER_END, I2C←_CB_CMD_TIMEOUT }
Functions
• void i2c_scb_init (uint8_t scb_index, i2c_scb_mode_t mode, i2c_scb_clock_freq_t clock_freq, uint8_t slave←_addr, uint8_t slave_mask, i2c_cb_fun_t cb_fun_ptr, uint8_t ∗scratch_buffer, uint16_t scratch_buffer_size)
• void i2c_scb_write (uint8_t scb_index, uint8_t ∗source_ptr, uint8_t size, uint8_t ∗count)
• void i2c_reset (uint8_t scb_index)
• void i2c_slave_ack_ctrl (uint8_t scb_index, bool enable)
• bool i2c_scb_is_idle (uint8_t scb_index)
• void i2c_scb_enable_wakeup (uint8_t scb_index)
6.27.1
Detailed Description
I2C slave driver header file.
6.27.2
Macro Definition Documentation
6.27.2.1
#define I2C_BLOCK_COUNT (4)
Number of I2C blocks supported by the device.
The CCG3 and CCG4 device families support 4 SCB blocks which can be used for I2C functionality. If the target
device using this stack supports a different number of SCBs, this macro value will need to be updated.
6.27.3
Enumeration Type Documentation
6.27.3.1
enum i2c_cb_cmd_t
Type of I2C operation being notified through a callback function.
Enumerator
I2C_CB_CMD_READ Read command from master.
I2C_CB_CMD_WRITE Write command from master.
I2C_CB_CMD_XFER_END End of read transfer: STOP condition signalled by master.
I2C_CB_CMD_TIMEOUT Timeout on I2C operation.
Generated for CCGx Firmware Stack by Doxygen
162
File Documentation
6.27.3.2
enum i2c_scb_clock_freq_t
List of possible I2C bus bit rates.
Enumerator
I2C_SCB_CLOCK_FREQ_100_KHZ 100 KHz operation.
I2C_SCB_CLOCK_FREQ_400_KHZ 400 KHz operation.
I2C_SCB_CLOCK_FREQ_1_MHZ 1 MHz operation.
6.27.3.3
enum i2c_scb_mode_t
List of possible I2C block operating modes.
This type lists the possible I2C block operating modes. Multiple slave modes are defined in case there is any mode
specific handling required for any of them.
Note: Master mode is currently not supported by the driver. Note: The HPI and ALP_RIDGE mode handling is
equivalent.
Enumerator
I2C_SCB_MODE_MASTER Master mode: Can be used for mux control. Not supported as of now.
I2C_SCB_MODE_HPI Slave mode: Used for HPI interface.
I2C_SCB_MODE_ALP_RIDGE Slave mode: Used for Alpine Ridge interface.
6.27.3.4
enum i2c_scb_state_t
List of possible I2C block states.
The I2C driver implements a state machine which ensures that read/write transfers are responded to correctly
without any corruption. This data type lists the possible states in this slave mode state machine.
Enumerator
I2C_SCB_STATE_DISABLED I2C interface is disabled.
I2C_SCB_STATE_INIT Interface initialized and waiting to be enabled.
I2C_SCB_STATE_IDLE Interface ready and waiting for preamble from the master.
I2C_SCB_STATE_PREAMBLE Preamble phase is in progress.
I2C_SCB_STATE_READ I2C read operation is in progress.
I2C_SCB_STATE_WRITE I2C write operation is in progress.
I2C_SCB_STATE_CLK_STRETCH Drive is stretching I2C clock to delay operation.
I2C_SCB_STATE_ERROR Error state: transaction error detected.
I2C_SCB_NUM_STATES Last state ID: not used.
6.27.4
Function Documentation
6.27.4.1
void i2c_reset ( uint8_t scb_index )
Reset the I2C block specified.
This function resets the I2C block in response to an error or explicit request from protocol layer.
Generated for CCGx Firmware Stack by Doxygen
6.27 scb/i2c.h File Reference
163
Parameters
scb_index
SCB ID to be reset.
Returns
None
6.27.4.2
void i2c_scb_enable_wakeup ( uint8_t scb_index )
Enable deep-sleep wakeup due to address match on the specified SCB block.
Parameters
scb_index
SCB ID to be configured as deep-sleep wakeup trigger.
Returns
None
6.27.4.3
void i2c_scb_init ( uint8_t scb_index, i2c_scb_mode_t mode, i2c_scb_clock_freq_t clock_freq, uint8_t
slave_addr, uint8_t slave_mask, i2c_cb_fun_t cb_fun_ptr, uint8_t ∗ scratch_buffer, uint16_t scratch_buffer_size )
Configure one of the I2C blocks as required.
This API is used to enable and configure one of the I2C blocks for driver operation. Only I2C slave operation is
currently supported by the driver as of now.
The I2C driver is agnostic of the actual data transfer protocol. It reads all data written by the master into a receive
buffer provided by the protocol layer. A callback function is used to notify the protocol layer when the write is
complete. The receive buffer provided should be big enough to hold the maximum amount of data that the master
may provide in a write operation. If the write contains more data than the buffer can hold, the I2C driver will NAK
the transaction.
Read requests from the I2C master are automatically delayed by clock stretching. A callback function is used to
notify the protocol layer that the master is waiting for data. The i2c_scb_write function can be used by the protocol
layer to write data into the transmit FIFO in response to the read request.
All I2C driver events are generated from interrupt context, and are expected to be handled with care. The protocol
layer should defer any long operations to a non-interrupt context.
Parameters
scb_index
SCB index being configured for I2C operation.
mode
Desired mode of operation.
clock_freq
Desired I2C clock frequency.
slave_addr
Device address to be used in case of slave operation.
slave_mask
Mask to be applied on for slave address matching.
cb_fun_ptr
Callback function to be called for event notification.
scratch_buffer
Receive buffer used to hold written by master.
scratch_buffer_size
Size of the receive buffer in bytes.
Generated for CCGx Firmware Stack by Doxygen
164
File Documentation
Returns
None
6.27.4.4
bool i2c_scb_is_idle ( uint8_t scb_index )
Check whether the I2C block is idle.
This function checks whether the specified I2C block is idle. This check should be performed before the device
enters deep sleep. Deep sleep entry should be avoided if this function returns false.
Parameters
scb_index
SCB ID to be checked.
Returns
true if the I2C block is idle, false otherwise.
6.27.4.5
void i2c_scb_write ( uint8_t scb_index, uint8_t ∗ source_ptr, uint8_t size, uint8_t ∗ count )
Write data into the transmit FIFO associated with the I2C block.
This function is used by the protocol layer to write data into the I2C transmit FIFO in response to a master read
operation.
Parameters
scb_index
SCB ID to do the I2C transfer through.
source_ptr
Pointer to buffer containing the data to be written.
size
Size of the data buffer. Maximum amount of data that may be written.
count
Return parameter through which the actual write size is returned.
Returns
None
6.27.4.6
void i2c_slave_ack_ctrl ( uint8_t scb_index, bool enable )
Enable/Disable the I2C slave acknowledgement.
This function enables/disables the slave address ACK from the I2C block. The protocol layer can disable the address
ACK to hold off data transfers when it is not ready to respond to the master.
Parameters
scb_index
SCB ID to configure.
enable
Whether to enable or disable the auto slave address acknowledgement.
Generated for CCGx Firmware Stack by Doxygen
6.28 system/boot.h File Reference
Returns
None
6.28
system/boot.h File Reference
#include "config.h"
#include "status.h"
Data Structures
• union fw_img_status_t
• struct fw_img_status_t::FwModeReason
• struct sys_fw_metadata_t
Macros
•
•
•
•
•
•
•
•
•
•
#define CY_PD_IMG1_FW_STATUS_BIT_MASK (0x08)
#define CCG_BOOT_MODE_RQT_SIG (0x424C)
#define CCG_FW1_BOOT_RQT_SIG (0x4231)
#define CCG_FW2_BOOT_RQT_SIG (0x4232)
#define CCG_FW_METADATA_BOOTSEQ_OFFSET (0x1C)
#define CCG_BL_WAIT_DEFAULT (50)
#define CCG_BL_WAIT_MINUMUM (20)
#define CCG_BL_WAIT_MAXIMUM (1000)
#define CCG_FWMETA_APPID_WAIT_DEF (0xFFFFu)
#define CCG_FWMETA_APPID_WAIT_0 (0x4359)
Functions
•
•
•
•
•
•
•
•
•
ccg_status_t boot_validate_configtable (uint8_t ∗table_p)
ccg_status_t boot_validate_fw (sys_fw_metadata_t ∗fw_metadata)
ccg_status_t boot_handle_validate_fw_cmd (uint8_t fw_mode)
uint16_t boot_get_wait_time (void)
bool boot_start (void)
void boot_check_for_valid_fw (void)
uint8_t get_boot_mode_reason (void)
void boot_jump_to_fw (void)
uint32_t boot_get_boot_seq (uint8_t fwid)
Variables
•
•
•
•
•
6.28.1
fw_img_status_t gl_img_status
sys_fw_metadata_t ∗ gl_img1_fw_metadata
sys_fw_metadata_t ∗ gl_img2_fw_metadata
sys_fw_metadata_t ∗ gl_img1_fw_pseudo_metadata
sys_fw_metadata_t ∗ gl_img2_fw_pseudo_metadata
Detailed Description
Boot-loader support header file.
Generated for CCGx Firmware Stack by Doxygen
165
166
File Documentation
6.28.2
Function Documentation
6.28.2.1
void boot_check_for_valid_fw ( void )
Check for the presence of alternate firmware waiting to be validated.
This function checks whether the CCGx device flash contains an alternate firmware binary which is waiting to be
validated. This can happen if a firmware update happened during the last power up of the device, and the binary is
yet to be validated and made active. The active firmware will make use of the pseudo metadata in flash to identify
the alternate firmware, validate it and activate it by updating the actual firmware metadata.
Please refer to the CCGx boot sequence description in the firmware guide for a more detailed description of the
boot procedure.
Returns
NONE
6.28.2.2
uint32_t boot_get_boot_seq ( uint8_t fwid )
Get the boot sequence number value for the specified firmware image.
A boot sequence number field stored in the firmware metadata is used by the CCGx boot-loader to identify the
firmware binary to be loaded. This function retrieves the sequence number associated with the specified firmware
binary.
Parameters
fwid
Firmware id whose sequence number is to be retrieved. 1 for FW1 and 2 for FW2.
Returns
Boot sequence number value if the firmware is valid, 0 otherwise.
6.28.2.3
uint16_t boot_get_wait_time ( void )
Returns the boot-wait delay configured for the application.
This function identifies the boot-wait delay required by checking the firmware metadata.
Returns
Boot-wait delay in milliseconds.
6.28.2.4 ccg_status_t boot_handle_validate_fw_cmd ( uint8_t fw_mode )
Handles the VALIDATE_FW command from HPI or UVDM.
This API handles the VALIDATE_FW command received through the HPI or UVDM interfaces.
Parameters
fw_mode
Firmware binary id: 1 for FW1 and 2 for FW2.
Generated for CCGx Firmware Stack by Doxygen
6.28 system/boot.h File Reference
167
Returns
Status code indicating the validity of the firmware.
6.28.2.5
void boot_jump_to_fw ( void )
Transfer control to the firmware binary identified by boot_start.
This function is only used by the CCGx boot-loader. This transfers control to the firmware binary selected as the
boot target by the boot_start function. This is expected to be called after the boot-wait window has elapsed.
Returns
None
6.28.2.6
bool boot_start ( void )
Identify the firmware binary to be loaded.
This function is only used in the CCGx boot-loader, and implements the main start-up logic of the boot-loader. The
function validates the two firmware binaries in device flash, and identifies the binary to be loaded. If neither binary
is valid, the function returns false notifying the caller to continue in boot-loader mode.
Returns
true if firmware load is allowed, false otherwise.
6.28.2.7 ccg_status_t boot_validate_configtable ( uint8_t ∗ table_p )
Validate the configuration table specified.
Each copy of CCGx firmware on the device flash contains an embedded configuration table that defines the runtime
behaviour of the CCGx device. This function checks whether the configuration table located at the specified location
is valid (has valid signature and checksum).
Parameters
table←_p
Pointer to the configuration table to be validated.
Returns
CCG_STAT_SUCCESS if the table is valid, CCG_STAT_FAILURE otherwise.
6.28.2.8 ccg_status_t boot_validate_fw ( sys_fw_metadata_t ∗ fw_metadata )
Validate the firmware image associated with the given metadata.
This function validates the firmware binary associated with the metadata specified in the fw_metadata parameter.
The validity check includes checks for signature, location, size and checksum. This function internally performs
validation of the embedded configuration table using the boot_validate_configtable function.
Parameters
fw_metadata
Pointer to metadata table of the FW which has to be validated.
Generated for CCGx Firmware Stack by Doxygen
168
File Documentation
Returns
CCG_STAT_SUCCESS if the firmware is valid, CCG_STAT_FAILURE otherwise.
6.28.2.9
uint8_t get_boot_mode_reason ( void )
Returns a bitmap containing the reason for boot mode.
This function returns the bitmap value that is to be stored in the BOOT_MODE_REASON HPI register, which
identifies the validity of the two firmware binaries. The validation of the firmware is expected to have been completed
earlier through the boot_start function. This function only retrieves the status stored during the validation procedure.
See also
fw_img_status_t
Returns
Boot mode reason bitmap.
6.29
system/ccg4_version.h File Reference
Macros
•
•
•
•
•
#define FW_MAJOR_VERSION (1)
#define FW_MINOR_VERSION (0)
#define FW_PATCH_VERSION (0)
#define FW_BUILD_NUMBER (263)
#define FW_BASE_VERSION
6.29.1
Detailed Description
This file defines the base firmware stack version for CCG4.
6.29.2
Macro Definition Documentation
6.29.2.1
#define FW_BASE_VERSION
Value:
((FW_MAJOR_VERSION << 28) | (FW_MINOR_VERSION << 24) |
(FW_PATCH_VERSION << 16) | (FW_BUILD_NUMBER))
\
Composite firmware stack version value.
Composite firmware stack version value. This is a 4 byte value with the following format: Bytes 1-0: Build number
Byte 2: Patch version Byte 3 (Bits 0:3): Minor Version Byte 3 (Bits 4:7): Major Version
6.30
system/ccgx_api_desc.h File Reference
6.30.1
Detailed Description
CCGx Firmware API Reference Guide Introduction.
Generated for CCGx Firmware Stack by Doxygen
6.31 system/flash.h File Reference
6.31
169
system/flash.h File Reference
#include
#include
#include
#include
"stdint.h"
"stdbool.h"
"config.h"
"status.h"
Typedefs
• typedef void(∗ flash_cbk_t) (flash_write_status_t status)
Enumerations
• enum flash_app_priority_t { FLASH_APP_PRIORITY_DEFAULT = 0, FLASH_APP_PRIORITY_IMAGE_1,
FLASH_APP_PRIORITY_IMAGE_2 }
• enum flash_interface_t { FLASH_IF_HPI = 0, FLASH_IF_UVDM, FLASH_IF_USB_VENDOR, FLASH_IF_←IECS_UART }
• enum flash_write_status_t { FLASH_WRITE_COMPLETE, FLASH_WRITE_ABORTED, FLASH_WRITE_←COMPLETE_AND_ABORTED, FLASH_WRITE_IN_PROGRESS }
Functions
• void flash_enter_mode (bool is_enable, flash_interface_t mode)
• bool flash_access_enabled (uint8_t modes)
• void flash_set_access_limits (uint16_t start_row, uint16_t last_row, uint16_t md_row, uint16_t bl_last_row)
• ccg_status_t flash_row_clear (uint16_t row_num)
• ccg_status_t flash_row_write (uint16_t row_num, uint8_t ∗data, flash_cbk_t cbk)
• ccg_status_t flash_row_read (uint16_t row_num, uint8_t ∗data)
• ccg_status_t flash_set_app_priority (flash_app_priority_t app_priority)
6.31.1
Detailed Description
Flash command handler header file.
6.31.2
Typedef Documentation
6.31.2.1
flash_cbk_t
Non-blocking flash write row callback function type.
The CCG3 device supports non-blocking flash update operations, so that the firmware can perform other operations
while a flash row write is in progress. The completion of the flash row write is notified through a callback function.
This type represents the function type which can be registered as a callback for notification of non-blocking flash
operations.
6.31.3
Enumeration Type Documentation
6.31.3.1
enum flash_app_priority_t
Enumeration of app priority values.
Generated for CCGx Firmware Stack by Doxygen
170
File Documentation
App priority is a debug feature that allows the CCG bootloader to prioritize one copy of the firmware over the other.
The default behaviour is for both firmware binaries to have the same priority so that the more recently updated
firmware binary gets loaded. The priority scheme can be updated to allow FW1 or FW2 to always be loaded for
debugging purposes.
Enumerator
FLASH_APP_PRIORITY_DEFAULT Default. Latest image gets priority.
FLASH_APP_PRIORITY_IMAGE_1 Image-1 gets priority over image-2.
FLASH_APP_PRIORITY_IMAGE_2 Image-2 gets priority over image-1.
6.31.3.2
enum flash_interface_t
List of supported flash update interfaces.
CCG supports multiple flash update interfaces such as HPI, UVDM, USB etc. depending on the application. This
enumerated type lists the supported flash update interfaces.
Enumerator
FLASH_IF_HPI HPI based flash update interface.
FLASH_IF_UVDM UVDM based flash update interface.
FLASH_IF_USB_VENDOR USB flash update interface.
FLASH_IF_IECS_UART IECS (UART) flash update interface.
6.31.3.3
enum flash_write_status_t
List of possible status codes for non blocking flash write operation.
Enumerator
FLASH_WRITE_COMPLETE Flash Write successfully completed.
FLASH_WRITE_ABORTED Flash Write aborted.
FLASH_WRITE_COMPLETE_AND_ABORTED Flash Write completed with an abort request.
FLASH_WRITE_IN_PROGRESS Flash Write is active.
6.31.4
Function Documentation
6.31.4.1
bool flash_access_enabled ( uint8_t modes )
Check whether flashing mode has been entered.
This function checks whether flashing mode has currently been entered by a different interface.
Parameters
modes
Bitmap containing flashing interfaces to be checked.
Returns
Returns true if flashing mode has been entered using any of the interfaces listed in modes, false otherwise.
Generated for CCGx Firmware Stack by Doxygen
6.31 system/flash.h File Reference
6.31.4.2
171
void flash_enter_mode ( bool is_enable, flash_interface_t mode )
Handle ENTER_FLASHING_MODE Command.
This function notifies the CCG stack that flash read/write is being enabled by the application. By default, C←CG firmware disallows all flash read/write operations. Flash access is only allowed after flashing mode has been
explicitly enabled through user command.
Note: FW update interface is allowed to Enable Flashing mode only once in one session. This is to ensure that
multiple flashing interfaces are not active simultaneously. Each FW update interface is expected to take care of this.
Once Flash access is complete, this API should be used to exit FW Update interface.
Parameters
is_enable
Enable/Disable Flashing Mode
mode
Flash update interface to be used.
Returns
None
6.31.4.3 ccg_status_t flash_row_clear ( uint16_t row_num )
Erase the contents of the specified flash row.
This API erases the contents of the specified flash row by filling it with zeroes. Please note that this API will only
work if flashing mode is enabled and the selected row is within the range of write enabled rows.
Parameters
row_num
Row number to be erased.
Returns
Status of row erase operation.
6.31.4.4 ccg_status_t flash_row_read ( uint16_t row_num, uint8_t ∗ data )
Read the contents of the specified flash row.
This API handles the flash read row operation. The contents of the flash row are copied into the specified data
buffer, if flashing mode has been entered and the row_num is part of the readable range of memory.
Parameters
row_num
Flash row to be read.
data
Buffer to read the flash row content into.
Returns
Status of the flash read. CCG_STAT_SUCCESS or appropriate error code.
Generated for CCGx Firmware Stack by Doxygen
172
File Documentation
6.31.4.5 ccg_status_t flash_row_write ( uint16_t row_num, uint8_t ∗ data, flash_cbk_t cbk )
Write the given data to the specified flash row.
This API handles the flash write row operation. The contents from the data buffer is written to the row_num flash
row. The access rules for the flash row as the same as for the flash_row_clear API.
For non-blocking write row operation, the API returns as soon as the row update is started. The stack takes care of
executing all of the steps across multiple resume interrupts; and the callback is called at the end of the process.
Parameters
row_num
Flash row to be updated.
data
Buffer containing data to be written to the flash row.
cbk
Callback function to be called at the end of non-blocking flash write.
Returns
Status of the flash write. CCG_STAT_SUCCESS or appropriate error code.
6.31.4.6
void flash_set_access_limits ( uint16_t start_row, uint16_t last_row, uint16_t md_row, uint16_t bl_last_row )
Set limits to the flash rows that can be accessed.
The CCG stack has been designed to support fail-safe firmware upgrades using a pair of firmware binaries that can
mutually update each other. This scheme can only be robust if the currently active firmware binary can effectively
protect itself by not allowing access to any of its own flash rows.
This function is used to specify the list of flash rows that can safely be accessed by the currently active firmware
binary. This function should only be used with parameters derived based on the binary locations identified from
firmware metadata. Incorrect usage of this API can cause the device to stop responding during a flash update
operation.
Parameters
start_row
The lowest row number that can be written.
last_row
The highest row number that can be written.
md_row
Row containing metadata for the alternate firmware.
bl_last_row
Last bootloader row. Rows above this can be read.
Returns
None
6.31.4.7 ccg_status_t flash_set_app_priority ( flash_app_priority_t app_priority )
Updates the app boot priority flag.
This function is used to set the app priority field to override the default FW selection algorithm.
Parameters
app_priority
Desired boot priority setting.
Generated for CCGx Firmware Stack by Doxygen
6.32 system/gpio.h File Reference
173
Returns
Status code of the priority update.
6.32
system/gpio.h File Reference
#include "stdint.h"
#include "stdbool.h"
Macros
• #define GPIO_DM_FIELD_SIZE (3u)
• #define GPIO_DM_FIELD_MASK (7u)
• #define GPIO_INT_FIELD_MASK (3u)
• #define HSIOM_FIELD_SHIFT (2u)
Enumerations
• enum gpio_port_pin_t {
GPIO_PORT_0_PIN_0 = 0x00, GPIO_PORT_0_PIN_1, GPIO_PORT_0_PIN_2, GPIO_PORT_0_PIN_3,
GPIO_PORT_0_PIN_4, GPIO_PORT_0_PIN_5, GPIO_PORT_0_PIN_6, GPIO_PORT_0_PIN_7,
GPIO_PORT_1_PIN_0 = 0x10, GPIO_PORT_1_PIN_1, GPIO_PORT_1_PIN_2, GPIO_PORT_1_PIN_3,
GPIO_PORT_1_PIN_4, GPIO_PORT_1_PIN_5, GPIO_PORT_1_PIN_6, GPIO_PORT_1_PIN_7,
GPIO_PORT_2_PIN_0 = 0x20, GPIO_PORT_2_PIN_1, GPIO_PORT_2_PIN_2, GPIO_PORT_2_PIN_3,
GPIO_PORT_2_PIN_4, GPIO_PORT_2_PIN_5, GPIO_PORT_2_PIN_6, GPIO_PORT_2_PIN_7,
GPIO_PORT_3_PIN_0 = 0x30, GPIO_PORT_3_PIN_1, GPIO_PORT_3_PIN_2, GPIO_PORT_3_PIN_3,
GPIO_PORT_3_PIN_4, GPIO_PORT_3_PIN_5, GPIO_PORT_3_PIN_6, GPIO_PORT_3_PIN_7,
GPIO_PORT_4_PIN_0 = 0x40, GPIO_PORT_4_PIN_1, GPIO_PORT_4_PIN_2, GPIO_PORT_4_PIN_3,
GPIO_PORT_4_PIN_4, GPIO_PORT_4_PIN_5, GPIO_PORT_4_PIN_6, GPIO_PORT_4_PIN_7 }
• enum gpio_dm_t {
GPIO_DM_HIZ_ANALOG = 0, GPIO_DM_HIZ_DIGITAL, GPIO_DM_RES_UP, GPIO_DM_RES_DWN,
GPIO_DM_OD_LOW, GPIO_DM_OD_HIGH, GPIO_DM_STRONG, GPIO_DM_RES_UPDOWN }
• enum gpio_intr_t { GPIO_INTR_DISABLE = 0, GPIO_INTR_RISING, GPIO_INTR_FALLING, GPIO_INTR←_BOTH }
• enum hsiom_mode_t {
HSIOM_MODE_GPIO = 0, HSIOM_MODE_AMUXA = 6, HSIOM_MODE_AMUXB = 7, HSIOM_MODE_T←CPWM_IO = 8,
HSIOM_MODE_SCB0_UART = 9, HSIOM_MODE_SCB1_UART = 10, HSIOM_MODE_SCB2_UART = 10,
HSIOM_MODE_SCB3_UART = 10,
HSIOM_MODE_SCB_TCPWM_OFLOW = 11, HSIOM_MODE_DDFT_PIN = 12, HSIOM_MODE_SWD = 13,
HSIOM_MODE_SCB0_SPI = 13,
HSIOM_MODE_SCB1_SPI = 14, HSIOM_MODE_SCB2_SPI = 14, HSIOM_MODE_SCB3_SPI = 14, HSI←OM_MODE_SCB0_I2C = 15,
HSIOM_MODE_SCB1_I2C = 15, HSIOM_MODE_SCB2_I2C = 15, HSIOM_MODE_SCB3_I2C = 15 }
Functions
• void gpio_set_value (gpio_port_pin_t port_pin, bool value)
• bool gpio_read_value (gpio_port_pin_t port_pin)
• void gpio_set_drv_mode (gpio_port_pin_t port_pin, gpio_dm_t drv_mode)
• void gpio_int_set_config (gpio_port_pin_t port_pin, uint8_t int_mode)
• void hsiom_set_config (gpio_port_pin_t port_pin, hsiom_mode_t hsiom_mode)
Generated for CCGx Firmware Stack by Doxygen
174
File Documentation
• void gpio_hsiom_set_config (gpio_port_pin_t port_pin, hsiom_mode_t hsiom_mode, gpio_dm_t drv_mode,
bool value)
• void gpio_set_lvttl_mode (uint8_t port)
• bool gpio_get_intr (gpio_port_pin_t port_pin)
• void gpio_clear_intr (gpio_port_pin_t port_pin)
6.32.1
Detailed Description
GPIO and IO mapping control functions.
6.32.2
Enumeration Type Documentation
6.32.2.1
enum gpio_dm_t
Various GPIO drive modes supported by the CCGx devices.
This enumeration lists the various drive modes supported by CCGx IOs which are configured as GPIOs. Please
refer to hsiom_mode_t for the IO mapping settings available for each CCGx IO.
See also
hsiom_mode_t
Enumerator
GPIO_DM_HIZ_ANALOG Output buffer off (HiZ), input buffer off
GPIO_DM_HIZ_DIGITAL Output buffer off (HiZ), input buffer on
GPIO_DM_RES_UP Resistive pull-up
GPIO_DM_RES_DWN Resistive pull-down
GPIO_DM_OD_LOW Drive low and HZI for high
GPIO_DM_OD_HIGH Drive high and HZI for low
GPIO_DM_STRONG Strong low and high drive
GPIO_DM_RES_UPDOWN Resistive pull-up and pull-down
6.32.2.2
enum gpio_intr_t
Various GPIO interrupt modes supported by the device.
Enumerator
GPIO_INTR_DISABLE GPIO interrupt disabled.
GPIO_INTR_RISING Interrupt on rising edge of input.
GPIO_INTR_FALLING Interrupt on falling edge of input.
GPIO_INTR_BOTH Interrupt on both rising and falling edges.
6.32.2.3
enum gpio_port_pin_t
List of pins supported on CCGx devices.
This enumeration lists the port and pin assignment for the pins available on the CCGx USB-PD controllers. This is
a superset of all pins supported across all of the devices in the family, and includes pins such as CC1/CC2 which
have fixed functionality.
Please refer to the respective device datasheets to identify the pins that can be used as GPIOs.
Generated for CCGx Firmware Stack by Doxygen
6.32 system/gpio.h File Reference
Enumerator
GPIO_PORT_0_PIN_0 P0.0: Port 0, Pin 0.
GPIO_PORT_0_PIN_1 P0.1: Port 0, Pin 1.
GPIO_PORT_0_PIN_2 P0.2: Port 0, Pin 2.
GPIO_PORT_0_PIN_3 P0.3: Port 0, Pin 3.
GPIO_PORT_0_PIN_4 P0.4: Port 0, Pin 4.
GPIO_PORT_0_PIN_5 P0.5: Port 0, Pin 5.
GPIO_PORT_0_PIN_6 P0.6: Port 0, Pin 6.
GPIO_PORT_0_PIN_7 P0.7: Port 0, Pin 7.
GPIO_PORT_1_PIN_0 P1.0: Port 1, Pin 0.
GPIO_PORT_1_PIN_1 P1.1: Port 1, Pin 1.
GPIO_PORT_1_PIN_2 P1.2: Port 1, Pin 2.
GPIO_PORT_1_PIN_3 P1.3: Port 1, Pin 3.
GPIO_PORT_1_PIN_4 P1.4: Port 1, Pin 4.
GPIO_PORT_1_PIN_5 P1.5: Port 1, Pin 5.
GPIO_PORT_1_PIN_6 P1.6: Port 1, Pin 6.
GPIO_PORT_1_PIN_7 P1.7: Port 1, Pin 7.
GPIO_PORT_2_PIN_0 P2.0: Port 2, Pin 0.
GPIO_PORT_2_PIN_1 P2.1: Port 2, Pin 1.
GPIO_PORT_2_PIN_2 P2.2: Port 2, Pin 2.
GPIO_PORT_2_PIN_3 P2.3: Port 2, Pin 3.
GPIO_PORT_2_PIN_4 P2.4: Port 2, Pin 4.
GPIO_PORT_2_PIN_5 P2.5: Port 2, Pin 5.
GPIO_PORT_2_PIN_6 P2.6: Port 2, Pin 6.
GPIO_PORT_2_PIN_7 P2.7: Port 2, Pin 7.
GPIO_PORT_3_PIN_0 P3.0: Port 3, Pin 0.
GPIO_PORT_3_PIN_1 P3.1: Port 3, Pin 1.
GPIO_PORT_3_PIN_2 P3.2: Port 3, Pin 2.
GPIO_PORT_3_PIN_3 P3.3: Port 3, Pin 3.
GPIO_PORT_3_PIN_4 P3.4: Port 3, Pin 4.
GPIO_PORT_3_PIN_5 P3.5: Port 3, Pin 5.
GPIO_PORT_3_PIN_6 P3.6: Port 3, Pin 6.
GPIO_PORT_3_PIN_7 P3.7: Port 3, Pin 7.
GPIO_PORT_4_PIN_0 P4.0: Port 4, Pin 0.
GPIO_PORT_4_PIN_1 P4.1: Port 4, Pin 1.
GPIO_PORT_4_PIN_2 P4.2: Port 4, Pin 2.
GPIO_PORT_4_PIN_3 P4.3: Port 4, Pin 3.
GPIO_PORT_4_PIN_4 P4.4: Port 4, Pin 4.
GPIO_PORT_4_PIN_5 P4.5: Port 4, Pin 5.
GPIO_PORT_4_PIN_6 P4.6: Port 4, Pin 6.
GPIO_PORT_4_PIN_7 P4.7: Port 4, Pin 7.
Generated for CCGx Firmware Stack by Doxygen
175
176
File Documentation
6.32.2.4
enum hsiom_mode_t
Various IO matrix configuration modes.
Most of the IOs on CCGx devices (except fixed function IOs like Vdd, GND, CCx) can be configured to select one
from many available options. This enumerated type lists the various IO functions that can be selected for the flexible
IOs.
Please refer to the respective device datasheets for more information about these IO options.
Enumerator
HSIOM_MODE_GPIO Special functions disabled. Used as GPIO.
HSIOM_MODE_AMUXA AMUXBUS A connection
HSIOM_MODE_AMUXB AMUXBUS B connection
HSIOM_MODE_TCPWM_IO TCPWM IO line.
HSIOM_MODE_SCB0_UART SCB0 UART IO.
HSIOM_MODE_SCB1_UART SCB1 UART IO.
HSIOM_MODE_SCB2_UART SCB2 UART IO.
HSIOM_MODE_SCB3_UART SCB3 UART IO.
HSIOM_MODE_SCB_TCPWM_OFLOW TCPWM overflow indicator
HSIOM_MODE_DDFT_PIN DDFT Pin HSIOM setting.
HSIOM_MODE_SWD SWD IOs. The specific SWD IO line type is hardwired.
HSIOM_MODE_SCB0_SPI SCB0 SPI IO.
HSIOM_MODE_SCB1_SPI SCB1 SPI IO.
HSIOM_MODE_SCB2_SPI SCB2 SPI IO.
HSIOM_MODE_SCB3_SPI SCB3 SPI IO.
HSIOM_MODE_SCB0_I2C SCB0 I2C IO.
HSIOM_MODE_SCB1_I2C SCB1 I2C IO.
HSIOM_MODE_SCB2_I2C SCB2 I2C IO.
HSIOM_MODE_SCB3_I2C SCB3 I2C IO.
6.32.3
Function Documentation
6.32.3.1
void gpio_clear_intr ( gpio_port_pin_t port_pin )
Clear interrupt status on the specified GPIO.
This function clears any active interrupts on the specified GPIO.
Parameters
port_pin
Pin to be updated.
Returns
None
6.32.3.2
bool gpio_get_intr ( gpio_port_pin_t port_pin )
Read the interrupt status on a specific GPIO.
Generated for CCGx Firmware Stack by Doxygen
6.32 system/gpio.h File Reference
This function checks whether there are any active interrupts on the specified GPIO.
Generated for CCGx Firmware Stack by Doxygen
177
178
File Documentation
Parameters
port_pin
Pin to be queried.
Returns
true if interrupt is active, false otherwise.
6.32.3.3
void gpio_hsiom_set_config ( gpio_port_pin_t port_pin, hsiom_mode_t hsiom_mode, gpio_dm_t drv_mode,
bool value )
Single function for complete configuration of a CCG IO.
This is a single API which can be used to configure the IO mode, the drive mode and the current value of a CCG
device IO. No error checks are performed, and the caller should ensure that the settings provided are valid for the
selected IO.
Parameters
port_pin
Pin to be configured.
hsiom_mode
Desired IO mode.
drv_mode
Desired drive mode.
value
Desired output state.
Returns
None
6.32.3.4
void gpio_int_set_config ( gpio_port_pin_t port_pin, uint8_t int_mode )
Configure the GPIO with the desired interrupt setting.
This API configures the interrupt mode for the specified GPIO. The API does not do any error check and will just
configure the GPIO interrupt setting. Care should be taken to make sure that wrong indexing is not done.
Parameters
port_pin
Pin to be configured.
int_mode
Desired interrupt mode.
Returns
None
6.32.3.5
bool gpio_read_value ( gpio_port_pin_t port_pin )
Get the GPIO current state.
This API retrieves the current state of a pin, assuming it has been configured as a GPIO. It is the caller's responsibility to ensure that the HSIOM and drive mode settings for the pin have been set correctly.
The API does not do any error check and will just read the GPIO state register. Care should be taken to make sure
that wrong indexing is not done.
Generated for CCGx Firmware Stack by Doxygen
6.32 system/gpio.h File Reference
179
Parameters
port_pin
Pin to be queried.
Returns
Current state of the pin.
See also
hsiom_set_config
gpio_set_drv_mode
6.32.3.6
void gpio_set_drv_mode ( gpio_port_pin_t port_pin, gpio_dm_t drv_mode )
Configure the GPIO with the desired drive mode.
This API updates the drive mode for the selected CCG device IO. The API does not do any error check and will just
set the drive mode of GPIO. The caller should ensure that the HSIOM setting for the pin has been selected correctly.
Parameters
port_pin
Pin to be configured.
drv_mode
Desired drive mode.
Returns
None
6.32.3.7
void gpio_set_lvttl_mode ( uint8_t port )
Set the input buffer voltage for a port to LVTTL.
This API sets the input buffer voltage for a complete CCG device port to LVTTL levels. This is required to be set for
ports that include the IOs used for the I2C based HPI interface.
Parameters
port
IO port to be configured for LVTTL levels.
Returns
None
6.32.3.8
void gpio_set_value ( gpio_port_pin_t port_pin, bool value )
Sets the GPIO to the required state.
This function updates the output state of a GPIO pin. The API does not do any error check and will just update the
output state. It is the caller's responsibility to ensure that the HSIOM and drive mode settings for the pin have been
selected as required.
Care should be taken to make sure that wrong indexing is not done.
Generated for CCGx Firmware Stack by Doxygen
180
File Documentation
Parameters
port_pin
Pin to be updated.
value
Value to drive on the pin: 0=LOW, 1=HIGH.
Returns
None
See also
hsiom_set_config
gpio_set_drv_mode
6.32.3.9
void hsiom_set_config ( gpio_port_pin_t port_pin, hsiom_mode_t hsiom_mode )
Select the IO mode for a CCG device IO.
This API configures the IO mode for a CCG device IO. The API does not do any error check and will just set the
HSIOM configuration for the GPIO. Care should be taken to make sure that wrong indexing is not done.
Parameters
port_pin
Pin to be configured.
hsiom_mode
Desired IO mode.
Returns
None
See also
hsiom_mode_t
6.33
system/status.h File Reference
Macros
• #define CCG_STATUS_CODE_OFFSET (2)
• #define CCG_STATUS_TO_HPI_RESPONSE(c) ((c) + CCG_STATUS_CODE_OFFSET)
Enumerations
• enum ccg_status_t {
CCG_STAT_NO_RESPONSE = -2, CCG_STAT_SUCCESS = 0, CCG_STAT_FLASH_DATA_AVAILABLE,
CCG_STAT_BAD_PARAM,
CCG_STAT_INVALID_COMMAND = 3, CCG_STAT_FLASH_UPDATE_FAILED = 5, CCG_STAT_INVAL←ID_FW, CCG_STAT_INVALID_ARGUMENT,
CCG_STAT_NOT_SUPPORTED, CCG_STAT_INVALID_SIGNATURE, CCG_STAT_TRANS_FAILURE,
CCG_STAT_CMD_FAILURE,
CCG_STAT_FAILURE, CCG_STAT_READ_DATA, CCG_STAT_NOT_READY, CCG_STAT_BUSY,
CCG_STAT_TIMEOUT }
Generated for CCGx Firmware Stack by Doxygen
6.34 system/system.h File Reference
6.33.1
181
Detailed Description
API return status definitions.
6.33.2
Macro Definition Documentation
6.33.2.1
#define CCG_STATUS_CODE_OFFSET (2)
Value to be added to the status code to get the HPI/UVDM response code.
The HPI/UVDM interface response codes use a different convention than the core function return codes. This value
represents the offset that should be added to the function return code to get the HPI/UVDM response code.
6.33.3
Enumeration Type Documentation
6.33.3.1
enum ccg_status_t
Interface status codes.
Enumeration to hold status codes for all CCG interfaces. These values are pre-defined for each interface and should
not be modified. To make interface usage easier, the enumeration starts at -2. This allows the success status to
have a value of zero. The response code should be incremented by two before sending out on the individual
interfaces.
Enumerator
CCG_STAT_NO_RESPONSE Special status code indicating no response.
CCG_STAT_SUCCESS Success status.
CCG_STAT_FLASH_DATA_AVAILABLE Special status code indicating flash data availability.
CCG_STAT_BAD_PARAM Bad input parameter.
CCG_STAT_INVALID_COMMAND Operation failed due to invalid command.
CCG_STAT_FLASH_UPDATE_FAILED Flash write operation failed.
CCG_STAT_INVALID_FW Special status code indcating invalid firmware
CCG_STAT_INVALID_ARGUMENT Operation failed due to invalid arguments.
CCG_STAT_NOT_SUPPORTED Feature not supported.
CCG_STAT_INVALID_SIGNATURE Invalid signature parameter identified.
CCG_STAT_TRANS_FAILURE Transaction failure status.
CCG_STAT_CMD_FAILURE Command failure status
CCG_STAT_FAILURE Generic failure status.
CCG_STAT_READ_DATA Special status code indicating read data availability.
CCG_STAT_NOT_READY Operation failed due to device/stack not ready.
CCG_STAT_BUSY Operation failed due to device/stack busy status.
CCG_STAT_TIMEOUT Operation timed out.
6.34
system/system.h File Reference
#include "stdint.h"
Generated for CCGx Firmware Stack by Doxygen
182
File Documentation
Macros
• #define SYS_BOOT_VERSION_ADDRESS (0x000000E0)
• #define SYS_FW_VERSION_OFFSET (0x000000E0)
• #define SYS_SILICON_ID_OFFSET (0x000000EA)
• #define SYS_METADATA_VALID_SIG (0x4359)
• #define SYS_PSEUDO_METADATA_VALID_SIG (0x4350)
• #define SYS_BOOT_MODE_RQT_SIG (0x424C)
• #define SYS_CONFIG_TABLE_SIGN (0x4359u)
• #define SYS_INVALID_FW_START_ADDR (0x00000000)
Enumerations
• enum sys_fw_mode_t { SYS_FW_MODE_BOOTLOADER = 0, SYS_FW_MODE_FWIMAGE_1, SYS_FW←_MODE_FWIMAGE_2, SYS_FW_MODE_INVALID }
Functions
• void sys_set_device_mode (sys_fw_mode_t fw_mode)
• sys_fw_mode_t sys_get_device_mode (void)
• uint8_t ∗ sys_get_boot_version (void)
• uint8_t ∗ sys_get_img1_fw_version (void)
• uint8_t ∗ sys_get_img2_fw_version (void)
• uint32_t sys_get_fw_img1_start_addr (void)
• uint32_t sys_get_fw_img2_start_addr (void)
• uint8_t sys_get_recent_fw_image (void)
• void sys_get_silicon_id (uint32_t ∗silicon_id)
Variables
• sys_fw_mode_t gl_active_fw
6.34.1
Detailed Description
Support functions and definitions for boot-loader and flash updates.
6.34.2
Enumeration Type Documentation
6.34.2.1
enum sys_fw_mode_t
List of CCG firmware modes.
Enumerator
SYS_FW_MODE_BOOTLOADER Bootloader mode.
SYS_FW_MODE_FWIMAGE_1 Firmware Image #1
SYS_FW_MODE_FWIMAGE_2 Firmware Image #2
SYS_FW_MODE_INVALID Invalid value.
Generated for CCGx Firmware Stack by Doxygen
6.34 system/system.h File Reference
6.34.3
Function Documentation
6.34.3.1
uint8_t∗ sys_get_boot_version ( void )
183
Get bootloader version.
The bootloader version is stored at absolute address SYS_CCG_BOOT_VERSION_ADDRESS in device FLASH.
This function returns a pointer to this version information.
Returns
Pointer to the bootloader version information.
6.34.3.2 sys_fw_mode_t sys_get_device_mode ( void )
Get the current firmware mode.
This function retrieves the current firmware mode of the CCG device.
Returns
The current firmware mode.
6.34.3.3
uint32_t sys_get_fw_img1_start_addr ( void )
Get the flash start address of firmware image-1.
This function returns the flash address from where firmware image-1 (FW1) has been stored.
Returns
Start address of firmware image-1.
6.34.3.4
uint32_t sys_get_fw_img2_start_addr ( void )
Get the flash start address of firmware image-2.
This function returns the flash address from where firmware image-2 (FW2) has been stored.
Returns
Start address of firmware image-2.
6.34.3.5
uint8_t∗ sys_get_img1_fw_version ( void )
Get version for firmware image-1.
This function returns a pointer to the version information for firmware image-1 (FW1). The version is located at a
fixed offset of CY_PD_FW_VERSION_OFFSET bytes from the start of the firmware binary.
Returns
Pointer to the firmware image-1 version information.
Generated for CCGx Firmware Stack by Doxygen
184
File Documentation
6.34.3.6
uint8_t∗ sys_get_img2_fw_version ( void )
Get version for firmware image-2.
This function returns a pointer to the version information for firmware image-2 (FW2). The version is located at a
fixed offset of CY_PD_FW_VERSION_OFFSET bytes from the start of the firmware binary.
Returns
Pointer to the firmware image-2 version information.
6.34.3.7
uint8_t sys_get_recent_fw_image ( void )
Determines the more recently update firmware image.
The CCG Bootloader uses this function to determine the more recently updated firmware image (from among F←W1 and FW2) by comparing the sequence numbers of images which are stored in the firmware metadata table.
The bootloader loads the most recently updated binary by default (even if its version is older than that of the other
firmware binary).
Returns
Firmware id: 1 for Image-1 and 2 for Image-2.
6.34.3.8
void sys_get_silicon_id ( uint32_t ∗ silicon_id )
Get Silicon ID of device.
This function retrieves the Silicon ID of the CCG device.
Parameters
silicon←_id
Pointer to buffer to hold the Silicon ID.
Returns
None
6.34.3.9
void sys_set_device_mode ( sys_fw_mode_t fw_mode )
Set the current firmware mode.
This function is used by the start-up logic to store the current firmware mode for the CCGx device.
This should not be used outside of the default start-up logic for the CCGx bootloader and firmware applications.
Parameters
fw_mode
The active firmware mode to be set.
Returns
None
Generated for CCGx Firmware Stack by Doxygen
6.35 system/timer.h File Reference
6.35
system/timer.h File Reference
#include "config.h"
#include "stdbool.h"
Data Structures
• struct ccg_timer_t
Macros
•
•
•
•
•
•
•
•
•
•
#define TIMER_NUM_TIMERS (32u)
#define TIMER_MAX_TIMEOUT (0xFFFF)
#define TIMER_INVALID_ID (0xFFu)
#define TIMER_INVALID_INDEX (0xFFu)
#define TIMER_MIN_PD_TIMER_ID (0x00u)
#define TIMER_MAX_PD_TIMER_ID (0x1Fu)
#define TIMER_MIN_T_TIMER_ID (0x20u)
#define TIMER_MAX_T_TIMER_ID (0x2Fu)
#define TIMER_MIN_SYS_TIMER_ID (0x80u)
#define TIMER_MAX_SYS_TIMER_ID (0xFEu)
Typedefs
• typedef uint8_t timer_id_t
• typedef void(∗ timer_cb_t) (uint8_t instance, timer_id_t id)
Functions
•
•
•
•
•
•
•
•
•
void timer_init (void)
bool timer_start (uint8_t instance, timer_id_t id, uint16_t period, timer_cb_t cb)
void timer_stop (uint8_t instance, timer_id_t id)
bool timer_is_running (uint8_t instance, timer_id_t id)
uint16_t timer_get_count (uint8_t instance, timer_id_t id)
void timer_stop_all (uint8_t instance)
void timer_stop_range (uint8_t instance, timer_id_t start, timer_id_t stop)
uint8_t timer_num_active (uint8_t instance)
void timer_enter_sleep (void)
6.35.1
Detailed Description
Soft timer header file.
6.35.2
Typedef Documentation
6.35.2.1
timer_cb_t
Timer callback function.
This callback function is invoked on timer expiry and should be treated as interrupt.
Generated for CCGx Firmware Stack by Doxygen
185
186
File Documentation
6.35.2.2 timer_id_t
Timer ID type definition.
This type definition is used to identify software timer objects.
6.35.3
Function Documentation
6.35.3.1
void timer_enter_sleep ( void )
Prepare the timer hardware for entering deep sleep.
This function prepares the timer module and the hardware timer for entering device deep sleep. This must be called
prior to entering deep sleep mode.
Returns
None
6.35.3.2
uint16_t timer_get_count ( uint8_t instance, timer_id_t id )
Returns the time remaining for timer expiration.
Returns the time remaining for timer expiration.
Parameters
instance
Instance number for which we are using the timer
id
Unique timer id
Returns
Time remaining for expiration of the soft timer.
6.35.3.3
void timer_init ( void )
Initialize the software timer module.
This function initializes the software timer module. This function initializes the data structures for timer management
and enables the hardware timer used for the soft timer implementation.
Returns
None
6.35.3.4
bool timer_is_running ( uint8_t instance, timer_id_t id )
Check whether the specified soft timer is currently running.
Parameters
instance
Instance number for which we are using the timer
id
Unique timer id.
Generated for CCGx Firmware Stack by Doxygen
6.35 system/timer.h File Reference
187
Returns
true if the timer is running, false otherwise.
6.35.3.5
uint8_t timer_num_active ( uint8_t instance )
Returns number of active timers.
Parameters
instance
Instance number to query.
Returns
Number of active timers on this instance.
6.35.3.6
bool timer_start ( uint8_t instance, timer_id_t id, uint16_t period, timer_cb_t cb )
Start a soft timer.
Start a specific soft timer. All soft timers are one-shot timers which will run until the specified period has elapsed.
The timer expiration callback will be called at the end of the period, if one is provided.
Parameters
instance
Timer instance number for which we are using the timer.
id
Unique timer id
period
Timer period in milliseconds.
cb
Timer expiration callback. Can be NULL.
Returns
true if the timer is started, false if timer start fails.
6.35.3.7
void timer_stop ( uint8_t instance, timer_id_t id )
Stop a soft timer.
Stop a soft timer which is currently running.
Parameters
instance
Instance number for which we are using the timer
id
Unique timer id
Returns
None
6.35.3.8
void timer_stop_all ( uint8_t instance )
Stops all soft timers associated with the instance.
Generated for CCGx Firmware Stack by Doxygen
188
File Documentation
Parameters
instance
Instance number on which timers are to be stopped.
Returns
None
6.35.3.9
void timer_stop_range ( uint8_t instance, timer_id_t start, timer_id_t stop )
This function stops all soft timers with ids in the specified range.
Parameters
instance
Instance number on which soft timers are to be stopped.
start
Starting timer ID. The value is inclusive.
stop
Ending timer ID. The value is inclusive.
Returns
None
6.36
system/utils.h File Reference
#include "stdint.h"
Macros
• #define GET_MAX(a, b) (((a) > (b)) ? (a) : (b))
• #define GET_MIN(a, b) (((a) > (b)) ? (b) : (a))
• #define DIV_ROUND_UP(x, y) (((x) + ((y) - 1)) / (y))
• #define DIV_ROUND_NEAREST(x, y) (((x) + ((y) / 2)) / (y))
• #define MAKE_WORD(hi, lo) (((uint16_t)(hi) << 8) | ((uint16_t)(lo)))
• #define MAKE_DWORD(b3, b2, b1, b0)
• #define MAKE_DWORD_FROM_WORD(hi, lo) (((uint32_t)(hi) << 16) | ((uint32_t)(lo)))
• #define WORD_GET_MSB(w) ((uint8_t)((w) >> 8))
• #define WORD_GET_LSB(w) ((uint8_t)((w) & 0xFF))
• #define DWORD_GET_BYTE0(dw) ((uint8_t)((dw) & 0xFF))
• #define DWORD_GET_BYTE1(dw) ((uint8_t)(((dw) >> 8) & 0xFF))
• #define DWORD_GET_BYTE2(dw) ((uint8_t)(((dw) >> 16) & 0xFF))
• #define DWORD_GET_BYTE3(dw) ((uint8_t)(((dw) >> 24) & 0xFF))
• #define MEM_COPY(dest, src, size) memcpy ((uint8_t ∗)(dest), (uint8_t ∗)(src), (size))
• #define MEM_CMP(buf1, buf2, size) memcmp ((uint8_t ∗)(buf1), (uint8_t ∗)(buf2), (size))
• #define MEM_SET(dest, byte, size) memset ((uint8_t ∗)(dest), (byte), (size))
• #define BUSY_WAIT_US(us) CyDelayCycles ((uint32_t)(us))
Generated for CCGx Firmware Stack by Doxygen
6.36 system/utils.h File Reference
189
Functions
uint8_t mem_calculate_byte_checksum (uint8_t ∗ptr, uint32_t size)
uint16_t mem_calculate_word_checksum (uint16_t ∗ptr, uint32_t size)
uint32_t mem_calculate_dword_checksum (uint32_t ∗ptr, uint32_t size)
uint16_t crc16 (uint16_t crc, uint8_t data)
•
•
•
•
6.36.1
Detailed Description
General utility macros and definitions for CCGx firmware stack.
6.36.2
Macro Definition Documentation
6.36.2.1
#define MAKE_DWORD( b3, b2, b1, b0 )
Value:
(((uint32_t)(b3) << 24) | ((uint32_t)(b2) << 16) |
((uint32_t)(b1) << 8) | ((uint32_t)(b0)))
\
Combine four bytes to create one 32-bit DWORD.
6.36.3
Function Documentation
6.36.3.1
uint16_t crc16 ( uint16_t crc, uint8_t data )
Function to calculate 16-bit CRC.
Parameters
crc
Original CRC value.
data
Data byte to be included in CRC computation.
Returns
Updated CRC value including the new data byte.
6.36.3.2
uint8_t mem_calculate_byte_checksum ( uint8_t ∗ ptr, uint32_t size )
Calculate the 2's complement binary checksum over a BYTE array.
This function calculates the checksum of the specified byte array. The checksum is a simple function calculated as
the 2's complement of the binary sum of all bytes in the array. This checksum is used for the firmware binary as well
as the configuration table.
Parameters
ptr
Pointer to the data array.
size
Size of the array in BYTE elements.
Generated for CCGx Firmware Stack by Doxygen
190
File Documentation
Returns
Checksum of the data array.
6.36.3.3
uint32_t mem_calculate_dword_checksum ( uint32_t ∗ ptr, uint32_t size )
Calculate the 2's complement binary checksum over a DWORD array.
This function calculates the checksum of the specified DWORD array. The checksum is a simple function calculated
as the 2's complement of the binary sum of all d-words in the array. This checksum is used for the firmware binary
as well as the configuration table.
Parameters
ptr
Pointer to the data array.
size
Size of the array in DWORD elements.
Returns
Checksum of the data array.
6.36.3.4
uint16_t mem_calculate_word_checksum ( uint16_t ∗ ptr, uint32_t size )
Calculate the 2's complement binary checksum over a WORD array.
This function calculates the checksum of the specified WORD array. The checksum is a simple function calculated
as the 2's complement of the binary sum of all words in the array.
Parameters
ptr
Pointer to the data array.
size
Size of the array in WORD elements.
Returns
Checksum of the data array.
Generated for CCGx Firmware Stack by Doxygen
Index
ALT_MODE_HPD
alt_mode_hw.h, 65
ALT_MODE_MNGR_STATE_DISC_MODE
alt_modes_mngr.h, 71
ALT_MODE_MNGR_STATE_EXIT
alt_modes_mngr.h, 71
ALT_MODE_MNGR_STATE_PROCESS
alt_modes_mngr.h, 71
ALT_MODE_MNGR_WAIT_EC_TRIGGER
alt_modes_mngr.h, 71
ALT_MODE_MUX
alt_mode_hw.h, 65
ALT_MODE_STATE_DISABLE
alt_modes_mngr.h, 71
ALT_MODE_STATE_EXIT
alt_modes_mngr.h, 71
ALT_MODE_STATE_FAIL
alt_modes_mngr.h, 71
ALT_MODE_STATE_IDLE
alt_modes_mngr.h, 71
ALT_MODE_STATE_INIT
alt_modes_mngr.h, 71
ALT_MODE_STATE_RUN
alt_modes_mngr.h, 71
ALT_MODE_STATE_SEND
alt_modes_mngr.h, 71
ALT_MODE_STATE_WAIT_FOR_RESP
alt_modes_mngr.h, 71
AM_CMD_DIS_TRIG
alt_modes_mngr.h, 70
AM_CMD_EN_TRIG
alt_modes_mngr.h, 70
AM_CMD_ENTER
alt_modes_mngr.h, 70
AM_CMD_EXIT
alt_modes_mngr.h, 70
AM_CMD_SPEC
alt_modes_mngr.h, 70
AM_EVT_ALT_MODE_ENTERED
alt_modes_mngr.h, 70
AM_EVT_ALT_MODE_EXITED
alt_modes_mngr.h, 70
AM_EVT_ALT_MODE_SUPP
alt_modes_mngr.h, 70
AM_EVT_CBL_NOT_SUPP_ALT_MODE
alt_modes_mngr.h, 70
AM_EVT_CBL_RESP_FAILED
alt_modes_mngr.h, 70
AM_EVT_DATA_EVT
alt_modes_mngr.h, 70
AM_EVT_DISC_FINISHED
alt_modes_mngr.h, 70
AM_EVT_NOT_SUPP_PARTNER_CAP
alt_modes_mngr.h, 70
AM_EVT_SOP_RESP_FAILED
alt_modes_mngr.h, 70
AM_EVT_SVID_NOT_FOUND
alt_modes_mngr.h, 70
AM_EVT_SVID_NOT_SUPP
alt_modes_mngr.h, 70
AM_EVT_SVID_SUPP
alt_modes_mngr.h, 70
AM_NO_CMD
alt_modes_mngr.h, 70
AM_NO_EVT
alt_modes_mngr.h, 70
AR_REG_CCG_COMMAND
ar_slave.h, 106
AR_REG_CCG_STATUS
ar_slave.h, 106
AR_SLAVE_ADDR_MASK
ar_slave.h, 106
AUTO_CTRL_MESSAGE_GOODCRC_MASK_CFG
pdss_hal.h, 143
act_link_train
ar_reg_t::USBPD_STATUS_REG, 58
active_boot_app
sys_fw_metadata_t, 55
active_cbl
ar_reg_t::USBPD_STATUS_REG, 58
active_modes
bm_alt_modes_t, 27
alp_ridge.h
ar_set_mux, 63
alt_mode
alt_mode_evt_t::ALT_MODE_EVT, 17
alt_mode_app_cbk_t
alt_modes_mngr.h, 69
alt_mode_app_cmd_t
alt_modes_mngr.h, 70
alt_mode_app_evt_t
alt_modes_mngr.h, 70
alt_mode_cbk_t
alt_modes_mngr.h, 69
alt_mode_cmd_info_t, 15
alt_mode_id, 15
app_evt_data, 15
app_evt_needed, 15
192
cbk, 16
cbl_obj_pos, 16
custom_att_obj_pos, 16
data_role, 16
eval_app_cmd, 16
is_active, 16
mode_state, 16
obj_pos, 16
sop_state, 16
vdm_header, 16
vdo, 16
vdo_max_numb, 16
vdo_numb, 17
alt_mode_entered
app_status_t, 21
alt_mode_event
alt_mode_evt_t, 19
alt_mode_event_data
alt_mode_evt_t, 19
alt_mode_evt
alt_mode_evt_t::ALT_MODE_EVT, 17
alt_mode_evt_t, 18
alt_mode_event, 19
alt_mode_event_data, 19
val, 19
alt_mode_evt_t::ALT_MODE_EVT_DATA, 18
evt_data, 18
evt_type, 18
alt_mode_evt_t::ALT_MODE_EVT, 17
alt_mode, 17
alt_mode_evt, 17
data_role, 17
svid, 17
alt_mode_hw.h
ALT_MODE_HPD, 65
ALT_MODE_MUX, 65
alt_mode_hw_deinit, 65
alt_mode_hw_is_idle, 65
alt_mode_hw_set_cbk, 65
alt_mode_hw_sleep, 66
alt_mode_hw_t, 64
alt_mode_hw_wakeup, 66
eval_app_alt_hw_cmd, 66
eval_hpd_cmd, 66
eval_mux_cmd, 67
MUX_CONFIG_2_0, 65
MUX_CONFIG_AR_CUSTOM, 65
MUX_CONFIG_DEINIT, 65
MUX_CONFIG_DP_2_LANE, 65
MUX_CONFIG_DP_4_LANE, 65
MUX_CONFIG_INIT, 65
MUX_CONFIG_ISOLATE, 65
MUX_CONFIG_SS_ONLY, 65
mux_select_t, 65
set_mux, 67
alt_mode_hw_deinit
alt_mode_hw.h, 65
alt_mode_hw_evt_t, 20
INDEX
hw_evt, 20
val, 20
alt_mode_hw_evt_t::ALT_MODE_HW_EVT, 19
data_role, 19
evt_data, 19
hw_type, 19
alt_mode_hw_is_idle
alt_mode_hw.h, 65
alt_mode_hw_set_cbk
alt_mode_hw.h, 65
alt_mode_hw_sleep
alt_mode_hw.h, 66
alt_mode_hw_t
alt_mode_hw.h, 64
alt_mode_hw_wakeup
alt_mode_hw.h, 66
alt_mode_id
alt_mode_cmd_info_t, 15
comp_tbl_t, 28
disc_mode_info_t, 30
alt_mode_mngr_state_t
alt_modes_mngr.h, 70
alt_mode_state_t
alt_modes_mngr.h, 71
alt_mode_trigger
app_status_t, 21
alt_modes_mngr.h
ALT_MODE_MNGR_STATE_DISC_MODE, 71
ALT_MODE_MNGR_STATE_EXIT, 71
ALT_MODE_MNGR_STATE_PROCESS, 71
ALT_MODE_MNGR_WAIT_EC_TRIGGER, 71
ALT_MODE_STATE_DISABLE, 71
ALT_MODE_STATE_EXIT, 71
ALT_MODE_STATE_FAIL, 71
ALT_MODE_STATE_IDLE, 71
ALT_MODE_STATE_INIT, 71
ALT_MODE_STATE_RUN, 71
ALT_MODE_STATE_SEND, 71
ALT_MODE_STATE_WAIT_FOR_RESP, 71
AM_CMD_DIS_TRIG, 70
AM_CMD_EN_TRIG, 70
AM_CMD_ENTER, 70
AM_CMD_EXIT, 70
AM_CMD_SPEC, 70
AM_EVT_ALT_MODE_ENTERED, 70
AM_EVT_ALT_MODE_EXITED, 70
AM_EVT_ALT_MODE_SUPP, 70
AM_EVT_CBL_NOT_SUPP_ALT_MODE, 70
AM_EVT_CBL_RESP_FAILED, 70
AM_EVT_DATA_EVT, 70
AM_EVT_DISC_FINISHED, 70
AM_EVT_NOT_SUPP_PARTNER_CAP, 70
AM_EVT_SOP_RESP_FAILED, 70
AM_EVT_SVID_NOT_FOUND, 70
AM_EVT_SVID_NOT_SUPP, 70
AM_EVT_SVID_SUPP, 70
AM_NO_CMD, 70
AM_NO_EVT, 70
Generated for CCGx Firmware Stack by Doxygen
INDEX
alt_mode_app_cbk_t, 69
alt_mode_app_cmd_t, 70
alt_mode_app_evt_t, 70
alt_mode_cbk_t, 69
alt_mode_mngr_state_t, 70
alt_mode_state_t, 71
dfp_alt_mode_mngr_sleep, 71
dfp_alt_mode_mngr_wakeup, 71
eval_app_alt_mode_cmd, 72
eval_rec_vdm, 72
form_alt_mode_event, 72
get_vdm_buff, 72
is_dfp_alt_mode_mngr_idle, 73
is_svid_supported, 73
reg_src_alt_mode, 73
reset_alt_mode_info, 74
ufp_alt_mode_idle, 74
ufp_alt_mode_mng_deinit, 74
ufp_alt_mode_mngr, 74
vdm_task_mng_alt_mode_process, 75
alt_status
bb_handle_t, 25
ama_vdo
atch_tgt_info_t, 24
app.h
app_event_handler, 82
app_get_callback_ptr, 82
app_get_resp_buf, 82
app_get_status, 83
app_init, 83
app_is_cbl_disc_done, 83
app_sleep, 83
app_task, 84
app_wakeup, 84
mux_ctrl_init, 84
mux_ctrl_set_cfg, 84
sln_pd_event_handler, 84
system_sleep, 85
app/alt_mode/alp_ridge.h, 63
app/alt_mode/alt_mode_hw.h, 64
app/alt_mode/alt_modes_mngr.h, 67
app/alt_mode/dfp_vdm_task_mngr.h, 75
app/alt_mode/dp_sid.h, 78
app/alt_mode/intel_vid.h, 80
app/app.h, 81
app/billboard.h, 85
app/hal_ccgx.h, 90
app/pdo.h, 92
app/psink.h, 93
app/psource.h, 94
app/swap.h, 97
app/usb_vendor.h, 99
app/uvdm.h, 101
app/vdm.h, 103
app_cbk
dpm_status_t, 33
app_cbk_t, 20
app_event_handler
Generated for CCGx Firmware Stack by Doxygen
193
app.h, 82
app_evt
disc_mode_info_t, 30
app_evt_data
alt_mode_cmd_info_t, 15
app_evt_needed
alt_mode_cmd_info_t, 15
app_get_callback_ptr
app.h, 82
app_get_resp_buf
app.h, 82
app_get_status
app.h, 83
app_init
app.h, 83
app_is_cbl_disc_done
app.h, 83
app_resp
app_status_t, 22
app_resp_t, 21
app_sleep
app.h, 83
app_status_t, 21
alt_mode_entered, 21
alt_mode_trigger, 21
app_resp, 22
cbl_disc_id_finished, 22
disc_id_resp, 22
is_vbus_on, 22
is_vconn_on, 22
psrc_rising, 22
psrc_volt, 22
psrc_volt_old, 22
pwr_ready_cbk, 22
ufp_alt_mode_allowed, 22
vdm_resp, 22
vdm_task_en, 22
app_task
app.h, 84
app_wakeup
app.h, 84
ar_reg_t, 23
ar_status, 23
usbpd_cmd_reg, 23
val, 23
ar_reg_t::USBPD_CMD_REG, 57
host_conn, 57
intrpt_ack, 57
rsvd, 57
soft_rst, 57
ar_reg_t::USBPD_STATUS_REG, 58
act_link_train, 58
active_cbl, 58
cbl_type, 58
conn_orien, 59
data_conn_pres, 59
dp_conn, 59
dp_pin_assign, 59
194
dp_role, 59
force_lsx, 59
ovc_indn, 59
rsvd1, 59
rsvd2, 59
rsvd3, 59
rsvd4, 59
rsvd5, 59
tbt_cbl_gen, 60
tbt_cbl_spd, 60
tbt_conn, 60
tbt_type, 60
usb2_conn, 60
usb3_conn, 60
usb3_speed, 60
usb_dr, 60
ar_set_mux
alp_ridge.h, 63
ar_slave.h
AR_REG_CCG_COMMAND, 106
AR_REG_CCG_STATUS, 106
AR_SLAVE_ADDR_MASK, 106
ar_slave_init, 106
ar_slave_reg_addr_t, 106
ar_slave_sleep, 106
ar_slave_status_update, 106
ar_slave/ar_slave.h, 105
ar_slave_init
ar_slave.h, 106
ar_slave_reg_addr_t
ar_slave.h, 106
ar_slave_sleep
ar_slave.h, 106
ar_slave_status_update
ar_slave.h, 106
ar_status
ar_reg_t, 23
atch_tgt_info
disc_mode_info_t, 30
atch_tgt_info_t, 23
ama_vdo, 24
cbl_svid, 24
cbl_vdo, 24
tgt_id_header, 24
tgt_svid, 24
atch_type
disc_mode_info_t, 30
attach
dpm_status_t, 33
attached_dev
dpm_status_t, 34
BB_ALT_MODE1_STRING_INDEX
billboard.h, 88
BB_ALT_MODE2_STRING_INDEX
billboard.h, 88
BB_ALT_MODE3_STRING_INDEX
billboard.h, 88
BB_ALT_MODE4_STRING_INDEX
INDEX
billboard.h, 88
BB_ALT_MODE5_STRING_INDEX
billboard.h, 88
BB_ALT_MODE6_STRING_INDEX
billboard.h, 88
BB_ALT_MODE7_STRING_INDEX
billboard.h, 88
BB_ALT_MODE8_STRING_INDEX
billboard.h, 88
BB_ALT_MODE_STAT_ERROR
billboard.h, 87
BB_ALT_MODE_STAT_NOT_ATTEMPTED
billboard.h, 87
BB_ALT_MODE_STAT_SUCCESSFUL
billboard.h, 87
BB_ALT_MODE_STAT_UNSUCCESSFUL
billboard.h, 87
BB_ALT_MODE_STATUS_INIT_VAL
billboard.h, 86
BB_BB_INF_STRING_INDEX
billboard.h, 88
BB_CAUSE_AME_FAILURE
billboard.h, 87
BB_CAUSE_AME_SUCCESS
billboard.h, 87
BB_CAUSE_AME_TIMEOUT
billboard.h, 87
BB_CONFIG_STRING_INDEX
billboard.h, 88
BB_HID_INF_STRING_INDEX
billboard.h, 88
BB_LANG_ID_STRING_INDEX
billboard.h, 88
BB_MAX_EP0_XFER_SIZE
billboard.h, 86
BB_MFG_STRING_INDEX
billboard.h, 88
BB_ON_TIMER_PERIOD
billboard.h, 86
BB_PROD_STRING_INDEX
billboard.h, 88
BB_SERIAL_STRING_INDEX
billboard.h, 88
BB_STATE_BILLBOARD
billboard.h, 87
BB_STATE_DEINITED
billboard.h, 87
BB_STATE_DISABLED
billboard.h, 87
BB_STATE_FLASHING
billboard.h, 87
BB_TYPE_EXTERNAL
billboard.h, 87
BB_TYPE_INTERNAL
billboard.h, 87
BB_TYPE_NONE
billboard.h, 87
BB_URL_STRING_INDEX
Generated for CCGx Firmware Stack by Doxygen
INDEX
billboard.h, 88
BUS_IDLE_CNT_VAL
pdss_hal.h, 143
bb_alt_mode_status_t
billboard.h, 87
bb_cause_t
billboard.h, 87
bb_disable
billboard.h, 88
bb_enable
billboard.h, 88
bb_enabling_flashing
billboard.h, 89
bb_handle_t, 25
alt_status, 25
ep0_buffer, 25
num_alt_modes, 25
queue_disable, 25
queue_enable, 26
queue_state, 26
state, 26
timeout, 26
type, 26
usb_port, 26
bb_init
billboard.h, 89
bb_is_present
billboard.h, 89
bb_state_t
billboard.h, 87
bb_task
billboard.h, 90
bb_type_t
billboard.h, 87
bb_update_alt_status
billboard.h, 90
bb_usb_string_index_t
billboard.h, 87
billboard.h
BB_ALT_MODE1_STRING_INDEX, 88
BB_ALT_MODE2_STRING_INDEX, 88
BB_ALT_MODE3_STRING_INDEX, 88
BB_ALT_MODE4_STRING_INDEX, 88
BB_ALT_MODE5_STRING_INDEX, 88
BB_ALT_MODE6_STRING_INDEX, 88
BB_ALT_MODE7_STRING_INDEX, 88
BB_ALT_MODE8_STRING_INDEX, 88
BB_ALT_MODE_STAT_ERROR, 87
BB_ALT_MODE_STAT_NOT_ATTEMPTED, 87
BB_ALT_MODE_STAT_SUCCESSFUL, 87
BB_ALT_MODE_STAT_UNSUCCESSFUL, 87
BB_ALT_MODE_STATUS_INIT_VAL, 86
BB_BB_INF_STRING_INDEX, 88
BB_CAUSE_AME_FAILURE, 87
BB_CAUSE_AME_SUCCESS, 87
BB_CAUSE_AME_TIMEOUT, 87
BB_CONFIG_STRING_INDEX, 88
BB_HID_INF_STRING_INDEX, 88
Generated for CCGx Firmware Stack by Doxygen
195
BB_LANG_ID_STRING_INDEX, 88
BB_MAX_EP0_XFER_SIZE, 86
BB_MFG_STRING_INDEX, 88
BB_ON_TIMER_PERIOD, 86
BB_PROD_STRING_INDEX, 88
BB_SERIAL_STRING_INDEX, 88
BB_STATE_BILLBOARD, 87
BB_STATE_DEINITED, 87
BB_STATE_DISABLED, 87
BB_STATE_FLASHING, 87
BB_TYPE_EXTERNAL, 87
BB_TYPE_INTERNAL, 87
BB_TYPE_NONE, 87
BB_URL_STRING_INDEX, 88
bb_alt_mode_status_t, 87
bb_cause_t, 87
bb_disable, 88
bb_enable, 88
bb_enabling_flashing, 89
bb_init, 89
bb_is_present, 89
bb_state_t, 87
bb_task, 90
bb_type_t, 87
bb_update_alt_status, 90
bb_usb_string_index_t, 87
bm_alt_modes_t, 26
active_modes, 27
exited_modes, 27
supported_modes, 27
boot.h
boot_check_for_valid_fw, 166
boot_get_boot_seq, 166
boot_get_wait_time, 166
boot_handle_validate_fw_cmd, 166
boot_jump_to_fw, 167
boot_start, 167
boot_validate_configtable, 167
boot_validate_fw, 167
get_boot_mode_reason, 168
boot_app_id
sys_fw_metadata_t, 55
boot_app_ver_status
sys_fw_metadata_t, 55
boot_app_version
sys_fw_metadata_t, 56
boot_check_for_valid_fw
boot.h, 166
boot_get_boot_seq
boot.h, 166
boot_get_wait_time
boot.h, 166
boot_handle_validate_fw_cmd
boot.h, 166
boot_jump_to_fw
boot.h, 167
boot_last_row
sys_fw_metadata_t, 56
196
boot_mode_request
fw_img_status_t::FwModeReason, 44
boot_seq
sys_fw_metadata_t, 56
boot_start
boot.h, 167
boot_validate_configtable
boot.h, 167
boot_validate_fw
boot.h, 167
bootup
dpm_status_t, 34
buf_size
i2c_scb_config_t, 45
buffer
i2c_scb_config_t, 45
CCG_STAT_BAD_PARAM
status.h, 181
CCG_STAT_BUSY
status.h, 181
CCG_STAT_CMD_FAILURE
status.h, 181
CCG_STAT_FAILURE
status.h, 181
CCG_STAT_FLASH_DATA_AVAILABLE
status.h, 181
CCG_STAT_FLASH_UPDATE_FAILED
status.h, 181
CCG_STAT_INVALID_ARGUMENT
status.h, 181
CCG_STAT_INVALID_COMMAND
status.h, 181
CCG_STAT_INVALID_FW
status.h, 181
CCG_STAT_INVALID_SIGNATURE
status.h, 181
CCG_STAT_NO_RESPONSE
status.h, 181
CCG_STAT_NOT_READY
status.h, 181
CCG_STAT_NOT_SUPPORTED
status.h, 181
CCG_STAT_READ_DATA
status.h, 181
CCG_STAT_SUCCESS
status.h, 181
CCG_STAT_TIMEOUT
status.h, 181
CCG_STAT_TRANS_FAILURE
status.h, 181
CCG_STATUS_CODE_OFFSET
status.h, 181
CRC_COUNTER_CFG
pdss_hal.h, 143
cb
ccg_timer_t, 28
cb_fun_ptr
i2c_scb_config_t, 45
INDEX
cbk
alt_mode_cmd_info_t, 16
cbl_disc_id_finished
app_status_t, 22
cbl_dsc
dpm_status_t, 34
cbl_obj_pos
alt_mode_cmd_info_t, 16
cbl_soft_reset_tried
dpm_status_t, 34
cbl_sop_flag
disc_mode_info_t, 30
cbl_state
dpm_status_t, 34
cbl_svid
atch_tgt_info_t, 24
cbl_type
ar_reg_t::USBPD_STATUS_REG, 58
dpm_status_t, 34
cbl_vdo
atch_tgt_info_t, 24
dpm_status_t, 34
cbl_wait
dpm_status_t, 34
cc_live
dpm_status_t, 34
cc_old_status
dpm_status_t, 34
cc_rd_status
dpm_status_t, 34
cc_state_t, 27
cc_status
dpm_status_t, 34
ccg4_version.h
FW_BASE_VERSION, 168
ccg_status_t
status.h, 181
ccg_timer_t, 27
cb, 28
count, 28
id, 28
period, 28
clock_freq
i2c_scb_config_t, 45
cmd
vdm_msg_info_t, 62
cmd_do
dpm_pd_cmd_buf_t, 31
cmd_p
dpm_status_t, 35
cmd_sop
dpm_pd_cmd_buf_t, 31
comp_tbl_t, 28
alt_mode_id, 28
svid, 28
conn_orien
ar_reg_t::USBPD_STATUS_REG, 59
connect
Generated for CCGx Firmware Stack by Doxygen
INDEX
dpm_status_t, 35
contract
dpm_status_t, 35
contract_exist
dpm_status_t, 35
contract_t, 29
val, 29
contract_t::FIELD, 42
cur_pwr, 42
volt, 42
count
ccg_timer_t, 28
crc16
utils.h, 189
cur_port_role
dpm_status_t, 35
cur_port_type
dpm_status_t, 35
cur_pwr
contract_t::FIELD, 42
cur_snk_max_min
dpm_status_t, 35
cur_snk_pdo
dpm_status_t, 35
cur_snk_pdo_count
dpm_status_t, 35
cur_src_pdo
dpm_status_t, 35
cur_src_pdo_count
dpm_status_t, 35
custom_att_obj_pos
alt_mode_cmd_info_t, 16
DFP_TASK_ALT_MODE
dfp_vdm_task_mngr.h, 76
DFP_TASK_DISC_ID
dfp_vdm_task_mngr.h, 76
DFP_TASK_DISC_SVID
dfp_vdm_task_mngr.h, 76
DFP_TASK_EXIT
dfp_vdm_task_mngr.h, 76
DFP_TASK_INIT
dfp_vdm_task_mngr.h, 76
DFP_TASK_REG_ATCH_TGT_INFO
dfp_vdm_task_mngr.h, 76
DFP_TASK_SEND_MSG
dfp_vdm_task_mngr.h, 76
DFP_TASK_WAIT
dfp_vdm_task_mngr.h, 76
DP_CBL
intel_vid.h, 80
DP_CONN_BOTH
dp_sid.h, 79
DP_CONN_DFP_D
dp_sid.h, 79
DP_CONN_NONE
dp_sid.h, 79
DP_CONN_UFP_D
dp_sid.h, 79
Generated for CCGx Firmware Stack by Doxygen
197
DP_PORT_CAP_BOTH
dp_sid.h, 79
DP_PORT_CAP_DFP_D
dp_sid.h, 79
DP_PORT_CAP_RSVD
dp_sid.h, 79
DP_PORT_CAP_UFP_D
dp_sid.h, 79
DP_STATE_ATT
dp_sid.h, 79
DP_STATE_CONFIG
dp_sid.h, 79
DP_STATE_ENTER
dp_sid.h, 79
DP_STATE_EXIT
dp_sid.h, 79
DP_STATE_IDLE
dp_sid.h, 79
DP_STATE_STATUS_UPDATE
dp_sid.h, 79
DRP_TOGGLE_PERIOD
pd.h, 132
data_conn_pres
ar_reg_t::USBPD_STATUS_REG, 59
data_role
alt_mode_cmd_info_t, 16
alt_mode_evt_t::ALT_MODE_EVT, 17
alt_mode_hw_evt_t::ALT_MODE_HW_EVT, 19
disc_mode_info_t, 30
db_support
dpm_status_t, 35
dead_bat
dpm_status_t, 36
dflt_port_role
dpm_status_t, 36
dfp_alt_mode_mngr_sleep
alt_modes_mngr.h, 71
dfp_alt_mode_mngr_wakeup
alt_modes_mngr.h, 71
dfp_vdm_evt_t
dfp_vdm_task_mngr.h, 76
dfp_vdm_task_idle
dfp_vdm_task_mngr.h, 76
dfp_vdm_task_mngr
dfp_vdm_task_mngr.h, 76
dfp_vdm_task_mngr.h
DFP_TASK_ALT_MODE, 76
DFP_TASK_DISC_ID, 76
DFP_TASK_DISC_SVID, 76
DFP_TASK_EXIT, 76
DFP_TASK_INIT, 76
DFP_TASK_REG_ATCH_TGT_INFO, 76
DFP_TASK_SEND_MSG, 76
DFP_TASK_WAIT, 76
dfp_vdm_evt_t, 76
dfp_vdm_task_idle, 76
dfp_vdm_task_mngr, 76
dfp_vdm_task_t, 76
198
enable_vdm_task_mng, 77
eval_attention, 77
VDM_EVT_EVAL, 76
VDM_EVT_EXIT, 76
VDM_EVT_FAIL, 76
VDM_EVT_RUN, 76
vdm_task_mng_deinit, 77
dfp_vdm_task_t
dfp_vdm_task_mngr.h, 76
disc_id_resp
app_status_t, 22
disc_mode_info_t, 29
alt_mode_id, 30
app_evt, 30
atch_tgt_info, 30
atch_type, 30
cbl_sop_flag, 30
data_role, 30
svid_emca_vdo, 30
svid_vdo, 30
vdo_pos, 30
dp_conn
ar_reg_t::USBPD_STATUS_REG, 59
dp_conn_t
dp_sid.h, 79
dp_pin_assign
ar_reg_t::USBPD_STATUS_REG, 59
dp_port_cap_t
dp_sid.h, 79
dp_role
ar_reg_t::USBPD_STATUS_REG, 59
dp_sid.h
DP_CONN_BOTH, 79
DP_CONN_DFP_D, 79
DP_CONN_NONE, 79
DP_CONN_UFP_D, 79
DP_PORT_CAP_BOTH, 79
DP_PORT_CAP_DFP_D, 79
DP_PORT_CAP_RSVD, 79
DP_PORT_CAP_UFP_D, 79
DP_STATE_ATT, 79
DP_STATE_CONFIG, 79
DP_STATE_ENTER, 79
DP_STATE_EXIT, 79
DP_STATE_IDLE, 79
DP_STATE_STATUS_UPDATE, 79
dp_conn_t, 79
dp_port_cap_t, 79
dp_state_t, 79
reg_dp_modes, 79
dp_state_t
dp_sid.h, 79
dpm.h
dpm_deepsleep, 113
dpm_get_info, 113
dpm_get_polarity, 114
dpm_init, 114
dpm_is_rdo_valid, 114
INDEX
dpm_pd_command, 114
dpm_sleep, 115
dpm_start, 115
dpm_stop, 115
dpm_task, 115
dpm_typec_command, 116
dpm_typec_deassert_rp_rd, 116
dpm_update_db_support, 116
dpm_update_port_config, 117
dpm_update_snk_cap, 117
dpm_update_snk_cap_mask, 117
dpm_update_snk_max_min, 117
dpm_update_src_cap, 118
dpm_update_src_cap_mask, 118
dpm_update_swap_response, 118
dpm_wakeup, 119
dpm_cmd_buf
dpm_status_t, 36
dpm_deepsleep
dpm.h, 113
dpm_enabled
dpm_status_t, 36
dpm_get_evtno_n_clear
dpm_intern.h, 119
dpm_get_info
dpm.h, 113
dpm_get_polarity
dpm.h, 114
dpm_get_status
dpm_intern.h, 119
dpm_init
dpm.h, 114
dpm_intern.h
dpm_get_evtno_n_clear, 119
dpm_get_status, 119
dpm_is_prev_contract_valid, 120
dpm_refresh_snk_cap, 120
dpm_refresh_src_cap, 120
dpm_is_prev_contract_valid
dpm_intern.h, 120
dpm_is_rdo_valid
dpm.h, 114
dpm_pd_cbk
dpm_status_t, 36
dpm_pd_cmd
dpm_status_t, 36
dpm_pd_cmd_active
dpm_status_t, 36
dpm_pd_cmd_buf_t, 31
cmd_do, 31
cmd_sop, 31
no_of_cmd_do, 31
dpm_pd_command
dpm.h, 114
dpm_refresh_snk_cap
dpm_intern.h, 120
dpm_refresh_src_cap
dpm_intern.h, 120
Generated for CCGx Firmware Stack by Doxygen
INDEX
dpm_safe_disable
dpm_status_t, 36
dpm_sleep
dpm.h, 115
dpm_start
dpm.h, 115
dpm_status_t, 32
app_cbk, 33
attach, 33
attached_dev, 34
bootup, 34
cbl_dsc, 34
cbl_soft_reset_tried, 34
cbl_state, 34
cbl_type, 34
cbl_vdo, 34
cbl_wait, 34
cc_live, 34
cc_old_status, 34
cc_rd_status, 34
cc_status, 34
cmd_p, 35
connect, 35
contract, 35
contract_exist, 35
cur_port_role, 35
cur_port_type, 35
cur_snk_max_min, 35
cur_snk_pdo, 35
cur_snk_pdo_count, 35
cur_src_pdo, 35
cur_src_pdo_count, 35
db_support, 35
dead_bat, 36
dflt_port_role, 36
dpm_cmd_buf, 36
dpm_enabled, 36
dpm_pd_cbk, 36
dpm_pd_cmd, 36
dpm_pd_cmd_active, 36
dpm_safe_disable, 36
dpm_typec_cbk, 36
dpm_typec_cmd, 36
dpm_typec_cmd_active, 36
drp_period, 36
emca_present, 37
err_recov, 37
is_snk_bat, 37
is_src_bat, 37
pd_connected, 37
pd_disabled, 37
pd_support, 37
pe_bcm2_ams_state, 37
pe_btd_ams_state, 37
pe_dr_ams_state, 37
pe_evt, 37
pe_fsm, 37
pe_gn_ams_state, 38
Generated for CCGx Firmware Stack by Doxygen
199
pe_hr_ams_state, 38
pe_pr_ams_state, 38
pe_snk_ams_state, 38
pe_sr_ams_state, 38
pe_src_ams_state, 38
pe_vs_ams_state, 38
polarity, 38
port_disable, 38
port_role, 38
ra_present, 38
reserved_2, 39
reserved_3, 39
rev_pol, 39
role_at_connect, 39
rp_supported, 39
skip_scan, 39
snk_cur_level, 39
snk_max_min, 39
snk_pdo, 39
snk_pdo_count, 39
snk_pdo_mask, 40
snk_period, 40
snk_rdo, 40
snk_sel_pdo, 40
snk_usb_comm_en, 40
snk_usb_susp_en, 40
src_cur_level, 40
src_pdo, 40
src_pdo_count, 40
src_pdo_mask, 40
src_period, 40
src_rdo, 40
src_sel_pdo, 41
swap_response, 41
toggle, 41
try_src, 41
typec_evt, 41
typec_fsm, 41
typec_gn_fsm_state, 41
vconn_actual, 41
vconn_logical, 41
dpm_stop
dpm.h, 115
dpm_task
dpm.h, 115
dpm_typec_cbk
dpm_status_t, 36
dpm_typec_cmd
dpm_status_t, 36
dpm_typec_cmd_active
dpm_status_t, 36
dpm_typec_command
dpm.h, 116
dpm_typec_deassert_rp_rd
dpm.h, 116
dpm_update_db_support
dpm.h, 116
dpm_update_port_config
200
dpm.h, 117
dpm_update_snk_cap
dpm.h, 117
dpm_update_snk_cap_mask
dpm.h, 117
dpm_update_snk_max_min
dpm.h, 117
dpm_update_src_cap
dpm.h, 118
dpm_update_src_cap_mask
dpm.h, 118
dpm_update_swap_response
dpm.h, 118
dpm_wakeup
dpm.h, 119
drp_period
dpm_status_t, 36
EXPECTED_GOOD_CRC_CLEAR_MASK
pdss_hal.h, 143
EXPECTED_GOOD_CRC_HDR_MASK
pdss_hal.h, 143
emca_present
dpm_status_t, 37
enable_vdm_task_mng
dfp_vdm_task_mngr.h, 77
ep0_buffer
bb_handle_t, 25
err_recov
dpm_status_t, 37
eval_app_alt_hw_cmd
alt_mode_hw.h, 66
eval_app_alt_mode_cmd
alt_modes_mngr.h, 72
eval_app_cmd
alt_mode_cmd_info_t, 16
eval_attention
dfp_vdm_task_mngr.h, 77
eval_dr_swap
swap.h, 98
eval_hpd_cmd
alt_mode_hw.h, 66
eval_mux_cmd
alt_mode_hw.h, 67
eval_pr_swap
swap.h, 98
eval_rdo
pdo.h, 92
eval_rec_vdm
alt_modes_mngr.h, 72
eval_src_cap
pdo.h, 92
eval_vconn_swap
swap.h, 98
eval_vdm
vdm.h, 104
evt_data
alt_mode_evt_t::ALT_MODE_EVT_DATA, 18
alt_mode_hw_evt_t::ALT_MODE_HW_EVT, 19
INDEX
evt_type
alt_mode_evt_t::ALT_MODE_EVT_DATA, 18
exited_modes
bm_alt_modes_t, 27
FLASH_APP_PRIORITY_DEFAULT
flash.h, 170
FLASH_APP_PRIORITY_IMAGE_1
flash.h, 170
FLASH_APP_PRIORITY_IMAGE_2
flash.h, 170
FLASH_IF_HPI
flash.h, 170
FLASH_IF_IECS_UART
flash.h, 170
FLASH_IF_USB_VENDOR
flash.h, 170
FLASH_IF_UVDM
flash.h, 170
FLASH_WRITE_ABORTED
flash.h, 170
FLASH_WRITE_COMPLETE_AND_ABORTED
flash.h, 170
FLASH_WRITE_COMPLETE
flash.h, 170
FLASH_WRITE_IN_PROGRESS
flash.h, 170
FW_BASE_VERSION
ccg4_version.h, 168
flash.h
FLASH_APP_PRIORITY_DEFAULT, 170
FLASH_APP_PRIORITY_IMAGE_1, 170
FLASH_APP_PRIORITY_IMAGE_2, 170
FLASH_IF_HPI, 170
FLASH_IF_IECS_UART, 170
FLASH_IF_USB_VENDOR, 170
FLASH_IF_UVDM, 170
FLASH_WRITE_ABORTED, 170
FLASH_WRITE_COMPLETE_AND_ABORTED,
170
FLASH_WRITE_COMPLETE, 170
FLASH_WRITE_IN_PROGRESS, 170
flash_access_enabled, 170
flash_app_priority_t, 169
flash_cbk_t, 169
flash_enter_mode, 170
flash_interface_t, 170
flash_row_clear, 171
flash_row_read, 171
flash_row_write, 171
flash_set_access_limits, 172
flash_set_app_priority, 172
flash_write_status_t, 170
flash_access_enabled
flash.h, 170
flash_app_priority_t
flash.h, 169
flash_cbk_t
flash.h, 169
Generated for CCGx Firmware Stack by Doxygen
INDEX
flash_enter_mode
flash.h, 170
flash_interface_t
flash.h, 170
flash_row_clear
flash.h, 171
flash_row_read
flash.h, 171
flash_row_write
flash.h, 171
flash_set_access_limits
flash.h, 172
flash_set_app_priority
flash.h, 172
flash_write_status_t
flash.h, 170
force_lsx
ar_reg_t::USBPD_STATUS_REG, 59
form_alt_mode_event
alt_modes_mngr.h, 72
fw1_invalid
fw_img_status_t::FwModeReason, 44
fw2_invalid
fw_img_status_t::FwModeReason, 44
fw_checksum
sys_fw_metadata_t, 56
fw_entry
sys_fw_metadata_t, 56
fw_img_status_t, 43
status, 43
val, 43
fw_img_status_t::FwModeReason, 43
boot_mode_request, 44
fw1_invalid, 44
fw2_invalid, 44
reserved, 44
reserved1, 44
fw_size
sys_fw_metadata_t, 56
fw_version
sys_fw_metadata_t, 56
GPIO_DM_HIZ_ANALOG
gpio.h, 174
GPIO_DM_HIZ_DIGITAL
gpio.h, 174
GPIO_DM_OD_HIGH
gpio.h, 174
GPIO_DM_OD_LOW
gpio.h, 174
GPIO_DM_RES_DWN
gpio.h, 174
GPIO_DM_RES_UPDOWN
gpio.h, 174
GPIO_DM_RES_UP
gpio.h, 174
GPIO_DM_STRONG
gpio.h, 174
GPIO_INTR_BOTH
Generated for CCGx Firmware Stack by Doxygen
201
gpio.h, 174
GPIO_INTR_DISABLE
gpio.h, 174
GPIO_INTR_FALLING
gpio.h, 174
GPIO_INTR_RISING
gpio.h, 174
GPIO_PORT_0_PIN_0
gpio.h, 175
GPIO_PORT_0_PIN_1
gpio.h, 175
GPIO_PORT_0_PIN_2
gpio.h, 175
GPIO_PORT_0_PIN_3
gpio.h, 175
GPIO_PORT_0_PIN_4
gpio.h, 175
GPIO_PORT_0_PIN_5
gpio.h, 175
GPIO_PORT_0_PIN_6
gpio.h, 175
GPIO_PORT_0_PIN_7
gpio.h, 175
GPIO_PORT_1_PIN_0
gpio.h, 175
GPIO_PORT_1_PIN_1
gpio.h, 175
GPIO_PORT_1_PIN_2
gpio.h, 175
GPIO_PORT_1_PIN_3
gpio.h, 175
GPIO_PORT_1_PIN_4
gpio.h, 175
GPIO_PORT_1_PIN_5
gpio.h, 175
GPIO_PORT_1_PIN_6
gpio.h, 175
GPIO_PORT_1_PIN_7
gpio.h, 175
GPIO_PORT_2_PIN_0
gpio.h, 175
GPIO_PORT_2_PIN_1
gpio.h, 175
GPIO_PORT_2_PIN_2
gpio.h, 175
GPIO_PORT_2_PIN_3
gpio.h, 175
GPIO_PORT_2_PIN_4
gpio.h, 175
GPIO_PORT_2_PIN_5
gpio.h, 175
GPIO_PORT_2_PIN_6
gpio.h, 175
GPIO_PORT_2_PIN_7
gpio.h, 175
GPIO_PORT_3_PIN_0
gpio.h, 175
GPIO_PORT_3_PIN_1
202
gpio.h, 175
GPIO_PORT_3_PIN_2
gpio.h, 175
GPIO_PORT_3_PIN_3
gpio.h, 175
GPIO_PORT_3_PIN_4
gpio.h, 175
GPIO_PORT_3_PIN_5
gpio.h, 175
GPIO_PORT_3_PIN_6
gpio.h, 175
GPIO_PORT_3_PIN_7
gpio.h, 175
GPIO_PORT_4_PIN_0
gpio.h, 175
GPIO_PORT_4_PIN_1
gpio.h, 175
GPIO_PORT_4_PIN_2
gpio.h, 175
GPIO_PORT_4_PIN_3
gpio.h, 175
GPIO_PORT_4_PIN_4
gpio.h, 175
GPIO_PORT_4_PIN_5
gpio.h, 175
GPIO_PORT_4_PIN_6
gpio.h, 175
GPIO_PORT_4_PIN_7
gpio.h, 175
get_boot_mode_reason
boot.h, 168
get_pd_config
pd.h, 133
get_pd_port_config
pd.h, 133
get_vdm_buff
alt_modes_mngr.h, 72
gpio.h
GPIO_DM_HIZ_ANALOG, 174
GPIO_DM_HIZ_DIGITAL, 174
GPIO_DM_OD_HIGH, 174
GPIO_DM_OD_LOW, 174
GPIO_DM_RES_DWN, 174
GPIO_DM_RES_UPDOWN, 174
GPIO_DM_RES_UP, 174
GPIO_DM_STRONG, 174
GPIO_INTR_BOTH, 174
GPIO_INTR_DISABLE, 174
GPIO_INTR_FALLING, 174
GPIO_INTR_RISING, 174
GPIO_PORT_0_PIN_0, 175
GPIO_PORT_0_PIN_1, 175
GPIO_PORT_0_PIN_2, 175
GPIO_PORT_0_PIN_3, 175
GPIO_PORT_0_PIN_4, 175
GPIO_PORT_0_PIN_5, 175
GPIO_PORT_0_PIN_6, 175
GPIO_PORT_0_PIN_7, 175
INDEX
GPIO_PORT_1_PIN_0, 175
GPIO_PORT_1_PIN_1, 175
GPIO_PORT_1_PIN_2, 175
GPIO_PORT_1_PIN_3, 175
GPIO_PORT_1_PIN_4, 175
GPIO_PORT_1_PIN_5, 175
GPIO_PORT_1_PIN_6, 175
GPIO_PORT_1_PIN_7, 175
GPIO_PORT_2_PIN_0, 175
GPIO_PORT_2_PIN_1, 175
GPIO_PORT_2_PIN_2, 175
GPIO_PORT_2_PIN_3, 175
GPIO_PORT_2_PIN_4, 175
GPIO_PORT_2_PIN_5, 175
GPIO_PORT_2_PIN_6, 175
GPIO_PORT_2_PIN_7, 175
GPIO_PORT_3_PIN_0, 175
GPIO_PORT_3_PIN_1, 175
GPIO_PORT_3_PIN_2, 175
GPIO_PORT_3_PIN_3, 175
GPIO_PORT_3_PIN_4, 175
GPIO_PORT_3_PIN_5, 175
GPIO_PORT_3_PIN_6, 175
GPIO_PORT_3_PIN_7, 175
GPIO_PORT_4_PIN_0, 175
GPIO_PORT_4_PIN_1, 175
GPIO_PORT_4_PIN_2, 175
GPIO_PORT_4_PIN_3, 175
GPIO_PORT_4_PIN_4, 175
GPIO_PORT_4_PIN_5, 175
GPIO_PORT_4_PIN_6, 175
GPIO_PORT_4_PIN_7, 175
gpio_clear_intr, 176
gpio_dm_t, 174
gpio_get_intr, 176
gpio_hsiom_set_config, 178
gpio_int_set_config, 178
gpio_intr_t, 174
gpio_port_pin_t, 174
gpio_read_value, 178
gpio_set_drv_mode, 179
gpio_set_lvttl_mode, 179
gpio_set_value, 179
HSIOM_MODE_AMUXA, 176
HSIOM_MODE_AMUXB, 176
HSIOM_MODE_DDFT_PIN, 176
HSIOM_MODE_GPIO, 176
HSIOM_MODE_SCB0_I2C, 176
HSIOM_MODE_SCB0_SPI, 176
HSIOM_MODE_SCB0_UART, 176
HSIOM_MODE_SCB1_I2C, 176
HSIOM_MODE_SCB1_SPI, 176
HSIOM_MODE_SCB1_UART, 176
HSIOM_MODE_SCB2_I2C, 176
HSIOM_MODE_SCB2_SPI, 176
HSIOM_MODE_SCB2_UART, 176
HSIOM_MODE_SCB3_I2C, 176
HSIOM_MODE_SCB3_SPI, 176
Generated for CCGx Firmware Stack by Doxygen
INDEX
HSIOM_MODE_SCB3_UART, 176
HSIOM_MODE_SCB_TCPWM_OFLOW, 176
HSIOM_MODE_SWD, 176
HSIOM_MODE_TCPWM_IO, 176
hsiom_mode_t, 175
hsiom_set_config, 180
gpio_clear_intr
gpio.h, 176
gpio_dm_t
gpio.h, 174
gpio_get_intr
gpio.h, 176
gpio_hsiom_set_config
gpio.h, 178
gpio_int_set_config
gpio.h, 178
gpio_intr_t
gpio.h, 174
gpio_port_pin_t
gpio.h, 174
gpio_read_value
gpio.h, 178
gpio_set_drv_mode
gpio.h, 179
gpio_set_lvttl_mode
gpio.h, 179
gpio_set_value
gpio.h, 179
HPD_COMMAND_DONE
hpd.h, 122
HPD_EVENT_IRQ
hpd.h, 122
HPD_EVENT_MASK
hpd.h, 122
HPD_EVENT_NONE
hpd.h, 122
HPD_EVENT_PLUG
hpd.h, 122
HPD_EVENT_UNPLUG
hpd.h, 122
HPI_REG_PART_DATA
hpi.h, 108
HPI_REG_PART_FLASH
hpi.h, 108
HPI_REG_PART_PDDATA_READ
hpi.h, 108
HPI_REG_PART_PDDATA_WRITE
hpi.h, 108
HPI_REG_PART_REG
hpi.h, 108
HPI_REG_SECTION_ALL
hpi.h, 108
HPI_REG_SECTION_DEV
hpi.h, 108
HPI_REG_SECTION_PORT_0
hpi.h, 108
HPI_REG_SECTION_PORT_1
hpi.h, 108
Generated for CCGx Firmware Stack by Doxygen
203
HSIOM_MODE_AMUXA
gpio.h, 176
HSIOM_MODE_AMUXB
gpio.h, 176
HSIOM_MODE_DDFT_PIN
gpio.h, 176
HSIOM_MODE_GPIO
gpio.h, 176
HSIOM_MODE_SCB0_I2C
gpio.h, 176
HSIOM_MODE_SCB0_SPI
gpio.h, 176
HSIOM_MODE_SCB0_UART
gpio.h, 176
HSIOM_MODE_SCB1_I2C
gpio.h, 176
HSIOM_MODE_SCB1_SPI
gpio.h, 176
HSIOM_MODE_SCB1_UART
gpio.h, 176
HSIOM_MODE_SCB2_I2C
gpio.h, 176
HSIOM_MODE_SCB2_SPI
gpio.h, 176
HSIOM_MODE_SCB2_UART
gpio.h, 176
HSIOM_MODE_SCB3_I2C
gpio.h, 176
HSIOM_MODE_SCB3_SPI
gpio.h, 176
HSIOM_MODE_SCB3_UART
gpio.h, 176
HSIOM_MODE_SCB_TCPWM_OFLOW
gpio.h, 176
HSIOM_MODE_SWD
gpio.h, 176
HSIOM_MODE_TCPWM_IO
gpio.h, 176
hal_ccgx.h
system_init, 91
system_vbus_ocp_dis, 91
system_vbus_ocp_en, 91
vbus_ocp_handler, 91
host_conn
ar_reg_t::USBPD_CMD_REG, 57
hpd.h
HPD_COMMAND_DONE, 122
HPD_EVENT_IRQ, 122
HPD_EVENT_MASK, 122
HPD_EVENT_NONE, 122
HPD_EVENT_PLUG, 122
HPD_EVENT_UNPLUG, 122
hpd_deinit, 122
hpd_event_type_t, 122
hpd_receive_init, 122
hpd_sleep_entry, 122
hpd_transmit_init, 123
hpd_transmit_sendevt, 123
204
hpd_wakeup, 123
hpd_deinit
hpd.h, 122
hpd_event_type_t
hpd.h, 122
hpd_receive_init
hpd.h, 122
hpd_sleep_entry
hpd.h, 122
hpd_transmit_init
hpd.h, 123
hpd_transmit_sendevt
hpd.h, 123
hpd_wakeup
hpd.h, 123
hpi.h
HPI_REG_PART_DATA, 108
HPI_REG_PART_FLASH, 108
HPI_REG_PART_PDDATA_READ, 108
HPI_REG_PART_PDDATA_WRITE, 108
HPI_REG_PART_REG, 108
HPI_REG_SECTION_ALL, 108
HPI_REG_SECTION_DEV, 108
HPI_REG_SECTION_PORT_0, 108
HPI_REG_SECTION_PORT_1, 108
hpi_get_port_enable, 108
hpi_init, 108
hpi_is_ec_ready, 109
hpi_is_vdm_ec_ctrl_enabled, 109
hpi_pd_event_handler, 109
hpi_reg_enqueue_event, 109
hpi_reg_part_t, 108
hpi_reg_section_t, 108
hpi_send_fw_ready_event, 110
hpi_set_fixed_slave_address, 110
hpi_set_mode_regs, 110
hpi_set_no_boot_mode, 110
hpi_set_reserved_reg, 111
hpi_sleep, 111
hpi_sleep_allowed, 111
hpi_task, 111
hpi_update_fw_locations, 111
hpi_update_versions, 112
hpid_get_ec_active_modes, 112
hpi_get_port_enable
hpi.h, 108
hpi_init
hpi.h, 108
hpi_is_ec_ready
hpi.h, 109
hpi_is_vdm_ec_ctrl_enabled
hpi.h, 109
hpi_pd_event_handler
hpi.h, 109
hpi_reg_enqueue_event
hpi.h, 109
hpi_reg_part_t
hpi.h, 108
INDEX
hpi_reg_section_t
hpi.h, 108
hpi_send_fw_ready_event
hpi.h, 110
hpi_set_fixed_slave_address
hpi.h, 110
hpi_set_mode_regs
hpi.h, 110
hpi_set_no_boot_mode
hpi.h, 110
hpi_set_reserved_reg
hpi.h, 111
hpi_sleep
hpi.h, 111
hpi_sleep_allowed
hpi.h, 111
hpi_task
hpi.h, 111
hpi_update_fw_locations
hpi.h, 111
hpi_update_versions
hpi.h, 112
hpid_get_ec_active_modes
hpi.h, 112
hpiss/hpi.h, 107
hsiom_mode_t
gpio.h, 175
hsiom_set_config
gpio.h, 180
hw_evt
alt_mode_hw_evt_t, 20
hw_type
alt_mode_hw_evt_t::ALT_MODE_HW_EVT, 19
I2C_BLOCK_COUNT
i2c.h, 161
I2C_CB_CMD_READ
i2c.h, 161
I2C_CB_CMD_TIMEOUT
i2c.h, 161
I2C_CB_CMD_WRITE
i2c.h, 161
I2C_CB_CMD_XFER_END
i2c.h, 161
I2C_SCB_CLOCK_FREQ_100_KHZ
i2c.h, 162
I2C_SCB_CLOCK_FREQ_1_MHZ
i2c.h, 162
I2C_SCB_CLOCK_FREQ_400_KHZ
i2c.h, 162
I2C_SCB_MODE_ALP_RIDGE
i2c.h, 162
I2C_SCB_MODE_HPI
i2c.h, 162
I2C_SCB_MODE_MASTER
i2c.h, 162
I2C_SCB_NUM_STATES
i2c.h, 162
I2C_SCB_STATE_CLK_STRETCH
Generated for CCGx Firmware Stack by Doxygen
INDEX
i2c.h, 162
I2C_SCB_STATE_DISABLED
i2c.h, 162
I2C_SCB_STATE_ERROR
i2c.h, 162
I2C_SCB_STATE_IDLE
i2c.h, 162
I2C_SCB_STATE_INIT
i2c.h, 162
I2C_SCB_STATE_PREAMBLE
i2c.h, 162
I2C_SCB_STATE_READ
i2c.h, 162
I2C_SCB_STATE_WRITE
i2c.h, 162
i2c.h
I2C_BLOCK_COUNT, 161
I2C_CB_CMD_READ, 161
I2C_CB_CMD_TIMEOUT, 161
I2C_CB_CMD_WRITE, 161
I2C_CB_CMD_XFER_END, 161
I2C_SCB_CLOCK_FREQ_100_KHZ, 162
I2C_SCB_CLOCK_FREQ_1_MHZ, 162
I2C_SCB_CLOCK_FREQ_400_KHZ, 162
I2C_SCB_MODE_ALP_RIDGE, 162
I2C_SCB_MODE_HPI, 162
I2C_SCB_MODE_MASTER, 162
I2C_SCB_NUM_STATES, 162
I2C_SCB_STATE_CLK_STRETCH, 162
I2C_SCB_STATE_DISABLED, 162
I2C_SCB_STATE_ERROR, 162
I2C_SCB_STATE_IDLE, 162
I2C_SCB_STATE_INIT, 162
I2C_SCB_STATE_PREAMBLE, 162
I2C_SCB_STATE_READ, 162
I2C_SCB_STATE_WRITE, 162
i2c_cb_cmd_t, 161
i2c_reset, 162
i2c_scb_clock_freq_t, 161
i2c_scb_enable_wakeup, 163
i2c_scb_init, 163
i2c_scb_is_idle, 164
i2c_scb_mode_t, 162
i2c_scb_state_t, 162
i2c_scb_write, 164
i2c_slave_ack_ctrl, 164
i2c_cb_cmd_t
i2c.h, 161
i2c_reset
i2c.h, 162
i2c_scb_clock_freq_t
i2c.h, 161
i2c_scb_config_t, 44
buf_size, 45
buffer, 45
cb_fun_ptr, 45
clock_freq, 45
i2c_state, 45
Generated for CCGx Firmware Stack by Doxygen
205
i2c_write_count, 45
mode, 45
slave_address, 45
slave_mask, 45
i2c_scb_enable_wakeup
i2c.h, 163
i2c_scb_init
i2c.h, 163
i2c_scb_is_idle
i2c.h, 164
i2c_scb_mode_t
i2c.h, 162
i2c_scb_state_t
i2c.h, 162
i2c_scb_write
i2c.h, 164
i2c_slave_ack_ctrl
i2c.h, 164
i2c_state
i2c_scb_config_t, 45
i2c_write_count
i2c_scb_config_t, 45
id
ccg_timer_t, 28
intel_vid.h
DP_CBL, 80
NO_CBL_CONN, 80
OTHER_CBL_AMA, 80
reg_intel_modes, 81
TBT_CBL, 80
TBT_STATE_ATT, 81
TBT_STATE_ENTER, 81
TBT_STATE_EXIT, 81
TBT_STATE_IDLE, 81
tbt_cbl_status, 80
tbt_state_t, 80
intrpt_ack
ar_reg_t::USBPD_CMD_REG, 57
is_active
alt_mode_cmd_info_t, 16
is_dfp_alt_mode_mngr_idle
alt_modes_mngr.h, 73
is_snk_bat
dpm_status_t, 37
is_src_bat
dpm_status_t, 37
is_svid_supported
alt_modes_mngr.h, 73
is_vbus_on
app_status_t, 22
is_vconn_on
app_status_t, 22
LOWER_LIMIT_IDX
pdss_hal.h, 143
MAKE_DWORD
utils.h, 189
MUX_CONFIG_2_0
206
alt_mode_hw.h, 65
MUX_CONFIG_AR_CUSTOM
alt_mode_hw.h, 65
MUX_CONFIG_DEINIT
alt_mode_hw.h, 65
MUX_CONFIG_DP_2_LANE
alt_mode_hw.h, 65
MUX_CONFIG_DP_4_LANE
alt_mode_hw.h, 65
MUX_CONFIG_INIT
alt_mode_hw.h, 65
MUX_CONFIG_ISOLATE
alt_mode_hw.h, 65
MUX_CONFIG_SS_ONLY
alt_mode_hw.h, 65
mem_calculate_byte_checksum
utils.h, 189
mem_calculate_dword_checksum
utils.h, 190
mem_calculate_word_checksum
utils.h, 190
metadata_valid
sys_fw_metadata_t, 56
mode
i2c_scb_config_t, 45
mode_state
alt_mode_cmd_info_t, 16
mux_ctrl_init
app.h, 84
mux_ctrl_set_cfg
app.h, 84
mux_select_t
alt_mode_hw.h, 65
NO_CBL_CONN
intel_vid.h, 80
no_of_cmd_do
dpm_pd_cmd_buf_t, 31
num_alt_modes
bb_handle_t, 25
OTHER_CBL_AMA
intel_vid.h, 80
obj_pos
alt_mode_cmd_info_t, 16
vdm_msg_info_t, 62
ovc_indn
ar_reg_t::USBPD_STATUS_REG, 59
PD_ADC_BAND_GAP_VOLT_MV
pdss_hal.h, 143
PD_ADC_CB_T
pdss_hal.h, 146
PD_ADC_DEFAULT_VDDD_VOLT_MV
pdss_hal.h, 143
PD_ADC_ID_T
pdss_hal.h, 146
PD_ADC_INPUT_AMUX_A
pdss_hal.h, 146
INDEX
PD_ADC_INPUT_AMUX_B
pdss_hal.h, 146
PD_ADC_INPUT_BANDGAP
pdss_hal.h, 146
PD_ADC_INPUT_BJT
pdss_hal.h, 146
PD_ADC_INPUT_T
pdss_hal.h, 146
PD_ADC_INT_BOTH
pdss_hal.h, 146
PD_ADC_INT_DISABLED
pdss_hal.h, 146
PD_ADC_INT_FALLING
pdss_hal.h, 146
PD_ADC_INT_RISING
pdss_hal.h, 146
PD_ADC_INT_T
pdss_hal.h, 146
PD_ADC_LEVEL_MIN_THRESHOLD
pdss_hal.h, 143
PD_ADC_MAX_VALUE
pdss_hal.h, 143
PD_ADC_NUM_INPUT
pdss_hal.h, 146
PD_ADC_NUM_LEVELS
pdss_hal.h, 144
PD_ADC_TIMEOUT_COUNT
pdss_hal.h, 144
PD_CMP_VSEL_0_2_V
pdss_hal.h, 144
PD_HEADER
pd.h, 132
PD_INTR_MASK
pdss_hal.h, 144
PD_PHY_EVT_RX_MSG_CMPLT_COL2
pdss_hal.h, 147
PD_PHY_EVT_RX_MSG_CMPLT
pdss_hal.h, 147
PD_PHY_EVT_RX_RST
pdss_hal.h, 147
PD_PHY_EVT_TX_MSG_COLLISION
pdss_hal.h, 146
PD_PHY_EVT_TX_MSG_FAILED
pdss_hal.h, 146
PD_PHY_EVT_TX_MSG_PHY_IDLE
pdss_hal.h, 146
PD_PHY_EVT_TX_MSG_SUCCESS
pdss_hal.h, 146
PD_PHY_EVT_TX_RST_COLLISION
pdss_hal.h, 146
PD_PHY_EVT_TX_RST_SUCCESS
pdss_hal.h, 147
pd.h
DRP_TOGGLE_PERIOD, 132
get_pd_config, 133
get_pd_port_config, 133
PD_HEADER, 132
pd_cbk_t, 132
Generated for CCGx Firmware Stack by Doxygen
INDEX
SRC_DRP_MIN_DC, 132
STD_VDM_HEADER_IDENTITY_REQ, 132
STD_VDM_HEADER_SVID_REQ, 132
typec_generic_fsm_state_t, 132
pd_adc_calibrate
pdss_hal.h, 147
pd_adc_comparator_ctrl
pdss_hal.h, 147
pd_adc_comparator_sample
pdss_hal.h, 147
pd_adc_get_comparator_status
pdss_hal.h, 148
pd_adc_init
pdss_hal.h, 148
pd_adc_level_to_volt
pdss_hal.h, 148
pd_adc_sample
pdss_hal.h, 149
pd_adc_volt_to_level
pdss_hal.h, 149
pd_cbk_t
pd.h, 132
pd_common/dpm.h, 112
pd_common/dpm_intern.h, 119
pd_common/hpd.h, 121
pd_common/pd.h, 124
pd_common/pd_policy_engine.h, 133
pd_common/pd_protocol.h, 134
pd_common/pdss_hal.h, 140
pd_common/typec_manager.h, 158
pd_config_t, 45
pd_connected
dpm_status_t, 37
pd_contract_info_t, 46
pd_disabled
dpm_status_t, 37
pd_do_t, 46
pd_do_t::BAT_SNK, 24
pd_do_t::BAT_SRC, 25
pd_do_t::BIST_DO, 26
pd_do_t::DP_CONFIG_VDO, 30
pd_do_t::DP_STATUS_VDO, 31
pd_do_t::FIXED_SNK, 42
pd_do_t::FIXED_SRC, 42
pd_do_t::RDO_BAT_GIVEBACK, 50
pd_do_t::RDO_BAT, 50
pd_do_t::RDO_FIXED_VAR_GIVEBACK, 51
pd_do_t::RDO_FIXED_VAR, 50
pd_do_t::RDO_GEN_GVB, 51
pd_do_t::RDO_GEN, 51
pd_do_t::SLICE_SUBHDR, 52
pd_do_t::SLICE_VDO, 52
pd_do_t::SRC_GEN, 52
pd_do_t::STD_AMA_VDO, 52
pd_do_t::STD_CBL_VDO, 53
pd_do_t::STD_CERT_VDO, 53
pd_do_t::STD_DP_VDO, 53
pd_do_t::STD_PROD_VDO, 54
Generated for CCGx Firmware Stack by Doxygen
207
pd_do_t::STD_SVID_RESP_VDO, 54
pd_do_t::STD_VDM_HDR, 54
pd_do_t::STD_VDM_ID_HDR, 55
pd_do_t::TBT_VDO, 57
pd_do_t::USTD_VDM_HDR, 60
pd_do_t::VAR_SNK, 61
pd_do_t::VAR_SRC, 61
pd_get_vbus_adc_level
pdss_hal.h, 150
pd_hal_init
pdss_hal.h, 150
pd_hal_set_vbus_detach_params
pdss_hal.h, 150
pd_hal_set_vbus_mon_divider
pdss_hal.h, 150
pd_hal_set_vbus_off_margin
pdss_hal.h, 151
pd_hdr_t, 48
pd_hdr_t::PD_HDR, 47
pd_is_vconn_present
pdss_hal.h, 151
pd_packet_t, 48
pd_phy_abort_bist_cm2
pdss_hal.h, 151
pd_phy_abort_tx_msg
pdss_hal.h, 151
pd_phy_deepsleep
pdss_hal.h, 152
pd_phy_evt_t
pdss_hal.h, 146
pd_phy_get_rx_packet
pdss_hal.h, 152
pd_phy_init
pdss_hal.h, 152
pd_phy_is_busy
pdss_hal.h, 152
pd_phy_load_msg
pdss_hal.h, 153
pd_phy_refresh_roles
pdss_hal.h, 153
pd_phy_send_bist_cm2
pdss_hal.h, 153
pd_phy_send_msg
pdss_hal.h, 154
pd_phy_send_reset
pdss_hal.h, 154
pd_phy_wakeup
pdss_hal.h, 154
pd_policy_engine.h
pe_fsm, 133
pe_init, 134
pe_is_busy, 134
pe_start, 134
pe_stop, 134
pd_port_config_t, 48
pd_prot_dis_bist_cm2
pd_protocol.h, 135
pd_prot_dis_bist_test_data
208
pd_protocol.h, 135
pd_prot_en_bist_cm2
pd_protocol.h, 136
pd_prot_en_bist_test_data
pd_protocol.h, 136
pd_prot_get_rx_packet
pd_protocol.h, 136
pd_prot_init
pd_protocol.h, 136
pd_prot_is_busy
pd_protocol.h, 137
pd_prot_refresh_roles
pd_protocol.h, 137
pd_prot_reset
pd_protocol.h, 137
pd_prot_reset_all
pd_protocol.h, 137
pd_prot_rx_dis
pd_protocol.h, 138
pd_prot_rx_en
pd_protocol.h, 138
pd_prot_send_cable_reset
pd_protocol.h, 138
pd_prot_send_ctrl_msg
pd_protocol.h, 138
pd_prot_send_data_msg
pd_protocol.h, 139
pd_prot_send_hard_reset
pd_protocol.h, 139
pd_prot_set_avoid_retry
pd_protocol.h, 139
pd_prot_start
pd_protocol.h, 139
pd_prot_stop
pd_protocol.h, 140
pd_protocol.h
pd_prot_dis_bist_cm2, 135
pd_prot_dis_bist_test_data, 135
pd_prot_en_bist_cm2, 136
pd_prot_en_bist_test_data, 136
pd_prot_get_rx_packet, 136
pd_prot_init, 136
pd_prot_is_busy, 137
pd_prot_refresh_roles, 137
pd_prot_reset, 137
pd_prot_reset_all, 137
pd_prot_rx_dis, 138
pd_prot_rx_en, 138
pd_prot_send_cable_reset, 138
pd_prot_send_ctrl_msg, 138
pd_prot_send_data_msg, 139
pd_prot_send_hard_reset, 139
pd_prot_set_avoid_retry, 139
pd_prot_start, 139
pd_prot_stop, 140
pd_support
dpm_status_t, 37
pd_typec_dis_dpslp_rp
INDEX
pdss_hal.h, 154
pd_typec_dis_rd
pdss_hal.h, 155
pd_typec_dis_rp
pdss_hal.h, 155
pd_typec_en_dpslp_rp
pdss_hal.h, 155
pd_typec_en_rd
pdss_hal.h, 155
pd_typec_en_rp
pdss_hal.h, 156
pd_typec_get_cc_status
pdss_hal.h, 156
pd_typec_init
pdss_hal.h, 156
pd_typec_set_polarity
pdss_hal.h, 156
pd_typec_snk_update_trim
pdss_hal.h, 157
pd_typec_start
pdss_hal.h, 157
pd_typec_stop
pdss_hal.h, 157
pd_vconn_disable
pdss_hal.h, 157
pd_vconn_enable
pdss_hal.h, 158
pdo.h
eval_rdo, 92
eval_src_cap, 92
pdss_hal.h
AUTO_CTRL_MESSAGE_GOODCRC_MASK_←CFG, 143
BUS_IDLE_CNT_VAL, 143
CRC_COUNTER_CFG, 143
EXPECTED_GOOD_CRC_CLEAR_MASK, 143
EXPECTED_GOOD_CRC_HDR_MASK, 143
LOWER_LIMIT_IDX, 143
PD_ADC_BAND_GAP_VOLT_MV, 143
PD_ADC_CB_T, 146
PD_ADC_DEFAULT_VDDD_VOLT_MV, 143
PD_ADC_ID_T, 146
PD_ADC_INPUT_AMUX_A, 146
PD_ADC_INPUT_AMUX_B, 146
PD_ADC_INPUT_BANDGAP, 146
PD_ADC_INPUT_BJT, 146
PD_ADC_INPUT_T, 146
PD_ADC_INT_BOTH, 146
PD_ADC_INT_DISABLED, 146
PD_ADC_INT_FALLING, 146
PD_ADC_INT_RISING, 146
PD_ADC_INT_T, 146
PD_ADC_LEVEL_MIN_THRESHOLD, 143
PD_ADC_MAX_VALUE, 143
PD_ADC_NUM_INPUT, 146
PD_ADC_NUM_LEVELS, 144
PD_ADC_TIMEOUT_COUNT, 144
PD_CMP_VSEL_0_2_V, 144
Generated for CCGx Firmware Stack by Doxygen
INDEX
PD_INTR_MASK, 144
PD_PHY_EVT_RX_MSG_CMPLT_COL2, 147
PD_PHY_EVT_RX_MSG_CMPLT, 147
PD_PHY_EVT_RX_RST, 147
PD_PHY_EVT_TX_MSG_COLLISION, 146
PD_PHY_EVT_TX_MSG_FAILED, 146
PD_PHY_EVT_TX_MSG_PHY_IDLE, 146
PD_PHY_EVT_TX_MSG_SUCCESS, 146
PD_PHY_EVT_TX_RST_COLLISION, 146
PD_PHY_EVT_TX_RST_SUCCESS, 147
pd_adc_calibrate, 147
pd_adc_comparator_ctrl, 147
pd_adc_comparator_sample, 147
pd_adc_get_comparator_status, 148
pd_adc_init, 148
pd_adc_level_to_volt, 148
pd_adc_sample, 149
pd_adc_volt_to_level, 149
pd_get_vbus_adc_level, 150
pd_hal_init, 150
pd_hal_set_vbus_detach_params, 150
pd_hal_set_vbus_mon_divider, 150
pd_hal_set_vbus_off_margin, 151
pd_is_vconn_present, 151
pd_phy_abort_bist_cm2, 151
pd_phy_abort_tx_msg, 151
pd_phy_deepsleep, 152
pd_phy_evt_t, 146
pd_phy_get_rx_packet, 152
pd_phy_init, 152
pd_phy_is_busy, 152
pd_phy_load_msg, 153
pd_phy_refresh_roles, 153
pd_phy_send_bist_cm2, 153
pd_phy_send_msg, 154
pd_phy_send_reset, 154
pd_phy_wakeup, 154
pd_typec_dis_dpslp_rp, 154
pd_typec_dis_rd, 155
pd_typec_dis_rp, 155
pd_typec_en_dpslp_rp, 155
pd_typec_en_rd, 155
pd_typec_en_rp, 156
pd_typec_get_cc_status, 156
pd_typec_init, 156
pd_typec_set_polarity, 156
pd_typec_snk_update_trim, 157
pd_typec_start, 157
pd_typec_stop, 157
pd_vconn_disable, 157
pd_vconn_enable, 158
RCV_INTR_MASK, 144
RD_ROW_NO, 144
RP_COL_WIDTH, 144
RST_TX_INTERRUPTS, 144
RX_CC_CFG, 144
RX_CNT_MAX_VAL, 145
RX_INTERRUPTS, 145
Generated for CCGx Firmware Stack by Doxygen
209
RX_ORDER_SET_CTRL_CFG, 145
RX_SOP_GOOD_CRC_EN_CTRL_CFG, 145
TX_INTERRUPTS, 145
pe_bcm2_ams_state
dpm_status_t, 37
pe_btd_ams_state
dpm_status_t, 37
pe_dr_ams_state
dpm_status_t, 37
pe_evt
dpm_status_t, 37
pe_fsm
dpm_status_t, 37
pd_policy_engine.h, 133
pe_gn_ams_state
dpm_status_t, 38
pe_hr_ams_state
dpm_status_t, 38
pe_init
pd_policy_engine.h, 134
pe_is_busy
pd_policy_engine.h, 134
pe_pr_ams_state
dpm_status_t, 38
pe_snk_ams_state
dpm_status_t, 38
pe_sr_ams_state
dpm_status_t, 38
pe_src_ams_state
dpm_status_t, 38
pe_start
pd_policy_engine.h, 134
pe_stop
pd_policy_engine.h, 134
pe_vs_ams_state
dpm_status_t, 38
period
ccg_timer_t, 28
polarity
dpm_status_t, 38
port_disable
dpm_status_t, 38
port_role
dpm_status_t, 38
psink.h
psnk_disable, 93
psnk_enable, 93
psnk_set_current, 93
psnk_set_voltage, 94
psnk_disable
psink.h, 93
psnk_enable
psink.h, 93
psnk_set_current
psink.h, 93
psnk_set_voltage
psink.h, 94
psource.h
210
psrc_disable, 94
psrc_enable, 95
psrc_set_current, 95
psrc_set_voltage, 95
system_vconn_ocp_dis, 95
system_vconn_ocp_en, 96
vbus_discharge_off, 96
vbus_discharge_on, 96
vbus_is_present, 96
vconn_disable, 97
vconn_enable, 97
vconn_is_present, 97
psrc_disable
psource.h, 94
psrc_enable
psource.h, 95
psrc_rising
app_status_t, 22
psrc_set_current
psource.h, 95
psrc_set_voltage
psource.h, 95
psrc_volt
app_status_t, 22
psrc_volt_old
app_status_t, 22
pwr_ready_cbk
app_status_t, 22
queue_disable
bb_handle_t, 25
queue_enable
bb_handle_t, 26
queue_state
bb_handle_t, 26
RCV_INTR_MASK
pdss_hal.h, 144
RD_ROW_NO
pdss_hal.h, 144
RP_COL_WIDTH
pdss_hal.h, 144
RST_TX_INTERRUPTS
pdss_hal.h, 144
RX_CC_CFG
pdss_hal.h, 144
RX_CNT_MAX_VAL
pdss_hal.h, 145
RX_INTERRUPTS
pdss_hal.h, 145
RX_ORDER_SET_CTRL_CFG
pdss_hal.h, 145
RX_SOP_GOOD_CRC_EN_CTRL_CFG
pdss_hal.h, 145
ra_present
dpm_status_t, 38
reg_dp_modes
dp_sid.h, 79
reg_intel_modes
INDEX
intel_vid.h, 81
reg_src_alt_mode
alt_modes_mngr.h, 73
reserved
fw_img_status_t::FwModeReason, 44
reserved1
fw_img_status_t::FwModeReason, 44
sys_fw_metadata_t, 56
reserved2
sys_fw_metadata_t, 56
reserved_2
dpm_status_t, 39
reserved_3
dpm_status_t, 39
reset_alt_mode_info
alt_modes_mngr.h, 74
rev_pol
dpm_status_t, 39
role_at_connect
dpm_status_t, 39
rp_supported
dpm_status_t, 39
rsvd
ar_reg_t::USBPD_CMD_REG, 57
rsvd1
ar_reg_t::USBPD_STATUS_REG, 59
rsvd2
ar_reg_t::USBPD_STATUS_REG, 59
rsvd3
ar_reg_t::USBPD_STATUS_REG, 59
rsvd4
ar_reg_t::USBPD_STATUS_REG, 59
rsvd5
ar_reg_t::USBPD_STATUS_REG, 59
SRC_DRP_MIN_DC
pd.h, 132
STD_VDM_HEADER_IDENTITY_REQ
pd.h, 132
STD_VDM_HEADER_SVID_REQ
pd.h, 132
SYS_FW_MODE_BOOTLOADER
system.h, 182
SYS_FW_MODE_FWIMAGE_1
system.h, 182
SYS_FW_MODE_FWIMAGE_2
system.h, 182
SYS_FW_MODE_INVALID
system.h, 182
scb/i2c.h, 160
set_mux
alt_mode_hw.h, 67
skip_scan
dpm_status_t, 39
slave_address
i2c_scb_config_t, 45
slave_mask
i2c_scb_config_t, 45
sln_pd_event_handler
Generated for CCGx Firmware Stack by Doxygen
INDEX
app.h, 84
snk_cur_level
dpm_status_t, 39
snk_max_min
dpm_status_t, 39
snk_pdo
dpm_status_t, 39
snk_pdo_count
dpm_status_t, 39
snk_pdo_mask
dpm_status_t, 40
snk_period
dpm_status_t, 40
snk_rdo
dpm_status_t, 40
snk_sel_pdo
dpm_status_t, 40
snk_usb_comm_en
dpm_status_t, 40
snk_usb_susp_en
dpm_status_t, 40
soft_rst
ar_reg_t::USBPD_CMD_REG, 57
sop_state
alt_mode_cmd_info_t, 16
sop_type
vdm_msg_info_t, 62
src_cur_level
dpm_status_t, 40
src_pdo
dpm_status_t, 40
src_pdo_count
dpm_status_t, 40
src_pdo_mask
dpm_status_t, 40
src_period
dpm_status_t, 40
src_rdo
dpm_status_t, 40
src_sel_pdo
dpm_status_t, 41
state
bb_handle_t, 26
status
fw_img_status_t, 43
status.h
CCG_STAT_BAD_PARAM, 181
CCG_STAT_BUSY, 181
CCG_STAT_CMD_FAILURE, 181
CCG_STAT_FAILURE, 181
CCG_STAT_FLASH_DATA_AVAILABLE, 181
CCG_STAT_FLASH_UPDATE_FAILED, 181
CCG_STAT_INVALID_ARGUMENT, 181
CCG_STAT_INVALID_COMMAND, 181
CCG_STAT_INVALID_FW, 181
CCG_STAT_INVALID_SIGNATURE, 181
CCG_STAT_NO_RESPONSE, 181
CCG_STAT_NOT_READY, 181
Generated for CCGx Firmware Stack by Doxygen
211
CCG_STAT_NOT_SUPPORTED, 181
CCG_STAT_READ_DATA, 181
CCG_STAT_SUCCESS, 181
CCG_STAT_TIMEOUT, 181
CCG_STAT_TRANS_FAILURE, 181
CCG_STATUS_CODE_OFFSET, 181
ccg_status_t, 181
supported_modes
bm_alt_modes_t, 27
svid
alt_mode_evt_t::ALT_MODE_EVT, 17
comp_tbl_t, 28
vdm_msg_info_t, 62
svid_emca_vdo
disc_mode_info_t, 30
svid_vdo
disc_mode_info_t, 30
swap.h
eval_dr_swap, 98
eval_pr_swap, 98
eval_vconn_swap, 98
swap_response
dpm_status_t, 41
sys_fw_metadata_t, 55
active_boot_app, 55
boot_app_id, 55
boot_app_ver_status, 55
boot_app_version, 56
boot_last_row, 56
boot_seq, 56
fw_checksum, 56
fw_entry, 56
fw_size, 56
fw_version, 56
metadata_valid, 56
reserved1, 56
reserved2, 56
sys_fw_mode_t
system.h, 182
sys_get_boot_version
system.h, 183
sys_get_device_mode
system.h, 183
sys_get_fw_img1_start_addr
system.h, 183
sys_get_fw_img2_start_addr
system.h, 183
sys_get_img1_fw_version
system.h, 183
sys_get_img2_fw_version
system.h, 183
sys_get_recent_fw_image
system.h, 184
sys_get_silicon_id
system.h, 184
sys_set_device_mode
system.h, 184
system.h
212
SYS_FW_MODE_BOOTLOADER, 182
SYS_FW_MODE_FWIMAGE_1, 182
SYS_FW_MODE_FWIMAGE_2, 182
SYS_FW_MODE_INVALID, 182
sys_fw_mode_t, 182
sys_get_boot_version, 183
sys_get_device_mode, 183
sys_get_fw_img1_start_addr, 183
sys_get_fw_img2_start_addr, 183
sys_get_img1_fw_version, 183
sys_get_img2_fw_version, 183
sys_get_recent_fw_image, 184
sys_get_silicon_id, 184
sys_set_device_mode, 184
system/boot.h, 165
system/ccg4_version.h, 168
system/ccgx_api_desc.h, 168
system/flash.h, 169
system/gpio.h, 173
system/status.h, 180
system/system.h, 181
system/timer.h, 185
system/utils.h, 188
system_init
hal_ccgx.h, 91
system_sleep
app.h, 85
system_vbus_ocp_dis
hal_ccgx.h, 91
system_vbus_ocp_en
hal_ccgx.h, 91
system_vconn_ocp_dis
psource.h, 95
system_vconn_ocp_en
psource.h, 96
TBT_CBL
intel_vid.h, 80
TBT_STATE_ATT
intel_vid.h, 81
TBT_STATE_ENTER
intel_vid.h, 81
TBT_STATE_EXIT
intel_vid.h, 81
TBT_STATE_IDLE
intel_vid.h, 81
TX_INTERRUPTS
pdss_hal.h, 145
tbt_cbl_gen
ar_reg_t::USBPD_STATUS_REG, 60
tbt_cbl_spd
ar_reg_t::USBPD_STATUS_REG, 60
tbt_cbl_status
intel_vid.h, 80
tbt_conn
ar_reg_t::USBPD_STATUS_REG, 60
tbt_state_t
intel_vid.h, 80
tbt_type
INDEX
ar_reg_t::USBPD_STATUS_REG, 60
tgt_id_header
atch_tgt_info_t, 24
tgt_svid
atch_tgt_info_t, 24
timeout
bb_handle_t, 26
timer.h
timer_cb_t, 185
timer_enter_sleep, 186
timer_get_count, 186
timer_id_t, 185
timer_init, 186
timer_is_running, 186
timer_num_active, 187
timer_start, 187
timer_stop, 187
timer_stop_all, 187
timer_stop_range, 188
timer_cb_t
timer.h, 185
timer_enter_sleep
timer.h, 186
timer_get_count
timer.h, 186
timer_id_t
timer.h, 185
timer_init
timer.h, 186
timer_is_running
timer.h, 186
timer_num_active
timer.h, 187
timer_start
timer.h, 187
timer_stop
timer.h, 187
timer_stop_all
timer.h, 187
timer_stop_range
timer.h, 188
toggle
dpm_status_t, 41
try_src
dpm_status_t, 41
type
bb_handle_t, 26
typec_assert_rd
typec_manager.h, 158
typec_assert_rp
typec_manager.h, 158
typec_deepsleep
typec_manager.h, 159
typec_evt
dpm_status_t, 41
typec_fsm
dpm_status_t, 41
typec_manager.h, 159
Generated for CCGx Firmware Stack by Doxygen
INDEX
typec_generic_fsm_state_t
pd.h, 132
typec_gn_fsm_state
dpm_status_t, 41
typec_init
typec_manager.h, 159
typec_is_busy
typec_manager.h, 159
typec_manager.h
typec_assert_rd, 158
typec_assert_rp, 158
typec_deepsleep, 159
typec_fsm, 159
typec_init, 159
typec_is_busy, 159
typec_start, 159
typec_stop, 160
typec_wakeup, 160
typec_start
typec_manager.h, 159
typec_stop
typec_manager.h, 160
typec_wakeup
typec_manager.h, 160
USB_VENDOR_CMD_BOOT_FAIL_REASON
usb_vendor.h, 100
USB_VENDOR_CMD_DEVICE_RESET
usb_vendor.h, 100
USB_VENDOR_CMD_ENTER_FLASHING_MODE
usb_vendor.h, 100
USB_VENDOR_CMD_FLASH_READ
usb_vendor.h, 99
USB_VENDOR_CMD_FLASH_WRITE
usb_vendor.h, 100
USB_VENDOR_CMD_GET_ALL_VERSION
usb_vendor.h, 100
USB_VENDOR_CMD_GET_DEVICE_ID
usb_vendor.h, 100
USB_VENDOR_CMD_GET_DEVICE_MODE
usb_vendor.h, 100
USB_VENDOR_CMD_GET_FW_LOCATION
usb_vendor.h, 100
USB_VENDOR_CMD_GET_SILICON_ID
usb_vendor.h, 99
USB_VENDOR_CMD_GET_VERSION
usb_vendor.h, 99
USB_VENDOR_CMD_JUMP_TO_BOOT
usb_vendor.h, 100
USB_VENDOR_CMD_SEND_SIGNATURE
usb_vendor.h, 100
USB_VENDOR_CMD_SET_APP_PRIORITY
usb_vendor.h, 100
USB_VENDOR_CMD_VALIDATE_FW
usb_vendor.h, 100
UVDM_HANDLED_NO_RESPONSE
uvdm.h, 102
UVDM_HANDLED_RESPONSE_NOT_READY
uvdm.h, 102
Generated for CCGx Firmware Stack by Doxygen
213
UVDM_HANDLED_RESPONSE_READY
uvdm.h, 102
UVDM_NOT_HANDLED
uvdm.h, 102
ufp_alt_mode_allowed
app_status_t, 22
ufp_alt_mode_idle
alt_modes_mngr.h, 74
ufp_alt_mode_mng_deinit
alt_modes_mngr.h, 74
ufp_alt_mode_mngr
alt_modes_mngr.h, 74
usb2_conn
ar_reg_t::USBPD_STATUS_REG, 60
usb3_conn
ar_reg_t::USBPD_STATUS_REG, 60
usb3_speed
ar_reg_t::USBPD_STATUS_REG, 60
usb_dr
ar_reg_t::USBPD_STATUS_REG, 60
usb_port
bb_handle_t, 26
usb_vendor.h
USB_VENDOR_CMD_BOOT_FAIL_REASON,
100
USB_VENDOR_CMD_DEVICE_RESET, 100
USB_VENDOR_CMD_ENTER_FLASHING_MO←DE, 100
USB_VENDOR_CMD_FLASH_READ, 99
USB_VENDOR_CMD_FLASH_WRITE, 100
USB_VENDOR_CMD_GET_ALL_VERSION, 100
USB_VENDOR_CMD_GET_DEVICE_ID, 100
USB_VENDOR_CMD_GET_DEVICE_MODE, 100
USB_VENDOR_CMD_GET_FW_LOCATION, 100
USB_VENDOR_CMD_GET_SILICON_ID, 99
USB_VENDOR_CMD_GET_VERSION, 99
USB_VENDOR_CMD_JUMP_TO_BOOT, 100
USB_VENDOR_CMD_SEND_SIGNATURE, 100
USB_VENDOR_CMD_SET_APP_PRIORITY, 100
USB_VENDOR_CMD_VALIDATE_FW, 100
usb_vendor_cmd_t, 99
usb_vendor_flashing_rqt_handler, 100
usb_vendor_get_ep0_buffer, 100
usb_vendor_cmd_t
usb_vendor.h, 99
usb_vendor_flashing_rqt_handler
usb_vendor.h, 100
usb_vendor_get_ep0_buffer
usb_vendor.h, 100
usbpd_cmd_reg
ar_reg_t, 23
utils.h
crc16, 189
MAKE_DWORD, 189
mem_calculate_byte_checksum, 189
mem_calculate_dword_checksum, 190
mem_calculate_word_checksum, 190
uvdm.h
214
UVDM_HANDLED_NO_RESPONSE, 102
UVDM_HANDLED_RESPONSE_NOT_READY,
102
UVDM_HANDLED_RESPONSE_READY, 102
UVDM_NOT_HANDLED, 102
uvdm_enter_cy_alt_mode, 102
uvdm_exit_cy_alt_mode, 103
uvdm_get_flashing_mode, 103
uvdm_handle_cmd, 103
uvdm_response_state_t, 102
uvdm_enter_cy_alt_mode
uvdm.h, 102
uvdm_exit_cy_alt_mode
uvdm.h, 103
uvdm_get_flashing_mode
uvdm.h, 103
uvdm_handle_cmd
uvdm.h, 103
uvdm_response_state_t
uvdm.h, 102
VDM_EVT_EVAL
dfp_vdm_task_mngr.h, 76
VDM_EVT_EXIT
dfp_vdm_task_mngr.h, 76
VDM_EVT_FAIL
dfp_vdm_task_mngr.h, 76
VDM_EVT_RUN
dfp_vdm_task_mngr.h, 76
val
alt_mode_evt_t, 19
alt_mode_hw_evt_t, 20
ar_reg_t, 23
contract_t, 29
fw_img_status_t, 43
vbus_discharge_off
psource.h, 96
vbus_discharge_on
psource.h, 96
vbus_is_present
psource.h, 96
vbus_ocp_handler
hal_ccgx.h, 91
vconn_actual
dpm_status_t, 41
vconn_disable
psource.h, 97
vconn_enable
psource.h, 97
vconn_is_present
psource.h, 97
vconn_logical
dpm_status_t, 41
vdm.h
eval_vdm, 104
vdm_data_init, 104
vdm_update_data, 104
vdm_data_init
vdm.h, 104
INDEX
vdm_header
alt_mode_cmd_info_t, 16
vdm_msg_info_t, 61
cmd, 62
obj_pos, 62
sop_type, 62
svid, 62
vdo, 62
vdo_numb, 62
vdm_resp
app_status_t, 22
vdm_resp_t, 62
vdm_task_en
app_status_t, 22
vdm_task_mng_alt_mode_process
alt_modes_mngr.h, 75
vdm_task_mng_deinit
dfp_vdm_task_mngr.h, 77
vdm_update_data
vdm.h, 104
vdo
alt_mode_cmd_info_t, 16
vdm_msg_info_t, 62
vdo_max_numb
alt_mode_cmd_info_t, 16
vdo_numb
alt_mode_cmd_info_t, 17
vdm_msg_info_t, 62
vdo_pos
disc_mode_info_t, 30
volt
contract_t::FIELD, 42
Generated for CCGx Firmware Stack by Doxygen