1 /*
2  * Copyright (c) 2021 Microchip Technology Inc. and its subsidiaries.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef _MEC_TFDP_H
8 #define _MEC_TFDP_H
9 
10 #include <stdint.h>
11 #include <stddef.h>
12 
13 #define MCHP_TFDP_CTRL_REG_MASK		0x7fu
14 #define MCHP_TFDP_CTRL_EN_POS		0u
15 #define MCHP_TFDP_CTRL_EDGE_SEL_POS	1u
16 #define MCHP_TFDP_CTRL_DIV_SEL_POS	2u
17 #define MCHP_TFDP_CTRL_IP_DLY_POS	4u
18 
19 #define MCHP_TFDP_CTRL_EN		BIT(0)
20 #define MCHP_TFDP_OUT_ON_FALLING_EDGE	BIT(1)
21 #define MCHP_TFDP_CLK_AHB_DIV_2		0
22 #define MCHP_TFDP_CLK_AHB_DIV_4		0x04u
23 #define MCHP_TFDP_CLK_AHB_DIV_8		0x08u
24 #define MCHP_TFDP_CLK_AHB_DIV_2_ALT	0x0cu
25 
26 /* Number of AHB clocks between each byte shifted out */
27 #define MCHP_TFDP_IP_DLY_1		0
28 #define MCHP_TFDP_IP_DLY_2		0x10u
29 #define MCHP_TFDP_IP_DLY_3		0x20u
30 #define MCHP_TFDP_IP_DLY_4		0x30u
31 #define MCHP_TFDP_IP_DLY_5		0x40u
32 #define MCHP_TFDP_IP_DLY_6		0x50u
33 #define MCHP_TFDP_IP_DLY_7		0x60u
34 #define MCHP_TFDP_IP_DLY_8		0x70u
35 
36 /* First byte indicates start of packet */
37 #define MCHP_TFDP_PKT_START		0xfdu
38 
39 /** @brief Trace FIFO Debug Port Registers (TFDP) */
40 struct tfdp_regs {
41 	volatile uint8_t DATA_OUT;
42 	uint8_t RSVD1[3];
43 	volatile uint32_t CTRL;
44 };
45 
46 #endif	/* #ifndef _MEC_TFDP_H */
47