-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nfc: Introduce Zero Latency IRQ #13248
base: main
Are you sure you want to change the base?
Conversation
#endif /* CONFIG_NFC_LOW_LATENCY_IRQ */ | ||
#endif /* CONFIG_NFC_ZERO_LATENCY_IRQ */ | ||
|
||
#define HFCLK_NONE 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enum?
static atomic_t clk_mode; | ||
#endif /* CONFIG_NFC_ZERO_LATENCY_IRQ */ | ||
|
||
static void hfclk_set(uint32_t mode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static void hfclk_set(uint32_t mode) | |
static void hfclk_set(uint32_t mode) |
enum?
ISR_DIRECT_DECLARE(nfc_swi_handler) | ||
{ | ||
atomic_val_t tmp; | ||
|
||
tmp = atomic_set(&clk_mode, HFCLK_NONE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if atomic would have any effect in our case. Probably using just volatile would make sense
ISR_DIRECT_DECLARE(nfc_swi_handler) | ||
{ | ||
atomic_val_t tmp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could remember previous clock status and check it in this function to prevent doing the same operation few times
10cd8b4
to
76a0aeb
Compare
76a0aeb
to
6d294c7
Compare
33d6809
to
458dce6
Compare
* Added: | ||
|
||
* Support for zero-latency interrupts for NFC. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Added: | |
* Support for zero-latency interrupts for NFC. | |
* Added support for zero-latency interrupts for all NFC libraries. |
If this is added for all of them.
subsys/nfc/lib/platform_internal.h
Outdated
@@ -33,6 +33,33 @@ extern "C" { | |||
*/ | |||
int nfc_platform_internal_init(nfc_lib_cb_resolve_t cb_rslv); | |||
|
|||
/** @brief Function for initializing internal hfclk control. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** @brief Function for initializing internal hfclk control. | |
/** @brief Initialize internal hfclk control. |
What is hfclk? Should we open it in the first instance?
subsys/nfc/lib/platform_internal.h
Outdated
*/ | ||
int nfc_platform_internal_hfclk_init(void); | ||
|
||
/** @brief Function for starting hfclk. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** @brief Function for starting hfclk. | |
/** @brief Start hfclk. |
subsys/nfc/lib/platform_internal.h
Outdated
*/ | ||
int nfc_platform_internal_hfclk_start(void); | ||
|
||
/** @brief Function for stopping hfclk. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** @brief Function for stopping hfclk. | |
/** @brief Stop hfclk. |
subsys/nfc/lib/platform.c
Outdated
#ifdef CONFIG_NFC_ZERO_LATENCY_IRQ | ||
IRQ_DIRECT_CONNECT(NFCT_IRQn, CONFIG_NFCT_IRQ_PRIORITY, | ||
nfc_isr_wrapper, IRQ_ZERO_LATENCY); | ||
#else | ||
IRQ_DIRECT_CONNECT(NFCT_IRQn, CONFIG_NFCT_IRQ_PRIORITY, | ||
nfc_isr_wrapper, 0); | ||
#endif /* CONFIG_NFC_ZERO_LATENCY_IRQ */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#ifdef CONFIG_NFC_ZERO_LATENCY_IRQ | |
IRQ_DIRECT_CONNECT(NFCT_IRQn, CONFIG_NFCT_IRQ_PRIORITY, | |
nfc_isr_wrapper, IRQ_ZERO_LATENCY); | |
#else | |
IRQ_DIRECT_CONNECT(NFCT_IRQn, CONFIG_NFCT_IRQ_PRIORITY, | |
nfc_isr_wrapper, 0); | |
#endif /* CONFIG_NFC_ZERO_LATENCY_IRQ */ | |
IRQ_DIRECT_CONNECT(NFCT_IRQn, CONFIG_NFCT_IRQ_PRIORITY, | |
nfc_isr_wrapper, NFCT_IRQ_FLAGS); |
What do you think about using the NFCT_IRQ_FLAGS definition?
This way we avoid conditional compilation at this place.
@@ -80,14 +80,15 @@ config NFC_THREAD_PRIORITY | |||
|
|||
endif# NFC_OWN_THREAD | |||
|
|||
config NFC_LOW_LATENCY_IRQ | |||
bool "Use low latency IRQ for NFC" | |||
config NFC_ZERO_LATENCY_IRQ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Experimental?
{ | ||
switch (event->evt_id) { | ||
case NRFX_NFCT_EVT_FIELD_DETECTED: | ||
#ifdef CONFIG_NFC_ZERO_LATENCY_IRQ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My general suggestion is to avoid conditional compilation by using IS_ENABLED()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be swapped here because of clk_mode variable which is conditional.
I also noticed error log: |
458dce6
to
12bc24f
Compare
Test specificationCI/Jenkins/NRF
CI/Jenkins/integration
Detailed information of selected test modules Note: This message is automatically posted and updated by the CI |
You can find the documentation preview for this PR at this link. It will be updated about 10 minutes after the documentation build succeeds. Note: This comment is automatically posted by the Documentation Publishing GitHub Action. |
Introduce Zero Latency IRQ in NFC Platform. The Zero Latency IRQ is an improvement on NFC processing latency with cost of a single SWI interrupt. Jira: NCSDK-23347 Signed-off-by: Dominik Chat <[email protected]>
12bc24f
to
65d06a8
Compare
Introduce Zero Latency IRQ in NFC Platform.
The Zero Latency IRQ is an improvement on NFC
processing latency with cost of a single SWI interrupt.