Merge pull request #1318 from Wiznet/mbed_dev1

Change directory structure and move files.
pull/1319/merge
Martin Kojtal 2015-09-04 09:29:53 +01:00
commit 92d1bfad30
37 changed files with 72 additions and 49 deletions

View File

@ -125,7 +125,6 @@ typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrorStatus;
/** /**
* @} * @}
*/ */
@ -1147,6 +1146,23 @@ typedef struct
typedef enum
{
PAD_PA = 0,
PAD_PB,
PAD_PC,
PAD_PD
}PAD_Type;
typedef enum
{
PAD_AF0 = Px_AFSR_AF0,
PAD_AF1 = Px_AFSR_AF1,
PAD_AF2 = Px_AFSR_AF2,
PAD_AF3 = Px_AFSR_AF3
}PAD_AF_TypeDef;
#if !defined (USE_HAL_DRIVER) #if !defined (USE_HAL_DRIVER)
#define USE_HAL_DRIVER #define USE_HAL_DRIVER
#endif /* USE_HAL_DRIVER */ #endif /* USE_HAL_DRIVER */
@ -1154,9 +1170,16 @@ typedef struct
#if defined (USE_HAL_DRIVER) #if defined (USE_HAL_DRIVER)
#include "W7500x_conf.h" // #include "system_W7500x.h"
// #include "W7500x_conf.h"
#endif #endif
#ifdef USE_FULL_ASSERT
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__,__LINE__))
#else
#define assert_param(expr) ((void)0)
#endif /* USE_FULL_ASSERT */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -46,9 +46,6 @@ typedef enum {
UART_1 = (int)W7500x_UART1_BASE UART_1 = (int)W7500x_UART1_BASE
} UARTName; } UARTName;
#define STDIO_UART_TX PC_2
#define STDIO_UART_RX PC_3
#define STDIO_UART UART_1
typedef enum { typedef enum {
SPI_0 = (int)SSP0_BASE, SPI_0 = (int)SSP0_BASE,

View File

@ -73,7 +73,7 @@ const PinMap PinMap_I2C_SCL[] = {
{PA_9, I2C_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)}, {PA_9, I2C_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)},
{PC_8, I2C_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF2)}, {PC_8, I2C_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF2)},
{PC_4, I2C_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)}, {PC_4, I2C_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)},
{PC_5, I2C_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF2)}, {PA_5, I2C_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF2)},
{NC, NC, 0} {NC, NC, 0}
}; };
@ -82,32 +82,32 @@ const PinMap PinMap_I2C_SCL[] = {
const PinMap PinMap_SPI_SCLK[] = { const PinMap PinMap_SPI_SCLK[] = {
{PA_6 , SPI_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)}, {PA_6 , SPI_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)},
{PB_1 , SPI_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)}, {PB_1 , SPI_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)},
{PC_12, SPI_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF3)}, {PC_13, SPI_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF2)},
{PA_12, SPI_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF3)}, {PA_12, SPI_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF2)},
{NC , NC , 0} {NC , NC , 0}
}; };
const PinMap PinMap_SPI_MOSI[] = { const PinMap PinMap_SPI_MOSI[] = {
{PA_8 , SPI_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)}, {PA_8 , SPI_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)},
{PB_3 , SPI_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)}, {PB_3 , SPI_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)},
{PC_10, SPI_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF3)}, {PC_15, SPI_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF2)},
{PA_14, SPI_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF3)}, {PA_14, SPI_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF2)},
{NC , NC , 0} {NC , NC , 0}
}; };
const PinMap PinMap_SPI_MISO[] = { const PinMap PinMap_SPI_MISO[] = {
{PA_7 , SPI_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)}, {PA_7 , SPI_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)},
{PB_2 , SPI_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)}, {PB_2 , SPI_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)},
{PC_11, SPI_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF3)}, {PC_14, SPI_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF2)},
{PA_13, SPI_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF3)}, {PA_13, SPI_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF2)},
{NC , NC , 0} {NC , NC , 0}
}; };
const PinMap PinMap_SPI_SSEL[] = { const PinMap PinMap_SPI_SSEL[] = {
{PA_5 , SPI_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)}, {PA_5 , SPI_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)},
{PB_0 , SPI_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)}, {PB_0 , SPI_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF0)},
{PC_13, SPI_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF3)}, {PC_12, SPI_0, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF2)},
{PA_11, SPI_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF3)}, {PA_11, SPI_1, WIZ_PIN_DATA(WIZ_MODE_AF, WIZ_GPIO_NOPULL, Px_AFSR_AF2)},
{NC , NC , 0} {NC , NC , 0}
}; };

