Skip to content

Commit f8f3db8

Browse files
authored
Merge pull request zephyrproject-rtos#7 from finikorg/up_squared_adsp
IPC working stage
2 parents 4a6dd9c + 740d793 commit f8f3db8

File tree

16 files changed

+262
-256
lines changed

16 files changed

+262
-256
lines changed

arch/xtensa/core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ zephyr_sources(
1010
zephyr_sources_ifdef(CONFIG_XTENSA_ASM2
1111
xtensa-asm2-util.S
1212
xtensa-asm2.c
13+
irq_manage.c
1314
)
1415

1516
zephyr_sources_ifndef(CONFIG_XTENSA_ASM2

arch/xtensa/core/irq_manage.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,24 @@ void z_irq_priority_set(unsigned int irq, unsigned int prio, u32_t flags)
3838
}
3939

4040
#ifdef CONFIG_DYNAMIC_INTERRUPTS
41+
#ifndef CONFIG_MULTI_LEVEL_INTERRUPTS
4142
int z_arch_irq_connect_dynamic(unsigned int irq, unsigned int priority,
42-
void (*routine)(void *parameter), void *parameter,
43-
u32_t flags)
43+
void (*routine)(void *parameter),
44+
void *parameter, u32_t flags)
4445
{
4546
ARG_UNUSED(flags);
4647
ARG_UNUSED(priority);
4748

4849
z_isr_install(irq, routine, parameter);
4950
return irq;
5051
}
52+
#else /* !CONFIG_MULTI_LEVEL_INTERRUPTS */
53+
int z_arch_irq_connect_dynamic(unsigned int irq, unsigned int priority,
54+
void (*routine)(void *parameter),
55+
void *parameter, u32_t flags)
56+
{
57+
return z_soc_irq_connect_dynamic(irq, priority, routine, parameter,
58+
flags);
59+
}
60+
#endif /* !CONFIG_MULTI_LEVEL_INTERRUPTS */
5161
#endif /* CONFIG_DYNAMIC_INTERRUPTS */

arch/xtensa/include/xtensa-asm2-s.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,12 @@ _switch_stacks_\@:
291291
_do_call_\@:
292292
CROSS_STACK_CALL
293293

294+
/* Mask interrupts (which have been unmasked during the handler
295+
* execution) while we muck with the windows and decrement the nested
296+
* count. The restore will unmask them correctly.
297+
*/
298+
rsil a0, XCHAL_NMILEVEL
299+
294300
/* Decrement nest count */
295301
rsr.\SR a3
296302
l32i a0, a3, \NEST_OFF
@@ -303,13 +309,9 @@ _do_call_\@:
303309
* register spill before restoring, for obvious reasons.
304310
* Remember to restore the A1 stack pointer as it existed at
305311
* interrupt time so the caller of the interrupted function
306-
* spills to the right place. Also mask interrupts (which
307-
* have been unmasked during the handler execution) while we
308-
* muck with the windows. The restore will unmask them
309-
* correctly.
312+
* spills to the right place.
310313
*/
311314
beq a6, a1, _restore_\@
312-
rsil a0, XCHAL_NMILEVEL
313315
l32i a1, a1, 0
314316
addi a1, a1, BASE_SAVE_AREA_SIZE
315317
SPILL_ALL_WINDOWS

boards/xtensa/up_squared_adsp/Kconfig.defconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,8 @@ config MAX_IRQ_PER_AGGREGATOR
2929
default 32
3030
config NUM_2ND_LEVEL_AGGREGATORS
3131
default 4
32-
config NUM_3RD_LEVEL_AGGREGATORS
33-
default 1
3432
config 2ND_LVL_ISR_TBL_OFFSET
3533
default 21
36-
config 3RD_LVL_ISR_TBL_OFFSET
37-
default 149
3834

3935
config CAVS_ISR_TBL_OFFSET
4036
default 2ND_LVL_ISR_TBL_OFFSET

boards/xtensa/up_squared_adsp/up_squared_adsp_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ CONFIG_XTENSA_USE_CORE_CRT1=y
1717

1818
CONFIG_MULTI_LEVEL_INTERRUPTS=y
1919
CONFIG_2ND_LEVEL_INTERRUPTS=y
20-
CONFIG_3RD_LEVEL_INTERRUPTS=y
2120
CONFIG_CAVS_ICTL=y
2221

2322
CONFIG_BOOTLOADER_SRAM_SIZE=192

include/arch/xtensa/irq.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,30 @@
1616
/* for _soc_irq_*() */
1717
#include <soc.h>
1818

19+
#ifdef CONFIG_2ND_LEVEL_INTERRUPTS
20+
#ifdef CONFIG_3RD_LEVEL_INTERRUPTS
1921
#define CONFIG_NUM_IRQS (XCHAL_NUM_INTERRUPTS +\
2022
(CONFIG_NUM_2ND_LEVEL_AGGREGATORS +\
2123
CONFIG_NUM_3RD_LEVEL_AGGREGATORS) *\
2224
CONFIG_MAX_IRQ_PER_AGGREGATOR)
25+
#else
26+
#define CONFIG_NUM_IRQS (XCHAL_NUM_INTERRUPTS +\
27+
CONFIG_NUM_2ND_LEVEL_AGGREGATORS *\
28+
CONFIG_MAX_IRQ_PER_AGGREGATOR)
29+
#endif
30+
#else
31+
#define CONFIG_NUM_IRQS XCHAL_NUM_INTERRUPTS
32+
#endif
2333

2434
#define z_arch_irq_enable(irq) z_soc_irq_enable(irq)
2535
#define z_arch_irq_disable(irq) z_soc_irq_disable(irq)
2636

37+
#ifdef CONFIG_DYNAMIC_INTERRUPTS
38+
extern int z_soc_irq_connect_dynamic(unsigned int irq, unsigned int priority,
39+
void (*routine)(void *parameter),
40+
void *parameter, u32_t flags);
41+
#endif
42+
2743
#else
2844

2945
#define CONFIG_NUM_IRQS XCHAL_NUM_INTERRUPTS

samples/audio/sof/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,16 @@ Although the BSP is based on `intel_s1000_crb` compiler and tools described for
4444
the board does not produce working code. Instead use xtools described in the
4545
chapter [Build SDK for the board](#build-sdk-for-the-board).
4646

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

49+
Build for qemu with:
4950
```bash
50-
$ west build -b up_squared_adsp samples/hello_world/
51+
$ west build -p -b up_squared_adsp zephyr/samples/audio/sof -DOVERLAY_CONFIG=overlay-qemu.conf
52+
```
53+
54+
Build for `up_squared` ADSP with:
55+
```bash
56+
$ west build -p -b up_squared_adsp zephyr/samples/audio/sof -DOVERLAY_CONFIG=overlay-up_squared.conf
5157
```
5258

5359
We would be using zephyr/zephyr.elf later on.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_LOG_BACKEND_XTENSA_SIM=y
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_LOG_BACKEND_ADSP=y

samples/audio/sof/prj.conf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
CONFIG_SOF=y
22
CONFIG_LOG=y
3-
CONFIG_LOG_BACKEND_XTENSA_SIM=y
4-
CONFIG_LOG_BACKEND_ADSP=y
3+
CONFIG_LOG_PRINTK=y
54
CONFIG_LOG_IMMEDIATE=y
65
CONFIG_SOF_LOG_LEVEL=4
76
# SOF requires malloc/calloc

0 commit comments

Comments
 (0)