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) {
@ -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,

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,

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) {
@ -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 */

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,

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) {
@ -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,

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) {
@ -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) {
@ -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) {
@ -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) {
@ -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) {
@ -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) {
@ -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,

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 */
@ -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];
@ -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();