Compare commits
169 Commits
collab-ini
...
v1.14.1-rc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03a52401c6 | ||
|
|
a3db646ee7 | ||
|
|
45a1852ce7 | ||
|
|
eaf7c2f4c2 | ||
|
|
d5b83ae461 | ||
|
|
c9f0148e3c | ||
|
|
f0f74e4f0e | ||
|
|
dfb96f40d6 | ||
|
|
4899c096ae | ||
|
|
528f787ddd | ||
|
|
db50b4ec2a | ||
|
|
d3ca4bdbdb | ||
|
|
301558a433 | ||
|
|
919aa1785a | ||
|
|
0f01fe754c | ||
|
|
fb199a2ac5 | ||
|
|
3c6f0742a7 | ||
|
|
5bbae10490 | ||
|
|
24d7e9e03f | ||
|
|
d4fd267086 | ||
|
|
9fb22af194 | ||
|
|
f35dc9c018 | ||
|
|
2761887b20 | ||
|
|
de50834455 | ||
|
|
683e14cc94 | ||
|
|
ee793280f3 | ||
|
|
8c2c5618de | ||
|
|
d7d9988d55 | ||
|
|
7e37ef4a7c | ||
|
|
47588913d3 | ||
|
|
b1991f9d12 | ||
|
|
686f3d21b4 | ||
|
|
a92a530465 | ||
|
|
2ae7f09dad | ||
|
|
a880994e06 | ||
|
|
f06bb3f1cd | ||
|
|
ea02a080a6 | ||
|
|
1ab6102343 | ||
|
|
0608aa8ffe | ||
|
|
618a2a7ea3 | ||
|
|
a51247e5fc | ||
|
|
5a418dd8f8 | ||
|
|
15a830a1ef | ||
|
|
f3e094afe3 | ||
|
|
bd49769964 | ||
|
|
3472eeaed4 | ||
|
|
c9af4aa4a8 | ||
|
|
08c4c32e91 | ||
|
|
d3f926f73f | ||
|
|
7cf70968fc | ||
|
|
e3f71020d3 | ||
|
|
6e96c8abca | ||
|
|
39121ae854 | ||
|
|
21609c2562 | ||
|
|
1c18dc7b2f | ||
|
|
bdf05c01e3 | ||
|
|
99ddf9ce0c | ||
|
|
6712db44b9 | ||
|
|
17b2abec79 | ||
|
|
4f52e63153 | ||
|
|
ed5625a837 | ||
|
|
344e275f31 | ||
|
|
e2b31e6c29 | ||
|
|
52cecb5148 | ||
|
|
92ebf5e6a8 | ||
|
|
3bbcdc79d0 | ||
|
|
2371a976d1 | ||
|
|
6d174a2b75 | ||
|
|
e798ae7e07 | ||
|
|
6950a38cb3 | ||
|
|
8fa76985b1 | ||
|
|
63841b5607 | ||
|
|
6f2cf7986d | ||
|
|
a72f851d12 | ||
|
|
f5d9f0b2af | ||
|
|
38d186a878 | ||
|
|
1b7b809f1d | ||
|
|
42b8d0c747 | ||
|
|
c55d817744 | ||
|
|
9403dd3126 | ||
|
|
251f48682a | ||
|
|
9ca3f9a967 | ||
|
|
bccaa9f4b7 | ||
|
|
c1191dec2d | ||
|
|
b504992306 | ||
|
|
9d00571faa | ||
|
|
870429de9a | ||
|
|
14a1f91d1e | ||
|
|
581a8cf218 | ||
|
|
7c44108677 | ||
|
|
4d7977f31d | ||
|
|
d01d68835e | ||
|
|
c5dca7f96a | ||
|
|
6a3e7ac12c | ||
|
|
3e142b4fd8 | ||
|
|
6bd02e3f33 | ||
|
|
9430a7e4e6 | ||
|
|
5df0f30930 | ||
|
|
d7189919c5 | ||
|
|
012f1c7445 | ||
|
|
203021bedb | ||
|
|
0f8de841af | ||
|
|
7586e60a89 | ||
|
|
fd4c012fd8 | ||
|
|
2af72beaf5 | ||
|
|
1f509d3baf | ||
|
|
1973bfa703 | ||
|
|
841df9aed2 | ||
|
|
01e086c007 | ||
|
|
fc67da0f5c | ||
|
|
8b0f062ff4 | ||
|
|
3f09b1293c | ||
|
|
2d05e7ab3f | ||
|
|
eee12033e7 | ||
|
|
cd8ccef8e4 | ||
|
|
ed6dc0ef13 | ||
|
|
7526dab2d5 | ||
|
|
c73cf83d85 | ||
|
|
26357e8e99 | ||
|
|
6fe0f2a14a | ||
|
|
c90b6332dc | ||
|
|
fdde0b06cf | ||
|
|
550e3165aa | ||
|
|
a4cc1f0fdc | ||
|
|
85348add23 | ||
|
|
f8be489b2e | ||
|
|
8812c7fd08 | ||
|
|
6cbdf40036 | ||
|
|
16a74a2fed | ||
|
|
c297c82039 | ||
|
|
1c5fa377a1 | ||
|
|
19b96e997e | ||
|
|
28ae163885 | ||
|
|
b8c44c2ada | ||
|
|
41b07b1d86 | ||
|
|
88b82c8152 | ||
|
|
6bd361409e | ||
|
|
12d6aa8b44 | ||
|
|
2ddf341e40 | ||
|
|
d4163bc17e | ||
|
|
14fe45898f | ||
|
|
f1b0df08e9 | ||
|
|
cea42e3554 | ||
|
|
e2d715b319 | ||
|
|
eb4fa6f000 | ||
|
|
a64cdc8388 | ||
|
|
56481d9edd | ||
|
|
8bf9538caf | ||
|
|
756ae3d542 | ||
|
|
fb5bde6f70 | ||
|
|
6993ee3cbf | ||
|
|
8d72bbdc79 | ||
|
|
a4afa13a7a | ||
|
|
93558f2fb9 | ||
|
|
23b54e42c3 | ||
|
|
ee9d7a960b | ||
|
|
a68fd9c733 | ||
|
|
ed47cf92cb | ||
|
|
25b00e8b6d | ||
|
|
1a9ef5ef4a | ||
|
|
349cc71d63 | ||
|
|
bdcc09ff2c | ||
|
|
c6325a66ca | ||
|
|
29c3fe5d77 | ||
|
|
82f176311d | ||
|
|
1b099c3e13 | ||
|
|
9132dcc697 | ||
|
|
d8236589e9 | ||
|
|
247330d62a |
@@ -48,7 +48,11 @@ build:
|
||||
else
|
||||
./scripts/ci/run_ci.sh -s -b ${BRANCH} -r origin -m ${MATRIX_BUILD} -M ${MATRIX_BUILDS};
|
||||
fi;
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- v*-branch
|
||||
- topic-*
|
||||
integrations:
|
||||
notifications:
|
||||
- integrationName: slack_integration
|
||||
@@ -70,5 +74,6 @@ integrations:
|
||||
- net
|
||||
- bluetooth
|
||||
- arm
|
||||
- v1.14-branch
|
||||
on_success: never
|
||||
on_failure: never
|
||||
|
||||
@@ -719,6 +719,7 @@ add_custom_command(
|
||||
${ZEPHYR_BASE}/scripts/gen_kobject_list.py
|
||||
--validation-output ${DRV_VALIDATION}
|
||||
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
|
||||
DEPENDS ${ZEPHYR_BASE}/scripts/gen_kobject_list.py
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
add_custom_target(${DRIVER_VALIDATION_H_TARGET} DEPENDS ${DRV_VALIDATION})
|
||||
@@ -852,6 +853,10 @@ endif()
|
||||
|
||||
if(CONFIG_CODE_DATA_RELOCATION)
|
||||
set(MEM_RELOCATAION_LD "${PROJECT_BINARY_DIR}/include/generated/linker_relocate.ld")
|
||||
set(MEM_RELOCATAION_SRAM_DATA_LD
|
||||
"${PROJECT_BINARY_DIR}/include/generated/linker_sram_data_relocate.ld")
|
||||
set(MEM_RELOCATAION_SRAM_BSS_LD
|
||||
"${PROJECT_BINARY_DIR}/include/generated/linker_sram_bss_relocate.ld")
|
||||
set(MEM_RELOCATAION_CODE "${PROJECT_BINARY_DIR}/code_relocation.c")
|
||||
|
||||
add_custom_command(
|
||||
@@ -863,6 +868,8 @@ if(CONFIG_CODE_DATA_RELOCATION)
|
||||
-d ${APPLICATION_BINARY_DIR}
|
||||
-i '$<TARGET_PROPERTY:code_data_relocation_target,COMPILE_DEFINITIONS>'
|
||||
-o ${MEM_RELOCATAION_LD}
|
||||
-s ${MEM_RELOCATAION_SRAM_DATA_LD}
|
||||
-b ${MEM_RELOCATAION_SRAM_BSS_LD}
|
||||
-c ${MEM_RELOCATAION_CODE}
|
||||
DEPENDS app kernel ${ZEPHYR_LIBS_PROPERTY}
|
||||
)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
/arch/arc/ @vonhust @ruuddw
|
||||
/arch/arm/ @MaureenHelm @galak
|
||||
/arch/arm/core/cortex_m/cmse/ @ioannisg
|
||||
/arch/arm/include/cortex_m/cmse/ @ioannisg
|
||||
arch/arm/include/cortex_m/cmse.h @ioannisg
|
||||
/soc/arm/ @MaureenHelm @galak
|
||||
/soc/arm/arm/mps2/ @fvincenzo
|
||||
/soc/arm/atmel_sam/sam4s/ @fallrisk
|
||||
|
||||
4
VERSION
4
VERSION
@@ -1,5 +1,5 @@
|
||||
VERSION_MAJOR = 1
|
||||
VERSION_MINOR = 14
|
||||
PATCHLEVEL = 0
|
||||
PATCHLEVEL = 1
|
||||
VERSION_TWEAK = 0
|
||||
EXTRAVERSION =
|
||||
EXTRAVERSION = rc1
|
||||
|
||||
@@ -267,7 +267,7 @@ _firq_reschedule:
|
||||
pop_s r2
|
||||
#endif
|
||||
|
||||
ld_s r3, [r2, _thread_offset_to_relinquish_cause]
|
||||
ld r3, [r2, _thread_offset_to_relinquish_cause]
|
||||
|
||||
breq r3, _CAUSE_RIRQ, _firq_return_from_rirq
|
||||
nop
|
||||
@@ -279,7 +279,7 @@ _firq_reschedule:
|
||||
.balign 4
|
||||
_firq_return_from_coop:
|
||||
|
||||
ld_s r3, [r2, _thread_offset_to_intlock_key]
|
||||
ld r3, [r2, _thread_offset_to_intlock_key]
|
||||
st 0, [r2, _thread_offset_to_intlock_key]
|
||||
|
||||
/* pc into ilink */
|
||||
@@ -298,7 +298,7 @@ _firq_return_from_coop:
|
||||
or.nz r0, r0, _ARC_V2_STATUS32_IE
|
||||
sr r0, [_ARC_V2_STATUS32_P0]
|
||||
|
||||
ld_s r0, [r2, _thread_offset_to_return_value]
|
||||
ld r0, [r2, _thread_offset_to_return_value]
|
||||
rtie
|
||||
|
||||
.balign 4
|
||||
|
||||
@@ -181,7 +181,7 @@ _rirq_common_interrupt_swap:
|
||||
pop_s r2
|
||||
#endif
|
||||
|
||||
ld_s r3, [r2, _thread_offset_to_relinquish_cause]
|
||||
ld r3, [r2, _thread_offset_to_relinquish_cause]
|
||||
|
||||
breq r3, _CAUSE_RIRQ, _rirq_return_from_rirq
|
||||
nop
|
||||
@@ -201,7 +201,7 @@ _rirq_return_from_coop:
|
||||
|
||||
/* update status32.ie (explanation in firq_exit:_firq_return_from_coop) */
|
||||
|
||||
ld_s r3, [r2, _thread_offset_to_intlock_key]
|
||||
ld r3, [r2, _thread_offset_to_intlock_key]
|
||||
st 0, [r2, _thread_offset_to_intlock_key]
|
||||
cmp r3, 0
|
||||
or.ne r0, r0, _ARC_V2_STATUS32_IE
|
||||
@@ -212,7 +212,7 @@ _rirq_return_from_coop:
|
||||
sub sp, sp, ___isf_t_pc_OFFSET
|
||||
|
||||
/* update return value on stack */
|
||||
ld_s r0, [r2, _thread_offset_to_return_value]
|
||||
ld r0, [r2, _thread_offset_to_return_value]
|
||||
st_s r0, [sp, ___isf_t_r0_OFFSET]
|
||||
|
||||
/* reset zero-overhead loops */
|
||||
|
||||
@@ -82,7 +82,7 @@ SECTION_FUNC(TEXT, __swap)
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
|
||||
/* save intlock key */
|
||||
st_s r0, [r2, _thread_offset_to_intlock_key]
|
||||
st r0, [r2, _thread_offset_to_intlock_key]
|
||||
st _CAUSE_COOP, [r2, _thread_offset_to_relinquish_cause]
|
||||
|
||||
/*
|
||||
@@ -92,7 +92,7 @@ SECTION_FUNC(TEXT, __swap)
|
||||
* z_set_thread_return_value().
|
||||
*/
|
||||
ld r3, [_k_neg_eagain]
|
||||
st_s r3, [r2, _thread_offset_to_return_value]
|
||||
st r3, [r2, _thread_offset_to_return_value]
|
||||
|
||||
/*
|
||||
* Save status32 and blink on the stack before the callee-saved registers.
|
||||
@@ -142,7 +142,7 @@ SECTION_FUNC(TEXT, __swap)
|
||||
pop_s r2
|
||||
#endif
|
||||
|
||||
ld_s r3, [r2, _thread_offset_to_relinquish_cause]
|
||||
ld r3, [r2, _thread_offset_to_relinquish_cause]
|
||||
|
||||
breq r3, _CAUSE_RIRQ, _swap_return_from_rirq
|
||||
nop
|
||||
@@ -154,9 +154,9 @@ SECTION_FUNC(TEXT, __swap)
|
||||
.balign 4
|
||||
_swap_return_from_coop:
|
||||
|
||||
ld_s r1, [r2, _thread_offset_to_intlock_key]
|
||||
ld r1, [r2, _thread_offset_to_intlock_key]
|
||||
st 0, [r2, _thread_offset_to_intlock_key]
|
||||
ld_s r0, [r2, _thread_offset_to_return_value]
|
||||
ld r0, [r2, _thread_offset_to_return_value]
|
||||
|
||||
lr ilink, [_ARC_V2_STATUS32]
|
||||
bbit1 ilink, _ARC_V2_STATUS32_AE_BIT, _return_from_exc
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <linker/linker-defs.h>
|
||||
#include <kernel_internal.h>
|
||||
#include <arch/arm/cortex_m/cmsis.h>
|
||||
#include <cortex_m/stack.h>
|
||||
|
||||
#if defined(__GNUC__)
|
||||
/*
|
||||
@@ -37,44 +36,6 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static inline void switch_sp_to_psp(void)
|
||||
{
|
||||
__set_CONTROL(__get_CONTROL() | CONTROL_SPSEL_Msk);
|
||||
/*
|
||||
* When changing the stack pointer, software must use an ISB instruction
|
||||
* immediately after the MSR instruction. This ensures that instructions
|
||||
* after the ISB instruction execute using the new stack pointer.
|
||||
*/
|
||||
__ISB();
|
||||
}
|
||||
|
||||
static inline void set_and_switch_to_psp(void)
|
||||
{
|
||||
u32_t process_sp;
|
||||
|
||||
process_sp = (u32_t)&_interrupt_stack + CONFIG_ISR_STACK_SIZE;
|
||||
__set_PSP(process_sp);
|
||||
switch_sp_to_psp();
|
||||
}
|
||||
|
||||
void lock_interrupts(void)
|
||||
{
|
||||
#if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE)
|
||||
__disable_irq();
|
||||
#elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)
|
||||
__set_BASEPRI(_EXC_IRQ_DEFAULT_PRIO);
|
||||
#else
|
||||
#error Unknown ARM architecture
|
||||
#endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */
|
||||
}
|
||||
|
||||
#ifdef CONFIG_INIT_STACKS
|
||||
static inline void init_stacks(void)
|
||||
{
|
||||
memset(&_interrupt_stack, 0xAA, CONFIG_ISR_STACK_SIZE);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CPU_CORTEX_M_HAS_VTOR
|
||||
|
||||
#ifdef CONFIG_XIP
|
||||
@@ -168,14 +129,6 @@ extern void z_IntLibInit(void);
|
||||
#endif
|
||||
void _PrepC(void)
|
||||
{
|
||||
#ifdef CONFIG_INIT_STACKS
|
||||
init_stacks();
|
||||
#endif
|
||||
/*
|
||||
* Set PSP and use it to boot without using MSP, so that it
|
||||
* gets set to _interrupt_stack during initialization.
|
||||
*/
|
||||
set_and_switch_to_psp();
|
||||
relocate_vector_table();
|
||||
enable_floating_point();
|
||||
z_bss_zero();
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
_ASM_FILE_PROLOGUE
|
||||
|
||||
GTEXT(__reset)
|
||||
GTEXT(memset)
|
||||
GDATA(_interrupt_stack)
|
||||
#if defined(CONFIG_PLATFORM_SPECIFIC_INIT)
|
||||
GTEXT(_PlatformInit)
|
||||
#endif
|
||||
@@ -61,12 +63,46 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start)
|
||||
#endif
|
||||
|
||||
/* lock interrupts: will get unlocked when switch to main task */
|
||||
bl lock_interrupts
|
||||
#if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE)
|
||||
cpsid i
|
||||
#elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)
|
||||
movs.n r0, #_EXC_IRQ_DEFAULT_PRIO
|
||||
msr BASEPRI, r0
|
||||
#else
|
||||
#error Unknown ARM architecture
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_WDOG_INIT
|
||||
/* board-specific watchdog initialization is necessary */
|
||||
bl _WdogInit
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_INIT_STACKS
|
||||
ldr r0, =_interrupt_stack
|
||||
ldr r1, =0xaa
|
||||
ldr r2, =CONFIG_ISR_STACK_SIZE
|
||||
bl memset
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set PSP and use it to boot without using MSP, so that it
|
||||
* gets set to _interrupt_stack during initialization.
|
||||
*/
|
||||
ldr r0, =_interrupt_stack
|
||||
ldr r1, =CONFIG_ISR_STACK_SIZE
|
||||
adds r0, r0, r1
|
||||
msr PSP, r0
|
||||
mrs r0, CONTROL
|
||||
movs r1, #2
|
||||
orrs r0, r1 /* CONTROL_SPSEL_Msk */
|
||||
msr CONTROL, r0
|
||||
/*
|
||||
* When changing the stack pointer, software must use an ISB instruction
|
||||
* immediately after the MSR instruction. This ensures that instructions
|
||||
* after the ISB instruction execute using the new stack pointer.
|
||||
*/
|
||||
isb
|
||||
|
||||
/*
|
||||
* 'bl' jumps the furthest of the branch instructions that are
|
||||
* supported on all platforms. So it is used when jumping to _PrepC
|
||||
|
||||
@@ -282,11 +282,11 @@ u32_t z_check_thread_stack_fail(const u32_t fault_addr, const u32_t psp)
|
||||
}
|
||||
}
|
||||
#else /* CONFIG_USERSPACE */
|
||||
if (IS_MPU_GUARD_VIOLATION(thread->stack_info.start,
|
||||
if (IS_MPU_GUARD_VIOLATION(thread->stack_info.start -
|
||||
MPU_GUARD_ALIGN_AND_SIZE,
|
||||
fault_addr, psp)) {
|
||||
/* Thread stack corruption */
|
||||
return thread->stack_info.start +
|
||||
MPU_GUARD_ALIGN_AND_SIZE;
|
||||
return thread->stack_info.start;
|
||||
}
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ z_arch_switch_to_main_thread(struct k_thread *main_thread,
|
||||
start_of_main_stack =
|
||||
Z_THREAD_STACK_BUFFER(main_stack) + main_stack_size;
|
||||
#endif
|
||||
start_of_main_stack = (void *)STACK_ROUND_DOWN(start_of_main_stack);
|
||||
start_of_main_stack = (char *)STACK_ROUND_DOWN(start_of_main_stack);
|
||||
|
||||
#ifdef CONFIG_TRACING
|
||||
z_sys_trace_thread_switched_out();
|
||||
|
||||
@@ -12,4 +12,5 @@ CONFIG_ARCV2_TIMER=y
|
||||
CONFIG_CONSOLE=y
|
||||
CONFIG_UART_CONSOLE=y
|
||||
CONFIG_SERIAL=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||
CONFIG_ARC_MPU_ENABLE=y
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 90 KiB |
@@ -13,9 +13,9 @@ This board acts as a sensor hub platform for all 96Boards compliant
|
||||
family products. It can also be used as a standalone board.
|
||||
|
||||
.. figure:: img/96b_argonkey.jpg
|
||||
:width: 557px
|
||||
:width: 540px
|
||||
:align: center
|
||||
:height: 480px
|
||||
:height: 558px
|
||||
:alt: 96Boards Argonkey
|
||||
|
||||
96Boards Argonkey
|
||||
@@ -76,6 +76,9 @@ features:
|
||||
| I2C | on-chip | i2c |
|
||||
+-----------+------------+-------------------------------------+
|
||||
|
||||
More information about the board can be found at the
|
||||
`ARGONKEY website`_.
|
||||
|
||||
The default board configuration can be found in the defconfig file:
|
||||
|
||||
``boards/arm/96b_argonkey/96b_argonkey_defconfig``
|
||||
@@ -223,6 +226,9 @@ References
|
||||
|
||||
.. target-notes::
|
||||
|
||||
.. _ARGONKEY website:
|
||||
https://www.st.com/en/evaluation-tools/steval-mki187v1.html
|
||||
|
||||
.. _AN2606:
|
||||
https://www.st.com/resource/en/application_note/cd00167594.pdf
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
#include <nxp/nxp_rt.dtsi>
|
||||
#include <nxp/nxp_rt1020.dtsi>
|
||||
|
||||
/ {
|
||||
model = "NXP MIMXRT1020-EVK board";
|
||||
|
||||
@@ -22,3 +22,4 @@ CONFIG_CONSOLE=y
|
||||
|
||||
# additional board options
|
||||
CONFIG_GPIO_AS_PINRESET=y
|
||||
CONFIG_NFCT_PINS_AS_GPIOS=y
|
||||
|
||||
@@ -37,6 +37,11 @@ static int board_reel_board_init(struct device *dev)
|
||||
(GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos) |
|
||||
(GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) |
|
||||
(GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos);
|
||||
gpio->PIN_CNF[DT_NORDIC_NRF_UART_0_TX_PIN] =
|
||||
(GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos) |
|
||||
(GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) |
|
||||
(GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ toolchain:
|
||||
- zephyr
|
||||
- gnuarmemb
|
||||
- xtools
|
||||
ram: 320
|
||||
ram: 128
|
||||
flash: 1024
|
||||
supported:
|
||||
- pwm
|
||||
|
||||
@@ -291,6 +291,7 @@ foreach(root ${BOARD_ROOT})
|
||||
|
||||
if(DEFINED SHIELD)
|
||||
foreach(s ${SHIELD_AS_LIST})
|
||||
list(REMOVE_ITEM SHIELD ${s})
|
||||
list(FIND SHIELD_LIST ${s} _idx)
|
||||
if (NOT _idx EQUAL -1)
|
||||
list(GET shields_refs_list ${_idx} s_path)
|
||||
|
||||
@@ -12,12 +12,20 @@ file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/include/generated)
|
||||
# CMake configure-time.
|
||||
#
|
||||
# See ~/zephyr/doc/dts
|
||||
set(GENERATED_DTS_BOARD_UNFIXED_H ${PROJECT_BINARY_DIR}/include/generated/generated_dts_board_unfixed.h)
|
||||
set(GENERATED_DTS_BOARD_CONF ${PROJECT_BINARY_DIR}/include/generated/generated_dts_board.conf)
|
||||
set(GENERATED_DTS_BOARD_UNFIXED_H ${PROJECT_BINARY_DIR}/include/generated/generated_dts_board_unfixed.h)
|
||||
set(GENERATED_DTS_BOARD_CONF ${PROJECT_BINARY_DIR}/include/generated/generated_dts_board.conf)
|
||||
|
||||
set_ifndef(DTS_SOURCE ${BOARD_DIR}/${BOARD}.dts)
|
||||
set_ifndef(DTS_COMMON_OVERLAYS ${ZEPHYR_BASE}/dts/common/common.dts)
|
||||
set_ifndef(DTS_APP_BINDINGS ${APPLICATION_SOURCE_DIR}/dts/bindings)
|
||||
set_ifndef(DTS_APP_INCLUDE ${APPLICATION_SOURCE_DIR}/dts)
|
||||
|
||||
# 'DTS_ROOT' is a list of directories where a directory tree with DT
|
||||
# files may be found. It always includes the application directory and
|
||||
# ${ZEPHYR_BASE}.
|
||||
list(APPEND
|
||||
DTS_ROOT
|
||||
${APPLICATION_SOURCE_DIR}
|
||||
${ZEPHYR_BASE}
|
||||
)
|
||||
|
||||
set(dts_files
|
||||
${DTS_SOURCE}
|
||||
@@ -64,6 +72,33 @@ if(SUPPORTS_DTS)
|
||||
math(EXPR i "${i}+1")
|
||||
endforeach()
|
||||
|
||||
foreach(dts_root ${DTS_ROOT})
|
||||
foreach(dts_root_path
|
||||
include
|
||||
dts/common
|
||||
dts/${ARCH}
|
||||
dts
|
||||
)
|
||||
set(full_path ${dts_root}/${dts_root_path})
|
||||
if(EXISTS ${full_path})
|
||||
list(APPEND
|
||||
DTS_ROOT_SYSTEM_INCLUDE_DIRS
|
||||
-isystem ${full_path}
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
foreach(dts_root ${DTS_ROOT})
|
||||
set(full_path ${dts_root}/dts/bindings)
|
||||
if(EXISTS ${full_path})
|
||||
list(APPEND
|
||||
DTS_ROOT_BINDINGS
|
||||
${full_path}
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# TODO: Cut down on CMake configuration time by avoiding
|
||||
# regeneration of generated_dts_board_unfixed.h on every configure. How
|
||||
# challenging is this? What are the dts dependencies? We run the
|
||||
@@ -77,12 +112,8 @@ if(SUPPORTS_DTS)
|
||||
COMMAND ${CMAKE_C_COMPILER}
|
||||
-x assembler-with-cpp
|
||||
-nostdinc
|
||||
-isystem ${DTS_APP_INCLUDE}
|
||||
-isystem ${ZEPHYR_BASE}/include
|
||||
-isystem ${ZEPHYR_BASE}/dts/${ARCH}
|
||||
-isystem ${ZEPHYR_BASE}/dts
|
||||
${DTS_ROOT_SYSTEM_INCLUDE_DIRS}
|
||||
${DTC_INCLUDE_FLAG_FOR_DTS} # include the DTS source and overlays
|
||||
-I${ZEPHYR_BASE}/dts/common
|
||||
${NOSYSDEF_CFLAG}
|
||||
-D__DTS__
|
||||
-P
|
||||
@@ -124,13 +155,9 @@ if(SUPPORTS_DTS)
|
||||
message(FATAL_ERROR "command failed with return code: ${ret}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS ${DTS_APP_BINDINGS})
|
||||
set(DTS_APP_BINDINGS)
|
||||
endif()
|
||||
|
||||
set(CMD_EXTRACT_DTS_INCLUDES ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/dts/extract_dts_includes.py
|
||||
--dts ${BOARD}.dts_compiled
|
||||
--yaml ${ZEPHYR_BASE}/dts/bindings ${DTS_APP_BINDINGS}
|
||||
--yaml ${DTS_ROOT_BINDINGS}
|
||||
--keyvalue ${GENERATED_DTS_BOARD_CONF}
|
||||
--include ${GENERATED_DTS_BOARD_UNFIXED_H}
|
||||
--old-alias-names
|
||||
|
||||
@@ -25,7 +25,7 @@ else()
|
||||
# via pypi, which will result in a single line of output.
|
||||
string(REGEX REPLACE "\n" ";" west_version_output "${west_version_output}")
|
||||
foreach(item ${west_version_output})
|
||||
if("${item}" MATCHES ".*v([0-9]+[.][0-9]+[.][0-9]+)")
|
||||
if("${item}" MATCHES "^[^\/\\]*v([0-9]+[.][0-9]+[.][0-9]+)")
|
||||
set(west_version "${CMAKE_MATCH_1}")
|
||||
if(${west_version} VERSION_LESS ${MIN_WEST_VERSION})
|
||||
message(FATAL_ERROR "The detected west version is unsupported.\n\
|
||||
|
||||
@@ -22,6 +22,7 @@ function(gen_kobj gen_dir_out)
|
||||
--kobj-otype-output ${KOBJ_OTYPE}
|
||||
--kobj-size-output ${KOBJ_SIZE}
|
||||
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
|
||||
DEPENDS $ENV{ZEPHYR_BASE}/scripts/gen_kobject_list.py
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
add_custom_target(${KOBJ_TYPES_H_TARGET} DEPENDS ${KOBJ_TYPES} ${KOBJ_OTYPE})
|
||||
|
||||
@@ -510,12 +510,12 @@ again.
|
||||
.. _application_debugging:
|
||||
.. _custom_board_definition:
|
||||
|
||||
Custom Board and SOC Definitions
|
||||
********************************
|
||||
Custom Board, DeviceTree and SOC Definitions
|
||||
********************************************
|
||||
|
||||
In cases where the board or platform you are developing for is not yet supported
|
||||
by Zephyr, you can add the board and SOC definition to your application and
|
||||
build for this board or SOC without having to add them to the Zephyr tree.
|
||||
In cases where the board or platform you are developing for is not yet
|
||||
supported by Zephyr, you can add board, DeviceTree and SOC definitions
|
||||
to your application without having to add them to the Zephyr tree.
|
||||
|
||||
The structure needed to support out-of-tree board and SOC development
|
||||
is similar to how boards and SOCs are maintained in the Zephyr tree. By using
|
||||
@@ -644,6 +644,29 @@ Zephyr binary into your application directory.
|
||||
You can also define the ``SOC_ROOT`` variable in the application
|
||||
:file:`CMakeLists.txt` file.
|
||||
|
||||
DeviceTree Definitions
|
||||
======================
|
||||
|
||||
Additional DeviceTree directory trees, or DTS_ROOTs, can be added by
|
||||
creating this directory tree:
|
||||
|
||||
dts/bindings/
|
||||
dts/common/
|
||||
dts/arm/
|
||||
include/
|
||||
|
||||
Where 'arm' is changed to the appropriate architecture. Each directory
|
||||
is optional. The binding directory contains bindings and the other
|
||||
directories contain files that can be included from DT sources.
|
||||
|
||||
Once the directory structure is in place, you can use it by specifying
|
||||
its location through the ``DTS_ROOT`` CMake Cache variable::
|
||||
|
||||
cmake -DDTS_ROOT=<path to dts root>
|
||||
|
||||
You can also define the variable in the application
|
||||
:file:`CMakeLists.txt` file.
|
||||
|
||||
.. _ext-projs:
|
||||
|
||||
Modules (External projects)
|
||||
|
||||
@@ -73,6 +73,18 @@ Additionally you can specify the build system target using the ``--target``
|
||||
You can list all targets with ``ninja help`` (or ``west build -t help``) inside
|
||||
the build folder.
|
||||
|
||||
A clean build can be triggered by using the ``--pristine`` (or ``-p``) option.
|
||||
This is particularly handy if you want to switch source dirs or boards without
|
||||
using a different build dir::
|
||||
|
||||
west build -b qemu_x86 samples/philosophers
|
||||
west build -p -b reel_board samples/hello_world
|
||||
|
||||
If you are unsure about whether the command-line parameters you supply to
|
||||
``west build`` require a clean build you can let west decide for you by using
|
||||
the ``auto`` setting in the ``--pristine`` option::
|
||||
|
||||
west build -p auto -b reel_board samples/hello_world
|
||||
|
||||
Finally, you can add additional arguments to the CMake invocation performed by
|
||||
``west build`` by supplying additional parameters (after a ``--``) to the
|
||||
@@ -93,6 +105,33 @@ a CMake re-run using the ``-c`` (or ``--cmake``) option::
|
||||
|
||||
west build -c
|
||||
|
||||
Configuration Options
|
||||
=====================
|
||||
|
||||
You can :ref:`configure <west-config-cmd>` ``west build`` using these options.
|
||||
|
||||
.. NOTE: docs authors: keep this table sorted alphabetically
|
||||
|
||||
.. list-table::
|
||||
:widths: 10 30
|
||||
:header-rows: 1
|
||||
|
||||
* - Option
|
||||
- Description
|
||||
* - ``build.pristine``
|
||||
- String. Controls the way in which ``west build`` may clean the build
|
||||
folder before building. Can take the following values:
|
||||
|
||||
- ``never`` (default): Never automatically make the build folder
|
||||
pristine.
|
||||
- ``auto``: ``west build`` will automatically make the build folder
|
||||
pristine before building, if a build system is present and the build
|
||||
would fail otherwise (e.g. the user has specified a different board
|
||||
or application from the one previously used to make the build
|
||||
directory).
|
||||
- ``always``: Always make the build folder pristine before building, if
|
||||
a build system is present.
|
||||
|
||||
.. _west-flashing:
|
||||
|
||||
Flashing: ``west flash``
|
||||
|
||||
@@ -165,16 +165,11 @@ static struct net_buf *get_rx(int timeout)
|
||||
{
|
||||
BT_DBG("type 0x%02x, evt 0x%02x", rx.type, rx.evt.evt);
|
||||
|
||||
if (rx.type == H4_EVT && (rx.evt.evt == BT_HCI_EVT_CMD_COMPLETE ||
|
||||
rx.evt.evt == BT_HCI_EVT_CMD_STATUS)) {
|
||||
return bt_buf_get_cmd_complete(timeout);
|
||||
if (rx.type == H4_EVT) {
|
||||
return bt_buf_get_evt(rx.evt.evt, rx.discardable, timeout);
|
||||
}
|
||||
|
||||
if (rx.type == H4_ACL) {
|
||||
return bt_buf_get_rx(BT_BUF_ACL_IN, timeout);
|
||||
} else {
|
||||
return bt_buf_get_rx(BT_BUF_EVT, timeout);
|
||||
}
|
||||
return bt_buf_get_rx(BT_BUF_ACL_IN, timeout);
|
||||
}
|
||||
|
||||
static void rx_thread(void *p1, void *p2, void *p3)
|
||||
|
||||
@@ -408,16 +408,7 @@ static inline struct net_buf *get_evt_buf(u8_t evt)
|
||||
{
|
||||
struct net_buf *buf;
|
||||
|
||||
switch (evt) {
|
||||
case BT_HCI_EVT_CMD_COMPLETE:
|
||||
case BT_HCI_EVT_CMD_STATUS:
|
||||
buf = bt_buf_get_cmd_complete(K_NO_WAIT);
|
||||
break;
|
||||
default:
|
||||
buf = bt_buf_get_rx(BT_BUF_EVT, K_NO_WAIT);
|
||||
break;
|
||||
}
|
||||
|
||||
buf = bt_buf_get_evt(evt, false, K_NO_WAIT);
|
||||
if (buf) {
|
||||
net_buf_add_u8(h5.rx_buf, evt);
|
||||
}
|
||||
|
||||
395
drivers/bluetooth/hci/ipm_stm32wb.c
Normal file
395
drivers/bluetooth/hci/ipm_stm32wb.c
Normal file
@@ -0,0 +1,395 @@
|
||||
/* ipm_stm32wb.c - HCI driver for stm32wb shared ram */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2019 Linaro Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
#include <init.h>
|
||||
#include <sys/util.h>
|
||||
|
||||
#include <bluetooth/hci.h>
|
||||
#include <bluetooth/hci_driver.h>
|
||||
|
||||
#include "app_conf.h"
|
||||
#include "stm32_wpan_common.h"
|
||||
#include "shci.h"
|
||||
#include "shci_tl.h"
|
||||
|
||||
#define POOL_SIZE (CFG_TLBLE_EVT_QUEUE_LENGTH * 4 * \
|
||||
DIVC((sizeof(TL_PacketHeader_t) + TL_BLE_EVENT_FRAME_SIZE), 4))
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static TL_CmdPacket_t BleCmdBuffer;
|
||||
PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static u8_t EvtPool[POOL_SIZE];
|
||||
PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static TL_CmdPacket_t SystemCmdBuffer;
|
||||
PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static u8_t
|
||||
SystemSpareEvtBuffer[sizeof(TL_PacketHeader_t) + TL_EVT_HDR_SIZE + 255];
|
||||
PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static u8_t
|
||||
BleSpareEvtBuffer[sizeof(TL_PacketHeader_t) + TL_EVT_HDR_SIZE + 255];
|
||||
PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static u8_t
|
||||
HciAclDataBuffer[sizeof(TL_PacketHeader_t) + 5 + 251];
|
||||
|
||||
static void syscmd_status_not(SHCI_TL_CmdStatus_t status);
|
||||
static void sysevt_received(void *pdata);
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||
#define LOG_MODULE_NAME hci_ipm
|
||||
#include "common/log.h"
|
||||
|
||||
#define HCI_CMD 0x01
|
||||
#define HCI_ACL 0x02
|
||||
#define HCI_SCO 0x03
|
||||
#define HCI_EVT 0x04
|
||||
|
||||
static K_SEM_DEFINE(c2_started, 0, 1);
|
||||
static K_SEM_DEFINE(ble_sys_wait_cmd_rsp, 0, 1);
|
||||
static K_SEM_DEFINE(acl_data_ack, 1, 1);
|
||||
static K_SEM_DEFINE(ipm_busy, 1, 1);
|
||||
|
||||
struct aci_set_tx_power {
|
||||
u8_t cmd;
|
||||
u8_t value[2];
|
||||
};
|
||||
|
||||
#define ACI_WRITE_SET_TX_POWER_LEVEL BT_OP(BT_OGF_VS, 0xFC0F)
|
||||
|
||||
static void stm32wb_start_ble(void)
|
||||
{
|
||||
SHCI_C2_Ble_Init_Cmd_Packet_t ble_init_cmd_packet = {
|
||||
{ { 0, 0, 0 } }, /**< Header unused */
|
||||
{ 0, /** pBleBufferAddress not used */
|
||||
0, /** BleBufferSize not used */
|
||||
CFG_BLE_NUM_GATT_ATTRIBUTES,
|
||||
CFG_BLE_NUM_GATT_SERVICES,
|
||||
CFG_BLE_ATT_VALUE_ARRAY_SIZE,
|
||||
CFG_BLE_NUM_LINK,
|
||||
CFG_BLE_DATA_LENGTH_EXTENSION,
|
||||
CFG_BLE_PREPARE_WRITE_LIST_SIZE,
|
||||
CFG_BLE_MBLOCK_COUNT,
|
||||
CFG_BLE_MAX_ATT_MTU,
|
||||
CFG_BLE_SLAVE_SCA,
|
||||
CFG_BLE_MASTER_SCA,
|
||||
CFG_BLE_LSE_SOURCE,
|
||||
CFG_BLE_MAX_CONN_EVENT_LENGTH,
|
||||
CFG_BLE_HSE_STARTUP_TIME,
|
||||
CFG_BLE_VITERBI_MODE,
|
||||
CFG_BLE_LL_ONLY,
|
||||
0 }
|
||||
};
|
||||
|
||||
/**
|
||||
* Starts the BLE Stack on CPU2
|
||||
*/
|
||||
SHCI_C2_BLE_Init(&ble_init_cmd_packet);
|
||||
}
|
||||
|
||||
static void sysevt_received(void *pdata)
|
||||
{
|
||||
k_sem_give(&c2_started);
|
||||
}
|
||||
|
||||
static void syscmd_status_not(SHCI_TL_CmdStatus_t status)
|
||||
{
|
||||
BT_DBG("status:%d", status);
|
||||
}
|
||||
|
||||
void TM_EvtReceivedCb(TL_EvtPacket_t *hcievt)
|
||||
{
|
||||
struct net_buf *buf;
|
||||
struct bt_hci_acl_hdr acl_hdr;
|
||||
TL_AclDataSerial_t *acl;
|
||||
|
||||
k_sem_take(&ipm_busy, K_NO_WAIT);
|
||||
|
||||
switch (hcievt->evtserial.type) {
|
||||
case HCI_EVT:
|
||||
BT_DBG("EVT: hcievt->evtserial.evt.evtcode: 0x%02x",
|
||||
hcievt->evtserial.evt.evtcode);
|
||||
switch (hcievt->evtserial.evt.evtcode) {
|
||||
case BT_HCI_EVT_VENDOR:
|
||||
/* Vendor events are currently unsupported */
|
||||
BT_ERR("Unknown evtcode type 0x%02x",
|
||||
hcievt->evtserial.evt.evtcode);
|
||||
goto out;
|
||||
default:
|
||||
buf = bt_buf_get_evt(evtserial.evt.evtcode, false,
|
||||
K_FOREVER);
|
||||
break;
|
||||
}
|
||||
net_buf_add_mem(buf, &hcievt->evtserial.evt,
|
||||
hcievt->evtserial.evt.plen + 2);
|
||||
break;
|
||||
case HCI_ACL:
|
||||
acl = &(((TL_AclDataPacket_t *)hcievt)->AclDataSerial);
|
||||
buf = bt_buf_get_rx(BT_BUF_ACL_IN, K_FOREVER);
|
||||
acl_hdr.handle = acl->handle;
|
||||
acl_hdr.len = acl->length;
|
||||
BT_DBG("ACL: handle %x, len %x", acl_hdr.handle, acl_hdr.len);
|
||||
net_buf_add_mem(buf, &acl_hdr, sizeof(acl_hdr));
|
||||
net_buf_add_mem(buf, (u8_t *)&acl->acl_data, acl_hdr.len);
|
||||
break;
|
||||
default:
|
||||
BT_ERR("Unknown BT buf type %d", hcievt->evtserial.type);
|
||||
TL_MM_EvtDone(hcievt);
|
||||
goto out;
|
||||
}
|
||||
|
||||
TL_MM_EvtDone(hcievt);
|
||||
|
||||
if (hcievt->evtserial.type == HCI_EVT &&
|
||||
bt_hci_evt_is_prio(hcievt->evtserial.evt.evtcode)) {
|
||||
bt_recv_prio(buf);
|
||||
} else {
|
||||
bt_recv(buf);
|
||||
}
|
||||
|
||||
out:
|
||||
k_sem_give(&ipm_busy);
|
||||
}
|
||||
|
||||
static void TM_AclDataAck(void)
|
||||
{
|
||||
k_sem_give(&acl_data_ack);
|
||||
}
|
||||
|
||||
void shci_notify_asynch_evt(void *pdata)
|
||||
{
|
||||
shci_user_evt_proc();
|
||||
}
|
||||
|
||||
void shci_cmd_resp_release(uint32_t flag)
|
||||
{
|
||||
k_sem_give(&ble_sys_wait_cmd_rsp);
|
||||
}
|
||||
|
||||
void shci_cmd_resp_wait(uint32_t timeout)
|
||||
{
|
||||
k_sem_take(&ble_sys_wait_cmd_rsp, timeout);
|
||||
}
|
||||
|
||||
void ipcc_reset(void)
|
||||
{
|
||||
/* Reset IPCC */
|
||||
LL_AHB3_GRP1_EnableClock(LL_AHB3_GRP1_PERIPH_IPCC);
|
||||
|
||||
LL_C1_IPCC_ClearFlag_CHx(
|
||||
IPCC,
|
||||
LL_IPCC_CHANNEL_1 | LL_IPCC_CHANNEL_2 | LL_IPCC_CHANNEL_3 |
|
||||
LL_IPCC_CHANNEL_4 | LL_IPCC_CHANNEL_5 | LL_IPCC_CHANNEL_6);
|
||||
|
||||
LL_C2_IPCC_ClearFlag_CHx(
|
||||
IPCC,
|
||||
LL_IPCC_CHANNEL_1 | LL_IPCC_CHANNEL_2 | LL_IPCC_CHANNEL_3 |
|
||||
LL_IPCC_CHANNEL_4 | LL_IPCC_CHANNEL_5 | LL_IPCC_CHANNEL_6);
|
||||
|
||||
LL_C1_IPCC_DisableTransmitChannel(
|
||||
IPCC,
|
||||
LL_IPCC_CHANNEL_1 | LL_IPCC_CHANNEL_2 | LL_IPCC_CHANNEL_3 |
|
||||
LL_IPCC_CHANNEL_4 | LL_IPCC_CHANNEL_5 | LL_IPCC_CHANNEL_6);
|
||||
|
||||
LL_C2_IPCC_DisableTransmitChannel(
|
||||
IPCC,
|
||||
LL_IPCC_CHANNEL_1 | LL_IPCC_CHANNEL_2 | LL_IPCC_CHANNEL_3 |
|
||||
LL_IPCC_CHANNEL_4 | LL_IPCC_CHANNEL_5 | LL_IPCC_CHANNEL_6);
|
||||
|
||||
LL_C1_IPCC_DisableReceiveChannel(
|
||||
IPCC,
|
||||
LL_IPCC_CHANNEL_1 | LL_IPCC_CHANNEL_2 | LL_IPCC_CHANNEL_3 |
|
||||
LL_IPCC_CHANNEL_4 | LL_IPCC_CHANNEL_5 | LL_IPCC_CHANNEL_6);
|
||||
|
||||
LL_C2_IPCC_DisableReceiveChannel(
|
||||
IPCC,
|
||||
LL_IPCC_CHANNEL_1 | LL_IPCC_CHANNEL_2 | LL_IPCC_CHANNEL_3 |
|
||||
LL_IPCC_CHANNEL_4 | LL_IPCC_CHANNEL_5 | LL_IPCC_CHANNEL_6);
|
||||
|
||||
/* Set IPCC default IRQ handlers */
|
||||
IRQ_CONNECT(IPCC_C1_RX_IRQn, 0, HW_IPCC_Rx_Handler, NULL, 0);
|
||||
IRQ_CONNECT(IPCC_C1_TX_IRQn, 0, HW_IPCC_Tx_Handler, NULL, 0);
|
||||
}
|
||||
|
||||
void transport_init(void)
|
||||
{
|
||||
TL_MM_Config_t tl_mm_config;
|
||||
TL_BLE_InitConf_t tl_ble_config;
|
||||
SHCI_TL_HciInitConf_t shci_init_config;
|
||||
|
||||
BT_DBG("BleCmdBuffer: %p", (void *)&BleCmdBuffer);
|
||||
BT_DBG("HciAclDataBuffer: %p", (void *)&HciAclDataBuffer);
|
||||
BT_DBG("SystemCmdBuffer: %p", (void *)&SystemCmdBuffer);
|
||||
BT_DBG("EvtPool: %p", (void *)&EvtPool);
|
||||
BT_DBG("SystemSpareEvtBuffer: %p", (void *)&SystemSpareEvtBuffer);
|
||||
BT_DBG("BleSpareEvtBuffer: %p", (void *)&BleSpareEvtBuffer);
|
||||
|
||||
/**< Reference table initialization */
|
||||
TL_Init();
|
||||
|
||||
/**< System channel initialization */
|
||||
shci_init_config.p_cmdbuffer = (u8_t *)&SystemCmdBuffer;
|
||||
shci_init_config.StatusNotCallBack = syscmd_status_not;
|
||||
shci_init(sysevt_received, (void *) &shci_init_config);
|
||||
|
||||
/**< Memory Manager channel initialization */
|
||||
tl_mm_config.p_BleSpareEvtBuffer = BleSpareEvtBuffer;
|
||||
tl_mm_config.p_SystemSpareEvtBuffer = SystemSpareEvtBuffer;
|
||||
tl_mm_config.p_AsynchEvtPool = EvtPool;
|
||||
tl_mm_config.AsynchEvtPoolSize = POOL_SIZE;
|
||||
TL_MM_Init(&tl_mm_config);
|
||||
|
||||
/**< BLE channel initialization */
|
||||
tl_ble_config.p_cmdbuffer = (u8_t *)&BleCmdBuffer;
|
||||
tl_ble_config.p_AclDataBuffer = HciAclDataBuffer;
|
||||
tl_ble_config.IoBusEvtCallBack = TM_EvtReceivedCb;
|
||||
tl_ble_config.IoBusAclDataTxAck = TM_AclDataAck;
|
||||
TL_BLE_Init((void *)&tl_ble_config);
|
||||
|
||||
TL_Enable();
|
||||
}
|
||||
|
||||
static int bt_ipm_send(struct net_buf *buf)
|
||||
{
|
||||
TL_CmdPacket_t *ble_cmd_buff = &BleCmdBuffer;
|
||||
|
||||
k_sem_take(&ipm_busy, K_FOREVER);
|
||||
|
||||
switch (bt_buf_get_type(buf)) {
|
||||
case BT_BUF_ACL_OUT:
|
||||
BT_DBG("ACL: buf %p type %u len %u", buf, bt_buf_get_type(buf),
|
||||
buf->len);
|
||||
k_sem_take(&acl_data_ack, K_FOREVER);
|
||||
net_buf_push_u8(buf, HCI_ACL);
|
||||
memcpy((void *)
|
||||
&((TL_AclDataPacket_t *)HciAclDataBuffer)->AclDataSerial,
|
||||
buf->data, buf->len);
|
||||
TL_BLE_SendAclData(NULL, 0);
|
||||
break;
|
||||
case BT_BUF_CMD:
|
||||
BT_DBG("CMD: buf %p type %u len %u", buf, bt_buf_get_type(buf),
|
||||
buf->len);
|
||||
ble_cmd_buff->cmdserial.type = HCI_CMD;
|
||||
ble_cmd_buff->cmdserial.cmd.plen = buf->len;
|
||||
memcpy((void *)&ble_cmd_buff->cmdserial.cmd, buf->data,
|
||||
buf->len);
|
||||
TL_BLE_SendCmd(NULL, 0);
|
||||
break;
|
||||
default:
|
||||
k_sem_give(&ipm_busy);
|
||||
BT_ERR("Unsupported type");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
k_sem_give(&ipm_busy);
|
||||
|
||||
net_buf_unref(buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void start_ble_rf(void)
|
||||
{
|
||||
if ((LL_RCC_IsActiveFlag_PINRST()) && (!LL_RCC_IsActiveFlag_SFTRST())) {
|
||||
/* Simulate power off reset */
|
||||
LL_PWR_EnableBkUpAccess();
|
||||
LL_PWR_EnableBkUpAccess();
|
||||
LL_RCC_ForceBackupDomainReset();
|
||||
LL_RCC_ReleaseBackupDomainReset();
|
||||
}
|
||||
|
||||
/* Select LSE clock */
|
||||
LL_RCC_LSE_Enable();
|
||||
while (!LL_RCC_LSE_IsReady()) {
|
||||
}
|
||||
|
||||
/* Select wakeup source of BLE RF */
|
||||
LL_RCC_SetRFWKPClockSource(LL_RCC_RFWKP_CLKSOURCE_LSE);
|
||||
LL_RCC_SetRTCClockSource(LL_RCC_RTC_CLKSOURCE_LSE);
|
||||
|
||||
/* Switch OFF LSI */
|
||||
LL_RCC_LSI1_Disable();
|
||||
/* Set RNG on HSI48 */
|
||||
LL_RCC_HSI48_Enable();
|
||||
while (!LL_RCC_HSI48_IsReady()) {
|
||||
}
|
||||
|
||||
LL_RCC_SetCLK48ClockSource(LL_RCC_CLK48_CLKSOURCE_HSI48);
|
||||
}
|
||||
|
||||
static int bt_ipm_ble_init(void)
|
||||
{
|
||||
struct aci_set_tx_power *param;
|
||||
struct net_buf *buf, *rsp;
|
||||
int err;
|
||||
|
||||
/* Send HCI_RESET */
|
||||
err = bt_hci_cmd_send_sync(BT_HCI_OP_RESET, NULL, &rsp);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
/* TDB: Something to do on reset complete? */
|
||||
net_buf_unref(rsp);
|
||||
|
||||
/* Send ACI_WRITE_SET_TX_POWER_LEVEL */
|
||||
buf = bt_hci_cmd_create(ACI_WRITE_SET_TX_POWER_LEVEL, 3);
|
||||
if (!buf) {
|
||||
return -ENOBUFS;
|
||||
}
|
||||
param = net_buf_add(buf, sizeof(*param));
|
||||
param->cmd = 0x0F;
|
||||
param->value[0] = 0x18;
|
||||
param->value[1] = 0x01;
|
||||
|
||||
err = bt_hci_cmd_send_sync(ACI_WRITE_SET_TX_POWER_LEVEL, buf, &rsp);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
net_buf_unref(rsp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bt_ipm_open(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
/* Take BLE out of reset */
|
||||
ipcc_reset();
|
||||
|
||||
transport_init();
|
||||
|
||||
/* Device will let us know when it's ready */
|
||||
k_sem_take(&c2_started, K_FOREVER);
|
||||
BT_DBG("C2 unlocked");
|
||||
|
||||
stm32wb_start_ble();
|
||||
|
||||
BT_DBG("IPM Channel Open Completed");
|
||||
|
||||
err = bt_ipm_ble_init();
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct bt_hci_driver drv = {
|
||||
.name = "BT IPM",
|
||||
.bus = BT_HCI_DRIVER_BUS_IPM,
|
||||
.quirks = BT_QUIRK_NO_RESET,
|
||||
.open = bt_ipm_open,
|
||||
.send = bt_ipm_send,
|
||||
};
|
||||
|
||||
static int _bt_ipm_init(struct device *unused)
|
||||
{
|
||||
ARG_UNUSED(unused);
|
||||
|
||||
bt_hci_driver_register(&drv);
|
||||
|
||||
start_ble_rf();
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(_bt_ipm_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
|
||||
@@ -353,12 +353,9 @@ static void bt_spi_rx_thread(void)
|
||||
/* Vendor events are currently unsupported */
|
||||
bt_spi_handle_vendor_evt(rxmsg);
|
||||
continue;
|
||||
case BT_HCI_EVT_CMD_COMPLETE:
|
||||
case BT_HCI_EVT_CMD_STATUS:
|
||||
buf = bt_buf_get_cmd_complete(K_FOREVER);
|
||||
break;
|
||||
default:
|
||||
buf = bt_buf_get_rx(BT_BUF_EVT, K_FOREVER);
|
||||
buf = bt_buf_get_evt(rxmsg[EVT_HEADER_EVENT],
|
||||
false, K_FOREVER);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,16 +57,11 @@ static int bt_dev_index = -1;
|
||||
|
||||
static struct net_buf *get_rx(const u8_t *buf)
|
||||
{
|
||||
if (buf[0] == H4_EVT && (buf[1] == BT_HCI_EVT_CMD_COMPLETE ||
|
||||
buf[1] == BT_HCI_EVT_CMD_STATUS)) {
|
||||
return bt_buf_get_cmd_complete(K_FOREVER);
|
||||
if (buf[0] == H4_EVT) {
|
||||
return bt_buf_get_evt(buf[1], false, K_FOREVER);
|
||||
}
|
||||
|
||||
if (buf[0] == H4_ACL) {
|
||||
return bt_buf_get_rx(BT_BUF_ACL_IN, K_FOREVER);
|
||||
} else {
|
||||
return bt_buf_get_rx(BT_BUF_EVT, K_FOREVER);
|
||||
}
|
||||
return bt_buf_get_rx(BT_BUF_ACL_IN, K_FOREVER);
|
||||
}
|
||||
|
||||
static bool uc_ready(void)
|
||||
|
||||
@@ -571,15 +571,15 @@ static void can_stm32_set_filter_bank(int filter_nr,
|
||||
|
||||
static inline void can_stm32_set_mode_scale(enum can_filter_type filter_type,
|
||||
u32_t *mode_reg, u32_t *scale_reg,
|
||||
int filter_nr)
|
||||
int bank_nr)
|
||||
{
|
||||
u32_t mode_reg_bit = (filter_type & 0x01) << filter_nr;
|
||||
u32_t scale_reg_bit = (filter_type >> 1) << filter_nr;
|
||||
u32_t mode_reg_bit = (filter_type & 0x01) << bank_nr;
|
||||
u32_t scale_reg_bit = (filter_type >> 1) << bank_nr;
|
||||
|
||||
*mode_reg &= ~(1 << filter_nr);
|
||||
*mode_reg &= ~(1 << bank_nr);
|
||||
*mode_reg |= mode_reg_bit;
|
||||
|
||||
*scale_reg &= ~(1 << filter_nr);
|
||||
*scale_reg &= ~(1 << bank_nr);
|
||||
*scale_reg |= scale_reg_bit;
|
||||
}
|
||||
|
||||
@@ -699,7 +699,7 @@ static inline int can_stm32_set_filter(const struct zcan_filter *filter,
|
||||
u32_t scale_reg = can->FS1R;
|
||||
|
||||
can_stm32_set_mode_scale(filter_type, &mode_reg, &scale_reg,
|
||||
filter_nr);
|
||||
bank_nr);
|
||||
|
||||
shift_width = filter_in_bank[filter_type] - filter_in_bank[bank_mode];
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ if !SOC_SERIES_STM32F4X
|
||||
|
||||
choice COUNTER_RTC_STM32_LSE_DRIVE
|
||||
prompt "LSE oscillator drive capability"
|
||||
depends on RTC_STM32_CLOCK_LSE
|
||||
depends on COUNTER_RTC_STM32_CLOCK_LSE
|
||||
|
||||
config COUNTER_RTC_STM32_LSE_DRIVE_LOW
|
||||
bool "Low"
|
||||
|
||||
@@ -275,10 +275,14 @@ static int rtc_stm32_init(struct device *dev)
|
||||
|
||||
#else /* CONFIG_COUNTER_RTC_STM32_CLOCK_LSE */
|
||||
|
||||
#ifndef(CONFIG_SOC_SERIES_STM32F4X)
|
||||
#if !defined(CONFIG_SOC_SERIES_STM32F4X) && \
|
||||
!defined(CONFIG_SOC_SERIES_STM32F2X)
|
||||
|
||||
LL_RCC_LSE_SetDriveCapability(
|
||||
CONFIG_COUNTER_RTC_STM32_LSE_DRIVE_STRENGTH);
|
||||
#endif /* !CONFIG_SOC_SERIES_STM32F4X */
|
||||
|
||||
#endif /* !CONFIG_SOC_SERIES_STM32F4X && !CONFIG_SOC_SERIES_STM32F2X */
|
||||
|
||||
LL_RCC_LSE_Enable();
|
||||
|
||||
/* Wait until LSE is ready */
|
||||
|
||||
@@ -99,6 +99,15 @@ static int counter_nrfx_set_alarm(struct device *dev, u8_t chan_id,
|
||||
nrfx_config->ch_data[chan_id].callback = alarm_cfg->callback;
|
||||
nrfx_config->ch_data[chan_id].user_data = alarm_cfg->user_data;
|
||||
|
||||
if ((cc_val == 0) &&
|
||||
(get_dev_data(dev)->top != counter_get_max_top_value(dev))) {
|
||||
/* From Product Specification: If a CC register value is 0 when
|
||||
* a CLEAR task is set, this will not trigger a COMPARE event.
|
||||
*/
|
||||
LOG_INST_INF(nrfx_config->log,
|
||||
"Attempt to set CC to 0, delayed to 1.");
|
||||
cc_val++;
|
||||
}
|
||||
nrfx_rtc_cc_set(rtc, ID_TO_CC(chan_id), cc_val, true);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
zephyr_link_interface_ifdef(CONFIG_MBEDTLS mbedTLS)
|
||||
zephyr_library()
|
||||
zephyr_library_sources_ifdef(CONFIG_CRYPTO_TINYCRYPT_SHIM crypto_tc_shim.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CRYPTO_ATAES132A crypto_ataes132a.c)
|
||||
|
||||
@@ -342,17 +342,19 @@ static int spi_flash_wb_erase(struct device *dev, off_t offset, size_t size)
|
||||
break;
|
||||
}
|
||||
|
||||
if (size_remaining >= W25QXXDV_BLOCK_SIZE) {
|
||||
if ((size_remaining >= W25QXXDV_BLOCK_SIZE) &&
|
||||
((new_offset & (W25QXXDV_BLOCK_SIZE - 1)) == 0)) {
|
||||
ret = spi_flash_wb_erase_internal(dev, new_offset,
|
||||
W25QXXDV_BLOCK_SIZE);
|
||||
W25QXXDV_BLOCK_SIZE);
|
||||
new_offset += W25QXXDV_BLOCK_SIZE;
|
||||
size_remaining -= W25QXXDV_BLOCK_SIZE;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (size_remaining >= W25QXXDV_BLOCK32K_SIZE) {
|
||||
if ((size_remaining >= W25QXXDV_BLOCK32K_SIZE) &&
|
||||
((new_offset & (W25QXXDV_BLOCK32K_SIZE - 1)) == 0)) {
|
||||
ret = spi_flash_wb_erase_internal(dev, new_offset,
|
||||
W25QXXDV_BLOCK32K_SIZE);
|
||||
W25QXXDV_BLOCK32K_SIZE);
|
||||
new_offset += W25QXXDV_BLOCK32K_SIZE;
|
||||
size_remaining -= W25QXXDV_BLOCK32K_SIZE;
|
||||
continue;
|
||||
@@ -360,7 +362,7 @@ static int spi_flash_wb_erase(struct device *dev, off_t offset, size_t size)
|
||||
|
||||
if (size_remaining >= W25QXXDV_SECTOR_SIZE) {
|
||||
ret = spi_flash_wb_erase_internal(dev, new_offset,
|
||||
W25QXXDV_SECTOR_SIZE);
|
||||
W25QXXDV_SECTOR_SIZE);
|
||||
new_offset += W25QXXDV_SECTOR_SIZE;
|
||||
size_remaining -= W25QXXDV_SECTOR_SIZE;
|
||||
continue;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <soc.h>
|
||||
#include <fsl_common.h>
|
||||
#include <fsl_port.h>
|
||||
#include <clock_control.h>
|
||||
|
||||
#include "gpio_utils.h"
|
||||
|
||||
@@ -19,6 +20,9 @@ struct gpio_rv32m1_config {
|
||||
GPIO_Type *gpio_base;
|
||||
PORT_Type *port_base;
|
||||
unsigned int flags;
|
||||
char *clock_controller;
|
||||
clock_control_subsys_t clock_subsys;
|
||||
int (*irq_config_func)(struct device *dev);
|
||||
};
|
||||
|
||||
struct gpio_rv32m1_data {
|
||||
@@ -228,6 +232,27 @@ static void gpio_rv32m1_port_isr(void *arg)
|
||||
config->port_base->ISFR = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
static int gpio_rv32m1_init(struct device *dev)
|
||||
{
|
||||
const struct gpio_rv32m1_config *config = dev->config->config_info;
|
||||
struct device *clk;
|
||||
int ret;
|
||||
|
||||
if (config->clock_controller) {
|
||||
clk = device_get_binding(config->clock_controller);
|
||||
if (!clk) {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = clock_control_on(clk, config->clock_subsys);
|
||||
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return config->irq_config_func(dev);
|
||||
}
|
||||
|
||||
static const struct gpio_driver_api gpio_rv32m1_driver_api = {
|
||||
.config = gpio_rv32m1_configure,
|
||||
@@ -248,13 +273,21 @@ static const struct gpio_rv32m1_config gpio_rv32m1_porta_config = {
|
||||
.flags = GPIO_INT,
|
||||
#else
|
||||
.flags = 0,
|
||||
#endif
|
||||
.irq_config_func = gpio_rv32m1_porta_init,
|
||||
#ifdef DT_OPENISA_RV32M1_GPIO_GPIO_A_CLOCK_CONTROLLER
|
||||
.clock_controller = DT_OPENISA_RV32M1_GPIO_GPIO_A_CLOCK_CONTROLLER,
|
||||
.clock_subsys = (clock_control_subsys_t)
|
||||
DT_OPENISA_RV32M1_GPIO_GPIO_A_CLOCK_NAME,
|
||||
#else
|
||||
.clock_controller = NULL,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gpio_rv32m1_data gpio_rv32m1_porta_data;
|
||||
|
||||
DEVICE_AND_API_INIT(gpio_rv32m1_porta, DT_OPENISA_RV32M1_GPIO_GPIO_A_LABEL,
|
||||
gpio_rv32m1_porta_init,
|
||||
gpio_rv32m1_init,
|
||||
&gpio_rv32m1_porta_data, &gpio_rv32m1_porta_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&gpio_rv32m1_driver_api);
|
||||
@@ -285,13 +318,21 @@ static const struct gpio_rv32m1_config gpio_rv32m1_portb_config = {
|
||||
.flags = GPIO_INT,
|
||||
#else
|
||||
.flags = 0,
|
||||
#endif
|
||||
.irq_config_func = gpio_rv32m1_portb_init,
|
||||
#ifdef DT_OPENISA_RV32M1_GPIO_GPIO_B_CLOCK_CONTROLLER
|
||||
.clock_controller = DT_OPENISA_RV32M1_GPIO_GPIO_B_CLOCK_CONTROLLER,
|
||||
.clock_subsys = (clock_control_subsys_t)
|
||||
DT_OPENISA_RV32M1_GPIO_GPIO_B_CLOCK_NAME,
|
||||
#else
|
||||
.clock_controller = NULL,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gpio_rv32m1_data gpio_rv32m1_portb_data;
|
||||
|
||||
DEVICE_AND_API_INIT(gpio_rv32m1_portb, DT_OPENISA_RV32M1_GPIO_GPIO_B_LABEL,
|
||||
gpio_rv32m1_portb_init,
|
||||
gpio_rv32m1_init,
|
||||
&gpio_rv32m1_portb_data, &gpio_rv32m1_portb_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&gpio_rv32m1_driver_api);
|
||||
@@ -323,12 +364,21 @@ static const struct gpio_rv32m1_config gpio_rv32m1_portc_config = {
|
||||
#else
|
||||
.flags = 0,
|
||||
#endif
|
||||
.irq_config_func = gpio_rv32m1_portc_init,
|
||||
#ifdef DT_OPENISA_RV32M1_GPIO_GPIO_C_CLOCK_CONTROLLER
|
||||
.clock_controller = DT_OPENISA_RV32M1_GPIO_GPIO_C_CLOCK_CONTROLLER,
|
||||
.clock_subsys = (clock_control_subsys_t)
|
||||
DT_OPENISA_RV32M1_GPIO_GPIO_C_CLOCK_NAME,
|
||||
#else
|
||||
.clock_controller = NULL,
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
static struct gpio_rv32m1_data gpio_rv32m1_portc_data;
|
||||
|
||||
DEVICE_AND_API_INIT(gpio_rv32m1_portc, DT_OPENISA_RV32M1_GPIO_GPIO_C_LABEL,
|
||||
gpio_rv32m1_portc_init,
|
||||
gpio_rv32m1_init,
|
||||
&gpio_rv32m1_portc_data, &gpio_rv32m1_portc_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&gpio_rv32m1_driver_api);
|
||||
@@ -359,13 +409,21 @@ static const struct gpio_rv32m1_config gpio_rv32m1_portd_config = {
|
||||
.flags = GPIO_INT,
|
||||
#else
|
||||
.flags = 0,
|
||||
#endif
|
||||
.irq_config_func = gpio_rv32m1_portd_init,
|
||||
#ifdef DT_OPENISA_RV32M1_GPIO_GPIO_D_CLOCK_CONTROLLER
|
||||
.clock_controller = DT_OPENISA_RV32M1_GPIO_GPIO_D_CLOCK_CONTROLLER,
|
||||
.clock_subsys = (clock_control_subsys_t)
|
||||
DT_OPENISA_RV32M1_GPIO_GPIO_D_CLOCK_NAME,
|
||||
#else
|
||||
.clock_controller = NULL,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gpio_rv32m1_data gpio_rv32m1_portd_data;
|
||||
|
||||
DEVICE_AND_API_INIT(gpio_rv32m1_portd, DT_OPENISA_RV32M1_GPIO_GPIO_D_LABEL,
|
||||
gpio_rv32m1_portd_init,
|
||||
gpio_rv32m1_init,
|
||||
&gpio_rv32m1_portd_data, &gpio_rv32m1_portd_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&gpio_rv32m1_driver_api);
|
||||
@@ -396,13 +454,21 @@ static const struct gpio_rv32m1_config gpio_rv32m1_porte_config = {
|
||||
.flags = GPIO_INT,
|
||||
#else
|
||||
.flags = 0,
|
||||
#endif
|
||||
.irq_config_func = gpio_rv32m1_porte_init,
|
||||
#ifdef DT_OPENISA_RV32M1_GPIO_GPIO_E_CLOCK_CONTROLLER
|
||||
.clock_controller = DT_OPENISA_RV32M1_GPIO_GPIO_E_CLOCK_CONTROLLER,
|
||||
.clock_subsys = (clock_control_subsys_t)
|
||||
DT_OPENISA_RV32M1_GPIO_GPIO_E_CLOCK_NAME,
|
||||
#else
|
||||
.clock_controller = NULL,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gpio_rv32m1_data gpio_rv32m1_porte_data;
|
||||
|
||||
DEVICE_AND_API_INIT(gpio_rv32m1_porte, DT_OPENISA_RV32M1_GPIO_GPIO_E_LABEL,
|
||||
gpio_rv32m1_porte_init,
|
||||
gpio_rv32m1_init,
|
||||
&gpio_rv32m1_porte_data, &gpio_rv32m1_porte_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&gpio_rv32m1_driver_api);
|
||||
|
||||
@@ -609,7 +609,7 @@ static void i2s_stm32_isr(void *arg)
|
||||
struct i2s_stm32_data *const dev_data = DEV_DATA(dev);
|
||||
struct stream *stream = &dev_data->rx;
|
||||
|
||||
LOG_ERR("%s: err=%d", __func__, LL_I2S_ReadReg(cfg->i2s, SR));
|
||||
LOG_ERR("%s: err=%d", __func__, (int)LL_I2S_ReadReg(cfg->i2s, SR));
|
||||
stream->state = I2S_STATE_ERROR;
|
||||
|
||||
/* OVR error must be explicitly cleared */
|
||||
|
||||
@@ -87,8 +87,8 @@ int kw41_dbg_idx;
|
||||
#define RADIO_0_IRQ_PRIO 0x0
|
||||
#define KW41Z_FCS_LENGTH 2
|
||||
#define KW41Z_PSDU_LENGTH 125
|
||||
#define KW41Z_OUTPUT_POWER_MAX 2
|
||||
#define KW41Z_OUTPUT_POWER_MIN (-19)
|
||||
#define KW41Z_OUTPUT_POWER_MAX 4
|
||||
#define KW41Z_OUTPUT_POWER_MIN (-31)
|
||||
|
||||
#define IEEE802154_ACK_LENGTH 5
|
||||
|
||||
@@ -122,16 +122,28 @@ enum {
|
||||
};
|
||||
|
||||
/* Lookup table for PA_PWR register */
|
||||
static const u8_t pa_pwr_lt[22] = {
|
||||
2, 2, 2, 2, 2, 2, /* -19:-14 dBm */
|
||||
4, 4, 4, /* -13:-11 dBm */
|
||||
6, 6, 6, /* -10:-8 dBm */
|
||||
8, 8, /* -7:-6 dBm */
|
||||
10, 10, /* -5:-4 dBm */
|
||||
12, /* -3 dBm */
|
||||
14, 14, /* -2:-1 dBm */
|
||||
18, 18, /* 0:1 dBm */
|
||||
24 /* 2 dBm */
|
||||
static const u8_t pa_pwr_lt[] = {
|
||||
1, /* -31.1 dBm: -31 */
|
||||
2, 2, 2, 2, 2, 2, 2, /* -25.0 dBm: -30, -29, -28, -27, -26, -25 */
|
||||
4, 4, 4, 4, 4, /* -19.0 dBm: -24, -23, -22, -21, -20, -19 */
|
||||
6, 6, 6, /* -15.6 dBm: -18, -17, -16 */
|
||||
8, 8, /* -13.1 dBm: -15, -14 */
|
||||
10, 10, /* -11.2 dBm: -13, -12 */
|
||||
12, 12, /* - 9.6 dBm: -11, -10 */
|
||||
14, /* - 8.3 dBm: -9 */
|
||||
16, /* - 7.2 dBm: -8 */
|
||||
18, /* - 6.2 dBm: -7 */
|
||||
20, /* - 5.3 dBm: -6 */
|
||||
22, /* - 4.5 dBm: -5 */
|
||||
24, /* - 3.8 dBm: -4 */
|
||||
28, /* - 2.5 dBm: -3 */
|
||||
30, /* - 1.9 dBm: -2 */
|
||||
34, /* - 1.0 dBm: -1 */
|
||||
40, /* + 0.3 dBm: 0 */
|
||||
44, /* + 1.1 dBm: +1 */
|
||||
50, /* + 2.1 dBm: +2 */
|
||||
58, /* + 3.1 dBm: +3 */
|
||||
62 /* + 3.5 dBm: +4 */
|
||||
};
|
||||
|
||||
struct kw41z_context {
|
||||
@@ -433,13 +445,21 @@ static int kw41z_filter(struct device *dev,
|
||||
static int kw41z_set_txpower(struct device *dev, s16_t dbm)
|
||||
{
|
||||
if (dbm < KW41Z_OUTPUT_POWER_MIN) {
|
||||
ZLL->PA_PWR = 0;
|
||||
LOG_INF("TX-power %d dBm below min of %d dBm, using %d dBm",
|
||||
dbm,
|
||||
KW41Z_OUTPUT_POWER_MIN,
|
||||
KW41Z_OUTPUT_POWER_MIN);
|
||||
dbm = KW41Z_OUTPUT_POWER_MIN;
|
||||
} else if (dbm > KW41Z_OUTPUT_POWER_MAX) {
|
||||
ZLL->PA_PWR = 30;
|
||||
} else {
|
||||
ZLL->PA_PWR = pa_pwr_lt[dbm - KW41Z_OUTPUT_POWER_MIN];
|
||||
LOG_INF("TX-power %d dBm above max of %d dBm, using %d dBm",
|
||||
dbm,
|
||||
KW41Z_OUTPUT_POWER_MAX,
|
||||
KW41Z_OUTPUT_POWER_MAX);
|
||||
dbm = KW41Z_OUTPUT_POWER_MAX;
|
||||
}
|
||||
|
||||
ZLL->PA_PWR = pa_pwr_lt[dbm - KW41Z_OUTPUT_POWER_MIN];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,9 +30,8 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
|
||||
#include <net/net_pkt.h>
|
||||
#include <net/net_if.h>
|
||||
#include <net/net_core.h>
|
||||
#include <net/dummy.h>
|
||||
#include <console/uart_pipe.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <net/lldp.h>
|
||||
|
||||
#define SLIP_END 0300
|
||||
#define SLIP_ESC 0333
|
||||
@@ -395,9 +394,13 @@ static void slip_iface_init(struct net_if *iface)
|
||||
struct slip_context *slip = net_if_get_device(iface)->driver_data;
|
||||
struct net_linkaddr *ll_addr;
|
||||
|
||||
#if defined(CONFIG_NET_L2_ETHERNET)
|
||||
ethernet_init(iface);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_LLDP)
|
||||
net_lldp_set_lldpdu(iface);
|
||||
#endif
|
||||
|
||||
if (slip->init_done) {
|
||||
return;
|
||||
@@ -429,6 +432,7 @@ use_random_mac:
|
||||
|
||||
static struct slip_context slip_context_data;
|
||||
|
||||
#if defined(CONFIG_SLIP_TAP)
|
||||
static enum ethernet_hw_caps eth_capabilities(struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
@@ -440,7 +444,6 @@ static enum ethernet_hw_caps eth_capabilities(struct device *dev)
|
||||
;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_SLIP_TAP) && defined(CONFIG_NET_L2_ETHERNET)
|
||||
static const struct ethernet_api slip_if_api = {
|
||||
.iface_api.init = slip_iface_init,
|
||||
|
||||
@@ -458,7 +461,7 @@ ETH_NET_DEVICE_INIT(slip, CONFIG_SLIP_DRV_NAME, slip_init, &slip_context_data,
|
||||
#else
|
||||
|
||||
static const struct dummy_api slip_if_api = {
|
||||
.iface_init.init = slip_iface_init,
|
||||
.iface_api.init = slip_iface_init,
|
||||
|
||||
.send = slip_send,
|
||||
};
|
||||
|
||||
@@ -57,10 +57,11 @@ static u32_t pwm_period_check_and_set(const struct pwm_nrfx_config *config,
|
||||
/* See if there is a prescaler that will make it work: */
|
||||
bool matching_prescaler_found = false;
|
||||
|
||||
/* Go through all available prescaler values on device.
|
||||
/* Go through all available prescaler values on device (skip 0
|
||||
* here as it is used in the 'else' block).
|
||||
* nRF52832 has 0-7 (Div1 - Div128)
|
||||
*/
|
||||
for (u8_t prescaler = 0;
|
||||
for (u8_t prescaler = 1;
|
||||
prescaler <= PWM_PRESCALER_PRESCALER_Msk;
|
||||
prescaler++) {
|
||||
u32_t new_countertop = period_cycles >> prescaler;
|
||||
@@ -82,10 +83,10 @@ static u32_t pwm_period_check_and_set(const struct pwm_nrfx_config *config,
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
/* If period_cycles fit with standard prescaler,
|
||||
* set it directly
|
||||
/* If period_cycles fit the PWM counter without dividing
|
||||
* the PWM clock, use the zero prescaler.
|
||||
*/
|
||||
data->prescaler = 1U;
|
||||
data->prescaler = 0U;
|
||||
data->countertop = period_cycles;
|
||||
data->period_cycles = period_cycles;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,8 @@ static u32_t rtc_stm32_read(struct device *dev)
|
||||
/* Convert calendar datetime to UNIX timestamp */
|
||||
now.tm_year = 100 + __LL_RTC_CONVERT_BCD2BIN(
|
||||
__LL_RTC_GET_YEAR(rtc_date));
|
||||
now.tm_mon = __LL_RTC_CONVERT_BCD2BIN(__LL_RTC_GET_MONTH(rtc_date));
|
||||
/* tm_mon starts from 0 */
|
||||
now.tm_mon = __LL_RTC_CONVERT_BCD2BIN(__LL_RTC_GET_MONTH(rtc_date)) - 1;
|
||||
now.tm_mday = __LL_RTC_CONVERT_BCD2BIN(__LL_RTC_GET_DAY(rtc_date));
|
||||
|
||||
now.tm_hour = __LL_RTC_CONVERT_BCD2BIN(__LL_RTC_GET_HOUR(rtc_time));
|
||||
@@ -147,7 +148,8 @@ static int rtc_stm32_set_config(struct device *dev, struct rtc_config *cfg)
|
||||
gmtime_r(&init_ts, &init_tm);
|
||||
|
||||
rtc_date.Year = init_tm.tm_year % 100;
|
||||
rtc_date.Month = init_tm.tm_mon;
|
||||
/* tm_mon starts from 0 */
|
||||
rtc_date.Month = init_tm.tm_mon + 1;
|
||||
rtc_date.Day = init_tm.tm_mday;
|
||||
rtc_date.WeekDay = init_tm.tm_wday + 1;
|
||||
|
||||
|
||||
@@ -399,12 +399,12 @@ DEVICE_AND_API_INIT(uart_sifive_0, DT_SIFIVE_UART_0_LABEL,
|
||||
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
|
||||
static void uart_sifive_irq_cfg_func_0(void)
|
||||
{
|
||||
IRQ_CONNECT(DT_SIFIVE_UART_0_IRQ_0,
|
||||
IRQ_CONNECT(RISCV_MAX_GENERIC_IRQ + DT_SIFIVE_UART_0_IRQ_0,
|
||||
CONFIG_UART_SIFIVE_PORT_0_IRQ_PRIORITY,
|
||||
uart_sifive_irq_handler, DEVICE_GET(uart_sifive_0),
|
||||
0);
|
||||
|
||||
irq_enable(DT_SIFIVE_UART_0_IRQ_0);
|
||||
irq_enable(RISCV_MAX_GENERIC_IRQ + DT_SIFIVE_UART_0_IRQ_0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -438,12 +438,12 @@ DEVICE_AND_API_INIT(uart_sifive_1, DT_SIFIVE_UART_1_LABEL,
|
||||
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
|
||||
static void uart_sifive_irq_cfg_func_1(void)
|
||||
{
|
||||
IRQ_CONNECT(DT_SIFIVE_UART_1_IRQ_0,
|
||||
IRQ_CONNECT(RISCV_MAX_GENERIC_IRQ + DT_SIFIVE_UART_1_IRQ_0,
|
||||
CONFIG_UART_SIFIVE_PORT_1_IRQ_PRIORITY,
|
||||
uart_sifive_irq_handler, DEVICE_GET(uart_sifive_1),
|
||||
0);
|
||||
|
||||
irq_enable(DT_SIFIVE_UART_1_IRQ_0);
|
||||
irq_enable(RISCV_MAX_GENERIC_IRQ + DT_SIFIVE_UART_1_IRQ_0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ void spi_context_buffers_setup(struct spi_context *ctx,
|
||||
if (tx_bufs) {
|
||||
ctx->current_tx = tx_bufs->buffers;
|
||||
ctx->tx_count = tx_bufs->count;
|
||||
ctx->tx_buf = ctx->current_tx->buf;
|
||||
ctx->tx_buf = (const u8_t *)ctx->current_tx->buf;
|
||||
ctx->tx_len = ctx->current_tx->len / dfs;
|
||||
} else {
|
||||
ctx->current_tx = NULL;
|
||||
@@ -239,7 +239,7 @@ void spi_context_buffers_setup(struct spi_context *ctx,
|
||||
if (rx_bufs) {
|
||||
ctx->current_rx = rx_bufs->buffers;
|
||||
ctx->rx_count = rx_bufs->count;
|
||||
ctx->rx_buf = ctx->current_rx->buf;
|
||||
ctx->rx_buf = (u8_t *)ctx->current_rx->buf;
|
||||
ctx->rx_len = ctx->current_rx->len / dfs;
|
||||
} else {
|
||||
ctx->current_rx = NULL;
|
||||
@@ -278,7 +278,7 @@ void spi_context_update_tx(struct spi_context *ctx, u8_t dfs, u32_t len)
|
||||
ctx->tx_count--;
|
||||
if (ctx->tx_count) {
|
||||
ctx->current_tx++;
|
||||
ctx->tx_buf = ctx->current_tx->buf;
|
||||
ctx->tx_buf = (const u8_t *)ctx->current_tx->buf;
|
||||
ctx->tx_len = ctx->current_tx->len / dfs;
|
||||
} else {
|
||||
ctx->tx_buf = NULL;
|
||||
@@ -326,7 +326,7 @@ void spi_context_update_rx(struct spi_context *ctx, u8_t dfs, u32_t len)
|
||||
ctx->rx_count--;
|
||||
if (ctx->rx_count) {
|
||||
ctx->current_rx++;
|
||||
ctx->rx_buf = ctx->current_rx->buf;
|
||||
ctx->rx_buf = (u8_t *)ctx->current_rx->buf;
|
||||
ctx->rx_len = ctx->current_rx->len / dfs;
|
||||
} else {
|
||||
ctx->rx_buf = NULL;
|
||||
|
||||
@@ -362,6 +362,11 @@ int usb_dc_ep_set_stall(const u8_t ep)
|
||||
u8_t ep_num = ep & ~USB_EP_DIR_MASK;
|
||||
UsbDeviceEndpoint *endpoint = ®s->DeviceEndpoint[ep_num];
|
||||
|
||||
if (ep_num >= USB_NUM_ENDPOINTS) {
|
||||
LOG_ERR("endpoint index/address out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (for_in) {
|
||||
endpoint->EPSTATUSSET.bit.STALLRQ1 = 1;
|
||||
} else {
|
||||
@@ -378,6 +383,11 @@ int usb_dc_ep_clear_stall(const u8_t ep)
|
||||
u8_t ep_num = ep & ~USB_EP_DIR_MASK;
|
||||
UsbDeviceEndpoint *endpoint = ®s->DeviceEndpoint[ep_num];
|
||||
|
||||
if (ep_num >= USB_NUM_ENDPOINTS) {
|
||||
LOG_ERR("endpoint index/address out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (for_in) {
|
||||
endpoint->EPSTATUSCLR.bit.STALLRQ1 = 1;
|
||||
} else {
|
||||
@@ -394,6 +404,16 @@ int usb_dc_ep_is_stalled(const u8_t ep, u8_t *stalled)
|
||||
u8_t ep_num = ep & ~USB_EP_DIR_MASK;
|
||||
UsbDeviceEndpoint *endpoint = ®s->DeviceEndpoint[ep_num];
|
||||
|
||||
if (ep_num >= USB_NUM_ENDPOINTS) {
|
||||
LOG_ERR("endpoint index/address out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (stalled == NULL) {
|
||||
LOG_ERR("parameter must not be NULL");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (for_in) {
|
||||
*stalled = endpoint->EPSTATUS.bit.STALLRQ1;
|
||||
} else {
|
||||
@@ -403,6 +423,28 @@ int usb_dc_ep_is_stalled(const u8_t ep, u8_t *stalled)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Halt the selected endpoint */
|
||||
int usb_dc_ep_halt(u8_t ep)
|
||||
{
|
||||
return usb_dc_ep_set_stall(ep);
|
||||
}
|
||||
|
||||
/* Flush the selected endpoint */
|
||||
int usb_dc_ep_flush(u8_t ep)
|
||||
{
|
||||
u8_t ep_num = ep & ~USB_EP_DIR_MASK;
|
||||
|
||||
if (ep_num >= USB_NUM_ENDPOINTS) {
|
||||
LOG_ERR("endpoint index/address out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* TODO */
|
||||
LOG_WRN("flush not implemented");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Enable an endpoint and the endpoint interrupts */
|
||||
int usb_dc_ep_enable(const u8_t ep)
|
||||
{
|
||||
@@ -411,6 +453,11 @@ int usb_dc_ep_enable(const u8_t ep)
|
||||
u8_t ep_num = ep & ~USB_EP_DIR_MASK;
|
||||
UsbDeviceEndpoint *endpoint = ®s->DeviceEndpoint[ep_num];
|
||||
|
||||
if (ep_num >= USB_NUM_ENDPOINTS) {
|
||||
LOG_ERR("endpoint index/address out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (for_in) {
|
||||
endpoint->EPSTATUSCLR.bit.BK1RDY = 1;
|
||||
} else {
|
||||
@@ -424,6 +471,25 @@ int usb_dc_ep_enable(const u8_t ep)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Disable the selected endpoint */
|
||||
int usb_dc_ep_disable(u8_t ep)
|
||||
{
|
||||
UsbDevice *regs = ®S->DEVICE;
|
||||
u8_t ep_num = ep & ~USB_EP_DIR_MASK;
|
||||
UsbDeviceEndpoint *endpoint = ®s->DeviceEndpoint[ep_num];
|
||||
|
||||
if (ep_num >= USB_NUM_ENDPOINTS) {
|
||||
LOG_ERR("endpoint index/address out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
endpoint->EPINTENCLR.reg = USB_DEVICE_EPINTENCLR_TRCPT0
|
||||
| USB_DEVICE_EPINTENCLR_TRCPT1
|
||||
| USB_DEVICE_EPINTENCLR_RXSTP;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Write a single payload to the IN buffer on the endpoint */
|
||||
int usb_dc_ep_write(u8_t ep, const u8_t *buf, u32_t len, u32_t *ret_bytes)
|
||||
{
|
||||
@@ -434,6 +500,11 @@ int usb_dc_ep_write(u8_t ep, const u8_t *buf, u32_t len, u32_t *ret_bytes)
|
||||
UsbDeviceDescriptor *desc = &data->descriptors[ep_num];
|
||||
u32_t addr = desc->DeviceDescBank[1].ADDR.reg;
|
||||
|
||||
if (ep_num >= USB_NUM_ENDPOINTS) {
|
||||
LOG_ERR("endpoint index/address out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (endpoint->EPSTATUS.bit.BK1RDY) {
|
||||
/* Write in progress, drop */
|
||||
return -EAGAIN;
|
||||
@@ -469,6 +540,11 @@ int usb_dc_ep_read_ex(u8_t ep, u8_t *buf, u32_t max_data_len,
|
||||
u32_t take;
|
||||
int remain;
|
||||
|
||||
if (ep_num >= USB_NUM_ENDPOINTS) {
|
||||
LOG_ERR("endpoint index/address out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!endpoint->EPSTATUS.bit.BK0RDY) {
|
||||
return -EAGAIN;
|
||||
}
|
||||
@@ -527,6 +603,11 @@ int usb_dc_ep_read_continue(u8_t ep)
|
||||
u8_t ep_num = ep & ~USB_EP_DIR_MASK;
|
||||
UsbDeviceEndpoint *endpoint = ®s->DeviceEndpoint[ep_num];
|
||||
|
||||
if (ep_num >= USB_NUM_ENDPOINTS) {
|
||||
LOG_ERR("endpoint index/address out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
endpoint->EPSTATUSCLR.bit.BK0RDY = 1;
|
||||
data->out_at = 0U;
|
||||
|
||||
@@ -539,6 +620,11 @@ int usb_dc_ep_set_callback(const u8_t ep, const usb_dc_ep_callback cb)
|
||||
u8_t for_in = ep & USB_EP_DIR_MASK;
|
||||
u8_t ep_num = ep & ~USB_EP_DIR_MASK;
|
||||
|
||||
if (ep_num >= USB_NUM_ENDPOINTS) {
|
||||
LOG_ERR("endpoint index/address out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
data->ep_cb[for_in ? 1 : 0][ep_num] = cb;
|
||||
|
||||
return 0;
|
||||
@@ -547,14 +633,33 @@ int usb_dc_ep_set_callback(const u8_t ep, const usb_dc_ep_callback cb)
|
||||
int usb_dc_ep_mps(const u8_t ep)
|
||||
{
|
||||
struct usb_sam0_data *data = usb_sam0_get_data();
|
||||
UsbDevice *regs = ®S->DEVICE;
|
||||
u8_t for_in = ep & USB_EP_DIR_MASK;
|
||||
u8_t ep_num = ep & ~USB_EP_DIR_MASK;
|
||||
UsbDeviceDescriptor *desc = &data->descriptors[ep_num];
|
||||
UsbDeviceEndpoint *endpoint = ®s->DeviceEndpoint[ep];
|
||||
int size;
|
||||
|
||||
if (ep_num >= USB_NUM_ENDPOINTS) {
|
||||
LOG_ERR("endpoint index/address out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (for_in) {
|
||||
|
||||
/* if endpoint is not configured, this should return 0 */
|
||||
if (endpoint->EPCFG.bit.EPTYPE1 == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
size = desc->DeviceDescBank[1].PCKSIZE.bit.SIZE;
|
||||
} else {
|
||||
|
||||
/* if endpoint is not configured, this should return 0 */
|
||||
if (endpoint->EPCFG.bit.EPTYPE0 == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
size = desc->DeviceDescBank[0].PCKSIZE.bit.SIZE;
|
||||
}
|
||||
|
||||
|
||||
@@ -427,7 +427,7 @@ int usb_dc_attach(void)
|
||||
* For STM32F0 series SoCs on QFN28 and TSSOP20 packages enable PIN
|
||||
* pair PA11/12 mapped instead of PA9/10 (e.g. stm32f070x6)
|
||||
*/
|
||||
#if defined(CONFIG_SOC_SERIES_STM32F0X) && defined(SYSCFG_CFGR1_PA11_PA12_RMP)
|
||||
#if defined(DT_USB_ENABLE_PIN_REMAP)
|
||||
if (LL_APB1_GRP2_IsEnabledClock(LL_APB1_GRP2_PERIPH_SYSCFG)) {
|
||||
LL_SYSCFG_EnablePinRemap();
|
||||
} else {
|
||||
@@ -880,12 +880,21 @@ int usb_dc_reset(void)
|
||||
|
||||
void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd)
|
||||
{
|
||||
int i;
|
||||
|
||||
LOG_DBG("");
|
||||
|
||||
HAL_PCD_EP_Open(&usb_dc_stm32_state.pcd, EP0_IN, EP0_MPS, EP_TYPE_CTRL);
|
||||
HAL_PCD_EP_Open(&usb_dc_stm32_state.pcd, EP0_OUT, EP0_MPS,
|
||||
EP_TYPE_CTRL);
|
||||
|
||||
/* The DataInCallback will never be called at this point for any pending
|
||||
* transactions. Reset the IN semaphores to prevent perpetual locked state.
|
||||
* */
|
||||
for (i = 0; i < DT_USB_NUM_BIDIR_ENDPOINTS; i++) {
|
||||
k_sem_give(&usb_dc_stm32_state.in_ep_state[i].write_sem);
|
||||
}
|
||||
|
||||
if (usb_dc_stm32_state.status_cb) {
|
||||
usb_dc_stm32_state.status_cb(USB_DC_RESET, NULL);
|
||||
}
|
||||
|
||||
@@ -117,6 +117,11 @@ static int wdt_sam0_install_timeout(struct device *dev,
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
if (cfg->window.max == 0) {
|
||||
LOG_ERR("Upper limit timeout out of range");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
per = wdt_sam0_timeout_to_wdt_period(cfg->window.max);
|
||||
if (per > WDT_CONFIG_PER_16K_Val) {
|
||||
LOG_ERR("Upper limit timeout out of range");
|
||||
|
||||
@@ -245,7 +245,7 @@
|
||||
compatible = "snps,designware-spi";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <0x80010100 0x100>;
|
||||
reg = <0x80010200 0x100>;
|
||||
interrupts = <78 2>, <79 2>, <80 2>;
|
||||
interrupt-names = "err-int", "rx-avail", "tx-req";
|
||||
interrupt-parent = <&intc>;
|
||||
|
||||
@@ -65,7 +65,6 @@
|
||||
sercom0: sercom@42000800 {
|
||||
compatible = "atmel,sam0-sercom";
|
||||
reg = <0x42000800 0x40>;
|
||||
interrupts = <9 0>;
|
||||
status = "disabled";
|
||||
label = "SERCOM0";
|
||||
};
|
||||
@@ -73,7 +72,6 @@
|
||||
sercom1: sercom@42000c00 {
|
||||
compatible = "atmel,sam0-sercom";
|
||||
reg = <0x42000c00 0x40>;
|
||||
interrupts = <10 0>;
|
||||
status = "disabled";
|
||||
label = "SERCOM1";
|
||||
};
|
||||
@@ -81,7 +79,6 @@
|
||||
sercom2: sercom@42001000 {
|
||||
compatible = "atmel,sam0-sercom";
|
||||
reg = <0x42001000 0x40>;
|
||||
interrupts = <11 0>;
|
||||
status = "disabled";
|
||||
label = "SERCOM2";
|
||||
};
|
||||
@@ -89,7 +86,6 @@
|
||||
sercom3: sercom@42001400 {
|
||||
compatible = "atmel,sam0-sercom";
|
||||
reg = <0x42001400 0x40>;
|
||||
interrupts = <12 0>;
|
||||
status = "disabled";
|
||||
label = "SERCOM3";
|
||||
};
|
||||
@@ -97,7 +93,6 @@
|
||||
sercom4: sercom@42001800 {
|
||||
compatible = "atmel,sam0-sercom";
|
||||
reg = <0x42001800 0x40>;
|
||||
interrupts = <13 0>;
|
||||
status = "disabled";
|
||||
label = "SERCOM4";
|
||||
};
|
||||
@@ -105,7 +100,6 @@
|
||||
sercom5: sercom@42001c00 {
|
||||
compatible = "atmel,sam0-sercom";
|
||||
reg = <0x42001c00 0x40>;
|
||||
interrupts = <14 0>;
|
||||
status = "disabled";
|
||||
label = "SERCOM5";
|
||||
};
|
||||
@@ -126,15 +120,6 @@
|
||||
#gpio-cells = <2>;
|
||||
};
|
||||
|
||||
usb0: usb@41005000 {
|
||||
compatible = "atmel,sam0-usb";
|
||||
status = "disabled";
|
||||
reg = <0x41005000 0x1000>;
|
||||
interrupts = <7 0>;
|
||||
num-bidir-endpoints = <8>;
|
||||
label = "USB0";
|
||||
};
|
||||
|
||||
rtc: rtc@40001400 {
|
||||
compatible = "atmel,sam0-rtc";
|
||||
reg = <0x40001400 0x1C>;
|
||||
|
||||
@@ -5,3 +5,27 @@
|
||||
*/
|
||||
|
||||
#include <atmel/samd.dtsi>
|
||||
|
||||
&sercom0 {
|
||||
interrupts = <7 0>;
|
||||
};
|
||||
|
||||
&sercom1 {
|
||||
interrupts = <8 0>;
|
||||
};
|
||||
|
||||
&sercom2 {
|
||||
interrupts = <9 0>;
|
||||
};
|
||||
|
||||
&sercom3 {
|
||||
interrupts = <10 0>;
|
||||
};
|
||||
|
||||
&sercom4 {
|
||||
interrupts = <11 0>;
|
||||
};
|
||||
|
||||
&sercom5 {
|
||||
interrupts = <12 0>;
|
||||
};
|
||||
|
||||
@@ -5,3 +5,40 @@
|
||||
*/
|
||||
|
||||
#include <atmel/samd.dtsi>
|
||||
|
||||
/ {
|
||||
soc {
|
||||
usb0: usb@41005000 {
|
||||
compatible = "atmel,sam0-usb";
|
||||
status = "disabled";
|
||||
reg = <0x41005000 0x1000>;
|
||||
interrupts = <7 0>;
|
||||
num-bidir-endpoints = <8>;
|
||||
label = "USB0";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&sercom0 {
|
||||
interrupts = <9 0>;
|
||||
};
|
||||
|
||||
&sercom1 {
|
||||
interrupts = <10 0>;
|
||||
};
|
||||
|
||||
&sercom2 {
|
||||
interrupts = <11 0>;
|
||||
};
|
||||
|
||||
&sercom3 {
|
||||
interrupts = <12 0>;
|
||||
};
|
||||
|
||||
&sercom4 {
|
||||
interrupts = <13 0>;
|
||||
};
|
||||
|
||||
&sercom5 {
|
||||
interrupts = <14 0>;
|
||||
};
|
||||
|
||||
24
dts/arm/nxp/nxp_rt1020.dtsi
Normal file
24
dts/arm/nxp/nxp_rt1020.dtsi
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Linaro
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <nxp/nxp_rt.dtsi>
|
||||
|
||||
/* i.MX rt1020 default FlexRAM partition:
|
||||
* ITCM: 64KB
|
||||
* DTCM: 64KB
|
||||
* OCRAM: 128KB
|
||||
*/
|
||||
&itcm0 {
|
||||
reg = <0x00000000 0x10000>;
|
||||
};
|
||||
|
||||
&dtcm0 {
|
||||
reg = <0x20000000 0x10000>;
|
||||
};
|
||||
|
||||
&ocram0 {
|
||||
reg = <0x20200000 0x20000>;
|
||||
};
|
||||
@@ -31,6 +31,12 @@ properties:
|
||||
description: Human readable string describing the device (used by Zephyr for API name)
|
||||
generation: define
|
||||
|
||||
clocks:
|
||||
type: array
|
||||
category: optional
|
||||
description: Clock gate control information
|
||||
generation: define
|
||||
|
||||
"#cells":
|
||||
- pin
|
||||
- flags
|
||||
|
||||
@@ -53,4 +53,11 @@ properties:
|
||||
category: optional
|
||||
generation: define
|
||||
description: PHY provider specifier
|
||||
|
||||
enable-pin-remap:
|
||||
type: boolean
|
||||
category: optional
|
||||
description: For STM32F0 series SoCs on QFN28 and TSSOP20 packages
|
||||
enable PIN pair PA11/12 mapped instead of PA9/10 (e.g. stm32f070x6)
|
||||
generation: define, use-prop-name
|
||||
...
|
||||
|
||||
@@ -171,6 +171,7 @@
|
||||
interrupts = <4>;
|
||||
reg = <0x10023000 0x1000>;
|
||||
reg-names = "control";
|
||||
label = "uart_1";
|
||||
status = "disabled";
|
||||
};
|
||||
spi0: spi@10014000 {
|
||||
|
||||
@@ -146,7 +146,7 @@ static uint32_t CSI_TransferGetQueueDelta(uint32_t startIdx, uint32_t endIdx)
|
||||
}
|
||||
else
|
||||
{
|
||||
return startIdx + CSI_DRIVER_ACTUAL_QUEUE_SIZE - endIdx;
|
||||
return endIdx + CSI_DRIVER_ACTUAL_QUEUE_SIZE - startIdx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#endif
|
||||
#else
|
||||
#define MPU_MIN_SIZE_ALIGN
|
||||
#define MPU_ALIGN(region_size) . = ALIGN(4)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_XIP)
|
||||
@@ -128,7 +129,7 @@ SECTIONS {
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
||||
_image_rodata_end = .;
|
||||
MPU_MIN_SIZE_ALIGN
|
||||
MPU_ALIGN(_image_rodata_end - _image_rom_start);
|
||||
_image_rom_end = .;
|
||||
_image_rom_size = _image_rom_end - _image_rom_start;
|
||||
|
||||
|
||||
@@ -40,7 +40,12 @@
|
||||
#define SKIP_TO_KINETIS_FLASH_CONFIG
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_XIP) && (CONFIG_FLASH_SIZE == 0)
|
||||
#define ROM_ADDR RAM_ADDR
|
||||
#else
|
||||
#define ROM_ADDR (CONFIG_FLASH_BASE_ADDRESS + CONFIG_FLASH_LOAD_OFFSET)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TI_CCFG_PRESENT
|
||||
#define CCFG_SIZE 88
|
||||
#define ROM_SIZE (CONFIG_FLASH_SIZE*1K - CONFIG_FLASH_LOAD_OFFSET - \
|
||||
@@ -277,6 +282,7 @@ SECTIONS
|
||||
#endif /* CONFIG_ARM_FIRMWARE_HAS_SECURE_ENTRY_FUNCS */
|
||||
|
||||
_image_rodata_end = .;
|
||||
MPU_ALIGN(_image_rodata_end -_image_rom_start);
|
||||
_image_rom_end = .;
|
||||
|
||||
GROUP_END(ROMABLE_REGION)
|
||||
@@ -409,6 +415,10 @@ SECTIONS
|
||||
*(COMMON)
|
||||
*(".kernel_bss.*")
|
||||
|
||||
#ifdef CONFIG_CODE_DATA_RELOCATION
|
||||
#include <linker_sram_bss_relocate.ld>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* As memory is cleared in words only, it is simpler to ensure the BSS
|
||||
* section ends on a 4 byte boundary. This wastes a maximum of 3 bytes.
|
||||
@@ -446,6 +456,10 @@ SECTIONS
|
||||
#ifdef CONFIG_CUSTOM_RWDATA_LD
|
||||
/* Located in project source directory */
|
||||
#include <custom-rwdata.ld>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CODE_DATA_RELOCATION
|
||||
#include <linker_sram_data_relocate.ld>
|
||||
#endif
|
||||
|
||||
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
|
||||
|
||||
@@ -64,6 +64,19 @@ struct net_buf *bt_buf_get_rx(enum bt_buf_type type, s32_t timeout);
|
||||
*/
|
||||
struct net_buf *bt_buf_get_cmd_complete(s32_t timeout);
|
||||
|
||||
/** Allocate a buffer for an HCI Event
|
||||
*
|
||||
* This will set the buffer type so bt_buf_set_type() does not need to
|
||||
* be explicitly called before bt_recv_prio() or bt_recv().
|
||||
*
|
||||
* @param evt HCI event code
|
||||
* @param discardable Whether the driver considers the event discardable.
|
||||
* @param timeout Timeout in milliseconds, or one of the special values
|
||||
* K_NO_WAIT and K_FOREVER.
|
||||
* @return A new buffer.
|
||||
*/
|
||||
struct net_buf *bt_buf_get_evt(u8_t evt, bool discardable, s32_t timeout);
|
||||
|
||||
/** Set the buffer type
|
||||
*
|
||||
* @param buf Bluetooth buffer
|
||||
|
||||
@@ -971,9 +971,14 @@ typedef u8_t (*bt_gatt_read_func_t)(struct bt_conn *conn, u8_t err,
|
||||
* @param handle_count If equals to 1 single.handle and single.offset
|
||||
* are used. If >1 Read Multiple Characteristic
|
||||
* Values is performed and handles are used.
|
||||
* If equals to 0 by_uuid is used for Read Using
|
||||
* Characteristic UUID.
|
||||
* @param handle Attribute handle
|
||||
* @param offset Attribute data offset
|
||||
* @param handles Handles to read in Read Multiple Characteristic Values
|
||||
* @param start_handle First requested handle number
|
||||
* @param end_handle Last requested handle number
|
||||
* @param uuid 2 or 16 octet UUID
|
||||
*/
|
||||
struct bt_gatt_read_params {
|
||||
struct bt_att_req _req;
|
||||
@@ -985,6 +990,11 @@ struct bt_gatt_read_params {
|
||||
u16_t offset;
|
||||
} single;
|
||||
u16_t *handles;
|
||||
struct {
|
||||
u16_t start_handle;
|
||||
u16_t end_handle;
|
||||
struct bt_uuid *uuid;
|
||||
} by_uuid;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -992,6 +1002,14 @@ struct bt_gatt_read_params {
|
||||
*
|
||||
* This procedure read the attribute value and return it to the callback.
|
||||
*
|
||||
* When reading attributes by UUID the callback can be called multiple times
|
||||
* depending on how many instances of given the UUID exists with the
|
||||
* start_handle being updated for each instance.
|
||||
*
|
||||
* If an instance does contain a long value which cannot be read entirely the
|
||||
* caller will need to read the remaining data separately using the handle and
|
||||
* offset.
|
||||
*
|
||||
* Note: This procedure is asynchronous therefore the parameters need to
|
||||
* remains valid while it is active.
|
||||
*
|
||||
|
||||
@@ -1355,6 +1355,7 @@ struct bt_hci_cp_le_set_privacy_mode {
|
||||
|
||||
/* Event definitions */
|
||||
|
||||
#define BT_HCI_EVT_UNKNOWN 0x00
|
||||
#define BT_HCI_EVT_VENDOR 0xff
|
||||
|
||||
#define BT_HCI_EVT_INQUIRY_COMPLETE 0x01
|
||||
|
||||
@@ -269,7 +269,8 @@ static inline int z_impl_can_send(struct device *dev,
|
||||
const struct zcan_frame *msg,
|
||||
s32_t timeout, can_tx_callback_t callback_isr)
|
||||
{
|
||||
const struct can_driver_api *api = dev->driver_api;
|
||||
const struct can_driver_api *api =
|
||||
(const struct can_driver_api *)dev->driver_api;
|
||||
|
||||
return api->send(dev, msg, timeout, callback_isr);
|
||||
}
|
||||
@@ -344,7 +345,8 @@ static inline int z_impl_can_attach_msgq(struct device *dev,
|
||||
struct k_msgq *msg_q,
|
||||
const struct zcan_filter *filter)
|
||||
{
|
||||
const struct can_driver_api *api = dev->driver_api;
|
||||
const struct can_driver_api *api =
|
||||
(const struct can_driver_api *)dev->driver_api;
|
||||
|
||||
return api->attach_msgq(dev, msg_q, filter);
|
||||
}
|
||||
@@ -371,7 +373,8 @@ static inline int can_attach_isr(struct device *dev,
|
||||
can_rx_callback_t isr,
|
||||
const struct zcan_filter *filter)
|
||||
{
|
||||
const struct can_driver_api *api = dev->driver_api;
|
||||
const struct can_driver_api *api =
|
||||
(const struct can_driver_api *)dev->driver_api;
|
||||
|
||||
return api->attach_isr(dev, isr, filter);
|
||||
}
|
||||
@@ -391,7 +394,8 @@ __syscall void can_detach(struct device *dev, int filter_id);
|
||||
|
||||
static inline void z_impl_can_detach(struct device *dev, int filter_id)
|
||||
{
|
||||
const struct can_driver_api *api = dev->driver_api;
|
||||
const struct can_driver_api *api =
|
||||
(const struct can_driver_api *)dev->driver_api;
|
||||
|
||||
return api->detach(dev, filter_id);
|
||||
}
|
||||
@@ -412,7 +416,8 @@ __syscall int can_configure(struct device *dev, enum can_mode mode,
|
||||
static inline int z_impl_can_configure(struct device *dev, enum can_mode mode,
|
||||
u32_t bitrate)
|
||||
{
|
||||
const struct can_driver_api *api = dev->driver_api;
|
||||
const struct can_driver_api *api =
|
||||
(const struct can_driver_api *)dev->driver_api;
|
||||
|
||||
return api->configure(dev, mode, bitrate);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,8 @@ struct clock_control_driver_api {
|
||||
static inline int clock_control_on(struct device *dev,
|
||||
clock_control_subsys_t sys)
|
||||
{
|
||||
const struct clock_control_driver_api *api = dev->driver_api;
|
||||
const struct clock_control_driver_api *api =
|
||||
(const struct clock_control_driver_api *)dev->driver_api;
|
||||
|
||||
return api->on(dev, sys);
|
||||
}
|
||||
@@ -65,7 +66,8 @@ static inline int clock_control_on(struct device *dev,
|
||||
static inline int clock_control_off(struct device *dev,
|
||||
clock_control_subsys_t sys)
|
||||
{
|
||||
const struct clock_control_driver_api *api = dev->driver_api;
|
||||
const struct clock_control_driver_api *api =
|
||||
(const struct clock_control_driver_api *)dev->driver_api;
|
||||
|
||||
return api->off(dev, sys);
|
||||
}
|
||||
@@ -81,7 +83,8 @@ static inline int clock_control_get_rate(struct device *dev,
|
||||
clock_control_subsys_t sys,
|
||||
u32_t *rate)
|
||||
{
|
||||
const struct clock_control_driver_api *api = dev->driver_api;
|
||||
const struct clock_control_driver_api *api =
|
||||
(const struct clock_control_driver_api *)dev->driver_api;
|
||||
|
||||
__ASSERT(api->get_rate != NULL, "%s not implemented for device %s",
|
||||
__func__, dev->config->name);
|
||||
|
||||
@@ -10,15 +10,16 @@
|
||||
#if defined(CONFIG_USB) && defined(CONFIG_SOC_NRF52840)
|
||||
#include <device.h>
|
||||
#endif
|
||||
#include <nrf_clock.h>
|
||||
|
||||
/* TODO: move all these to clock_control.h ? */
|
||||
|
||||
/* Define 32KHz clock source */
|
||||
#ifdef CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC
|
||||
#define CLOCK_CONTROL_NRF_K32SRC 0
|
||||
#define CLOCK_CONTROL_NRF_K32SRC NRF_CLOCK_LFCLK_RC
|
||||
#endif
|
||||
#ifdef CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL
|
||||
#define CLOCK_CONTROL_NRF_K32SRC 1
|
||||
#define CLOCK_CONTROL_NRF_K32SRC NRF_CLOCK_LFCLK_Xtal
|
||||
#endif
|
||||
|
||||
/* Define 32KHz clock accuracy */
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <zephyr/types.h>
|
||||
#include <device.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <zephyr/types.h>
|
||||
#include <device.h>
|
||||
|
||||
/**
|
||||
* @typedef entropy_get_entropy_t
|
||||
* @brief Callback API to get entropy.
|
||||
@@ -69,7 +69,8 @@ static inline int z_impl_entropy_get_entropy(struct device *dev,
|
||||
u8_t *buffer,
|
||||
u16_t length)
|
||||
{
|
||||
const struct entropy_driver_api *api = dev->driver_api;
|
||||
const struct entropy_driver_api *api =
|
||||
(const struct entropy_driver_api *)dev->driver_api;
|
||||
|
||||
__ASSERT(api->get_entropy != NULL,
|
||||
"Callback pointer should not be NULL");
|
||||
@@ -94,7 +95,8 @@ static inline int entropy_get_entropy_isr(struct device *dev,
|
||||
u16_t length,
|
||||
u32_t flags)
|
||||
{
|
||||
const struct entropy_driver_api *api = dev->driver_api;
|
||||
const struct entropy_driver_api *api =
|
||||
(const struct entropy_driver_api *)dev->driver_api;
|
||||
|
||||
if (unlikely(!api->get_entropy_isr)) {
|
||||
return -ENOTSUP;
|
||||
|
||||
@@ -207,7 +207,7 @@ struct _k_object_assignment {
|
||||
*/
|
||||
void z_object_init(void *obj);
|
||||
#else
|
||||
|
||||
/* LCOV_EXCL_START */
|
||||
#define K_THREAD_ACCESS_GRANT(thread, ...)
|
||||
|
||||
/**
|
||||
@@ -250,6 +250,7 @@ static inline void k_object_access_all_grant(void *object)
|
||||
{
|
||||
ARG_UNUSED(object);
|
||||
}
|
||||
/* LCOV_EXCL_STOP */
|
||||
#endif /* !CONFIG_USERSPACE */
|
||||
|
||||
/**
|
||||
@@ -326,6 +327,7 @@ __syscall void *k_object_alloc(enum k_objects otype);
|
||||
*/
|
||||
void k_object_free(void *obj);
|
||||
#else
|
||||
/* LCOV_EXCL_START */
|
||||
static inline void *z_impl_k_object_alloc(enum k_objects otype)
|
||||
{
|
||||
ARG_UNUSED(otype);
|
||||
@@ -337,6 +339,7 @@ static inline void k_obj_free(void *obj)
|
||||
{
|
||||
ARG_UNUSED(obj);
|
||||
}
|
||||
/* LCOV_EXCL_STOP */
|
||||
#endif /* CONFIG_DYNAMIC_OBJECTS */
|
||||
|
||||
/** @} */
|
||||
@@ -537,7 +540,7 @@ struct k_thread {
|
||||
|
||||
#if defined(CONFIG_THREAD_NAME)
|
||||
/* Thread name */
|
||||
const char *name;
|
||||
char name[CONFIG_THREAD_MAX_NAME_LEN];
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_THREAD_CUSTOM_DATA
|
||||
@@ -1260,8 +1263,14 @@ __syscall void *k_thread_custom_data_get(void);
|
||||
* Set the name of the thread to be used when THREAD_MONITOR is enabled for
|
||||
* tracing and debugging.
|
||||
*
|
||||
* @param thread_id Thread to set name, or NULL to set the current thread
|
||||
* @param value Name string
|
||||
* @retval 0 on success
|
||||
* @retval -EFAULT Memory access error with supplied string
|
||||
* @retval -ENOSYS Thread name configuration option not enabled
|
||||
* @retval -EINVAL Thread name too long
|
||||
*/
|
||||
__syscall void k_thread_name_set(k_tid_t thread_id, const char *value);
|
||||
__syscall int k_thread_name_set(k_tid_t thread_id, const char *value);
|
||||
|
||||
/**
|
||||
* @brief Get thread name
|
||||
@@ -1269,9 +1278,23 @@ __syscall void k_thread_name_set(k_tid_t thread_id, const char *value);
|
||||
* Get the name of a thread
|
||||
*
|
||||
* @param thread_id Thread ID
|
||||
*
|
||||
* @retval Thread name, or NULL if configuration not enabled
|
||||
*/
|
||||
__syscall const char *k_thread_name_get(k_tid_t thread_id);
|
||||
const char *k_thread_name_get(k_tid_t thread_id);
|
||||
|
||||
/**
|
||||
* @brief Copy the thread name into a supplied buffer
|
||||
*
|
||||
* @param thread_id Thread to obtain name information
|
||||
* @param buf Destination buffer
|
||||
* @param size Destinatiomn buffer size
|
||||
* @retval -ENOSPC Destination buffer too small
|
||||
* @retval -EFAULT Memory access error
|
||||
* @retval -ENOSYS Thread name feature not enabled
|
||||
* @retval 0 Success
|
||||
*/
|
||||
__syscall int k_thread_name_copy(k_tid_t thread_id, char *buf,
|
||||
size_t size);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -276,6 +276,10 @@ int log_printk(const char *fmt, va_list ap);
|
||||
*/
|
||||
char *log_strdup(const char *str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#define LOG_IN_CPLUSPLUS 1
|
||||
#endif
|
||||
/* Macro expects that optionally on second argument local log level is provided.
|
||||
* If provided it is returned, otherwise default log level is returned or
|
||||
* LOG_LEVEL, if it was locally defined.
|
||||
@@ -292,8 +296,8 @@ char *log_strdup(const char *str);
|
||||
/* Return first argument */
|
||||
#define _LOG_ARG1(arg1, ...) arg1
|
||||
|
||||
|
||||
#define _LOG_MODULE_CONST_DATA_CREATE(_name, _level) \
|
||||
COND_CODE_1(LOG_IN_CPLUSPLUS, (extern), ()) \
|
||||
const struct log_source_const_data LOG_ITEM_CONST_DATA(_name) \
|
||||
__attribute__ ((section("." STRINGIFY(LOG_ITEM_CONST_DATA(_name))))) \
|
||||
__attribute__((used)) = { \
|
||||
@@ -309,8 +313,8 @@ char *log_strdup(const char *str);
|
||||
__attribute__((used))
|
||||
|
||||
#define _LOG_MODULE_DYNAMIC_DATA_COND_CREATE(_name) \
|
||||
Z_LOG_EVAL( \
|
||||
IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING), \
|
||||
COND_CODE_1( \
|
||||
CONFIG_LOG_RUNTIME_FILTERING, \
|
||||
(_LOG_MODULE_DYNAMIC_DATA_CREATE(_name);), \
|
||||
() \
|
||||
)
|
||||
@@ -351,7 +355,6 @@ char *log_strdup(const char *str);
|
||||
* @see LOG_MODULE_DECLARE
|
||||
*/
|
||||
|
||||
|
||||
#define LOG_MODULE_REGISTER(...) \
|
||||
Z_LOG_EVAL( \
|
||||
_LOG_LEVEL_RESOLVE(__VA_ARGS__), \
|
||||
@@ -422,9 +425,4 @@ char *log_strdup(const char *str);
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_LOGGING_LOG_H_ */
|
||||
|
||||
@@ -159,8 +159,9 @@ struct _rb_foreach {
|
||||
}
|
||||
#else
|
||||
#define _RB_FOREACH_INIT(tree, node) { \
|
||||
.stack = alloca((tree)->max_depth * sizeof(struct rbnode *)), \
|
||||
.is_left = alloca((tree)->max_depth * sizeof(char)), \
|
||||
.stack = (struct rbnode **) \
|
||||
alloca((tree)->max_depth * sizeof(struct rbnode *)), \
|
||||
.is_left = (char *)alloca((tree)->max_depth * sizeof(char)), \
|
||||
.top = -1 \
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -481,10 +481,10 @@ static inline
|
||||
enum ethernet_hw_caps net_eth_get_hw_capabilities(struct net_if *iface)
|
||||
{
|
||||
const struct ethernet_api *eth =
|
||||
net_if_get_device(iface)->driver_api;
|
||||
(struct ethernet_api *)net_if_get_device(iface)->driver_api;
|
||||
|
||||
if (!eth->get_capabilities) {
|
||||
return 0;
|
||||
return (enum ethernet_hw_caps)0;
|
||||
}
|
||||
|
||||
return eth->get_capabilities(net_if_get_device(iface));
|
||||
|
||||
@@ -1285,15 +1285,17 @@ void net_if_ipv6_dad_failed(struct net_if *iface, const struct in6_addr *addr);
|
||||
|
||||
/**
|
||||
* @brief Return global IPv6 address from the first interface that has
|
||||
* a global IPv6 address either in TENTATIVE or PREFERRED state.
|
||||
* a global IPv6 address matching the given state.
|
||||
*
|
||||
* @param state IPv6 address state (ANY, TENTATIVE, PREFERRED, DEPRECATED)
|
||||
* @param iface Caller can give an interface to check. If iface is set to NULL,
|
||||
* then all the interfaces are checked. Pointer to interface where the IPv6
|
||||
* address is defined is returned to the caller.
|
||||
*
|
||||
* @return Pointer to IPv6 address, NULL if not found.
|
||||
*/
|
||||
struct in6_addr *net_if_ipv6_get_global_addr(struct net_if **iface);
|
||||
struct in6_addr *net_if_ipv6_get_global_addr(enum net_addr_state state,
|
||||
struct net_if **iface);
|
||||
|
||||
/**
|
||||
* @brief Allocate network interface IPv4 config.
|
||||
@@ -1493,6 +1495,18 @@ const struct in_addr *net_if_ipv4_select_src_addr(struct net_if *iface,
|
||||
struct in_addr *net_if_ipv4_get_ll(struct net_if *iface,
|
||||
enum net_addr_state addr_state);
|
||||
|
||||
/**
|
||||
* @brief Get a IPv4 global address in a given state.
|
||||
*
|
||||
* @param iface Interface to use. Must be a valid pointer to an interface.
|
||||
* @param addr_state IPv4 address state (preferred, tentative, deprecated)
|
||||
*
|
||||
* @return Pointer to link local IPv4 address, NULL if no proper IPv4 address
|
||||
* could be found.
|
||||
*/
|
||||
struct in_addr *net_if_ipv4_get_global_addr(struct net_if *iface,
|
||||
enum net_addr_state addr_state);
|
||||
|
||||
/**
|
||||
* @brief Set IPv4 netmask for an interface.
|
||||
*
|
||||
|
||||
@@ -140,6 +140,7 @@ struct net_mgmt_event_callback {
|
||||
|
||||
#ifdef CONFIG_NET_MGMT_EVENT_INFO
|
||||
const void *info;
|
||||
size_t info_length;
|
||||
#endif
|
||||
|
||||
/** A mask of network events on which the above handler should be
|
||||
@@ -242,6 +243,8 @@ static inline void net_mgmt_event_notify(u32_t mgmt_event, struct net_if *iface)
|
||||
* the caller wants to listen to.
|
||||
* @param info a valid pointer if user wants to get the information the
|
||||
* event might bring along. NULL otherwise.
|
||||
* @param info_length tells how long the info memory area is. Only valid if
|
||||
* the info is not NULL.
|
||||
* @param timeout a delay in milliseconds. K_FOREVER can be used to wait
|
||||
* indefinitely.
|
||||
*
|
||||
@@ -254,12 +257,14 @@ int net_mgmt_event_wait(u32_t mgmt_event_mask,
|
||||
u32_t *raised_event,
|
||||
struct net_if **iface,
|
||||
const void **info,
|
||||
size_t *info_length,
|
||||
int timeout);
|
||||
#else
|
||||
static inline int net_mgmt_event_wait(u32_t mgmt_event_mask,
|
||||
u32_t *raised_event,
|
||||
struct net_if **iface,
|
||||
const void **info,
|
||||
size_t *info_length,
|
||||
int timeout)
|
||||
{
|
||||
return 0;
|
||||
@@ -277,6 +282,8 @@ static inline int net_mgmt_event_wait(u32_t mgmt_event_mask,
|
||||
* interested in that information.
|
||||
* @param info a valid pointer if user wants to get the information the
|
||||
* event might bring along. NULL otherwise.
|
||||
* @param info_length tells how long the info memory area is. Only valid if
|
||||
* the info is not NULL.
|
||||
* @param timeout a delay in milliseconds. K_FOREVER can be used to wait
|
||||
* indefinitely.
|
||||
*
|
||||
@@ -289,12 +296,14 @@ int net_mgmt_event_wait_on_iface(struct net_if *iface,
|
||||
u32_t mgmt_event_mask,
|
||||
u32_t *raised_event,
|
||||
const void **info,
|
||||
size_t *info_length,
|
||||
int timeout);
|
||||
#else
|
||||
static inline int net_mgmt_event_wait_on_iface(struct net_if *iface,
|
||||
u32_t mgmt_event_mask,
|
||||
u32_t *raised_event,
|
||||
const void **info,
|
||||
size_t *info_length,
|
||||
int timeout)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -60,7 +60,7 @@ static inline int net_promisc_mode_on(struct net_if *iface)
|
||||
{
|
||||
ARG_UNUSED(iface);
|
||||
|
||||
return -ENOSUP;
|
||||
return -ENOTSUP;
|
||||
}
|
||||
#endif /* CONFIG_NET_PROMISCUOUS_MODE */
|
||||
|
||||
@@ -78,7 +78,7 @@ static inline int net_promisc_mode_off(struct net_if *iface)
|
||||
{
|
||||
ARG_UNUSED(iface);
|
||||
|
||||
return -ENOSUP;
|
||||
return -ENOTSUP;
|
||||
}
|
||||
#endif /* CONFIG_NET_PROMISCUOUS_MODE */
|
||||
|
||||
|
||||
@@ -75,21 +75,24 @@ struct pinmux_driver_api {
|
||||
|
||||
static inline int pinmux_pin_set(struct device *dev, u32_t pin, u32_t func)
|
||||
{
|
||||
const struct pinmux_driver_api *api = dev->driver_api;
|
||||
const struct pinmux_driver_api *api =
|
||||
(const struct pinmux_driver_api *)dev->driver_api;
|
||||
|
||||
return api->set(dev, pin, func);
|
||||
}
|
||||
|
||||
static inline int pinmux_pin_get(struct device *dev, u32_t pin, u32_t *func)
|
||||
{
|
||||
const struct pinmux_driver_api *api = dev->driver_api;
|
||||
const struct pinmux_driver_api *api =
|
||||
(const struct pinmux_driver_api *)dev->driver_api;
|
||||
|
||||
return api->get(dev, pin, func);
|
||||
}
|
||||
|
||||
static inline int pinmux_pin_pullup(struct device *dev, u32_t pin, u8_t func)
|
||||
{
|
||||
const struct pinmux_driver_api *api = dev->driver_api;
|
||||
const struct pinmux_driver_api *api =
|
||||
(const struct pinmux_driver_api *)dev->driver_api;
|
||||
|
||||
return api->pullup(dev, pin, func);
|
||||
}
|
||||
@@ -97,7 +100,8 @@ static inline int pinmux_pin_pullup(struct device *dev, u32_t pin, u8_t func)
|
||||
static inline int pinmux_pin_input_enable(struct device *dev, u32_t pin,
|
||||
u8_t func)
|
||||
{
|
||||
const struct pinmux_driver_api *api = dev->driver_api;
|
||||
const struct pinmux_driver_api *api =
|
||||
(const struct pinmux_driver_api *)dev->driver_api;
|
||||
|
||||
return api->input(dev, pin, func);
|
||||
}
|
||||
|
||||
@@ -160,8 +160,7 @@ static inline int pthread_condattr_destroy(pthread_condattr_t *att)
|
||||
* @param name Symbol name of the mutex
|
||||
*/
|
||||
#define PTHREAD_MUTEX_DEFINE(name) \
|
||||
struct pthread_mutex name \
|
||||
__in_section(_k_mutex, static, name) = \
|
||||
struct pthread_mutex name = \
|
||||
{ \
|
||||
.lock_count = 0, \
|
||||
.wait_q = Z_WAIT_Q_INIT(&name.wait_q), \
|
||||
|
||||
@@ -148,7 +148,7 @@ static inline void ring_buf_init(struct ring_buf *buf, u32_t size, void *data)
|
||||
{
|
||||
memset(buf, 0, sizeof(struct ring_buf));
|
||||
buf->size = size;
|
||||
buf->buf.buf32 = data;
|
||||
buf->buf.buf32 = (u32_t *)data;
|
||||
if (is_power_of_two(size)) {
|
||||
buf->mask = size - 1;
|
||||
} else {
|
||||
|
||||
@@ -57,9 +57,6 @@ struct wdt_config {
|
||||
u32_t timeout;
|
||||
void (*interrupt_fn)(struct device *dev);
|
||||
};
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -148,7 +148,7 @@ config SCHED_CPU_MASK
|
||||
config MAIN_STACK_SIZE
|
||||
int "Size of stack for initialization and main thread"
|
||||
default 2048 if COVERAGE_GCOV
|
||||
default 512 if ZTEST
|
||||
default 512 if ZTEST && !RISCV32
|
||||
default 1024
|
||||
help
|
||||
When the initialization is complete, the thread executing it then
|
||||
@@ -361,11 +361,22 @@ config THREAD_NAME
|
||||
bool "Thread name [EXPERIMENTAL]"
|
||||
help
|
||||
This option allows to set a name for a thread.
|
||||
|
||||
config THREAD_MAX_NAME_LEN
|
||||
int "Max length of a thread name"
|
||||
default 32
|
||||
range 8 128
|
||||
depends on THREAD_NAME
|
||||
help
|
||||
Thread names get stored in the k_thread struct. Indicate the max
|
||||
name length, including the terminating NULL byte. Reduce this value
|
||||
to conserve memory.
|
||||
endmenu
|
||||
|
||||
menu "Work Queue Options"
|
||||
config SYSTEM_WORKQUEUE_STACK_SIZE
|
||||
int "System workqueue stack size"
|
||||
default 4096 if COVERAGE
|
||||
default 1024
|
||||
|
||||
config SYSTEM_WORKQUEUE_PRIORITY
|
||||
@@ -380,6 +391,7 @@ config SYSTEM_WORKQUEUE_PRIORITY
|
||||
|
||||
config OFFLOAD_WORKQUEUE_STACK_SIZE
|
||||
int "Workqueue stack size for thread offload requests"
|
||||
default 4096 if COVERAGE
|
||||
default 1024
|
||||
|
||||
config OFFLOAD_WORKQUEUE_PRIORITY
|
||||
|
||||
@@ -26,6 +26,10 @@
|
||||
*/
|
||||
unsigned char sys_pm_idle_exit_notify;
|
||||
|
||||
|
||||
/* LCOV_EXCL_START
|
||||
* These are almost certainly overidden and in any event do nothing
|
||||
*/
|
||||
#if defined(CONFIG_SYS_POWER_SLEEP_STATES)
|
||||
void __attribute__((weak)) _sys_resume(void)
|
||||
{
|
||||
@@ -37,6 +41,7 @@ void __attribute__((weak)) _sys_resume_from_deep_sleep(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
||||
#endif /* CONFIG_SYS_POWER_MANAGEMENT */
|
||||
|
||||
|
||||
@@ -10,6 +10,12 @@
|
||||
|
||||
#include <syscall_list.h>
|
||||
|
||||
/* All of this is build time magic, but LCOV gets confused. Disable coverage
|
||||
* for this whole file.
|
||||
*
|
||||
* LCOV_EXCL_START
|
||||
*/
|
||||
|
||||
/*
|
||||
* The final link step uses the symbol _OffsetAbsSyms to force the linkage of
|
||||
* offsets.o into the ELF image.
|
||||
@@ -80,4 +86,5 @@ GEN_ABSOLUTE_SYM(K_THREAD_SIZEOF, sizeof(struct k_thread));
|
||||
/* size of the device structure. Used by linker scripts */
|
||||
GEN_ABSOLUTE_SYM(_DEVICE_STRUCT_SIZEOF, sizeof(struct device));
|
||||
|
||||
/* LCOV_EXCL_STOP */
|
||||
#endif /* ZEPHYR_KERNEL_INCLUDE_KERNEL_OFFSETS_H_ */
|
||||
|
||||
@@ -244,7 +244,7 @@ static ALWAYS_INLINE void z_new_thread_init(struct k_thread *thread,
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_THREAD_NAME
|
||||
thread->name = NULL;
|
||||
thread->name[0] = '\0';
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
|
||||
@@ -36,7 +36,7 @@ static inline void z_waitq_init(_wait_q_t *w)
|
||||
|
||||
static inline struct k_thread *z_waitq_head(_wait_q_t *w)
|
||||
{
|
||||
return (void *)rb_get_min(&w->waitq.tree);
|
||||
return (struct k_thread *)rb_get_min(&w->waitq.tree);
|
||||
}
|
||||
|
||||
#else /* !CONFIG_WAITQ_SCALABLE: */
|
||||
@@ -52,7 +52,7 @@ static inline void z_waitq_init(_wait_q_t *w)
|
||||
|
||||
static inline struct k_thread *z_waitq_head(_wait_q_t *w)
|
||||
{
|
||||
return (void *)sys_dlist_peek_head(&w->waitq);
|
||||
return (struct k_thread *)sys_dlist_peek_head(&w->waitq);
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_WAITQ_SCALABLE */
|
||||
|
||||
@@ -133,6 +133,13 @@ K_THREAD_STACK_DEFINE(_interrupt_stack3, CONFIG_ISR_STACK_SIZE);
|
||||
extern void idle(void *unused1, void *unused2, void *unused3);
|
||||
|
||||
|
||||
/* LCOV_EXCL_START
|
||||
*
|
||||
* This code is called so early in the boot process that code coverage
|
||||
* doesn't work properly. In addition, not all arches call this code,
|
||||
* some like x86 do this with optimized assembly
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Clear BSS
|
||||
@@ -216,7 +223,9 @@ void z_data_copy(void)
|
||||
#endif /* CONFIG_STACK_CANARIES */
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_XIP */
|
||||
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -278,12 +287,14 @@ static void bg_thread_main(void *unused1, void *unused2, void *unused3)
|
||||
|
||||
main();
|
||||
|
||||
/* Mark nonessenrial since main() has no more work to do */
|
||||
_main_thread->base.user_options &= ~K_ESSENTIAL;
|
||||
|
||||
/* Dump coverage data once the main() has exited. */
|
||||
gcov_coverage_dump();
|
||||
} /* LCOV_EXCL_LINE ... because we just dumped final coverage data */
|
||||
|
||||
/* Terminate thread normally since it has no more work to do */
|
||||
_main_thread->base.user_options &= ~K_ESSENTIAL;
|
||||
}
|
||||
/* LCOV_EXCL_START */
|
||||
|
||||
void __weak main(void)
|
||||
{
|
||||
@@ -291,6 +302,8 @@ void __weak main(void)
|
||||
arch_nop();
|
||||
}
|
||||
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
||||
#if defined(CONFIG_MULTITHREADING)
|
||||
static void init_idle_thread(struct k_thread *thr, k_thread_stack_t *stack)
|
||||
{
|
||||
@@ -408,7 +421,7 @@ static void prepare_multithreading(struct k_thread *dummy_thread)
|
||||
|
||||
}
|
||||
|
||||
static void switch_to_main_thread(void)
|
||||
static FUNC_NORETURN void switch_to_main_thread(void)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_HAS_CUSTOM_SWAP_TO_MAIN
|
||||
z_arch_switch_to_main_thread(_main_thread, _main_stack, MAIN_STACK_SIZE,
|
||||
@@ -421,6 +434,7 @@ static void switch_to_main_thread(void)
|
||||
*/
|
||||
z_swap_unlocked();
|
||||
#endif
|
||||
CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
#endif /* CONFIG_MULTITHREADING */
|
||||
|
||||
@@ -515,9 +529,13 @@ FUNC_NORETURN void z_cstart(void)
|
||||
#else
|
||||
bg_thread_main(NULL, NULL, NULL);
|
||||
|
||||
/* LCOV_EXCL_START
|
||||
* We've already dumped coverage data at this point.
|
||||
*/
|
||||
irq_lock();
|
||||
while (true) {
|
||||
}
|
||||
/* LCOV_EXCL_STOP */
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -526,5 +544,5 @@ FUNC_NORETURN void z_cstart(void)
|
||||
* far.
|
||||
*/
|
||||
|
||||
CODE_UNREACHABLE;
|
||||
CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
@@ -919,7 +919,6 @@ s32_t z_impl_k_sleep(s32_t duration)
|
||||
s32_t ticks;
|
||||
|
||||
__ASSERT(!z_is_in_isr(), "");
|
||||
__ASSERT(duration != K_FOREVER, "");
|
||||
|
||||
K_DEBUG("thread %p for %d ns\n", _current, duration);
|
||||
|
||||
@@ -962,12 +961,6 @@ s32_t z_impl_k_sleep(s32_t duration)
|
||||
#ifdef CONFIG_USERSPACE
|
||||
Z_SYSCALL_HANDLER(k_sleep, duration)
|
||||
{
|
||||
/* FIXME there were some discussions recently on whether we should
|
||||
* relax this, thread would be unscheduled until k_wakeup issued
|
||||
*/
|
||||
Z_OOPS(Z_SYSCALL_VERIFY_MSG(duration != K_FOREVER,
|
||||
"sleeping forever not allowed"));
|
||||
|
||||
return z_impl_k_sleep(duration);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -63,7 +63,7 @@ s32_t z_impl_k_stack_alloc_init(struct k_stack *stack, u32_t num_entries)
|
||||
void *buffer;
|
||||
s32_t ret;
|
||||
|
||||
buffer = z_thread_malloc(num_entries);
|
||||
buffer = z_thread_malloc(num_entries * sizeof(u32_t));
|
||||
if (buffer != NULL) {
|
||||
k_stack_init(stack, buffer, num_entries);
|
||||
stack->flags = K_STACK_FLAG_ALLOC;
|
||||
|
||||
140
kernel/thread.c
140
kernel/thread.c
@@ -138,11 +138,22 @@ void z_impl_k_thread_custom_data_set(void *value)
|
||||
_current->custom_data = value;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
Z_SYSCALL_HANDLER(k_thread_custom_data_set, data)
|
||||
{
|
||||
z_impl_k_thread_custom_data_set((void *)data);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void *z_impl_k_thread_custom_data_get(void)
|
||||
{
|
||||
return _current->custom_data;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
Z_SYSCALL_HANDLER0_SIMPLE(k_thread_custom_data_get);
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
#endif /* CONFIG_THREAD_CUSTOM_DATA */
|
||||
|
||||
#if defined(CONFIG_THREAD_MONITOR)
|
||||
@@ -172,61 +183,109 @@ void z_thread_monitor_exit(struct k_thread *thread)
|
||||
}
|
||||
#endif
|
||||
|
||||
int z_impl_k_thread_name_set(struct k_thread *thread, const char *value)
|
||||
{
|
||||
#ifdef CONFIG_THREAD_NAME
|
||||
void z_impl_k_thread_name_set(struct k_thread *thread, const char *value)
|
||||
{
|
||||
if (thread == NULL) {
|
||||
_current->name = value;
|
||||
} else {
|
||||
thread->name = value;
|
||||
thread = _current;
|
||||
}
|
||||
}
|
||||
|
||||
const char *z_impl_k_thread_name_get(struct k_thread *thread)
|
||||
{
|
||||
return (const char *)thread->name;
|
||||
}
|
||||
|
||||
strncpy(thread->name, value, CONFIG_THREAD_MAX_NAME_LEN);
|
||||
thread->name[CONFIG_THREAD_MAX_NAME_LEN - 1] = '\0';
|
||||
return 0;
|
||||
#else
|
||||
void z_impl_k_thread_name_set(k_tid_t thread_id, const char *value)
|
||||
{
|
||||
ARG_UNUSED(thread_id);
|
||||
ARG_UNUSED(thread);
|
||||
ARG_UNUSED(value);
|
||||
}
|
||||
|
||||
const char *z_impl_k_thread_name_get(k_tid_t thread_id)
|
||||
{
|
||||
ARG_UNUSED(thread_id);
|
||||
return NULL;
|
||||
}
|
||||
return -ENOSYS;
|
||||
#endif /* CONFIG_THREAD_NAME */
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
|
||||
#if defined(CONFIG_THREAD_NAME)
|
||||
Z_SYSCALL_HANDLER(k_thread_name_set, thread, data)
|
||||
Z_SYSCALL_HANDLER(k_thread_name_set, thread, str_param)
|
||||
{
|
||||
char *name_copy = NULL;
|
||||
#ifdef CONFIG_THREAD_NAME
|
||||
struct k_thread *t = (struct k_thread *)thread;
|
||||
size_t len;
|
||||
int err;
|
||||
const char *str = (const char *)str_param;
|
||||
|
||||
name_copy = z_user_string_alloc_copy((char *)data, 64);
|
||||
z_impl_k_thread_name_set((struct k_thread *)thread, name_copy);
|
||||
return 0;
|
||||
if (t != NULL) {
|
||||
if (Z_SYSCALL_OBJ(t, K_OBJ_THREAD) != 0) {
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
len = z_user_string_nlen(str, CONFIG_THREAD_MAX_NAME_LEN, &err);
|
||||
if (err != 0) {
|
||||
return -EFAULT;
|
||||
}
|
||||
if (Z_SYSCALL_MEMORY_READ(str, len) != 0) {
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
return z_impl_k_thread_name_set(t, str);
|
||||
#else
|
||||
return -ENOSYS;
|
||||
#endif /* CONFIG_THREAD_NAME */
|
||||
}
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
const char *k_thread_name_get(struct k_thread *thread)
|
||||
{
|
||||
#ifdef CONFIG_THREAD_NAME
|
||||
return (const char *)thread->name;
|
||||
#else
|
||||
ARG_UNUSED(thread);
|
||||
return NULL;
|
||||
#endif /* CONFIG_THREAD_NAME */
|
||||
}
|
||||
|
||||
Z_SYSCALL_HANDLER1_SIMPLE(k_thread_name_get, K_OBJ_THREAD, k_tid_t);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_THREAD_CUSTOM_DATA
|
||||
Z_SYSCALL_HANDLER(k_thread_custom_data_set, data)
|
||||
int z_impl_k_thread_name_copy(k_tid_t thread_id, char *buf, size_t size)
|
||||
{
|
||||
z_impl_k_thread_custom_data_set((void *)data);
|
||||
#ifdef CONFIG_THREAD_NAME
|
||||
strncpy(buf, thread_id->name, size);
|
||||
return 0;
|
||||
#else
|
||||
ARG_UNUSED(thread_id);
|
||||
ARG_UNUSED(buf);
|
||||
ARG_UNUSED(size);
|
||||
return -ENOSYS;
|
||||
#endif /* CONFIG_THREAD_NAME */
|
||||
}
|
||||
|
||||
Z_SYSCALL_HANDLER0_SIMPLE(k_thread_custom_data_get);
|
||||
#endif /* CONFIG_THREAD_CUSTOM_DATA */
|
||||
#ifdef CONFIG_USERSPACE
|
||||
Z_SYSCALL_HANDLER(k_thread_name_copy, thread_id, buf, size)
|
||||
{
|
||||
#ifdef CONFIG_THREAD_NAME
|
||||
size_t len;
|
||||
struct k_thread *t = (struct k_thread *)thread_id;
|
||||
struct _k_object *ko = z_object_find(t);
|
||||
|
||||
/* Special case: we allow reading the names of initialized threads
|
||||
* even if we don't have permission on them
|
||||
*/
|
||||
if (t == NULL || ko->type != K_OBJ_THREAD ||
|
||||
(ko->flags & K_OBJ_FLAG_INITIALIZED) == 0) {
|
||||
return -EINVAL;
|
||||
}
|
||||
if (Z_SYSCALL_MEMORY_WRITE(buf, size) != 0) {
|
||||
return -EFAULT;
|
||||
}
|
||||
len = strlen(t->name);
|
||||
if (len + 1 > size) {
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
return z_user_to_copy((void *)buf, t->name, len + 1);
|
||||
#else
|
||||
ARG_UNUSED(thread_id);
|
||||
ARG_UNUSED(buf);
|
||||
ARG_UNUSED(size);
|
||||
return -ENOSYS;
|
||||
#endif /* CONFIG_THREAD_NAME */
|
||||
}
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STACK_SENTINEL
|
||||
/* Check that the stack sentinel is still present
|
||||
@@ -386,7 +445,12 @@ void z_setup_new_thread(struct k_thread *new_thread,
|
||||
k_spin_unlock(&lock, key);
|
||||
#endif
|
||||
#ifdef CONFIG_THREAD_NAME
|
||||
new_thread->name = name;
|
||||
if (name != NULL) {
|
||||
strncpy(new_thread->name, name,
|
||||
CONFIG_THREAD_MAX_NAME_LEN - 1);
|
||||
/* Ensure NULL termination, truncate if longer */
|
||||
new_thread->name[CONFIG_THREAD_MAX_NAME_LEN - 1] = '\0';
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_USERSPACE
|
||||
z_object_init(new_thread);
|
||||
|
||||
@@ -760,7 +760,7 @@ static u32_t handler_bad_syscall(u32_t bad_id, u32_t arg2, u32_t arg3,
|
||||
{
|
||||
printk("Bad system call id %u invoked\n", bad_id);
|
||||
z_arch_syscall_oops(ssf);
|
||||
CODE_UNREACHABLE;
|
||||
CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
static u32_t handler_no_syscall(u32_t arg1, u32_t arg2, u32_t arg3,
|
||||
@@ -768,7 +768,7 @@ static u32_t handler_no_syscall(u32_t arg1, u32_t arg2, u32_t arg3,
|
||||
{
|
||||
printk("Unimplemented system call\n");
|
||||
z_arch_syscall_oops(ssf);
|
||||
CODE_UNREACHABLE;
|
||||
CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
#include <syscall_dispatch.c>
|
||||
|
||||
@@ -24,6 +24,7 @@ config CMSIS_MAX_THREAD_COUNT
|
||||
|
||||
config CMSIS_THREAD_MAX_STACK_SIZE
|
||||
int "Max stack size threads can be allocated in CMSIS RTOS application"
|
||||
default 4096 if COVERAGE
|
||||
default 512
|
||||
help
|
||||
Mention max stack size threads can be allocated in CMSIS RTOS application.
|
||||
|
||||
@@ -38,13 +38,15 @@ config CMSIS_V2_THREAD_DYNAMIC_MAX_COUNT
|
||||
|
||||
config CMSIS_V2_THREAD_MAX_STACK_SIZE
|
||||
int "Max stack size threads can be allocated in CMSIS RTOS V2 application"
|
||||
default 4096 if COVERAGE
|
||||
default 512
|
||||
help
|
||||
Mention max stack size threads can be allocated in CMSIS RTOS V2 application.
|
||||
|
||||
config CMSIS_V2_THREAD_DYNAMIC_STACK_SIZE
|
||||
int "Dynamic stack size threads are allocated in CMSIS RTOS V2 application"
|
||||
default 0
|
||||
default 4096 if COVERAGE
|
||||
default 512
|
||||
help
|
||||
Mention dynamic stack size threads are allocated in CMSIS RTOS V2 application.
|
||||
|
||||
|
||||
@@ -102,6 +102,10 @@ void *realloc(void *ptr, size_t requested_size)
|
||||
size_t block_size, total_requested_size;
|
||||
void *new_ptr;
|
||||
|
||||
if (ptr == NULL) {
|
||||
return malloc(requested_size);
|
||||
}
|
||||
|
||||
if (requested_size == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -57,8 +57,6 @@ extern void *_heap_sentry;
|
||||
#define MAX_HEAP_SIZE ((KB(CONFIG_SRAM_SIZE)) - USED_RAM_SIZE)
|
||||
#endif
|
||||
|
||||
static unsigned char *heap_base = UINT_TO_POINTER(USED_RAM_END_ADDR);
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
struct k_mem_partition z_malloc_partition;
|
||||
|
||||
@@ -66,7 +64,11 @@ static int malloc_prepare(struct device *unused)
|
||||
{
|
||||
ARG_UNUSED(unused);
|
||||
|
||||
#if CONFIG_NEWLIB_LIBC_ALIGNED_HEAP_SIZE
|
||||
z_malloc_partition.start = (u32_t)heap_base;
|
||||
#else
|
||||
z_malloc_partition.start = USED_RAM_END_ADDR;
|
||||
#endif
|
||||
z_malloc_partition.size = MAX_HEAP_SIZE;
|
||||
z_malloc_partition.attr = K_MEM_PARTITION_P_RW_U_RW;
|
||||
return 0;
|
||||
@@ -222,7 +224,11 @@ void _exit(int status)
|
||||
|
||||
void *_sbrk(int count)
|
||||
{
|
||||
#if CONFIG_NEWLIB_LIBC_ALIGNED_HEAP_SIZE
|
||||
void *ptr = heap_base + heap_sz;
|
||||
#else
|
||||
void *ptr = _end + heap_sz;
|
||||
#endif
|
||||
|
||||
if ((heap_sz + count) < MAX_HEAP_SIZE) {
|
||||
heap_sz += count;
|
||||
|
||||
@@ -45,6 +45,7 @@ static void _printk_hex_ulong(out_func_t out, void *ctx,
|
||||
*
|
||||
* @return 0
|
||||
*/
|
||||
/* LCOV_EXCL_START */
|
||||
__attribute__((weak)) int z_arch_printk_char_out(int c)
|
||||
{
|
||||
ARG_UNUSED(c);
|
||||
@@ -52,6 +53,7 @@ static void _printk_hex_ulong(out_func_t out, void *ctx,
|
||||
/* do nothing */
|
||||
return 0;
|
||||
}
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
||||
int (*_char_out)(int) = z_arch_printk_char_out;
|
||||
|
||||
@@ -506,18 +508,14 @@ static int str_out(int c, struct str_context *ctx)
|
||||
|
||||
int snprintk(char *str, size_t size, const char *fmt, ...)
|
||||
{
|
||||
struct str_context ctx = { str, size, 0 };
|
||||
va_list ap;
|
||||
int ret;
|
||||
|
||||
va_start(ap, fmt);
|
||||
z_vprintk((out_func_t)str_out, &ctx, fmt, ap);
|
||||
ret = vsnprintk(str, size, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (ctx.count < ctx.max) {
|
||||
str[ctx.count] = '\0';
|
||||
}
|
||||
|
||||
return ctx.count;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int vsnprintk(char *str, size_t size, const char *fmt, va_list ap)
|
||||
|
||||
@@ -28,18 +28,12 @@ FUNC_NORETURN void z_thread_entry(k_thread_entry_t entry,
|
||||
{
|
||||
entry(p1, p2, p3);
|
||||
|
||||
#ifdef CONFIG_MULTITHREADING
|
||||
k_thread_abort(k_current_get());
|
||||
#else
|
||||
for (;;) {
|
||||
k_cpu_idle();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compiler can't tell that k_thread_abort() won't return and issues a
|
||||
* warning unless we tell it that control never gets this far.
|
||||
*/
|
||||
|
||||
CODE_UNREACHABLE;
|
||||
CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
@@ -67,20 +67,15 @@ int clock_gettime(clockid_t clock_id, struct timespec *ts)
|
||||
int clock_settime(clockid_t clock_id, const struct timespec *tp)
|
||||
{
|
||||
struct timespec base;
|
||||
int res;
|
||||
|
||||
if (clock_id != CLOCK_REALTIME) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
res = clock_gettime(clock_id, &base);
|
||||
if (res != 0) {
|
||||
return res;
|
||||
}
|
||||
|
||||
s64_t delta = (s64_t)NSEC_PER_SEC * (tp->tv_sec - base.tv_sec) +
|
||||
(tp->tv_nsec - base.tv_nsec);
|
||||
u64_t elapsed_msecs = k_uptime_get();
|
||||
s64_t delta = (s64_t)NSEC_PER_SEC * tp->tv_sec + tp->tv_nsec
|
||||
- elapsed_msecs * USEC_PER_MSEC * NSEC_PER_USEC;
|
||||
|
||||
base.tv_sec = delta / NSEC_PER_SEC;
|
||||
base.tv_nsec = delta % NSEC_PER_SEC;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#define _SRAM2_DATA_SECTION_NAME .sram2_data
|
||||
#define _SRAM2_BSS_SECTION_NAME .sram2_bss
|
||||
#define _SRAM2_TEXT_SECTION_NAME .sram2_text
|
||||
#define SRAM2_ADDR (CONFIG_SRAM_BASE_ADDRESS + RAM_SIZE2)
|
||||
#endif
|
||||
|
||||
#define RAM_SIZE2 (CONFIG_SRAM_SIZE * 512)
|
||||
|
||||
@@ -26,7 +26,6 @@ CONFIG_BT_PERIPHERAL=y
|
||||
|
||||
CONFIG_BT=y
|
||||
CONFIG_BT_TINYCRYPT_ECC=y
|
||||
CONFIG_BT_RX_BUF_COUNT=30
|
||||
CONFIG_BT_L2CAP_RX_MTU=69
|
||||
CONFIG_BT_L2CAP_TX_MTU=69
|
||||
CONFIG_BT_L2CAP_TX_BUF_COUNT=5
|
||||
|
||||
@@ -17,6 +17,8 @@ CONFIG_SETTINGS_FCB=y
|
||||
CONFIG_BT=y
|
||||
CONFIG_BT_TINYCRYPT_ECC=y
|
||||
CONFIG_BT_RX_STACK_SIZE=1100
|
||||
CONFIG_BT_RX_BUF_COUNT=3
|
||||
CONFIG_BT_DISCARDABLE_BUF_COUNT=3
|
||||
|
||||
CONFIG_BT_CTLR_DUP_FILTER_LEN=0
|
||||
CONFIG_BT_OBSERVER=y
|
||||
|
||||
@@ -3,7 +3,6 @@ CONFIG_MAIN_STACK_SIZE=512
|
||||
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
|
||||
|
||||
CONFIG_BT=y
|
||||
CONFIG_BT_RX_BUF_COUNT=30
|
||||
CONFIG_BT_TINYCRYPT_ECC=y
|
||||
#CONFIG_BT_DEBUG_LOG=y
|
||||
CONFIG_BT_OBSERVER=y
|
||||
|
||||
@@ -7,7 +7,7 @@ CONFIG_BT_SMP=y
|
||||
CONFIG_BT_SIGNING=y
|
||||
CONFIG_BT_PERIPHERAL=y
|
||||
CONFIG_BT_GATT_DIS=y
|
||||
CONFIG_BT_ATT_PREPARE_COUNT=2
|
||||
CONFIG_BT_ATT_PREPARE_COUNT=5
|
||||
CONFIG_BT_PRIVACY=y
|
||||
CONFIG_BT_DEVICE_NAME="Zephyr Peripheral Sample Long Name"
|
||||
CONFIG_BT_DEVICE_APPEARANCE=833
|
||||
|
||||
@@ -31,7 +31,6 @@ CONFIG_BT_PERIPHERAL=y
|
||||
|
||||
CONFIG_BT=y
|
||||
CONFIG_BT_TINYCRYPT_ECC=y
|
||||
CONFIG_BT_RX_BUF_COUNT=30
|
||||
CONFIG_BT_L2CAP_RX_MTU=69
|
||||
CONFIG_BT_L2CAP_TX_MTU=69
|
||||
CONFIG_BT_L2CAP_TX_BUF_COUNT=8
|
||||
|
||||
@@ -26,7 +26,6 @@ CONFIG_BT_CTLR_TX_PWR_PLUS_8=y
|
||||
CONFIG_BT_PERIPHERAL=y
|
||||
CONFIG_BT=y
|
||||
CONFIG_BT_TINYCRYPT_ECC=y
|
||||
CONFIG_BT_RX_BUF_COUNT=30
|
||||
CONFIG_BT_RX_STACK_SIZE=4096
|
||||
CONFIG_BT_L2CAP_RX_MTU=69
|
||||
CONFIG_BT_L2CAP_TX_MTU=69
|
||||
|
||||
@@ -19,7 +19,6 @@ CONFIG_BT_MESH_DEBUG=y
|
||||
|
||||
CONFIG_BT_OBSERVER=y
|
||||
CONFIG_BT_BROADCASTER=y
|
||||
CONFIG_BT_RX_BUF_COUNT=30
|
||||
CONFIG_BT_L2CAP_RX_MTU=69
|
||||
CONFIG_BT_L2CAP_TX_MTU=69
|
||||
CONFIG_BT_L2CAP_TX_BUF_COUNT=8
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user