Compare commits
21 commits
master
...
releases/1
Author | SHA1 | Date | |
---|---|---|---|
|
148c631a2d | ||
|
ec145d5823 | ||
|
9efa398c69 | ||
|
0dba857028 | ||
|
b6f3f2eedc | ||
|
75d62344c2 | ||
|
68b67e692e | ||
|
51f0fc57da | ||
|
a5fe4ec813 | ||
|
9d1b8f0966 | ||
|
a9c7381b59 | ||
|
11fcbc5c45 | ||
|
2bbc0938db | ||
|
7c9f572eae | ||
|
b787e9ec3b | ||
|
d905a4e8a0 | ||
|
8ed5d562ee | ||
|
9e719bbbb7 | ||
|
50410cb1d5 | ||
|
26f5e973f6 | ||
|
67541728cf |
32 changed files with 25919 additions and 25219 deletions
50738
ReleaseNotes
50738
ReleaseNotes
File diff suppressed because it is too large
Load diff
|
@ -100,8 +100,8 @@ void up_secure_irq_all(bool secure)
|
|||
{
|
||||
int i;
|
||||
|
||||
modreg32(secure ? 0 : NVIC_AIRCR_BFHFNMINS,
|
||||
NVIC_AIRCR_BFHFNMINS, NVIC_AIRCR);
|
||||
modreg32((secure ? 0 : NVIC_AIRCR_BFHFNMINS) | NVIC_AIRCR_VECTKEY,
|
||||
(NVIC_AIRCR_VECTKEY_MASK | NVIC_AIRCR_BFHFNMINS), NVIC_AIRCR);
|
||||
|
||||
modreg32(secure ? NVIC_DEMCR_SDME : 0,
|
||||
NVIC_DEMCR_SDME, NVIC_DEMCR);
|
||||
|
|
|
@ -400,6 +400,12 @@ static void _dmac_intc_handler(int ch)
|
|||
int itc;
|
||||
int err;
|
||||
|
||||
if (dev == NULL)
|
||||
{
|
||||
dmaerr("Cannot get device with channel number %d.\n", ch);
|
||||
return;
|
||||
}
|
||||
|
||||
mask = (1u << (ch & 1));
|
||||
|
||||
if (is_dmac(2, dev))
|
||||
|
@ -442,9 +448,16 @@ static int intr_handler_admac1(int irq, void *context, void *arg)
|
|||
static int intr_handler_idmac(int irq, void *context, void *arg)
|
||||
{
|
||||
struct dmac_register_map *dev = get_device(2); /* XXX */
|
||||
uint32_t stat = dev->intstatus & 0x1f;
|
||||
uint32_t stat;
|
||||
int i;
|
||||
|
||||
if (dev == NULL)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
stat = dev->intstatus & 0x1f;
|
||||
|
||||
for (i = 2; stat; i++, stat >>= 1)
|
||||
{
|
||||
if (stat & 1)
|
||||
|
|
|
@ -200,7 +200,7 @@ static uint32_t cxd56_getreg(uintptr_t regaddr)
|
|||
|
||||
/* Show the register value read */
|
||||
|
||||
wdinfo("%08x->%08\n", regaddr, regval);
|
||||
wdinfo("%08x->%08x\n", regaddr, regval);
|
||||
return regval;
|
||||
}
|
||||
#endif
|
||||
|
@ -283,6 +283,7 @@ static int cxd56_start(struct watchdog_lowerhalf_s *lower)
|
|||
wdinfo("Entry\n");
|
||||
|
||||
cxd56_putreg(WDOGLOCK_UNLOCK_KEY, CXD56_WDT_WDOGLOCK);
|
||||
cxd56_putreg(0, CXD56_WDT_WDOGINTCLR); /* reload by write any value */
|
||||
cxd56_putreg(WDOGCONTROL_RESEN | WDOGCONTROL_INTEN, CXD56_WDT_WDOGCONTROL);
|
||||
cxd56_putreg(0, CXD56_WDT_WDOGLOCK);
|
||||
|
||||
|
@ -473,6 +474,7 @@ static int cxd56_settimeout(struct watchdog_lowerhalf_s *lower,
|
|||
/* Set the WDT register according to calculated value */
|
||||
|
||||
cxd56_putreg(WDOGLOCK_UNLOCK_KEY, CXD56_WDT_WDOGLOCK);
|
||||
cxd56_putreg(0, CXD56_WDT_WDOGINTCLR); /* reload by write any value */
|
||||
cxd56_putreg(reload, CXD56_WDT_WDOGLOAD);
|
||||
cxd56_putreg(WDOGCONTROL_RESEN | WDOGCONTROL_INTEN, CXD56_WDT_WDOGCONTROL);
|
||||
cxd56_putreg(0, CXD56_WDT_WDOGLOCK);
|
||||
|
|
|
@ -171,6 +171,30 @@ volatile bool g_rtc_enabled = false;
|
|||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_rtc_waitlasttask
|
||||
*
|
||||
* Description:
|
||||
* wait task done
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void stm32_rtc_waitlasttask(void)
|
||||
{
|
||||
/* Previous write is done? */
|
||||
|
||||
while ((getreg16(STM32_RTC_CRL) & RTC_CRL_RTOFF) == 0)
|
||||
{
|
||||
stm32_waste();
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_rtc_beginwr
|
||||
*
|
||||
|
@ -187,12 +211,7 @@ volatile bool g_rtc_enabled = false;
|
|||
|
||||
static inline void stm32_rtc_beginwr(void)
|
||||
{
|
||||
/* Previous write is done? */
|
||||
|
||||
while ((getreg16(STM32_RTC_CRL) & RTC_CRL_RTOFF) == 0)
|
||||
{
|
||||
stm32_waste();
|
||||
}
|
||||
stm32_rtc_waitlasttask();
|
||||
|
||||
/* Enter Config mode, Set Value and Exit */
|
||||
|
||||
|
@ -216,13 +235,7 @@ static inline void stm32_rtc_beginwr(void)
|
|||
static inline void stm32_rtc_endwr(void)
|
||||
{
|
||||
modifyreg16(STM32_RTC_CRL, RTC_CRL_CNF, 0);
|
||||
|
||||
/* Wait for the write to actually reach RTC registers */
|
||||
|
||||
while ((getreg16(STM32_RTC_CRL) & RTC_CRL_RTOFF) == 0)
|
||||
{
|
||||
stm32_waste();
|
||||
}
|
||||
stm32_rtc_waitlasttask();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -384,6 +397,15 @@ int up_rtc_initialize(void)
|
|||
putreg16(RTC_MAGIC, RTC_MAGIC_REG);
|
||||
}
|
||||
|
||||
modifyreg16(STM32_RCC_BDCR, 0, RCC_BDCR_LSEON);
|
||||
|
||||
/* Wait for the LSE clock to be ready */
|
||||
|
||||
while ((getreg16(STM32_RCC_BDCR) & RCC_BDCR_LSERDY) == 0)
|
||||
{
|
||||
stm32_waste();
|
||||
}
|
||||
|
||||
/* Select the lower power external 32,768Hz (Low-Speed External, LSE)
|
||||
* oscillator as RTC Clock Source and enable the Clock.
|
||||
*/
|
||||
|
@ -393,12 +415,10 @@ int up_rtc_initialize(void)
|
|||
/* Enable RTC and wait for RSF */
|
||||
|
||||
modifyreg16(STM32_RCC_BDCR, 0, RCC_BDCR_RTCEN);
|
||||
|
||||
/* TODO: Possible stall?
|
||||
* should we set the timeout period? and return with -1
|
||||
*/
|
||||
stm32_rtc_waitlasttask();
|
||||
|
||||
stm32_rtc_wait4rsf();
|
||||
stm32_rtc_waitlasttask();
|
||||
|
||||
/* Configure prescaler, note that these are write-only registers */
|
||||
|
||||
|
@ -408,6 +428,7 @@ int up_rtc_initialize(void)
|
|||
stm32_rtc_endwr();
|
||||
|
||||
stm32_rtc_wait4rsf();
|
||||
stm32_rtc_waitlasttask();
|
||||
|
||||
#ifdef CONFIG_RTC_HIRES
|
||||
/* Enable overflow interrupt - alarm interrupt is enabled in
|
||||
|
@ -631,7 +652,6 @@ int up_rtc_settime(const struct timespec *tp)
|
|||
{
|
||||
struct rtc_regvals_s regvals;
|
||||
irqstate_t flags;
|
||||
uint16_t cntl;
|
||||
|
||||
/* Break out the time values */
|
||||
|
||||
|
@ -646,16 +666,11 @@ int up_rtc_settime(const struct timespec *tp)
|
|||
* register (hi-res mode only)
|
||||
*/
|
||||
|
||||
do
|
||||
{
|
||||
stm32_rtc_beginwr();
|
||||
putreg16(RTC_MAGIC, RTC_MAGIC_TIME_SET);
|
||||
putreg16(regvals.cnth, STM32_RTC_CNTH);
|
||||
putreg16(regvals.cntl, STM32_RTC_CNTL);
|
||||
cntl = getreg16(STM32_RTC_CNTL);
|
||||
stm32_rtc_endwr();
|
||||
}
|
||||
while (cntl != regvals.cntl);
|
||||
stm32_rtc_beginwr();
|
||||
putreg16(regvals.cnth, STM32_RTC_CNTH);
|
||||
putreg16(regvals.cntl, STM32_RTC_CNTL);
|
||||
stm32_rtc_endwr();
|
||||
putreg16(RTC_MAGIC_TIME_SET, RTC_MAGIC_REG);
|
||||
|
||||
#ifdef CONFIG_RTC_HIRES
|
||||
putreg16(regvals.ovf, RTC_TIMEMSB_REG);
|
||||
|
|
|
@ -307,7 +307,7 @@ int stm32_configgpio(uint32_t cfgset)
|
|||
* Should it configured as an EXTI interrupt?
|
||||
*/
|
||||
|
||||
if ((cfgset & GPIO_EXTI) != 0)
|
||||
if ((pinmode != GPIO_MODER_OUTPUT) && ((cfgset & GPIO_EXTI) != 0))
|
||||
{
|
||||
uint32_t regaddr;
|
||||
int shift;
|
||||
|
|
|
@ -602,12 +602,12 @@ if ESP32S2_UART1
|
|||
|
||||
config ESP32S2_UART1_TXPIN
|
||||
int "UART1 Tx Pin"
|
||||
default 37
|
||||
default 17
|
||||
range 0 46
|
||||
|
||||
config ESP32S2_UART1_RXPIN
|
||||
int "UART1 Rx Pin"
|
||||
default 38
|
||||
default 18
|
||||
range 0 46
|
||||
|
||||
config ESP32S2_UART1_RTSPIN
|
||||
|
|
|
@ -74,11 +74,15 @@
|
|||
# error "Select LTE SPI 4 or 5"
|
||||
#endif
|
||||
|
||||
#define POWER_ON_WAIT_TIME (2) /* ms */
|
||||
#define ACTIVE_SHUTDOWN_TIME (100) /* ms */
|
||||
#define TIME_TO_STABLE_VDDIO (10) /* ms */
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static struct spi_dev_s *alt1250_poweron(void);
|
||||
static struct spi_dev_s *alt1250_poweron(bool keep_on);
|
||||
static void alt1250_poweroff(void);
|
||||
static bool alt1250_powerstatus(void);
|
||||
static int alt1250_hibernation_mode(bool enable);
|
||||
|
@ -196,7 +200,7 @@ static void set_spiparam(struct spi_dev_s *spidev)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
static struct spi_dev_s *alt1250_poweron(void)
|
||||
static struct spi_dev_s *alt1250_poweron(bool keep_on)
|
||||
{
|
||||
struct spi_dev_s *spi;
|
||||
#if defined(CONFIG_CXD56_LTE_SPI4_DMAC) || defined(CONFIG_CXD56_LTE_SPI5_DMAC)
|
||||
|
@ -204,6 +208,38 @@ static struct spi_dev_s *alt1250_poweron(void)
|
|||
dma_config_t conf;
|
||||
#endif
|
||||
|
||||
/* Hi-Z SHUTDOWN and PowerBTN signals before power-on */
|
||||
|
||||
cxd56_gpio_config(ALT1250_SHUTDOWN, false);
|
||||
|
||||
/* power on alt1250 modem device and wait until the power is distributed */
|
||||
|
||||
board_alt1250_poweron();
|
||||
up_mdelay(POWER_ON_WAIT_TIME);
|
||||
|
||||
/* If keep_on is enabled, skip setting the SHUTDOWN signal to low
|
||||
* because the ALT1250 is already in the power-on state.
|
||||
*/
|
||||
|
||||
if (!keep_on)
|
||||
{
|
||||
/* Drive SHUTDOWN signal low */
|
||||
|
||||
cxd56_gpio_write(ALT1250_SHUTDOWN, 0);
|
||||
}
|
||||
|
||||
/* Keep the SHUTDOWN signal low for reset period */
|
||||
|
||||
up_mdelay(ACTIVE_SHUTDOWN_TIME);
|
||||
|
||||
/* Undrive SHUTDOWN signal to rise up to high by pull-up */
|
||||
|
||||
cxd56_gpio_write_hiz(ALT1250_SHUTDOWN);
|
||||
|
||||
/* Wait VDDIO on Alt1250 stable */
|
||||
|
||||
up_mdelay(TIME_TO_STABLE_VDDIO);
|
||||
|
||||
/* Initialize spi deivce */
|
||||
|
||||
spi = cxd56_spibus_initialize(SPI_CH);
|
||||
|
@ -233,10 +269,6 @@ static struct spi_dev_s *alt1250_poweron(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* power on altair modem device */
|
||||
|
||||
board_alt1250_poweron();
|
||||
|
||||
/* Input enable */
|
||||
|
||||
cxd56_gpio_config(ALT1250_SLAVE_REQ, true);
|
||||
|
@ -263,7 +295,6 @@ static struct spi_dev_s *alt1250_poweron(void)
|
|||
/* enable the SPI pin */
|
||||
|
||||
spi_pincontrol(SPI_CH, true);
|
||||
|
||||
set_spiparam(spi);
|
||||
|
||||
return spi;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "cxd56_i2c.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
#include <arch/chip/pm.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
|
@ -59,6 +60,14 @@
|
|||
|
||||
#define POWER_CHECK_RETRY (10)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static struct pm_cpu_freqlock_s g_hv_lock =
|
||||
PM_CPUFREQLOCK_INIT(PM_CPUFREQLOCK_TAG('I', 'S', 0),
|
||||
PM_CPUFREQLOCK_FLAG_HV);
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -163,6 +172,10 @@ struct i2c_master_s *board_isx012_initialize(void)
|
|||
{
|
||||
_info("Initializing ISX012...\n");
|
||||
|
||||
/* Fix system clock to HV mode */
|
||||
|
||||
up_pm_acquire_freqlock(&g_hv_lock);
|
||||
|
||||
#ifdef IMAGER_ALERT
|
||||
cxd56_gpio_config(IMAGER_ALERT, true);
|
||||
#endif
|
||||
|
@ -184,6 +197,10 @@ int board_isx012_uninitialize(struct i2c_master_s *i2c)
|
|||
|
||||
_info("Uninitializing ISX012...\n");
|
||||
|
||||
/* Release system clock */
|
||||
|
||||
up_pm_release_freqlock(&g_hv_lock);
|
||||
|
||||
/* Initialize i2c device */
|
||||
|
||||
ret = isx012_uninitialize();
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "cxd56_clock.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
#include <arch/chip/pm.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
|
@ -54,6 +55,14 @@
|
|||
|
||||
#define POWER_CHECK_RETRY (10)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static struct pm_cpu_freqlock_s g_hv_lock =
|
||||
PM_CPUFREQLOCK_INIT(PM_CPUFREQLOCK_TAG('I', 'S', 0),
|
||||
PM_CPUFREQLOCK_FLAG_HV);
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -134,6 +143,10 @@ struct i2c_master_s *board_isx019_initialize(void)
|
|||
|
||||
_info("Initializing ISX019...\n");
|
||||
|
||||
/* Fix system clock to HV mode */
|
||||
|
||||
up_pm_acquire_freqlock(&g_hv_lock);
|
||||
|
||||
while (!g_rtc_enabled && 0 < retry--)
|
||||
{
|
||||
/* ISX019 requires stable RTC */
|
||||
|
@ -171,6 +184,10 @@ int board_isx019_uninitialize(struct i2c_master_s *i2c)
|
|||
cxd56_gpio_write_hiz(PIN_IS_DATA0);
|
||||
cxd56_gpio_write_hiz(PIN_IS_DATA7);
|
||||
|
||||
/* Release system clock */
|
||||
|
||||
up_pm_release_freqlock(&g_hv_lock);
|
||||
|
||||
/* Uninitialize i2c device */
|
||||
|
||||
ret = isx019_uninitialize();
|
||||
|
|
|
@ -315,6 +315,12 @@ int lcddev_register(int devno)
|
|||
}
|
||||
|
||||
priv->lcd_ptr = board_lcd_getdev(devno);
|
||||
if (!priv->lcd_ptr)
|
||||
{
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = priv->lcd_ptr->getplaneinfo(priv->lcd_ptr, 0, &priv->planeinfo);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
|
|
@ -488,7 +488,7 @@ static altmdm_state_t process_state_poweroff(uint32_t event,
|
|||
altmdm_event_clear(&g_altmdm_dev.event, EVENT_POWERON);
|
||||
usec2timespec(RESET_INTERVAL, &interval);
|
||||
nxsig_nanosleep(&interval, NULL);
|
||||
g_altmdm_dev.spidev = g_altmdm_dev.lower->poweron();
|
||||
g_altmdm_dev.spidev = g_altmdm_dev.lower->poweron(false);
|
||||
g_altmdm_dev.lower->set_mready(false);
|
||||
g_altmdm_dev.lower->set_wakeup(false);
|
||||
g_altmdm_dev.lower->irqenable(true);
|
||||
|
@ -1534,7 +1534,7 @@ int altmdm_init(FAR struct spi_dev_s *spidev,
|
|||
|
||||
g_altmdm_dev.current_state = ALTMDM_STATE_SLEEP;
|
||||
g_altmdm_dev.vp = VP_V4;
|
||||
g_altmdm_dev.spidev = g_altmdm_dev.lower->poweron();
|
||||
g_altmdm_dev.spidev = g_altmdm_dev.lower->poweron(true);
|
||||
g_altmdm_dev.lower->set_mready(false);
|
||||
g_altmdm_dev.lower->set_wakeup(false);
|
||||
g_altmdm_dev.lower->irqenable(true);
|
||||
|
|
|
@ -1218,6 +1218,7 @@ int apds9960_register(FAR const char *devpath,
|
|||
if (ret != OK)
|
||||
{
|
||||
snerr("ERROR: APDS-9960 is not responding!\n");
|
||||
kmm_free(priv);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1227,6 +1228,7 @@ int apds9960_register(FAR const char *devpath,
|
|||
if (ret < 0)
|
||||
{
|
||||
snerr("ERROR: Failed to initialize the APDS9960!\n");
|
||||
kmm_free(priv);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1240,6 +1242,7 @@ int apds9960_register(FAR const char *devpath,
|
|||
if (ret < 0)
|
||||
{
|
||||
snerr("ERROR: Failed to initialize the APDS9960!\n");
|
||||
kmm_free(priv);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1249,6 +1252,7 @@ int apds9960_register(FAR const char *devpath,
|
|||
if (ret < 0)
|
||||
{
|
||||
snerr("ERROR: Failed to initialize the APDS9960!\n");
|
||||
kmm_free(priv);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1262,6 +1266,7 @@ int apds9960_register(FAR const char *devpath,
|
|||
if (ret < 0)
|
||||
{
|
||||
snerr("ERROR: Failed to write APDS9960_GCONFIG4!\n");
|
||||
kmm_free(priv);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1271,6 +1276,7 @@ int apds9960_register(FAR const char *devpath,
|
|||
if (ret < 0)
|
||||
{
|
||||
snerr("ERROR: Failed to initialize the APDS9960!\n");
|
||||
kmm_free(priv);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,16 @@
|
|||
#include "inode/inode.h"
|
||||
#include "fs_fat32.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_FS_LARGEFILE)
|
||||
# define OFF_MAX INT64_MAX
|
||||
#else
|
||||
# define OFF_MAX INT32_MAX
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
@ -764,7 +774,7 @@ static ssize_t fat_write(FAR struct file *filep, FAR const char *buffer,
|
|||
|
||||
/* Check if the file size would exceed the range of off_t */
|
||||
|
||||
if (ff->ff_size + buflen < ff->ff_size)
|
||||
if (buflen > OFF_MAX || ff->ff_size > OFF_MAX - (off_t)buflen)
|
||||
{
|
||||
ret = -EFBIG;
|
||||
goto errout_with_lock;
|
||||
|
|
|
@ -307,7 +307,7 @@ struct alt_readdata_s
|
|||
|
||||
struct alt1250_lower_s
|
||||
{
|
||||
FAR struct spi_dev_s * (*poweron)(void);
|
||||
FAR struct spi_dev_s * (*poweron)(bool keep_on);
|
||||
void (*poweroff)(void);
|
||||
bool (*powerstatus)(void);
|
||||
int (*hiber_mode)(bool);
|
||||
|
|
|
@ -71,6 +71,8 @@ SYSCALL_LOOKUP(sethostname, 2)
|
|||
|
||||
/* Semaphores */
|
||||
|
||||
SYSCALL_LOOKUP(nxsem_wait, 1)
|
||||
|
||||
SYSCALL_LOOKUP(sem_destroy, 1)
|
||||
SYSCALL_LOOKUP(sem_post, 1)
|
||||
SYSCALL_LOOKUP(sem_clockwait, 3)
|
||||
|
|
|
@ -89,6 +89,13 @@ int aio_error(FAR const struct aiocb *aiocbp)
|
|||
{
|
||||
DEBUGASSERT(aiocbp);
|
||||
|
||||
/* the aio_reqprio field must be large or equal than 0 */
|
||||
|
||||
if (aiocbp->aio_reqprio < 0)
|
||||
{
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (aiocbp->aio_result < 0)
|
||||
{
|
||||
return -aiocbp->aio_result;
|
||||
|
|
|
@ -215,55 +215,25 @@ static int lio_sigsetup(FAR struct aiocb * const *list, int nent,
|
|||
FAR struct sigevent *sig)
|
||||
{
|
||||
FAR struct aiocb *aiocbp;
|
||||
FAR struct lio_sighand_s *sighand;
|
||||
struct lio_sighand_s sighand;
|
||||
sigset_t set;
|
||||
struct sigaction act;
|
||||
int status;
|
||||
int i;
|
||||
|
||||
/* Allocate a structure to pass data to the signal handler */
|
||||
|
||||
sighand = lib_zalloc(sizeof(struct lio_sighand_s));
|
||||
if (!sighand)
|
||||
{
|
||||
ferr("ERROR: lib_zalloc failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* Initialize the allocated structure */
|
||||
|
||||
sighand->list = list;
|
||||
sighand->sig = *sig;
|
||||
sighand->nent = nent;
|
||||
sighand->pid = _SCHED_GETPID();
|
||||
|
||||
/* Save this structure as the private data attached to each aiocb */
|
||||
|
||||
for (i = 0; i < nent; i++)
|
||||
{
|
||||
/* Skip over NULL entries in the list */
|
||||
|
||||
aiocbp = list[i];
|
||||
if (aiocbp)
|
||||
{
|
||||
FAR void *priv = NULL;
|
||||
|
||||
/* Check if I/O is pending for this entry */
|
||||
|
||||
if (aiocbp->aio_result == -EINPROGRESS)
|
||||
{
|
||||
priv = (FAR void *)sighand;
|
||||
}
|
||||
|
||||
aiocbp->aio_priv = priv;
|
||||
}
|
||||
}
|
||||
memset(&sighand, 0, sizeof(struct lio_sighand_s));
|
||||
sighand.list = list;
|
||||
sighand.sig = *sig;
|
||||
sighand.nent = nent;
|
||||
sighand.pid = _SCHED_GETPID();
|
||||
|
||||
/* Make sure that SIGPOLL is not blocked */
|
||||
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set, SIGPOLL);
|
||||
status = sigprocmask(SIG_UNBLOCK, &set, &sighand->oprocmask);
|
||||
status = sigprocmask(SIG_UNBLOCK, &set, &sighand.oprocmask);
|
||||
if (status != OK)
|
||||
{
|
||||
int errcode = get_errno();
|
||||
|
@ -282,7 +252,7 @@ static int lio_sigsetup(FAR struct aiocb * const *list, int nent,
|
|||
sigfillset(&act.sa_mask);
|
||||
sigdelset(&act.sa_mask, SIGPOLL);
|
||||
|
||||
status = sigaction(SIGPOLL, &act, &sighand->oact);
|
||||
status = sigaction(SIGPOLL, &act, &sighand.oact);
|
||||
if (status != OK)
|
||||
{
|
||||
int errcode = get_errno();
|
||||
|
@ -293,6 +263,36 @@ static int lio_sigsetup(FAR struct aiocb * const *list, int nent,
|
|||
return -errcode;
|
||||
}
|
||||
|
||||
/* Save this structure as the private data attached to each aiocb */
|
||||
|
||||
for (i = 0; i < nent; i++)
|
||||
{
|
||||
/* Skip over NULL entries in the list */
|
||||
|
||||
aiocbp = list[i];
|
||||
if (aiocbp)
|
||||
{
|
||||
FAR void *priv = NULL;
|
||||
|
||||
/* Check if I/O is pending for this entry */
|
||||
|
||||
if (aiocbp->aio_result == -EINPROGRESS)
|
||||
{
|
||||
priv = lib_zalloc(sizeof(struct lio_sighand_s));
|
||||
if (!priv)
|
||||
{
|
||||
ferr("ERROR: lib_zalloc failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memcpy(priv, (FAR void *)&sighand,
|
||||
sizeof(struct lio_sighand_s));
|
||||
}
|
||||
|
||||
aiocbp->aio_priv = priv;
|
||||
}
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -517,7 +517,12 @@ int lio_listio(int mode, FAR struct aiocb * const list[], int nent,
|
|||
int ret;
|
||||
int i;
|
||||
|
||||
DEBUGASSERT(mode == LIO_WAIT || mode == LIO_NOWAIT);
|
||||
if (mode != LIO_WAIT && mode != LIO_NOWAIT)
|
||||
{
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
DEBUGASSERT(list);
|
||||
|
||||
nqueued = 0; /* No I/O operations yet queued */
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <nuttx/sched.h>
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/mutex.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
|
@ -200,15 +201,13 @@ int nxmutex_lock(FAR mutex_t *mutex)
|
|||
{
|
||||
/* Take the semaphore (perhaps waiting) */
|
||||
|
||||
ret = _SEM_WAIT(&mutex->sem);
|
||||
ret = nxsem_wait(&mutex->sem);
|
||||
if (ret >= 0)
|
||||
{
|
||||
mutex->holder = _SCHED_GETTID();
|
||||
break;
|
||||
}
|
||||
|
||||
ret = _SEM_ERRVAL(ret);
|
||||
if (ret != -EINTR && ret != -ECANCELED)
|
||||
else if (ret != -EINTR && ret != -ECANCELED)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
# Add the pwd C files to the build
|
||||
|
||||
CSRCS += lib_getpwnam.c lib_getpwnamr.c lib_getpwuid.c lib_getpwuidr.c
|
||||
CSRCS += lib_pwd_globals.c
|
||||
|
||||
ifeq ($(CONFIG_LIBC_PASSWD_FILE),y)
|
||||
CSRCS += lib_find_pwdfile.c lib_pwd_globals.c
|
||||
|
|
|
@ -133,13 +133,14 @@ static int pwd_foreach(pwd_foreach_match_t match, uintptr_t arg,
|
|||
*
|
||||
* The format of the password file is:
|
||||
*
|
||||
* user:x:uid:uid:home
|
||||
* user:x:uid:uid:geos:home
|
||||
*
|
||||
* Where:
|
||||
* user: User name
|
||||
* x: Encrypted password
|
||||
* uid: User ID
|
||||
* uid: Group ID
|
||||
* geos: User information
|
||||
* home: Login directory
|
||||
*/
|
||||
|
||||
|
|
|
@ -24,20 +24,9 @@
|
|||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#include "pwd/lib_pwd.h"
|
||||
#include "libc.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static FAR char *g_buf;
|
||||
static FAR struct passwd *g_pwd;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
|
@ -68,51 +57,8 @@ FAR struct passwd *getpwbuf(uid_t uid, gid_t gid, FAR const char *name,
|
|||
FAR const char *gecos, FAR const char *dir,
|
||||
FAR const char *shell)
|
||||
{
|
||||
FAR struct passwd *result;
|
||||
FAR char *newbuf;
|
||||
size_t buflen;
|
||||
int err;
|
||||
|
||||
buflen = strlen(name) + 1 + strlen(gecos) + 1 + strlen(dir) + 1 +
|
||||
strlen(shell) + 1;
|
||||
|
||||
newbuf = (FAR char *)lib_realloc(g_buf, buflen);
|
||||
|
||||
if (!newbuf)
|
||||
{
|
||||
err = ENOMEM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
g_buf = newbuf;
|
||||
|
||||
if (!g_pwd)
|
||||
{
|
||||
g_pwd = (FAR struct passwd *)lib_malloc(sizeof(struct passwd));
|
||||
}
|
||||
|
||||
if (!g_pwd)
|
||||
{
|
||||
err = ENOMEM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
err = getpwbuf_r(uid, gid, name, gecos, dir, shell,
|
||||
g_pwd, g_buf, buflen, &result);
|
||||
|
||||
if (err)
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
error:
|
||||
lib_free(g_pwd);
|
||||
lib_free(g_buf);
|
||||
g_pwd = NULL;
|
||||
g_buf = NULL;
|
||||
set_errno(err);
|
||||
|
||||
return NULL;
|
||||
FAR struct passwd *pwd = NULL;
|
||||
int ret = getpwbuf_r(uid, gid, name, gecos, dir, shell, &g_passwd,
|
||||
g_passwd_buffer, sizeof(g_passwd_buffer), &pwd);
|
||||
return ret == 0 ? pwd : NULL;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ FAR struct passwd *getpwnam(FAR const char *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return getpwbuf(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_NAME, ROOT_DIR,
|
||||
return getpwbuf(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_GEOCS, ROOT_DIR,
|
||||
ROOT_SHELL);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ int getpwnam_r(FAR const char *name, FAR struct passwd *pwd, FAR char *buf,
|
|||
return 0;
|
||||
}
|
||||
|
||||
return getpwbuf_r(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_NAME, ROOT_DIR,
|
||||
return getpwbuf_r(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_GEOCS, ROOT_DIR,
|
||||
ROOT_SHELL, pwd, buf, buflen, result);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ FAR struct passwd *getpwuid(uid_t uid)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return getpwbuf(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_NAME, ROOT_DIR,
|
||||
return getpwbuf(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_GEOCS, ROOT_DIR,
|
||||
ROOT_SHELL);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ int getpwuid_r(uid_t uid, FAR struct passwd *pwd, FAR char *buf,
|
|||
return 0;
|
||||
}
|
||||
|
||||
return getpwbuf_r(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_NAME, ROOT_DIR,
|
||||
return getpwbuf_r(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_GEOCS, ROOT_DIR,
|
||||
ROOT_SHELL, pwd, buf, buflen, result);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -33,9 +33,14 @@
|
|||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_LIBC_PASSWD_LINESIZE
|
||||
# define CONFIG_LIBC_PASSWD_LINESIZE 80
|
||||
#endif
|
||||
|
||||
#define ROOT_NAME "root"
|
||||
#define ROOT_UID 0
|
||||
#define ROOT_GID 0
|
||||
#define ROOT_GEOCS "root"
|
||||
#define ROOT_DIR "/root"
|
||||
#define ROOT_SHELL "/bin/nsh"
|
||||
|
||||
|
@ -51,12 +56,10 @@ extern "C"
|
|||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LIBC_PASSWD_FILE
|
||||
/* Data for non-reentrant group functions */
|
||||
|
||||
EXTERN struct passwd g_passwd;
|
||||
EXTERN char g_passwd_buffer[CONFIG_LIBC_PASSWD_LINESIZE];
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
|
||||
#include "pwd/lib_pwd.h"
|
||||
|
||||
#ifdef CONFIG_LIBC_PASSWD_FILE
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
@ -40,5 +38,3 @@ char g_passwd_buffer[CONFIG_LIBC_PASSWD_LINESIZE];
|
|||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* CONFIG_LIBC_GROUP_FILE */
|
||||
|
|
|
@ -94,6 +94,7 @@ int pthread_cond_wait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex)
|
|||
sinfo("Give up mutex / take cond\n");
|
||||
|
||||
flags = enter_critical_section();
|
||||
sched_lock();
|
||||
mutex->pid = INVALID_PROCESS_ID;
|
||||
#ifndef CONFIG_PTHREAD_MUTEX_UNSAFE
|
||||
mflags = mutex->flags;
|
||||
|
@ -116,6 +117,7 @@ int pthread_cond_wait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex)
|
|||
ret = status;
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
|
||||
/* Reacquire the mutex.
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
"nx_pthread_exit","nuttx/pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","noreturn","pthread_addr_t"
|
||||
"nx_vsyslog","nuttx/syslog/syslog.h","","int","int","FAR const IPTR char *","FAR va_list *"
|
||||
"nxsched_get_stackinfo","nuttx/sched.h","","int","pid_t","FAR struct stackinfo_s *"
|
||||
"nxsem_wait","nuttx/semaphore.h","","int","FAR sem_t *"
|
||||
"open","fcntl.h","","int","FAR const char *","int","...","mode_t"
|
||||
"pgalloc", "nuttx/arch.h", "defined(CONFIG_BUILD_KERNEL)", "uintptr_t", "uintptr_t", "unsigned int"
|
||||
"pipe2","unistd.h","defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0","int","int [2]|FAR int *","int"
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
@ -250,7 +250,7 @@ tools/mkconfig$(HOSTEXEEXT):
|
|||
include/nuttx/config.h: $(TOPDIR)/.config tools/mkconfig$(HOSTEXEEXT)
|
||||
$(Q) grep -v "CONFIG_BASE_DEFCONFIG" "$(TOPDIR)/.config" > "$(TOPDIR)/.config.tmp"
|
||||
$(Q) if ! cmp -s "$(TOPDIR)/.config.tmp" "$(TOPDIR)/.config.orig" ; then \
|
||||
sed -i.bak "/CONFIG_BASE_DEFCONFIG/ { /-dirty/! s/\"$$/-dirty\"/ }" "$(TOPDIR)/.config"; \
|
||||
sed -i.bak "/CONFIG_BASE_DEFCONFIG/s/\"$$/-dirty\"/" "$(TOPDIR)/.config"; \
|
||||
else \
|
||||
sed -i.bak "s/-dirty//g" "$(TOPDIR)/.config"; \
|
||||
fi
|
||||
|
|
|
@ -238,7 +238,7 @@ include\nuttx\config.h: $(TOPDIR)\.config tools\mkconfig$(HOSTEXEEXT)
|
|||
$(Q) grep -v "CONFIG_BASE_DEFCONFIG" "$(TOPDIR)\.config" > "$(TOPDIR)\.config.tmp"
|
||||
# In-place edit can mess up permissions on Windows
|
||||
$(Q) if ! cmp -s "$(TOPDIR)\.config.tmp" "$(TOPDIR)\.config.orig" ; then \
|
||||
sed "/CONFIG_BASE_DEFCONFIG/ { /-dirty/! s/\"$$/-dirty\"/ }" "$(TOPDIR)\.config" > "$(TOPDIR)\.config-temp"; \
|
||||
sed "/CONFIG_BASE_DEFCONFIG/s/\"$$/-dirty\"/" "$(TOPDIR)\.config" > "$(TOPDIR)\.config-temp"; \
|
||||
else \
|
||||
sed "s/-dirty//g" "$(TOPDIR)\.config" > "$(TOPDIR)\.config-temp"; \
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue