Skip to content

Commit

Permalink
Merge pull request zephyrproject-rtos#7 from finikorg/up_squared_adsp
Browse files Browse the repository at this point in the history
IPC working stage
  • Loading branch information
jhedberg authored Aug 21, 2019
2 parents 4a6dd9c + 740d793 commit f8f3db8
Show file tree
Hide file tree
Showing 16 changed files with 262 additions and 256 deletions.
1 change: 1 addition & 0 deletions arch/xtensa/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ zephyr_sources(
zephyr_sources_ifdef(CONFIG_XTENSA_ASM2
xtensa-asm2-util.S
xtensa-asm2.c
irq_manage.c
)

zephyr_sources_ifndef(CONFIG_XTENSA_ASM2
Expand Down
14 changes: 12 additions & 2 deletions arch/xtensa/core/irq_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,24 @@ void z_irq_priority_set(unsigned int irq, unsigned int prio, u32_t flags)
}

#ifdef CONFIG_DYNAMIC_INTERRUPTS
#ifndef CONFIG_MULTI_LEVEL_INTERRUPTS
int z_arch_irq_connect_dynamic(unsigned int irq, unsigned int priority,
void (*routine)(void *parameter), void *parameter,
u32_t flags)
void (*routine)(void *parameter),
void *parameter, u32_t flags)
{
ARG_UNUSED(flags);
ARG_UNUSED(priority);

z_isr_install(irq, routine, parameter);
return irq;
}
#else /* !CONFIG_MULTI_LEVEL_INTERRUPTS */
int z_arch_irq_connect_dynamic(unsigned int irq, unsigned int priority,
void (*routine)(void *parameter),
void *parameter, u32_t flags)
{
return z_soc_irq_connect_dynamic(irq, priority, routine, parameter,
flags);
}
#endif /* !CONFIG_MULTI_LEVEL_INTERRUPTS */
#endif /* CONFIG_DYNAMIC_INTERRUPTS */
12 changes: 7 additions & 5 deletions arch/xtensa/include/xtensa-asm2-s.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,12 @@ _switch_stacks_\@:
_do_call_\@:
CROSS_STACK_CALL

/* Mask interrupts (which have been unmasked during the handler
* execution) while we muck with the windows and decrement the nested
* count. The restore will unmask them correctly.
*/
rsil a0, XCHAL_NMILEVEL

/* Decrement nest count */
rsr.\SR a3
l32i a0, a3, \NEST_OFF
Expand All @@ -303,13 +309,9 @@ _do_call_\@:
* register spill before restoring, for obvious reasons.
* Remember to restore the A1 stack pointer as it existed at
* interrupt time so the caller of the interrupted function
* spills to the right place. Also mask interrupts (which
* have been unmasked during the handler execution) while we
* muck with the windows. The restore will unmask them
* correctly.
* spills to the right place.
*/
beq a6, a1, _restore_\@
rsil a0, XCHAL_NMILEVEL
l32i a1, a1, 0
addi a1, a1, BASE_SAVE_AREA_SIZE
SPILL_ALL_WINDOWS
Expand Down
4 changes: 0 additions & 4 deletions boards/xtensa/up_squared_adsp/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,8 @@ config MAX_IRQ_PER_AGGREGATOR
default 32
config NUM_2ND_LEVEL_AGGREGATORS
default 4
config NUM_3RD_LEVEL_AGGREGATORS
default 1
config 2ND_LVL_ISR_TBL_OFFSET
default 21
config 3RD_LVL_ISR_TBL_OFFSET
default 149

config CAVS_ISR_TBL_OFFSET
default 2ND_LVL_ISR_TBL_OFFSET
Expand Down
1 change: 0 additions & 1 deletion boards/xtensa/up_squared_adsp/up_squared_adsp_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ CONFIG_XTENSA_USE_CORE_CRT1=y