View File

@ -67,6 +67,11 @@
#define DEVICE_STDIO_MESSAGES 1 #define DEVICE_STDIO_MESSAGES 1
#define STDIO_UART_TX PC_2
#define STDIO_UART_RX PC_3
#define STDIO_UART UART_1
#define DEVICE_ERROR_RED 0 #define DEVICE_ERROR_RED 0
#include "objects.h" #include "objects.h"

View File

@ -1,4 +1,5 @@
#include "W7500x.h" #include "W7500x.h"
#include "W7500x_adc.h"
void ADC_PowerDownEnable (FunctionalState NewState) void ADC_PowerDownEnable (FunctionalState NewState)
{ {

View File

@ -13,6 +13,7 @@
/* Includes -------------------------------------------*/ /* Includes -------------------------------------------*/
#include "W7500x.h" #include "W7500x.h"
#include "W7500x_dualtimer.h"
void DUALTIMER_ClockEnable(DUALTIMER_TypeDef* DUALTIMERn) void DUALTIMER_ClockEnable(DUALTIMER_TypeDef* DUALTIMERn)
{ {

View File

@ -1,5 +1,6 @@
#include "W7500x.h" #include "W7500x.h"
#include "W7500x_exti.h"
#include "W7500x_gpio.h"
/** /**

View File

@ -1,6 +1,5 @@
#include "W7500x.h" #include "W7500x.h"
#include "W7500x_gpio.h"
void HAL_GPIO_DeInit(GPIO_TypeDef* GPIOx) void HAL_GPIO_DeInit(GPIO_TypeDef* GPIOx)
{ {

View File

@ -83,21 +83,6 @@ typedef enum
Bit_SET Bit_SET
}BitAction; }BitAction;
typedef enum
{
PAD_PA = 0,
PAD_PB,
PAD_PC,
PAD_PD
}PAD_Type;
typedef enum
{
PAD_AF0 = Px_AFSR_AF0,
PAD_AF1 = Px_AFSR_AF1,
PAD_AF2 = Px_AFSR_AF2,
PAD_AF3 = Px_AFSR_AF3
}PAD_AF_TypeDef;
#define IS_PAD_TYPE(Px) (((Px) == PAD_PA) || ((Px) == PAD_PB) \ #define IS_PAD_TYPE(Px) (((Px) == PAD_PA) || ((Px) == PAD_PB) \
((Px) == PAD_PC) || ((Px) == PAD_PD)) ((Px) == PAD_PC) || ((Px) == PAD_PD))

View File

@ -28,8 +28,9 @@
******************************************************************************* *******************************************************************************
*/ */
/*include -------------------------------------*/ /*include -------------------------------------*/
#include <stdio.h>
#include "W7500x.h" #include "W7500x.h"
#include "W7500x_i2c.h"
#include "W7500x_gpio.h"
GPIO_InitTypeDef GPIO_InitDef; GPIO_InitTypeDef GPIO_InitDef;
@ -61,8 +62,8 @@ uint32_t I2C_Init(I2C_ConfigStruct* conf)
HAL_GPIO_ResetBits((GPIO_TypeDef*)(GPIOA_BASE + (sda_port_num << 24)), sda_pin_index); HAL_GPIO_ResetBits((GPIO_TypeDef*)(GPIOA_BASE + (sda_port_num << 24)), sda_pin_index);
//Pin muxing //Pin muxing
HAL_PAD_AFConfig(scl_port_num, scl_pin_index, PAD_AF1); HAL_PAD_AFConfig((PAD_Type)scl_port_num, (uint16_t)scl_pin_index, PAD_AF1);
HAL_PAD_AFConfig(sda_port_num, sda_pin_index, PAD_AF1); HAL_PAD_AFConfig((PAD_Type)sda_port_num, (uint16_t)sda_pin_index, PAD_AF1);
return 0; return 0;
} }
@ -98,9 +99,6 @@ uint8_t I2C_ReadBitSDA(I2C_ConfigStruct* conf)
if(HAL_GPIO_ReadInputDataBit((GPIO_TypeDef*)(GPIOA_BASE + (sda_port_num << 24)), sda_pin_index)) if(HAL_GPIO_ReadInputDataBit((GPIO_TypeDef*)(GPIOA_BASE + (sda_port_num << 24)), sda_pin_index))
return 1; return 1;
else
return 0;
return 0; return 0;
} }
@ -193,7 +191,7 @@ int I2C_Write(I2C_ConfigStruct* conf, uint8_t addr, uint8_t* data, uint32_t len)
//Write addr //Write addr
if(I2C_WriteByte(conf, addr) != 0) if(I2C_WriteByte(conf, addr) != 0)
{ {
printf("Received NACK at address phase!!\r\n"); //printf("Received NACK at address phase!!\r\n");
return -1; return -1;
} }
@ -218,7 +216,7 @@ int I2C_WriteRepeated(I2C_ConfigStruct* conf, uint8_t addr, uint8_t* data, uint3
//Write addr //Write addr
if(I2C_WriteByte(conf, addr) != 0) if(I2C_WriteByte(conf, addr) != 0)
{ {
printf("Received NACK at address phase!!\r\n"); //printf("Received NACK at address phase!!\r\n");
return -1; return -1;
} }
@ -241,7 +239,7 @@ int I2C_Read(I2C_ConfigStruct* conf, uint8_t addr, uint8_t* data, uint32_t len)
//Write addr | read command //Write addr | read command
if(I2C_WriteByte(conf, (addr | 1)) != 0) if(I2C_WriteByte(conf, (addr | 1)) != 0)
{ {
printf("Received NACK at address phase!!\r\n"); //printf("Received NACK at address phase!!\r\n");
return -1; return -1;
} }
@ -270,7 +268,7 @@ int I2C_ReadRepeated(I2C_ConfigStruct* conf, uint8_t addr, uint8_t* data, uint32
//Write addr | read command //Write addr | read command
if(I2C_WriteByte(conf, (addr | 1)) != 0) if(I2C_WriteByte(conf, (addr | 1)) != 0)
{ {
printf("Received NACK at address phase!!\r\n"); //printf("Received NACK at address phase!!\r\n");
return -1; return -1;
} }

View File

@ -28,11 +28,11 @@
******************************************************************************* *******************************************************************************
*/ */
/*include -------------------------------------*/ /*include -------------------------------------*/
#include "W7500x.h"
#ifndef __W7500X_I2C_H #ifndef __W7500X_I2C_H
#define __W7500X_I2C_H #define __W7500X_I2C_H
#include "W7500x.h"
typedef enum { typedef enum {
I2C_PA_5 = 0x05, I2C_PA_5 = 0x05,

View File

@ -13,6 +13,7 @@
/* Includes -------------------------------------------*/ /* Includes -------------------------------------------*/
#include "W7500x.h" #include "W7500x.h"
#include "W7500x_pwm.h"
void PWM_DeInit(PWM_CHn_TypeDef* PWM_CHn) void PWM_DeInit(PWM_CHn_TypeDef* PWM_CHn)
{ {

View File

@ -14,6 +14,7 @@
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include "W7500x.h" #include "W7500x.h"
#include "W7500x_uart.h"
void UART_StructInit(UART_InitTypeDef* UART_InitStruct) void UART_StructInit(UART_InitTypeDef* UART_InitStruct)
{ {

View File

@ -36,6 +36,7 @@
#include "wait_api.h" #include "wait_api.h"
#include "cmsis.h" #include "cmsis.h"
#include "pinmap.h" #include "pinmap.h"
#include "W7500x_adc.h"
#include "PeripheralPins.h" #include "PeripheralPins.h"

View File

@ -46,7 +46,7 @@ static uint32_t channel_ids[4][16];
#ifdef __cplusplus #ifdef __cplusplus
extern "C"{ extern "C"{
#endif #endif
void port_generic_handler(GPIO_TypeDef* GPIOx, uint32_t port_num);
void PORT0_Handler(void) void PORT0_Handler(void)
{ {

View File

@ -32,6 +32,7 @@
#define MBED_GPIO_OBJECT_H #define MBED_GPIO_OBJECT_H
#include "mbed_assert.h" #include "mbed_assert.h"
#include "W7500x_gpio.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -40,6 +40,7 @@
#include "wait_api.h" #include "wait_api.h"
#include "us_ticker_api.h" #include "us_ticker_api.h"
#include "W7500x_i2c.h"
/* Timeout values for flags and events waiting loops. These timeouts are /* Timeout values for flags and events waiting loops. These timeouts are
not based on accurate values, they just guarantee that the application will not based on accurate values, they just guarantee that the application will
@ -106,12 +107,12 @@ int i2c_read(i2c_t *obj, int address, char *data, int length, int stop)
if(stop) if(stop)
{ {
if(I2C_Read(&conf, address, data, length) != 0) if(I2C_Read(&conf, address, (uint8_t*)data, length) != 0)
return -1; return -1;
} }
else else
{ {
if(I2C_ReadRepeated(&conf, address, data, length) != 0) if(I2C_ReadRepeated(&conf, address, (uint8_t*)data, length) != 0)
return -1; return -1;
} }
@ -129,12 +130,12 @@ int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop)
if(stop) if(stop)
{ {
if(I2C_Write(&conf, address, data, length) != 0) if(I2C_Write(&conf, address, (uint8_t*)data, length) != 0)
return -1; return -1;
} }
else else
{ {
if(I2C_WriteRepeated(&conf, address, data, length) != 0) if(I2C_WriteRepeated(&conf, address, (uint8_t*)data, length) != 0)
return -1; return -1;
} }

View File

@ -32,6 +32,8 @@
#include "pinmap.h" #include "pinmap.h"
#include "PortNames.h" #include "PortNames.h"
#include "mbed_error.h" #include "mbed_error.h"
#include "W7500x.h"
#include "W7500x_gpio.h"
uint32_t Get_GPIO_BaseAddress(uint32_t port_idx) uint32_t Get_GPIO_BaseAddress(uint32_t port_idx)

View File

@ -35,6 +35,7 @@
#include "pinmap.h" #include "pinmap.h"
#include "mbed_error.h" #include "mbed_error.h"
#include "PeripheralPins.h" #include "PeripheralPins.h"
#include "W7500x_pwm.h"
static PWM_TimerModeInitTypeDef TimerModeStructure; static PWM_TimerModeInitTypeDef TimerModeStructure;

View File

@ -14,6 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include "rtc_api.h" #include "rtc_api.h"
#include "cmsis.h"
#include "W7500x_pwm.h"
time_t wiz_rtc_time; time_t wiz_rtc_time;
char rtc_enabled = 0; char rtc_enabled = 0;

View File

@ -37,6 +37,7 @@
#include "pinmap.h" #include "pinmap.h"
#include <string.h> #include <string.h>
#include "PeripheralPins.h" #include "PeripheralPins.h"
#include "W7500x_uart.h"
#define UART_NUM (2) #define UART_NUM (2)

View File

@ -32,6 +32,8 @@
#include "us_ticker_api.h" #include "us_ticker_api.h"
#include "PeripheralNames.h" #include "PeripheralNames.h"
#include "system_W7500x.h" #include "system_W7500x.h"
#include "W7500x_dualtimer.h"
#include "W7500x_pwm.h"
#define TIMER_0 DUALTIMER0_0 #define TIMER_0 DUALTIMER0_0
#define TIMER_1 PWM_CH1 #define TIMER_1 PWM_CH1