Merge pull request #2126 from RT-Thread/fix_errno

[Kernel] Fix the errno definitions in armcc/iar.
This commit is contained in:
Bernard Xiong 2018-12-27 13:07:45 +08:00 committed by GitHub
commit 9544b4227f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 549 additions and 354 deletions

View File

@ -7,18 +7,32 @@
# RT-Thread Kernel # RT-Thread Kernel
# #
CONFIG_RT_NAME_MAX=8 CONFIG_RT_NAME_MAX=8
# CONFIG_RT_USING_SMP is not set
CONFIG_RT_ALIGN_SIZE=4 CONFIG_RT_ALIGN_SIZE=4
# CONFIG_RT_THREAD_PRIORITY_8 is not set
CONFIG_RT_THREAD_PRIORITY_32=y
# CONFIG_RT_THREAD_PRIORITY_256 is not set
CONFIG_RT_THREAD_PRIORITY_MAX=32 CONFIG_RT_THREAD_PRIORITY_MAX=32
CONFIG_RT_TICK_PER_SECOND=100 CONFIG_RT_TICK_PER_SECOND=100
CONFIG_RT_DEBUG=y
CONFIG_RT_USING_OVERFLOW_CHECK=y CONFIG_RT_USING_OVERFLOW_CHECK=y
CONFIG_RT_DEBUG_INIT=0
# CONFIG_RT_DEBUG_THREAD is not set
CONFIG_RT_USING_HOOK=y CONFIG_RT_USING_HOOK=y
CONFIG_RT_USING_IDLE_HOOK=y
CONFIG_RT_IDEL_HOOK_LIST_SIZE=4
CONFIG_IDLE_THREAD_STACK_SIZE=256 CONFIG_IDLE_THREAD_STACK_SIZE=256
CONFIG_RT_USING_TIMER_SOFT=y CONFIG_RT_USING_TIMER_SOFT=y
CONFIG_RT_TIMER_THREAD_PRIO=4 CONFIG_RT_TIMER_THREAD_PRIO=4
CONFIG_RT_TIMER_THREAD_STACK_SIZE=512 CONFIG_RT_TIMER_THREAD_STACK_SIZE=512
CONFIG_RT_DEBUG=y
# CONFIG_RT_DEBUG_INIT_CONFIG is not set
# CONFIG_RT_DEBUG_THREAD_CONFIG is not set
# CONFIG_RT_DEBUG_SCHEDULER_CONFIG is not set
# CONFIG_RT_DEBUG_IPC_CONFIG is not set
# CONFIG_RT_DEBUG_TIMER_CONFIG is not set
# CONFIG_RT_DEBUG_IRQ_CONFIG is not set
# CONFIG_RT_DEBUG_MEM_CONFIG is not set
# CONFIG_RT_DEBUG_SLAB_CONFIG is not set
# CONFIG_RT_DEBUG_MEMHEAP_CONFIG is not set
# CONFIG_RT_DEBUG_MODULE_CONFIG is not set
# #
# Inter-Thread communication # Inter-Thread communication
@ -35,24 +49,32 @@ CONFIG_RT_USING_MESSAGEQUEUE=y
# #
CONFIG_RT_USING_MEMPOOL=y CONFIG_RT_USING_MEMPOOL=y
CONFIG_RT_USING_MEMHEAP=y CONFIG_RT_USING_MEMHEAP=y
CONFIG_RT_USING_HEAP=y # CONFIG_RT_USING_NOHEAP is not set
CONFIG_RT_USING_SMALL_MEM=y CONFIG_RT_USING_SMALL_MEM=y
# CONFIG_RT_USING_SLAB is not set # CONFIG_RT_USING_SLAB is not set
# CONFIG_RT_USING_MEMHEAP_AS_HEAP is not set
# CONFIG_RT_USING_MEMTRACE is not set
CONFIG_RT_USING_HEAP=y
# #
# Kernel Device Object # Kernel Device Object
# #
CONFIG_RT_USING_DEVICE=y CONFIG_RT_USING_DEVICE=y
# CONFIG_RT_USING_DEVICE_OPS is not set
# CONFIG_RT_USING_INTERRUPT_INFO is not set
CONFIG_RT_USING_CONSOLE=y CONFIG_RT_USING_CONSOLE=y
CONFIG_RT_CONSOLEBUF_SIZE=128 CONFIG_RT_CONSOLEBUF_SIZE=128
CONFIG_RT_CONSOLE_DEVICE_NAME="uart0" CONFIG_RT_CONSOLE_DEVICE_NAME="uart0"
# CONFIG_RT_USING_MODULE is not set CONFIG_RT_VER_NUM=0x40000
# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set
# #
# RT-Thread Components # RT-Thread Components
# #
CONFIG_RT_USING_COMPONENTS_INIT=y CONFIG_RT_USING_COMPONENTS_INIT=y
CONFIG_RT_USING_USER_MAIN=y CONFIG_RT_USING_USER_MAIN=y
CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048
CONFIG_RT_MAIN_THREAD_PRIORITY=10
# #
# C++ features # C++ features
@ -63,9 +85,12 @@ CONFIG_RT_USING_USER_MAIN=y
# Command shell # Command shell
# #
CONFIG_RT_USING_FINSH=y CONFIG_RT_USING_FINSH=y
CONFIG_FINSH_THREAD_NAME="tshell"
CONFIG_FINSH_USING_HISTORY=y CONFIG_FINSH_USING_HISTORY=y
CONFIG_FINSH_HISTORY_LINES=5
CONFIG_FINSH_USING_SYMTAB=y CONFIG_FINSH_USING_SYMTAB=y
CONFIG_FINSH_USING_DESCRIPTION=y CONFIG_FINSH_USING_DESCRIPTION=y
# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set
CONFIG_FINSH_THREAD_PRIORITY=20 CONFIG_FINSH_THREAD_PRIORITY=20
CONFIG_FINSH_THREAD_STACK_SIZE=4096 CONFIG_FINSH_THREAD_STACK_SIZE=4096
CONFIG_FINSH_CMD_SIZE=80 CONFIG_FINSH_CMD_SIZE=80
@ -81,37 +106,59 @@ CONFIG_FINSH_CMD_SIZE=80
# Device Drivers # Device Drivers
# #
CONFIG_RT_USING_DEVICE_IPC=y CONFIG_RT_USING_DEVICE_IPC=y
CONFIG_RT_PIPE_BUFSZ=512
CONFIG_RT_USING_SERIAL=y CONFIG_RT_USING_SERIAL=y
CONFIG_RT_SERIAL_USING_DMA=y CONFIG_RT_SERIAL_USING_DMA=y
# CONFIG_RT_USING_CAN is not set # CONFIG_RT_USING_CAN is not set
# CONFIG_RT_USING_HWTIMER is not set # CONFIG_RT_USING_HWTIMER is not set
# CONFIG_RT_USING_CPUTIME is not set
# CONFIG_RT_USING_I2C is not set # CONFIG_RT_USING_I2C is not set
# CONFIG_RT_USING_PIN is not set # CONFIG_RT_USING_PIN is not set
# CONFIG_RT_USING_ADC is not set
# CONFIG_RT_USING_PWM is not set
# CONFIG_RT_USING_MTD_NOR is not set # CONFIG_RT_USING_MTD_NOR is not set
# CONFIG_RT_USING_MTD_NAND is not set # CONFIG_RT_USING_MTD_NAND is not set
# CONFIG_RT_USING_MTD is not set
# CONFIG_RT_USING_PM is not set
# CONFIG_RT_USING_RTC is not set # CONFIG_RT_USING_RTC is not set
# CONFIG_RT_USING_SDIO is not set # CONFIG_RT_USING_SDIO is not set
# CONFIG_RT_USING_SPI is not set # CONFIG_RT_USING_SPI is not set
# CONFIG_RT_USING_WDT is not set # CONFIG_RT_USING_WDT is not set
# CONFIG_RT_USING_AUDIO is not set
#
# Using WiFi
#
# CONFIG_RT_USING_WIFI is not set
#
# Using USB
#
# CONFIG_RT_USING_USB_HOST is not set # CONFIG_RT_USING_USB_HOST is not set
# CONFIG_RT_USING_USB_DEVICE is not set # CONFIG_RT_USING_USB_DEVICE is not set
# #
# POSIX layer and C standard library # POSIX layer and C standard library
# #
# CONFIG_RT_USING_LIBC is not set CONFIG_RT_USING_LIBC=y
# CONFIG_RT_USING_PTHREADS is not set # CONFIG_RT_USING_PTHREADS is not set
# #
# Network stack # Network
# #
#
# Socket abstraction layer
#
# CONFIG_RT_USING_SAL is not set
# #
# light weight TCP/IP stack # light weight TCP/IP stack
# #
CONFIG_RT_USING_LWIP=y CONFIG_RT_USING_LWIP=y
CONFIG_RT_USING_LWIP141=y CONFIG_RT_USING_LWIP141=y
# CONFIG_RT_USING_LWIP202 is not set # CONFIG_RT_USING_LWIP202 is not set
# CONFIG_RT_USING_LWIP210 is not set
# CONFIG_RT_LWIP_IGMP is not set # CONFIG_RT_LWIP_IGMP is not set
CONFIG_RT_LWIP_ICMP=y CONFIG_RT_LWIP_ICMP=y
# CONFIG_RT_LWIP_SNMP is not set # CONFIG_RT_LWIP_SNMP is not set
@ -119,7 +166,6 @@ CONFIG_RT_LWIP_DNS=y
CONFIG_RT_LWIP_DHCP=y CONFIG_RT_LWIP_DHCP=y
CONFIG_IP_SOF_BROADCAST=1 CONFIG_IP_SOF_BROADCAST=1
CONFIG_IP_SOF_BROADCAST_RECV=1 CONFIG_IP_SOF_BROADCAST_RECV=1
# CONFIG_LWIP_USING_DHCPD is not set
# #
# Static IPv4 Address # Static IPv4 Address
@ -131,8 +177,7 @@ CONFIG_RT_LWIP_UDP=y
CONFIG_RT_LWIP_TCP=y CONFIG_RT_LWIP_TCP=y
# CONFIG_RT_LWIP_RAW is not set # CONFIG_RT_LWIP_RAW is not set
# CONFIG_RT_LWIP_PPP is not set # CONFIG_RT_LWIP_PPP is not set
# CONFIG_RT_LWIP_PPPOE is not set CONFIG_RT_MEMP_NUM_NETCONN=8
# CONFIG_RT_LWIP_PPPOS is not set
CONFIG_RT_LWIP_PBUF_NUM=16 CONFIG_RT_LWIP_PBUF_NUM=16
CONFIG_RT_LWIP_RAW_PCB_NUM=4 CONFIG_RT_LWIP_RAW_PCB_NUM=4
CONFIG_RT_LWIP_UDP_PCB_NUM=4 CONFIG_RT_LWIP_UDP_PCB_NUM=4
@ -143,6 +188,8 @@ CONFIG_RT_LWIP_TCP_WND=8196
CONFIG_RT_LWIP_TCPTHREAD_PRIORITY=10 CONFIG_RT_LWIP_TCPTHREAD_PRIORITY=10
CONFIG_RT_LWIP_TCPTHREAD_MBOX_SIZE=8 CONFIG_RT_LWIP_TCPTHREAD_MBOX_SIZE=8
CONFIG_RT_LWIP_TCPTHREAD_STACKSIZE=1024 CONFIG_RT_LWIP_TCPTHREAD_STACKSIZE=1024
# CONFIG_LWIP_NO_RX_THREAD is not set
# CONFIG_LWIP_NO_TX_THREAD is not set
CONFIG_RT_LWIP_ETHTHREAD_PRIORITY=12 CONFIG_RT_LWIP_ETHTHREAD_PRIORITY=12
CONFIG_RT_LWIP_ETHTHREAD_STACKSIZE=1024 CONFIG_RT_LWIP_ETHTHREAD_STACKSIZE=1024
CONFIG_RT_LWIP_ETHTHREAD_MBOX_SIZE=8 CONFIG_RT_LWIP_ETHTHREAD_MBOX_SIZE=8
@ -152,69 +199,188 @@ CONFIG_SO_REUSE=1
CONFIG_LWIP_SO_RCVTIMEO=1 CONFIG_LWIP_SO_RCVTIMEO=1
CONFIG_LWIP_SO_SNDTIMEO=1 CONFIG_LWIP_SO_SNDTIMEO=1
CONFIG_LWIP_SO_RCVBUF=1 CONFIG_LWIP_SO_RCVBUF=1
# CONFIG_RT_LWIP_NETIF_LOOPBACK is not set
CONFIG_LWIP_NETIF_LOOPBACK=0
# CONFIG_RT_LWIP_STATS is not set
# CONFIG_RT_LWIP_DEBUG is not set
# #
# Modbus master and slave stack # Modbus master and slave stack
# #
# CONFIG_RT_USING_MODBUS is not set # CONFIG_RT_USING_MODBUS is not set
# CONFIG_RT_USING_NETUTILS is not set
# #
# RT-Thread UI Engine # AT commands
# #
# CONFIG_PKG_USING_GUIENGINE is not set # CONFIG_RT_USING_AT is not set
# CONFIG_LWIP_USING_DHCPD is not set
#
# VBUS(Virtual Software BUS)
#
# CONFIG_RT_USING_VBUS is not set
#
# Utilities
#
# CONFIG_RT_USING_LOGTRACE is not set
# CONFIG_RT_USING_RYM is not set
# CONFIG_RT_USING_ULOG is not set
# CONFIG_RT_USING_UTEST is not set
# #
# RT-Thread online packages # RT-Thread online packages
# #
#
# system packages
#
# CONFIG_PKG_USING_PARTITION is not set
# CONFIG_PKG_USING_SQLITE is not set
# #
# IoT - internet of things # IoT - internet of things
# #
# CONFIG_PKG_USING_PAHOMQTT is not set # CONFIG_PKG_USING_PAHOMQTT is not set
# CONFIG_PKG_USING_WEBCLIENT is not set # CONFIG_PKG_USING_WEBCLIENT is not set
# CONFIG_PKG_USING_WEBNET is not set
# CONFIG_PKG_USING_MONGOOSE is not set # CONFIG_PKG_USING_MONGOOSE is not set
# CONFIG_PKG_USING_WEBTERMINAL is not set # CONFIG_PKG_USING_WEBTERMINAL is not set
# CONFIG_PKG_USING_CJSON is not set # CONFIG_PKG_USING_CJSON is not set
# CONFIG_PKG_USING_JSMN is not set
# CONFIG_PKG_USING_LJSON is not set
# CONFIG_PKG_USING_EZXML is not set # CONFIG_PKG_USING_EZXML is not set
# CONFIG_PKG_USING_NANOPB is not set
#
# Wi-Fi
#
# #
# Marvell WiFi # Marvell WiFi
# #
# CONFIG_PKG_USING_MARVELLWIFI is not set # CONFIG_PKG_USING_WLANMARVELL is not set
#
# Wiced WiFi
#
# CONFIG_PKG_USING_WLAN_WICED is not set
# CONFIG_PKG_USING_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set
# CONFIG_PKG_USING_NETUTILS is not set
# CONFIG_PKG_USING_AT_DEVICE is not set
# CONFIG_PKG_USING_WIZNET is not set
#
# IoT Cloud
#
# CONFIG_PKG_USING_ONENET is not set
# CONFIG_PKG_USING_GAGENT_CLOUD is not set
# CONFIG_PKG_USING_ALI_IOTKIT is not set
# CONFIG_PKG_USING_AZURE is not set
# CONFIG_PKG_USING_TENCENT_IOTKIT is not set
# #
# security packages # security packages
# #
# CONFIG_PKG_USING_MBEDTLS is not set # CONFIG_PKG_USING_MBEDTLS is not set
# CONFIG_PKG_USING_libsodium is not set
# CONFIG_PKG_USING_TINYCRYPT is not set
# #
# language packages # language packages
# #
# CONFIG_PKG_USING_LUA is not set
# CONFIG_PKG_USING_JERRYSCRIPT is not set # CONFIG_PKG_USING_JERRYSCRIPT is not set
# CONFIG_PKG_USING_MICROPYTHON is not set
# #
# multimedia packages # multimedia packages
# #
# CONFIG_PKG_USING_OPENMV is not set
# CONFIG_PKG_USING_MUPDF is not set
# #
# tools packages # tools packages
# #
# CONFIG_PKG_USING_CMBACKTRACE is not set # CONFIG_PKG_USING_CMBACKTRACE is not set
# CONFIG_PKG_USING_EASYFLASH is not set
# CONFIG_PKG_USING_EASYLOGGER is not set # CONFIG_PKG_USING_EASYLOGGER is not set
# CONFIG_PKG_USING_SYSTEMVIEW is not set
# CONFIG_PKG_USING_RDB is not set
# CONFIG_PKG_USING_QRCODE is not set
# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
#
# system packages
#
# CONFIG_PKG_USING_GUIENGINE is not set
# CONFIG_PKG_USING_CAIRO is not set
# CONFIG_PKG_USING_PIXMAN is not set
# CONFIG_PKG_USING_LWEXT4 is not set
# CONFIG_PKG_USING_PARTITION is not set
# CONFIG_PKG_USING_FAL is not set
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
# CONFIG_PKG_USING_CMSIS is not set
# CONFIG_PKG_USING_DFS_YAFFS is not set
# CONFIG_PKG_USING_LITTLEFS is not set
#
# peripheral libraries and drivers
#
# CONFIG_PKG_USING_REALTEK_AMEBA is not set
# CONFIG_PKG_USING_SHT2X is not set
# CONFIG_PKG_USING_AHT10 is not set
# CONFIG_PKG_USING_AP3216C is not set
# CONFIG_PKG_USING_STM32_SDIO is not set
# CONFIG_PKG_USING_ICM20608 is not set
# CONFIG_PKG_USING_U8G2 is not set
# CONFIG_PKG_USING_BUTTON is not set
# CONFIG_PKG_USING_MPU6XXX is not set
# CONFIG_PKG_USING_PCF8574 is not set
# CONFIG_PKG_USING_KENDRYTE_SDK is not set
# #
# miscellaneous packages # miscellaneous packages
# #
# CONFIG_PKG_USING_LIBCSV is not set
# CONFIG_PKG_USING_OPTPARSE is not set
# CONFIG_PKG_USING_FASTLZ is not set
# CONFIG_PKG_USING_MINILZO is not set
# CONFIG_PKG_USING_QUICKLZ is not set
# CONFIG_PKG_USING_MULTIBUTTON is not set
# CONFIG_PKG_USING_CANFESTIVAL is not set
# CONFIG_PKG_USING_ZLIB is not set
# CONFIG_PKG_USING_DSTR is not set
# CONFIG_PKG_USING_TINYFRAME is not set
# CONFIG_PKG_USING_KENDRYTE_DEMO is not set
#
# samples: kernel and components samples
#
# CONFIG_PKG_USING_KERNEL_SAMPLES is not set
# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set
# CONFIG_PKG_USING_NETWORK_SAMPLES is not set
# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set
# CONFIG_PKG_USING_HELLO is not set # CONFIG_PKG_USING_HELLO is not set
# #
# BSP_SPECIAL CONFIG # Privated Packages of RealThread
# #
# CONFIG_PKG_USING_CODEC is not set
# CONFIG_PKG_USING_PLAYER is not set
# CONFIG_PKG_USING_PERSIMMON_SRC is not set
# CONFIG_PKG_USING_JS_PERSIMMON is not set
# CONFIG_PKG_USING_JERRYSCRIPT_WIN32 is not set
#
# Network Utilities
#
# CONFIG_PKG_USING_MDNS is not set
# CONFIG_PKG_USING_UPNP is not set
# CONFIG_PKG_USING_WICED is not set
# CONFIG_PKG_USING_CLOUDSDK is not set
# CONFIG_PKG_USING_COREMARK is not set
# CONFIG_PKG_USING_POWER_MANAGER is not set
# CONFIG_PKG_USING_RT_OTA is not set
# CONFIG_PKG_USING_RDBD_SRC is not set
# CONFIG_PKG_USING_RTINSIGHT is not set
# CONFIG_PKG_USING_SMARTCONFIG is not set
# CONFIG_PKG_USING_RTX is not set
CONFIG_RT_USING_UART0=y CONFIG_RT_USING_UART0=y