CONFIG_MULTI_LEVEL_INTERRUPTS=y
CONFIG_2ND_LEVEL_INTERRUPTS=y
CONFIG_3RD_LEVEL_INTERRUPTS=y
CONFIG_CAVS_ICTL=y

CONFIG_BOOTLOADER_SRAM_SIZE=192
16 changes: 16 additions & 0 deletions include/arch/xtensa/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,30 @@
/* for _soc_irq_*() */
#include <soc.h>

#ifdef CONFIG_2ND_LEVEL_INTERRUPTS
#ifdef CONFIG_3RD_LEVEL_INTERRUPTS
#define CONFIG_NUM_IRQS (XCHAL_NUM_INTERRUPTS +\
(CONFIG_NUM_2ND_LEVEL_AGGREGATORS +\
CONFIG_NUM_3RD_LEVEL_AGGREGATORS) *\
CONFIG_MAX_IRQ_PER_AGGREGATOR)
#else
#define CONFIG_NUM_IRQS (XCHAL_NUM_INTERRUPTS +\
CONFIG_NUM_2ND_LEVEL_AGGREGATORS *\
CONFIG_MAX_IRQ_PER_AGGREGATOR)
#endif
#else
#define CONFIG_NUM_IRQS XCHAL_NUM_INTERRUPTS
#endif

#define z_arch_irq_enable(irq) z_soc_irq_enable(irq)
#define z_arch_irq_disable(irq) z_soc_irq_disable(irq)

#ifdef CONFIG_DYNAMIC_INTERRUPTS
extern int z_soc_irq_connect_dynamic(unsigned int irq, unsigned int priority,
void (*routine)(void *parameter),
void *parameter, u32_t flags);
#endif

#else

#define CONFIG_NUM_IRQS XCHAL_NUM_INTERRUPTS
Expand Down
10 changes: 8 additions & 2 deletions samples/audio/sof/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,16 @@ Although the BSP is based on `intel_s1000_crb` compiler and tools described for
the board does not produce working code. Instead use xtools described in the
chapter [Build SDK for the board](#build-sdk-for-the-board).

Build `hello_world` modified sample and we can use built zephyr.elf.
Build `samples/audio/sof` sample and we can use built zephyr.elf later.

Build for qemu with:
```bash
$ west build -b up_squared_adsp samples/hello_world/
$ west build -p -b up_squared_adsp zephyr/samples/audio/sof -DOVERLAY_CONFIG=overlay-qemu.conf
```

Build for `up_squared` ADSP with:
```bash
$ west build -p -b up_squared_adsp zephyr/samples/audio/sof -DOVERLAY_CONFIG=overlay-up_squared.conf
```

We would be using zephyr/zephyr.elf later on.
Expand Down
1 change: 1 addition & 0 deletions samples/audio/sof/overlay-qemu.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_LOG_BACKEND_XTENSA_SIM=y
1 change: 1 addition & 0 deletions samples/audio/sof/overlay-up_squared.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_LOG_BACKEND_ADSP=y
3 changes: 1 addition & 2 deletions samples/audio/sof/prj.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
CONFIG_SOF=y
CONFIG_LOG=y
CONFIG_LOG_BACKEND_XTENSA_SIM=y
CONFIG_LOG_BACKEND_ADSP=y
CONFIG_LOG_PRINTK=y
CONFIG_LOG_IMMEDIATE=y
CONFIG_SOF_LOG_LEVEL=4
# SOF requires malloc/calloc
Expand Down
13 changes: 13 additions & 0 deletions soc/xtensa/intel_apl_adsp/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,17 @@ config KERNEL_ENTRY
config USE_SOF_BOOT_LDR
default y

if SOF

config MULTI_LEVEL_INTERRUPTS
default y

config 2ND_LEVEL_INTERRUPTS
default y

config DYNAMIC_INTERRUPTS
default y

endif

endif
Loading

0 comments on commit f8f3db8

Please sign in to comment.