TARGET_STM_EMAC astyle

pull/7351/head
jeromecoutant 2018-06-27 15:00:51 +02:00
parent 057142167b
commit 6391b7f2fa
16 changed files with 86 additions and 86 deletions

View File

@ -33,7 +33,7 @@
/** /**
* Override HAL Eth Init function * Override HAL Eth Init function
*/ */
void HAL_ETH_MspInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
{ {
GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitTypeDef GPIO_InitStructure;
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
@ -59,7 +59,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Configure PA1, PA2 and PA7 */ /* Configure PA1, PA2 and PA7 */
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH; GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP; GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Alternate = GPIO_AF11_ETH; GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7; GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure); HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
@ -79,7 +79,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Enable the Ethernet global Interrupt */ /* Enable the Ethernet global Interrupt */
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0); HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
HAL_NVIC_EnableIRQ(ETH_IRQn); HAL_NVIC_EnableIRQ(ETH_IRQn);
/* Enable ETHERNET clock */ /* Enable ETHERNET clock */
__HAL_RCC_ETH_CLK_ENABLE(); __HAL_RCC_ETH_CLK_ENABLE();
} }
@ -88,7 +88,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/** /**
* Override HAL Eth DeInit function * Override HAL Eth DeInit function
*/ */
void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
{ {
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
/* Peripheral clock disable */ /* Peripheral clock disable */

View File

@ -18,8 +18,7 @@
void _eth_config_mac(ETH_HandleTypeDef *heth) void _eth_config_mac(ETH_HandleTypeDef *heth)
{ {
ETH_MACInitTypeDef macconf = ETH_MACInitTypeDef macconf = {
{
.Watchdog = ETH_WATCHDOG_ENABLE, .Watchdog = ETH_WATCHDOG_ENABLE,
.Jabber = ETH_JABBER_ENABLE, .Jabber = ETH_JABBER_ENABLE,
.InterFrameGap = ETH_INTERFRAMEGAP_96BIT, .InterFrameGap = ETH_INTERFRAMEGAP_96BIT,
@ -49,7 +48,7 @@ void _eth_config_mac(ETH_HandleTypeDef *heth)
.TransmitFlowControl = ETH_TRANSMITFLOWCONTROL_DISABLE, .TransmitFlowControl = ETH_TRANSMITFLOWCONTROL_DISABLE,
.VLANTagComparison = ETH_VLANTAGCOMPARISON_16BIT, .VLANTagComparison = ETH_VLANTAGCOMPARISON_16BIT,
.VLANTagIdentifier = 0x0U .VLANTagIdentifier = 0x0U
}; };
if (heth->Init.ChecksumMode == ETH_CHECKSUM_BY_HARDWARE) { if (heth->Init.ChecksumMode == ETH_CHECKSUM_BY_HARDWARE) {
macconf.ChecksumOffload = ETH_CHECKSUMOFFLAOD_ENABLE; macconf.ChecksumOffload = ETH_CHECKSUMOFFLAOD_ENABLE;

View File

@ -18,8 +18,7 @@
void _eth_config_mac(ETH_HandleTypeDef *heth) void _eth_config_mac(ETH_HandleTypeDef *heth)
{ {
ETH_MACInitTypeDef macconf = ETH_MACInitTypeDef macconf = {
{
.Watchdog = ETH_WATCHDOG_ENABLE, .Watchdog = ETH_WATCHDOG_ENABLE,
.Jabber = ETH_JABBER_ENABLE, .Jabber = ETH_JABBER_ENABLE,
.InterFrameGap = ETH_INTERFRAMEGAP_96BIT, .InterFrameGap = ETH_INTERFRAMEGAP_96BIT,
@ -49,7 +48,7 @@ void _eth_config_mac(ETH_HandleTypeDef *heth)
.TransmitFlowControl = ETH_TRANSMITFLOWCONTROL_DISABLE, .TransmitFlowControl = ETH_TRANSMITFLOWCONTROL_DISABLE,
.VLANTagComparison = ETH_VLANTAGCOMPARISON_16BIT, .VLANTagComparison = ETH_VLANTAGCOMPARISON_16BIT,
.VLANTagIdentifier = 0x0U, .VLANTagIdentifier = 0x0U,
}; };
if (heth->Init.ChecksumMode == ETH_CHECKSUM_BY_HARDWARE) { if (heth->Init.ChecksumMode == ETH_CHECKSUM_BY_HARDWARE) {
macconf.ChecksumOffload = ETH_CHECKSUMOFFLAOD_ENABLE; macconf.ChecksumOffload = ETH_CHECKSUMOFFLAOD_ENABLE;

View File

@ -3,7 +3,7 @@
/** /**
* Override HAL Eth Init function * Override HAL Eth Init function
*/ */
void HAL_ETH_MspInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
{ {
GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitTypeDef GPIO_InitStructure;
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
@ -20,7 +20,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
RMII_MII_CRS_DV -------------------> PA7 RMII_MII_CRS_DV -------------------> PA7
RMII_MII_RXD0 ---------------------> PC4 RMII_MII_RXD0 ---------------------> PC4
RMII_MII_RXD1 ---------------------> PC5 RMII_MII_RXD1 ---------------------> PC5
RMII_MII_RXER ---------------------> RMII_MII_RXER --------------------->
RMII_MII_TX_EN --------------------> PB11 RMII_MII_TX_EN --------------------> PB11
RMII_MII_TXD0 ---------------------> PB12 RMII_MII_TXD0 ---------------------> PB12
RMII_MII_TXD1 ---------------------> PB13 RMII_MII_TXD1 ---------------------> PB13
@ -28,7 +28,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Configure PA1, PA2 and PA7 */ /* Configure PA1, PA2 and PA7 */
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH; GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP; GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Alternate = GPIO_AF11_ETH; GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7; GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure); HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
@ -44,7 +44,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Enable the Ethernet global Interrupt */ /* Enable the Ethernet global Interrupt */
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0); HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
HAL_NVIC_EnableIRQ(ETH_IRQn); HAL_NVIC_EnableIRQ(ETH_IRQn);
/* Enable ETHERNET clock */ /* Enable ETHERNET clock */
__HAL_RCC_ETH_CLK_ENABLE(); __HAL_RCC_ETH_CLK_ENABLE();
} }
@ -53,7 +53,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/** /**
* Override HAL Eth DeInit function * Override HAL Eth DeInit function
*/ */
void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
{ {
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
/* Peripheral clock disable */ /* Peripheral clock disable */
@ -66,7 +66,7 @@ void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth)
RMII_MII_CRS_DV -------------------> PA7 RMII_MII_CRS_DV -------------------> PA7
RMII_MII_RXD0 ---------------------> PC4 RMII_MII_RXD0 ---------------------> PC4
RMII_MII_RXD1 ---------------------> PC5 RMII_MII_RXD1 ---------------------> PC5
RMII_MII_RXER ---------------------> RMII_MII_RXER --------------------->
RMII_MII_TX_EN --------------------> PB11 RMII_MII_TX_EN --------------------> PB11
RMII_MII_TXD0 ---------------------> PB12 RMII_MII_TXD0 ---------------------> PB12
RMII_MII_TXD1 ---------------------> PB13 RMII_MII_TXD1 ---------------------> PB13

View File

@ -18,8 +18,7 @@
void _eth_config_mac(ETH_HandleTypeDef *heth) void _eth_config_mac(ETH_HandleTypeDef *heth)
{ {
ETH_MACInitTypeDef macconf = ETH_MACInitTypeDef macconf = {
{
.Watchdog = ETH_WATCHDOG_ENABLE, .Watchdog = ETH_WATCHDOG_ENABLE,
.Jabber = ETH_JABBER_ENABLE, .Jabber = ETH_JABBER_ENABLE,
.InterFrameGap = ETH_INTERFRAMEGAP_96BIT, .InterFrameGap = ETH_INTERFRAMEGAP_96BIT,
@ -49,7 +48,7 @@ void _eth_config_mac(ETH_HandleTypeDef *heth)
.TransmitFlowControl = ETH_TRANSMITFLOWCONTROL_DISABLE, .TransmitFlowControl = ETH_TRANSMITFLOWCONTROL_DISABLE,
.VLANTagComparison = ETH_VLANTAGCOMPARISON_16BIT, .VLANTagComparison = ETH_VLANTAGCOMPARISON_16BIT,
.VLANTagIdentifier = 0x0U, .VLANTagIdentifier = 0x0U,
}; };
if (heth->Init.ChecksumMode == ETH_CHECKSUM_BY_HARDWARE) { if (heth->Init.ChecksumMode == ETH_CHECKSUM_BY_HARDWARE) {
macconf.ChecksumOffload = ETH_CHECKSUMOFFLAOD_ENABLE; macconf.ChecksumOffload = ETH_CHECKSUMOFFLAOD_ENABLE;

View File

@ -33,7 +33,7 @@
/** /**
* Override HAL Eth Init function * Override HAL Eth Init function
*/ */
void HAL_ETH_MspInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
{ {
GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitTypeDef GPIO_InitStructure;
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
@ -59,7 +59,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Configure PA1, PA2 and PA7 */ /* Configure PA1, PA2 and PA7 */
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH; GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP; GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Alternate = GPIO_AF11_ETH; GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7; GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure); HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
@ -79,7 +79,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Enable the Ethernet global Interrupt */ /* Enable the Ethernet global Interrupt */
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0); HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
HAL_NVIC_EnableIRQ(ETH_IRQn); HAL_NVIC_EnableIRQ(ETH_IRQn);
/* Enable ETHERNET clock */ /* Enable ETHERNET clock */
__HAL_RCC_ETH_CLK_ENABLE(); __HAL_RCC_ETH_CLK_ENABLE();
} }
@ -88,7 +88,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/** /**
* Override HAL Eth DeInit function * Override HAL Eth DeInit function
*/ */
void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
{ {
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
/* Peripheral clock disable */ /* Peripheral clock disable */

View File

@ -18,8 +18,7 @@
void _eth_config_mac(ETH_HandleTypeDef *heth) void _eth_config_mac(ETH_HandleTypeDef *heth)
{ {
ETH_MACInitTypeDef macconf = ETH_MACInitTypeDef macconf = {
{
.Watchdog = ETH_WATCHDOG_ENABLE, .Watchdog = ETH_WATCHDOG_ENABLE,
.Jabber = ETH_JABBER_ENABLE, .Jabber = ETH_JABBER_ENABLE,
.InterFrameGap = ETH_INTERFRAMEGAP_96BIT, .InterFrameGap = ETH_INTERFRAMEGAP_96BIT,
@ -49,7 +48,7 @@ void _eth_config_mac(ETH_HandleTypeDef *heth)
.TransmitFlowControl = ETH_TRANSMITFLOWCONTROL_DISABLE, .TransmitFlowControl = ETH_TRANSMITFLOWCONTROL_DISABLE,
.VLANTagComparison = ETH_VLANTAGCOMPARISON_16BIT, .VLANTagComparison = ETH_VLANTAGCOMPARISON_16BIT,
.VLANTagIdentifier = 0x0U, .VLANTagIdentifier = 0x0U,
}; };
if (heth->Init.ChecksumMode == ETH_CHECKSUM_BY_HARDWARE) { if (heth->Init.ChecksumMode == ETH_CHECKSUM_BY_HARDWARE) {
macconf.ChecksumOffload = ETH_CHECKSUMOFFLAOD_ENABLE; macconf.ChecksumOffload = ETH_CHECKSUMOFFLAOD_ENABLE;

View File

@ -33,7 +33,7 @@
/** /**
* Override HAL Eth Init function * Override HAL Eth Init function
*/ */
void HAL_ETH_MspInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
{ {
GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitTypeDef GPIO_InitStructure;
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
@ -59,7 +59,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Configure PA1, PA2 and PA7 */ /* Configure PA1, PA2 and PA7 */
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH; GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP; GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Alternate = GPIO_AF11_ETH; GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7; GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure); HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
@ -79,7 +79,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Enable the Ethernet global Interrupt */ /* Enable the Ethernet global Interrupt */
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0); HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
HAL_NVIC_EnableIRQ(ETH_IRQn); HAL_NVIC_EnableIRQ(ETH_IRQn);
/* Enable ETHERNET clock */ /* Enable ETHERNET clock */
__HAL_RCC_ETH_CLK_ENABLE(); __HAL_RCC_ETH_CLK_ENABLE();
} }
@ -88,7 +88,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/** /**
* Override HAL Eth DeInit function * Override HAL Eth DeInit function
*/ */
void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
{ {
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
/* Peripheral clock disable */ /* Peripheral clock disable */

View File

@ -33,7 +33,7 @@
/** /**
* Override HAL Eth Init function * Override HAL Eth Init function
*/ */
void HAL_ETH_MspInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
{ {
GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitTypeDef GPIO_InitStructure;
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
@ -60,7 +60,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Configure PA1, PA2 and PA7 */ /* Configure PA1, PA2 and PA7 */
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH; GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP; GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Alternate = GPIO_AF11_ETH; GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7; GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure); HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
@ -76,7 +76,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Enable the Ethernet global Interrupt */ /* Enable the Ethernet global Interrupt */
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0); HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
HAL_NVIC_EnableIRQ(ETH_IRQn); HAL_NVIC_EnableIRQ(ETH_IRQn);
/* Enable ETHERNET clock */ /* Enable ETHERNET clock */
__HAL_RCC_ETH_CLK_ENABLE(); __HAL_RCC_ETH_CLK_ENABLE();
} }
@ -85,7 +85,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/** /**
* Override HAL Eth DeInit function * Override HAL Eth DeInit function
*/ */
void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
{ {
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
/* Peripheral clock disable */ /* Peripheral clock disable */

View File

@ -33,7 +33,7 @@
/** /**
* Override HAL Eth Init function * Override HAL Eth Init function
*/ */
void HAL_ETH_MspInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
{ {
GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitTypeDef GPIO_InitStructure;
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
@ -61,7 +61,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Configure PA1, PA2 and PA7 */ /* Configure PA1, PA2 and PA7 */
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH; GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP; GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Alternate = GPIO_AF11_ETH; GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7; GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure); HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
@ -81,7 +81,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Enable the Ethernet global Interrupt */ /* Enable the Ethernet global Interrupt */
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0); HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
HAL_NVIC_EnableIRQ(ETH_IRQn); HAL_NVIC_EnableIRQ(ETH_IRQn);
/* Enable ETHERNET clock */ /* Enable ETHERNET clock */
__HAL_RCC_ETH_CLK_ENABLE(); __HAL_RCC_ETH_CLK_ENABLE();
} }
@ -90,7 +90,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/** /**
* Override HAL Eth DeInit function * Override HAL Eth DeInit function
*/ */
void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
{ {
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
/* Peripheral clock disable */ /* Peripheral clock disable */

View File

@ -33,7 +33,7 @@
/** /**
* Override HAL Eth Init function * Override HAL Eth Init function
*/ */
void HAL_ETH_MspInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
{ {
GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitTypeDef GPIO_InitStructure;
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
@ -61,7 +61,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Configure PA1, PA2 and PA7 */ /* Configure PA1, PA2 and PA7 */
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH; GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP; GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Alternate = GPIO_AF11_ETH; GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7; GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure); HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
@ -81,7 +81,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Enable the Ethernet global Interrupt */ /* Enable the Ethernet global Interrupt */
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0); HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
HAL_NVIC_EnableIRQ(ETH_IRQn); HAL_NVIC_EnableIRQ(ETH_IRQn);
/* Enable ETHERNET clock */ /* Enable ETHERNET clock */
__HAL_RCC_ETH_CLK_ENABLE(); __HAL_RCC_ETH_CLK_ENABLE();
} }
@ -90,7 +90,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/** /**
* Override HAL Eth DeInit function * Override HAL Eth DeInit function
*/ */
void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
{ {
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
/* Peripheral clock disable */ /* Peripheral clock disable */

View File

@ -33,7 +33,7 @@
/** /**
* Override HAL Eth Init function * Override HAL Eth Init function
*/ */
void HAL_ETH_MspInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
{ {
GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitTypeDef GPIO_InitStructure;
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
@ -61,7 +61,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Configure PA1, PA2 and PA7 */ /* Configure PA1, PA2 and PA7 */
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH; GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP; GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Alternate = GPIO_AF11_ETH; GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7; GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure); HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
@ -81,7 +81,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Enable the Ethernet global Interrupt */ /* Enable the Ethernet global Interrupt */
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0); HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
HAL_NVIC_EnableIRQ(ETH_IRQn); HAL_NVIC_EnableIRQ(ETH_IRQn);
/* Enable ETHERNET clock */ /* Enable ETHERNET clock */
__HAL_RCC_ETH_CLK_ENABLE(); __HAL_RCC_ETH_CLK_ENABLE();
} }
@ -90,7 +90,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/** /**
* Override HAL Eth DeInit function * Override HAL Eth DeInit function
*/ */
void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
{ {
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
/* Peripheral clock disable */ /* Peripheral clock disable */

View File

@ -33,7 +33,7 @@
/** /**
* Override HAL Eth Init function * Override HAL Eth Init function
*/ */
void HAL_ETH_MspInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
{ {
GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitTypeDef GPIO_InitStructure;
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
@ -61,7 +61,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Configure PA1, PA2 and PA7 */ /* Configure PA1, PA2 and PA7 */
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH; GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP; GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Alternate = GPIO_AF11_ETH; GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7; GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure); HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
@ -81,7 +81,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/* Enable the Ethernet global Interrupt */ /* Enable the Ethernet global Interrupt */
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0); HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
HAL_NVIC_EnableIRQ(ETH_IRQn); HAL_NVIC_EnableIRQ(ETH_IRQn);
/* Enable ETHERNET clock */ /* Enable ETHERNET clock */
__HAL_RCC_ETH_CLK_ENABLE(); __HAL_RCC_ETH_CLK_ENABLE();
} }
@ -90,7 +90,7 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
/** /**
* Override HAL Eth DeInit function * Override HAL Eth DeInit function
*/ */
void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth) void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
{ {
if (heth->Instance == ETH) { if (heth->Instance == ETH) {
/* Peripheral clock disable */ /* Peripheral clock disable */

View File

@ -18,8 +18,7 @@
void _eth_config_mac(ETH_HandleTypeDef *heth) void _eth_config_mac(ETH_HandleTypeDef *heth)
{ {
ETH_MACInitTypeDef macconf = ETH_MACInitTypeDef macconf = {
{
.Watchdog = ETH_WATCHDOG_ENABLE, .Watchdog = ETH_WATCHDOG_ENABLE,
.Jabber = ETH_JABBER_ENABLE, .Jabber = ETH_JABBER_ENABLE,
.InterFrameGap = ETH_INTERFRAMEGAP_96BIT, .InterFrameGap = ETH_INTERFRAMEGAP_96BIT,
@ -49,7 +48,7 @@ void _eth_config_mac(ETH_HandleTypeDef *heth)
.TransmitFlowControl = ETH_TRANSMITFLOWCONTROL_DISABLE, .TransmitFlowControl = ETH_TRANSMITFLOWCONTROL_DISABLE,
.VLANTagComparison = ETH_VLANTAGCOMPARISON_16BIT, .VLANTagComparison = ETH_VLANTAGCOMPARISON_16BIT,
.VLANTagIdentifier = 0x0 .VLANTagIdentifier = 0x0
}; };
if (heth->Init.ChecksumMode == ETH_CHECKSUM_BY_HARDWARE) { if (heth->Init.ChecksumMode == ETH_CHECKSUM_BY_HARDWARE) {
macconf.ChecksumOffload = ETH_CHECKSUMOFFLAOD_ENABLE; macconf.ChecksumOffload = ETH_CHECKSUMOFFLAOD_ENABLE;

View File

@ -24,22 +24,22 @@
#define STM_ETH_IF_NAME "st" #define STM_ETH_IF_NAME "st"
#if defined (__ICCARM__) /*!< IAR Compiler */ #if defined (__ICCARM__) /*!< IAR Compiler */
#pragma data_alignment=4 #pragma data_alignment=4
#endif #endif
__ALIGN_BEGIN ETH_DMADescTypeDef DMARxDscrTab[ETH_RXBUFNB] __ALIGN_END; /* Ethernet Rx DMA Descriptor */ __ALIGN_BEGIN ETH_DMADescTypeDef DMARxDscrTab[ETH_RXBUFNB] __ALIGN_END; /* Ethernet Rx DMA Descriptor */
#if defined (__ICCARM__) /*!< IAR Compiler */ #if defined (__ICCARM__) /*!< IAR Compiler */
#pragma data_alignment=4 #pragma data_alignment=4
#endif #endif
__ALIGN_BEGIN ETH_DMADescTypeDef DMATxDscrTab[ETH_TXBUFNB] __ALIGN_END; /* Ethernet Tx DMA Descriptor */ __ALIGN_BEGIN ETH_DMADescTypeDef DMATxDscrTab[ETH_TXBUFNB] __ALIGN_END; /* Ethernet Tx DMA Descriptor */
#if defined (__ICCARM__) /*!< IAR Compiler */ #if defined (__ICCARM__) /*!< IAR Compiler */
#pragma data_alignment=4 #pragma data_alignment=4
#endif #endif
__ALIGN_BEGIN uint8_t Rx_Buff[ETH_RXBUFNB][ETH_RX_BUF_SIZE] __ALIGN_END; /* Ethernet Receive Buffer */ __ALIGN_BEGIN uint8_t Rx_Buff[ETH_RXBUFNB][ETH_RX_BUF_SIZE] __ALIGN_END; /* Ethernet Receive Buffer */
#if defined (__ICCARM__) /*!< IAR Compiler */ #if defined (__ICCARM__) /*!< IAR Compiler */
#pragma data_alignment=4 #pragma data_alignment=4
#endif #endif
__ALIGN_BEGIN uint8_t Tx_Buff[ETH_TXBUFNB][ETH_TX_BUF_SIZE] __ALIGN_END; /* Ethernet Transmit Buffer */ __ALIGN_BEGIN uint8_t Tx_Buff[ETH_TXBUFNB][ETH_TX_BUF_SIZE] __ALIGN_END; /* Ethernet Transmit Buffer */
@ -326,16 +326,16 @@ int STM32_EMAC::low_level_input(emac_mem_buf_t **buf)
*/ */
void STM32_EMAC::packet_rx() void STM32_EMAC::packet_rx()
{ {
/* move received packet into a new buf */ /* move received packet into a new buf */
while (1) { while (1) {
emac_mem_buf_t *p = NULL; emac_mem_buf_t *p = NULL;
if (low_level_input(&p) < 0) { if (low_level_input(&p) < 0) {
break; break;
} }
if (p) { if (p) {
emac_link_input_cb(p); emac_link_input_cb(p);
} }
} }
} }
/** \brief Worker thread. /** \brief Worker thread.
@ -344,7 +344,7 @@ void STM32_EMAC::packet_rx()
* *
* \param[in] pvParameters pointer to the interface data * \param[in] pvParameters pointer to the interface data
*/ */
void STM32_EMAC::thread_function(void* pvParameters) void STM32_EMAC::thread_function(void *pvParameters)
{ {
static struct STM32_EMAC *stm32_enet = static_cast<STM32_EMAC *>(pvParameters); static struct STM32_EMAC *stm32_enet = static_cast<STM32_EMAC *>(pvParameters);
@ -391,16 +391,16 @@ void STM32_EMAC::phy_task()
* *
* \param[in] pvParameters pointer to the interface data * \param[in] pvParameters pointer to the interface data
*/ */
void STM32_EMAC::rmii_watchdog_thread_function(void* pvParameters) void STM32_EMAC::rmii_watchdog_thread_function(void *pvParameters)
{ {
struct STM32_EMAC *stm32_enet = static_cast<STM32_EMAC *>(pvParameters); struct STM32_EMAC *stm32_enet = static_cast<STM32_EMAC *>(pvParameters);
while(1) { while (1) {
/* some good packets are received */ /* some good packets are received */
if (stm32_enet->EthHandle.Instance->MMCRGUFCR > 0) { if (stm32_enet->EthHandle.Instance->MMCRGUFCR > 0) {
/* RMII Init is OK - would need service to terminate or suspend /* RMII Init is OK - would need service to terminate or suspend
* the thread */ * the thread */
while(1) { while (1) {
/* don't do anything anymore */ /* don't do anything anymore */
osDelay(0xFFFFFFFF); osDelay(0xFFFFFFFF);
} }
@ -432,7 +432,8 @@ void STM32_EMAC::disable_interrupts(void)
* @param mac A 6-byte array to write the MAC address * @param mac A 6-byte array to write the MAC address
*/ */
void mbed_mac_address(char *mac) { void mbed_mac_address(char *mac)
{
if (mbed_otp_mac_address(mac)) { if (mbed_otp_mac_address(mac)) {
return; return;
} else { } else {
@ -441,11 +442,13 @@ void mbed_mac_address(char *mac) {
return; return;
} }
__weak uint8_t mbed_otp_mac_address(char *mac) { __weak uint8_t mbed_otp_mac_address(char *mac)
{
return 0; return 0;
} }
void mbed_default_mac_address(char *mac) { void mbed_default_mac_address(char *mac)
{
unsigned char ST_mac_addr[3] = {0x00, 0x80, 0xe1}; // default STMicro mac address unsigned char ST_mac_addr[3] = {0x00, 0x80, 0xe1}; // default STMicro mac address
// Read unic id // Read unic id
@ -456,7 +459,7 @@ void mbed_default_mac_address(char *mac) {
#elif defined (TARGET_STM32F7) #elif defined (TARGET_STM32F7)
uint32_t word0 = *(uint32_t *)0x1FF0F420; uint32_t word0 = *(uint32_t *)0x1FF0F420;
#else #else
#error MAC address can not be derived from target unique Id #error MAC address can not be derived from target unique Id
#endif #endif
mac[0] = ST_mac_addr[0]; mac[0] = ST_mac_addr[0];
@ -522,37 +525,37 @@ bool STM32_EMAC::get_hwaddr(uint8_t *addr) const
void STM32_EMAC::set_hwaddr(const uint8_t *addr) void STM32_EMAC::set_hwaddr(const uint8_t *addr)
{ {
/* No-op at this stage */ /* No-op at this stage */
} }
void STM32_EMAC::set_link_input_cb(emac_link_input_cb_t input_cb) void STM32_EMAC::set_link_input_cb(emac_link_input_cb_t input_cb)
{ {
emac_link_input_cb = input_cb; emac_link_input_cb = input_cb;
} }
void STM32_EMAC::set_link_state_cb(emac_link_state_change_cb_t state_cb) void STM32_EMAC::set_link_state_cb(emac_link_state_change_cb_t state_cb)
{ {
emac_link_state_cb = state_cb; emac_link_state_cb = state_cb;
} }
void STM32_EMAC::add_multicast_group(const uint8_t *addr) void STM32_EMAC::add_multicast_group(const uint8_t *addr)
{ {
/* No-op at this stage */ /* No-op at this stage */
} }
void STM32_EMAC::remove_multicast_group(const uint8_t *addr) void STM32_EMAC::remove_multicast_group(const uint8_t *addr)
{ {
/* No-op at this stage */ /* No-op at this stage */
} }
void STM32_EMAC::set_all_multicast(bool all) void STM32_EMAC::set_all_multicast(bool all)
{ {
/* No-op at this stage */ /* No-op at this stage */
} }
void STM32_EMAC::power_down() void STM32_EMAC::power_down()
{ {
/* No-op at this stage */ /* No-op at this stage */
} }
void STM32_EMAC::set_memory_manager(EMACMemoryManager &mem_mngr) void STM32_EMAC::set_memory_manager(EMACMemoryManager &mem_mngr)
@ -560,12 +563,14 @@ void STM32_EMAC::set_memory_manager(EMACMemoryManager &mem_mngr)
memory_manager = &mem_mngr; memory_manager = &mem_mngr;
} }
STM32_EMAC &STM32_EMAC::get_instance() { STM32_EMAC &STM32_EMAC::get_instance()
{
static STM32_EMAC emac; static STM32_EMAC emac;
return emac; return emac;
} }
// Weak so a module can override // Weak so a module can override
MBED_WEAK EMAC &EMAC::get_default_instance() { MBED_WEAK EMAC &EMAC::get_default_instance()
{
return STM32_EMAC::get_instance(); return STM32_EMAC::get_instance();
} }

View File

@ -155,8 +155,8 @@ private:
bool low_level_init_successful(); bool low_level_init_successful();
void packet_rx(); void packet_rx();
int low_level_input(emac_mem_buf_t **buf); int low_level_input(emac_mem_buf_t **buf);
static void thread_function(void* pvParameters); static void thread_function(void *pvParameters);
static void rmii_watchdog_thread_function(void* pvParameters); static void rmii_watchdog_thread_function(void *pvParameters);
void phy_task(); void phy_task();
void enable_interrupts(); void enable_interrupts();
void disable_interrupts(); void disable_interrupts();