mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 12:23:34 +08:00
Nuttx Upgrade:Adds sem_setprotocol
This commit is contained in:
committed by
Lorenz Meier
parent
8610eced57
commit
c9f10107c0
@@ -278,8 +278,12 @@ extern "C" {
|
||||
}
|
||||
|
||||
PX4_DEBUG("Called px4_poll timeout = %d", timeout);
|
||||
|
||||
px4_sem_init(&sem, 0, 0);
|
||||
|
||||
// sem use case is a signal
|
||||
px4_sem_setprotocol(&sem, SEM_PRIO_NONE);
|
||||
|
||||
// Go through all fds and check them for a pollable state
|
||||
bool fd_pollable = false;
|
||||
|
||||
@@ -409,6 +413,11 @@ extern "C" {
|
||||
void px4_enable_sim_lockstep()
|
||||
{
|
||||
px4_sem_init(&lockstep_sem, 0, 0);
|
||||
|
||||
// lockstep_sem use case is a signal
|
||||
|
||||
px4_sem_setprotocol(&lockstep_sem, SEM_PRIO_NONE);
|
||||
|
||||
sim_lockstep = true;
|
||||
sim_delay = false;
|
||||
}
|
||||
|
||||
@@ -231,6 +231,9 @@ PX4IO_serial::~PX4IO_serial()
|
||||
px4_arch_unconfiggpio(PX4IO_SERIAL_TX_GPIO);
|
||||
px4_arch_unconfiggpio(PX4IO_SERIAL_RX_GPIO);
|
||||
|
||||
/* Disable APB clock for the USART peripheral */
|
||||
modifyreg32(STM32_RCC_APB2ENR, RCC_APB2ENR_USART6EN, 0);
|
||||
|
||||
/* and kill our semaphores */
|
||||
px4_sem_destroy(&_completion_semaphore);
|
||||
px4_sem_destroy(&_bus_semaphore);
|
||||
@@ -263,6 +266,10 @@ PX4IO_serial::init()
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Enable the APB clock for the USART peripheral */
|
||||
modifyreg32(STM32_RCC_APB2ENR, 0, RCC_APB2ENR_USART6EN);
|
||||
|
||||
/* configure pins for serial use */
|
||||
px4_arch_configgpio(PX4IO_SERIAL_TX_GPIO);
|
||||
px4_arch_configgpio(PX4IO_SERIAL_RX_GPIO);
|
||||
@@ -294,6 +301,11 @@ PX4IO_serial::init()
|
||||
|
||||
/* create semaphores */
|
||||
px4_sem_init(&_completion_semaphore, 0, 0);
|
||||
|
||||
/* _completion_semaphore use case is a signal */
|
||||
|
||||
px4_sem_setprotocol(&_completion_semaphore, SEM_PRIO_NONE);
|
||||
|
||||
px4_sem_init(&_bus_semaphore, 0, 1);
|
||||
|
||||
|
||||
@@ -311,7 +323,7 @@ PX4IO_serial::ioctl(unsigned operation, unsigned &arg)
|
||||
case 1: /* XXX magic number - test operation */
|
||||
switch (arg) {
|
||||
case 0:
|
||||
lowsyslog("test 0\n");
|
||||
syslog(LOG_INFO, "test 0\n");
|
||||
|
||||
/* kill DMA, this is a PIO test */
|
||||
stm32_dmastop(_tx_dma);
|
||||
@@ -338,7 +350,7 @@ PX4IO_serial::ioctl(unsigned operation, unsigned &arg)
|
||||
}
|
||||
|
||||
if (count >= 5000) {
|
||||
lowsyslog("==== test 1 : %u failures ====\n", fails);
|
||||
syslog(LOG_INFO, "==== test 1 : %u failures ====\n", fails);
|
||||
perf_print_counter(_pc_txns);
|
||||
perf_print_counter(_pc_dmasetup);
|
||||
perf_print_counter(_pc_retries);
|
||||
@@ -357,7 +369,7 @@ PX4IO_serial::ioctl(unsigned operation, unsigned &arg)
|
||||
}
|
||||
|
||||
case 2:
|
||||
lowsyslog("test 2\n");
|
||||
syslog(LOG_INFO, "test 2\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -597,7 +609,7 @@ PX4IO_serial::_wait_complete()
|
||||
}
|
||||
|
||||
/* we might? see this for EINTR */
|
||||
lowsyslog("unexpected ret %d/%d\n", ret, errno);
|
||||
syslog(LOG_ERR, "unexpected ret %d/%d\n", ret, errno);
|
||||
}
|
||||
|
||||
/* reset DMA status */
|
||||
|
||||
Reference in New Issue
Block a user