Merge remote-tracking branch 'remotes/origin/master' into master_rt-thread

This commit is contained in:
SummerGift 2019-05-16 09:33:14 +08:00
commit a900eaa053
11 changed files with 105 additions and 66 deletions

View File

@ -102,6 +102,7 @@ void rt_hw_interrupt_mask(int vector)
}
/**
* This function will un-mask a interrupt.
* @param vector the interrupt number
*/
@ -167,7 +168,7 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
return old_handler;
}
void rt_interrupt_dispatch(void)
void rt_interrupt_dispatch(rt_uint32_t fiq_irq)
{
void *param;
int vector;

View File

@ -36,8 +36,8 @@
extern int Image$$ER_ZI$$ZI$$Limit;
#define HEAP_BEGIN (&Image$$ER_ZI$$ZI$$Limit)
#elif (defined (__GNUC__))
extern unsigned char __bss_end__;
#define HEAP_BEGIN (&__bss_end__)
extern unsigned char __bss_end;
#define HEAP_BEGIN (&__bss_end)
#elif (defined (__ICCARM__))
#pragma section=".noinit"
#define HEAP_BEGIN (__section_end(".noinit"))

View File

@ -1,6 +1,6 @@
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(start)
ENTRY(system_vectors)
SECTIONS
{
. = 0x70000000;
@ -8,7 +8,7 @@ SECTIONS
. = ALIGN(4);
.text :
{
*(.init)
*(.vectors)
*(.text)
*(.gnu.linkonce.t*)
@ -76,9 +76,9 @@ SECTIONS
.nobss : { *(.nobss) }
. = ALIGN(4);
__bss_start__ = .;
__bss_start = .;
.bss : { *(.bss)}
__bss_end__ = .;
__bss_end = .;
/* stabs debugging sections. */
.stab 0 : { *(.stab) }

View File

@ -332,7 +332,7 @@ void rt_hw_interrupt_umask(int irq)
* @return old handler
*/
rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
void *param, char *name)
void *param, const char *name)
{
rt_isr_handler_t old_handler = RT_NULL;
@ -419,6 +419,29 @@ void rt_hw_interrupt_ack(rt_uint32_t fiq_irq, rt_uint32_t id)
AT91C_BASE_AIC->AIC_EOICR = 0x0;
}
void rt_interrupt_dispatch(rt_uint32_t fiq_irq)
{
rt_isr_handler_t isr_func;
rt_uint32_t irq;
void *param;
/* get irq number */
irq = rt_hw_interrupt_get_active(fiq_irq);
/* get interrupt service routine */
isr_func = irq_desc[irq].handler;
param = irq_desc[irq].param;
/* turn to interrupt service routine */
isr_func(irq, param);
rt_hw_interrupt_ack(fiq_irq, irq);
#ifdef RT_USING_INTERRUPT_INFO
irq_desc[irq].counter ++;
#endif
}
#ifdef RT_USING_FINSH
#ifdef RT_USING_INTERRUPT_INFO
void list_irq(void)

View File

@ -10,7 +10,7 @@ if os.getenv('RTT_CC'):
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
EXEC_PATH = r'D:\arm-2013.11\bin'
EXEC_PATH = '/usr/bin'
elif CROSS_TOOL == 'keil':
PLATFORM = 'armcc'
EXEC_PATH = 'C:/Keil_v5'

View File

@ -431,31 +431,34 @@ static void phy_monitor_thread_entry(void *parameter)
uint8_t phy_addr = 0xFF;
uint8_t phy_speed_new = 0;
rt_uint32_t status = 0;
uint8_t detected_count = 0;
/* phy search */
rt_uint32_t i, temp;
for (i = 0; i <= 0x1F; i++)
while(phy_addr == 0xFF)
{
EthHandle.Init.PhyAddress = i;
HAL_ETH_ReadPHYRegister(&EthHandle, PHY_ID1_REG, (uint32_t *)&temp);
if (temp != 0xFFFF && temp != 0x00)
/* phy search */
rt_uint32_t i, temp;
for (i = 0; i <= 0x1F; i++)
{
phy_addr = i;
break;
EthHandle.Init.PhyAddress = i;
HAL_ETH_ReadPHYRegister(&EthHandle, PHY_ID1_REG, (uint32_t *)&temp);
if (temp != 0xFFFF && temp != 0x00)
{
phy_addr = i;
break;
}
}
detected_count++;
rt_thread_mdelay(1000);
if (detected_count > 10)
{
LOG_E("No PHY device was detected, please check hardware!");
}
}
if (phy_addr == 0xFF)
{
LOG_E("phy not probe!");
return;
}
else
{
LOG_D("found a phy, address:0x%02X", phy_addr);
}
LOG_D("Found a phy, address:0x%02X", phy_addr);
/* RESET PHY */
LOG_D("RESET PHY!");

View File

@ -52,6 +52,8 @@ static void serial_soft_trans_irq(void* parameter);
BOOL xMBPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
eMBParity eParity)
{
rt_device_t dev = RT_NULL;
char uart_name[20];
/**
* set 485 mode receive and transmit control IO
* @note MODBUS_SLAVE_RT_CONTROL_PIN_INDEX need be defined by user
@ -60,22 +62,19 @@ BOOL xMBPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
rt_pin_mode(MODBUS_SLAVE_RT_CONTROL_PIN_INDEX, PIN_MODE_OUTPUT);
#endif
/* set serial name */
if (ucPORT == 1) {
#if defined(RT_USING_UART1) || defined(RT_USING_REMAP_UART1)
extern struct rt_serial_device serial1;
serial = &serial1;
#endif
} else if (ucPORT == 2) {
#if defined(RT_USING_UART2)
extern struct rt_serial_device serial2;
serial = &serial2;
#endif
} else if (ucPORT == 3) {
#if defined(RT_USING_UART3)
extern struct rt_serial_device serial3;
serial = &serial3;
#endif
rt_snprintf(uart_name,sizeof(uart_name), "uart%d", ucPORT);
dev = rt_device_find(uart_name);
if(dev == RT_NULL)
{
/* can not find uart */
return FALSE;
}
else
{
serial = (struct rt_serial_device*)dev;
}
/* set serial configure parameter */
serial->config.baud_rate = ulBaudRate;
serial->config.stop_bits = STOP_BITS_1;

View File

@ -53,6 +53,9 @@ static void serial_soft_trans_irq(void* parameter);
BOOL xMBMasterPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
eMBParity eParity)
{
rt_device_t dev = RT_NULL;
char uart_name[20];
/**
* set 485 mode receive and transmit control IO
* @note MODBUS_MASTER_RT_CONTROL_PIN_INDEX need be defined by user
@ -60,24 +63,20 @@ BOOL xMBMasterPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
#if defined(RT_MODBUS_MASTER_USE_CONTROL_PIN)
rt_pin_mode(MODBUS_MASTER_RT_CONTROL_PIN_INDEX, PIN_MODE_OUTPUT);
#endif
/* set serial name */
if (ucPORT == 1) {
#if defined(RT_USING_UART1) || defined(RT_USING_REMAP_UART1)
extern struct rt_serial_device serial1;
serial = &serial1;
#endif
} else if (ucPORT == 2) {
#if defined(RT_USING_UART2)
extern struct rt_serial_device serial2;
serial = &serial2;
#endif
} else if (ucPORT == 3) {
#if defined(RT_USING_UART3)
extern struct rt_serial_device serial3;
serial = &serial3;
#endif
rt_snprintf(uart_name,sizeof(uart_name), "uart%d", ucPORT);
dev = rt_device_find(uart_name);
if(dev == RT_NULL)
{
/* can not find uart */
return FALSE;
}
else
{
serial = (struct rt_serial_device*)dev;
}
/* set serial configure parameter */
serial->config.baud_rate = ulBaudRate;
serial->config.stop_bits = STOP_BITS_1;

View File

@ -217,6 +217,19 @@ static int inet_getsockname(int socket, struct sockaddr *name, socklen_t *namele
return lwip_getsockname(socket, name, namelen);
}
int inet_ioctlsocket(int socket, long cmd, void *arg)
{
switch (cmd)
{
case F_GETFL:
case F_SETFL:
return lwip_fcntl(socket, cmd, (int) arg);
default:
return lwip_ioctl(socket, cmd, arg);
}
}
#ifdef SAL_USING_POSIX
static int inet_poll(struct dfs_fd *file, struct rt_pollreq *req)
{
@ -278,7 +291,7 @@ static const struct sal_socket_ops lwip_socket_ops =
lwip_shutdown,
lwip_getpeername,
inet_getsockname,
lwip_ioctl,
inet_ioctlsocket,
#ifdef SAL_USING_POSIX
inet_poll,
#endif

View File

@ -197,14 +197,14 @@ void rt_hw_trap_resv(struct rt_hw_register *regs)
rt_hw_cpu_shutdown();
}
extern void rt_interrupt_dispatch(void);
extern void rt_interrupt_dispatch(rt_uint32_t fiq_irq);
void rt_hw_trap_irq(void)
{
rt_interrupt_dispatch();
rt_interrupt_dispatch(INT_IRQ);
}
void rt_hw_trap_fiq(void)
{
rt_interrupt_dispatch();
rt_interrupt_dispatch(INT_FIQ);
}

View File

@ -23,6 +23,7 @@
# 2018-07-31 weety Support pyconfig
import os
import re
import sys
import shutil
@ -75,7 +76,7 @@ def mk_rtconfig(filename):
if setting[1] == 'y':
rtconfig.write('#define %s\n' % setting[0])
else:
rtconfig.write('#define %s %s\n' % (setting[0], setting[1]))
rtconfig.write('#define %s %s\n' % (setting[0], re.findall(r"^.*?=(.*)$",line)[0]))
if os.path.isfile('rtconfig_project.h'):
rtconfig.write('#include "rtconfig_project.h"\n')