Initial commit
This commit is contained in:
commit
66c5a26d69
1145 changed files with 938088 additions and 0 deletions
|
@ -0,0 +1,83 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="generator" content="pandoc" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
|
||||
<title>Release Notes for TUSB546 Component Drivers</title>
|
||||
<style type="text/css">
|
||||
code{white-space: pre-wrap;}
|
||||
span.smallcaps{font-variant: small-caps;}
|
||||
span.underline{text-decoration: underline;}
|
||||
div.column{display: inline-block; vertical-align: top; width: 50%;}
|
||||
</style>
|
||||
<link rel="stylesheet" href="../../../../_htmresc/mini-st.css" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-lg-4">
|
||||
<div class="card fluid">
|
||||
<div class="sectione dark">
|
||||
<center>
|
||||
<h1 id="release-notes-for-tusb546-component-drivers"><small>Release Notes for</small> <mark>TUSB546 Component Drivers</mark></h1>
|
||||
<p>Copyright © 2017 STMicroelectronics<br />
|
||||
</p>
|
||||
<a href="https://www.st.com" class="logo"><img src="../../../../_htmresc/st_logo.png" alt="ST logo" /></a>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
<h1 id="license">License</h1>
|
||||
<p>Licensed by ST under BSD 3-Clause license (the "License"). You may not use this package except in compliance with the License. You may obtain a copy of the License at:</p>
|
||||
<p><a href="https://opensource.org/licenses/BSD-3-Clause">https://opensource.org/licenses/BSD-3-Clause</a></p>
|
||||
<h1 id="purpose">Purpose</h1>
|
||||
<p>This directory contains the TUSB546 component drivers.</p>
|
||||
</div>
|
||||
<div class="col-sm-12 col-lg-8">
|
||||
<h1 id="update-history">Update History</h1>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section3" checked aria-hidden="true"> <label for="collapse-section3" aria-hidden="true">V1.0.3 / 23-July-2020</label>
|
||||
<div>
|
||||
<h2 id="main-changes">Main Changes</h2>
|
||||
<ul>
|
||||
<li>Correct misspelled words</li>
|
||||
<li>Update Release Notes format</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section4" aria-hidden="true"> <label for="collapse-section4" aria-hidden="true">V1.0.2 / 10-October-2018</label>
|
||||
<div>
|
||||
<h2 id="main-changes-1">Main Changes</h2>
|
||||
<ul>
|
||||
<li>Fix compilation warnings detected by IAR V8.30.1</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section2" aria-hidden="true"> <label for="collapse-section2" aria-hidden="true">V1.0.1 / 16-March-2018</label>
|
||||
<div>
|
||||
<h2 id="main-changes-2">Main Changes</h2>
|
||||
<ul>
|
||||
<li>Correct compilation warnings detected by SW4STM32 gcc compiler</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section1" aria-hidden="true"> <label for="collapse-section1" aria-hidden="true">V1.0.0 / 16-November-2017</label>
|
||||
<div>
|
||||
<h2 id="main-changes-3">Main Changes</h2>
|
||||
<ul>
|
||||
<li>First official release of TUSB546 Component drivers</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="sticky">
|
||||
For complete documentation on <mark>STM32 Microcontrollers</mark> , visit: <a href="http://www.st.com/STM32">http://www.st.com/STM32</a>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
533
USB-PD_Provider_1port/Drivers/BSP/Components/tusb546/tusb546.c
Normal file
533
USB-PD_Provider_1port/Drivers/BSP/Components/tusb546/tusb546.c
Normal file
|
@ -0,0 +1,533 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file tusb546.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of functions needed to manage the TUSB546
|
||||
* (USB Type-C DP ALT Mode Linear Redriver Crosspoint Switch).
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "tusb546.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup TUSB546
|
||||
* @brief This file provides a set of functions needed to drive the
|
||||
* TUSB546 USB Type-C DP ALT Mode Linear Redriver Crosspoint Switch.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup TUSB546_Private_TypesDefinitions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TUSB546_Private_Defines
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TUSB546_Private_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TUSB546_Private_Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Type-C Crosspoint Switch Driver structure initialization */
|
||||
TYPECSWITCH_Drv_t tusb546_drv_CrossSwitch =
|
||||
{
|
||||
tusb546_CrossSwitch_Init,
|
||||
tusb546_CrossSwitch_DeInit,
|
||||
tusb546_CrossSwitch_PowerOn,
|
||||
tusb546_CrossSwitch_PowerOff,
|
||||
tusb546_CrossSwitch_SetMode,
|
||||
tusb546_CrossSwitch_IsSupportedMode
|
||||
};
|
||||
|
||||
/* DisplayPort Linear Redriver driver structure initialization*/
|
||||
DPREDRIVER_Drv_t tusb546_drv_LinearRedriver =
|
||||
{
|
||||
tusb546_DPRedriver_Init,
|
||||
tusb546_DPRedriver_DeInit,
|
||||
tusb546_DPRedriver_PowerOn,
|
||||
tusb546_DPRedriver_PowerOff,
|
||||
tusb546_DPRedriver_SetEQGain,
|
||||
tusb546_DPRedriver_EnableChannel,
|
||||
tusb546_DPRedriver_DisableChannel
|
||||
};
|
||||
|
||||
/* Supported USB Type-C pin assignments */
|
||||
static const uint32_t tusb546_SupportedModes =
|
||||
( 1 << USB_NORMAL |
|
||||
1 << USB_FLIPPED |
|
||||
1 << DFP_D_PIN_ASSIGNMENT_C_NORMAL |
|
||||
1 << DFP_D_PIN_ASSIGNMENT_C_FLIPPED |
|
||||
1 << DFP_D_PIN_ASSIGNMENT_D_NORMAL |
|
||||
1 << DFP_D_PIN_ASSIGNMENT_D_FLIPPED |
|
||||
1 << DFP_D_PIN_ASSIGNMENT_E_NORMAL |
|
||||
1 << DFP_D_PIN_ASSIGNMENT_E_FLIPPED |
|
||||
1 << DFP_D_PIN_ASSIGNMENT_F_NORMAL |
|
||||
1 << DFP_D_PIN_ASSIGNMENT_F_FLIPPED );
|
||||
|
||||
static uint8_t tusb546_IsInitialized_CrossSwitch = 0;
|
||||
static uint8_t tusb546_IsInitialized_DPRedriver = 0;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/** @defgroup TUSB546_Private_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TUSB546_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initialize the TUSB546 and configure the needed hardware resources
|
||||
* (Type-C cross switch part).
|
||||
* @param Address TUSB546 address on communication Bus.
|
||||
* @retval 0: successful, else failed
|
||||
*/
|
||||
uint32_t tusb546_CrossSwitch_Init(uint16_t Address)
|
||||
{
|
||||
uint32_t err_count = 0;
|
||||
|
||||
tusb546_IsInitialized_CrossSwitch = 1;
|
||||
|
||||
if (!tusb546_IsInitialized_DPRedriver)
|
||||
{
|
||||
/* Low level init */
|
||||
err_count += MUX_IO_Init();
|
||||
|
||||
/* Restore TUSB546 registers reset values */
|
||||
err_count += MUX_IO_Write(Address, TUSB546_REG_CTRL, 0x01);
|
||||
err_count += MUX_IO_Write(Address, TUSB546_REG_DP_CTRL1, 0x00);
|
||||
err_count += MUX_IO_Write(Address, TUSB546_REG_DP_CTRL2, 0x00);
|
||||
err_count += MUX_IO_Write(Address, TUSB546_REG_DP_CTRL4, 0x00);
|
||||
err_count += MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL1, 0x00);
|
||||
err_count += MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL2, 0x00);
|
||||
err_count += MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL3, 0x00);
|
||||
}
|
||||
|
||||
return err_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Release the hardware resources required to use the TUSB546
|
||||
* (Type-C cross switch part).
|
||||
* @param Address TUSB546 address on communication Bus.
|
||||
* @retval none
|
||||
*/
|
||||
void tusb546_CrossSwitch_DeInit(uint16_t Address)
|
||||
{
|
||||
tusb546_IsInitialized_CrossSwitch = 0;
|
||||
|
||||
if ((!tusb546_IsInitialized_CrossSwitch) &&
|
||||
(!tusb546_IsInitialized_DPRedriver))
|
||||
{
|
||||
/* Restore TUSB546 registers reset values */
|
||||
MUX_IO_Write(Address, TUSB546_REG_CTRL, 0x01);
|
||||
MUX_IO_Write(Address, TUSB546_REG_DP_CTRL1, 0x00);
|
||||
MUX_IO_Write(Address, TUSB546_REG_DP_CTRL2, 0x00);
|
||||
MUX_IO_Write(Address, TUSB546_REG_DP_CTRL4, 0x00);
|
||||
MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL1, 0x00);
|
||||
MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL2, 0x00);
|
||||
MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL3, 0x00);
|
||||
|
||||
/* Low level de-init */
|
||||
MUX_IO_DeInit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Power on the TUSB546 (Type-C cross switch part).
|
||||
* @param Address TUSB546 address on communication Bus.
|
||||
* @retval 0: successful, else failed
|
||||
*/
|
||||
uint32_t tusb546_CrossSwitch_PowerOn(uint16_t Address)
|
||||
{
|
||||
uint32_t err_count = 0;
|
||||
|
||||
/* Enable USB3x port */
|
||||
err_count += MUX_IO_Write(Address, TUSB546_REG_CTRL, TUSB546_REG_CTRL_CTLSEL_0);
|
||||
|
||||
return err_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Power down the TUSB546 (Type-C cross switch part).
|
||||
* @param Address TUSB546 address on communication Bus.
|
||||
* @retval 0: successful, else failed
|
||||
*/
|
||||
uint32_t tusb546_CrossSwitch_PowerOff(uint16_t Address)
|
||||
{
|
||||
uint32_t err_count = 0;
|
||||
|
||||
/* All RX and TX for USB3 and DisplayPort are disabled */
|
||||
err_count += MUX_IO_Write(Address, TUSB546_REG_CTRL, 0);
|
||||
|
||||
return err_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the TUSB546 according to the requested USB Type-C
|
||||
* connector pin assignment.
|
||||
* @param Address TUSB546 address on communication Bus.
|
||||
* @param Mode USB Type-C connector pin assignment
|
||||
* @retval 0: success, else error
|
||||
*/
|
||||
uint32_t tusb546_CrossSwitch_SetMode(uint16_t Address, TYPECSWITCH_Mode_t Mode)
|
||||
{
|
||||
uint32_t err_count = 0;
|
||||
uint8_t flipsel;
|
||||
uint8_t ctlsel;
|
||||
uint8_t ctlreg;
|
||||
|
||||
switch(Mode)
|
||||
{
|
||||
case USB_NORMAL:
|
||||
flipsel = 0;
|
||||
ctlsel = TUSB546_REG_CTRL_CTLSEL_0;
|
||||
break;
|
||||
case USB_FLIPPED:
|
||||
flipsel = TUSB546_REG_CTRL_FLIPSEL;
|
||||
ctlsel = TUSB546_REG_CTRL_CTLSEL_0;
|
||||
break;
|
||||
case DFP_D_PIN_ASSIGNMENT_C_NORMAL:
|
||||
case DFP_D_PIN_ASSIGNMENT_E_NORMAL:
|
||||
flipsel = 0;
|
||||
ctlsel = TUSB546_REG_CTRL_CTLSEL_1;
|
||||
break;
|
||||
case DFP_D_PIN_ASSIGNMENT_C_FLIPPED:
|
||||
case DFP_D_PIN_ASSIGNMENT_E_FLIPPED:
|
||||
flipsel = TUSB546_REG_CTRL_FLIPSEL;
|
||||
ctlsel = TUSB546_REG_CTRL_CTLSEL_1;
|
||||
break;
|
||||
case DFP_D_PIN_ASSIGNMENT_D_NORMAL:
|
||||
case DFP_D_PIN_ASSIGNMENT_F_NORMAL:
|
||||
flipsel = 0;
|
||||
ctlsel = TUSB546_REG_CTRL_CTLSEL;
|
||||
break;
|
||||
case DFP_D_PIN_ASSIGNMENT_D_FLIPPED:
|
||||
case DFP_D_PIN_ASSIGNMENT_F_FLIPPED:
|
||||
flipsel = TUSB546_REG_CTRL_FLIPSEL;
|
||||
ctlsel = TUSB546_REG_CTRL_CTLSEL;
|
||||
break;
|
||||
default:
|
||||
flipsel = 0;
|
||||
ctlsel = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get actual device configuration */
|
||||
err_count += MUX_IO_Read(Address, TUSB546_REG_CTRL, &ctlreg);
|
||||
ctlreg = (ctlreg & ~(uint8_t)(TUSB546_REG_CTRL_FLIPSEL | TUSB546_REG_CTRL_CTLSEL)) | (flipsel | ctlsel);
|
||||
|
||||
/* Update device configuration */
|
||||
err_count += MUX_IO_Write(Address, TUSB546_REG_CTRL, ctlreg);
|
||||
|
||||
return err_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Indicate whether the requested USB Type-C connector pin assignment
|
||||
* is supported by the TUSB546.
|
||||
* @param Mode USB Type-C connector pin assignment
|
||||
* @retval 1: Mode supported, else Mode not supported
|
||||
*/
|
||||
uint32_t tusb546_CrossSwitch_IsSupportedMode(TYPECSWITCH_Mode_t Mode)
|
||||
{
|
||||
return (((1 << Mode) & tusb546_SupportedModes ) == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize the TUSB546 and configure the needed hardware resources
|
||||
* (DisplayPort linear redriver part).
|
||||
* @param Address TUSB546 address on communication Bus.
|
||||
* @retval 0: successful, else failed
|
||||
*/
|
||||
uint32_t tusb546_DPRedriver_Init(uint16_t Address)
|
||||
{
|
||||
uint32_t err_count = 0;
|
||||
|
||||
tusb546_IsInitialized_DPRedriver = 1;
|
||||
|
||||
if (!tusb546_IsInitialized_CrossSwitch)
|
||||
{
|
||||
/* Low level init */
|
||||
err_count += MUX_IO_Init();
|
||||
}
|
||||
|
||||
return err_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Release the hardware resources required to use the TUSB546
|
||||
* (DisplayPort linear redriver part).
|
||||
* @param Address TUSB546 address on communication Bus.
|
||||
* @retval none
|
||||
*/
|
||||
void tusb546_DPRedriver_DeInit(uint16_t Address)
|
||||
{
|
||||
tusb546_IsInitialized_DPRedriver = 0;
|
||||
|
||||
if ((!tusb546_IsInitialized_CrossSwitch) &&
|
||||
(!tusb546_IsInitialized_DPRedriver))
|
||||
{
|
||||
/* Restore TUSB546 registers reset values */
|
||||
MUX_IO_Write(Address, TUSB546_REG_CTRL, 0x01);
|
||||
MUX_IO_Write(Address, TUSB546_REG_DP_CTRL1, 0x00);
|
||||
MUX_IO_Write(Address, TUSB546_REG_DP_CTRL2, 0x00);
|
||||
MUX_IO_Write(Address, TUSB546_REG_DP_CTRL4, 0x00);
|
||||
MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL1, 0x00);
|
||||
MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL2, 0x00);
|
||||
MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL3, 0x00);
|
||||
|
||||
/* Low level de-init */
|
||||
MUX_IO_DeInit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Power on the TUSB546 (DisplayPort linear redriver part).
|
||||
* @param Address TUSB546 address on communication Bus.
|
||||
* @retval 0: successful, else failed
|
||||
*/
|
||||
uint32_t tusb546_DPRedriver_PowerOn(uint16_t Address)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Power down the TUSB546 (DisplayPort linear redriver part).
|
||||
* @param Address TUSB546 address on communication Bus.
|
||||
* @retval 0: successful, else failed
|
||||
*/
|
||||
uint32_t tusb546_DPRedriver_PowerOff(uint16_t Address)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the equalizer gain for a given channel.
|
||||
* @param Address TUSB546 address on communication Bus.
|
||||
* @param ChannelId Channel identifier.
|
||||
* This parameter can be take one of the following values:
|
||||
* CHANNEL_DP0
|
||||
* CHANNEL_DP1
|
||||
* CHANNEL_DP2
|
||||
* CHANNEL_DP3
|
||||
* CHANNEL_RX1
|
||||
* CHANNEL_RX2
|
||||
* CHANNEL_SSTX
|
||||
* @param EQGain Equalizer gain.
|
||||
* This parameter must be a value between 0x00 and 0x0F.
|
||||
* @retval 0: successful, else failed
|
||||
*/
|
||||
uint32_t tusb546_DPRedriver_SetEQGain(uint16_t Address,
|
||||
DPREDRIVER_ChannelId_t ChannelId,
|
||||
uint8_t EQGain)
|
||||
{
|
||||
uint32_t err_count = 0;
|
||||
uint8_t eqsel = 0;
|
||||
uint8_t reg_offset = 0;
|
||||
uint8_t ctlreg;
|
||||
uint8_t mask = 0;
|
||||
|
||||
switch(ChannelId)
|
||||
{
|
||||
case CHANNEL_DP0:
|
||||
reg_offset = TUSB546_REG_DP_CTRL1;
|
||||
mask = TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Msk;
|
||||
eqsel = EQGain;
|
||||
break;
|
||||
case CHANNEL_DP1:
|
||||
reg_offset = TUSB546_REG_DP_CTRL1;
|
||||
mask = TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Msk;
|
||||
eqsel = (EQGain << TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Pos);
|
||||
break;
|
||||
case CHANNEL_DP2:
|
||||
reg_offset = TUSB546_REG_DP_CTRL2;
|
||||
mask = TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Msk;
|
||||
eqsel = EQGain;
|
||||
break;
|
||||
case CHANNEL_DP3:
|
||||
reg_offset = TUSB546_REG_DP_CTRL2;
|
||||
mask = TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Msk;
|
||||
eqsel = (EQGain << TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Pos);
|
||||
break;
|
||||
case CHANNEL_RX1:
|
||||
reg_offset = TUSB546_REG_USB3_CTRL1;
|
||||
mask = TUSB546_REG_USB3_CTRL1_EQ1_SEL_Msk;
|
||||
eqsel = EQGain;
|
||||
break;
|
||||
case CHANNEL_RX2:
|
||||
reg_offset = TUSB546_REG_USB3_CTRL1;
|
||||
mask = TUSB546_REG_USB3_CTRL1_EQ2_SEL_Msk;
|
||||
eqsel = (EQGain << TUSB546_REG_USB3_CTRL1_EQ2_SEL_Pos);
|
||||
break;
|
||||
case CHANNEL_SSTX:
|
||||
reg_offset = TUSB546_REG_USB3_CTRL2;
|
||||
mask = TUSB546_USB3_CTRL2_SSEQ_SEL_Msk;
|
||||
eqsel = EQGain;
|
||||
break;
|
||||
}
|
||||
|
||||
if (reg_offset != 0)
|
||||
{
|
||||
/* Set EQ_OVERRIDE to use EQ settings from registers instead of value sample from pins */
|
||||
err_count += MUX_IO_Write(Address, TUSB546_REG_CTRL, TUSB546_REG_CTRL_EQ_OVERRIDE);
|
||||
|
||||
/* Get actual EQ configuration */
|
||||
err_count += MUX_IO_Read(Address, reg_offset, &ctlreg);
|
||||
ctlreg = (ctlreg & ~(mask)) | eqsel;
|
||||
|
||||
/* Update EQ configuration */
|
||||
err_count += MUX_IO_Write(Address, reg_offset, ctlreg);
|
||||
}
|
||||
|
||||
return err_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable a DP channel.
|
||||
* @param Address TUSB546 address on communication Bus.
|
||||
* @param ChannelId Channel identifier.
|
||||
* This parameter can be take one of the following values:
|
||||
* CHANNEL_DP0
|
||||
* CHANNEL_DP1
|
||||
* CHANNEL_DP2
|
||||
* CHANNEL_DP3
|
||||
* @retval 0: successful, else failed
|
||||
*/
|
||||
uint32_t tusb546_DPRedriver_EnableChannel(uint16_t Address,
|
||||
DPREDRIVER_ChannelId_t ChannelId)
|
||||
{
|
||||
uint32_t err_count = 0;
|
||||
uint8_t ctlreg;
|
||||
|
||||
err_count += MUX_IO_Read(Address, TUSB546_REG_DP_CTRL4, &ctlreg);
|
||||
|
||||
switch(ChannelId)
|
||||
{
|
||||
case CHANNEL_DP0:
|
||||
ctlreg &= ~TUSB546_REG_DP_CTRL4_DP0_DISABLE;
|
||||
break;
|
||||
case CHANNEL_DP1:
|
||||
ctlreg &= ~TUSB546_REG_DP_CTRL4_DP1_DISABLE;
|
||||
break;
|
||||
case CHANNEL_DP2:
|
||||
ctlreg &= ~TUSB546_REG_DP_CTRL4_DP2_DISABLE;
|
||||
break;
|
||||
case CHANNEL_DP3:
|
||||
ctlreg &= ~TUSB546_REG_DP_CTRL4_DP3_DISABLE;
|
||||
break;
|
||||
default:
|
||||
/* Nothing to do */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Enable the DP line */
|
||||
err_count += MUX_IO_Write(Address, TUSB546_REG_DP_CTRL4, ctlreg);
|
||||
|
||||
return err_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable a DP channel.
|
||||
* @param Address TUSB546 address on communication Bus.
|
||||
* @param ChannelId Channel identifier.
|
||||
* This parameter can be take one of the following values:
|
||||
* CHANNEL_DP0
|
||||
* CHANNEL_DP1
|
||||
* CHANNEL_DP2
|
||||
* CHANNEL_DP3
|
||||
* @retval 0: successful, else failed
|
||||
*/
|
||||
uint32_t tusb546_DPRedriver_DisableChannel(uint16_t Address,
|
||||
DPREDRIVER_ChannelId_t ChannelId)
|
||||
{
|
||||
uint32_t err_count = 0;
|
||||
uint8_t ctlreg;
|
||||
|
||||
err_count += MUX_IO_Read(Address, TUSB546_REG_DP_CTRL4, &ctlreg);
|
||||
|
||||
switch(ChannelId)
|
||||
{
|
||||
case CHANNEL_DP0:
|
||||
ctlreg |= TUSB546_REG_DP_CTRL4_DP0_DISABLE;
|
||||
break;
|
||||
case CHANNEL_DP1:
|
||||
ctlreg |= TUSB546_REG_DP_CTRL4_DP1_DISABLE;
|
||||
break;
|
||||
case CHANNEL_DP2:
|
||||
ctlreg |= TUSB546_REG_DP_CTRL4_DP2_DISABLE;
|
||||
break;
|
||||
case CHANNEL_DP3:
|
||||
ctlreg |= TUSB546_REG_DP_CTRL4_DP3_DISABLE;
|
||||
break;
|
||||
default:
|
||||
/* Nothing to do */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Disable the DP line */
|
||||
err_count += MUX_IO_Write(Address, TUSB546_REG_DP_CTRL4, ctlreg);
|
||||
|
||||
return err_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
474
USB-PD_Provider_1port/Drivers/BSP/Components/tusb546/tusb546.h
Normal file
474
USB-PD_Provider_1port/Drivers/BSP/Components/tusb546/tusb546.h
Normal file
|
@ -0,0 +1,474 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file tusb546.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header for tusb546.h module
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef TUSB546_H
|
||||
#define TUSB546_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
#include "../Common/usbtypecswitch.h"
|
||||
#include "../Common/dpredriver.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup TUSB546
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup TUSB546_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
/******************************* Register Map ********************************/
|
||||
#define TUSB546_REG_CTRL 0x0A /*!< */
|
||||
#define TUSB546_REG_DP_CTRL1 0x10 /*!< */
|
||||
#define TUSB546_REG_DP_CTRL2 0x11 /*!< */
|
||||
#define TUSB546_REG_DP_CTRL3 0x12 /*!< */
|
||||
#define TUSB546_REG_DP_CTRL4 0x13 /*!< */
|
||||
#define TUSB546_REG_USB3_CTRL1 0x20 /*!< */
|
||||
#define TUSB546_REG_USB3_CTRL2 0x21 /*!< */
|
||||
#define TUSB546_REG_USB3_CTRL3 0x22 /*!< */
|
||||
|
||||
/*********************** Bit definition for CTRL register *******************/
|
||||
#define TUSB546_REG_CTRL_CTLSEL_Pos (0U)
|
||||
#define TUSB546_REG_CTRL_CTLSEL_Msk (0x3U << TUSB546_REG_CTRL_CTLSEL_Pos) /*!< 0x03*/
|
||||
#define TUSB546_REG_CTRL_CTLSEL TUSB546_REG_CTRL_CTLSEL_Msk /*!< DP Alt mode and USB 3.1 Switch Control */
|
||||
#define TUSB546_REG_CTRL_CTLSEL_0 (0x1 << TUSB546_REG_CTRL_CTLSEL_Pos) /*!< 0x01 */
|
||||
#define TUSB546_REG_CTRL_CTLSEL_1 (0x2 << TUSB546_REG_CTRL_CTLSEL_Pos) /*!< 0x02 */
|
||||
#define TUSB546_REG_CTRL_FLIPSEL_Pos (2U)
|
||||
#define TUSB546_REG_CTRL_FLIPSEL_Msk (0x1U << TUSB546_REG_CTRL_FLIPSEL_Pos) /*!< 0x04*/
|
||||
#define TUSB546_REG_CTRL_FLIPSEL TUSB546_REG_CTRL_FLIPSEL_Msk /*!< Flip Control */
|
||||
#define TUSB546_REG_CTRL_HPDIN_OVERRIDE_Pos (3U)
|
||||
#define TUSB546_REG_CTRL_HPDIN_OVERRIDE_Msk (0x1U << TUSB546_REG_CTRL_HPDIN_OVERRIDE_Pos) /*!< 0x08*/
|
||||
#define TUSB546_REG_CTRL_HPDIN_OVERRIDE TUSB546_REG_CTRL_HPDIN_OVERRIDE_Msk /*!< HPDIN control */
|
||||
#define TUSB546_REG_CTRL_EQ_OVERRIDE_Pos (4U)
|
||||
#define TUSB546_REG_CTRL_EQ_OVERRIDE_Msk (0x1U << TUSB546_REG_CTRL_EQ_OVERRIDE_Pos) /*!< 0x10*/
|
||||
#define TUSB546_REG_CTRL_EQ_OVERRIDE TUSB546_REG_CTRL_EQ_OVERRIDE_Msk /*!< EQ settings control */
|
||||
#define TUSB546_REG_CTRL_SWAP_HPDIN_Pos (5U)
|
||||
#define TUSB546_REG_CTRL_SWAP_HPDIN_Msk (0x1U << TUSB546_REG_CTRL_SWAP_HPDIN_Pos) /*!< 0x20*/
|
||||
#define TUSB546_REG_CTRL_SWAP_HPDIN TUSB546_REG_CTRL_SWAP_HPDIN_Msk /*!< HPDIN pin control */
|
||||
|
||||
/********************* Bit definition for DP_CTRL1 register *****************/
|
||||
#define TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Pos (0U)
|
||||
#define TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Msk (0xFU << TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Pos) /*!< 0x0F */
|
||||
#define TUSB546_REG_DP_CTRL1_DP0EQ_SEL TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Msk /*!< Field selects between 0 to 14dB of EQ for DP lane 0 */
|
||||
#define TUSB546_REG_DP_CTRL1_DP0EQ_SEL_0 (0x1 << TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Pos) /*!< 0x01 */
|
||||
#define TUSB546_REG_DP_CTRL1_DP0EQ_SEL_1 (0x2 << TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Pos) /*!< 0x02 */
|
||||
#define TUSB546_REG_DP_CTRL1_DP0EQ_SEL_2 (0x4 << TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Pos) /*!< 0x04 */
|
||||
#define TUSB546_REG_DP_CTRL1_DP0EQ_SEL_4 (0x8 << TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Pos) /*!< 0x08 */
|
||||
#define TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Pos (4U)
|
||||
#define TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Msk (0xFU << TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Pos) /*!< 0xF0*/
|
||||
#define TUSB546_REG_DP_CTRL1_DP1EQ_SEL TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Msk /*!< Field selects between 0 to 14dB of EQ for DP lane 1 */
|
||||
#define TUSB546_REG_DP_CTRL1_DP1EQ_SEL_0 (0x1 << TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Pos) /*!< 0x10 */
|
||||
#define TUSB546_REG_DP_CTRL1_DP1EQ_SEL_1 (0x2 << TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Pos) /*!< 0x20 */
|
||||
#define TUSB546_REG_DP_CTRL1_DP1EQ_SEL_2 (0x4 << TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Pos) /*!< 0x40 */
|
||||
#define TUSB546_REG_DP_CTRL1_DP1EQ_SEL_4 (0x8 << TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Pos) /*!< 0x80 */
|
||||
|
||||
/********************* Bit definition for DP_CTRL2 register *****************/
|
||||
#define TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Pos (0U)
|
||||
#define TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Msk (0xFU << TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Pos) /*!< 0x0F */
|
||||
#define TUSB546_REG_DP_CTRL2_DP2EQ_SEL TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Msk /*!< Field selects between 0 to 14dB of EQ for DP lane 2 */
|
||||
#define TUSB546_REG_DP_CTRL1_DP2EQ_SEL_0 (0x1 << TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Pos) /*!< 0x01 */
|
||||
#define TUSB546_REG_DP_CTRL1_DP2EQ_SEL_1 (0x2 << TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Pos) /*!< 0x02 */
|
||||
#define TUSB546_REG_DP_CTRL1_DP2EQ_SEL_2 (0x4 << TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Pos) /*!< 0x04 */
|
||||
#define TUSB546_REG_DP_CTRL1_DP2EQ_SEL_4 (0x8 << TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Pos) /*!< 0x08 */
|
||||
#define TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Pos (4U)
|
||||
#define TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Msk (0xFU << TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Pos) /*!< 0xF0*/
|
||||
#define TUSB546_REG_DP_CTRL2_DP3EQ_SEL TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Msk /*!< Field selects between 0 to 14dB of EQ for DP lane 3 */
|
||||
#define TUSB546_REG_DP_CTRL1_DP3EQ_SEL_0 (0x1 << TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Pos) /*!< 0x10 */
|
||||
#define TUSB546_REG_DP_CTRL1_DP3EQ_SEL_1 (0x2 << TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Pos) /*!< 0x20 */
|
||||
#define TUSB546_REG_DP_CTRL1_DP3EQ_SEL_2 (0x4 << TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Pos) /*!< 0x40 */
|
||||
#define TUSB546_REG_DP_CTRL1_DP3EQ_SEL_4 (0x8 << TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Pos) /*!< 0x80 */
|
||||
|
||||
/********************* Bit definition for DP_CTRL3 register *****************/
|
||||
#define TUSB546_REG_DP_CTRL3_LANE_COUNT_SET_Pos (0U)
|
||||
#define TUSB546_REG_DP_CTRL3_LANE_COUNT_SET_Msk (0x1FU << TUSB546_REG_DP_CTRL3_LANE_COUNT_SET_Pos) /*!< 0x1F */
|
||||
#define TUSB546_REG_DP_CTRL3_LANE_COUNT_SET TUSB546_REG_DP_CTRL3_LANE_COUNT_SET_Msk /*!< */
|
||||
#define TUSB546_REG_DP_CTRL3_SET_POWER_STATE_Pos (5U)
|
||||
#define TUSB546_REG_DP_CTRL3_SET_POWER_STATE_Msk (0x3U << TUSB546_REG_DP_CTRL3_SET_POWER_STATE5_Pos) /*!< 0x60 */
|
||||
#define TUSB546_REG_DP_CTRL3_SET_POWER_STATE TUSB546_REG_DP_CTRL3_SET_POWER_STATE5_Msk /*!< */
|
||||
#define TUSB546_REG_DP_CTRL3_SET_POWER_STATE_0 (0x1 << TUSB546_REG_DP_CTRL3_SET_POWER_STATE_Pos) /*!< 0x20 */
|
||||
#define TUSB546_REG_DP_CTRL3_SET_POWER_STATE_1 (0x2 << TUSB546_REG_DP_CTRL3_SET_POWER_STATE_Pos) /*!< 0x40 */
|
||||
|
||||
/********************* Bit definition for DP_CTRL4 register *****************/
|
||||
#define TUSB546_REG_DP_CTRL4_DP0_DISABLE_Pos (0U)
|
||||
#define TUSB546_REG_DP_CTRL4_DP0_DISABLE_Msk (0x1U << TUSB546_REG_DP_CTRL4_DP0_DISABLE_Pos) /*!< 0x01 */
|
||||
#define TUSB546_REG_DP_CTRL4_DP0_DISABLE TUSB546_REG_DP_CTRL4_DP0_DISABLE_Msk /*!< DP Lane 0 disable */
|
||||
#define TUSB546_REG_DP_CTRL4_DP1_DISABLE_Pos (1U)
|
||||
#define TUSB546_REG_DP_CTRL4_DP1_DISABLE_Msk (0x1U << TUSB546_REG_DP_CTRL4_DP1_DISABLE_Pos) /*!< 0x02 */
|
||||
#define TUSB546_REG_DP_CTRL4_DP1_DISABLE TUSB546_REG_DP_CTRL4_DP1_DISABLE_Msk /*!< DP Lane 1 disable */
|
||||
#define TUSB546_REG_DP_CTRL4_DP2_DISABLE_Pos (2U)
|
||||
#define TUSB546_REG_DP_CTRL4_DP2_DISABLE_Msk (0x1U << TUSB546_REG_DP_CTRL4_DP2_DISABLE_Pos) /*!< 0x04 */
|
||||
#define TUSB546_REG_DP_CTRL4_DP2_DISABLE TUSB546_REG_DP_CTRL4_DP2_DISABLE_Msk /*!< DP Lane 2 disable */
|
||||
#define TUSB546_REG_DP_CTRL4_DP3_DISABLE_Pos (3U)
|
||||
#define TUSB546_REG_DP_CTRL4_DP3_DISABLE_Msk (0x1U << TUSB546_REG_DP_CTRL4_DP3_DISABLE_Pos) /*!< 0x08 */
|
||||
#define TUSB546_REG_DP_CTRL4_DP3_DISABLE TUSB546_REG_DP_CTRL4_DP3_DISABLE_Msk /*!< DP Lane 3 disable */
|
||||
#define TUSB546_REG_DP_CTRL4_AUX_SBU_OVR_Pos (4U)
|
||||
#define TUSB546_REG_DP_CTRL4_AUX_SBU_OVR_Msk (0x3U << TUSB546_REG_DP_CTRL4_AUX_SBU_OVR_Pos) /*!< 0x30 */
|
||||
#define TUSB546_REG_DP_CTRL4_AUX_SBU_OVR TUSB546_REG_DP_CTRL4_AUX_SBU_OVR_Msk /*!< AUX to SBU config */
|
||||
#define TUSB546_REG_DP_CTRL4_AUX_SBU_OVR_0 (0x1 << TUSB546_REG_DP_CTRL4_AUX_SBU_OVR_Pos) /*!< 0x10 */
|
||||
#define TUSB546_REG_DP_CTRL4_AUX_SBU_OVR_1 (0x2 << TUSB546_REG_DP_CTRL4_AUX_SBU_OVR_Pos) /*!< 0x20 */
|
||||
#define TUSB546_REG_DP_CTRL4_SNOOP_DISABLE_Pos (7U)
|
||||
#define TUSB546_REG_DP_CTRL4_SNOOP_DISABLE_Msk (0x1U << TUSB546_REG_DP_CTRL4_SNOOP_DISABLE_Pos) /*!< 0x80 */
|
||||
#define TUSB546_REG_DP_CTRL4_SNOOP_DISABLE TUSB546_REG_DP_CTRL4_SNOOP_DISABLE_Msk /*!< AUX snoop disable */
|
||||
|
||||
/******************** Bit definition for USB3_CTRL1 register ****************/
|
||||
#define TUSB546_REG_USB3_CTRL1_EQ1_SEL_Pos (0U)
|
||||
#define TUSB546_REG_USB3_CTRL1_EQ1_SEL_Msk (0xFU << TUSB546_REG_USB3_CTRL1_EQ1_SEL_Pos) /*!< 0x0F */
|
||||
#define TUSB546_REG_USB3_CTRL1_EQ1_SEL TUSB546_REG_USB3_CTRL1_EQ1_SEL_Msk /*!< Field selects between 0 to 11 dB of EQ for USB3.1 RX1 receiver */
|
||||
#define TUSB546_REG_USB3_CTRL1_EQ1_SEL_0 (0x1 << TUSB546_REG_USB3_CTRL1_EQ1_SEL_Pos) /*!< 0x01 */
|
||||
#define TUSB546_REG_USB3_CTRL1_EQ1_SEL_1 (0x2 << TUSB546_REG_USB3_CTRL1_EQ1_SEL_Pos) /*!< 0x02 */
|
||||
#define TUSB546_REG_USB3_CTRL1_EQ1_SEL_2 (0x4 << TUSB546_REG_USB3_CTRL1_EQ1_SEL_Pos) /*!< 0x04 */
|
||||
#define TUSB546_REG_USB3_CTRL1_EQ1_SEL_4 (0x8 << TUSB546_REG_USB3_CTRL1_EQ1_SEL_Pos) /*!< 0x08 */
|
||||
#define TUSB546_REG_USB3_CTRL1_EQ2_SEL_Pos (4U)
|
||||
#define TUSB546_REG_USB3_CTRL1_EQ2_SEL_Msk (0xFU << TUSB546_REG_USB3_CTRL1_EQ2_SEL_Pos) /*!< 0xF0 */
|
||||
#define TUSB546_REG_USB3_CTRL1_EQ2_SEL TUSB546_REG_USB3_CTRL1_EQ2_SEL_Msk /*!< Field selects between 0 to 11 dB of EQ for USB3.1 RX2 receiver */
|
||||
#define TUSB546_REG_USB3_CTRL1_EQ2_SEL_0 (0x1 << TUSB546_REG_USB3_CTRL1_EQ2_SEL_Pos) /*!< 0x10 */
|
||||
#define TUSB546_REG_USB3_CTRL1_EQ2_SEL_1 (0x2 << TUSB546_REG_USB3_CTRL1_EQ2_SEL_Pos) /*!< 0x20 */
|
||||
#define TUSB546_REG_USB3_CTRL1_EQ2_SEL_2 (0x4 << TUSB546_REG_USB3_CTRL1_EQ2_SEL_Pos) /*!< 0x40 */
|
||||
#define TUSB546_REG_USB3_CTRL1_EQ2_SEL_4 (0x8 << TUSB546_REG_USB3_CTRL1_EQ2_SEL_Pos) /*!< 0x80 */
|
||||
|
||||
/******************** Bit definition for USB3_CTRL2 register ****************/
|
||||
#define TUSB546_USB3_CTRL2_SSEQ_SEL_Pos (0U)
|
||||
#define TUSB546_USB3_CTRL2_SSEQ_SEL_Msk (0xFU << TUSB546_USB3_CTRL2_SSEQ_SEL_Pos) /*!< 0x0F */
|
||||
#define TUSB546_USB3_CTRL2_SSEQ_SEL TUSB546_USB3_CTRL2_SSEQ_SEL_Msk /*!< Field selects between 0 to 9 dB of EQ for USB3.1 SSTXP/N receiver */
|
||||
#define TUSB546_USB3_CTRL2_SSEQ_SEL_0 (0x1 << TUSB546_USB3_CTRL2_SSEQ_SEL_Pos) /*!< 0x01 */
|
||||
#define TUSB546_USB3_CTRL2_SSEQ_SEL_1 (0x2 << TUSB546_USB3_CTRL2_SSEQ_SEL_Pos) /*!< 0x02 */
|
||||
#define TUSB546_USB3_CTRL2_SSEQ_SEL_2 (0x4 << TUSB546_USB3_CTRL2_SSEQ_SEL_Pos) /*!< 0x04 */
|
||||
#define TUSB546_USB3_CTRL2_SSEQ_SEL_4 (0x8 << TUSB546_USB3_CTRL2_SSEQ_SEL_Pos) /*!< 0x08 */
|
||||
|
||||
/******************** Bit definition for USB3_CTRL3 register ****************/
|
||||
#define TUSB546_REG_USB3_CTRL3_COMPLIANCE_Pos (0U)
|
||||
#define TUSB546_REG_USB3_CTRL3_COMPLIANCE_Msk (0x3U << TUSB546_REG_USB3_CTRL3_COMPLIANCE_Pos) /*!< 0x03 */
|
||||
#define TUSB546_REG_USB3_CTRL3_COMPLIANCE TUSB546_REG_USB3_CTRL3_COMPLIANCE_Msk /*!< Compliance mode */
|
||||
#define TUSB546_REG_USB3_CTRL3_COMPLIANCE_0 (0x1 << TUSB546_REG_USB3_CTRL3_COMPLIANCE_Pos) /*!< 0x01 */
|
||||
#define TUSB546_REG_USB3_CTRL3_COMPLIANCE_1 (0x2 << TUSB546_REG_USB3_CTRL3_COMPLIANCE_Pos) /*!< 0x02 */
|
||||
#define TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_Pos (2U)
|
||||
#define TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_Msk (0x3U << TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_Pos) /*!< 0x0C */
|
||||
#define TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_Msk /*!< Rx.Detect interval for the Downstream facing port */
|
||||
#define TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_0 (0x1 << TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_Pos) /*!< 0x04 */
|
||||
#define TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_1 (0x2 << TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_Pos) /*!< 0x08 */
|
||||
#define TUSB546_REG_USB3_CTRL3_DISABLE_U2U3_RXDET_Pos (4U)
|
||||
#define TUSB546_REG_USB3_CTRL3_DISABLE_U2U3_RXDET_Msk (0x1U << TUSB546_REG_USB3_CTRL3_DISABLE_U2U3_RXDET_Pos) /*!< 0x10 */
|
||||
#define TUSB546_REG_USB3_CTRL3_DISABLE_U2U3_RXDET TUSB546_REG_USB3_CTRL3_DISABLE_U2U3_RXDET_Msk /*!< Rx.Detect in U2/U3 disabled */
|
||||
#define TUSB546_REG_USB3_CTRL3_U2U3_LFPS_DEBOUNCE_Pos (5U)
|
||||
#define TUSB546_REG_USB3_CTRL3_U2U3_LFPS_DEBOUNCE_Msk (0x1U << TUSB546_REG_USB3_CTRL3_U2U3_LFPS_DEBOUNCE_Pos) /*!< 0x20 */
|
||||
#define TUSB546_REG_USB3_CTRL3_U2U3_LFPS_DEBOUNCE TUSB546_REG_USB3_CTRL3_U2U3_LFPS_DEBOUNCE_Msk /*!< Debounce of LFPS before U2/U3 exit enabled */
|
||||
#define TUSB546_REG_USB3_CTRL3_LFPS_EQ_Pos (6U)
|
||||
#define TUSB546_REG_USB3_CTRL3_LFPS_EQ_Msk (0x1U << TUSB546_REG_USB3_CTRL3_LFPS_EQ_Pos) /*!< 0x40 */
|
||||
#define TUSB546_REG_USB3_CTRL3_LFPS_EQ TUSB546_REG_USB3_CTRL3_LFPS_EQ_Msk /*!< EQ settings control */
|
||||
#define TUSB546_REG_USB3_CM_ACTIVE_EQ_Pos (7U)
|
||||
#define TUSB546_REG_USB3_CM_ACTIVE_EQ_Msk (0x1U << TUSB546_REG_USB3_CM_ACTIVE_EQ_Pos) /*!< 0x80 */
|
||||
#define TUSB546_REG_USB3_CM_ACTIVE_EQ TUSB546_REG_USB3_CM_ACTIVE_EQ_Msk /*!< USB 3.1 compliance mode */
|
||||
|
||||
/** @defgroup TUSB546_MODE TUSB546 functioning mode
|
||||
* @{
|
||||
*/
|
||||
#define TUSB546_MODE_DISABLED 0x0U
|
||||
#define TUSB546_MODE_USB3_ONLY TUSB546_REG_CTRL_CTLSEL_0
|
||||
#define TUSB546_MODE_FOUR_DPLANES TUSB546_REG_CTRL_CTLSEL_1
|
||||
#define TUSB546_MODE_TWO_DPLANES_USB3 TUSB546_REG_CTRL_CTLSEL
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TUSB546_ORIENTATION TUSB546 Type-C Cable Orientation
|
||||
* @{
|
||||
*/
|
||||
#define TUSB546_ORIENTATION_NORMAL 0x0U
|
||||
#define TUSB546_ORIENTATION_FLIPPED TUSB546_REG_CTRL_FLIPSEL
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TUSB546_DPLANE DP Lane Identifier
|
||||
* @{
|
||||
*/
|
||||
#define TUSB546_DPLANE_0 0x0U
|
||||
#define TUSB546_DPLANE_1 0x2U
|
||||
#define TUSB546_DPLANE_2 0x4U
|
||||
#define TUSB546_DPLANE_3 0x8U
|
||||
#define TUSB546_DPLANE_ALL 0xFU
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TUSB546_USBSIGNAL TUSB546 USB 3.1 signal identifier
|
||||
* @{
|
||||
*/
|
||||
#define TUSB546_USBSIGNAL_RX1 0x0U
|
||||
#define TUSB546_USBSIGNAL_RX2 0x1U
|
||||
#define TUSB546_USBSIGNAL_SSTX 0x2U
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TUSB546_EQGAIN TUSB546 Equalizer Gain
|
||||
* @{
|
||||
.------------------------.-------------------------.-------------------------.------------------------.
|
||||
| Equalization setting # | USB3.1 DFP EQ Gain (dB) | USB3.1 UFP EQ Gain (dB) | DISPLAYPORT LANES (dB) |
|
||||
'------------------------'-------------------------'-------------------------'------------------------'
|
||||
| 0 | 0.2 | -1.6 | 1.0 |
|
||||
| 1 | 1.2 | -0.5 | 3.3 |
|
||||
| 2 | 2.2 | 0.5 | 4.9 |
|
||||
| 3 | 3.3 | 1.6 | 6.5 |
|
||||
| 4 | 4.2 | 2.4 | 7.5 |
|
||||
| 5 | 5.1 | 3.4 | 8.6 |
|
||||
| 6 | 5.9 | 4.1 | 9.5 |
|
||||
| 7 | 6.7 | 4.9 | 10.4 |
|
||||
| 8 | 7.4 | 5.7 | 11.1 |
|
||||
| 9 | 8.1 | 6.4 | 11.7 |
|
||||
| 10 | 8.7 | 6.9 | 12.3 |
|
||||
| 11 | 9.3 | 7.5 | 12.8 |
|
||||
| 12 | 9.7 | 8.0 | 13.2 |
|
||||
| 13 | 10.2 | 8.5 | 13.6 |
|
||||
| 14 | 10.6 | 8.9 | 14.0 |
|
||||
| 15 | 11.1 | 9.4 | 14.4 |
|
||||
'------------------------'-------------------------'-------------------------'------------------------'
|
||||
*/
|
||||
#define TUSB546_EQGAIN_0 0x0U
|
||||
#define TUSB546_EQGAIN_1 0x1U
|
||||
#define TUSB546_EQGAIN_2 0x2U
|
||||
#define TUSB546_EQGAIN_3 0x3U
|
||||
#define TUSB546_EQGAIN_4 0x4U
|
||||
#define TUSB546_EQGAIN_5 0x5U
|
||||
#define TUSB546_EQGAIN_6 0x6U
|
||||
#define TUSB546_EQGAIN_7 0x7U
|
||||
#define TUSB546_EQGAIN_8 0x8U
|
||||
#define TUSB546_EQGAIN_9 0x9U
|
||||
#define TUSB546_EQGAIN_10 0xAU
|
||||
#define TUSB546_EQGAIN_11 0xBU
|
||||
#define TUSB546_EQGAIN_12 0xCU
|
||||
#define TUSB546_EQGAIN_13 0xDU
|
||||
#define TUSB546_EQGAIN_14 0xEU
|
||||
#define TUSB546_EQGAIN_15 0xFU
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TUSB546_DPCDREG TUSB546 Display Port Configuration Data (DPCD) register identifier
|
||||
* @{
|
||||
*/
|
||||
#define TUSB546_DPCDREG_LANE_COUNT_SET 0x0U
|
||||
#define TUSB546_DPCDREG_SET_POWER 0x1U
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TUSB546_AUXTOSBU TUSB546 AUXp or AUXn to SBU1 or SBU2 connect/disconnect override
|
||||
* @{
|
||||
*/
|
||||
#define TUSB546_AUXTOSBU_DEFAULT 0x0U
|
||||
#define TUSB546_AUXTOSBU_OVERRIDE 0x1U
|
||||
#define TUSB546_AUXTOSBU_OPEN 0x2U
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TUSB546_USB3_COMPLIANCEMODE USB 3.1 Compliance mode
|
||||
* @{
|
||||
*/
|
||||
#define TUSB546_USB3_COMPLIANCEMODE_FSM 0x0U
|
||||
#define TUSB546_USB3_COMPLIANCEMODE_DFP TUSB546_REG_USB3_CTRL3_COMPLIANCE_0
|
||||
#define TUSB546_USB3_COMPLIANCEMODE_UFP TUSB546_REG_USB3_CTRL3_COMPLIANCE_1
|
||||
#define TUSB546_USB3_COMPLIANCEMODE_DISABLED TUSB546_REG_USB3_CTRL3_COMPLIANCE
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TUSB546_RXDET_INTERVAL USB 3.1 Rx.Detect interval for the Downstream facing port (TX1P/N and TX2P/N)
|
||||
* @{
|
||||
*/
|
||||
#define TUSB546_RXDET_INTERVAL_8MS 0x0U
|
||||
#define TUSB546_RXDET_INTERVAL_12MS TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_0
|
||||
#define TUSB546_RXDET_INTERVAL_48MS TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_1
|
||||
#define TUSB546_RXDET_INTERVAL_96MS TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#if defined(TUSB546_DEBUG)
|
||||
/** @defgroup TUSB546_Exported_Structure TUSB546 Exported Structure
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef union {
|
||||
uint8_t Register;
|
||||
struct {
|
||||
uint8_t CTLSEL:2;
|
||||
uint8_t FLIPSEL:1;
|
||||
uint8_t HPDIN_OVRRIDE:1;
|
||||
uint8_t EQ_OVERRIDE:1;
|
||||
uint8_t SWAP_HPDIN :1;
|
||||
uint8_t Reserved:2;
|
||||
};
|
||||
} TUSB546_GeneralRegTypeDef;
|
||||
|
||||
typedef union {
|
||||
uint8_t Register;
|
||||
struct {
|
||||
uint8_t DP0EQ_SEL:4;
|
||||
uint8_t DP1EQ_SEL:4;
|
||||
};
|
||||
} TUSB546_DPCtrlStatusReg10TypeDef;
|
||||
|
||||
typedef union {
|
||||
uint8_t Register;
|
||||
struct {
|
||||
uint8_t DP2EQ_SEL:4;
|
||||
uint8_t DP3EQ_SEL:4;
|
||||
};
|
||||
} TUSB546_DPCtrlStatusReg11TypeDef;
|
||||
|
||||
typedef union {
|
||||
uint8_t Register;
|
||||
struct {
|
||||
uint8_t LANE_COUNT_SET :5;
|
||||
uint8_t SET_POWER_STATE :2;
|
||||
uint8_t Reserved :1;
|
||||
};
|
||||
} TUSB546_DPCtrlStatusReg12TypeDef;
|
||||
|
||||
typedef union {
|
||||
uint8_t Register;
|
||||
struct {
|
||||
uint8_t DP0_DISABLE :1;
|
||||
uint8_t DP1_DISABLE :1;
|
||||
uint8_t DP2_DISABLE :1;
|
||||
uint8_t DP3_DISABLE :1;
|
||||
uint8_t AUX_SBU_OVR :2;
|
||||
uint8_t Reserved :1;
|
||||
uint8_t AUX_SNOOP_DISABLE :1;
|
||||
};
|
||||
} TUSB546_DPCtrlStatusReg13TypeDef;
|
||||
|
||||
typedef union {
|
||||
uint8_t Register;
|
||||
struct {
|
||||
uint8_t Reserved :8;
|
||||
};
|
||||
} TUSB546_USBCtrlStatusReg20TypeDef;
|
||||
|
||||
typedef union {
|
||||
uint8_t Register;
|
||||
struct {
|
||||
uint8_t Reserved :8;
|
||||
};
|
||||
} TUSB546_USBCtrlStatusReg21TypeDef;
|
||||
|
||||
typedef union {
|
||||
uint8_t Register;
|
||||
struct {
|
||||
uint8_t Reserved :8;
|
||||
};
|
||||
} TUSB546_USBCtrlStatusReg22TypeDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
TUSB546_GeneralRegTypeDef General; /*!< General Registers (0x0A) */
|
||||
TUSB546_DPCtrlStatusReg10TypeDef DPCtrlStatus10; /*!< DisplayPort Control/Status Registers (0x10)*/
|
||||
TUSB546_DPCtrlStatusReg11TypeDef DPCtrlStatus11; /*!< DisplayPort Control/Status Registers (0x11)*/
|
||||
TUSB546_DPCtrlStatusReg12TypeDef DPCtrlStatus12; /*!< DisplayPort Control/Status Registers (0x12) */
|
||||
TUSB546_DPCtrlStatusReg13TypeDef DPCtrlStatus13; /*!< DisplayPort Control/Status Registers (0x13) */
|
||||
TUSB546_USBCtrlStatusReg20TypeDef USBCtrlStatus20;/*!< USB3.1 Control/Status Registers (0x20) */
|
||||
TUSB546_USBCtrlStatusReg21TypeDef USBCtrlStatus21;/*!< USB3.1 Control/Status Registers (0x21) */
|
||||
TUSB546_USBCtrlStatusReg22TypeDef USBCtrlStatus22;/*!< USB3.1 Control/Status Registers (0x22) */
|
||||
} TUSB546_RegistersTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* TUSB546_DEBUG */
|
||||
|
||||
/** @defgroup TUSB546_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
/* USB Type-C cross switch management functions */
|
||||
uint32_t tusb546_CrossSwitch_Init(uint16_t Address);
|
||||
void tusb546_CrossSwitch_DeInit(uint16_t Address);
|
||||
uint32_t tusb546_CrossSwitch_PowerOn(uint16_t Address);
|
||||
uint32_t tusb546_CrossSwitch_PowerOff(uint16_t Address);
|
||||
uint32_t tusb546_CrossSwitch_SetMode(uint16_t Address, TYPECSWITCH_Mode_t Mode);
|
||||
uint32_t tusb546_CrossSwitch_IsSupportedMode(TYPECSWITCH_Mode_t Mode);
|
||||
|
||||
/* DisplayPort Linear Redriver management functions */
|
||||
uint32_t tusb546_DPRedriver_Init(uint16_t Address);
|
||||
void tusb546_DPRedriver_DeInit(uint16_t Address);
|
||||
uint32_t tusb546_DPRedriver_PowerOn(uint16_t Address);
|
||||
uint32_t tusb546_DPRedriver_PowerOff(uint16_t Address);
|
||||
uint32_t tusb546_DPRedriver_SetEQGain(uint16_t Address, DPREDRIVER_ChannelId_t ChannelId, uint8_t EQGain);
|
||||
uint32_t tusb546_DPRedriver_EnableChannel(uint16_t Address, DPREDRIVER_ChannelId_t ChannelId);
|
||||
uint32_t tusb546_DPRedriver_DisableChannel(uint16_t Address, DPREDRIVER_ChannelId_t ChannelId);
|
||||
|
||||
/* MUX IO functions */
|
||||
uint8_t MUX_IO_Init(void);
|
||||
void MUX_IO_DeInit(void);
|
||||
uint8_t MUX_IO_Write(uint16_t Addr, uint16_t Reg, uint8_t Data);
|
||||
uint8_t MUX_IO_Read(uint16_t Addr, uint16_t Reg, uint8_t *pData);
|
||||
uint32_t MUX_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TUSB546_Exported_Variables
|
||||
* @{
|
||||
*/
|
||||
/* USB Type-C crossbar switch driver structure */
|
||||
extern TYPECSWITCH_Drv_t tusb546_drv_CrossSwitch;
|
||||
|
||||
/* Displayport Linear Redriver driver structure */
|
||||
extern DPREDRIVER_Drv_t tusb546_drv_LinearRedriver;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TUSB546_H */
|
||||
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
Loading…
Add table
Add a link
Reference in a new issue