View File

@ -248,11 +248,11 @@ volatile uint32_t g_ui32AbnormalInts;
typedef struct typedef struct
{ {
/* inherit from ethernet device */ /* inherit from ethernet device */
struct eth_device parent; struct eth_device parent;
tStellarisIF* dma_if; tStellarisIF* dma_if;
/* for rx_thread async get pbuf */ /* for rx_thread async get pbuf */
rt_mailbox_t rx_pbuf_mb; rt_mailbox_t rx_pbuf_mb;
} net_device; } net_device;
typedef net_device* net_device_t; typedef net_device* net_device_t;
@ -862,8 +862,8 @@ tivaif_receive(net_device_t dev)
{ {
#else #else
//if(tcpip_input(pBuf, psNetif) != RT_EOK) //if(tcpip_input(pBuf, psNetif) != RT_EOK)
if((rt_mb_send(dev->rx_pbuf_mb, (rt_uint32_t)pBuf) != RT_EOK) || if((rt_mb_send(dev->rx_pbuf_mb, (rt_uint32_t)pBuf) != RT_EOK) ||
(eth_device_ready(&(dev->parent)) != RT_EOK)) (eth_device_ready(&(dev->parent)) != RT_EOK))
{ {
#endif #endif
/* drop the packet */ /* drop the packet */
@ -950,10 +950,10 @@ tivaif_process_phy_interrupt(net_device_t dev)
*/ */
ui16Val = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_MISR1); ui16Val = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_MISR1);
/* /*
* Dummy read PHY REG EPHY_BMSR, it will force update the EPHY_STS register * Dummy read PHY REG EPHY_BMSR, it will force update the EPHY_STS register
*/ */
EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_BMSR); EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_BMSR);
/* Read the current PHY status. */ /* Read the current PHY status. */
ui16Status = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_STS); ui16Status = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_STS);
@ -968,7 +968,7 @@ tivaif_process_phy_interrupt(net_device_t dev)
netif_set_link_up(psNetif); netif_set_link_up(psNetif);
#else #else
//tcpip_callback((tcpip_callback_fn)netif_set_link_up, psNetif); //tcpip_callback((tcpip_callback_fn)netif_set_link_up, psNetif);
eth_device_linkchange(&(dev->parent), RT_TRUE); eth_device_linkchange(&(dev->parent), RT_TRUE);
#endif #endif
/* In this case we drop through since we may need to reconfigure /* In this case we drop through since we may need to reconfigure
@ -982,7 +982,7 @@ tivaif_process_phy_interrupt(net_device_t dev)
netif_set_link_down(psNetif); netif_set_link_down(psNetif);
#else #else
//tcpip_callback((tcpip_callback_fn)netif_set_link_down, psNetif); //tcpip_callback((tcpip_callback_fn)netif_set_link_down, psNetif);
eth_device_linkchange(&(dev->parent), RT_FALSE); eth_device_linkchange(&(dev->parent), RT_FALSE);
#endif #endif
} }
} }
@ -1168,40 +1168,40 @@ void lwIPEthernetIntHandler(void)
// OUI:00-12-37 (hex) Texas Instruments, only for test // OUI:00-12-37 (hex) Texas Instruments, only for test
static int tiva_eth_mac_addr_init(void) static int tiva_eth_mac_addr_init(void)
{ {
int retVal =0; int retVal =0;
uint32_t ulUser[2]; uint32_t ulUser[2];
uint8_t mac_addr[6]; uint8_t mac_addr[6];
MAP_FlashUserGet(&ulUser[0], &ulUser[1]); MAP_FlashUserGet(&ulUser[0], &ulUser[1]);
if((ulUser[0] == 0xffffffff) || (ulUser[1] == 0xffffffff)) if((ulUser[0] == 0xffffffff) || (ulUser[1] == 0xffffffff))
{ {
rt_kprintf("Fail to get mac address from eeprom.\n"); rt_kprintf("Fail to get mac address from eeprom.\n");
rt_kprintf("Using default mac address\n"); rt_kprintf("Using default mac address\n");
// OUI:00-12-37 (hex) Texas Instruments, only for test // OUI:00-12-37 (hex) Texas Instruments, only for test
// Configure the hardware MAC address // Configure the hardware MAC address
ulUser[0] = 0x00371200; ulUser[0] = 0x00371200;
ulUser[1] = 0x00563412; ulUser[1] = 0x00563412;
//FlashUserSet(ulUser0, ulUser1); //FlashUserSet(ulUser0, ulUser1);
retVal =-1; retVal =-1;
} }
//Convert the 24/24 split MAC address from NV ram into a 32/16 split MAC //Convert the 24/24 split MAC address from NV ram into a 32/16 split MAC
//address needed to program the hardware registers, then program the MAC //address needed to program the hardware registers, then program the MAC
//address into the Ethernet Controller registers. //address into the Ethernet Controller registers.
mac_addr[0] = ((ulUser[0] >> 0) & 0xff); mac_addr[0] = ((ulUser[0] >> 0) & 0xff);
mac_addr[1] = ((ulUser[0] >> 8) & 0xff); mac_addr[1] = ((ulUser[0] >> 8) & 0xff);
mac_addr[2] = ((ulUser[0] >> 16) & 0xff); mac_addr[2] = ((ulUser[0] >> 16) & 0xff);
mac_addr[3] = ((ulUser[1] >> 0) & 0xff); mac_addr[3] = ((ulUser[1] >> 0) & 0xff);
mac_addr[4] = ((ulUser[1] >> 8) & 0xff); mac_addr[4] = ((ulUser[1] >> 8) & 0xff);
mac_addr[5] = ((ulUser[1] >> 16) & 0xff); mac_addr[5] = ((ulUser[1] >> 16) & 0xff);
// //
// Program the hardware with its MAC address (for filtering). // Program the hardware with its MAC address (for filtering).
// //
MAP_EMACAddrSet(EMAC0_BASE, 0, mac_addr); MAP_EMACAddrSet(EMAC0_BASE, 0, mac_addr);
return retVal; return retVal;
} }
void tiva_eth_lowlevel_init(void) void tiva_eth_lowlevel_init(void)
@ -1214,7 +1214,7 @@ static int tiva_eth_mac_addr_init(void)
MAP_GPIOPinConfigure(GPIO_PF4_EN0LED1); MAP_GPIOPinConfigure(GPIO_PF4_EN0LED1);
GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_0); GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_0);
GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_4); GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_4);
// //
// Enable the ethernet peripheral. // Enable the ethernet peripheral.
// //
@ -1243,7 +1243,7 @@ static int tiva_eth_mac_addr_init(void)
// //
// Internal PHY is not present on this part so hang here. // Internal PHY is not present on this part so hang here.
// //
rt_kprintf("Internal PHY is not present on this part.\n"); rt_kprintf("Internal PHY is not present on this part.\n");
while(1) while(1)
{ {
} }
@ -1283,17 +1283,17 @@ static int tiva_eth_mac_addr_init(void)
EMAC_MODE_TX_STORE_FORWARD | EMAC_MODE_TX_STORE_FORWARD |
EMAC_MODE_TX_THRESHOLD_64_BYTES | EMAC_MODE_TX_THRESHOLD_64_BYTES |
EMAC_MODE_RX_THRESHOLD_64_BYTES), 0); EMAC_MODE_RX_THRESHOLD_64_BYTES), 0);
EMACIntRegister(EMAC0_BASE, lwIPEthernetIntHandler); EMACIntRegister(EMAC0_BASE, lwIPEthernetIntHandler);
} }
static rt_err_t eth_dev_init(rt_device_t device) static rt_err_t eth_dev_init(rt_device_t device)
{ {
net_device_t net_dev = (net_device_t)device; net_device_t net_dev = (net_device_t)device;
struct netif *psNetif = (net_dev->parent.netif); struct netif *psNetif = (net_dev->parent.netif);
LWIP_ASSERT("psNetif != NULL", (psNetif != NULL)); LWIP_ASSERT("psNetif != NULL", (psNetif != NULL));
#if LWIP_NETIF_HOSTNAME #if LWIP_NETIF_HOSTNAME
/* Initialize interface hostname */ /* Initialize interface hostname */
@ -1320,91 +1320,91 @@ static rt_err_t eth_dev_init(rt_device_t device)
/* control the interface */ /* control the interface */
static rt_err_t eth_dev_control(rt_device_t dev, int cmd, void *args) static rt_err_t eth_dev_control(rt_device_t dev, int cmd, void *args)
{ {
switch(cmd) switch(cmd)
{ {
case NIOCTL_GADDR: case NIOCTL_GADDR:
/* get mac address */ /* get mac address */
if(args) if(args)
MAP_EMACAddrGet(EMAC0_BASE, 0, (uint8_t*)args); MAP_EMACAddrGet(EMAC0_BASE, 0, (uint8_t*)args);
else else
return -RT_ERROR; return -RT_ERROR;
break; break;
default : default :
break; break;
} }
return RT_EOK; return RT_EOK;
} }
/* Open the interface */ /* Open the interface */
static rt_err_t eth_dev_open(rt_device_t dev, rt_uint16_t oflag) static rt_err_t eth_dev_open(rt_device_t dev, rt_uint16_t oflag)
{ {
return RT_EOK; return RT_EOK;
} }
/* Close the interface */ /* Close the interface */
static rt_err_t eth_dev_close(rt_device_t dev) static rt_err_t eth_dev_close(rt_device_t dev)
{ {
return RT_EOK; return RT_EOK;
} }
/* Read */ /* Read */
static rt_size_t eth_dev_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size) static rt_size_t eth_dev_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
{ {
rt_set_errno(-RT_ENOSYS); rt_set_errno(-RT_ENOSYS);
return 0; return 0;
} }
/* Write */ /* Write */
static rt_size_t eth_dev_write(rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size) static rt_size_t eth_dev_write(rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size)
{ {
rt_set_errno(-RT_ENOSYS); rt_set_errno(-RT_ENOSYS);
return 0; return 0;
} }
static rt_err_t eth_dev_tx(rt_device_t dev, struct pbuf *p) static rt_err_t eth_dev_tx(rt_device_t dev, struct pbuf *p)
{ {
return tivaif_transmit((net_device_t)dev, p); return tivaif_transmit((net_device_t)dev, p);
} }
static struct pbuf* eth_dev_rx(rt_device_t dev) static struct pbuf* eth_dev_rx(rt_device_t dev)
{ {
rt_err_t result; rt_err_t result;
rt_uint32_t temp =0; rt_uint32_t temp =0;
net_device_t net_dev = (net_device_t)dev; net_device_t net_dev = (net_device_t)dev;
result = rt_mb_recv(net_dev->rx_pbuf_mb, &temp, RT_WAITING_NO); result = rt_mb_recv(net_dev->rx_pbuf_mb, (rt_ubase_t *)&temp, RT_WAITING_NO);
return (result == RT_EOK)? (struct pbuf*)temp : RT_NULL; return (result == RT_EOK)? (struct pbuf*)temp : RT_NULL;
} }
int rt_hw_tiva_eth_init(void) int rt_hw_tiva_eth_init(void)
{ {
rt_err_t result; rt_err_t result;
/* Clock GPIO and etc */ /* Clock GPIO and etc */
tiva_eth_lowlevel_init(); tiva_eth_lowlevel_init();
tiva_eth_mac_addr_init(); tiva_eth_mac_addr_init();
/* init rt-thread device interface */ /* init rt-thread device interface */
eth_dev->parent.parent.init = eth_dev_init; eth_dev->parent.parent.init = eth_dev_init;
eth_dev->parent.parent.open = eth_dev_open; eth_dev->parent.parent.open = eth_dev_open;
eth_dev->parent.parent.close = eth_dev_close; eth_dev->parent.parent.close = eth_dev_close;
eth_dev->parent.parent.read = eth_dev_read; eth_dev->parent.parent.read = eth_dev_read;
eth_dev->parent.parent.write = eth_dev_write; eth_dev->parent.parent.write = eth_dev_write;
eth_dev->parent.parent.control = eth_dev_control; eth_dev->parent.parent.control = eth_dev_control;
eth_dev->parent.eth_rx = eth_dev_rx; eth_dev->parent.eth_rx = eth_dev_rx;
eth_dev->parent.eth_tx = eth_dev_tx; eth_dev->parent.eth_tx = eth_dev_tx;
result = rt_mb_init(&eth_rx_pbuf_mb, "epbuf", result = rt_mb_init(&eth_rx_pbuf_mb, "epbuf",
&rx_pbuf_mb_pool[0], sizeof(rx_pbuf_mb_pool)/4, &rx_pbuf_mb_pool[0], sizeof(rx_pbuf_mb_pool)/4,
RT_IPC_FLAG_FIFO); RT_IPC_FLAG_FIFO);
RT_ASSERT(result == RT_EOK); RT_ASSERT(result == RT_EOK);
eth_dev->rx_pbuf_mb = &eth_rx_pbuf_mb; eth_dev->rx_pbuf_mb = &eth_rx_pbuf_mb;
result = eth_device_init(&(eth_dev->parent), "e0"); result = eth_device_init(&(eth_dev->parent), "e0");
return result; return result;
} }
// eth_device_init using malloc // eth_device_init using malloc
// We use INIT_COMPONENT_EXPORT insted of INIT_BOARD_EXPORT // We use INIT_COMPONENT_EXPORT insted of INIT_BOARD_EXPORT
@ -1416,28 +1416,28 @@ INIT_COMPONENT_EXPORT(rt_hw_tiva_eth_init);
#include "finsh.h" #include "finsh.h"
void PHY_Read(uint8_t addr) void PHY_Read(uint8_t addr)
{ {
uint16_t data = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, addr); uint16_t data = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, addr);
rt_kprintf("R PHY_REG[0x%02X] = 0x%04X\n", addr, data); rt_kprintf("R PHY_REG[0x%02X] = 0x%04X\n", addr, data);
} }
FINSH_FUNCTION_EXPORT(PHY_Read, (add)); FINSH_FUNCTION_EXPORT(PHY_Read, (add));
void PHY_Write(uint8_t addr , uint16_t data) void PHY_Write(uint8_t addr , uint16_t data)
{ {
EMACPHYWrite(EMAC0_BASE, PHY_PHYS_ADDR, addr, data); EMACPHYWrite(EMAC0_BASE, PHY_PHYS_ADDR, addr, data);
rt_kprintf("W PHY_REG[0x%02X] = 0x%04X\n", addr, data); rt_kprintf("W PHY_REG[0x%02X] = 0x%04X\n", addr, data);
} }
FINSH_FUNCTION_EXPORT(PHY_Write, (add, data)); FINSH_FUNCTION_EXPORT(PHY_Write, (add, data));
void PHY_SetAdd(uint8_t addr0, uint8_t addr1, uint8_t addr2, void PHY_SetAdd(uint8_t addr0, uint8_t addr1, uint8_t addr2,
uint8_t addr3, uint8_t addr4, uint8_t addr5) uint8_t addr3, uint8_t addr4, uint8_t addr5)
{ {
uint32_t ulUser[2]; uint32_t ulUser[2];
ulUser[0] = (((addr2<<8)|addr1)<<8)|addr0; ulUser[0] = (((addr2<<8)|addr1)<<8)|addr0;
ulUser[1] = (((addr5<<8)|addr4)<<8)|addr3; ulUser[1] = (((addr5<<8)|addr4)<<8)|addr3;
MAP_FlashUserSet(ulUser[0], ulUser[1]); MAP_FlashUserSet(ulUser[0], ulUser[1]);
MAP_FlashUserSave(); MAP_FlashUserSave();
rt_kprintf("Save to EEPROM. please reboot."); rt_kprintf("Save to EEPROM. please reboot.");
} }
FINSH_FUNCTION_EXPORT(PHY_SetAdd, (add0-add5)); FINSH_FUNCTION_EXPORT(PHY_SetAdd, (add0-add5));
#endif //RT_USING_FINSH #endif //RT_USING_FINSH

View File

@ -8,17 +8,18 @@
#define RT_NAME_MAX 8 #define RT_NAME_MAX 8
#define RT_ALIGN_SIZE 4 #define RT_ALIGN_SIZE 4
#define RT_THREAD_PRIORITY_32
#define RT_THREAD_PRIORITY_MAX 32 #define RT_THREAD_PRIORITY_MAX 32
#define RT_TICK_PER_SECOND 100 #define RT_TICK_PER_SECOND 100
#define RT_DEBUG
#define RT_USING_OVERFLOW_CHECK #define RT_USING_OVERFLOW_CHECK
#define RT_DEBUG_INIT 0
/* RT_DEBUG_THREAD is not set */
#define RT_USING_HOOK #define RT_USING_HOOK
#define RT_USING_IDLE_HOOK
#define RT_IDEL_HOOK_LIST_SIZE 4
#define IDLE_THREAD_STACK_SIZE 256 #define IDLE_THREAD_STACK_SIZE 256
#define RT_USING_TIMER_SOFT #define RT_USING_TIMER_SOFT
#define RT_TIMER_THREAD_PRIO 4 #define RT_TIMER_THREAD_PRIO 4
#define RT_TIMER_THREAD_STACK_SIZE 512 #define RT_TIMER_THREAD_STACK_SIZE 512
#define RT_DEBUG
/* Inter-Thread communication */ /* Inter-Thread communication */
@ -27,15 +28,13 @@
#define RT_USING_EVENT #define RT_USING_EVENT
#define RT_USING_MAILBOX #define RT_USING_MAILBOX
#define RT_USING_MESSAGEQUEUE #define RT_USING_MESSAGEQUEUE
/* RT_USING_SIGNALS is not set */
/* Memory Management */ /* Memory Management */
#define RT_USING_MEMPOOL #define RT_USING_MEMPOOL
#define RT_USING_MEMHEAP #define RT_USING_MEMHEAP
#define RT_USING_HEAP
#define RT_USING_SMALL_MEM #define RT_USING_SMALL_MEM
/* RT_USING_SLAB is not set */ #define RT_USING_HEAP
/* Kernel Device Object */ /* Kernel Device Object */
@ -43,71 +42,64 @@
#define RT_USING_CONSOLE #define RT_USING_CONSOLE
#define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLEBUF_SIZE 128
#define RT_CONSOLE_DEVICE_NAME "uart0" #define RT_CONSOLE_DEVICE_NAME "uart0"
/* RT_USING_MODULE is not set */ #define RT_VER_NUM 0x40000
/* RT-Thread Components */ /* RT-Thread Components */
#define RT_USING_COMPONENTS_INIT #define RT_USING_COMPONENTS_INIT
#define RT_USING_USER_MAIN #define RT_USING_USER_MAIN
#define RT_MAIN_THREAD_STACK_SIZE 2048
#define RT_MAIN_THREAD_PRIORITY 10
/* C++ features */ /* C++ features */
/* RT_USING_CPLUSPLUS is not set */
/* Command shell */ /* Command shell */
#define RT_USING_FINSH #define RT_USING_FINSH
#define FINSH_THREAD_NAME "tshell"
#define FINSH_USING_HISTORY #define FINSH_USING_HISTORY
#define FINSH_HISTORY_LINES 5
#define FINSH_USING_SYMTAB #define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION #define FINSH_USING_DESCRIPTION
#define FINSH_THREAD_PRIORITY 20 #define FINSH_THREAD_PRIORITY 20
#define FINSH_THREAD_STACK_SIZE 4096 #define FINSH_THREAD_STACK_SIZE 4096
#define FINSH_CMD_SIZE 80 #define FINSH_CMD_SIZE 80
/* FINSH_USING_AUTH is not set */
/* FINSH_USING_MSH is not set */
/* Device virtual file system */ /* Device virtual file system */
/* RT_USING_DFS is not set */
/* Device Drivers */ /* Device Drivers */
#define RT_USING_DEVICE_IPC #define RT_USING_DEVICE_IPC
#define RT_PIPE_BUFSZ 512
#define RT_USING_SERIAL #define RT_USING_SERIAL
#define RT_SERIAL_USING_DMA #define RT_SERIAL_USING_DMA
/* RT_USING_CAN is not set */
/* RT_USING_HWTIMER is not set */ /* Using WiFi */
/* RT_USING_I2C is not set */
/* RT_USING_PIN is not set */
/* RT_USING_MTD_NOR is not set */ /* Using USB */
/* RT_USING_MTD_NAND is not set */
/* RT_USING_RTC is not set */
/* RT_USING_SDIO is not set */
/* RT_USING_SPI is not set */
/* RT_USING_WDT is not set */
/* RT_USING_USB_HOST is not set */
/* RT_USING_USB_DEVICE is not set */
/* POSIX layer and C standard library */ /* POSIX layer and C standard library */
/* RT_USING_LIBC is not set */ #define RT_USING_LIBC
/* RT_USING_PTHREADS is not set */
/* Network */
/* Socket abstraction layer */
/* Network stack */
/* light weight TCP/IP stack */ /* light weight TCP/IP stack */
#define RT_USING_LWIP #define RT_USING_LWIP
#define RT_USING_LWIP141 #define RT_USING_LWIP141
/* RT_USING_LWIP202 is not set */
/* RT_LWIP_IGMP is not set */
#define RT_LWIP_ICMP #define RT_LWIP_ICMP
/* RT_LWIP_SNMP is not set */
#define RT_LWIP_DNS #define RT_LWIP_DNS
#define RT_LWIP_DHCP #define RT_LWIP_DHCP
#define IP_SOF_BROADCAST 1 #define IP_SOF_BROADCAST 1
#define IP_SOF_BROADCAST_RECV 1 #define IP_SOF_BROADCAST_RECV 1
/* LWIP_USING_DHCPD is not set */
/* Static IPv4 Address */ /* Static IPv4 Address */
@ -116,10 +108,7 @@
#define RT_LWIP_MSKADDR "255.255.255.0" #define RT_LWIP_MSKADDR "255.255.255.0"
#define RT_LWIP_UDP #define RT_LWIP_UDP
#define RT_LWIP_TCP #define RT_LWIP_TCP
/* RT_LWIP_RAW is not set */ #define RT_MEMP_NUM_NETCONN 8
/* RT_LWIP_PPP is not set */
/* RT_LWIP_PPPOE is not set */
/* RT_LWIP_PPPOS is not set */
#define RT_LWIP_PBUF_NUM 16 #define RT_LWIP_PBUF_NUM 16
#define RT_LWIP_RAW_PCB_NUM 4 #define RT_LWIP_RAW_PCB_NUM 4
#define RT_LWIP_UDP_PCB_NUM 4 #define RT_LWIP_UDP_PCB_NUM 4
@ -133,62 +122,69 @@
#define RT_LWIP_ETHTHREAD_PRIORITY 12 #define RT_LWIP_ETHTHREAD_PRIORITY 12
#define RT_LWIP_ETHTHREAD_STACKSIZE 1024 #define RT_LWIP_ETHTHREAD_STACKSIZE 1024
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 8 #define RT_LWIP_ETHTHREAD_MBOX_SIZE 8
/* RT_LWIP_REASSEMBLY_FRAG is not set */
#define LWIP_NETIF_STATUS_CALLBACK 1 #define LWIP_NETIF_STATUS_CALLBACK 1
#define SO_REUSE 1 #define SO_REUSE 1
#define LWIP_SO_RCVTIMEO 1 #define LWIP_SO_RCVTIMEO 1
#define LWIP_SO_SNDTIMEO 1 #define LWIP_SO_SNDTIMEO 1
#define LWIP_SO_RCVBUF 1 #define LWIP_SO_RCVBUF 1
#define LWIP_NETIF_LOOPBACK 0
/* Modbus master and slave stack */ /* Modbus master and slave stack */
/* RT_USING_MODBUS is not set */
/* RT_USING_NETUTILS is not set */
/* RT-Thread UI Engine */ /* AT commands */
/* VBUS(Virtual Software BUS) */
/* Utilities */
/* PKG_USING_GUIENGINE is not set */
/* RT-Thread online packages */ /* RT-Thread online packages */
/* system packages */
/* PKG_USING_PARTITION is not set */
/* PKG_USING_SQLITE is not set */
/* IoT - internet of things */ /* IoT - internet of things */
/* PKG_USING_PAHOMQTT is not set */
/* PKG_USING_WEBCLIENT is not set */ /* Wi-Fi */
/* PKG_USING_MONGOOSE is not set */
/* PKG_USING_WEBTERMINAL is not set */
/* PKG_USING_CJSON is not set */
/* PKG_USING_EZXML is not set */
/* Marvell WiFi */ /* Marvell WiFi */
/* PKG_USING_MARVELLWIFI is not set */
/* Wiced WiFi */
/* IoT Cloud */
/* security packages */ /* security packages */
/* PKG_USING_MBEDTLS is not set */
/* language packages */ /* language packages */
/* PKG_USING_JERRYSCRIPT is not set */
/* multimedia packages */ /* multimedia packages */
/* tools packages */ /* tools packages */
/* PKG_USING_CMBACKTRACE is not set */
/* PKG_USING_EASYLOGGER is not set */ /* system packages */
/* peripheral libraries and drivers */
/* miscellaneous packages */ /* miscellaneous packages */
/* PKG_USING_HELLO is not set */
/* BSP_SPECIAL CONFIG */ /* samples: kernel and components samples */
/* Privated Packages of RealThread */
/* Network Utilities */
#define RT_USING_UART0 #define RT_USING_UART0

