arch/xtensa: Remove FAR qualifier for Xtensa-specific files
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
This commit is contained in:
parent
58f87ef443
commit
e13dd7dab9
@ -143,7 +143,7 @@ void *xtensa_imm_zalloc(size_t size);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void xtensa_imm_free(FAR void *mem);
|
||||
void xtensa_imm_free(void *mem);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: xtensa_imm_memalign
|
||||
@ -174,7 +174,7 @@ void *xtensa_imm_memalign(size_t alignment, size_t size);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
bool xtensa_imm_heapmember(FAR void *mem);
|
||||
bool xtensa_imm_heapmember(void *mem);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: xtensa_imm_mallinfo
|
||||
@ -185,7 +185,7 @@ bool xtensa_imm_heapmember(FAR void *mem);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int xtensa_imm_mallinfo(FAR struct mallinfo *info);
|
||||
int xtensa_imm_mallinfo(struct mallinfo *info);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
|
@ -63,7 +63,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_TLS_ALIGNED
|
||||
static inline FAR struct tls_info_s *up_tls_info(void)
|
||||
static inline struct tls_info_s *up_tls_info(void)
|
||||
{
|
||||
DEBUGASSERT(!up_interrupt_context());
|
||||
return TLS_INFO((uintptr_t)up_getsp());
|
||||
|
@ -344,7 +344,7 @@ void xtensa_pminitialize(void);
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_STACK_COLORATION
|
||||
void up_stack_color(FAR void *stackbase, size_t nbytes);
|
||||
void up_stack_color(void *stackbase, size_t nbytes);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
@ -63,7 +63,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_USBDUMP
|
||||
static int usbtrace_syslog(FAR const char *fmt, ...)
|
||||
static int usbtrace_syslog(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -75,7 +75,7 @@ static int usbtrace_syslog(FAR const char *fmt, ...)
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
|
||||
static int assert_tracecallback(struct usbtrace_s *trace, void *arg)
|
||||
{
|
||||
usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value);
|
||||
return 0;
|
||||
|
@ -105,9 +105,9 @@ static void get_window_regs(struct xtensa_windowregs_s *frame)
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __XTENSA_CALL0_ABI__
|
||||
static int backtrace_window(FAR uintptr_t *base, FAR uintptr_t *limit,
|
||||
static int backtrace_window(uintptr_t *base, uintptr_t *limit,
|
||||
struct xtensa_windowregs_s *frame,
|
||||
FAR void **buffer, int size)
|
||||
void **buffer, int size)
|
||||
{
|
||||
uint32_t windowstart;
|
||||
uint32_t ra;
|
||||
@ -152,9 +152,9 @@ static int backtrace_window(FAR uintptr_t *base, FAR uintptr_t *limit,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int backtrace_stack(FAR uintptr_t *base, FAR uintptr_t *limit,
|
||||
FAR uintptr_t *sp, FAR uintptr_t *ra,
|
||||
FAR void **buffer, int size)
|
||||
static int backtrace_stack(uintptr_t *base, uintptr_t *limit,
|
||||
uintptr_t *sp, uintptr_t *ra,
|
||||
void **buffer, int size)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
@ -163,14 +163,14 @@ static int backtrace_stack(FAR uintptr_t *base, FAR uintptr_t *limit,
|
||||
buffer[i++] = MAKE_PC_FROM_RA((uintptr_t)ra);
|
||||
}
|
||||
|
||||
for (; i < size; sp = (FAR uintptr_t *)*(sp - 3), i++)
|
||||
for (; i < size; sp = (uintptr_t *)*(sp - 3), i++)
|
||||
{
|
||||
if (sp > limit || sp < base)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
ra = (FAR uintptr_t *)*(sp - 4);
|
||||
ra = (uintptr_t *)*(sp - 4);
|
||||
if (ra == NULL)
|
||||
{
|
||||
break;
|
||||
@ -210,9 +210,9 @@ static int backtrace_stack(FAR uintptr_t *base, FAR uintptr_t *limit,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_backtrace(FAR struct tcb_s *tcb, FAR void **buffer, int size)
|
||||
int up_backtrace(struct tcb_s *tcb, void **buffer, int size)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = running_task();
|
||||
struct tcb_s *rtcb = running_task();
|
||||
irqstate_t flags;
|
||||
int ret;
|
||||
|
||||
@ -234,20 +234,20 @@ int up_backtrace(FAR struct tcb_s *tcb, FAR void **buffer, int size)
|
||||
#endif
|
||||
xtensa_window_spill();
|
||||
|
||||
ret = bactrace_stack((FAR void *)istackbase,
|
||||
(FAR void *)((uint32_t)&g_intstackalloc +
|
||||
ret = bactrace_stack((void *)istackbase,
|
||||
(void *)((uint32_t)&g_intstackalloc +
|
||||
CONFIG_ARCH_INTERRUPTSTACK),
|
||||
(FAR void *)up_getsp(), NULL, buffer, size);
|
||||
(void *)up_getsp(), NULL, buffer, size);
|
||||
#else
|
||||
ret = backtrace_stack(rtcb->stack_base_ptr,
|
||||
rtcb->stack_base_ptr + rtcb->adj_stack_size,
|
||||
(FAR void *)up_getsp(), NULL, buffer, size);
|
||||
(void *)up_getsp(), NULL, buffer, size);
|
||||
#endif
|
||||
ret += backtrace_stack(rtcb->stack_base_ptr,
|
||||
rtcb->stack_base_ptr +
|
||||
rtcb->adj_stack_size,
|
||||
(FAR void *)CURRENT_REGS[REG_A1],
|
||||
(FAR void *)CURRENT_REGS[REG_A0],
|
||||
(void *)CURRENT_REGS[REG_A1],
|
||||
(void *)CURRENT_REGS[REG_A0],
|
||||
&buffer[ret], size - ret);
|
||||
}
|
||||
else
|
||||
@ -273,7 +273,7 @@ int up_backtrace(FAR struct tcb_s *tcb, FAR void **buffer, int size)
|
||||
#endif
|
||||
ret += backtrace_stack(rtcb->stack_base_ptr,
|
||||
rtcb->stack_base_ptr + rtcb->adj_stack_size,
|
||||
(FAR void *)up_getsp(), NULL, buffer, size - ret);
|
||||
(void *)up_getsp(), NULL, buffer, size - ret);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -284,8 +284,8 @@ int up_backtrace(FAR struct tcb_s *tcb, FAR void **buffer, int size)
|
||||
|
||||
ret = backtrace_stack(tcb->stack_base_ptr,
|
||||
tcb->stack_base_ptr + tcb->adj_stack_size,
|
||||
(FAR void *)tcb->xcp.regs[REG_A1],
|
||||
(FAR void *)tcb->xcp.regs[REG_A0],
|
||||
(void *)tcb->xcp.regs[REG_A1],
|
||||
(void *)tcb->xcp.regs[REG_A0],
|
||||
buffer, size);
|
||||
|
||||
leave_critical_section(flags);
|
||||
|
@ -72,9 +72,9 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size);
|
||||
|
||||
static size_t do_stackcheck(uintptr_t alloc, size_t size)
|
||||
{
|
||||
FAR uintptr_t start;
|
||||
FAR uintptr_t end;
|
||||
FAR uint32_t *ptr;
|
||||
uintptr_t start;
|
||||
uintptr_t end;
|
||||
uint32_t *ptr;
|
||||
size_t mark;
|
||||
|
||||
if (size == 0)
|
||||
@ -99,7 +99,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
|
||||
* we encounter that does not have the magic value is the high water mark.
|
||||
*/
|
||||
|
||||
for (ptr = (FAR uint32_t *)start, mark = (size >> 2);
|
||||
for (ptr = (uint32_t *)start, mark = (size >> 2);
|
||||
*ptr == STACK_COLOR && mark > 0;
|
||||
ptr++, mark--);
|
||||
|
||||
@ -119,7 +119,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
|
||||
int i;
|
||||
int j;
|
||||
|
||||
ptr = (FAR uint32_t *)start;
|
||||
ptr = (uint32_t *)start;
|
||||
for (i = 0; i < size; i += 4 * 64)
|
||||
{
|
||||
for (j = 0; j < 64; j++)
|
||||
@ -167,12 +167,12 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
size_t up_check_tcbstack(FAR struct tcb_s *tcb)
|
||||
size_t up_check_tcbstack(struct tcb_s *tcb)
|
||||
{
|
||||
return do_stackcheck((uintptr_t)tcb->stack_base_ptr, tcb->adj_stack_size);
|
||||
}
|
||||
|
||||
ssize_t up_check_tcbstack_remain(FAR struct tcb_s *tcb)
|
||||
ssize_t up_check_tcbstack_remain(struct tcb_s *tcb)
|
||||
{
|
||||
return tcb->adj_stack_size - up_check_tcbstack(tcb);
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ bool up_cpu_pausereq(int cpu)
|
||||
|
||||
int up_cpu_paused(int cpu)
|
||||
{
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
struct tcb_s *tcb = this_task();
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
|
@ -97,7 +97,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
int up_create_stack(struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
{
|
||||
#if XCHAL_CP_NUM > 0
|
||||
struct xcptcontext *xcp;
|
||||
@ -271,12 +271,12 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_STACK_COLORATION
|
||||
void up_stack_color(FAR void *stackbase, size_t nbytes)
|
||||
void up_stack_color(void *stackbase, size_t nbytes)
|
||||
{
|
||||
uintptr_t start;
|
||||
uintptr_t end;
|
||||
size_t nwords;
|
||||
FAR uint32_t *ptr;
|
||||
uint32_t *ptr;
|
||||
|
||||
/* Take extra care that we do not write outside the stack boundaries */
|
||||
|
||||
@ -287,7 +287,7 @@ void up_stack_color(FAR void *stackbase, size_t nbytes)
|
||||
/* Get the adjusted size based on the top and bottom of the stack */
|
||||
|
||||
nwords = (end - start) >> 2;
|
||||
ptr = (FAR uint32_t *)start;
|
||||
ptr = (uint32_t *)start;
|
||||
|
||||
/* Set the entire stack to the coloration value */
|
||||
|
||||
|
@ -56,7 +56,7 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_STACK_COLORATION
|
||||
static void up_taskdump(FAR struct tcb_s *tcb, FAR void *arg)
|
||||
static void up_taskdump(struct tcb_s *tcb, void *arg)
|
||||
{
|
||||
/* Dump interesting properties of this task */
|
||||
|
||||
|
@ -63,11 +63,11 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
static void _xtensa_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
|
||||
static void _xtensa_dumponexit(struct tcb_s *tcb, void *arg)
|
||||
{
|
||||
FAR struct filelist *filelist;
|
||||
struct filelist *filelist;
|
||||
#ifdef CONFIG_FILE_STREAM
|
||||
FAR struct file_struct *filep;
|
||||
struct file_struct *filep;
|
||||
#endif
|
||||
int i;
|
||||
int j;
|
||||
|
@ -68,7 +68,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
|
||||
void up_release_stack(struct tcb_s *dtcb, uint8_t ttype)
|
||||
{
|
||||
/* Is there a stack allocated? */
|
||||
|
||||
|
@ -82,9 +82,9 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size)
|
||||
void *up_stack_frame(struct tcb_s *tcb, size_t frame_size)
|
||||
{
|
||||
FAR void *ret;
|
||||
void *ret;
|
||||
|
||||
/* Align the frame_size */
|
||||
|
||||
@ -102,7 +102,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size)
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
tcb->stack_base_ptr = (FAR uint8_t *)tcb->stack_base_ptr + frame_size;
|
||||
tcb->stack_base_ptr = (uint8_t *)tcb->stack_base_ptr + frame_size;
|
||||
tcb->adj_stack_size -= frame_size;
|
||||
|
||||
/* And return the pointer to the allocated region */
|
||||
|
@ -49,7 +49,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline uint32_t xtensa_compareset(FAR volatile uint32_t *addr,
|
||||
static inline uint32_t xtensa_compareset(volatile uint32_t *addr,
|
||||
uint32_t compare,
|
||||
uint32_t set)
|
||||
{
|
||||
@ -88,13 +88,13 @@ static inline uint32_t xtensa_compareset(FAR volatile uint32_t *addr,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
spinlock_t up_testset(volatile FAR spinlock_t *lock)
|
||||
spinlock_t up_testset(volatile spinlock_t *lock)
|
||||
{
|
||||
spinlock_t prev;
|
||||
|
||||
/* Perform the 32-bit compare and set operation */
|
||||
|
||||
prev = xtensa_compareset((FAR volatile uint32_t *)lock,
|
||||
prev = xtensa_compareset((volatile uint32_t *)lock,
|
||||
SP_UNLOCKED, SP_LOCKED);
|
||||
|
||||
/* xtensa_compareset() should return either SP_UNLOCKED if the spinlock
|
||||
|
@ -580,8 +580,8 @@ int esp32_aes_init(void)
|
||||
|
||||
#ifdef CONFIG_CRYPTO_AES
|
||||
|
||||
int aes_cypher(FAR void *out, FAR const void *in, uint32_t size,
|
||||
FAR const void *iv, FAR const void *key, uint32_t keysize,
|
||||
int aes_cypher(void *out, const void *in, uint32_t size,
|
||||
const void *iv, const void *key, uint32_t keysize,
|
||||
int mode, int encrypt)
|
||||
{
|
||||
int ret;
|
||||
|
@ -64,11 +64,11 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
|
||||
void up_allocate_heap(void **heap_start, size_t *heap_size)
|
||||
{
|
||||
board_autoled_on(LED_HEAPALLOCATE);
|
||||
|
||||
*heap_start = (FAR void *)&_sheap;
|
||||
*heap_start = (void *)&_sheap;
|
||||
DEBUGASSERT(HEAP_REGION1_END > (uintptr_t)*heap_start);
|
||||
*heap_size = (size_t)(HEAP_REGION1_END - (uintptr_t)*heap_start);
|
||||
}
|
||||
@ -113,28 +113,28 @@ void xtensa_add_region(void)
|
||||
}
|
||||
|
||||
#ifndef CONFIG_SMP
|
||||
start = (FAR void *)(HEAP_REGION2_START + XTENSA_IMEM_REGION_SIZE);
|
||||
start = (void *)(HEAP_REGION2_START + XTENSA_IMEM_REGION_SIZE);
|
||||
size = (size_t)(uintptr_t)&_eheap - (size_t)start;
|
||||
umm_addregion(start, size);
|
||||
|
||||
#else
|
||||
#ifdef CONFIG_ESP32_QEMU_IMAGE
|
||||
start = (FAR void *)HEAP_REGION2_START;
|
||||
start = (void *)HEAP_REGION2_START;
|
||||
size = (size_t)(uintptr_t)&_eheap - (size_t)start;
|
||||
umm_addregion(start, size);
|
||||
#else
|
||||
start = (FAR void *)HEAP_REGION2_START;
|
||||
start = (void *)HEAP_REGION2_START;
|
||||
size = (size_t)(HEAP_REGION2_END - HEAP_REGION2_START);
|
||||
umm_addregion(start, size);
|
||||
|
||||
start = (FAR void *)HEAP_REGION3_START + XTENSA_IMEM_REGION_SIZE;
|
||||
start = (void *)HEAP_REGION3_START + XTENSA_IMEM_REGION_SIZE;
|
||||
size = (size_t)(uintptr_t)&_eheap - (size_t)start;
|
||||
umm_addregion(start, size);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ESP32_QEMU_IMAGE
|
||||
start = (FAR void *)HEAP_REGION0_START;
|
||||
start = (void *)HEAP_REGION0_START;
|
||||
size = (size_t)(HEAP_REGION0_END - HEAP_REGION0_START);
|
||||
umm_addregion(start, size);
|
||||
#endif
|
||||
@ -142,10 +142,10 @@ void xtensa_add_region(void)
|
||||
#ifdef CONFIG_ESP32_SPIRAM
|
||||
# if defined(CONFIG_HEAP2_BASE) && defined(CONFIG_HEAP2_SIZE)
|
||||
# ifdef CONFIG_XTENSA_EXTMEM_BSS
|
||||
start = (FAR void *)(&_ebss_extmem);
|
||||
start = (void *)(&_ebss_extmem);
|
||||
size = CONFIG_HEAP2_SIZE - (size_t)(&_ebss_extmem - &_sbss_extmem);
|
||||
# else
|
||||
start = (FAR void *)CONFIG_HEAP2_BASE;
|
||||
start = (void *)CONFIG_HEAP2_BASE;
|
||||
size = CONFIG_HEAP2_SIZE;
|
||||
# endif
|
||||
# ifdef CONFIG_ESP32_SPIRAM_BANKSWITCH_ENABLE
|
||||
|
@ -86,7 +86,7 @@ uint32_t g_cpu1_idlestack[CPU1_IDLETHREAD_STACKWORDS]
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_cpu_idlestack(int cpu, FAR struct tcb_s *tcb, size_t stack_size)
|
||||
int up_cpu_idlestack(int cpu, struct tcb_s *tcb, size_t stack_size)
|
||||
{
|
||||
/* XTENSA uses a push-down stack: the stack grows toward lower* addresses
|
||||
* in memory. The stack pointer register points to the lowest, valid
|
||||
|
@ -72,7 +72,7 @@ extern void ets_set_appcpu_boot_addr(uint32_t start);
|
||||
****************************************************************************/
|
||||
|
||||
#if 0 /* Was useful in solving some startup problems */
|
||||
static inline void xtensa_registerdump(FAR struct tcb_s *tcb)
|
||||
static inline void xtensa_registerdump(struct tcb_s *tcb)
|
||||
{
|
||||
_info("CPU%d:\n", up_cpu_index());
|
||||
|
||||
@ -130,7 +130,7 @@ static inline void xtensa_attach_fromcpu0_interrupt(void)
|
||||
|
||||
void xtensa_appcpu_start(void)
|
||||
{
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
struct tcb_s *tcb = this_task();
|
||||
register uint32_t sp;
|
||||
|
||||
#ifdef CONFIG_STACK_COLORATION
|
||||
|
@ -60,4 +60,4 @@ int esp_efuse_write_field(const efuse_desc_t *field[],
|
||||
|
||||
void esp_efuse_burn_efuses(void);
|
||||
|
||||
int esp32_efuse_initialize(FAR const char *devpath);
|
||||
int esp32_efuse_initialize(const char *devpath);
|
||||
|
@ -37,8 +37,8 @@
|
||||
|
||||
struct esp32_efuse_lowerhalf_s
|
||||
{
|
||||
FAR const struct efuse_ops_s *ops; /* Lower half operations */
|
||||
void *upper; /* Pointer to efuse_upperhalf_s */
|
||||
const struct efuse_ops_s *ops; /* Lower half operations */
|
||||
void *upper; /* Pointer to efuse_upperhalf_s */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@ -47,14 +47,14 @@ struct esp32_efuse_lowerhalf_s
|
||||
|
||||
/* "Lower half" driver methods **********************************************/
|
||||
|
||||
static int esp32_efuse_read_field(FAR struct efuse_lowerhalf_s *lower,
|
||||
static int esp32_efuse_read_field(struct efuse_lowerhalf_s *lower,
|
||||
const efuse_desc_t *field[],
|
||||
FAR uint8_t *data, size_t size);
|
||||
static int esp32_efuse_write_field(FAR struct efuse_lowerhalf_s *lower,
|
||||
uint8_t *data, size_t size);
|
||||
static int esp32_efuse_write_field(struct efuse_lowerhalf_s *lower,
|
||||
const efuse_desc_t *field[],
|
||||
FAR const uint8_t *data,
|
||||
const uint8_t *data,
|
||||
size_t size);
|
||||
static int efuse_ioctl(FAR struct efuse_lowerhalf_s *lower, int cmd,
|
||||
static int efuse_ioctl(struct efuse_lowerhalf_s *lower, int cmd,
|
||||
unsigned long arg);
|
||||
|
||||
/****************************************************************************
|
||||
@ -82,7 +82,7 @@ static struct esp32_efuse_lowerhalf_s g_esp32_efuse_lowerhalf =
|
||||
* Private functions
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_efuse_read_field(FAR struct efuse_lowerhalf_s *lower,
|
||||
static int esp32_efuse_read_field(struct efuse_lowerhalf_s *lower,
|
||||
const efuse_desc_t *field[],
|
||||
uint8_t *data, size_t bits_len)
|
||||
{
|
||||
@ -95,7 +95,7 @@ static int esp32_efuse_read_field(FAR struct efuse_lowerhalf_s *lower,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int esp32_efuse_write_field(FAR struct efuse_lowerhalf_s *lower,
|
||||
static int esp32_efuse_write_field(struct efuse_lowerhalf_s *lower,
|
||||
const efuse_desc_t *field[],
|
||||
const uint8_t *data, size_t bits_len)
|
||||
{
|
||||
@ -121,7 +121,7 @@ static int esp32_efuse_write_field(FAR struct efuse_lowerhalf_s *lower,
|
||||
* Name: efuse_ioctl
|
||||
****************************************************************************/
|
||||
|
||||
static int efuse_ioctl(FAR struct efuse_lowerhalf_s *lower,
|
||||
static int efuse_ioctl(struct efuse_lowerhalf_s *lower,
|
||||
int cmd, unsigned long arg)
|
||||
{
|
||||
int ret = OK;
|
||||
@ -162,7 +162,7 @@ static int efuse_ioctl(FAR struct efuse_lowerhalf_s *lower,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_efuse_initialize(FAR const char *devpath)
|
||||
int esp32_efuse_initialize(const char *devpath)
|
||||
{
|
||||
struct esp32_efuse_lowerhalf_s *lower = NULL;
|
||||
int ret = OK;
|
||||
@ -174,7 +174,7 @@ int esp32_efuse_initialize(FAR const char *devpath)
|
||||
/* Register the efuser upper driver */
|
||||
|
||||
lower->upper = efuse_register(devpath,
|
||||
(FAR struct efuse_lowerhalf_s *)lower);
|
||||
(struct efuse_lowerhalf_s *)lower);
|
||||
|
||||
if (lower->upper == NULL)
|
||||
{
|
||||
|
@ -373,7 +373,7 @@ static void emac_init_buffer(struct esp32_emac_s *priv)
|
||||
|
||||
for (i = 0; i < EMAC_BUF_NUM; i++)
|
||||
{
|
||||
sq_addlast((FAR sq_entry_t *)buffer, &priv->freeb);
|
||||
sq_addlast((sq_entry_t *)buffer, &priv->freeb);
|
||||
buffer += EMAC_BUF_LEN;
|
||||
}
|
||||
}
|
||||
@ -435,7 +435,7 @@ static inline void emac_free_buffer(struct esp32_emac_s *priv,
|
||||
{
|
||||
/* Free the buffer by adding it to the end of the free buffer list */
|
||||
|
||||
sq_addlast((FAR sq_entry_t *)buffer, &priv->freeb);
|
||||
sq_addlast((sq_entry_t *)buffer, &priv->freeb);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -1271,7 +1271,7 @@ static int phy_enable_interrupt(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void emac_txtimeout_work(FAR void *arg)
|
||||
static void emac_txtimeout_work(void *arg)
|
||||
{
|
||||
struct esp32_emac_s *priv = (struct esp32_emac_s *)arg;
|
||||
|
||||
@ -1341,7 +1341,7 @@ static void emac_txtimeout_expiry(wdparm_t arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void emac_rx_interrupt_work(FAR void *arg)
|
||||
static void emac_rx_interrupt_work(void *arg)
|
||||
{
|
||||
struct esp32_emac_s *priv = (struct esp32_emac_s *)arg;
|
||||
struct net_driver_s *dev = &priv->dev;
|
||||
@ -1496,7 +1496,7 @@ static void emac_rx_interrupt_work(FAR void *arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void emac_tx_interrupt_work(FAR void *arg)
|
||||
static void emac_tx_interrupt_work(void *arg)
|
||||
{
|
||||
struct esp32_emac_s *priv = (struct esp32_emac_s *)arg;
|
||||
|
||||
@ -1526,7 +1526,7 @@ static void emac_tx_interrupt_work(FAR void *arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int emac_interrupt(int irq, FAR void *context, FAR void *arg)
|
||||
static int emac_interrupt(int irq, void *context, void *arg)
|
||||
{
|
||||
struct esp32_emac_s *priv = (struct esp32_emac_s *)arg;
|
||||
uint32_t value = emac_get_reg(EMAC_DMA_SR_OFFSET);
|
||||
@ -1677,7 +1677,7 @@ static int emac_txpoll(struct net_driver_s *dev)
|
||||
|
||||
static void emac_dopoll(struct esp32_emac_s *priv)
|
||||
{
|
||||
FAR struct net_driver_s *dev = &priv->dev;
|
||||
struct net_driver_s *dev = &priv->dev;
|
||||
|
||||
if (!TX_IS_BUSY(priv))
|
||||
{
|
||||
@ -1722,7 +1722,7 @@ static void emac_dopoll(struct esp32_emac_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void emac_txavail_work(FAR void *arg)
|
||||
static void emac_txavail_work(void *arg)
|
||||
{
|
||||
struct esp32_emac_s *priv = (struct esp32_emac_s *)arg;
|
||||
|
||||
@ -1758,11 +1758,11 @@ static void emac_txavail_work(FAR void *arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void emac_poll_work(FAR void *arg)
|
||||
static void emac_poll_work(void *arg)
|
||||
{
|
||||
int ret;
|
||||
struct esp32_emac_s *priv = (struct esp32_emac_s *)arg;
|
||||
FAR struct net_driver_s *dev = &priv->dev;
|
||||
struct net_driver_s *dev = &priv->dev;
|
||||
|
||||
ninfo("ifup: %d\n", priv->ifup);
|
||||
|
||||
@ -1826,7 +1826,7 @@ static void emac_poll_work(FAR void *arg)
|
||||
|
||||
static void emac_poll_expiry(wdparm_t arg)
|
||||
{
|
||||
FAR struct esp32_emac_s *priv = (FAR struct esp32_emac_s *)arg;
|
||||
struct esp32_emac_s *priv = (struct esp32_emac_s *)arg;
|
||||
|
||||
/* Schedule to perform the interrupt processing on the worker thread. */
|
||||
|
||||
@ -2026,7 +2026,7 @@ static int emac_txavail(struct net_driver_s *dev)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NET_MCASTGROUP) || defined(CONFIG_NET_ICMPv6)
|
||||
static int emac_addmac(struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
static int emac_addmac(struct net_driver_s *dev, const uint8_t *mac)
|
||||
{
|
||||
ninfo("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
@ -2055,7 +2055,7 @@ static int emac_addmac(struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_MCASTGROUP
|
||||
static int emac_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
static int emac_rmmac(struct net_driver_s *dev, const uint8_t *mac)
|
||||
{
|
||||
ninfo("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
@ -2096,7 +2096,7 @@ static int emac_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
static int emac_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg)
|
||||
{
|
||||
#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
|
||||
FAR struct esp32_emacmac_s *priv = NET2PRIV(dev);
|
||||
struct esp32_emacmac_s *priv = NET2PRIV(dev);
|
||||
#endif
|
||||
int ret;
|
||||
|
||||
|
@ -46,11 +46,11 @@
|
||||
|
||||
struct esp32_freerun_s
|
||||
{
|
||||
uint8_t chan; /* The timer/counter in use */
|
||||
uint32_t overflow; /* Timer counter overflow */
|
||||
uint16_t resolution; /* Timer resolution */
|
||||
uint64_t max_timeout; /* Maximum timeout to overflow */
|
||||
FAR struct esp32_tim_dev_s *tch; /* Handle returned by esp32_tim_init() */
|
||||
uint8_t chan; /* The timer/counter in use */
|
||||
uint32_t overflow; /* Timer counter overflow */
|
||||
uint16_t resolution; /* Timer resolution */
|
||||
uint64_t max_timeout; /* Maximum timeout to overflow */
|
||||
struct esp32_tim_dev_s *tch; /* Handle returned by esp32_tim_init() */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -135,7 +135,7 @@ static void gpio_dispatch(int irq, uint32_t status, uint32_t *regs)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESP32_GPIO_IRQ
|
||||
static int gpio_interrupt(int irq, FAR void *context, FAR void *arg)
|
||||
static int gpio_interrupt(int irq, void *context, void *arg)
|
||||
{
|
||||
uint32_t status;
|
||||
|
||||
|
@ -103,13 +103,13 @@
|
||||
|
||||
/* Character driver methods */
|
||||
|
||||
static int himem_open(FAR struct file *filep);
|
||||
static int himem_close(FAR struct file *filep);
|
||||
static ssize_t himem_read(FAR struct file *filep, FAR char *buffer,
|
||||
static int himem_open(struct file *filep);
|
||||
static int himem_close(struct file *filep);
|
||||
static ssize_t himem_read(struct file *filep, char *buffer,
|
||||
size_t buflen);
|
||||
static ssize_t himem_write(FAR struct file *filep, FAR const char *buffer,
|
||||
static ssize_t himem_write(struct file *filep, const char *buffer,
|
||||
size_t buflen);
|
||||
static int himem_ioctl(FAR struct file *filep, int cmd,
|
||||
static int himem_ioctl(struct file *filep, int cmd,
|
||||
unsigned long arg);
|
||||
|
||||
/* This structure is used only for access control */
|
||||
@ -222,7 +222,7 @@ size_t esp_himem_reserved_area_size(void)
|
||||
|
||||
int esp_himem_init(void)
|
||||
{
|
||||
FAR struct himem_access_s *priv;
|
||||
struct himem_access_s *priv;
|
||||
int paddr_start = (4096 * 1024) - (CACHE_BLOCKSIZE *
|
||||
SPIRAM_BANKSWITCH_RESERVE);
|
||||
int paddr_end;
|
||||
@ -236,7 +236,7 @@ int esp_himem_init(void)
|
||||
|
||||
/* Allocate a new himem access instance */
|
||||
|
||||
priv = (FAR struct himem_access_s *)
|
||||
priv = (struct himem_access_s *)
|
||||
kmm_zalloc(sizeof(struct himem_access_s));
|
||||
|
||||
if (!priv)
|
||||
@ -652,7 +652,7 @@ int esp_himem_unmap(esp_himem_rangehandle_t range, void *ptr,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int himem_open(FAR struct file *filep)
|
||||
static int himem_open(struct file *filep)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
@ -665,7 +665,7 @@ static int himem_open(FAR struct file *filep)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int himem_close(FAR struct file *filep)
|
||||
static int himem_close(struct file *filep)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
@ -674,7 +674,7 @@ static int himem_close(FAR struct file *filep)
|
||||
* Name: himem_read
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t himem_read(FAR struct file *filep, FAR char *buffer,
|
||||
static ssize_t himem_read(struct file *filep, char *buffer,
|
||||
size_t buflen)
|
||||
{
|
||||
return -ENOSYS;
|
||||
@ -684,7 +684,7 @@ static ssize_t himem_read(FAR struct file *filep, FAR char *buffer,
|
||||
* Name: himem_write
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t himem_write(FAR struct file *filep, FAR const char *buffer,
|
||||
static ssize_t himem_write(struct file *filep, const char *buffer,
|
||||
size_t buflen)
|
||||
{
|
||||
return -ENOSYS;
|
||||
@ -694,7 +694,7 @@ static ssize_t himem_write(FAR struct file *filep, FAR const char *buffer,
|
||||
* Name: himem_ioctl
|
||||
****************************************************************************/
|
||||
|
||||
static int himem_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
static int himem_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
@ -704,8 +704,8 @@ static int himem_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case HIMEMIOC_ALLOC_BLOCKS:
|
||||
{
|
||||
FAR struct esp_himem_par *param =
|
||||
(FAR struct esp_himem_par *)((uintptr_t)arg);
|
||||
struct esp_himem_par *param =
|
||||
(struct esp_himem_par *)((uintptr_t)arg);
|
||||
|
||||
DEBUGASSERT(param != NULL);
|
||||
|
||||
@ -724,8 +724,8 @@ static int himem_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case HIMEMIOC_FREE_BLOCKS:
|
||||
{
|
||||
FAR struct esp_himem_par *param =
|
||||
(FAR struct esp_himem_par *)((uintptr_t)arg);
|
||||
struct esp_himem_par *param =
|
||||
(struct esp_himem_par *)((uintptr_t)arg);
|
||||
|
||||
DEBUGASSERT(param != NULL);
|
||||
|
||||
@ -742,8 +742,8 @@ static int himem_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case HIMEMIOC_ALLOC_MAP_RANGE:
|
||||
{
|
||||
FAR struct esp_himem_par *param =
|
||||
(FAR struct esp_himem_par *)((uintptr_t)arg);
|
||||
struct esp_himem_par *param =
|
||||
(struct esp_himem_par *)((uintptr_t)arg);
|
||||
|
||||
DEBUGASSERT(param != NULL);
|
||||
|
||||
@ -762,8 +762,8 @@ static int himem_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case HIMEMIOC_FREE_MAP_RANGE:
|
||||
{
|
||||
FAR struct esp_himem_par *param =
|
||||
(FAR struct esp_himem_par *)((uintptr_t)arg);
|
||||
struct esp_himem_par *param =
|
||||
(struct esp_himem_par *)((uintptr_t)arg);
|
||||
|
||||
DEBUGASSERT(param != NULL);
|
||||
|
||||
@ -780,8 +780,8 @@ static int himem_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case HIMEMIOC_MAP:
|
||||
{
|
||||
FAR struct esp_himem_par *param =
|
||||
(FAR struct esp_himem_par *)((uintptr_t)arg);
|
||||
struct esp_himem_par *param =
|
||||
(struct esp_himem_par *)((uintptr_t)arg);
|
||||
|
||||
DEBUGASSERT(param != NULL);
|
||||
|
||||
@ -804,8 +804,8 @@ static int himem_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case HIMEMIOC_UNMAP:
|
||||
{
|
||||
FAR struct esp_himem_par *param =
|
||||
(FAR struct esp_himem_par *)((uintptr_t)arg);
|
||||
struct esp_himem_par *param =
|
||||
(struct esp_himem_par *)((uintptr_t)arg);
|
||||
|
||||
DEBUGASSERT(param != NULL);
|
||||
|
||||
@ -824,8 +824,8 @@ static int himem_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case HIMEMIOC_GET_PHYS_SIZE:
|
||||
{
|
||||
FAR struct esp_himem_par *param =
|
||||
(FAR struct esp_himem_par *)((uintptr_t)arg);
|
||||
struct esp_himem_par *param =
|
||||
(struct esp_himem_par *)((uintptr_t)arg);
|
||||
|
||||
DEBUGASSERT(param != NULL);
|
||||
|
||||
@ -837,8 +837,8 @@ static int himem_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case HIMEMIOC_GET_FREE_SIZE:
|
||||
{
|
||||
FAR struct esp_himem_par *param =
|
||||
(FAR struct esp_himem_par *)((uintptr_t)arg);
|
||||
struct esp_himem_par *param =
|
||||
(struct esp_himem_par *)((uintptr_t)arg);
|
||||
|
||||
DEBUGASSERT(param != NULL);
|
||||
|
||||
|
@ -235,20 +235,20 @@ struct esp32_i2c_priv_s
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_i2c_init_clock(FAR struct esp32_i2c_priv_s *priv,
|
||||
static void esp32_i2c_init_clock(struct esp32_i2c_priv_s *priv,
|
||||
uint32_t clock);
|
||||
static void esp32_i2c_init(FAR struct esp32_i2c_priv_s *priv);
|
||||
static void esp32_i2c_deinit(FAR struct esp32_i2c_priv_s *priv);
|
||||
static int esp32_i2c_transfer(FAR struct i2c_master_s *dev,
|
||||
FAR struct i2c_msg_s *msgs,
|
||||
static void esp32_i2c_init(struct esp32_i2c_priv_s *priv);
|
||||
static void esp32_i2c_deinit(struct esp32_i2c_priv_s *priv);
|
||||
static int esp32_i2c_transfer(struct i2c_master_s *dev,
|
||||
struct i2c_msg_s *msgs,
|
||||
int count);
|
||||
static inline void esp32_i2c_process(struct esp32_i2c_priv_s *priv,
|
||||
uint32_t status);
|
||||
#ifdef CONFIG_I2C_POLLED
|
||||
static int esp32_i2c_polling_waitdone(FAR struct esp32_i2c_priv_s *priv);
|
||||
static int esp32_i2c_polling_waitdone(struct esp32_i2c_priv_s *priv);
|
||||
#endif
|
||||
#ifdef CONFIG_I2C_RESET
|
||||
static int esp32_i2c_reset(FAR struct i2c_master_s *dev);
|
||||
static int esp32_i2c_reset(struct i2c_master_s *dev);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_I2C_TRACE
|
||||
@ -416,7 +416,7 @@ static inline void esp32_i2c_reset_reg_bits(struct esp32_i2c_priv_s *priv,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_i2c_reset_fifo(FAR struct esp32_i2c_priv_s *priv)
|
||||
static void esp32_i2c_reset_fifo(struct esp32_i2c_priv_s *priv)
|
||||
{
|
||||
esp32_i2c_set_reg_bits(priv, I2C_FIFO_CONF_OFFSET, I2C_TX_FIFO_RST);
|
||||
esp32_i2c_reset_reg_bits(priv, I2C_FIFO_CONF_OFFSET, I2C_TX_FIFO_RST);
|
||||
@ -433,7 +433,7 @@ static void esp32_i2c_reset_fifo(FAR struct esp32_i2c_priv_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_i2c_sendstart(FAR struct esp32_i2c_priv_s *priv)
|
||||
static void esp32_i2c_sendstart(struct esp32_i2c_priv_s *priv)
|
||||
{
|
||||
struct i2c_msg_s *msg = &priv->msgv[priv->msgid];
|
||||
|
||||
@ -471,7 +471,7 @@ static void esp32_i2c_sendstart(FAR struct esp32_i2c_priv_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_i2c_senddata(FAR struct esp32_i2c_priv_s *priv)
|
||||
static void esp32_i2c_senddata(struct esp32_i2c_priv_s *priv)
|
||||
{
|
||||
int i;
|
||||
struct i2c_msg_s *msg = &priv->msgv[priv->msgid];
|
||||
@ -600,7 +600,7 @@ static void esp32_i2c_sendstop(struct esp32_i2c_priv_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_i2c_init_clock(FAR struct esp32_i2c_priv_s *priv,
|
||||
static void esp32_i2c_init_clock(struct esp32_i2c_priv_s *priv,
|
||||
uint32_t clk_freq)
|
||||
{
|
||||
uint32_t half_cycles = APB_CLK_FREQ / clk_freq / 2;
|
||||
@ -632,7 +632,7 @@ static void esp32_i2c_init_clock(FAR struct esp32_i2c_priv_s *priv,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_i2c_init(FAR struct esp32_i2c_priv_s *priv)
|
||||
static void esp32_i2c_init(struct esp32_i2c_priv_s *priv)
|
||||
{
|
||||
const struct esp32_i2c_config_s *config = priv->config;
|
||||
|
||||
@ -682,7 +682,7 @@ static void esp32_i2c_init(FAR struct esp32_i2c_priv_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_i2c_deinit(FAR struct esp32_i2c_priv_s *priv)
|
||||
static void esp32_i2c_deinit(struct esp32_i2c_priv_s *priv)
|
||||
{
|
||||
const struct esp32_i2c_config_s *config = priv->config;
|
||||
|
||||
@ -700,7 +700,7 @@ static void esp32_i2c_deinit(FAR struct esp32_i2c_priv_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_i2c_reset_fsmc(FAR struct esp32_i2c_priv_s *priv)
|
||||
static void esp32_i2c_reset_fsmc(struct esp32_i2c_priv_s *priv)
|
||||
{
|
||||
esp32_i2c_deinit(priv);
|
||||
esp32_i2c_init(priv);
|
||||
@ -718,7 +718,7 @@ static void esp32_i2c_reset_fsmc(FAR struct esp32_i2c_priv_s *priv)
|
||||
* priv - Pointer to the internal driver state structure.
|
||||
****************************************************************************/
|
||||
#ifndef CONFIG_I2C_POLLED
|
||||
static int esp32_i2c_sem_waitdone(FAR struct esp32_i2c_priv_s *priv)
|
||||
static int esp32_i2c_sem_waitdone(struct esp32_i2c_priv_s *priv)
|
||||
{
|
||||
int ret;
|
||||
struct timespec abstime;
|
||||
@ -766,7 +766,7 @@ static int esp32_i2c_sem_waitdone(FAR struct esp32_i2c_priv_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifdef CONFIG_I2C_POLLED
|
||||
static int esp32_i2c_polling_waitdone(FAR struct esp32_i2c_priv_s *priv)
|
||||
static int esp32_i2c_polling_waitdone(struct esp32_i2c_priv_s *priv)
|
||||
{
|
||||
int ret;
|
||||
struct timespec current_time;
|
||||
@ -869,7 +869,7 @@ static int esp32_i2c_polling_waitdone(FAR struct esp32_i2c_priv_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_i2c_sem_wait(FAR struct esp32_i2c_priv_s *priv)
|
||||
static int esp32_i2c_sem_wait(struct esp32_i2c_priv_s *priv)
|
||||
{
|
||||
return nxsem_wait_uninterruptible(&priv->sem_excl);
|
||||
}
|
||||
@ -895,7 +895,7 @@ static void esp32_i2c_sem_post(struct esp32_i2c_priv_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_i2c_sem_destroy(FAR struct esp32_i2c_priv_s *priv)
|
||||
static void esp32_i2c_sem_destroy(struct esp32_i2c_priv_s *priv)
|
||||
{
|
||||
nxsem_destroy(&priv->sem_excl);
|
||||
#ifndef CONFIG_I2C_POLLED
|
||||
@ -911,7 +911,7 @@ static void esp32_i2c_sem_destroy(FAR struct esp32_i2c_priv_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void esp32_i2c_sem_init(FAR struct esp32_i2c_priv_s *priv)
|
||||
static inline void esp32_i2c_sem_init(struct esp32_i2c_priv_s *priv)
|
||||
{
|
||||
nxsem_init(&priv->sem_excl, 0, 1);
|
||||
|
||||
@ -937,13 +937,13 @@ static inline void esp32_i2c_sem_init(FAR struct esp32_i2c_priv_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_i2c_transfer(FAR struct i2c_master_s *dev,
|
||||
FAR struct i2c_msg_s *msgs,
|
||||
static int esp32_i2c_transfer(struct i2c_master_s *dev,
|
||||
struct i2c_msg_s *msgs,
|
||||
int count)
|
||||
{
|
||||
int i;
|
||||
int ret = OK;
|
||||
FAR struct esp32_i2c_priv_s *priv = (FAR struct esp32_i2c_priv_s *)dev;
|
||||
struct esp32_i2c_priv_s *priv = (struct esp32_i2c_priv_s *)dev;
|
||||
|
||||
DEBUGASSERT(count > 0);
|
||||
|
||||
@ -1163,10 +1163,10 @@ out:
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_I2C_RESET
|
||||
static int esp32_i2c_reset(FAR struct i2c_master_s *dev)
|
||||
static int esp32_i2c_reset(struct i2c_master_s *dev)
|
||||
{
|
||||
irqstate_t flags;
|
||||
FAR struct esp32_i2c_priv_s *priv = (FAR struct esp32_i2c_priv_s *)dev;
|
||||
struct esp32_i2c_priv_s *priv = (struct esp32_i2c_priv_s *)dev;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -1380,7 +1380,7 @@ static void esp32_i2c_tracedump(struct esp32_i2c_priv_s *priv)
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_I2C_POLLED
|
||||
static int esp32_i2c_irq(int cpuint, void *context, FAR void *arg)
|
||||
static int esp32_i2c_irq(int cpuint, void *context, void *arg)
|
||||
{
|
||||
struct esp32_i2c_priv_s *priv = (struct esp32_i2c_priv_s *)arg;
|
||||
|
||||
@ -1528,7 +1528,7 @@ static inline void esp32_i2c_process(struct esp32_i2c_priv_s *priv,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct i2c_master_s *esp32_i2cbus_initialize(int port)
|
||||
struct i2c_master_s *esp32_i2cbus_initialize(int port)
|
||||
{
|
||||
irqstate_t flags;
|
||||
struct esp32_i2c_priv_s *priv;
|
||||
@ -1598,7 +1598,7 @@ FAR struct i2c_master_s *esp32_i2cbus_initialize(int port)
|
||||
|
||||
leave_critical_section(flags);
|
||||
|
||||
return (FAR struct i2c_master_s *)priv;
|
||||
return (struct i2c_master_s *)priv;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -1609,10 +1609,10 @@ FAR struct i2c_master_s *esp32_i2cbus_initialize(int port)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_i2cbus_uninitialize(FAR struct i2c_master_s *dev)
|
||||
int esp32_i2cbus_uninitialize(struct i2c_master_s *dev)
|
||||
{
|
||||
irqstate_t flags;
|
||||
FAR struct esp32_i2c_priv_s *priv = (FAR struct esp32_i2c_priv_s *)dev;
|
||||
struct esp32_i2c_priv_s *priv = (struct esp32_i2c_priv_s *)dev;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
|
@ -64,7 +64,7 @@ extern "C"
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct i2c_master_s *esp32_i2cbus_initialize(int port);
|
||||
struct i2c_master_s *esp32_i2cbus_initialize(int port);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32_i2cbus_uninitialize
|
||||
@ -81,7 +81,7 @@ FAR struct i2c_master_s *esp32_i2cbus_initialize(int port);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_i2cbus_uninitialize(FAR struct i2c_master_s *dev);
|
||||
int esp32_i2cbus_uninitialize(struct i2c_master_s *dev);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct mm_heap_s *g_iheap;
|
||||
struct mm_heap_s *g_iheap;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@ -60,7 +60,7 @@ void xtensa_imm_initialize(void)
|
||||
void *start;
|
||||
size_t size;
|
||||
|
||||
start = (FAR void *)ESP32_IMEM_START;
|
||||
start = (void *)ESP32_IMEM_START;
|
||||
size = CONFIG_XTENSA_IMEM_REGION_SIZE;
|
||||
g_iheap = mm_initialize("esp32-imem", start, size);
|
||||
}
|
||||
@ -126,7 +126,7 @@ void *xtensa_imm_zalloc(size_t size)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void xtensa_imm_free(FAR void *mem)
|
||||
void xtensa_imm_free(void *mem)
|
||||
{
|
||||
mm_free(g_iheap, mem);
|
||||
}
|
||||
@ -163,7 +163,7 @@ void *xtensa_imm_memalign(size_t alignment, size_t size)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
bool xtensa_imm_heapmember(FAR void *mem)
|
||||
bool xtensa_imm_heapmember(void *mem)
|
||||
{
|
||||
return mm_heapmember(g_iheap, mem);
|
||||
}
|
||||
@ -177,7 +177,7 @@ bool xtensa_imm_heapmember(FAR void *mem)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int xtensa_imm_mallinfo(FAR struct mallinfo *info)
|
||||
int xtensa_imm_mallinfo(struct mallinfo *info)
|
||||
{
|
||||
return mm_mallinfo(g_iheap, info);
|
||||
}
|
||||
|
@ -80,12 +80,12 @@ static int esp32_fromcpu_interrupt(int fromcpu)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_fromcpu0_interrupt(int irq, FAR void *context, FAR void *arg)
|
||||
int esp32_fromcpu0_interrupt(int irq, void *context, void *arg)
|
||||
{
|
||||
return esp32_fromcpu_interrupt(0);
|
||||
}
|
||||
|
||||
int esp32_fromcpu1_interrupt(int irq, FAR void *context, FAR void *arg)
|
||||
int esp32_fromcpu1_interrupt(int irq, void *context, void *arg)
|
||||
{
|
||||
return esp32_fromcpu_interrupt(1);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ struct esp32_oneshot_s
|
||||
{
|
||||
uint8_t chan; /* The timer/counter in use */
|
||||
volatile bool running; /* True: the timer is running */
|
||||
FAR struct esp32_tim_dev_s *tim; /* Pointer returned by
|
||||
struct esp32_tim_dev_s *tim; /* Pointer returned by
|
||||
* esp32_tim_init() */
|
||||
volatile oneshot_handler_t handler; /* Oneshot expiration callback */
|
||||
volatile void *arg; /* The argument that will accompany
|
||||
|
@ -58,7 +58,7 @@ struct esp32_oneshot_lowerhalf_s
|
||||
struct oneshot_lowerhalf_s lh; /* Lower half instance */
|
||||
struct esp32_oneshot_s oneshot; /* ESP32-specific oneshot state */
|
||||
oneshot_callback_t callback; /* Upper half Interrupt callback */
|
||||
FAR void *arg; /* Argument passed to handler */
|
||||
void *arg; /* Argument passed to handler */
|
||||
uint16_t resolution;
|
||||
};
|
||||
|
||||
@ -70,16 +70,16 @@ static void esp32_oneshot_lh_handler(void *arg);
|
||||
|
||||
/* "Lower half" driver methods **********************************************/
|
||||
|
||||
static int esp32_max_lh_delay(FAR struct oneshot_lowerhalf_s *lower,
|
||||
FAR struct timespec *ts);
|
||||
static int esp32_lh_start(FAR struct oneshot_lowerhalf_s *lower,
|
||||
static int esp32_max_lh_delay(struct oneshot_lowerhalf_s *lower,
|
||||
struct timespec *ts);
|
||||
static int esp32_lh_start(struct oneshot_lowerhalf_s *lower,
|
||||
oneshot_callback_t callback,
|
||||
FAR void *arg,
|
||||
FAR const struct timespec *ts);
|
||||
static int esp32_lh_cancel(FAR struct oneshot_lowerhalf_s *lower,
|
||||
FAR struct timespec *ts);
|
||||
static int esp32_lh_current(FAR struct oneshot_lowerhalf_s *lower,
|
||||
FAR struct timespec *ts);
|
||||
void *arg,
|
||||
const struct timespec *ts);
|
||||
static int esp32_lh_cancel(struct oneshot_lowerhalf_s *lower,
|
||||
struct timespec *ts);
|
||||
static int esp32_lh_current(struct oneshot_lowerhalf_s *lower,
|
||||
struct timespec *ts);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@ -113,8 +113,8 @@ static const struct oneshot_operations_s g_esp32_timer_ops =
|
||||
|
||||
static void esp32_oneshot_lh_handler(void *arg)
|
||||
{
|
||||
FAR struct esp32_oneshot_lowerhalf_s *priv =
|
||||
(FAR struct esp32_oneshot_lowerhalf_s *)arg;
|
||||
struct esp32_oneshot_lowerhalf_s *priv =
|
||||
(struct esp32_oneshot_lowerhalf_s *)arg;
|
||||
|
||||
DEBUGASSERT(priv != NULL);
|
||||
DEBUGASSERT(priv->callback != NULL);
|
||||
@ -149,8 +149,8 @@ static void esp32_oneshot_lh_handler(void *arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_max_lh_delay(FAR struct oneshot_lowerhalf_s *lower,
|
||||
FAR struct timespec *ts)
|
||||
static int esp32_max_lh_delay(struct oneshot_lowerhalf_s *lower,
|
||||
struct timespec *ts)
|
||||
{
|
||||
DEBUGASSERT(ts != NULL);
|
||||
|
||||
@ -191,13 +191,13 @@ static int esp32_max_lh_delay(FAR struct oneshot_lowerhalf_s *lower,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_lh_start(FAR struct oneshot_lowerhalf_s *lower,
|
||||
static int esp32_lh_start(struct oneshot_lowerhalf_s *lower,
|
||||
oneshot_callback_t callback,
|
||||
FAR void *arg,
|
||||
FAR const struct timespec *ts)
|
||||
void *arg,
|
||||
const struct timespec *ts)
|
||||
{
|
||||
FAR struct esp32_oneshot_lowerhalf_s *priv =
|
||||
(FAR struct esp32_oneshot_lowerhalf_s *)lower;
|
||||
struct esp32_oneshot_lowerhalf_s *priv =
|
||||
(struct esp32_oneshot_lowerhalf_s *)lower;
|
||||
int ret;
|
||||
irqstate_t flags;
|
||||
|
||||
@ -247,11 +247,11 @@ static int esp32_lh_start(FAR struct oneshot_lowerhalf_s *lower,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_lh_cancel(FAR struct oneshot_lowerhalf_s *lower,
|
||||
FAR struct timespec *ts)
|
||||
static int esp32_lh_cancel(struct oneshot_lowerhalf_s *lower,
|
||||
struct timespec *ts)
|
||||
{
|
||||
FAR struct esp32_oneshot_lowerhalf_s *priv =
|
||||
(FAR struct esp32_oneshot_lowerhalf_s *)lower;
|
||||
struct esp32_oneshot_lowerhalf_s *priv =
|
||||
(struct esp32_oneshot_lowerhalf_s *)lower;
|
||||
irqstate_t flags;
|
||||
int ret;
|
||||
|
||||
@ -292,11 +292,11 @@ static int esp32_lh_cancel(FAR struct oneshot_lowerhalf_s *lower,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_lh_current(FAR struct oneshot_lowerhalf_s *lower,
|
||||
FAR struct timespec *ts)
|
||||
static int esp32_lh_current(struct oneshot_lowerhalf_s *lower,
|
||||
struct timespec *ts)
|
||||
{
|
||||
FAR struct esp32_oneshot_lowerhalf_s *priv =
|
||||
(FAR struct esp32_oneshot_lowerhalf_s *)lower;
|
||||
struct esp32_oneshot_lowerhalf_s *priv =
|
||||
(struct esp32_oneshot_lowerhalf_s *)lower;
|
||||
uint64_t current_us;
|
||||
|
||||
DEBUGASSERT(priv != NULL);
|
||||
@ -333,15 +333,15 @@ static int esp32_lh_current(FAR struct oneshot_lowerhalf_s *lower,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct oneshot_lowerhalf_s *oneshot_initialize(int chan,
|
||||
struct oneshot_lowerhalf_s *oneshot_initialize(int chan,
|
||||
uint16_t resolution)
|
||||
{
|
||||
FAR struct esp32_oneshot_lowerhalf_s *priv;
|
||||
struct esp32_oneshot_lowerhalf_s *priv;
|
||||
int ret;
|
||||
|
||||
/* Allocate an instance of the lower half driver */
|
||||
|
||||
priv = (FAR struct esp32_oneshot_lowerhalf_s *)kmm_zalloc(
|
||||
priv = (struct esp32_oneshot_lowerhalf_s *)kmm_zalloc(
|
||||
sizeof(struct esp32_oneshot_lowerhalf_s));
|
||||
|
||||
if (priv == NULL)
|
||||
|
@ -362,7 +362,7 @@ static int ota_set_bootseq(struct mtd_dev_priv *dev, int num)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_part_erase(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
static int esp32_part_erase(struct mtd_dev_s *dev, off_t startblock,
|
||||
size_t nblocks)
|
||||
{
|
||||
struct mtd_dev_priv *mtd_priv = (struct mtd_dev_priv *)dev;
|
||||
@ -387,8 +387,8 @@ static int esp32_part_erase(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t esp32_part_read(FAR struct mtd_dev_s *dev, off_t offset,
|
||||
size_t nbytes, FAR uint8_t *buffer)
|
||||
static ssize_t esp32_part_read(struct mtd_dev_s *dev, off_t offset,
|
||||
size_t nbytes, uint8_t *buffer)
|
||||
{
|
||||
struct mtd_dev_priv *mtd_priv = (struct mtd_dev_priv *)dev;
|
||||
|
||||
@ -412,8 +412,8 @@ static ssize_t esp32_part_read(FAR struct mtd_dev_s *dev, off_t offset,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t esp32_part_bread(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
size_t nblocks, FAR uint8_t *buffer)
|
||||
static ssize_t esp32_part_bread(struct mtd_dev_s *dev, off_t startblock,
|
||||
size_t nblocks, uint8_t *buffer)
|
||||
{
|
||||
struct mtd_dev_priv *mtd_priv = (struct mtd_dev_priv *)dev;
|
||||
|
||||
@ -437,8 +437,8 @@ static ssize_t esp32_part_bread(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t esp32_part_write(FAR struct mtd_dev_s *dev, off_t offset,
|
||||
size_t nbytes, FAR const uint8_t *buffer)
|
||||
static ssize_t esp32_part_write(struct mtd_dev_s *dev, off_t offset,
|
||||
size_t nbytes, const uint8_t *buffer)
|
||||
{
|
||||
struct mtd_dev_priv *mtd_priv = (struct mtd_dev_priv *)dev;
|
||||
|
||||
@ -463,8 +463,8 @@ static ssize_t esp32_part_write(FAR struct mtd_dev_s *dev, off_t offset,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t esp32_part_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
size_t nblocks, FAR const uint8_t *buffer)
|
||||
static ssize_t esp32_part_bwrite(struct mtd_dev_s *dev, off_t startblock,
|
||||
size_t nblocks, const uint8_t *buffer)
|
||||
{
|
||||
struct mtd_dev_priv *mtd_priv = (struct mtd_dev_priv *)dev;
|
||||
|
||||
@ -487,7 +487,7 @@ static ssize_t esp32_part_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_part_ioctl(FAR struct mtd_dev_s *dev, int cmd,
|
||||
static int esp32_part_ioctl(struct mtd_dev_s *dev, int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
int ret;
|
||||
|
@ -59,9 +59,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_rng_initialize(void);
|
||||
static ssize_t esp32_rng_read(FAR struct file *filep, FAR char *buffer,
|
||||
static ssize_t esp32_rng_read(struct file *filep, char *buffer,
|
||||
size_t buflen);
|
||||
static int esp32_rng_open(FAR struct file *filep);
|
||||
static int esp32_rng_open(struct file *filep);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
@ -166,7 +166,7 @@ static int esp32_rng_initialize(void)
|
||||
* Name: esp32_rng_open
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_rng_open(FAR struct file *filep)
|
||||
static int esp32_rng_open(struct file *filep)
|
||||
{
|
||||
/* O_NONBLOCK is not supported */
|
||||
|
||||
@ -183,10 +183,10 @@ static int esp32_rng_open(FAR struct file *filep)
|
||||
* Name: esp32_rng_read
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t esp32_rng_read(FAR struct file *filep, FAR char *buffer,
|
||||
static ssize_t esp32_rng_read(struct file *filep, char *buffer,
|
||||
size_t buflen)
|
||||
{
|
||||
FAR struct rng_dev_s *priv = (struct rng_dev_s *)&g_rngdev;
|
||||
struct rng_dev_s *priv = (struct rng_dev_s *)&g_rngdev;
|
||||
ssize_t read_len;
|
||||
uint8_t *rd_buf = (uint8_t *)buffer;
|
||||
|
||||
@ -241,7 +241,7 @@ static ssize_t esp32_rng_read(FAR struct file *filep, FAR char *buffer,
|
||||
void devrandom_register(void)
|
||||
{
|
||||
esp32_rng_initialize();
|
||||
register_driver("/dev/random", FAR & g_rngops, 0444, NULL);
|
||||
register_driver("/dev/random", &g_rngops, 0444, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -265,7 +265,7 @@ void devurandom_register(void)
|
||||
#ifndef CONFIG_DEV_RANDOM
|
||||
esp32_rng_initialize();
|
||||
#endif
|
||||
register_driver("dev/urandom", FAR & g_rngops, 0444, NULL);
|
||||
register_driver("dev/urandom", &g_rngops, 0444, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -93,7 +93,7 @@ static struct esp32_tim_dev_s *s_esp32_tim_dev;
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void start_rt_timer(FAR struct rt_timer_s *timer,
|
||||
static void start_rt_timer(struct rt_timer_s *timer,
|
||||
uint64_t timeout,
|
||||
bool repeat)
|
||||
{
|
||||
@ -178,7 +178,7 @@ static void start_rt_timer(FAR struct rt_timer_s *timer,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void stop_rt_timer(FAR struct rt_timer_s *timer)
|
||||
static void stop_rt_timer(struct rt_timer_s *timer)
|
||||
{
|
||||
irqstate_t flags;
|
||||
bool ishead;
|
||||
@ -252,7 +252,7 @@ static void stop_rt_timer(FAR struct rt_timer_s *timer)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void delete_rt_timer(FAR struct rt_timer_s *timer)
|
||||
static void delete_rt_timer(struct rt_timer_s *timer)
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
@ -294,7 +294,7 @@ exit:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int rt_timer_thread(int argc, FAR char *argv[])
|
||||
static int rt_timer_thread(int argc, char *argv[])
|
||||
{
|
||||
int ret;
|
||||
irqstate_t flags;
|
||||
@ -464,8 +464,8 @@ static int rt_timer_isr(int irq, void *context, void *arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int rt_timer_create(FAR const struct rt_timer_args_s *args,
|
||||
FAR struct rt_timer_s **timer_handle)
|
||||
int rt_timer_create(const struct rt_timer_args_s *args,
|
||||
struct rt_timer_s **timer_handle)
|
||||
{
|
||||
struct rt_timer_s *timer;
|
||||
|
||||
@ -503,7 +503,7 @@ int rt_timer_create(FAR const struct rt_timer_args_s *args,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void rt_timer_start(FAR struct rt_timer_s *timer,
|
||||
void rt_timer_start(struct rt_timer_s *timer,
|
||||
uint64_t timeout,
|
||||
bool repeat)
|
||||
{
|
||||
@ -526,7 +526,7 @@ void rt_timer_start(FAR struct rt_timer_s *timer,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void rt_timer_stop(FAR struct rt_timer_s *timer)
|
||||
void rt_timer_stop(struct rt_timer_s *timer)
|
||||
{
|
||||
stop_rt_timer(timer);
|
||||
}
|
||||
@ -545,7 +545,7 @@ void rt_timer_stop(FAR struct rt_timer_s *timer)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void rt_timer_delete(FAR struct rt_timer_s *timer)
|
||||
void rt_timer_delete(struct rt_timer_s *timer)
|
||||
{
|
||||
delete_rt_timer(timer);
|
||||
}
|
||||
|
@ -107,8 +107,8 @@ extern "C"
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int rt_timer_create(FAR const struct rt_timer_args_s *args,
|
||||
FAR struct rt_timer_s **timer_handle);
|
||||
int rt_timer_create(const struct rt_timer_args_s *args,
|
||||
struct rt_timer_s **timer_handle);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rt_timer_start
|
||||
@ -126,7 +126,7 @@ int rt_timer_create(FAR const struct rt_timer_args_s *args,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void rt_timer_start(FAR struct rt_timer_s *timer,
|
||||
void rt_timer_start(struct rt_timer_s *timer,
|
||||
uint64_t timeout,
|
||||
bool repeat);
|
||||
|
||||
@ -144,7 +144,7 @@ void rt_timer_start(FAR struct rt_timer_s *timer,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void rt_timer_stop(FAR struct rt_timer_s *timer);
|
||||
void rt_timer_stop(struct rt_timer_s *timer);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rt_timer_delete
|
||||
@ -160,7 +160,7 @@ void rt_timer_stop(FAR struct rt_timer_s *timer);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void rt_timer_delete(FAR struct rt_timer_s *timer);
|
||||
void rt_timer_delete(struct rt_timer_s *timer);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rt_timer_time_us
|
||||
|
@ -232,7 +232,7 @@ struct alm_cbinfo_s
|
||||
{
|
||||
struct rt_timer_s *alarm_hdl; /* Timer id point to here */
|
||||
volatile alm_callback_t ac_cb; /* Client callback function */
|
||||
volatile FAR void *ac_arg; /* Argument to pass with the callback function */
|
||||
volatile void *ac_arg; /* Argument to pass with the callback function */
|
||||
uint64_t deadline_us;
|
||||
uint8_t index;
|
||||
};
|
||||
@ -266,7 +266,7 @@ static void IRAM_ATTR esp32_rtc_clk_8m_enable(bool clk_8m_en, bool d256_en);
|
||||
static uint32_t IRAM_ATTR esp32_rtc_clk_slow_freq_get_hz(void);
|
||||
|
||||
#ifdef CONFIG_RTC_DRIVER
|
||||
static void IRAM_ATTR esp32_rt_cb_handler(FAR void *arg);
|
||||
static void IRAM_ATTR esp32_rt_cb_handler(void *arg);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -760,11 +760,11 @@ static void esp32_select_rtc_slow_clk(enum esp32_slow_clk_sel_e slow_clk)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void IRAM_ATTR esp32_rt_cb_handler(FAR void *arg)
|
||||
static void IRAM_ATTR esp32_rt_cb_handler(void *arg)
|
||||
{
|
||||
FAR struct alm_cbinfo_s *cbinfo = (struct alm_cbinfo_s *)arg;
|
||||
struct alm_cbinfo_s *cbinfo = (struct alm_cbinfo_s *)arg;
|
||||
alm_callback_t cb;
|
||||
FAR void *cb_arg;
|
||||
void *cb_arg;
|
||||
int alminfo_id;
|
||||
|
||||
DEBUGASSERT(cbinfo != NULL);
|
||||
@ -777,7 +777,7 @@ static void IRAM_ATTR esp32_rt_cb_handler(FAR void *arg)
|
||||
/* Alarm callback */
|
||||
|
||||
cb = cbinfo->ac_cb;
|
||||
cb_arg = (FAR void *)cbinfo->ac_arg;
|
||||
cb_arg = (void *)cbinfo->ac_arg;
|
||||
cbinfo->ac_cb = NULL;
|
||||
cbinfo->ac_arg = NULL;
|
||||
cbinfo->deadline_us = 0;
|
||||
@ -1957,7 +1957,7 @@ time_t up_rtc_time(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_rtc_settime(FAR const struct timespec *ts)
|
||||
int up_rtc_settime(const struct timespec *ts)
|
||||
{
|
||||
irqstate_t flags;
|
||||
uint64_t now_us;
|
||||
@ -2052,7 +2052,7 @@ int up_rtc_initialize(void)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RTC_HIRES
|
||||
int up_rtc_gettime(FAR struct timespec *tp)
|
||||
int up_rtc_gettime(struct timespec *tp)
|
||||
{
|
||||
irqstate_t flags;
|
||||
uint64_t time_us;
|
||||
@ -2095,10 +2095,10 @@ int up_rtc_gettime(FAR struct timespec *tp)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_rtc_setalarm(FAR struct alm_setalarm_s *alminfo)
|
||||
int up_rtc_setalarm(struct alm_setalarm_s *alminfo)
|
||||
{
|
||||
struct rt_timer_args_s rt_timer_args;
|
||||
FAR struct alm_cbinfo_s *cbinfo;
|
||||
struct alm_cbinfo_s *cbinfo;
|
||||
irqstate_t flags;
|
||||
int ret = -EBUSY;
|
||||
int id;
|
||||
@ -2170,7 +2170,7 @@ int up_rtc_setalarm(FAR struct alm_setalarm_s *alminfo)
|
||||
|
||||
int up_rtc_cancelalarm(enum alm_id_e alarmid)
|
||||
{
|
||||
FAR struct alm_cbinfo_s *cbinfo;
|
||||
struct alm_cbinfo_s *cbinfo;
|
||||
irqstate_t flags;
|
||||
int ret = -ENODATA;
|
||||
|
||||
@ -2217,10 +2217,10 @@ int up_rtc_cancelalarm(enum alm_id_e alarmid)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_rtc_rdalarm(FAR struct timespec *tp, uint32_t alarmid)
|
||||
int up_rtc_rdalarm(struct timespec *tp, uint32_t alarmid)
|
||||
{
|
||||
irqstate_t flags;
|
||||
FAR struct alm_cbinfo_s *cbinfo;
|
||||
struct alm_cbinfo_s *cbinfo;
|
||||
DEBUGASSERT(tp != NULL);
|
||||
DEBUGASSERT((RTC_ALARM0 <= alarmid) &&
|
||||
(alarmid < RTC_ALARM_LAST));
|
||||
|
@ -134,7 +134,7 @@ enum esp32_rtc_cal_sel_e
|
||||
|
||||
/* The form of an alarm callback */
|
||||
|
||||
typedef CODE void (*alm_callback_t)(FAR void *arg, unsigned int alarmid);
|
||||
typedef CODE void (*alm_callback_t)(void *arg, unsigned int alarmid);
|
||||
|
||||
enum alm_id_e
|
||||
{
|
||||
@ -150,7 +150,7 @@ struct alm_setalarm_s
|
||||
int as_id; /* enum alm_id_e */
|
||||
struct timespec as_time; /* Alarm expiration time */
|
||||
alm_callback_t as_cb; /* Callback (if non-NULL) */
|
||||
FAR void *as_arg; /* Argument for callback */
|
||||
void *as_arg; /* Argument for callback */
|
||||
};
|
||||
|
||||
#endif /* CONFIG_RTC_ALARM */
|
||||
@ -562,7 +562,7 @@ time_t up_rtc_time(void);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_rtc_settime(FAR const struct timespec *ts);
|
||||
int up_rtc_settime(const struct timespec *ts);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_rtc_initialize
|
||||
@ -598,7 +598,7 @@ int up_rtc_initialize(void);
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RTC_HIRES
|
||||
int up_rtc_gettime(FAR struct timespec *tp);
|
||||
int up_rtc_gettime(struct timespec *tp);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
@ -617,7 +617,7 @@ int up_rtc_gettime(FAR struct timespec *tp);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_rtc_setalarm(FAR struct alm_setalarm_s *alminfo);
|
||||
int up_rtc_setalarm(struct alm_setalarm_s *alminfo);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_rtc_cancelalarm
|
||||
@ -650,7 +650,7 @@ int up_rtc_cancelalarm(enum alm_id_e alarmid);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_rtc_rdalarm(FAR struct timespec *tp, uint32_t alarmid);
|
||||
int up_rtc_rdalarm(struct timespec *tp, uint32_t alarmid);
|
||||
|
||||
#endif /* CONFIG_RTC_ALARM */
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
struct esp32_cbinfo_s
|
||||
{
|
||||
volatile rtc_alarm_callback_t cb; /* Callback when the alarm expires */
|
||||
volatile FAR void *priv; /* Private argurment to accompany callback */
|
||||
volatile void *priv; /* Private argurment to accompany callback */
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -60,7 +60,7 @@ struct esp32_lowerhalf_s
|
||||
* operations vtable (which may lie in FLASH or ROM)
|
||||
*/
|
||||
|
||||
FAR const struct rtc_ops_s *ops;
|
||||
const struct rtc_ops_s *ops;
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
/* Alarm callback information */
|
||||
|
||||
@ -74,22 +74,22 @@ struct esp32_lowerhalf_s
|
||||
|
||||
/* Prototypes for static methods in struct rtc_ops_s */
|
||||
|
||||
static int rtc_lh_rdtime(FAR struct rtc_lowerhalf_s *lower,
|
||||
FAR struct rtc_time *rtctime);
|
||||
static int rtc_lh_settime(FAR struct rtc_lowerhalf_s *lower,
|
||||
FAR const struct rtc_time *rtctime);
|
||||
static bool rtc_lh_havesettime(FAR struct rtc_lowerhalf_s *lower);
|
||||
static int rtc_lh_rdtime(struct rtc_lowerhalf_s *lower,
|
||||
struct rtc_time *rtctime);
|
||||
static int rtc_lh_settime(struct rtc_lowerhalf_s *lower,
|
||||
const struct rtc_time *rtctime);
|
||||
static bool rtc_lh_havesettime(struct rtc_lowerhalf_s *lower);
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
static void rtc_lh_alarm_callback(FAR void *arg, unsigned int alarmid);
|
||||
static int rtc_lh_setalarm(FAR struct rtc_lowerhalf_s *lower,
|
||||
FAR const struct lower_setalarm_s *alarminfo);
|
||||
static int rtc_lh_setrelative(FAR struct rtc_lowerhalf_s *lower,
|
||||
FAR const struct lower_setrelative_s *alarminfo);
|
||||
static int rtc_lh_cancelalarm(FAR struct rtc_lowerhalf_s *lower,
|
||||
static void rtc_lh_alarm_callback(void *arg, unsigned int alarmid);
|
||||
static int rtc_lh_setalarm(struct rtc_lowerhalf_s *lower,
|
||||
const struct lower_setalarm_s *alarminfo);
|
||||
static int rtc_lh_setrelative(struct rtc_lowerhalf_s *lower,
|
||||
const struct lower_setrelative_s *alarminfo);
|
||||
static int rtc_lh_cancelalarm(struct rtc_lowerhalf_s *lower,
|
||||
int alarmid);
|
||||
static int rtc_lh_rdalarm(FAR struct rtc_lowerhalf_s *lower,
|
||||
FAR struct lower_rdalarm_s *alarminfo);
|
||||
static int rtc_lh_rdalarm(struct rtc_lowerhalf_s *lower,
|
||||
struct lower_rdalarm_s *alarminfo);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -145,12 +145,12 @@ static struct esp32_lowerhalf_s g_rtc_lowerhalf =
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
static void rtc_lh_alarm_callback(FAR void *arg, unsigned int alarmid)
|
||||
static void rtc_lh_alarm_callback(void *arg, unsigned int alarmid)
|
||||
{
|
||||
FAR struct esp32_lowerhalf_s *lower;
|
||||
FAR struct esp32_cbinfo_s *cbinfo;
|
||||
struct esp32_lowerhalf_s *lower;
|
||||
struct esp32_cbinfo_s *cbinfo;
|
||||
rtc_alarm_callback_t cb;
|
||||
FAR void *priv;
|
||||
void *priv;
|
||||
|
||||
DEBUGASSERT((RTC_ALARM0 <= alarmid) && (alarmid < RTC_ALARM_LAST));
|
||||
|
||||
@ -162,7 +162,7 @@ static void rtc_lh_alarm_callback(FAR void *arg, unsigned int alarmid)
|
||||
*/
|
||||
|
||||
cb = (rtc_alarm_callback_t)cbinfo->cb;
|
||||
priv = (FAR void *)cbinfo->priv;
|
||||
priv = (void *)cbinfo->priv;
|
||||
|
||||
cbinfo->cb = NULL;
|
||||
cbinfo->priv = NULL;
|
||||
@ -192,11 +192,11 @@ static void rtc_lh_alarm_callback(FAR void *arg, unsigned int alarmid)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int rtc_lh_rdtime(FAR struct rtc_lowerhalf_s *lower,
|
||||
FAR struct rtc_time *rtctime)
|
||||
static int rtc_lh_rdtime(struct rtc_lowerhalf_s *lower,
|
||||
struct rtc_time *rtctime)
|
||||
{
|
||||
#if defined(CONFIG_RTC_HIRES)
|
||||
FAR struct timespec ts;
|
||||
struct timespec ts;
|
||||
int ret;
|
||||
|
||||
/* Get the higher resolution time */
|
||||
@ -212,7 +212,7 @@ static int rtc_lh_rdtime(FAR struct rtc_lowerhalf_s *lower,
|
||||
* compatible.
|
||||
*/
|
||||
|
||||
if (!gmtime_r(&ts.tv_sec, (FAR struct tm *)rtctime))
|
||||
if (!gmtime_r(&ts.tv_sec, (struct tm *)rtctime))
|
||||
{
|
||||
ret = -get_errno();
|
||||
goto errout;
|
||||
@ -233,7 +233,7 @@ errout:
|
||||
|
||||
/* Convert the one second epoch time to a struct tm */
|
||||
|
||||
if (gmtime_r(&timer, (FAR struct tm *)rtctime) == 0)
|
||||
if (gmtime_r(&timer, (struct tm *)rtctime) == 0)
|
||||
{
|
||||
int errcode = get_errno();
|
||||
DEBUGASSERT(errcode > 0);
|
||||
@ -262,8 +262,8 @@ errout:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int rtc_lh_settime(FAR struct rtc_lowerhalf_s *lower,
|
||||
FAR const struct rtc_time *rtctime)
|
||||
static int rtc_lh_settime(struct rtc_lowerhalf_s *lower,
|
||||
const struct rtc_time *rtctime)
|
||||
{
|
||||
struct timespec ts;
|
||||
|
||||
@ -271,7 +271,7 @@ static int rtc_lh_settime(FAR struct rtc_lowerhalf_s *lower,
|
||||
* rtc_time is cast compatible with struct tm.
|
||||
*/
|
||||
|
||||
ts.tv_sec = mktime((FAR struct tm *)rtctime);
|
||||
ts.tv_sec = mktime((struct tm *)rtctime);
|
||||
ts.tv_nsec = 0;
|
||||
|
||||
/* Now set the time (with a accuracy of seconds) */
|
||||
@ -293,7 +293,7 @@ static int rtc_lh_settime(FAR struct rtc_lowerhalf_s *lower,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static bool rtc_lh_havesettime(FAR struct rtc_lowerhalf_s *lower)
|
||||
static bool rtc_lh_havesettime(struct rtc_lowerhalf_s *lower)
|
||||
{
|
||||
if (esp32_rtc_get_boot_time() == 0)
|
||||
{
|
||||
@ -321,11 +321,11 @@ static bool rtc_lh_havesettime(FAR struct rtc_lowerhalf_s *lower)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
static int rtc_lh_setalarm(FAR struct rtc_lowerhalf_s *lower,
|
||||
FAR const struct lower_setalarm_s *alarminfo)
|
||||
static int rtc_lh_setalarm(struct rtc_lowerhalf_s *lower,
|
||||
const struct lower_setalarm_s *alarminfo)
|
||||
{
|
||||
FAR struct esp32_lowerhalf_s *priv;
|
||||
FAR struct esp32_cbinfo_s *cbinfo;
|
||||
struct esp32_lowerhalf_s *priv;
|
||||
struct esp32_cbinfo_s *cbinfo;
|
||||
struct alm_setalarm_s lowerinfo;
|
||||
int ret;
|
||||
|
||||
@ -333,7 +333,7 @@ static int rtc_lh_setalarm(FAR struct rtc_lowerhalf_s *lower,
|
||||
DEBUGASSERT((RTC_ALARM0 <= alarminfo->id) &&
|
||||
(alarminfo->id < RTC_ALARM_LAST));
|
||||
|
||||
priv = (FAR struct esp32_lowerhalf_s *)lower;
|
||||
priv = (struct esp32_lowerhalf_s *)lower;
|
||||
|
||||
/* Remember the callback information */
|
||||
|
||||
@ -349,7 +349,7 @@ static int rtc_lh_setalarm(FAR struct rtc_lowerhalf_s *lower,
|
||||
|
||||
/* Convert the RTC time to a timespec (1 second accuracy) */
|
||||
|
||||
lowerinfo.as_time.tv_sec = mktime((FAR struct tm *)&alarminfo->time);
|
||||
lowerinfo.as_time.tv_sec = mktime((struct tm *)&alarminfo->time);
|
||||
lowerinfo.as_time.tv_nsec = 0;
|
||||
|
||||
/* And set the alarm */
|
||||
@ -383,8 +383,8 @@ static int rtc_lh_setalarm(FAR struct rtc_lowerhalf_s *lower,
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
static int rtc_lh_setrelative(FAR struct rtc_lowerhalf_s *lower,
|
||||
FAR const struct lower_setrelative_s *alarminfo)
|
||||
static int rtc_lh_setrelative(struct rtc_lowerhalf_s *lower,
|
||||
const struct lower_setrelative_s *alarminfo)
|
||||
{
|
||||
struct lower_setalarm_s setalarm;
|
||||
time_t seconds;
|
||||
@ -400,7 +400,7 @@ static int rtc_lh_setrelative(FAR struct rtc_lowerhalf_s *lower,
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
|
||||
seconds = alarminfo->reltime;
|
||||
gmtime_r(&seconds, (FAR struct tm *)&setalarm.time);
|
||||
gmtime_r(&seconds, (struct tm *)&setalarm.time);
|
||||
|
||||
/* The set the alarm using this absolute time */
|
||||
|
||||
@ -434,15 +434,15 @@ static int rtc_lh_setrelative(FAR struct rtc_lowerhalf_s *lower,
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
static int rtc_lh_cancelalarm(FAR struct rtc_lowerhalf_s *lower, int alarmid)
|
||||
static int rtc_lh_cancelalarm(struct rtc_lowerhalf_s *lower, int alarmid)
|
||||
{
|
||||
FAR struct esp32_lowerhalf_s *priv;
|
||||
FAR struct esp32_cbinfo_s *cbinfo;
|
||||
struct esp32_lowerhalf_s *priv;
|
||||
struct esp32_cbinfo_s *cbinfo;
|
||||
|
||||
DEBUGASSERT(lower != NULL);
|
||||
DEBUGASSERT((RTC_ALARM0 <= alarmid) && (alarmid < RTC_ALARM_LAST));
|
||||
|
||||
priv = (FAR struct esp32_lowerhalf_s *)lower;
|
||||
priv = (struct esp32_lowerhalf_s *)lower;
|
||||
|
||||
/* Nullify callback information to reduce window for race conditions */
|
||||
|
||||
@ -473,8 +473,8 @@ static int rtc_lh_cancelalarm(FAR struct rtc_lowerhalf_s *lower, int alarmid)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
static int rtc_lh_rdalarm(FAR struct rtc_lowerhalf_s *lower,
|
||||
FAR struct lower_rdalarm_s *alarminfo)
|
||||
static int rtc_lh_rdalarm(struct rtc_lowerhalf_s *lower,
|
||||
struct lower_rdalarm_s *alarminfo)
|
||||
{
|
||||
struct timespec ts;
|
||||
int ret;
|
||||
@ -487,8 +487,8 @@ static int rtc_lh_rdalarm(FAR struct rtc_lowerhalf_s *lower,
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
|
||||
ret = up_rtc_rdalarm(&ts, alarminfo->id);
|
||||
localtime_r((FAR const time_t *)&ts.tv_sec,
|
||||
(FAR struct tm *)alarminfo->time);
|
||||
localtime_r((const time_t *)&ts.tv_sec,
|
||||
(struct tm *)alarminfo->time);
|
||||
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
|
||||
@ -515,9 +515,9 @@ static int rtc_lh_rdalarm(FAR struct rtc_lowerhalf_s *lower,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct rtc_lowerhalf_s *esp32_rtc_lowerhalf(void)
|
||||
struct rtc_lowerhalf_s *esp32_rtc_lowerhalf(void)
|
||||
{
|
||||
return (FAR struct rtc_lowerhalf_s *)&g_rtc_lowerhalf;
|
||||
return (struct rtc_lowerhalf_s *)&g_rtc_lowerhalf;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -539,7 +539,7 @@ FAR struct rtc_lowerhalf_s *esp32_rtc_lowerhalf(void)
|
||||
int esp32_rtc_driverinit(void)
|
||||
{
|
||||
int ret;
|
||||
FAR struct rtc_lowerhalf_s *lower;
|
||||
struct rtc_lowerhalf_s *lower;
|
||||
|
||||
/* Instantiate the ESP32 lower-half RTC driver */
|
||||
|
||||
|
@ -280,7 +280,7 @@ static int esp32_setup(struct uart_dev_s *dev);
|
||||
static void esp32_shutdown(struct uart_dev_s *dev);
|
||||
static int esp32_attach(struct uart_dev_s *dev);
|
||||
static void esp32_detach(struct uart_dev_s *dev);
|
||||
static int esp32_interrupt(int cpuint, void *context, FAR void *arg);
|
||||
static int esp32_interrupt(int cpuint, void *context, void *arg);
|
||||
static int esp32_ioctl(struct file *filep, int cmd, unsigned long arg);
|
||||
static int esp32_receive(struct uart_dev_s *dev, unsigned int *status);
|
||||
static void esp32_rxint(struct uart_dev_s *dev, bool enable);
|
||||
@ -300,7 +300,7 @@ static void dma_config(uint8_t dma_chan);
|
||||
static void dma_attach(uint8_t dma_chan);
|
||||
static inline void dma_enable_int(uint8_t dma_chan);
|
||||
static inline void dma_disable_int(uint8_t dma_chan);
|
||||
static int esp32_interrupt_dma(int cpuint, void *context, FAR void *arg);
|
||||
static int esp32_interrupt_dma(int cpuint, void *context, void *arg);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -1178,7 +1178,7 @@ static void dma_attach(uint8_t dma_chan)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_interrupt_dma(int irq, void *context, FAR void *arg)
|
||||
static int esp32_interrupt_dma(int irq, void *context, void *arg)
|
||||
{
|
||||
uint32_t value;
|
||||
uint32_t status;
|
||||
@ -1315,7 +1315,7 @@ static void dma_config(uint8_t dma_chan)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_interrupt(int cpuint, void *context, FAR void *arg)
|
||||
static int esp32_interrupt(int cpuint, void *context, void *arg)
|
||||
{
|
||||
struct uart_dev_s *dev = (struct uart_dev_s *)arg;
|
||||
struct esp32_dev_s *priv;
|
||||
|
@ -64,8 +64,8 @@ extern uint32_t g_cpu1_idlestack[CPU1_IDLETHREAD_STACKWORDS];
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_fromcpu0_interrupt(int irq, FAR void *context, FAR void *arg);
|
||||
int esp32_fromcpu1_interrupt(int irq, FAR void *context, FAR void *arg);
|
||||
int esp32_fromcpu0_interrupt(int irq, void *context, void *arg);
|
||||
int esp32_fromcpu1_interrupt(int irq, void *context, void *arg);
|
||||
|
||||
#endif /* CONFIG_SMP */
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32_ESP32_SMP_H */
|
||||
|
@ -168,37 +168,37 @@ struct esp32_spi_priv_s
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_spi_lock(FAR struct spi_dev_s *dev, bool lock);
|
||||
static int esp32_spi_lock(struct spi_dev_s *dev, bool lock);
|
||||
#ifndef CONFIG_ESP32_SPI_UDCS
|
||||
static void esp32_spi_select(FAR struct spi_dev_s *dev,
|
||||
static void esp32_spi_select(struct spi_dev_s *dev,
|
||||
uint32_t devid, bool selected);
|
||||
#endif
|
||||
static uint32_t esp32_spi_setfrequency(FAR struct spi_dev_s *dev,
|
||||
static uint32_t esp32_spi_setfrequency(struct spi_dev_s *dev,
|
||||
uint32_t frequency);
|
||||
static void esp32_spi_setmode(FAR struct spi_dev_s *dev,
|
||||
static void esp32_spi_setmode(struct spi_dev_s *dev,
|
||||
enum spi_mode_e mode);
|
||||
static void esp32_spi_setbits(FAR struct spi_dev_s *dev, int nbits);
|
||||
static void esp32_spi_setbits(struct spi_dev_s *dev, int nbits);
|
||||
#ifdef CONFIG_SPI_HWFEATURES
|
||||
static int esp32_spi_hwfeatures(FAR struct spi_dev_s *dev,
|
||||
static int esp32_spi_hwfeatures(struct spi_dev_s *dev,
|
||||
spi_hwfeatures_t features);
|
||||
#endif
|
||||
static uint32_t esp32_spi_send(FAR struct spi_dev_s *dev, uint32_t wd);
|
||||
static void esp32_spi_exchange(FAR struct spi_dev_s *dev,
|
||||
FAR const void *txbuffer,
|
||||
FAR void *rxbuffer, size_t nwords);
|
||||
static uint32_t esp32_spi_send(struct spi_dev_s *dev, uint32_t wd);
|
||||
static void esp32_spi_exchange(struct spi_dev_s *dev,
|
||||
const void *txbuffer,
|
||||
void *rxbuffer, size_t nwords);
|
||||
#ifndef CONFIG_SPI_EXCHANGE
|
||||
static void esp32_spi_sndblock(FAR struct spi_dev_s *dev,
|
||||
FAR const void *txbuffer,
|
||||
static void esp32_spi_sndblock(struct spi_dev_s *dev,
|
||||
const void *txbuffer,
|
||||
size_t nwords);
|
||||
static void esp32_spi_recvblock(FAR struct spi_dev_s *dev,
|
||||
FAR void *rxbuffer,
|
||||
static void esp32_spi_recvblock(struct spi_dev_s *dev,
|
||||
void *rxbuffer,
|
||||
size_t nwords);
|
||||
#endif
|
||||
#ifdef CONFIG_SPI_TRIGGER
|
||||
static int esp32_spi_trigger(FAR struct spi_dev_s *dev);
|
||||
static int esp32_spi_trigger(struct spi_dev_s *dev);
|
||||
#endif
|
||||
static void esp32_spi_init(FAR struct spi_dev_s *dev);
|
||||
static void esp32_spi_deinit(FAR struct spi_dev_s *dev);
|
||||
static void esp32_spi_init(struct spi_dev_s *dev);
|
||||
static void esp32_spi_deinit(struct spi_dev_s *dev);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@ -467,10 +467,10 @@ static inline bool esp32_spi_iomux(struct esp32_spi_priv_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_spi_lock(FAR struct spi_dev_s *dev, bool lock)
|
||||
static int esp32_spi_lock(struct spi_dev_s *dev, bool lock)
|
||||
{
|
||||
int ret;
|
||||
FAR struct esp32_spi_priv_s *priv = (FAR struct esp32_spi_priv_s *)dev;
|
||||
struct esp32_spi_priv_s *priv = (struct esp32_spi_priv_s *)dev;
|
||||
|
||||
if (lock)
|
||||
{
|
||||
@ -492,7 +492,7 @@ static int esp32_spi_lock(FAR struct spi_dev_s *dev, bool lock)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_spi_sem_waitdone(FAR struct esp32_spi_priv_s *priv)
|
||||
static int esp32_spi_sem_waitdone(struct esp32_spi_priv_s *priv)
|
||||
{
|
||||
int ret;
|
||||
struct timespec abstime;
|
||||
@ -531,11 +531,11 @@ static int esp32_spi_sem_waitdone(FAR struct esp32_spi_priv_s *priv)
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_ESP32_SPI_UDCS
|
||||
static void esp32_spi_select(FAR struct spi_dev_s *dev,
|
||||
static void esp32_spi_select(struct spi_dev_s *dev,
|
||||
uint32_t devid, bool selected)
|
||||
{
|
||||
#ifdef CONFIG_ESP32_SPI_SWCS
|
||||
FAR struct esp32_spi_priv_s *priv = (FAR struct esp32_spi_priv_s *)dev;
|
||||
struct esp32_spi_priv_s *priv = (struct esp32_spi_priv_s *)dev;
|
||||
bool value = selected ? false : true;
|
||||
|
||||
esp32_gpiowrite(priv->config->cs_pin, value);
|
||||
@ -561,11 +561,11 @@ static void esp32_spi_select(FAR struct spi_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static uint32_t esp32_spi_setfrequency(FAR struct spi_dev_s *dev,
|
||||
static uint32_t esp32_spi_setfrequency(struct spi_dev_s *dev,
|
||||
uint32_t frequency)
|
||||
{
|
||||
uint32_t reg_val;
|
||||
FAR struct esp32_spi_priv_s *priv = (FAR struct esp32_spi_priv_s *)dev;
|
||||
struct esp32_spi_priv_s *priv = (struct esp32_spi_priv_s *)dev;
|
||||
const uint32_t duty_cycle = 128;
|
||||
|
||||
if (priv->frequency == frequency)
|
||||
@ -655,13 +655,13 @@ static uint32_t esp32_spi_setfrequency(FAR struct spi_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_spi_setmode(FAR struct spi_dev_s *dev,
|
||||
static void esp32_spi_setmode(struct spi_dev_s *dev,
|
||||
enum spi_mode_e mode)
|
||||
{
|
||||
uint32_t ck_idle_edge;
|
||||
uint32_t ck_out_edge;
|
||||
uint32_t delay_mode;
|
||||
FAR struct esp32_spi_priv_s *priv = (FAR struct esp32_spi_priv_s *)dev;
|
||||
struct esp32_spi_priv_s *priv = (struct esp32_spi_priv_s *)dev;
|
||||
|
||||
spiinfo("mode=%d\n", mode);
|
||||
|
||||
@ -737,9 +737,9 @@ static void esp32_spi_setmode(FAR struct spi_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_spi_setbits(FAR struct spi_dev_s *dev, int nbits)
|
||||
static void esp32_spi_setbits(struct spi_dev_s *dev, int nbits)
|
||||
{
|
||||
FAR struct esp32_spi_priv_s *priv = (FAR struct esp32_spi_priv_s *)dev;
|
||||
struct esp32_spi_priv_s *priv = (struct esp32_spi_priv_s *)dev;
|
||||
|
||||
spiinfo("nbits=%d\n", nbits);
|
||||
|
||||
@ -763,7 +763,7 @@ static void esp32_spi_setbits(FAR struct spi_dev_s *dev, int nbits)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SPI_HWFEATURES
|
||||
static int esp32_spi_hwfeatures(FAR struct spi_dev_s *dev,
|
||||
static int esp32_spi_hwfeatures(struct spi_dev_s *dev,
|
||||
spi_hwfeatures_t features)
|
||||
{
|
||||
/* Other H/W features are not supported */
|
||||
@ -793,9 +793,9 @@ static int esp32_spi_hwfeatures(FAR struct spi_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_spi_dma_exchange(FAR struct esp32_spi_priv_s *priv,
|
||||
FAR const void *txbuffer,
|
||||
FAR void *rxbuffer,
|
||||
static void esp32_spi_dma_exchange(struct esp32_spi_priv_s *priv,
|
||||
const void *txbuffer,
|
||||
void *rxbuffer,
|
||||
uint32_t nwords)
|
||||
{
|
||||
const uint32_t total = nwords * (priv->nbits / 8);
|
||||
@ -947,7 +947,7 @@ static void esp32_spi_dma_exchange(FAR struct esp32_spi_priv_s *priv,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static uint32_t esp32_spi_poll_send(FAR struct esp32_spi_priv_s *priv,
|
||||
static uint32_t esp32_spi_poll_send(struct esp32_spi_priv_s *priv,
|
||||
uint32_t wd)
|
||||
{
|
||||
uint32_t val;
|
||||
@ -991,9 +991,9 @@ static uint32_t esp32_spi_poll_send(FAR struct esp32_spi_priv_s *priv,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static uint32_t esp32_spi_send(FAR struct spi_dev_s *dev, uint32_t wd)
|
||||
static uint32_t esp32_spi_send(struct spi_dev_s *dev, uint32_t wd)
|
||||
{
|
||||
FAR struct esp32_spi_priv_s *priv = (FAR struct esp32_spi_priv_s *)dev;
|
||||
struct esp32_spi_priv_s *priv = (struct esp32_spi_priv_s *)dev;
|
||||
|
||||
return esp32_spi_poll_send(priv, wd);
|
||||
}
|
||||
@ -1019,9 +1019,9 @@ static uint32_t esp32_spi_send(FAR struct spi_dev_s *dev, uint32_t wd)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_spi_poll_exchange(FAR struct esp32_spi_priv_s *priv,
|
||||
FAR const void *txbuffer,
|
||||
FAR void *rxbuffer,
|
||||
static void esp32_spi_poll_exchange(struct esp32_spi_priv_s *priv,
|
||||
const void *txbuffer,
|
||||
void *rxbuffer,
|
||||
size_t nwords)
|
||||
{
|
||||
const uintptr_t spi_user_reg = SPI_USER_REG(priv->config->id);
|
||||
@ -1147,12 +1147,12 @@ static void esp32_spi_poll_exchange(FAR struct esp32_spi_priv_s *priv,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_spi_exchange(FAR struct spi_dev_s *dev,
|
||||
FAR const void *txbuffer,
|
||||
FAR void *rxbuffer,
|
||||
static void esp32_spi_exchange(struct spi_dev_s *dev,
|
||||
const void *txbuffer,
|
||||
void *rxbuffer,
|
||||
size_t nwords)
|
||||
{
|
||||
FAR struct esp32_spi_priv_s *priv = (FAR struct esp32_spi_priv_s *)dev;
|
||||
struct esp32_spi_priv_s *priv = (struct esp32_spi_priv_s *)dev;
|
||||
|
||||
#ifdef CONFIG_ESP32_SPI_DMATHRESHOLD
|
||||
size_t thld = CONFIG_ESP32_SPI_DMATHRESHOLD;
|
||||
@ -1192,8 +1192,8 @@ static void esp32_spi_exchange(FAR struct spi_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_spi_sndblock(FAR struct spi_dev_s *dev,
|
||||
FAR const void *txbuffer,
|
||||
static void esp32_spi_sndblock(struct spi_dev_s *dev,
|
||||
const void *txbuffer,
|
||||
size_t nwords)
|
||||
{
|
||||
spiinfo("txbuffer=%p nwords=%d\n", txbuffer, nwords);
|
||||
@ -1221,8 +1221,8 @@ static void esp32_spi_sndblock(FAR struct spi_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_spi_recvblock(FAR struct spi_dev_s *dev,
|
||||
FAR void *rxbuffer,
|
||||
static void esp32_spi_recvblock(struct spi_dev_s *dev,
|
||||
void *rxbuffer,
|
||||
size_t nwords)
|
||||
{
|
||||
spiinfo("rxbuffer=%p nwords=%d\n", rxbuffer, nwords);
|
||||
@ -1248,7 +1248,7 @@ static void esp32_spi_recvblock(FAR struct spi_dev_s *dev,
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SPI_TRIGGER
|
||||
static int esp32_spi_trigger(FAR struct spi_dev_s *dev)
|
||||
static int esp32_spi_trigger(struct spi_dev_s *dev)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
@ -1268,9 +1268,9 @@ static int esp32_spi_trigger(FAR struct spi_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_spi_init(FAR struct spi_dev_s *dev)
|
||||
static void esp32_spi_init(struct spi_dev_s *dev)
|
||||
{
|
||||
FAR struct esp32_spi_priv_s *priv = (FAR struct esp32_spi_priv_s *)dev;
|
||||
struct esp32_spi_priv_s *priv = (struct esp32_spi_priv_s *)dev;
|
||||
const struct esp32_spi_config_s *config = priv->config;
|
||||
uint32_t regval;
|
||||
|
||||
@ -1372,9 +1372,9 @@ static void esp32_spi_init(FAR struct spi_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_spi_deinit(FAR struct spi_dev_s *dev)
|
||||
static void esp32_spi_deinit(struct spi_dev_s *dev)
|
||||
{
|
||||
FAR struct esp32_spi_priv_s *priv = (FAR struct esp32_spi_priv_s *)dev;
|
||||
struct esp32_spi_priv_s *priv = (struct esp32_spi_priv_s *)dev;
|
||||
|
||||
if (priv->config->use_dma)
|
||||
{
|
||||
@ -1404,9 +1404,9 @@ static void esp32_spi_deinit(FAR struct spi_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_spi_interrupt(int irq, void *context, FAR void *arg)
|
||||
static int esp32_spi_interrupt(int irq, void *context, void *arg)
|
||||
{
|
||||
FAR struct esp32_spi_priv_s *priv = (FAR struct esp32_spi_priv_s *)arg;
|
||||
struct esp32_spi_priv_s *priv = (struct esp32_spi_priv_s *)arg;
|
||||
|
||||
esp32_spi_reset_regbits(SPI_SLAVE_REG(priv->config->id), SPI_TRANS_DONE_M);
|
||||
nxsem_post(&priv->sem_isr);
|
||||
@ -1428,11 +1428,11 @@ static int esp32_spi_interrupt(int irq, void *context, FAR void *arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct spi_dev_s *esp32_spibus_initialize(int port)
|
||||
struct spi_dev_s *esp32_spibus_initialize(int port)
|
||||
{
|
||||
int ret;
|
||||
FAR struct spi_dev_s *spi_dev;
|
||||
FAR struct esp32_spi_priv_s *priv;
|
||||
struct spi_dev_s *spi_dev;
|
||||
struct esp32_spi_priv_s *priv;
|
||||
irqstate_t flags;
|
||||
|
||||
switch (port)
|
||||
@ -1451,7 +1451,7 @@ FAR struct spi_dev_s *esp32_spibus_initialize(int port)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
spi_dev = (FAR struct spi_dev_s *)priv;
|
||||
spi_dev = (struct spi_dev_s *)priv;
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
@ -1505,10 +1505,10 @@ FAR struct spi_dev_s *esp32_spibus_initialize(int port)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_spibus_uninitialize(FAR struct spi_dev_s *dev)
|
||||
int esp32_spibus_uninitialize(struct spi_dev_s *dev)
|
||||
{
|
||||
irqstate_t flags;
|
||||
FAR struct esp32_spi_priv_s *priv = (FAR struct esp32_spi_priv_s *)dev;
|
||||
struct esp32_spi_priv_s *priv = (struct esp32_spi_priv_s *)dev;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
|
@ -72,7 +72,7 @@ extern "C"
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct spi_dev_s *esp32_spibus_initialize(int port);
|
||||
struct spi_dev_s *esp32_spibus_initialize(int port);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32_spi0/1/...select and esp32_spi0/1/...status
|
||||
@ -105,17 +105,17 @@ FAR struct spi_dev_s *esp32_spibus_initialize(int port);
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESP32_SPI2
|
||||
void esp32_spi2_select(FAR struct spi_dev_s *dev, uint32_t devid,
|
||||
void esp32_spi2_select(struct spi_dev_s *dev, uint32_t devid,
|
||||
bool selected);
|
||||
uint8_t esp32_spi2_status(FAR struct spi_dev_s *dev, uint32_t devid);
|
||||
int esp32_spi2_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
|
||||
uint8_t esp32_spi2_status(struct spi_dev_s *dev, uint32_t devid);
|
||||
int esp32_spi2_cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32_SPI3
|
||||
void esp32_spi3_select(FAR struct spi_dev_s *dev, uint32_t devid,
|
||||
void esp32_spi3_select(struct spi_dev_s *dev, uint32_t devid,
|
||||
bool selected);
|
||||
uint8_t esp32_spi3_status(FAR struct spi_dev_s *dev, uint32_t devid);
|
||||
int esp32_spi3_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
|
||||
uint8_t esp32_spi3_status(struct spi_dev_s *dev, uint32_t devid);
|
||||
int esp32_spi3_cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -126,7 +126,7 @@ int esp32_spi3_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_spibus_uninitialize(FAR struct spi_dev_s *dev);
|
||||
int esp32_spibus_uninitialize(struct spi_dev_s *dev);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32_spislv_ctrlr_initialize
|
||||
@ -142,7 +142,7 @@ int esp32_spibus_uninitialize(FAR struct spi_dev_s *dev);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct spi_slave_ctrlr_s *esp32_spislv_ctrlr_initialize(int port);
|
||||
struct spi_slave_ctrlr_s *esp32_spislv_ctrlr_initialize(int port);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32_spislv_ctrlr_uninitialize
|
||||
@ -158,7 +158,7 @@ FAR struct spi_slave_ctrlr_s *esp32_spislv_ctrlr_initialize(int port);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_spislv_ctrlr_uninitialize(FAR struct spi_slave_ctrlr_s *ctrlr);
|
||||
int esp32_spislv_ctrlr_uninitialize(struct spi_slave_ctrlr_s *ctrlr);
|
||||
|
||||
#endif /* CONFIG_ESP32_SPI */
|
||||
|
||||
|
@ -169,23 +169,23 @@ struct esp32_spislv_priv_s
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_spislv_setmode(FAR struct spi_slave_ctrlr_s *ctrlr,
|
||||
static void esp32_spislv_setmode(struct spi_slave_ctrlr_s *ctrlr,
|
||||
enum spi_mode_e mode);
|
||||
static void esp32_spislv_setbits(FAR struct spi_slave_ctrlr_s *ctrlr,
|
||||
static void esp32_spislv_setbits(struct spi_slave_ctrlr_s *ctrlr,
|
||||
int nbits);
|
||||
static int esp32_spislv_interrupt(int irq, void *context, FAR void *arg);
|
||||
static void esp32_spislv_initialize(FAR struct spi_slave_ctrlr_s *ctrlr);
|
||||
static int esp32_spislv_interrupt(int irq, void *context, void *arg);
|
||||
static void esp32_spislv_initialize(struct spi_slave_ctrlr_s *ctrlr);
|
||||
static void esp32_spislv_bind(struct spi_slave_ctrlr_s *ctrlr,
|
||||
struct spi_slave_dev_s *dev,
|
||||
enum spi_slave_mode_e mode,
|
||||
int nbits);
|
||||
static void esp32_spislv_unbind(struct spi_slave_ctrlr_s *ctrlr);
|
||||
static int esp32_spislv_enqueue(struct spi_slave_ctrlr_s *ctrlr,
|
||||
FAR const void *data,
|
||||
const void *data,
|
||||
size_t nwords);
|
||||
static bool esp32_spislv_qfull(struct spi_slave_ctrlr_s *ctrlr);
|
||||
static void esp32_spislv_qflush(struct spi_slave_ctrlr_s *ctrlr);
|
||||
static size_t esp32_spislv_qpoll(FAR struct spi_slave_ctrlr_s *ctrlr);
|
||||
static size_t esp32_spislv_qpoll(struct spi_slave_ctrlr_s *ctrlr);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@ -458,7 +458,7 @@ static inline bool esp32_spi_iomux(struct esp32_spislv_priv_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_spislv_setmode(FAR struct spi_slave_ctrlr_s *ctrlr,
|
||||
static void esp32_spislv_setmode(struct spi_slave_ctrlr_s *ctrlr,
|
||||
enum spi_mode_e mode)
|
||||
{
|
||||
uint32_t ck_idle_edge;
|
||||
@ -587,7 +587,7 @@ static void esp32_spislv_setmode(FAR struct spi_slave_ctrlr_s *ctrlr,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_spislv_setbits(FAR struct spi_slave_ctrlr_s *ctrlr,
|
||||
static void esp32_spislv_setbits(struct spi_slave_ctrlr_s *ctrlr,
|
||||
int nbits)
|
||||
{
|
||||
struct esp32_spislv_priv_s *priv = (struct esp32_spislv_priv_s *)ctrlr;
|
||||
@ -614,7 +614,7 @@ static void esp32_spislv_setbits(FAR struct spi_slave_ctrlr_s *ctrlr,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_io_interrupt(int irq, void *context, FAR void *arg)
|
||||
static int esp32_io_interrupt(int irq, void *context, void *arg)
|
||||
{
|
||||
struct esp32_spislv_priv_s *priv = (struct esp32_spislv_priv_s *)arg;
|
||||
|
||||
@ -755,7 +755,7 @@ static void esp32_spislv_rx(struct esp32_spislv_priv_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_spislv_interrupt(int irq, void *context, FAR void *arg)
|
||||
static int esp32_spislv_interrupt(int irq, void *context, void *arg)
|
||||
{
|
||||
struct esp32_spislv_priv_s *priv = (struct esp32_spislv_priv_s *)arg;
|
||||
uint32_t n;
|
||||
@ -846,7 +846,7 @@ static int esp32_spislv_interrupt(int irq, void *context, FAR void *arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_spislv_initialize(FAR struct spi_slave_ctrlr_s *ctrlr)
|
||||
static void esp32_spislv_initialize(struct spi_slave_ctrlr_s *ctrlr)
|
||||
{
|
||||
struct esp32_spislv_priv_s *priv = (struct esp32_spislv_priv_s *)ctrlr;
|
||||
const struct esp32_spislv_config_s *config = priv->config;
|
||||
@ -958,7 +958,7 @@ static void esp32_spislv_initialize(FAR struct spi_slave_ctrlr_s *ctrlr)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_spislv_deinit(FAR struct spi_slave_ctrlr_s *ctrlr)
|
||||
static void esp32_spislv_deinit(struct spi_slave_ctrlr_s *ctrlr)
|
||||
{
|
||||
struct esp32_spislv_priv_s *priv = (struct esp32_spislv_priv_s *)ctrlr;
|
||||
|
||||
@ -1101,7 +1101,7 @@ static void esp32_spislv_unbind(struct spi_slave_ctrlr_s *ctrlr)
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_spislv_enqueue(struct spi_slave_ctrlr_s *ctrlr,
|
||||
FAR const void *data,
|
||||
const void *data,
|
||||
size_t nwords)
|
||||
{
|
||||
struct esp32_spislv_priv_s *priv = (struct esp32_spislv_priv_s *)ctrlr;
|
||||
@ -1217,7 +1217,7 @@ static void esp32_spislv_qflush(struct spi_slave_ctrlr_s *ctrlr)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static size_t esp32_spislv_qpoll(FAR struct spi_slave_ctrlr_s *ctrlr)
|
||||
static size_t esp32_spislv_qpoll(struct spi_slave_ctrlr_s *ctrlr)
|
||||
{
|
||||
struct esp32_spislv_priv_s *priv = (struct esp32_spislv_priv_s *)ctrlr;
|
||||
irqstate_t flags;
|
||||
@ -1249,11 +1249,11 @@ static size_t esp32_spislv_qpoll(FAR struct spi_slave_ctrlr_s *ctrlr)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct spi_slave_ctrlr_s *esp32_spislv_ctrlr_initialize(int port)
|
||||
struct spi_slave_ctrlr_s *esp32_spislv_ctrlr_initialize(int port)
|
||||
{
|
||||
int ret;
|
||||
FAR struct spi_slave_ctrlr_s *spislv_dev;
|
||||
FAR struct esp32_spislv_priv_s *priv;
|
||||
struct spi_slave_ctrlr_s *spislv_dev;
|
||||
struct esp32_spislv_priv_s *priv;
|
||||
irqstate_t flags;
|
||||
|
||||
switch (port)
|
||||
@ -1272,7 +1272,7 @@ FAR struct spi_slave_ctrlr_s *esp32_spislv_ctrlr_initialize(int port)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
spislv_dev = (FAR struct spi_slave_ctrlr_s *)priv;
|
||||
spislv_dev = (struct spi_slave_ctrlr_s *)priv;
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
@ -1333,7 +1333,7 @@ FAR struct spi_slave_ctrlr_s *esp32_spislv_ctrlr_initialize(int port)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_spislv_ctrlr_uninitialize(FAR struct spi_slave_ctrlr_s *ctrlr)
|
||||
int esp32_spislv_ctrlr_uninitialize(struct spi_slave_ctrlr_s *ctrlr)
|
||||
{
|
||||
irqstate_t flags;
|
||||
struct esp32_spislv_priv_s *priv = (struct esp32_spislv_priv_s *)ctrlr;
|
||||
|
@ -71,7 +71,7 @@
|
||||
#define SPI_FLASH_ENCRYPT_WORDS (32 / 4)
|
||||
#define SPI_FLASH_ERASED_STATE (0xff)
|
||||
|
||||
#define MTD2PRIV(_dev) ((FAR struct esp32_spiflash_s *)_dev)
|
||||
#define MTD2PRIV(_dev) ((struct esp32_spiflash_s *)_dev)
|
||||
#define MTD_SIZE(_priv) ((_priv)->chip->chip_size)
|
||||
#define MTD_BLKSIZE(_priv) ((_priv)->chip->page_size)
|
||||
#define MTD_ERASESIZE(_priv) ((_priv)->chip->sector_size)
|
||||
@ -192,63 +192,63 @@ static inline void spi_reset_regbits(struct esp32_spiflash_s *priv,
|
||||
/* Misc. helpers */
|
||||
|
||||
static inline void IRAM_ATTR
|
||||
esp32_spiflash_opstart(FAR struct spiflash_cachestate_s *state);
|
||||
esp32_spiflash_opstart(struct spiflash_cachestate_s *state);
|
||||
static inline void IRAM_ATTR
|
||||
esp32_spiflash_opdone(FAR const struct spiflash_cachestate_s *state);
|
||||
esp32_spiflash_opdone(const struct spiflash_cachestate_s *state);
|
||||
|
||||
static bool IRAM_ATTR spiflash_pagecached(uint32_t phypage);
|
||||
static void IRAM_ATTR spiflash_flushmapped(size_t start, size_t size);
|
||||
|
||||
/* Flash helpers */
|
||||
|
||||
static void IRAM_ATTR esp32_set_read_opt(FAR struct esp32_spiflash_s *priv);
|
||||
static void IRAM_ATTR esp32_set_read_opt(struct esp32_spiflash_s *priv);
|
||||
static void IRAM_ATTR esp32_set_write_opt(struct esp32_spiflash_s *priv);
|
||||
static int IRAM_ATTR esp32_read_status(FAR struct esp32_spiflash_s *priv,
|
||||
static int IRAM_ATTR esp32_read_status(struct esp32_spiflash_s *priv,
|
||||
uint32_t *status);
|
||||
static int IRAM_ATTR esp32_wait_idle(FAR struct esp32_spiflash_s *priv);
|
||||
static int IRAM_ATTR esp32_enable_write(FAR struct esp32_spiflash_s *priv);
|
||||
static int IRAM_ATTR esp32_erasesector(FAR struct esp32_spiflash_s *priv,
|
||||
static int IRAM_ATTR esp32_wait_idle(struct esp32_spiflash_s *priv);
|
||||
static int IRAM_ATTR esp32_enable_write(struct esp32_spiflash_s *priv);
|
||||
static int IRAM_ATTR esp32_erasesector(struct esp32_spiflash_s *priv,
|
||||
uint32_t addr, uint32_t size);
|
||||
static int IRAM_ATTR esp32_writedata(FAR struct esp32_spiflash_s *priv,
|
||||
static int IRAM_ATTR esp32_writedata(struct esp32_spiflash_s *priv,
|
||||
uint32_t addr,
|
||||
const uint8_t *buffer, uint32_t size);
|
||||
static int IRAM_ATTR esp32_readdata(FAR struct esp32_spiflash_s *priv,
|
||||
static int IRAM_ATTR esp32_readdata(struct esp32_spiflash_s *priv,
|
||||
uint32_t addr,
|
||||
uint8_t *buffer, uint32_t size);
|
||||
#if 0
|
||||
static int esp32_read_highstatus(FAR struct esp32_spiflash_s *priv,
|
||||
static int esp32_read_highstatus(struct esp32_spiflash_s *priv,
|
||||
uint32_t *status);
|
||||
#endif
|
||||
#if 0
|
||||
static int esp32_write_status(FAR struct esp32_spiflash_s *priv,
|
||||
static int esp32_write_status(struct esp32_spiflash_s *priv,
|
||||
uint32_t status);
|
||||
#endif
|
||||
|
||||
/* MTD driver methods */
|
||||
|
||||
static int esp32_erase(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
static int esp32_erase(struct mtd_dev_s *dev, off_t startblock,
|
||||
size_t nblocks);
|
||||
static ssize_t esp32_read(FAR struct mtd_dev_s *dev, off_t offset,
|
||||
size_t nbytes, FAR uint8_t *buffer);
|
||||
static ssize_t esp32_read_decrypt(FAR struct mtd_dev_s *dev,
|
||||
static ssize_t esp32_read(struct mtd_dev_s *dev, off_t offset,
|
||||
size_t nbytes, uint8_t *buffer);
|
||||
static ssize_t esp32_read_decrypt(struct mtd_dev_s *dev,
|
||||
off_t offset,
|
||||
size_t nbytes,
|
||||
FAR uint8_t *buffer);
|
||||
static ssize_t esp32_bread(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
size_t nblocks, FAR uint8_t *buffer);
|
||||
static ssize_t esp32_bread_decrypt(FAR struct mtd_dev_s *dev,
|
||||
uint8_t *buffer);
|
||||
static ssize_t esp32_bread(struct mtd_dev_s *dev, off_t startblock,
|
||||
size_t nblocks, uint8_t *buffer);
|
||||
static ssize_t esp32_bread_decrypt(struct mtd_dev_s *dev,
|
||||
off_t startblock,
|
||||
size_t nblocks,
|
||||
FAR uint8_t *buffer);
|
||||
static ssize_t esp32_write(FAR struct mtd_dev_s *dev, off_t offset,
|
||||
size_t nbytes, FAR const uint8_t *buffer);
|
||||
static ssize_t esp32_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
size_t nblocks, FAR const uint8_t *buffer);
|
||||
static ssize_t esp32_bwrite_encrypt(FAR struct mtd_dev_s *dev,
|
||||
uint8_t *buffer);
|
||||
static ssize_t esp32_write(struct mtd_dev_s *dev, off_t offset,
|
||||
size_t nbytes, const uint8_t *buffer);
|
||||
static ssize_t esp32_bwrite(struct mtd_dev_s *dev, off_t startblock,
|
||||
size_t nblocks, const uint8_t *buffer);
|
||||
static ssize_t esp32_bwrite_encrypt(struct mtd_dev_s *dev,
|
||||
off_t startblock,
|
||||
size_t nblocks,
|
||||
FAR const uint8_t *buffer);
|
||||
static int esp32_ioctl(FAR struct mtd_dev_s *dev, int cmd,
|
||||
const uint8_t *buffer);
|
||||
static int esp32_ioctl(struct mtd_dev_s *dev, int cmd,
|
||||
unsigned long arg);
|
||||
|
||||
/****************************************************************************
|
||||
@ -406,7 +406,7 @@ static inline void spi_reset_regbits(struct esp32_spiflash_s *priv,
|
||||
****************************************************************************/
|
||||
|
||||
static inline void IRAM_ATTR
|
||||
esp32_spiflash_opstart(FAR struct spiflash_cachestate_s *state)
|
||||
esp32_spiflash_opstart(struct spiflash_cachestate_s *state)
|
||||
{
|
||||
#ifdef CONFIG_SMP
|
||||
int other;
|
||||
@ -439,7 +439,7 @@ static inline void IRAM_ATTR
|
||||
****************************************************************************/
|
||||
|
||||
static inline void IRAM_ATTR
|
||||
esp32_spiflash_opdone(FAR const struct spiflash_cachestate_s *state)
|
||||
esp32_spiflash_opdone(const struct spiflash_cachestate_s *state)
|
||||
{
|
||||
#ifdef CONFIG_SMP
|
||||
int other;
|
||||
@ -558,7 +558,7 @@ static void IRAM_ATTR spiflash_flushmapped(size_t start, size_t size)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void IRAM_ATTR esp32_set_read_opt(FAR struct esp32_spiflash_s *priv)
|
||||
static void IRAM_ATTR esp32_set_read_opt(struct esp32_spiflash_s *priv)
|
||||
{
|
||||
uint32_t regval;
|
||||
uint32_t ctrl;
|
||||
@ -698,7 +698,7 @@ static void IRAM_ATTR esp32_set_write_opt(struct esp32_spiflash_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int IRAM_ATTR esp32_read_status(FAR struct esp32_spiflash_s *priv,
|
||||
static int IRAM_ATTR esp32_read_status(struct esp32_spiflash_s *priv,
|
||||
uint32_t *status)
|
||||
{
|
||||
esp32_spiflash_chip_t *chip = priv->chip;
|
||||
@ -752,7 +752,7 @@ static int IRAM_ATTR esp32_read_status(FAR struct esp32_spiflash_s *priv,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int IRAM_ATTR esp32_wait_idle(FAR struct esp32_spiflash_s *priv)
|
||||
static int IRAM_ATTR esp32_wait_idle(struct esp32_spiflash_s *priv)
|
||||
{
|
||||
uint32_t status;
|
||||
|
||||
@ -790,7 +790,7 @@ static int IRAM_ATTR esp32_wait_idle(FAR struct esp32_spiflash_s *priv)
|
||||
****************************************************************************/
|
||||
|
||||
#if 0
|
||||
static int esp32_read_highstatus(FAR struct esp32_spiflash_s *priv,
|
||||
static int esp32_read_highstatus(struct esp32_spiflash_s *priv,
|
||||
uint32_t *status)
|
||||
{
|
||||
uint32_t regval;
|
||||
@ -827,7 +827,7 @@ static int esp32_read_highstatus(FAR struct esp32_spiflash_s *priv,
|
||||
****************************************************************************/
|
||||
|
||||
#if 0
|
||||
static int esp32_write_status(FAR struct esp32_spiflash_s *priv,
|
||||
static int esp32_write_status(struct esp32_spiflash_s *priv,
|
||||
uint32_t status)
|
||||
{
|
||||
if (esp32_wait_idle(priv))
|
||||
@ -865,7 +865,7 @@ static int esp32_write_status(FAR struct esp32_spiflash_s *priv,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int IRAM_ATTR esp32_enable_write(FAR struct esp32_spiflash_s *priv)
|
||||
static int IRAM_ATTR esp32_enable_write(struct esp32_spiflash_s *priv)
|
||||
{
|
||||
uint32_t flags;
|
||||
uint32_t regval;
|
||||
@ -911,7 +911,7 @@ static int IRAM_ATTR esp32_enable_write(FAR struct esp32_spiflash_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int IRAM_ATTR esp32_erasesector(FAR struct esp32_spiflash_s *priv,
|
||||
static int IRAM_ATTR esp32_erasesector(struct esp32_spiflash_s *priv,
|
||||
uint32_t addr, uint32_t size)
|
||||
{
|
||||
uint32_t offset;
|
||||
@ -976,7 +976,7 @@ static int IRAM_ATTR esp32_erasesector(FAR struct esp32_spiflash_s *priv,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int IRAM_ATTR esp32_writeonce(FAR struct esp32_spiflash_s *priv,
|
||||
static int IRAM_ATTR esp32_writeonce(struct esp32_spiflash_s *priv,
|
||||
uint32_t addr,
|
||||
const uint32_t *buffer,
|
||||
uint32_t size)
|
||||
@ -1046,7 +1046,7 @@ static int IRAM_ATTR esp32_writeonce(FAR struct esp32_spiflash_s *priv,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int IRAM_ATTR esp32_writedata(FAR struct esp32_spiflash_s *priv,
|
||||
static int IRAM_ATTR esp32_writedata(struct esp32_spiflash_s *priv,
|
||||
uint32_t addr,
|
||||
const uint8_t *buffer,
|
||||
uint32_t size)
|
||||
@ -1114,7 +1114,7 @@ static int IRAM_ATTR esp32_writedata(FAR struct esp32_spiflash_s *priv,
|
||||
****************************************************************************/
|
||||
|
||||
static int IRAM_ATTR esp32_writedata_encrypted(
|
||||
FAR struct esp32_spiflash_s *priv,
|
||||
struct esp32_spiflash_s *priv,
|
||||
uint32_t addr,
|
||||
const uint8_t *buffer,
|
||||
uint32_t size)
|
||||
@ -1203,7 +1203,7 @@ exit:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int IRAM_ATTR esp32_readonce(FAR struct esp32_spiflash_s *priv,
|
||||
static int IRAM_ATTR esp32_readonce(struct esp32_spiflash_s *priv,
|
||||
uint32_t addr,
|
||||
uint32_t *buffer,
|
||||
uint32_t size)
|
||||
@ -1265,7 +1265,7 @@ static int IRAM_ATTR esp32_readonce(FAR struct esp32_spiflash_s *priv,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int IRAM_ATTR esp32_readdata(FAR struct esp32_spiflash_s *priv,
|
||||
static int IRAM_ATTR esp32_readdata(struct esp32_spiflash_s *priv,
|
||||
uint32_t addr,
|
||||
uint8_t *buffer,
|
||||
uint32_t size)
|
||||
@ -1318,7 +1318,7 @@ static int IRAM_ATTR esp32_readdata(FAR struct esp32_spiflash_s *priv,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int IRAM_ATTR esp32_mmap(FAR struct esp32_spiflash_s *priv,
|
||||
static int IRAM_ATTR esp32_mmap(struct esp32_spiflash_s *priv,
|
||||
struct spiflash_map_req *req)
|
||||
{
|
||||
int ret;
|
||||
@ -1402,7 +1402,7 @@ static int IRAM_ATTR esp32_mmap(FAR struct esp32_spiflash_s *priv,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void IRAM_ATTR esp32_ummap(FAR struct esp32_spiflash_s *priv,
|
||||
static void IRAM_ATTR esp32_ummap(struct esp32_spiflash_s *priv,
|
||||
const struct spiflash_map_req *req)
|
||||
{
|
||||
int i;
|
||||
@ -1447,7 +1447,7 @@ static void IRAM_ATTR esp32_ummap(FAR struct esp32_spiflash_s *priv,
|
||||
****************************************************************************/
|
||||
|
||||
static int IRAM_ATTR esp32_readdata_encrypted(
|
||||
FAR struct esp32_spiflash_s *priv,
|
||||
struct esp32_spiflash_s *priv,
|
||||
uint32_t addr,
|
||||
uint8_t *buffer,
|
||||
uint32_t size)
|
||||
@ -1488,11 +1488,11 @@ static int IRAM_ATTR esp32_readdata_encrypted(
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_erase(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
static int esp32_erase(struct mtd_dev_s *dev, off_t startblock,
|
||||
size_t nblocks)
|
||||
{
|
||||
int ret;
|
||||
FAR struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
uint32_t addr = startblock * MTD_ERASESIZE(priv);
|
||||
uint32_t size = nblocks * MTD_ERASESIZE(priv);
|
||||
|
||||
@ -1544,11 +1544,11 @@ static int esp32_erase(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t esp32_read(FAR struct mtd_dev_s *dev, off_t offset,
|
||||
size_t nbytes, FAR uint8_t *buffer)
|
||||
static ssize_t esp32_read(struct mtd_dev_s *dev, off_t offset,
|
||||
size_t nbytes, uint8_t *buffer)
|
||||
{
|
||||
int ret;
|
||||
FAR struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
|
||||
#ifdef CONFIG_ESP32_SPIFLASH_DEBUG
|
||||
finfo("esp32_read(%p, 0x%x, %d, %p)\n", dev, offset, nbytes, buffer);
|
||||
@ -1598,11 +1598,11 @@ error_with_buffer:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t esp32_bread(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
size_t nblocks, FAR uint8_t *buffer)
|
||||
static ssize_t esp32_bread(struct mtd_dev_s *dev, off_t startblock,
|
||||
size_t nblocks, uint8_t *buffer)
|
||||
{
|
||||
int ret;
|
||||
FAR struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
uint32_t addr = MTD_BLK2SIZE(priv, startblock);
|
||||
uint32_t size = MTD_BLK2SIZE(priv, nblocks);
|
||||
|
||||
@ -1642,14 +1642,14 @@ static ssize_t esp32_bread(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t esp32_read_decrypt(FAR struct mtd_dev_s *dev,
|
||||
static ssize_t esp32_read_decrypt(struct mtd_dev_s *dev,
|
||||
off_t offset,
|
||||
size_t nbytes,
|
||||
FAR uint8_t *buffer)
|
||||
uint8_t *buffer)
|
||||
{
|
||||
int ret;
|
||||
uint8_t *tmpbuff = buffer;
|
||||
FAR struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
|
||||
#ifdef CONFIG_ESP32_SPIFLASH_DEBUG
|
||||
finfo("esp32_read_decrypt(%p, 0x%x, %d, %p)\n",
|
||||
@ -1699,13 +1699,13 @@ error_with_buffer:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t esp32_bread_decrypt(FAR struct mtd_dev_s *dev,
|
||||
static ssize_t esp32_bread_decrypt(struct mtd_dev_s *dev,
|
||||
off_t startblock,
|
||||
size_t nblocks,
|
||||
FAR uint8_t *buffer)
|
||||
uint8_t *buffer)
|
||||
{
|
||||
int ret;
|
||||
FAR struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
uint32_t addr = MTD_BLK2SIZE(priv, startblock);
|
||||
uint32_t size = MTD_BLK2SIZE(priv, nblocks);
|
||||
|
||||
@ -1744,11 +1744,11 @@ static ssize_t esp32_bread_decrypt(FAR struct mtd_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t esp32_write(FAR struct mtd_dev_s *dev, off_t offset,
|
||||
size_t nbytes, FAR const uint8_t *buffer)
|
||||
static ssize_t esp32_write(struct mtd_dev_s *dev, off_t offset,
|
||||
size_t nbytes, const uint8_t *buffer)
|
||||
{
|
||||
int ret;
|
||||
FAR struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
|
||||
ASSERT(buffer);
|
||||
|
||||
@ -1805,11 +1805,11 @@ error_with_buffer:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t esp32_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
size_t nblocks, FAR const uint8_t *buffer)
|
||||
static ssize_t esp32_bwrite(struct mtd_dev_s *dev, off_t startblock,
|
||||
size_t nblocks, const uint8_t *buffer)
|
||||
{
|
||||
ssize_t ret;
|
||||
FAR struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
uint32_t addr = MTD_BLK2SIZE(priv, startblock);
|
||||
uint32_t size = MTD_BLK2SIZE(priv, nblocks);
|
||||
|
||||
@ -1849,13 +1849,13 @@ static ssize_t esp32_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t esp32_bwrite_encrypt(FAR struct mtd_dev_s *dev,
|
||||
static ssize_t esp32_bwrite_encrypt(struct mtd_dev_s *dev,
|
||||
off_t startblock,
|
||||
size_t nblocks,
|
||||
FAR const uint8_t *buffer)
|
||||
const uint8_t *buffer)
|
||||
{
|
||||
ssize_t ret;
|
||||
FAR struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
uint32_t addr = MTD_BLK2SIZE(priv, startblock);
|
||||
uint32_t size = MTD_BLK2SIZE(priv, nblocks);
|
||||
|
||||
@ -1904,11 +1904,11 @@ error_with_buffer:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_ioctl(FAR struct mtd_dev_s *dev, int cmd,
|
||||
static int esp32_ioctl(struct mtd_dev_s *dev, int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
FAR struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
struct esp32_spiflash_s *priv = MTD2PRIV(dev);
|
||||
|
||||
finfo("cmd: %d \n", cmd);
|
||||
|
||||
@ -1916,7 +1916,7 @@ static int esp32_ioctl(FAR struct mtd_dev_s *dev, int cmd,
|
||||
{
|
||||
case MTDIOC_GEOMETRY:
|
||||
{
|
||||
FAR struct mtd_geometry_s *geo = (FAR struct mtd_geometry_s *)arg;
|
||||
struct mtd_geometry_s *geo = (struct mtd_geometry_s *)arg;
|
||||
if (geo)
|
||||
{
|
||||
geo->blocksize = MTD_BLKSIZE(priv);
|
||||
@ -1932,8 +1932,8 @@ static int esp32_ioctl(FAR struct mtd_dev_s *dev, int cmd,
|
||||
|
||||
case BIOC_PARTINFO:
|
||||
{
|
||||
FAR struct partition_info_s *info =
|
||||
(FAR struct partition_info_s *)arg;
|
||||
struct partition_info_s *info =
|
||||
(struct partition_info_s *)arg;
|
||||
if (info != NULL)
|
||||
{
|
||||
info->numsectors = MTD_SIZE(priv) / MTD_BLKSIZE(priv);
|
||||
@ -1947,7 +1947,7 @@ static int esp32_ioctl(FAR struct mtd_dev_s *dev, int cmd,
|
||||
|
||||
case MTDIOC_ERASESTATE:
|
||||
{
|
||||
FAR uint8_t *result = (FAR uint8_t *)arg;
|
||||
uint8_t *result = (uint8_t *)arg;
|
||||
*result = SPI_FLASH_ERASED_STATE;
|
||||
|
||||
ret = OK;
|
||||
@ -1982,12 +1982,12 @@ static int esp32_ioctl(FAR struct mtd_dev_s *dev, int cmd,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct mtd_dev_s *esp32_spiflash_alloc_mtdpart(uint32_t mtd_offset,
|
||||
struct mtd_dev_s *esp32_spiflash_alloc_mtdpart(uint32_t mtd_offset,
|
||||
uint32_t mtd_size)
|
||||
{
|
||||
struct esp32_spiflash_s *priv = &g_esp32_spiflash1;
|
||||
esp32_spiflash_chip_t *chip = priv->chip;
|
||||
FAR struct mtd_dev_s *mtd_part;
|
||||
struct mtd_dev_s *mtd_part;
|
||||
uint32_t blocks;
|
||||
uint32_t startblock;
|
||||
uint32_t size;
|
||||
@ -2043,7 +2043,7 @@ FAR struct mtd_dev_s *esp32_spiflash_alloc_mtdpart(uint32_t mtd_offset,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct mtd_dev_s *esp32_spiflash_get_mtd(void)
|
||||
struct mtd_dev_s *esp32_spiflash_get_mtd(void)
|
||||
{
|
||||
struct esp32_spiflash_s *priv = &g_esp32_spiflash1;
|
||||
|
||||
@ -2064,7 +2064,7 @@ FAR struct mtd_dev_s *esp32_spiflash_get_mtd(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct mtd_dev_s *esp32_spiflash_encrypt_get_mtd(void)
|
||||
struct mtd_dev_s *esp32_spiflash_encrypt_get_mtd(void)
|
||||
{
|
||||
struct esp32_spiflash_s *priv = &g_esp32_spiflash1_encrypt;
|
||||
|
||||
|
@ -63,7 +63,7 @@ extern "C"
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct mtd_dev_s *esp32_spiflash_alloc_mtdpart(uint32_t mtd_offset,
|
||||
struct mtd_dev_s *esp32_spiflash_alloc_mtdpart(uint32_t mtd_offset,
|
||||
uint32_t mtd_size);
|
||||
|
||||
/****************************************************************************
|
||||
@ -80,7 +80,7 @@ FAR struct mtd_dev_s *esp32_spiflash_alloc_mtdpart(uint32_t mtd_offset,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct mtd_dev_s *esp32_spiflash_get_mtd(void);
|
||||
struct mtd_dev_s *esp32_spiflash_get_mtd(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32_spiflash_encrypt_get_mtd
|
||||
@ -96,7 +96,7 @@ FAR struct mtd_dev_s *esp32_spiflash_get_mtd(void);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct mtd_dev_s *esp32_spiflash_encrypt_get_mtd(void);
|
||||
struct mtd_dev_s *esp32_spiflash_encrypt_get_mtd(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -60,9 +60,9 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR void *up_textheap_memalign(size_t align, size_t size)
|
||||
void *up_textheap_memalign(size_t align, size_t size)
|
||||
{
|
||||
FAR void *ret = NULL;
|
||||
void *ret = NULL;
|
||||
|
||||
/* Prioritise allocating from RTC. If that fails, allocate from the
|
||||
* main heap.
|
||||
@ -88,7 +88,7 @@ FAR void *up_textheap_memalign(size_t align, size_t size)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_textheap_free(FAR void *p)
|
||||
void up_textheap_free(void *p)
|
||||
{
|
||||
if (p)
|
||||
{
|
||||
|
@ -27,10 +27,10 @@
|
||||
*
|
||||
* void up_timer_initialize(void): Initializes the timer facilities.
|
||||
* Called early in the initialization sequence (by up_initialize()).
|
||||
* int up_timer_gettime(FAR struct timespec *ts): Returns the current
|
||||
* int up_timer_gettime(struct timespec *ts): Returns the current
|
||||
* time from the platform specific time source.
|
||||
* int up_timer_cancel(void): Cancels the interval timer.
|
||||
* int up_timer_start(FAR const struct timespec *ts): Start (or re-starts)
|
||||
* int up_timer_start(const struct timespec *ts): Start (or re-starts)
|
||||
* the interval timer.
|
||||
*
|
||||
* The RTOS will provide the following interfaces for use by the platform-
|
||||
@ -92,7 +92,7 @@ static inline uint64_t up_tmr_total_count(void);
|
||||
static inline uint64_t up_tmr_getcount(void);
|
||||
static void IRAM_ATTR up_tmr_setcompare(uint32_t ticks);
|
||||
static void IRAM_ATTR up_tmr_setcount(uint64_t ticks);
|
||||
static int up_timer_expire(int irq, void *regs, FAR void *arg);
|
||||
static int up_timer_expire(int irq, void *regs, void *arg);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@ -234,7 +234,7 @@ static void IRAM_ATTR up_tmr_setcount(uint64_t ticks)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int up_timer_expire(int irq, void *regs, FAR void *arg)
|
||||
static int up_timer_expire(int irq, void *regs, void *arg)
|
||||
{
|
||||
irqstate_t flags;
|
||||
bool do_sched = false;
|
||||
@ -295,7 +295,7 @@ static int up_timer_expire(int irq, void *regs, FAR void *arg)
|
||||
* up_timer_initialize() was called). This function is functionally
|
||||
* equivalent to:
|
||||
*
|
||||
* int clock_gettime(clockid_t clockid, FAR struct timespec *ts);
|
||||
* int clock_gettime(clockid_t clockid, struct timespec *ts);
|
||||
*
|
||||
* when clockid is CLOCK_MONOTONIC.
|
||||
*
|
||||
@ -320,7 +320,7 @@ static int up_timer_expire(int irq, void *regs, FAR void *arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int IRAM_ATTR up_timer_gettime(FAR struct timespec *ts)
|
||||
int IRAM_ATTR up_timer_gettime(struct timespec *ts)
|
||||
{
|
||||
uint64_t ticks;
|
||||
irqstate_t flags;
|
||||
@ -371,7 +371,7 @@ int IRAM_ATTR up_timer_gettime(FAR struct timespec *ts)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int IRAM_ATTR up_timer_cancel(FAR struct timespec *ts)
|
||||
int IRAM_ATTR up_timer_cancel(struct timespec *ts)
|
||||
{
|
||||
uint64_t rst_ticks;
|
||||
uint64_t cur_ticks;
|
||||
@ -437,7 +437,7 @@ int IRAM_ATTR up_timer_cancel(FAR struct timespec *ts)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int IRAM_ATTR up_timer_start(FAR const struct timespec *ts)
|
||||
int IRAM_ATTR up_timer_start(const struct timespec *ts)
|
||||
{
|
||||
uint64_t cpu_ticks;
|
||||
irqstate_t flags;
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
struct esp32_tim_priv_s
|
||||
{
|
||||
FAR struct esp32_tim_ops_s *ops;
|
||||
struct esp32_tim_ops_s *ops;
|
||||
uint32_t base; /* Timer register base address */
|
||||
uint8_t periph; /* Peripheral ID */
|
||||
uint8_t irq; /* Interrupt ID */
|
||||
@ -59,12 +59,12 @@ struct esp32_tim_priv_s
|
||||
|
||||
/* TIM registers access *****************************************************/
|
||||
|
||||
static uint32_t esp32_tim_getreg(FAR struct esp32_tim_dev_s *dev,
|
||||
static uint32_t esp32_tim_getreg(struct esp32_tim_dev_s *dev,
|
||||
uint32_t offset);
|
||||
static void esp32_tim_putreg(FAR struct esp32_tim_dev_s *dev,
|
||||
static void esp32_tim_putreg(struct esp32_tim_dev_s *dev,
|
||||
uint32_t offset,
|
||||
uint32_t value);
|
||||
static void esp32_tim_modifyreg32(FAR struct esp32_tim_dev_s *dev,
|
||||
static void esp32_tim_modifyreg32(struct esp32_tim_dev_s *dev,
|
||||
uint32_t offset,
|
||||
uint32_t clearbits,
|
||||
uint32_t setbits);
|
||||
@ -73,29 +73,29 @@ static void esp32_tim_modifyreg32(FAR struct esp32_tim_dev_s *dev,
|
||||
|
||||
/* TIM operations ***********************************************************/
|
||||
|
||||
static void esp32_tim_start(FAR struct esp32_tim_dev_s *dev);
|
||||
static void esp32_tim_stop(FAR struct esp32_tim_dev_s *dev);
|
||||
static void esp32_tim_clear(FAR struct esp32_tim_dev_s *dev);
|
||||
static void esp32_tim_setmode(FAR struct esp32_tim_dev_s *dev, uint8_t mode);
|
||||
static void esp32_tim_setpre(FAR struct esp32_tim_dev_s *dev, uint16_t pre);
|
||||
static void esp32_tim_getcounter(FAR struct esp32_tim_dev_s *dev,
|
||||
static void esp32_tim_start(struct esp32_tim_dev_s *dev);
|
||||
static void esp32_tim_stop(struct esp32_tim_dev_s *dev);
|
||||
static void esp32_tim_clear(struct esp32_tim_dev_s *dev);
|
||||
static void esp32_tim_setmode(struct esp32_tim_dev_s *dev, uint8_t mode);
|
||||
static void esp32_tim_setpre(struct esp32_tim_dev_s *dev, uint16_t pre);
|
||||
static void esp32_tim_getcounter(struct esp32_tim_dev_s *dev,
|
||||
uint64_t *value);
|
||||
static void esp32_tim_setcounter(FAR struct esp32_tim_dev_s *dev,
|
||||
static void esp32_tim_setcounter(struct esp32_tim_dev_s *dev,
|
||||
uint64_t value);
|
||||
static void esp32_tim_reload_now(FAR struct esp32_tim_dev_s *dev);
|
||||
static void esp32_tim_getalarmvalue(FAR struct esp32_tim_dev_s *dev,
|
||||
static void esp32_tim_reload_now(struct esp32_tim_dev_s *dev);
|
||||
static void esp32_tim_getalarmvalue(struct esp32_tim_dev_s *dev,
|
||||
uint64_t *value);
|
||||
static void esp32_tim_setalarmvalue(FAR struct esp32_tim_dev_s *dev,
|
||||
static void esp32_tim_setalarmvalue(struct esp32_tim_dev_s *dev,
|
||||
uint64_t value);
|
||||
static void esp32_tim_setalarm(FAR struct esp32_tim_dev_s *dev, bool enable);
|
||||
static void esp32_tim_setautoreload(FAR struct esp32_tim_dev_s *dev,
|
||||
static void esp32_tim_setalarm(struct esp32_tim_dev_s *dev, bool enable);
|
||||
static void esp32_tim_setautoreload(struct esp32_tim_dev_s *dev,
|
||||
bool enable);
|
||||
static int esp32_tim_setisr(FAR struct esp32_tim_dev_s *dev, xcpt_t handler,
|
||||
FAR void * arg);
|
||||
static void esp32_tim_enableint(FAR struct esp32_tim_dev_s *dev);
|
||||
static void esp32_tim_disableint(FAR struct esp32_tim_dev_s *dev);
|
||||
static void esp32_tim_ackint(FAR struct esp32_tim_dev_s *dev);
|
||||
static int esp32_tim_checkint(FAR struct esp32_tim_dev_s *dev);
|
||||
static int esp32_tim_setisr(struct esp32_tim_dev_s *dev, xcpt_t handler,
|
||||
void * arg);
|
||||
static void esp32_tim_enableint(struct esp32_tim_dev_s *dev);
|
||||
static void esp32_tim_disableint(struct esp32_tim_dev_s *dev);
|
||||
static void esp32_tim_ackint(struct esp32_tim_dev_s *dev);
|
||||
static int esp32_tim_checkint(struct esp32_tim_dev_s *dev);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@ -200,7 +200,7 @@ struct esp32_tim_priv_s g_esp32_tim3_priv =
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static uint32_t esp32_tim_getreg(FAR struct esp32_tim_dev_s *dev,
|
||||
static uint32_t esp32_tim_getreg(struct esp32_tim_dev_s *dev,
|
||||
uint32_t offset)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
@ -216,7 +216,7 @@ static uint32_t esp32_tim_getreg(FAR struct esp32_tim_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_tim_putreg(FAR struct esp32_tim_dev_s *dev,
|
||||
static void esp32_tim_putreg(struct esp32_tim_dev_s *dev,
|
||||
uint32_t offset,
|
||||
uint32_t value)
|
||||
{
|
||||
@ -233,7 +233,7 @@ static void esp32_tim_putreg(FAR struct esp32_tim_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_tim_modifyreg32(FAR struct esp32_tim_dev_s *dev,
|
||||
static void esp32_tim_modifyreg32(struct esp32_tim_dev_s *dev,
|
||||
uint32_t offset,
|
||||
uint32_t clearbits,
|
||||
uint32_t setbits)
|
||||
@ -252,7 +252,7 @@ static void esp32_tim_modifyreg32(FAR struct esp32_tim_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_tim_start(FAR struct esp32_tim_dev_s *dev)
|
||||
static void esp32_tim_start(struct esp32_tim_dev_s *dev)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
esp32_tim_modifyreg32(dev, TIM_CONFIG_OFFSET, 0, TIMG_T0_EN);
|
||||
@ -266,7 +266,7 @@ static void esp32_tim_start(FAR struct esp32_tim_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_tim_stop(FAR struct esp32_tim_dev_s *dev)
|
||||
static void esp32_tim_stop(struct esp32_tim_dev_s *dev)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
esp32_tim_modifyreg32(dev, TIM_CONFIG_OFFSET, TIMG_T0_EN, 0);
|
||||
@ -280,7 +280,7 @@ static void esp32_tim_stop(FAR struct esp32_tim_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_tim_clear(FAR struct esp32_tim_dev_s *dev)
|
||||
static void esp32_tim_clear(struct esp32_tim_dev_s *dev)
|
||||
{
|
||||
uint64_t clear_value = 0;
|
||||
DEBUGASSERT(dev);
|
||||
@ -296,7 +296,7 @@ static void esp32_tim_clear(FAR struct esp32_tim_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_tim_setmode(FAR struct esp32_tim_dev_s *dev, uint8_t mode)
|
||||
static void esp32_tim_setmode(struct esp32_tim_dev_s *dev, uint8_t mode)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -320,7 +320,7 @@ static void esp32_tim_setmode(FAR struct esp32_tim_dev_s *dev, uint8_t mode)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_tim_setpre(FAR struct esp32_tim_dev_s *dev, uint16_t pre)
|
||||
static void esp32_tim_setpre(struct esp32_tim_dev_s *dev, uint16_t pre)
|
||||
{
|
||||
uint32_t mask = (uint32_t)pre << TIMG_T0_DIVIDER_S;
|
||||
DEBUGASSERT(dev);
|
||||
@ -335,7 +335,7 @@ static void esp32_tim_setpre(FAR struct esp32_tim_dev_s *dev, uint16_t pre)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_tim_getcounter(FAR struct esp32_tim_dev_s *dev,
|
||||
static void esp32_tim_getcounter(struct esp32_tim_dev_s *dev,
|
||||
uint64_t *value)
|
||||
{
|
||||
uint32_t value_32;
|
||||
@ -369,7 +369,7 @@ static void esp32_tim_getcounter(FAR struct esp32_tim_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_tim_setcounter(FAR struct esp32_tim_dev_s *dev,
|
||||
static void esp32_tim_setcounter(struct esp32_tim_dev_s *dev,
|
||||
uint64_t value)
|
||||
{
|
||||
uint64_t low_64 = value & LOW_32_MASK;
|
||||
@ -391,7 +391,7 @@ static void esp32_tim_setcounter(FAR struct esp32_tim_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_tim_reload_now(FAR struct esp32_tim_dev_s *dev)
|
||||
static void esp32_tim_reload_now(struct esp32_tim_dev_s *dev)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -408,7 +408,7 @@ static void esp32_tim_reload_now(FAR struct esp32_tim_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_tim_getalarmvalue(FAR struct esp32_tim_dev_s *dev,
|
||||
static void esp32_tim_getalarmvalue(struct esp32_tim_dev_s *dev,
|
||||
uint64_t *value)
|
||||
{
|
||||
uint32_t value_32;
|
||||
@ -435,7 +435,7 @@ static void esp32_tim_getalarmvalue(FAR struct esp32_tim_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_tim_setalarmvalue(FAR struct esp32_tim_dev_s *dev,
|
||||
static void esp32_tim_setalarmvalue(struct esp32_tim_dev_s *dev,
|
||||
uint64_t value)
|
||||
{
|
||||
uint64_t low_64 = value & LOW_32_MASK;
|
||||
@ -457,7 +457,7 @@ static void esp32_tim_setalarmvalue(FAR struct esp32_tim_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_tim_setalarm(FAR struct esp32_tim_dev_s *dev, bool enable)
|
||||
static void esp32_tim_setalarm(struct esp32_tim_dev_s *dev, bool enable)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -482,7 +482,7 @@ static void esp32_tim_setalarm(FAR struct esp32_tim_dev_s *dev, bool enable)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_tim_setautoreload(FAR struct esp32_tim_dev_s *dev,
|
||||
static void esp32_tim_setautoreload(struct esp32_tim_dev_s *dev,
|
||||
bool enable)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
@ -507,15 +507,15 @@ static void esp32_tim_setautoreload(FAR struct esp32_tim_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_tim_setisr(FAR struct esp32_tim_dev_s *dev, xcpt_t handler,
|
||||
FAR void *arg)
|
||||
static int esp32_tim_setisr(struct esp32_tim_dev_s *dev, xcpt_t handler,
|
||||
void *arg)
|
||||
{
|
||||
FAR struct esp32_tim_priv_s *tim = NULL;
|
||||
struct esp32_tim_priv_s *tim = NULL;
|
||||
int ret = OK;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
tim = (FAR struct esp32_tim_priv_s *)dev;
|
||||
tim = (struct esp32_tim_priv_s *)dev;
|
||||
|
||||
/* Disable interrupt when callback is removed */
|
||||
|
||||
@ -587,7 +587,7 @@ errout:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_tim_enableint(FAR struct esp32_tim_dev_s *dev)
|
||||
static void esp32_tim_enableint(struct esp32_tim_dev_s *dev)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -620,7 +620,7 @@ static void esp32_tim_enableint(FAR struct esp32_tim_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_tim_disableint(FAR struct esp32_tim_dev_s *dev)
|
||||
static void esp32_tim_disableint(struct esp32_tim_dev_s *dev)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -651,7 +651,7 @@ static void esp32_tim_disableint(FAR struct esp32_tim_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_tim_ackint(FAR struct esp32_tim_dev_s *dev)
|
||||
static void esp32_tim_ackint(struct esp32_tim_dev_s *dev)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -679,7 +679,7 @@ static void esp32_tim_ackint(FAR struct esp32_tim_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_tim_checkint(FAR struct esp32_tim_dev_s *dev)
|
||||
static int esp32_tim_checkint(struct esp32_tim_dev_s *dev)
|
||||
{
|
||||
int ret = 0;
|
||||
uint32_t reg_value;
|
||||
@ -724,9 +724,9 @@ static int esp32_tim_checkint(FAR struct esp32_tim_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct esp32_tim_dev_s *esp32_tim_init(int timer)
|
||||
struct esp32_tim_dev_s *esp32_tim_init(int timer)
|
||||
{
|
||||
FAR struct esp32_tim_priv_s *tim = NULL;
|
||||
struct esp32_tim_priv_s *tim = NULL;
|
||||
|
||||
/* First, take the data structure associated with the timer instance */
|
||||
|
||||
@ -784,7 +784,7 @@ FAR struct esp32_tim_dev_s *esp32_tim_init(int timer)
|
||||
}
|
||||
|
||||
errout:
|
||||
return (FAR struct esp32_tim_dev_s *)tim;
|
||||
return (struct esp32_tim_dev_s *)tim;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -795,13 +795,13 @@ FAR struct esp32_tim_dev_s *esp32_tim_init(int timer)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32_tim_deinit(FAR struct esp32_tim_dev_s *dev)
|
||||
void esp32_tim_deinit(struct esp32_tim_dev_s *dev)
|
||||
{
|
||||
FAR struct esp32_tim_priv_s *tim = NULL;
|
||||
struct esp32_tim_priv_s *tim = NULL;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
tim = (FAR struct esp32_tim_priv_s *)dev;
|
||||
tim = (struct esp32_tim_priv_s *)dev;
|
||||
|
||||
tim->inuse = false;
|
||||
}
|
||||
|
@ -82,39 +82,39 @@ struct esp32_tim_ops_s
|
||||
{
|
||||
/* Timer tasks */
|
||||
|
||||
CODE void (*start)(FAR struct esp32_tim_dev_s *dev);
|
||||
CODE void (*stop)(FAR struct esp32_tim_dev_s *dev);
|
||||
CODE void (*clear)(FAR struct esp32_tim_dev_s *dev);
|
||||
CODE void (*start)(struct esp32_tim_dev_s *dev);
|
||||
CODE void (*stop)(struct esp32_tim_dev_s *dev);
|
||||
CODE void (*clear)(struct esp32_tim_dev_s *dev);
|
||||
|
||||
/* Timer operations */
|
||||
|
||||
CODE void (*setmode)(FAR struct esp32_tim_dev_s *dev, uint8_t mode);
|
||||
CODE void (*setpre)(FAR struct esp32_tim_dev_s *dev, uint16_t pre);
|
||||
CODE void (*getcounter)(FAR struct esp32_tim_dev_s *dev, uint64_t *value);
|
||||
CODE void (*setcounter)(FAR struct esp32_tim_dev_s *dev, uint64_t value);
|
||||
CODE void (*reloadnow)(FAR struct esp32_tim_dev_s *dev);
|
||||
CODE void (*getalarmvalue)(FAR struct esp32_tim_dev_s *dev,
|
||||
CODE void (*setmode)(struct esp32_tim_dev_s *dev, uint8_t mode);
|
||||
CODE void (*setpre)(struct esp32_tim_dev_s *dev, uint16_t pre);
|
||||
CODE void (*getcounter)(struct esp32_tim_dev_s *dev, uint64_t *value);
|
||||
CODE void (*setcounter)(struct esp32_tim_dev_s *dev, uint64_t value);
|
||||
CODE void (*reloadnow)(struct esp32_tim_dev_s *dev);
|
||||
CODE void (*getalarmvalue)(struct esp32_tim_dev_s *dev,
|
||||
uint64_t *value);
|
||||
CODE void (*setalarmvalue)(FAR struct esp32_tim_dev_s *dev,
|
||||
CODE void (*setalarmvalue)(struct esp32_tim_dev_s *dev,
|
||||
uint64_t value);
|
||||
CODE void (*setalarm)(FAR struct esp32_tim_dev_s *dev, bool enable);
|
||||
CODE void (*setautoreload)(FAR struct esp32_tim_dev_s *dev, bool enable);
|
||||
CODE void (*setalarm)(struct esp32_tim_dev_s *dev, bool enable);
|
||||
CODE void (*setautoreload)(struct esp32_tim_dev_s *dev, bool enable);
|
||||
|
||||
/* Timer interrupts */
|
||||
|
||||
CODE int (*setisr)(FAR struct esp32_tim_dev_s *dev, xcpt_t handler,
|
||||
FAR void * arg);
|
||||
CODE void (*enableint)(FAR struct esp32_tim_dev_s *dev);
|
||||
CODE void (*disableint)(FAR struct esp32_tim_dev_s *dev);
|
||||
CODE void (*ackint)(FAR struct esp32_tim_dev_s *dev);
|
||||
CODE int (*checkint)(FAR struct esp32_tim_dev_s *dev);
|
||||
CODE int (*setisr)(struct esp32_tim_dev_s *dev, xcpt_t handler,
|
||||
void * arg);
|
||||
CODE void (*enableint)(struct esp32_tim_dev_s *dev);
|
||||
CODE void (*disableint)(struct esp32_tim_dev_s *dev);
|
||||
CODE void (*ackint)(struct esp32_tim_dev_s *dev);
|
||||
CODE int (*checkint)(struct esp32_tim_dev_s *dev);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct esp32_tim_dev_s *esp32_tim_init(int timer);
|
||||
void esp32_tim_deinit(FAR struct esp32_tim_dev_s *dev);
|
||||
struct esp32_tim_dev_s *esp32_tim_init(int timer);
|
||||
void esp32_tim_deinit(struct esp32_tim_dev_s *dev);
|
||||
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32_ESP32_TIM_H */
|
||||
|
@ -53,12 +53,12 @@
|
||||
|
||||
struct esp32_timer_lowerhalf_s
|
||||
{
|
||||
FAR const struct timer_ops_s *ops; /* Lower half operations */
|
||||
FAR struct esp32_tim_dev_s *tim; /* esp32 timer driver */
|
||||
tccb_t callback; /* Current user interrupt callback */
|
||||
FAR void *arg; /* Argument passed to upper half callback */
|
||||
bool started; /* True: Timer has been started */
|
||||
void *upper; /* Pointer to watchdog_upperhalf_s */
|
||||
const struct timer_ops_s *ops; /* Lower half operations */
|
||||
struct esp32_tim_dev_s *tim; /* esp32 timer driver */
|
||||
tccb_t callback; /* Current user interrupt callback */
|
||||
void *arg; /* Argument passed to upper half callback */
|
||||
bool started; /* True: Timer has been started */
|
||||
void *upper; /* Pointer to watchdog_upperhalf_s */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@ -69,16 +69,16 @@ static int esp32_timer_handler(int irq, void *context, void *arg);
|
||||
|
||||
/* "Lower half" driver methods **********************************************/
|
||||
|
||||
static int esp32_timer_start(FAR struct timer_lowerhalf_s *lower);
|
||||
static int esp32_timer_stop(FAR struct timer_lowerhalf_s *lower);
|
||||
static int esp32_timer_getstatus(FAR struct timer_lowerhalf_s *lower,
|
||||
FAR struct timer_status_s *status);
|
||||
static int esp32_timer_settimeout(FAR struct timer_lowerhalf_s *lower,
|
||||
static int esp32_timer_start(struct timer_lowerhalf_s *lower);
|
||||
static int esp32_timer_stop(struct timer_lowerhalf_s *lower);
|
||||
static int esp32_timer_getstatus(struct timer_lowerhalf_s *lower,
|
||||
struct timer_status_s *status);
|
||||
static int esp32_timer_settimeout(struct timer_lowerhalf_s *lower,
|
||||
uint32_t timeout);
|
||||
static int esp32_timer_maxtimeout(FAR struct timer_lowerhalf_s *lower,
|
||||
static int esp32_timer_maxtimeout(struct timer_lowerhalf_s *lower,
|
||||
uint32_t *timeout);
|
||||
static void esp32_timer_setcallback(FAR struct timer_lowerhalf_s *lower,
|
||||
tccb_t callback, FAR void *arg);
|
||||
static void esp32_timer_setcallback(struct timer_lowerhalf_s *lower,
|
||||
tccb_t callback, void *arg);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@ -151,8 +151,8 @@ static struct esp32_timer_lowerhalf_s g_esp32_timer3_lowerhalf =
|
||||
|
||||
static int esp32_timer_handler(int irq, void *context, void *arg)
|
||||
{
|
||||
FAR struct esp32_timer_lowerhalf_s *priv =
|
||||
(FAR struct esp32_timer_lowerhalf_s *)arg;
|
||||
struct esp32_timer_lowerhalf_s *priv =
|
||||
(struct esp32_timer_lowerhalf_s *)arg;
|
||||
uint32_t next_interval_us = 0;
|
||||
|
||||
if (priv->callback(&next_interval_us, priv->upper))
|
||||
@ -189,10 +189,10 @@ static int esp32_timer_handler(int irq, void *context, void *arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_timer_start(FAR struct timer_lowerhalf_s *lower)
|
||||
static int esp32_timer_start(struct timer_lowerhalf_s *lower)
|
||||
{
|
||||
FAR struct esp32_timer_lowerhalf_s *priv =
|
||||
(FAR struct esp32_timer_lowerhalf_s *)lower;
|
||||
struct esp32_timer_lowerhalf_s *priv =
|
||||
(struct esp32_timer_lowerhalf_s *)lower;
|
||||
int ret = OK;
|
||||
uint16_t pre;
|
||||
irqstate_t flags;
|
||||
@ -282,10 +282,10 @@ errout:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_timer_stop(FAR struct timer_lowerhalf_s *lower)
|
||||
static int esp32_timer_stop(struct timer_lowerhalf_s *lower)
|
||||
{
|
||||
FAR struct esp32_timer_lowerhalf_s *priv =
|
||||
(FAR struct esp32_timer_lowerhalf_s *)lower;
|
||||
struct esp32_timer_lowerhalf_s *priv =
|
||||
(struct esp32_timer_lowerhalf_s *)lower;
|
||||
int ret = OK;
|
||||
irqstate_t flags;
|
||||
|
||||
@ -328,11 +328,11 @@ errout:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_timer_getstatus(FAR struct timer_lowerhalf_s *lower,
|
||||
FAR struct timer_status_s *status)
|
||||
static int esp32_timer_getstatus(struct timer_lowerhalf_s *lower,
|
||||
struct timer_status_s *status)
|
||||
{
|
||||
FAR struct esp32_timer_lowerhalf_s *priv =
|
||||
(FAR struct esp32_timer_lowerhalf_s *)lower;
|
||||
struct esp32_timer_lowerhalf_s *priv =
|
||||
(struct esp32_timer_lowerhalf_s *)lower;
|
||||
int ret = OK;
|
||||
uint64_t current_counter_value;
|
||||
uint64_t alarm_value;
|
||||
@ -390,11 +390,11 @@ static int esp32_timer_getstatus(FAR struct timer_lowerhalf_s *lower,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_timer_settimeout(FAR struct timer_lowerhalf_s *lower,
|
||||
static int esp32_timer_settimeout(struct timer_lowerhalf_s *lower,
|
||||
uint32_t timeout)
|
||||
{
|
||||
FAR struct esp32_timer_lowerhalf_s *priv =
|
||||
(FAR struct esp32_timer_lowerhalf_s *)lower;
|
||||
struct esp32_timer_lowerhalf_s *priv =
|
||||
(struct esp32_timer_lowerhalf_s *)lower;
|
||||
int ret = OK;
|
||||
|
||||
DEBUGASSERT(priv);
|
||||
@ -422,7 +422,7 @@ static int esp32_timer_settimeout(FAR struct timer_lowerhalf_s *lower,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_timer_maxtimeout(FAR struct timer_lowerhalf_s *lower,
|
||||
static int esp32_timer_maxtimeout(struct timer_lowerhalf_s *lower,
|
||||
uint32_t *max_timeout)
|
||||
{
|
||||
DEBUGASSERT(max_timeout);
|
||||
@ -452,11 +452,11 @@ static int esp32_timer_maxtimeout(FAR struct timer_lowerhalf_s *lower,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_timer_setcallback(FAR struct timer_lowerhalf_s *lower,
|
||||
tccb_t callback, FAR void *arg)
|
||||
static void esp32_timer_setcallback(struct timer_lowerhalf_s *lower,
|
||||
tccb_t callback, void *arg)
|
||||
{
|
||||
FAR struct esp32_timer_lowerhalf_s *priv =
|
||||
(FAR struct esp32_timer_lowerhalf_s *)lower;
|
||||
struct esp32_timer_lowerhalf_s *priv =
|
||||
(struct esp32_timer_lowerhalf_s *)lower;
|
||||
irqstate_t flags;
|
||||
int ret = OK;
|
||||
|
||||
@ -508,7 +508,7 @@ static void esp32_timer_setcallback(FAR struct timer_lowerhalf_s *lower,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_timer_initialize(FAR const char *devpath, uint8_t timer)
|
||||
int esp32_timer_initialize(const char *devpath, uint8_t timer)
|
||||
{
|
||||
struct esp32_timer_lowerhalf_s *lower = NULL;
|
||||
int ret = OK;
|
||||
@ -582,7 +582,7 @@ int esp32_timer_initialize(FAR const char *devpath, uint8_t timer)
|
||||
*/
|
||||
|
||||
lower->upper = timer_register(devpath,
|
||||
(FAR struct timer_lowerhalf_s *)lower);
|
||||
(struct timer_lowerhalf_s *)lower);
|
||||
if (lower->upper == NULL)
|
||||
{
|
||||
/* The actual cause of the failure may have been a failure to allocate
|
||||
|
@ -37,6 +37,6 @@
|
||||
* Name: esp32_timer_initialize
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_timer_initialize(FAR const char *devpath, uint8_t timer);
|
||||
int esp32_timer_initialize(const char *devpath, uint8_t timer);
|
||||
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32_ESP32_TIM_LOWERHALF_H */
|
||||
|
@ -65,7 +65,7 @@ static uint32_t g_tick_divisor;
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_timerisr(int irq, uint32_t *regs, FAR void *arg)
|
||||
static int esp32_timerisr(int irq, uint32_t *regs, void *arg)
|
||||
{
|
||||
uint32_t divisor;
|
||||
uint32_t compare;
|
||||
|
@ -347,7 +347,7 @@ uint32_t *xtensa_user(int exccause, uint32_t *regs)
|
||||
uint8_t t;
|
||||
|
||||
binfo("XCHAL_EXCCAUSE_LOAD_STORE_ERROR at %p, pc=%p\n",
|
||||
(FAR void *)regs[REG_EXCVADDR],
|
||||
(void *)regs[REG_EXCVADDR],
|
||||
pc);
|
||||
|
||||
if (decode_s8i(pc, &imm8, &s, &t))
|
||||
|
@ -49,7 +49,7 @@
|
||||
|
||||
struct esp32_wdt_priv_s
|
||||
{
|
||||
FAR struct esp32_wdt_ops_s *ops;
|
||||
struct esp32_wdt_ops_s *ops;
|
||||
uint32_t base; /* WDT register base address */
|
||||
uint8_t cpu; /* CPU ID */
|
||||
uint8_t periph; /* Peripheral ID */
|
||||
@ -64,34 +64,34 @@ struct esp32_wdt_priv_s
|
||||
|
||||
/* WDT registers access *****************************************************/
|
||||
|
||||
static void esp32_wdt_putreg(FAR struct esp32_wdt_dev_s *dev,
|
||||
static void esp32_wdt_putreg(struct esp32_wdt_dev_s *dev,
|
||||
uint32_t offset,
|
||||
uint32_t value);
|
||||
static void esp32_wdt_modifyreg32(FAR struct esp32_wdt_dev_s *dev,
|
||||
static void esp32_wdt_modifyreg32(struct esp32_wdt_dev_s *dev,
|
||||
uint32_t offset,
|
||||
uint32_t clearbits,
|
||||
uint32_t setbits);
|
||||
static uint32_t esp32_wdt_getreg(FAR struct esp32_wdt_dev_s *dev,
|
||||
static uint32_t esp32_wdt_getreg(struct esp32_wdt_dev_s *dev,
|
||||
uint32_t offset);
|
||||
|
||||
/* WDT operations ***********************************************************/
|
||||
|
||||
static int esp32_wdt_start(FAR struct esp32_wdt_dev_s *dev);
|
||||
static int esp32_wdt_stop(FAR struct esp32_wdt_dev_s *dev);
|
||||
static int esp32_wdt_enablewp(FAR struct esp32_wdt_dev_s *dev);
|
||||
static int esp32_wdt_disablewp(FAR struct esp32_wdt_dev_s *dev);
|
||||
static int esp32_wdt_pre(FAR struct esp32_wdt_dev_s *dev, uint16_t value);
|
||||
static int esp32_wdt_settimeout(FAR struct esp32_wdt_dev_s *dev,
|
||||
static int esp32_wdt_start(struct esp32_wdt_dev_s *dev);
|
||||
static int esp32_wdt_stop(struct esp32_wdt_dev_s *dev);
|
||||
static int esp32_wdt_enablewp(struct esp32_wdt_dev_s *dev);
|
||||
static int esp32_wdt_disablewp(struct esp32_wdt_dev_s *dev);
|
||||
static int esp32_wdt_pre(struct esp32_wdt_dev_s *dev, uint16_t value);
|
||||
static int esp32_wdt_settimeout(struct esp32_wdt_dev_s *dev,
|
||||
uint32_t value, uint8_t stage);
|
||||
static int esp32_wdt_feed_dog(FAR struct esp32_wdt_dev_s *dev);
|
||||
static int esp32_wdt_set_stg_conf(FAR struct esp32_wdt_dev_s *dev,
|
||||
static int esp32_wdt_feed_dog(struct esp32_wdt_dev_s *dev);
|
||||
static int esp32_wdt_set_stg_conf(struct esp32_wdt_dev_s *dev,
|
||||
uint8_t stage, uint8_t conf);
|
||||
static uint16_t esp32_rtc_clk(FAR struct esp32_wdt_dev_s *dev);
|
||||
static int esp32_wdt_setisr(FAR struct esp32_wdt_dev_s *dev, xcpt_t handler,
|
||||
FAR void * arg);
|
||||
static int esp32_wdt_enableint(FAR struct esp32_wdt_dev_s *dev);
|
||||
static int esp32_wdt_disableint(FAR struct esp32_wdt_dev_s *dev);
|
||||
static int esp32_wdt_ackint(FAR struct esp32_wdt_dev_s *dev);
|
||||
static uint16_t esp32_rtc_clk(struct esp32_wdt_dev_s *dev);
|
||||
static int esp32_wdt_setisr(struct esp32_wdt_dev_s *dev, xcpt_t handler,
|
||||
void * arg);
|
||||
static int esp32_wdt_enableint(struct esp32_wdt_dev_s *dev);
|
||||
static int esp32_wdt_disableint(struct esp32_wdt_dev_s *dev);
|
||||
static int esp32_wdt_ackint(struct esp32_wdt_dev_s *dev);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@ -184,7 +184,7 @@ struct esp32_wdt_priv_s g_esp32_rwdt_priv =
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_wdt_putreg(FAR struct esp32_wdt_dev_s *dev,
|
||||
static void esp32_wdt_putreg(struct esp32_wdt_dev_s *dev,
|
||||
uint32_t offset,
|
||||
uint32_t value)
|
||||
{
|
||||
@ -201,7 +201,7 @@ static void esp32_wdt_putreg(FAR struct esp32_wdt_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32_wdt_modifyreg32(FAR struct esp32_wdt_dev_s *dev,
|
||||
static void esp32_wdt_modifyreg32(struct esp32_wdt_dev_s *dev,
|
||||
uint32_t offset,
|
||||
uint32_t clearbits,
|
||||
uint32_t setbits)
|
||||
@ -220,7 +220,7 @@ static void esp32_wdt_modifyreg32(FAR struct esp32_wdt_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static uint32_t esp32_wdt_getreg(FAR struct esp32_wdt_dev_s *dev,
|
||||
static uint32_t esp32_wdt_getreg(struct esp32_wdt_dev_s *dev,
|
||||
uint32_t offset)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
@ -236,7 +236,7 @@ static uint32_t esp32_wdt_getreg(FAR struct esp32_wdt_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_wdt_start(FAR struct esp32_wdt_dev_s *dev)
|
||||
static int esp32_wdt_start(struct esp32_wdt_dev_s *dev)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -272,7 +272,7 @@ static int esp32_wdt_start(FAR struct esp32_wdt_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_wdt_set_stg_conf(FAR struct esp32_wdt_dev_s *dev,
|
||||
static int esp32_wdt_set_stg_conf(struct esp32_wdt_dev_s *dev,
|
||||
uint8_t stage, uint8_t conf)
|
||||
{
|
||||
int ret = OK;
|
||||
@ -393,7 +393,7 @@ static int esp32_wdt_set_stg_conf(FAR struct esp32_wdt_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_wdt_stop(FAR struct esp32_wdt_dev_s *dev)
|
||||
static int esp32_wdt_stop(struct esp32_wdt_dev_s *dev)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -426,7 +426,7 @@ static int esp32_wdt_stop(FAR struct esp32_wdt_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_wdt_enablewp(FAR struct esp32_wdt_dev_s *dev)
|
||||
static int esp32_wdt_enablewp(struct esp32_wdt_dev_s *dev)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -459,7 +459,7 @@ static int esp32_wdt_enablewp(FAR struct esp32_wdt_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_wdt_disablewp(FAR struct esp32_wdt_dev_s *dev)
|
||||
static int esp32_wdt_disablewp(struct esp32_wdt_dev_s *dev)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -490,7 +490,7 @@ static int esp32_wdt_disablewp(FAR struct esp32_wdt_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_wdt_pre(FAR struct esp32_wdt_dev_s *dev, uint16_t pre)
|
||||
static int esp32_wdt_pre(struct esp32_wdt_dev_s *dev, uint16_t pre)
|
||||
{
|
||||
uint32_t mask = (uint32_t)pre << TIMG_WDT_CLK_PRESCALE_S;
|
||||
|
||||
@ -511,7 +511,7 @@ static int esp32_wdt_pre(FAR struct esp32_wdt_dev_s *dev, uint16_t pre)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static uint16_t esp32_rtc_clk(FAR struct esp32_wdt_dev_s *dev)
|
||||
static uint16_t esp32_rtc_clk(struct esp32_wdt_dev_s *dev)
|
||||
{
|
||||
enum esp32_rtc_slow_freq_e slow_clk_rtc;
|
||||
uint32_t period_13q19;
|
||||
@ -568,7 +568,7 @@ static uint16_t esp32_rtc_clk(FAR struct esp32_wdt_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_wdt_settimeout(FAR struct esp32_wdt_dev_s *dev,
|
||||
static int esp32_wdt_settimeout(struct esp32_wdt_dev_s *dev,
|
||||
uint32_t value, uint8_t stage)
|
||||
{
|
||||
int ret = OK;
|
||||
@ -673,7 +673,7 @@ static int esp32_wdt_settimeout(FAR struct esp32_wdt_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_wdt_feed_dog(FAR struct esp32_wdt_dev_s *dev)
|
||||
static int esp32_wdt_feed_dog(struct esp32_wdt_dev_s *dev)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -704,15 +704,15 @@ static int esp32_wdt_feed_dog(FAR struct esp32_wdt_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_wdt_setisr(FAR struct esp32_wdt_dev_s *dev, xcpt_t handler,
|
||||
FAR void *arg)
|
||||
static int esp32_wdt_setisr(struct esp32_wdt_dev_s *dev, xcpt_t handler,
|
||||
void *arg)
|
||||
{
|
||||
FAR struct esp32_wdt_priv_s *wdt = NULL;
|
||||
struct esp32_wdt_priv_s *wdt = NULL;
|
||||
int ret = OK;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
wdt = (FAR struct esp32_wdt_priv_s *)dev;
|
||||
wdt = (struct esp32_wdt_priv_s *)dev;
|
||||
|
||||
/* Disable interrupt when callback is removed */
|
||||
|
||||
@ -779,7 +779,7 @@ errout:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_wdt_enableint(FAR struct esp32_wdt_dev_s *dev)
|
||||
static int esp32_wdt_enableint(struct esp32_wdt_dev_s *dev)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -826,7 +826,7 @@ static int esp32_wdt_enableint(FAR struct esp32_wdt_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_wdt_disableint(FAR struct esp32_wdt_dev_s *dev)
|
||||
static int esp32_wdt_disableint(struct esp32_wdt_dev_s *dev)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -871,7 +871,7 @@ static int esp32_wdt_disableint(FAR struct esp32_wdt_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_wdt_ackint(FAR struct esp32_wdt_dev_s *dev)
|
||||
static int esp32_wdt_ackint(struct esp32_wdt_dev_s *dev)
|
||||
{
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -904,9 +904,9 @@ static int esp32_wdt_ackint(FAR struct esp32_wdt_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct esp32_wdt_dev_s *esp32_wdt_init(uint8_t wdt_id)
|
||||
struct esp32_wdt_dev_s *esp32_wdt_init(uint8_t wdt_id)
|
||||
{
|
||||
FAR struct esp32_wdt_priv_s *wdt = NULL;
|
||||
struct esp32_wdt_priv_s *wdt = NULL;
|
||||
|
||||
/* Get wdt instance */
|
||||
|
||||
@ -970,7 +970,7 @@ FAR struct esp32_wdt_dev_s *esp32_wdt_init(uint8_t wdt_id)
|
||||
}
|
||||
|
||||
errout:
|
||||
return (FAR struct esp32_wdt_dev_s *)wdt;
|
||||
return (struct esp32_wdt_dev_s *)wdt;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -999,13 +999,13 @@ void esp32_wdt_early_deinit(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_wdt_deinit(FAR struct esp32_wdt_dev_s *dev)
|
||||
int esp32_wdt_deinit(struct esp32_wdt_dev_s *dev)
|
||||
{
|
||||
FAR struct esp32_wdt_priv_s *wdt = NULL;
|
||||
struct esp32_wdt_priv_s *wdt = NULL;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
wdt = (FAR struct esp32_wdt_priv_s *)dev;
|
||||
wdt = (struct esp32_wdt_priv_s *)dev;
|
||||
|
||||
wdt->inuse = false;
|
||||
|
||||
@ -1021,7 +1021,7 @@ int esp32_wdt_deinit(FAR struct esp32_wdt_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
bool esp32_wdt_is_running(FAR struct esp32_wdt_dev_s *dev)
|
||||
bool esp32_wdt_is_running(struct esp32_wdt_dev_s *dev)
|
||||
{
|
||||
uint32_t status = 0;
|
||||
DEBUGASSERT(dev);
|
||||
|
@ -70,37 +70,37 @@ struct esp32_wdt_ops_s
|
||||
{
|
||||
/* WDT tasks */
|
||||
|
||||
CODE int (*start)(FAR struct esp32_wdt_dev_s *dev);
|
||||
CODE int (*stop)(FAR struct esp32_wdt_dev_s *dev);
|
||||
CODE int (*start)(struct esp32_wdt_dev_s *dev);
|
||||
CODE int (*stop)(struct esp32_wdt_dev_s *dev);
|
||||
|
||||
/* WDT configuration */
|
||||
|
||||
CODE int (*enablewp)(FAR struct esp32_wdt_dev_s *dev);
|
||||
CODE int (*disablewp)(FAR struct esp32_wdt_dev_s *dev);
|
||||
CODE int (*pre)(FAR struct esp32_wdt_dev_s *dev, uint16_t value);
|
||||
CODE int (*settimeout)(FAR struct esp32_wdt_dev_s *dev,
|
||||
CODE int (*enablewp)(struct esp32_wdt_dev_s *dev);
|
||||
CODE int (*disablewp)(struct esp32_wdt_dev_s *dev);
|
||||
CODE int (*pre)(struct esp32_wdt_dev_s *dev, uint16_t value);
|
||||
CODE int (*settimeout)(struct esp32_wdt_dev_s *dev,
|
||||
uint32_t value, uint8_t stage);
|
||||
CODE int (*feed)(FAR struct esp32_wdt_dev_s *dev);
|
||||
CODE int (*stg_conf)(FAR struct esp32_wdt_dev_s *dev,
|
||||
CODE int (*feed)(struct esp32_wdt_dev_s *dev);
|
||||
CODE int (*stg_conf)(struct esp32_wdt_dev_s *dev,
|
||||
uint8_t stage, uint8_t conf);
|
||||
CODE uint16_t (*rtc_clk)(FAR struct esp32_wdt_dev_s *dev);
|
||||
CODE uint16_t (*rtc_clk)(struct esp32_wdt_dev_s *dev);
|
||||
|
||||
/* WDT interrupts */
|
||||
|
||||
CODE int (*setisr)(FAR struct esp32_wdt_dev_s *dev, xcpt_t handler,
|
||||
FAR void * arg);
|
||||
CODE int (*enableint)(FAR struct esp32_wdt_dev_s *dev);
|
||||
CODE int (*disableint)(FAR struct esp32_wdt_dev_s *dev);
|
||||
CODE int (*ackint)(FAR struct esp32_wdt_dev_s *dev);
|
||||
CODE int (*setisr)(struct esp32_wdt_dev_s *dev, xcpt_t handler,
|
||||
void * arg);
|
||||
CODE int (*enableint)(struct esp32_wdt_dev_s *dev);
|
||||
CODE int (*disableint)(struct esp32_wdt_dev_s *dev);
|
||||
CODE int (*ackint)(struct esp32_wdt_dev_s *dev);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct esp32_wdt_dev_s *esp32_wdt_init(uint8_t wdt_id);
|
||||
struct esp32_wdt_dev_s *esp32_wdt_init(uint8_t wdt_id);
|
||||
void esp32_wdt_early_deinit(void);
|
||||
int esp32_wdt_deinit(FAR struct esp32_wdt_dev_s *dev);
|
||||
bool esp32_wdt_is_running(FAR struct esp32_wdt_dev_s *dev);
|
||||
int esp32_wdt_deinit(struct esp32_wdt_dev_s *dev);
|
||||
bool esp32_wdt_is_running(struct esp32_wdt_dev_s *dev);
|
||||
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32_ESP32_WDT_H */
|
||||
|
@ -72,14 +72,14 @@
|
||||
|
||||
struct esp32_wdt_lowerhalf_s
|
||||
{
|
||||
FAR const struct watchdog_ops_s *ops; /* Lower half operations */
|
||||
FAR struct esp32_wdt_dev_s *wdt; /* esp32 watchdog driver */
|
||||
uint32_t timeout; /* The current timeout */
|
||||
enum wdt_peripherals peripheral; /* Indicates if it is from RTC or Timer Module */
|
||||
uint32_t lastreset; /* The last reset time */
|
||||
bool started; /* True: Timer has been started */
|
||||
xcpt_t handler; /* User Handler */
|
||||
void *upper; /* Pointer to watchdog_upperhalf_s */
|
||||
const struct watchdog_ops_s *ops; /* Lower half operations */
|
||||
struct esp32_wdt_dev_s *wdt; /* esp32 watchdog driver */
|
||||
uint32_t timeout; /* The current timeout */
|
||||
enum wdt_peripherals peripheral; /* Indicates if it is from RTC or Timer Module */
|
||||
uint32_t lastreset; /* The last reset time */
|
||||
bool started; /* True: Timer has been started */
|
||||
xcpt_t handler; /* User Handler */
|
||||
void *upper; /* Pointer to watchdog_upperhalf_s */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@ -88,18 +88,18 @@ struct esp32_wdt_lowerhalf_s
|
||||
|
||||
/* Interrupt handling *******************************************************/
|
||||
|
||||
static int esp32_wdt_handler(int irq, FAR void *context, FAR void *arg);
|
||||
static int esp32_wdt_handler(int irq, void *context, void *arg);
|
||||
|
||||
/* "Lower half" driver methods **********************************************/
|
||||
|
||||
static int esp32_wdt_start(FAR struct watchdog_lowerhalf_s *lower);
|
||||
static int esp32_wdt_stop(FAR struct watchdog_lowerhalf_s *lower);
|
||||
static int esp32_wdt_keepalive(FAR struct watchdog_lowerhalf_s *lower);
|
||||
static int esp32_wdt_getstatus(FAR struct watchdog_lowerhalf_s *lower,
|
||||
FAR struct watchdog_status_s *status);
|
||||
static int esp32_wdt_settimeout(FAR struct watchdog_lowerhalf_s *lower,
|
||||
static int esp32_wdt_start(struct watchdog_lowerhalf_s *lower);
|
||||
static int esp32_wdt_stop(struct watchdog_lowerhalf_s *lower);
|
||||
static int esp32_wdt_keepalive(struct watchdog_lowerhalf_s *lower);
|
||||
static int esp32_wdt_getstatus(struct watchdog_lowerhalf_s *lower,
|
||||
struct watchdog_status_s *status);
|
||||
static int esp32_wdt_settimeout(struct watchdog_lowerhalf_s *lower,
|
||||
uint32_t timeout);
|
||||
static xcpt_t esp32_wdt_capture(FAR struct watchdog_lowerhalf_s *lower,
|
||||
static xcpt_t esp32_wdt_capture(struct watchdog_lowerhalf_s *lower,
|
||||
xcpt_t handler);
|
||||
|
||||
/****************************************************************************
|
||||
@ -163,10 +163,10 @@ static struct esp32_wdt_lowerhalf_s g_esp32_rwdt_lowerhalf =
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_wdt_start(FAR struct watchdog_lowerhalf_s *lower)
|
||||
static int esp32_wdt_start(struct watchdog_lowerhalf_s *lower)
|
||||
{
|
||||
FAR struct esp32_wdt_lowerhalf_s *priv =
|
||||
(FAR struct esp32_wdt_lowerhalf_s *)lower;
|
||||
struct esp32_wdt_lowerhalf_s *priv =
|
||||
(struct esp32_wdt_lowerhalf_s *)lower;
|
||||
int ret = OK;
|
||||
irqstate_t flags;
|
||||
|
||||
@ -248,10 +248,10 @@ static int esp32_wdt_start(FAR struct watchdog_lowerhalf_s *lower)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_wdt_stop(FAR struct watchdog_lowerhalf_s *lower)
|
||||
static int esp32_wdt_stop(struct watchdog_lowerhalf_s *lower)
|
||||
{
|
||||
FAR struct esp32_wdt_lowerhalf_s *priv =
|
||||
(FAR struct esp32_wdt_lowerhalf_s *)lower;
|
||||
struct esp32_wdt_lowerhalf_s *priv =
|
||||
(struct esp32_wdt_lowerhalf_s *)lower;
|
||||
irqstate_t flags;
|
||||
|
||||
/* Unlock WDT */
|
||||
@ -296,10 +296,10 @@ static int esp32_wdt_stop(FAR struct watchdog_lowerhalf_s *lower)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_wdt_keepalive(FAR struct watchdog_lowerhalf_s *lower)
|
||||
static int esp32_wdt_keepalive(struct watchdog_lowerhalf_s *lower)
|
||||
{
|
||||
FAR struct esp32_wdt_lowerhalf_s *priv =
|
||||
(FAR struct esp32_wdt_lowerhalf_s *)lower;
|
||||
struct esp32_wdt_lowerhalf_s *priv =
|
||||
(struct esp32_wdt_lowerhalf_s *)lower;
|
||||
irqstate_t flags;
|
||||
|
||||
wdinfo("Entry\n");
|
||||
@ -335,11 +335,11 @@ static int esp32_wdt_keepalive(FAR struct watchdog_lowerhalf_s *lower)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_wdt_getstatus(FAR struct watchdog_lowerhalf_s *lower,
|
||||
FAR struct watchdog_status_s *status)
|
||||
static int esp32_wdt_getstatus(struct watchdog_lowerhalf_s *lower,
|
||||
struct watchdog_status_s *status)
|
||||
{
|
||||
FAR struct esp32_wdt_lowerhalf_s *priv =
|
||||
(FAR struct esp32_wdt_lowerhalf_s *)lower;
|
||||
struct esp32_wdt_lowerhalf_s *priv =
|
||||
(struct esp32_wdt_lowerhalf_s *)lower;
|
||||
uint32_t ticks;
|
||||
uint32_t elapsed;
|
||||
|
||||
@ -404,11 +404,11 @@ static int esp32_wdt_getstatus(FAR struct watchdog_lowerhalf_s *lower,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_wdt_settimeout(FAR struct watchdog_lowerhalf_s *lower,
|
||||
static int esp32_wdt_settimeout(struct watchdog_lowerhalf_s *lower,
|
||||
uint32_t timeout)
|
||||
{
|
||||
FAR struct esp32_wdt_lowerhalf_s *priv =
|
||||
(FAR struct esp32_wdt_lowerhalf_s *)lower;
|
||||
struct esp32_wdt_lowerhalf_s *priv =
|
||||
(struct esp32_wdt_lowerhalf_s *)lower;
|
||||
uint16_t rtc_cycles = 0;
|
||||
uint32_t rtc_ms_max = 0;
|
||||
|
||||
@ -497,11 +497,11 @@ static int esp32_wdt_settimeout(FAR struct watchdog_lowerhalf_s *lower,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static xcpt_t esp32_wdt_capture(FAR struct watchdog_lowerhalf_s *lower,
|
||||
static xcpt_t esp32_wdt_capture(struct watchdog_lowerhalf_s *lower,
|
||||
xcpt_t handler)
|
||||
{
|
||||
FAR struct esp32_wdt_lowerhalf_s *priv =
|
||||
(FAR struct esp32_wdt_lowerhalf_s *)lower;
|
||||
struct esp32_wdt_lowerhalf_s *priv =
|
||||
(struct esp32_wdt_lowerhalf_s *)lower;
|
||||
irqstate_t flags;
|
||||
xcpt_t oldhandler;
|
||||
|
||||
@ -576,9 +576,9 @@ static xcpt_t esp32_wdt_capture(FAR struct watchdog_lowerhalf_s *lower,
|
||||
|
||||
/* Interrupt handling *******************************************************/
|
||||
|
||||
static int esp32_wdt_handler(int irq, FAR void *context, FAR void *arg)
|
||||
static int esp32_wdt_handler(int irq, void *context, void *arg)
|
||||
{
|
||||
FAR struct esp32_wdt_lowerhalf_s *priv = arg;
|
||||
struct esp32_wdt_lowerhalf_s *priv = arg;
|
||||
|
||||
ESP32_WDT_UNLOCK(priv->wdt);
|
||||
|
||||
@ -622,7 +622,7 @@ static int esp32_wdt_handler(int irq, FAR void *context, FAR void *arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_wdt_initialize(FAR const char *devpath, uint8_t wdt)
|
||||
int esp32_wdt_initialize(const char *devpath, uint8_t wdt)
|
||||
{
|
||||
struct esp32_wdt_lowerhalf_s *lower = NULL;
|
||||
int ret = OK;
|
||||
@ -699,7 +699,7 @@ int esp32_wdt_initialize(FAR const char *devpath, uint8_t wdt)
|
||||
*/
|
||||
|
||||
lower->upper = watchdog_register(devpath,
|
||||
(FAR struct watchdog_lowerhalf_s *)lower);
|
||||
(struct watchdog_lowerhalf_s *)lower);
|
||||
if (lower->upper == NULL)
|
||||
{
|
||||
/* The actual cause of the failure may have been a failure to allocate
|
||||
|
@ -47,6 +47,6 @@ enum wdt_peripherals
|
||||
* Name: esp32_timer_initialize
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_wdt_initialize(FAR const char *devpath, uint8_t timer);
|
||||
int esp32_wdt_initialize(const char *devpath, uint8_t timer);
|
||||
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32_ESP32_WDT_LOWERHALF_H */
|
||||
|
@ -673,7 +673,7 @@ static int32_t wifi_errno_trans(int ret)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp_int_adpt_cb(int irq, void *context, FAR void *arg)
|
||||
static int esp_int_adpt_cb(int irq, void *context, void *arg)
|
||||
{
|
||||
struct irq_adpt *adapter = (struct irq_adpt *)arg;
|
||||
|
||||
@ -2094,7 +2094,7 @@ static int esp_event_id_map(int event_id)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp_evt_work_cb(FAR void *arg)
|
||||
static void esp_evt_work_cb(void *arg)
|
||||
{
|
||||
int ret;
|
||||
irqstate_t flags;
|
||||
@ -4787,7 +4787,7 @@ void esp_wifi_free_eb(void *eb)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp_wifi_notify_subscribe(pid_t pid, FAR struct sigevent *event)
|
||||
int esp_wifi_notify_subscribe(pid_t pid, struct sigevent *event)
|
||||
{
|
||||
int id;
|
||||
struct wifi_notify *notify;
|
||||
|
@ -134,7 +134,7 @@ void esp_wifi_free_eb(void *eb);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp_wifi_notify_subscribe(pid_t pid, FAR struct sigevent *event);
|
||||
int esp_wifi_notify_subscribe(pid_t pid, struct sigevent *event);
|
||||
|
||||
#ifdef ESP32_WLAN_HAS_STA
|
||||
|
||||
|
@ -442,7 +442,7 @@ void esp_wifi_scan_event_parse(void)
|
||||
* in pointer field.
|
||||
*/
|
||||
|
||||
iwe->u.essid.pointer = (FAR void *)sizeof(iwe->u.essid);
|
||||
iwe->u.essid.pointer = (void *)sizeof(iwe->u.essid);
|
||||
memcpy(&iwe->u.essid + 1,
|
||||
ap_list_buffer[bss_count].ssid, essid_len);
|
||||
wlinfo("INFO: ssid %s\n", ap_list_buffer[bss_count].ssid);
|
||||
|
@ -128,7 +128,7 @@ struct wlan_ops
|
||||
int (*rssi)(struct iwreq *iwr, bool set);
|
||||
int (*connect)(void);
|
||||
int (*disconnect)(void);
|
||||
int (*event)(pid_t pid, FAR struct sigevent *event);
|
||||
int (*event)(pid_t pid, struct sigevent *event);
|
||||
int (*stop)(void);
|
||||
};
|
||||
|
||||
@ -231,17 +231,17 @@ static const struct wlan_ops g_softap_ops =
|
||||
|
||||
/* Common TX logic */
|
||||
|
||||
static void wlan_transmit(FAR struct wlan_priv_s *priv);
|
||||
static void wlan_rxpoll(FAR void *arg);
|
||||
static int wlan_txpoll(FAR struct net_driver_s *dev);
|
||||
static void wlan_dopoll(FAR struct wlan_priv_s *priv);
|
||||
static void wlan_transmit(struct wlan_priv_s *priv);
|
||||
static void wlan_rxpoll(void *arg);
|
||||
static int wlan_txpoll(struct net_driver_s *dev);
|
||||
static void wlan_dopoll(struct wlan_priv_s *priv);
|
||||
|
||||
/* Watchdog timer expirations */
|
||||
|
||||
static void wlan_txtimeout_work(FAR void *arg);
|
||||
static void wlan_txtimeout_work(void *arg);
|
||||
static void wlan_txtimeout_expiry(wdparm_t arg);
|
||||
|
||||
static void wlan_poll_work(FAR void *arg);
|
||||
static void wlan_poll_work(void *arg);
|
||||
static void wlan_poll_expiry(wdparm_t arg);
|
||||
|
||||
/* NuttX callback functions */
|
||||
@ -249,15 +249,15 @@ static void wlan_poll_expiry(wdparm_t arg);
|
||||
static int wlan_ifup(struct net_driver_s *dev);
|
||||
static int wlan_ifdown(struct net_driver_s *dev);
|
||||
|
||||
static void wlan_txavail_work(FAR void *arg);
|
||||
static void wlan_txavail_work(void *arg);
|
||||
static int wlan_txavail(struct net_driver_s *dev);
|
||||
|
||||
#if defined(CONFIG_NET_MCASTGROUP) || defined(CONFIG_NET_ICMPv6)
|
||||
static int wlan_addmac(struct net_driver_s *dev, FAR const uint8_t *mac);
|
||||
static int wlan_addmac(struct net_driver_s *dev, const uint8_t *mac);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_MCASTGROUP
|
||||
static int wlan_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac);
|
||||
static int wlan_rmmac(struct net_driver_s *dev, const uint8_t *mac);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NETDEV_IOCTL
|
||||
@ -446,7 +446,7 @@ static inline void wlan_add_txpkt_head(struct wlan_priv_s *priv,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static struct wlan_pktbuf *wlan_recvframe(FAR struct wlan_priv_s *priv)
|
||||
static struct wlan_pktbuf *wlan_recvframe(struct wlan_priv_s *priv)
|
||||
{
|
||||
irqstate_t flags;
|
||||
sq_entry_t *entry;
|
||||
@ -479,7 +479,7 @@ static struct wlan_pktbuf *wlan_recvframe(FAR struct wlan_priv_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static struct wlan_pktbuf *wlan_txframe(FAR struct wlan_priv_s *priv)
|
||||
static struct wlan_pktbuf *wlan_txframe(struct wlan_priv_s *priv)
|
||||
{
|
||||
irqstate_t flags;
|
||||
sq_entry_t *entry;
|
||||
@ -513,7 +513,7 @@ static struct wlan_pktbuf *wlan_txframe(FAR struct wlan_priv_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void wlan_transmit(FAR struct wlan_priv_s *priv)
|
||||
static void wlan_transmit(struct wlan_priv_s *priv)
|
||||
{
|
||||
struct wlan_pktbuf *pktbuf;
|
||||
int ret;
|
||||
@ -550,7 +550,7 @@ static void wlan_transmit(FAR struct wlan_priv_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void wlan_tx_done(FAR struct wlan_priv_s *priv)
|
||||
static void wlan_tx_done(struct wlan_priv_s *priv)
|
||||
{
|
||||
wd_cancel(&priv->txtimeout);
|
||||
|
||||
@ -575,7 +575,7 @@ static void wlan_tx_done(FAR struct wlan_priv_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int wlan_rx_done(FAR struct wlan_priv_s *priv, void *buffer,
|
||||
static int wlan_rx_done(struct wlan_priv_s *priv, void *buffer,
|
||||
uint16_t len, void *eb)
|
||||
{
|
||||
struct wlan_pktbuf *pktbuf;
|
||||
@ -645,12 +645,12 @@ out:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void wlan_rxpoll(FAR void *arg)
|
||||
static void wlan_rxpoll(void *arg)
|
||||
{
|
||||
struct wlan_pktbuf *pktbuf;
|
||||
struct eth_hdr_s *eth_hdr;
|
||||
FAR struct wlan_priv_s *priv = (FAR struct wlan_priv_s *)arg;
|
||||
FAR struct net_driver_s *dev = &priv->dev;
|
||||
struct wlan_priv_s *priv = (struct wlan_priv_s *)arg;
|
||||
struct net_driver_s *dev = &priv->dev;
|
||||
#ifdef WLAN_RX_THRESHOLD
|
||||
uint32_t rbytes = 0;
|
||||
#endif
|
||||
@ -868,10 +868,10 @@ static void wlan_rxpoll(FAR void *arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int wlan_txpoll(FAR struct net_driver_s *dev)
|
||||
static int wlan_txpoll(struct net_driver_s *dev)
|
||||
{
|
||||
struct wlan_pktbuf *pktbuf;
|
||||
FAR struct wlan_priv_s *priv = (FAR struct wlan_priv_s *)dev->d_private;
|
||||
struct wlan_priv_s *priv = (struct wlan_priv_s *)dev->d_private;
|
||||
|
||||
DEBUGASSERT(dev->d_buf != NULL);
|
||||
|
||||
@ -941,9 +941,9 @@ static int wlan_txpoll(FAR struct net_driver_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void wlan_dopoll(FAR struct wlan_priv_s *priv)
|
||||
static void wlan_dopoll(struct wlan_priv_s *priv)
|
||||
{
|
||||
FAR struct net_driver_s *dev = &priv->dev;
|
||||
struct net_driver_s *dev = &priv->dev;
|
||||
struct wlan_pktbuf *pktbuf;
|
||||
uint8_t *txbuf;
|
||||
int ret;
|
||||
@ -1059,10 +1059,10 @@ static void wlan_txtimeout_expiry(wdparm_t arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void wlan_poll_work(FAR void *arg)
|
||||
static void wlan_poll_work(void *arg)
|
||||
{
|
||||
int32_t delay = WLAN_WDDELAY;
|
||||
FAR struct wlan_priv_s *priv = (FAR struct wlan_priv_s *)arg;
|
||||
struct wlan_priv_s *priv = (struct wlan_priv_s *)arg;
|
||||
struct net_driver_s *dev = &priv->dev;
|
||||
struct wlan_pktbuf *pktbuf;
|
||||
|
||||
@ -1129,7 +1129,7 @@ exit:
|
||||
|
||||
static void wlan_poll_expiry(wdparm_t arg)
|
||||
{
|
||||
FAR struct wlan_priv_s *priv = (FAR struct wlan_priv_s *)arg;
|
||||
struct wlan_priv_s *priv = (struct wlan_priv_s *)arg;
|
||||
|
||||
if (priv->ifup)
|
||||
{
|
||||
@ -1154,9 +1154,9 @@ static void wlan_poll_expiry(wdparm_t arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void wlan_txavail_work(FAR void *arg)
|
||||
static void wlan_txavail_work(void *arg)
|
||||
{
|
||||
FAR struct wlan_priv_s *priv = (FAR struct wlan_priv_s *)arg;
|
||||
struct wlan_priv_s *priv = (struct wlan_priv_s *)arg;
|
||||
|
||||
/* Try to send all cached TX packets even if net is down */
|
||||
|
||||
@ -1197,10 +1197,10 @@ static void wlan_txavail_work(FAR void *arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int wlan_ifup(FAR struct net_driver_s *dev)
|
||||
static int wlan_ifup(struct net_driver_s *dev)
|
||||
{
|
||||
int ret;
|
||||
FAR struct wlan_priv_s *priv = (FAR struct wlan_priv_s *)dev->d_private;
|
||||
struct wlan_priv_s *priv = (struct wlan_priv_s *)dev->d_private;
|
||||
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
ninfo("Bringing up: %d.%d.%d.%d\n",
|
||||
@ -1264,10 +1264,10 @@ static int wlan_ifup(FAR struct net_driver_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int wlan_ifdown(FAR struct net_driver_s *dev)
|
||||
static int wlan_ifdown(struct net_driver_s *dev)
|
||||
{
|
||||
int ret;
|
||||
FAR struct wlan_priv_s *priv = (FAR struct wlan_priv_s *)dev->d_private;
|
||||
struct wlan_priv_s *priv = (struct wlan_priv_s *)dev->d_private;
|
||||
|
||||
net_lock();
|
||||
|
||||
@ -1316,9 +1316,9 @@ static int wlan_ifdown(FAR struct net_driver_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int wlan_txavail(FAR struct net_driver_s *dev)
|
||||
static int wlan_txavail(struct net_driver_s *dev)
|
||||
{
|
||||
FAR struct wlan_priv_s *priv = (FAR struct wlan_priv_s *)dev->d_private;
|
||||
struct wlan_priv_s *priv = (struct wlan_priv_s *)dev->d_private;
|
||||
|
||||
if (work_available(&priv->txwork))
|
||||
{
|
||||
@ -1347,9 +1347,9 @@ static int wlan_txavail(FAR struct net_driver_s *dev)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NET_MCASTGROUP) || defined(CONFIG_NET_ICMPv6)
|
||||
static int wlan_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
static int wlan_addmac(struct net_driver_s *dev, const uint8_t *mac)
|
||||
{
|
||||
FAR struct wlan_priv_s *priv = (FAR struct wlan_priv_s *)dev->d_private;
|
||||
struct wlan_priv_s *priv = (struct wlan_priv_s *)dev->d_private;
|
||||
|
||||
/* Add the MAC address to the hardware multicast routing table */
|
||||
|
||||
@ -1374,9 +1374,9 @@ static int wlan_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_MCASTGROUP
|
||||
static int wlan_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
static int wlan_rmmac(struct net_driver_s *dev, const uint8_t *mac)
|
||||
{
|
||||
FAR struct wlan_priv_s *priv = (FAR struct wlan_priv_s *)dev->d_private;
|
||||
struct wlan_priv_s *priv = (struct wlan_priv_s *)dev->d_private;
|
||||
|
||||
/* Add the MAC address to the hardware multicast routing table */
|
||||
|
||||
@ -1399,9 +1399,9 @@ static int wlan_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_ICMPv6
|
||||
static void wlan_ipv6multicast(FAR struct wlan_priv_s *priv)
|
||||
static void wlan_ipv6multicast(struct wlan_priv_s *priv)
|
||||
{
|
||||
FAR struct net_driver_s *dev;
|
||||
struct net_driver_s *dev;
|
||||
uint16_t tmp16;
|
||||
uint8_t mac[6];
|
||||
|
||||
@ -1471,7 +1471,7 @@ static void wlan_ipv6multicast(FAR struct wlan_priv_s *priv)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NETDEV_IOCTL
|
||||
static int wlan_ioctl(FAR struct net_driver_s *dev,
|
||||
static int wlan_ioctl(struct net_driver_s *dev,
|
||||
int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
@ -1659,8 +1659,8 @@ static int esp32_net_initialize(int devno, uint8_t *mac_addr,
|
||||
const struct wlan_ops *ops)
|
||||
{
|
||||
int ret;
|
||||
FAR struct wlan_priv_s *priv;
|
||||
FAR struct net_driver_s *netdev;
|
||||
struct wlan_priv_s *priv;
|
||||
struct net_driver_s *netdev;
|
||||
|
||||
priv = &g_wlan_priv[devno];
|
||||
if (priv->ref)
|
||||
@ -1728,7 +1728,7 @@ static int esp32_net_initialize(int devno, uint8_t *mac_addr,
|
||||
#ifdef ESP32_WLAN_HAS_STA
|
||||
static int wlan_sta_rx_done(void *buffer, uint16_t len, void *eb)
|
||||
{
|
||||
FAR struct wlan_priv_s *priv = &g_wlan_priv[ESP32_WLAN_STA_DEVNO];
|
||||
struct wlan_priv_s *priv = &g_wlan_priv[ESP32_WLAN_STA_DEVNO];
|
||||
|
||||
return wlan_rx_done(priv, buffer, len, eb);
|
||||
}
|
||||
@ -1753,7 +1753,7 @@ static int wlan_sta_rx_done(void *buffer, uint16_t len, void *eb)
|
||||
|
||||
static void wlan_sta_tx_done(uint8_t *data, uint16_t *len, bool status)
|
||||
{
|
||||
FAR struct wlan_priv_s *priv = &g_wlan_priv[ESP32_WLAN_STA_DEVNO];
|
||||
struct wlan_priv_s *priv = &g_wlan_priv[ESP32_WLAN_STA_DEVNO];
|
||||
|
||||
wlan_tx_done(priv);
|
||||
}
|
||||
@ -1779,7 +1779,7 @@ static void wlan_sta_tx_done(uint8_t *data, uint16_t *len, bool status)
|
||||
#ifdef ESP32_WLAN_HAS_SOFTAP
|
||||
static int wlan_softap_rx_done(void *buffer, uint16_t len, void *eb)
|
||||
{
|
||||
FAR struct wlan_priv_s *priv = &g_wlan_priv[ESP32_WLAN_SOFTAP_DEVNO];
|
||||
struct wlan_priv_s *priv = &g_wlan_priv[ESP32_WLAN_SOFTAP_DEVNO];
|
||||
|
||||
return wlan_rx_done(priv, buffer, len, eb);
|
||||
}
|
||||
@ -1804,7 +1804,7 @@ static int wlan_softap_rx_done(void *buffer, uint16_t len, void *eb)
|
||||
|
||||
static void wlan_softap_tx_done(uint8_t *data, uint16_t *len, bool status)
|
||||
{
|
||||
FAR struct wlan_priv_s *priv = &g_wlan_priv[ESP32_WLAN_SOFTAP_DEVNO];
|
||||
struct wlan_priv_s *priv = &g_wlan_priv[ESP32_WLAN_SOFTAP_DEVNO];
|
||||
|
||||
wlan_tx_done(priv);
|
||||
}
|
||||
|
@ -57,13 +57,13 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
|
||||
void up_allocate_heap(void **heap_start, size_t *heap_size)
|
||||
{
|
||||
extern uint32_t *_dram0_rtos_reserved_start;
|
||||
|
||||
board_autoled_on(LED_HEAPALLOCATE);
|
||||
|
||||
*heap_start = (FAR void *)&_sheap;
|
||||
*heap_start = (void *)&_sheap;
|
||||
*heap_size = (size_t)((uintptr_t)&_dram0_rtos_reserved_start -
|
||||
(uintptr_t)&_sheap);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ static void gpio_dispatch(int irq, uint32_t status, uint32_t *regs)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESP32S2_GPIO_IRQ
|
||||
static int gpio_interrupt(int irq, FAR void *context, FAR void *arg)
|
||||
static int gpio_interrupt(int irq, void *context, void *arg)
|
||||
{
|
||||
uint32_t status;
|
||||
|
||||
|
@ -229,7 +229,7 @@ static uart_dev_t g_uart1_dev =
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int uart_handler(int irq, FAR void *context, FAR void *arg)
|
||||
static int uart_handler(int irq, void *context, void *arg)
|
||||
{
|
||||
struct uart_dev_s *dev = (struct uart_dev_s *)arg;
|
||||
struct esp32s2_uart_s *priv = dev->priv;
|
||||
|
@ -50,7 +50,7 @@
|
||||
|
||||
struct esp32s2_tim_priv_s
|
||||
{
|
||||
FAR struct esp32s2_tim_ops_s *ops;
|
||||
struct esp32s2_tim_ops_s *ops;
|
||||
uint8_t gid; /* Group instance */
|
||||
uint8_t tid; /* Timer instance */
|
||||
uint8_t int_pri;
|
||||
@ -66,34 +66,34 @@ struct esp32s2_tim_priv_s
|
||||
|
||||
/* TIM operations ***********************************************************/
|
||||
|
||||
static void esp32s2_tim_start(FAR struct esp32s2_tim_dev_s *dev);
|
||||
static void esp32s2_tim_stop(FAR struct esp32s2_tim_dev_s *dev);
|
||||
static void esp32s2_tim_clear(FAR struct esp32s2_tim_dev_s *dev);
|
||||
static void esp32s2_tim_setmode(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_start(struct esp32s2_tim_dev_s *dev);
|
||||
static void esp32s2_tim_stop(struct esp32s2_tim_dev_s *dev);
|
||||
static void esp32s2_tim_clear(struct esp32s2_tim_dev_s *dev);
|
||||
static void esp32s2_tim_setmode(struct esp32s2_tim_dev_s *dev,
|
||||
enum esp32s2_tim_mode_e mode);
|
||||
static void esp32s2_tim_setclksrc(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_setclksrc(struct esp32s2_tim_dev_s *dev,
|
||||
enum esp32s2_tim_clksrc_e src);
|
||||
static void esp32s2_tim_setpre(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_setpre(struct esp32s2_tim_dev_s *dev,
|
||||
uint16_t pre);
|
||||
static void esp32s2_tim_getcounter(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_getcounter(struct esp32s2_tim_dev_s *dev,
|
||||
uint64_t *value);
|
||||
static void esp32s2_tim_setcounter(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_setcounter(struct esp32s2_tim_dev_s *dev,
|
||||
uint64_t value);
|
||||
static void esp32s2_tim_reload_now(FAR struct esp32s2_tim_dev_s *dev);
|
||||
static void esp32s2_tim_getalarmvalue(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_reload_now(struct esp32s2_tim_dev_s *dev);
|
||||
static void esp32s2_tim_getalarmvalue(struct esp32s2_tim_dev_s *dev,
|
||||
uint64_t *value);
|
||||
static void esp32s2_tim_setalarmvalue(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_setalarmvalue(struct esp32s2_tim_dev_s *dev,
|
||||
uint64_t value);
|
||||
static void esp32s2_tim_setalarm(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_setalarm(struct esp32s2_tim_dev_s *dev,
|
||||
bool enable);
|
||||
static void esp32s2_tim_setautoreload(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_setautoreload(struct esp32s2_tim_dev_s *dev,
|
||||
bool enable);
|
||||
static int esp32s2_tim_setisr(FAR struct esp32s2_tim_dev_s *dev,
|
||||
xcpt_t handler, FAR void * arg);
|
||||
static void esp32s2_tim_enableint(FAR struct esp32s2_tim_dev_s *dev);
|
||||
static void esp32s2_tim_disableint(FAR struct esp32s2_tim_dev_s *dev);
|
||||
static void esp32s2_tim_ackint(FAR struct esp32s2_tim_dev_s *dev);
|
||||
static int esp32s2_tim_checkint(FAR struct esp32s2_tim_dev_s *dev);
|
||||
static int esp32s2_tim_setisr(struct esp32s2_tim_dev_s *dev,
|
||||
xcpt_t handler, void * arg);
|
||||
static void esp32s2_tim_enableint(struct esp32s2_tim_dev_s *dev);
|
||||
static void esp32s2_tim_disableint(struct esp32s2_tim_dev_s *dev);
|
||||
static void esp32s2_tim_ackint(struct esp32s2_tim_dev_s *dev);
|
||||
static int esp32s2_tim_checkint(struct esp32s2_tim_dev_s *dev);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@ -203,9 +203,9 @@ struct esp32s2_tim_priv_s g_esp32s2_tim3_priv =
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s2_tim_start(FAR struct esp32s2_tim_dev_s *dev)
|
||||
static void esp32s2_tim_start(struct esp32s2_tim_dev_s *dev)
|
||||
{
|
||||
struct esp32s2_tim_priv_s *priv = (FAR struct esp32s2_tim_priv_s *)dev;
|
||||
struct esp32s2_tim_priv_s *priv = (struct esp32s2_tim_priv_s *)dev;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -230,9 +230,9 @@ static void esp32s2_tim_start(FAR struct esp32s2_tim_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s2_tim_stop(FAR struct esp32s2_tim_dev_s *dev)
|
||||
static void esp32s2_tim_stop(struct esp32s2_tim_dev_s *dev)
|
||||
{
|
||||
struct esp32s2_tim_priv_s *priv = (FAR struct esp32s2_tim_priv_s *)dev;
|
||||
struct esp32s2_tim_priv_s *priv = (struct esp32s2_tim_priv_s *)dev;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -257,7 +257,7 @@ static void esp32s2_tim_stop(FAR struct esp32s2_tim_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s2_tim_clear(FAR struct esp32s2_tim_dev_s *dev)
|
||||
static void esp32s2_tim_clear(struct esp32s2_tim_dev_s *dev)
|
||||
{
|
||||
uint64_t clear_value = 0;
|
||||
|
||||
@ -279,10 +279,10 @@ static void esp32s2_tim_clear(FAR struct esp32s2_tim_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s2_tim_setmode(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_setmode(struct esp32s2_tim_dev_s *dev,
|
||||
enum esp32s2_tim_mode_e mode)
|
||||
{
|
||||
struct esp32s2_tim_priv_s *priv = (FAR struct esp32s2_tim_priv_s *)dev;
|
||||
struct esp32s2_tim_priv_s *priv = (struct esp32s2_tim_priv_s *)dev;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -325,10 +325,10 @@ static void esp32s2_tim_setmode(FAR struct esp32s2_tim_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s2_tim_setclksrc(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_setclksrc(struct esp32s2_tim_dev_s *dev,
|
||||
enum esp32s2_tim_clksrc_e src)
|
||||
{
|
||||
struct esp32s2_tim_priv_s *priv = (FAR struct esp32s2_tim_priv_s *)dev;
|
||||
struct esp32s2_tim_priv_s *priv = (struct esp32s2_tim_priv_s *)dev;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -356,10 +356,10 @@ static void esp32s2_tim_setclksrc(FAR struct esp32s2_tim_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s2_tim_setpre(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_setpre(struct esp32s2_tim_dev_s *dev,
|
||||
uint16_t pre)
|
||||
{
|
||||
struct esp32s2_tim_priv_s *priv = (FAR struct esp32s2_tim_priv_s *)dev;
|
||||
struct esp32s2_tim_priv_s *priv = (struct esp32s2_tim_priv_s *)dev;
|
||||
uint32_t mask = (uint32_t)pre << TIMG_T0_DIVIDER_S;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
@ -387,11 +387,11 @@ static void esp32s2_tim_setpre(FAR struct esp32s2_tim_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s2_tim_getcounter(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_getcounter(struct esp32s2_tim_dev_s *dev,
|
||||
uint64_t *value)
|
||||
{
|
||||
uint32_t value_32;
|
||||
struct esp32s2_tim_priv_s *priv = (FAR struct esp32s2_tim_priv_s *)dev;
|
||||
struct esp32s2_tim_priv_s *priv = (struct esp32s2_tim_priv_s *)dev;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -443,10 +443,10 @@ static void esp32s2_tim_getcounter(FAR struct esp32s2_tim_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s2_tim_setcounter(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_setcounter(struct esp32s2_tim_dev_s *dev,
|
||||
uint64_t value)
|
||||
{
|
||||
struct esp32s2_tim_priv_s *priv = (FAR struct esp32s2_tim_priv_s *)dev;
|
||||
struct esp32s2_tim_priv_s *priv = (struct esp32s2_tim_priv_s *)dev;
|
||||
uint64_t low_64 = value & UINT32_MAX;
|
||||
uint64_t high_64 = (value >> SHIFT_32);
|
||||
|
||||
@ -478,9 +478,9 @@ static void esp32s2_tim_setcounter(FAR struct esp32s2_tim_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s2_tim_reload_now(FAR struct esp32s2_tim_dev_s *dev)
|
||||
static void esp32s2_tim_reload_now(struct esp32s2_tim_dev_s *dev)
|
||||
{
|
||||
struct esp32s2_tim_priv_s *priv = (FAR struct esp32s2_tim_priv_s *)dev;
|
||||
struct esp32s2_tim_priv_s *priv = (struct esp32s2_tim_priv_s *)dev;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -508,11 +508,11 @@ static void esp32s2_tim_reload_now(FAR struct esp32s2_tim_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s2_tim_getalarmvalue(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_getalarmvalue(struct esp32s2_tim_dev_s *dev,
|
||||
uint64_t *value)
|
||||
{
|
||||
uint32_t value_32;
|
||||
struct esp32s2_tim_priv_s *priv = (FAR struct esp32s2_tim_priv_s *)dev;
|
||||
struct esp32s2_tim_priv_s *priv = (struct esp32s2_tim_priv_s *)dev;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -551,10 +551,10 @@ static void esp32s2_tim_getalarmvalue(FAR struct esp32s2_tim_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s2_tim_setalarmvalue(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_setalarmvalue(struct esp32s2_tim_dev_s *dev,
|
||||
uint64_t value)
|
||||
{
|
||||
struct esp32s2_tim_priv_s *priv = (FAR struct esp32s2_tim_priv_s *)dev;
|
||||
struct esp32s2_tim_priv_s *priv = (struct esp32s2_tim_priv_s *)dev;
|
||||
uint64_t low_64 = value & UINT32_MAX;
|
||||
uint64_t high_64 = (value >> SHIFT_32);
|
||||
|
||||
@ -587,10 +587,10 @@ static void esp32s2_tim_setalarmvalue(FAR struct esp32s2_tim_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s2_tim_setalarm(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_setalarm(struct esp32s2_tim_dev_s *dev,
|
||||
bool enable)
|
||||
{
|
||||
struct esp32s2_tim_priv_s *priv = (FAR struct esp32s2_tim_priv_s *)dev;
|
||||
struct esp32s2_tim_priv_s *priv = (struct esp32s2_tim_priv_s *)dev;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -632,10 +632,10 @@ static void esp32s2_tim_setalarm(FAR struct esp32s2_tim_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s2_tim_setautoreload(FAR struct esp32s2_tim_dev_s *dev,
|
||||
static void esp32s2_tim_setautoreload(struct esp32s2_tim_dev_s *dev,
|
||||
bool enable)
|
||||
{
|
||||
struct esp32s2_tim_priv_s *priv = (FAR struct esp32s2_tim_priv_s *)dev;
|
||||
struct esp32s2_tim_priv_s *priv = (struct esp32s2_tim_priv_s *)dev;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -683,10 +683,10 @@ static void esp32s2_tim_setautoreload(FAR struct esp32s2_tim_dev_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32s2_tim_setisr(FAR struct esp32s2_tim_dev_s *dev,
|
||||
xcpt_t handler, FAR void *arg)
|
||||
static int esp32s2_tim_setisr(struct esp32s2_tim_dev_s *dev,
|
||||
xcpt_t handler, void *arg)
|
||||
{
|
||||
FAR struct esp32s2_tim_priv_s *priv = (FAR struct esp32s2_tim_priv_s *)dev;
|
||||
struct esp32s2_tim_priv_s *priv = (struct esp32s2_tim_priv_s *)dev;
|
||||
int ret = OK;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
@ -772,9 +772,9 @@ errout:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s2_tim_enableint(FAR struct esp32s2_tim_dev_s *dev)
|
||||
static void esp32s2_tim_enableint(struct esp32s2_tim_dev_s *dev)
|
||||
{
|
||||
struct esp32s2_tim_priv_s *priv = (FAR struct esp32s2_tim_priv_s *)dev;
|
||||
struct esp32s2_tim_priv_s *priv = (struct esp32s2_tim_priv_s *)dev;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -801,9 +801,9 @@ static void esp32s2_tim_enableint(FAR struct esp32s2_tim_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s2_tim_disableint(FAR struct esp32s2_tim_dev_s *dev)
|
||||
static void esp32s2_tim_disableint(struct esp32s2_tim_dev_s *dev)
|
||||
{
|
||||
struct esp32s2_tim_priv_s *priv = (FAR struct esp32s2_tim_priv_s *)dev;
|
||||
struct esp32s2_tim_priv_s *priv = (struct esp32s2_tim_priv_s *)dev;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -830,9 +830,9 @@ static void esp32s2_tim_disableint(FAR struct esp32s2_tim_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s2_tim_ackint(FAR struct esp32s2_tim_dev_s *dev)
|
||||
static void esp32s2_tim_ackint(struct esp32s2_tim_dev_s *dev)
|
||||
{
|
||||
struct esp32s2_tim_priv_s *priv = (FAR struct esp32s2_tim_priv_s *)dev;
|
||||
struct esp32s2_tim_priv_s *priv = (struct esp32s2_tim_priv_s *)dev;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
@ -860,7 +860,7 @@ static void esp32s2_tim_ackint(FAR struct esp32s2_tim_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32s2_tim_checkint(FAR struct esp32s2_tim_dev_s *dev)
|
||||
static int esp32s2_tim_checkint(struct esp32s2_tim_dev_s *dev)
|
||||
{
|
||||
struct esp32s2_tim_priv_s *priv = (struct esp32s2_tim_priv_s *)dev;
|
||||
uint32_t reg_value;
|
||||
@ -903,9 +903,9 @@ static int esp32s2_tim_checkint(FAR struct esp32s2_tim_dev_s *dev)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct esp32s2_tim_dev_s *esp32s2_tim_init(int timer)
|
||||
struct esp32s2_tim_dev_s *esp32s2_tim_init(int timer)
|
||||
{
|
||||
FAR struct esp32s2_tim_priv_s *tim = NULL;
|
||||
struct esp32s2_tim_priv_s *tim = NULL;
|
||||
|
||||
/* First, take the data structure associated with the timer instance */
|
||||
|
||||
@ -963,7 +963,7 @@ FAR struct esp32s2_tim_dev_s *esp32s2_tim_init(int timer)
|
||||
}
|
||||
|
||||
errout:
|
||||
return (FAR struct esp32s2_tim_dev_s *)tim;
|
||||
return (struct esp32s2_tim_dev_s *)tim;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -977,12 +977,12 @@ errout:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s2_tim_deinit(FAR struct esp32s2_tim_dev_s *dev)
|
||||
void esp32s2_tim_deinit(struct esp32s2_tim_dev_s *dev)
|
||||
{
|
||||
FAR struct esp32s2_tim_priv_s *tim = NULL;
|
||||
struct esp32s2_tim_priv_s *tim = NULL;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
tim = (FAR struct esp32s2_tim_priv_s *)dev;
|
||||
tim = (struct esp32s2_tim_priv_s *)dev;
|
||||
tim->inuse = false;
|
||||
}
|
||||
|
@ -96,43 +96,43 @@ struct esp32s2_tim_ops_s
|
||||
{
|
||||
/* Timer tasks */
|
||||
|
||||
CODE void (*start)(FAR struct esp32s2_tim_dev_s *dev);
|
||||
CODE void (*stop)(FAR struct esp32s2_tim_dev_s *dev);
|
||||
CODE void (*clear)(FAR struct esp32s2_tim_dev_s *dev);
|
||||
CODE void (*start)(struct esp32s2_tim_dev_s *dev);
|
||||
CODE void (*stop)(struct esp32s2_tim_dev_s *dev);
|
||||
CODE void (*clear)(struct esp32s2_tim_dev_s *dev);
|
||||
|
||||
/* Timer operations */
|
||||
|
||||
CODE void (*setmode)(FAR struct esp32s2_tim_dev_s *dev,
|
||||
CODE void (*setmode)(struct esp32s2_tim_dev_s *dev,
|
||||
enum esp32s2_tim_mode_e mode);
|
||||
CODE void (*setpre)(FAR struct esp32s2_tim_dev_s *dev, uint16_t pre);
|
||||
CODE void (*getcounter)(FAR struct esp32s2_tim_dev_s *dev,
|
||||
CODE void (*setpre)(struct esp32s2_tim_dev_s *dev, uint16_t pre);
|
||||
CODE void (*getcounter)(struct esp32s2_tim_dev_s *dev,
|
||||
uint64_t *value);
|
||||
CODE void (*setclksrc)(FAR struct esp32s2_tim_dev_s *dev,
|
||||
CODE void (*setclksrc)(struct esp32s2_tim_dev_s *dev,
|
||||
enum esp32s2_tim_clksrc_e src);
|
||||
CODE void (*setcounter)(FAR struct esp32s2_tim_dev_s *dev, uint64_t value);
|
||||
CODE void (*reloadnow)(FAR struct esp32s2_tim_dev_s *dev);
|
||||
CODE void (*getalarmvalue)(FAR struct esp32s2_tim_dev_s *dev,
|
||||
CODE void (*setcounter)(struct esp32s2_tim_dev_s *dev, uint64_t value);
|
||||
CODE void (*reloadnow)(struct esp32s2_tim_dev_s *dev);
|
||||
CODE void (*getalarmvalue)(struct esp32s2_tim_dev_s *dev,
|
||||
uint64_t *value);
|
||||
CODE void (*setalarmvalue)(FAR struct esp32s2_tim_dev_s *dev,
|
||||
CODE void (*setalarmvalue)(struct esp32s2_tim_dev_s *dev,
|
||||
uint64_t value);
|
||||
CODE void (*setalarm)(FAR struct esp32s2_tim_dev_s *dev, bool enable);
|
||||
CODE void (*setautoreload)(FAR struct esp32s2_tim_dev_s *dev, bool enable);
|
||||
CODE void (*setalarm)(struct esp32s2_tim_dev_s *dev, bool enable);
|
||||
CODE void (*setautoreload)(struct esp32s2_tim_dev_s *dev, bool enable);
|
||||
|
||||
/* Timer interrupts */
|
||||
|
||||
CODE int (*setisr)(FAR struct esp32s2_tim_dev_s *dev, xcpt_t handler,
|
||||
FAR void * arg);
|
||||
CODE void (*enableint)(FAR struct esp32s2_tim_dev_s *dev);
|
||||
CODE void (*disableint)(FAR struct esp32s2_tim_dev_s *dev);
|
||||
CODE void (*ackint)(FAR struct esp32s2_tim_dev_s *dev);
|
||||
CODE int (*checkint)(FAR struct esp32s2_tim_dev_s *dev);
|
||||
CODE int (*setisr)(struct esp32s2_tim_dev_s *dev, xcpt_t handler,
|
||||
void * arg);
|
||||
CODE void (*enableint)(struct esp32s2_tim_dev_s *dev);
|
||||
CODE void (*disableint)(struct esp32s2_tim_dev_s *dev);
|
||||
CODE void (*ackint)(struct esp32s2_tim_dev_s *dev);
|
||||
CODE int (*checkint)(struct esp32s2_tim_dev_s *dev);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct esp32s2_tim_dev_s *esp32s2_tim_init(int timer);
|
||||
void esp32s2_tim_deinit(FAR struct esp32s2_tim_dev_s *dev);
|
||||
struct esp32s2_tim_dev_s *esp32s2_tim_init(int timer);
|
||||
void esp32s2_tim_deinit(struct esp32s2_tim_dev_s *dev);
|
||||
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S2_ESP32S2_TIM_H */
|
||||
|
@ -51,32 +51,32 @@
|
||||
|
||||
struct esp32s2_timer_lowerhalf_s
|
||||
{
|
||||
FAR const struct timer_ops_s *ops; /* Lower half operations */
|
||||
FAR struct esp32s2_tim_dev_s *tim; /* esp32s2 timer driver */
|
||||
tccb_t callback; /* Interrupt callback */
|
||||
FAR void *arg; /* Argument passed to upper half callback */
|
||||
bool started; /* True: Timer has been started */
|
||||
FAR void *upper; /* Pointer to watchdog_upperhalf_s */
|
||||
const struct timer_ops_s *ops; /* Lower half operations */
|
||||
struct esp32s2_tim_dev_s *tim; /* esp32s2 timer driver */
|
||||
tccb_t callback; /* Interrupt callback */
|
||||
void *arg; /* Argument passed to upper half callback */
|
||||
bool started; /* True: Timer has been started */
|
||||
void *upper; /* Pointer to watchdog_upperhalf_s */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32s2_timer_handler(int irq, FAR void *context, void *arg);
|
||||
static int esp32s2_timer_handler(int irq, void *context, void *arg);
|
||||
|
||||
/* "Lower half" driver methods **********************************************/
|
||||
|
||||
static int esp32s2_timer_start(FAR struct timer_lowerhalf_s *lower);
|
||||
static int esp32s2_timer_stop(FAR struct timer_lowerhalf_s *lower);
|
||||
static int esp32s2_timer_getstatus(FAR struct timer_lowerhalf_s *lower,
|
||||
FAR struct timer_status_s *status);
|
||||
static int esp32s2_timer_settimeout(FAR struct timer_lowerhalf_s *lower,
|
||||
static int esp32s2_timer_start(struct timer_lowerhalf_s *lower);
|
||||
static int esp32s2_timer_stop(struct timer_lowerhalf_s *lower);
|
||||
static int esp32s2_timer_getstatus(struct timer_lowerhalf_s *lower,
|
||||
struct timer_status_s *status);
|
||||
static int esp32s2_timer_settimeout(struct timer_lowerhalf_s *lower,
|
||||
uint32_t timeout);
|
||||
static int esp32s2_timer_maxtimeout(FAR struct timer_lowerhalf_s *lower,
|
||||
static int esp32s2_timer_maxtimeout(struct timer_lowerhalf_s *lower,
|
||||
uint32_t *timeout);
|
||||
static void esp32s2_timer_setcallback(FAR struct timer_lowerhalf_s *lower,
|
||||
tccb_t callback, FAR void *arg);
|
||||
static void esp32s2_timer_setcallback(struct timer_lowerhalf_s *lower,
|
||||
tccb_t callback, void *arg);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@ -147,10 +147,10 @@ static struct esp32s2_timer_lowerhalf_s g_esp32s2_timer3_lowerhalf =
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32s2_timer_handler(int irq, FAR void *context, void *arg)
|
||||
static int esp32s2_timer_handler(int irq, void *context, void *arg)
|
||||
{
|
||||
FAR struct esp32s2_timer_lowerhalf_s *priv =
|
||||
(FAR struct esp32s2_timer_lowerhalf_s *)arg;
|
||||
struct esp32s2_timer_lowerhalf_s *priv =
|
||||
(struct esp32s2_timer_lowerhalf_s *)arg;
|
||||
uint32_t next_interval_us = 0;
|
||||
|
||||
if (priv->callback(&next_interval_us, priv->upper))
|
||||
@ -187,10 +187,10 @@ static int esp32s2_timer_handler(int irq, FAR void *context, void *arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32s2_timer_start(FAR struct timer_lowerhalf_s *lower)
|
||||
static int esp32s2_timer_start(struct timer_lowerhalf_s *lower)
|
||||
{
|
||||
FAR struct esp32s2_timer_lowerhalf_s *priv =
|
||||
(FAR struct esp32s2_timer_lowerhalf_s *)lower;
|
||||
struct esp32s2_timer_lowerhalf_s *priv =
|
||||
(struct esp32s2_timer_lowerhalf_s *)lower;
|
||||
int ret = OK;
|
||||
uint16_t pre;
|
||||
irqstate_t flags;
|
||||
@ -282,10 +282,10 @@ errout:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32s2_timer_stop(FAR struct timer_lowerhalf_s *lower)
|
||||
static int esp32s2_timer_stop(struct timer_lowerhalf_s *lower)
|
||||
{
|
||||
FAR struct esp32s2_timer_lowerhalf_s *priv =
|
||||
(FAR struct esp32s2_timer_lowerhalf_s *)lower;
|
||||
struct esp32s2_timer_lowerhalf_s *priv =
|
||||
(struct esp32s2_timer_lowerhalf_s *)lower;
|
||||
int ret = OK;
|
||||
irqstate_t flags;
|
||||
|
||||
@ -331,11 +331,11 @@ errout:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32s2_timer_getstatus(FAR struct timer_lowerhalf_s *lower,
|
||||
FAR struct timer_status_s *status)
|
||||
static int esp32s2_timer_getstatus(struct timer_lowerhalf_s *lower,
|
||||
struct timer_status_s *status)
|
||||
{
|
||||
FAR struct esp32s2_timer_lowerhalf_s *priv =
|
||||
(FAR struct esp32s2_timer_lowerhalf_s *)lower;
|
||||
struct esp32s2_timer_lowerhalf_s *priv =
|
||||
(struct esp32s2_timer_lowerhalf_s *)lower;
|
||||
int ret = OK;
|
||||
uint64_t current_counter_value;
|
||||
uint64_t alarm_value;
|
||||
@ -393,11 +393,11 @@ static int esp32s2_timer_getstatus(FAR struct timer_lowerhalf_s *lower,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32s2_timer_settimeout(FAR struct timer_lowerhalf_s *lower,
|
||||
static int esp32s2_timer_settimeout(struct timer_lowerhalf_s *lower,
|
||||
uint32_t timeout)
|
||||
{
|
||||
FAR struct esp32s2_timer_lowerhalf_s *priv =
|
||||
(FAR struct esp32s2_timer_lowerhalf_s *)lower;
|
||||
struct esp32s2_timer_lowerhalf_s *priv =
|
||||
(struct esp32s2_timer_lowerhalf_s *)lower;
|
||||
int ret = OK;
|
||||
|
||||
DEBUGASSERT(priv);
|
||||
@ -425,7 +425,7 @@ static int esp32s2_timer_settimeout(FAR struct timer_lowerhalf_s *lower,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32s2_timer_maxtimeout(FAR struct timer_lowerhalf_s *lower,
|
||||
static int esp32s2_timer_maxtimeout(struct timer_lowerhalf_s *lower,
|
||||
uint32_t *max_timeout)
|
||||
{
|
||||
DEBUGASSERT(max_timeout);
|
||||
@ -452,11 +452,11 @@ static int esp32s2_timer_maxtimeout(FAR struct timer_lowerhalf_s *lower,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s2_timer_setcallback(FAR struct timer_lowerhalf_s *lower,
|
||||
tccb_t callback, FAR void *arg)
|
||||
static void esp32s2_timer_setcallback(struct timer_lowerhalf_s *lower,
|
||||
tccb_t callback, void *arg)
|
||||
{
|
||||
FAR struct esp32s2_timer_lowerhalf_s *priv =
|
||||
(FAR struct esp32s2_timer_lowerhalf_s *)lower;
|
||||
struct esp32s2_timer_lowerhalf_s *priv =
|
||||
(struct esp32s2_timer_lowerhalf_s *)lower;
|
||||
irqstate_t flags;
|
||||
int ret = OK;
|
||||
|
||||
@ -511,7 +511,7 @@ static void esp32s2_timer_setcallback(FAR struct timer_lowerhalf_s *lower,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32s2_timer_initialize(FAR const char *devpath, uint8_t timer)
|
||||
int esp32s2_timer_initialize(const char *devpath, uint8_t timer)
|
||||
{
|
||||
struct esp32s2_timer_lowerhalf_s *lower = NULL;
|
||||
int ret = OK;
|
||||
@ -577,7 +577,7 @@ int esp32s2_timer_initialize(FAR const char *devpath, uint8_t timer)
|
||||
*/
|
||||
|
||||
lower->upper = timer_register(devpath,
|
||||
(FAR struct timer_lowerhalf_s *)lower);
|
||||
(struct timer_lowerhalf_s *)lower);
|
||||
if (lower->upper == NULL)
|
||||
{
|
||||
/* The actual cause of the failure may have been a failure to allocate
|
||||
|
@ -37,6 +37,6 @@
|
||||
* Name: esp32s2_timer_initialize
|
||||
****************************************************************************/
|
||||
|
||||
int esp32s2_timer_initialize(FAR const char *devpath, uint8_t timer);
|
||||
int esp32s2_timer_initialize(const char *devpath, uint8_t timer);
|
||||
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S2_ESP32S2_TIM_LOWERHALF_H */
|
||||
|
@ -111,7 +111,7 @@ static inline void xtensa_setcompare(uint32_t compare)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32s2_timerisr(int irq, uint32_t *regs, FAR void *arg)
|
||||
static int esp32s2_timerisr(int irq, uint32_t *regs, void *arg)
|
||||
{
|
||||
uint32_t divisor;
|
||||
uint32_t compare;
|
||||
|
@ -317,7 +317,7 @@ uint32_t *xtensa_user(int exccause, uint32_t *regs)
|
||||
uint8_t t;
|
||||
|
||||
binfo("XCHAL_EXCCAUSE_LOAD_STORE_ERROR at %p, pc=%p\n",
|
||||
(FAR void *)regs[REG_EXCVADDR],
|
||||
(void *)regs[REG_EXCVADDR],
|
||||
pc);
|
||||
|
||||
if (decode_s8i(pc, &imm8, &s, &t))
|
||||
|
Loading…
Reference in New Issue
Block a user