View File

@ -1,15 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
#ifndef SYS_ERRNO_H__
#define SYS_ERRNO_H__
#include <rtthread.h>
#endif

View File

@ -38,13 +38,14 @@
#include <rthw.h> #include <rthw.h>
#include <rtthread.h> #include <rtthread.h>
typedef rt_uint8_t u8_t; #include <stdint.h>
typedef rt_int8_t s8_t; typedef uint8_t u8_t;
typedef rt_uint16_t u16_t; typedef int8_t s8_t;
typedef rt_int16_t s16_t; typedef uint16_t u16_t;
typedef rt_uint32_t u32_t; typedef int16_t s16_t;
typedef rt_int32_t s32_t; typedef uint32_t u32_t;
typedef rt_uint32_t mem_ptr_t; typedef int32_t s32_t;
typedef uintptr_t mem_ptr_t;
#define U16_F "hu" #define U16_F "hu"
#define S16_F "hd" #define S16_F "hd"

View File

@ -497,10 +497,11 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout)
t = timeout / (1000/RT_TICK_PER_SECOND); t = timeout / (1000/RT_TICK_PER_SECOND);
} }
ret = rt_mb_recv(*mbox, (rt_uint32_t *)msg, t); ret = rt_mb_recv(*mbox, (rt_ubase_t *)msg, t);
if(ret == -RT_ETIMEOUT) if(ret == -RT_ETIMEOUT)
{
return SYS_ARCH_TIMEOUT; return SYS_ARCH_TIMEOUT;
}
else else
{ {
LWIP_ASSERT("rt_mb_recv returned with error!", ret == RT_EOK); LWIP_ASSERT("rt_mb_recv returned with error!", ret == RT_EOK);
@ -528,10 +529,11 @@ u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg)
{ {
int ret; int ret;
ret = rt_mb_recv(*mbox, (rt_uint32_t *)msg, 0); ret = rt_mb_recv(*mbox, (rt_ubase_t *)msg, 0);
if(ret == -RT_ETIMEOUT) if(ret == -RT_ETIMEOUT)
{
return SYS_ARCH_TIMEOUT; return SYS_ARCH_TIMEOUT;
}
else else
{ {
if (ret == RT_EOK) if (ret == RT_EOK)

View File

@ -307,7 +307,7 @@ static void eth_tx_thread_entry(void* parameter)
while (1) while (1)
{ {
if (rt_mb_recv(&eth_tx_thread_mb, (rt_uint32_t*)&msg, RT_WAITING_FOREVER) == RT_EOK) if (rt_mb_recv(&eth_tx_thread_mb, (rt_ubase_t*)&msg, RT_WAITING_FOREVER) == RT_EOK)
{ {
struct eth_device* enetif; struct eth_device* enetif;
@ -339,7 +339,7 @@ static void eth_rx_thread_entry(void* parameter)
while (1) while (1)
{ {
if (rt_mb_recv(&eth_rx_thread_mb, (rt_uint32_t*)&device, RT_WAITING_FOREVER) == RT_EOK) if (rt_mb_recv(&eth_rx_thread_mb, (rt_ubase_t*)&device, RT_WAITING_FOREVER) == RT_EOK)
{ {
struct pbuf *p; struct pbuf *p;

View File

@ -2,10 +2,6 @@
* Copyright (c) 2006-2018, RT-Thread Development Team * Copyright (c) 2006-2018, RT-Thread Development Team
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/
/*
* File : libc_errno.h
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
@ -17,145 +13,194 @@
#include <rtconfig.h> #include <rtconfig.h>
#if defined(RT_USING_NEWLIB) || defined(_WIN32) #if defined(RT_USING_NEWLIB) || defined(_WIN32) || defined(__CC_ARM) || defined(__IAR_SYSTEMS_ICC__)
/* use errno.h file in newlib */ /* use errno.h file in toolchains */
#include <errno.h> #include <errno.h>
#endif
#if defined(__CC_ARM)
/*
defined in armcc/errno.h
#define EDOM 1
#define ERANGE 2
#define EILSEQ 4
#define ESIGNUM 3
#define EINVAL 5
#define ENOMEM 6
*/
#define ERROR_BASE_NO 7
#elif defined(__IAR_SYSTEMS_ICC__)
/* defined in iar/errno.h
#define EDOM 33
#define ERANGE 34
#define EFPOS 35
#define EILSEQ 36
*/
#define ERROR_BASE_NO 36
#else #else
/* define errno self. */
#define EPERM 1 #define ERROR_BASE_NO 0
#define ENOENT 2 #endif
#define ESRCH 3
#define EINTR 4 #if !defined(RT_USING_NEWLIB) && !defined(_WIN32)
#define EIO 5
#define ENXIO 6 #define EPERM (ERROR_BASE_NO + 1)
#define E2BIG 7 #define ENOENT (ERROR_BASE_NO + 2)
#define ENOEXEC 8 #define ESRCH (ERROR_BASE_NO + 3)
#define EBADF 9 #define EINTR (ERROR_BASE_NO + 4)
#define ECHILD 10 #define EIO (ERROR_BASE_NO + 5)
#define EAGAIN 11 #define ENXIO (ERROR_BASE_NO + 6)
#define ENOMEM 12 #define E2BIG (ERROR_BASE_NO + 7)
#define EACCES 13 #define ENOEXEC (ERROR_BASE_NO + 8)
#define EFAULT 14 #define EBADF (ERROR_BASE_NO + 9)
#define ENOTBLK 15 #define ECHILD (ERROR_BASE_NO + 10)
#define EBUSY 16 #define EAGAIN (ERROR_BASE_NO + 11)
#define EEXIST 17
#define EXDEV 18 #ifndef ENOMEM
#define ENODEV 19 #define ENOMEM (ERROR_BASE_NO + 12)
#define ENOTDIR 20 #endif
#define EISDIR 21
#define EINVAL 22 #define EACCES (ERROR_BASE_NO + 13)
#define ENFILE 23 #define EFAULT (ERROR_BASE_NO + 14)
#define EMFILE 24 #define ENOTBLK (ERROR_BASE_NO + 15)
#define ENOTTY 25 #define EBUSY (ERROR_BASE_NO + 16)
#define ETXTBSY 26 #define EEXIST (ERROR_BASE_NO + 17)
#define EFBIG 27 #define EXDEV (ERROR_BASE_NO + 18)
#define ENOSPC 28 #define ENODEV (ERROR_BASE_NO + 19)
#define ESPIPE 29 #define ENOTDIR (ERROR_BASE_NO + 20)
#define EROFS 30 #define EISDIR (ERROR_BASE_NO + 21)
#define EMLINK 31
#define EPIPE 32 #ifndef EINVAL
#define EDOM 33 #define EINVAL (ERROR_BASE_NO + 22)
#define ERANGE 34 #endif
#define EDEADLK 35
#define ENAMETOOLONG 36 #define ENFILE (ERROR_BASE_NO + 23)
#define ENOLCK 37 #define EMFILE (ERROR_BASE_NO + 24)
#define ENOSYS 38 #define ENOTTY (ERROR_BASE_NO + 25)
#define ENOTEMPTY 39 #define ETXTBSY (ERROR_BASE_NO + 26)
#define ELOOP 40 #define EFBIG (ERROR_BASE_NO + 27)
#define ENOSPC (ERROR_BASE_NO + 28)
#define ESPIPE (ERROR_BASE_NO + 29)
#define EROFS (ERROR_BASE_NO + 30)
#define EMLINK (ERROR_BASE_NO + 31)
#define EPIPE (ERROR_BASE_NO + 32)
#ifndef EDOM
#define EDOM (ERROR_BASE_NO + 33)
#endif
#ifndef ERANGE
#define ERANGE (ERROR_BASE_NO + 34)
#endif
#define EDEADLK (ERROR_BASE_NO + 35)
#define ENAMETOOLONG (ERROR_BASE_NO + 36)
#define ENOLCK (ERROR_BASE_NO + 37)
#define ENOSYS (ERROR_BASE_NO + 38)
#define ENOTEMPTY (ERROR_BASE_NO + 39)
#define ELOOP (ERROR_BASE_NO + 40)
#define EWOULDBLOCK EAGAIN #define EWOULDBLOCK EAGAIN
#define ENOMSG 42 #define ENOMSG (ERROR_BASE_NO + 42)
#define EIDRM 43 #define EIDRM (ERROR_BASE_NO + 43)
#define ECHRNG 44 #define ECHRNG (ERROR_BASE_NO + 44)
#define EL2NSYNC 45 #define EL2NSYNC (ERROR_BASE_NO + 45)
#define EL3HLT 46 #define EL3HLT (ERROR_BASE_NO + 46)
#define EL3RST 47 #define EL3RST (ERROR_BASE_NO + 47)
#define ELNRNG 48 #define ELNRNG (ERROR_BASE_NO + 48)
#define EUNATCH 49 #define EUNATCH (ERROR_BASE_NO + 49)
#define ENOCSI 50 #define ENOCSI (ERROR_BASE_NO + 50)
#define EL2HLT 51 #define EL2HLT (ERROR_BASE_NO + 51)
#define EBADE 52 #define EBADE (ERROR_BASE_NO + 52)
#define EBADR 53 #define EBADR (ERROR_BASE_NO + 53)
#define EXFULL 54 #define EXFULL (ERROR_BASE_NO + 54)
#define ENOANO 55 #define ENOANO (ERROR_BASE_NO + 55)
#define EBADRQC 56 #define EBADRQC (ERROR_BASE_NO + 56)
#define EBADSLT 57 #define EBADSLT (ERROR_BASE_NO + 57)
#define EDEADLOCK EDEADLK #define EDEADLOCK EDEADLK
#define EBFONT 59 #define EBFONT (ERROR_BASE_NO + 59)
#define ENOSTR 60 #define ENOSTR (ERROR_BASE_NO + 60)
#define ENODATA 61 #define ENODATA (ERROR_BASE_NO + 61)
#define ETIME 62 #define ETIME (ERROR_BASE_NO + 62)
#define ENOSR 63 #define ENOSR (ERROR_BASE_NO + 63)
#define ENONET 64 #define ENONET (ERROR_BASE_NO + 64)
#define ENOPKG 65 #define ENOPKG (ERROR_BASE_NO + 65)
#define EREMOTE 66 #define EREMOTE (ERROR_BASE_NO + 66)
#define ENOLINK 67 #define ENOLINK (ERROR_BASE_NO + 67)
#define EADV 68 #define EADV (ERROR_BASE_NO + 68)
#define ESRMNT 69 #define ESRMNT (ERROR_BASE_NO + 69)
#define ECOMM 70 #define ECOMM (ERROR_BASE_NO + 70)
#define EPROTO 71 #define EPROTO (ERROR_BASE_NO + 71)
#define EMULTIHOP 72 #define EMULTIHOP (ERROR_BASE_NO + 72)
#define EDOTDOT 73 #define EDOTDOT (ERROR_BASE_NO + 73)
#define EBADMSG 74 #define EBADMSG (ERROR_BASE_NO + 74)
#define EOVERFLOW 75 #define EOVERFLOW (ERROR_BASE_NO + 75)
#define ENOTUNIQ 76 #define ENOTUNIQ (ERROR_BASE_NO + 76)
#define EBADFD 77 #define EBADFD (ERROR_BASE_NO + 77)
#define EREMCHG 78 #define EREMCHG (ERROR_BASE_NO + 78)
#define ELIBACC 79 #define ELIBACC (ERROR_BASE_NO + 79)
#define ELIBBAD 80 #define ELIBBAD (ERROR_BASE_NO + 80)
#define ELIBSCN 81 #define ELIBSCN (ERROR_BASE_NO + 81)
#define ELIBMAX 82 #define ELIBMAX (ERROR_BASE_NO + 82)
#define ELIBEXEC 83 #define ELIBEXEC (ERROR_BASE_NO + 83)
#define EILSEQ 84
#define ERESTART 85 #ifndef EILSEQ
#define ESTRPIPE 86 #define EILSEQ (ERROR_BASE_NO + 84)
#define EUSERS 87 #endif
#define ENOTSOCK 88
#define EDESTADDRREQ 89 #define ERESTART (ERROR_BASE_NO + 85)
#define EMSGSIZE 90 #define ESTRPIPE (ERROR_BASE_NO + 86)
#define EPROTOTYPE 91 #define EUSERS (ERROR_BASE_NO + 87)
#define ENOPROTOOPT 92 #define ENOTSOCK (ERROR_BASE_NO + 88)
#define EPROTONOSUPPORT 93 #define EDESTADDRREQ (ERROR_BASE_NO + 89)
#define ESOCKTNOSUPPORT 94 #define EMSGSIZE (ERROR_BASE_NO + 90)
#define EOPNOTSUPP 95 #define EPROTOTYPE (ERROR_BASE_NO + 91)
#define ENOTSUP EOPNOTSUPP #define ENOPROTOOPT (ERROR_BASE_NO + 92)
#define EPFNOSUPPORT 96 #define EPROTONOSUPPORT (ERROR_BASE_NO + 93)
#define EAFNOSUPPORT 97 #define ESOCKTNOSUPPORT (ERROR_BASE_NO + 94)
#define EADDRINUSE 98 #define EOPNOTSUPP (ERROR_BASE_NO + 95)
#define EADDRNOTAVAIL 99 #define ENOTSUP EOPNOTSUPP )
#define ENETDOWN 100 #define EPFNOSUPPORT (ERROR_BASE_NO + 96)
#define ENETUNREACH 101 #define EAFNOSUPPORT (ERROR_BASE_NO + 97)
#define ENETRESET 102 #define EADDRINUSE (ERROR_BASE_NO + 98)
#define ECONNABORTED 103 #define EADDRNOTAVAIL (ERROR_BASE_NO + 99)
#define ECONNRESET 104 #define ENETDOWN (ERROR_BASE_NO + 100)
#define ENOBUFS 105 #define ENETUNREACH (ERROR_BASE_NO + 101)
#define EISCONN 106 #define ENETRESET (ERROR_BASE_NO + 102)
#define ENOTCONN 107 #define ECONNABORTED (ERROR_BASE_NO + 103)
#define ESHUTDOWN 108 #define ECONNRESET (ERROR_BASE_NO + 104)
#define ETOOMANYREFS 109 #define ENOBUFS (ERROR_BASE_NO + 105)
#define ETIMEDOUT 110 #define EISCONN (ERROR_BASE_NO + 106)
#define ECONNREFUSED 111 #define ENOTCONN (ERROR_BASE_NO + 107)
#define EHOSTDOWN 112 #define ESHUTDOWN (ERROR_BASE_NO + 108)
#define EHOSTUNREACH 113 #define ETOOMANYREFS (ERROR_BASE_NO + 109)
#define EALREADY 114 #define ETIMEDOUT (ERROR_BASE_NO + 110)
#define EINPROGRESS 115 #define ECONNREFUSED (ERROR_BASE_NO + 111)
#define ESTALE 116 #define EHOSTDOWN (ERROR_BASE_NO + 112)
#define EUCLEAN 117 #define EHOSTUNREACH (ERROR_BASE_NO + 113)
#define ENOTNAM 118 #define EALREADY (ERROR_BASE_NO + 114)
#define ENAVAIL 119 #define EINPROGRESS (ERROR_BASE_NO + 115)
#define EISNAM 120 #define ESTALE (ERROR_BASE_NO + 116)
#define EREMOTEIO 121 #define EUCLEAN (ERROR_BASE_NO + 117)
#define EDQUOT 122 #define ENOTNAM (ERROR_BASE_NO + 118)
#define ENOMEDIUM 123 #define ENAVAIL (ERROR_BASE_NO + 119)
#define EMEDIUMTYPE 124 #define EISNAM (ERROR_BASE_NO + 120)
#define ECANCELED 125 #define EREMOTEIO (ERROR_BASE_NO + 121)
#define ENOKEY 126 #define EDQUOT (ERROR_BASE_NO + 122)
#define EKEYEXPIRED 127 #define ENOMEDIUM (ERROR_BASE_NO + 123)
#define EKEYREVOKED 128 #define EMEDIUMTYPE (ERROR_BASE_NO + 124)
#define EKEYREJECTED 129 #define ECANCELED (ERROR_BASE_NO + 125)
#define EOWNERDEAD 130 #define ENOKEY (ERROR_BASE_NO + 126)
#define ENOTRECOVERABLE 131 #define EKEYEXPIRED (ERROR_BASE_NO + 127)
#define ERFKILL 132 #define EKEYREVOKED (ERROR_BASE_NO + 128)
#define EHWPOISON 133 #define EKEYREJECTED (ERROR_BASE_NO + 129)
#define EOWNERDEAD (ERROR_BASE_NO + 130)
#define ENOTRECOVERABLE (ERROR_BASE_NO + 131)
#define ERFKILL (ERROR_BASE_NO + 132)
#define EHWPOISON (ERROR_BASE_NO + 133)
#endif #endif
#endif #endif