Skip to content

FUTURE_SEQUANA_PSA: fixed deep sleep mode #9678

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

Merged
merged 1 commit into from
Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,13 @@
* multiplexer. This requires that we define which of the 32 NVIC channels is used
* by which interrupt. This is done here.
*/
#define CY_M0_CORE_IRQ_CHANNEL_US_TICKER ((IRQn_Type)0)
#define CY_M0_CORE_IRQ_CHANNEL_LP_TICKER ((IRQn_Type)0)
#define CY_M0_CORE_IRQ_CHANNEL_IPC_SYS ((IRQn_Type)1)
#define CY_M0_CORE_IRQ_CHANNEL_IPC_USR ((IRQn_Type)2)
#define CY_M0_CORE_IRQ_CHANNEL_PSA_MAILBOX ((IRQn_Type)3)
#define CY_M0_CORE_IRQ_CHANNEL_SERIAL ((IRQn_Type)4)
#define CY_M0_CORE_IRQ_CHANNEL_BLE ((IRQn_Type)3)
#define CY_M0_CORE_IRQ_CHANNEL_BLE ((IRQn_Type)7)
#define CY_M0_CORE_IRQ_CHANNEL_US_TICKER ((IRQn_Type)8)

/** Identifiers used in allocation of NVIC channels.
*/
Expand All @@ -78,4 +82,5 @@
#define CY_BLE_IRQN_ID (0x300)
#define CY_GPIO_IRQN_ID (0x400)
#define CY_LP_TICKER_IRQN_ID (0x500)
#define CY_PSA_MAILBOX_IRQN_ID (0x600)
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@

#include "spm_api.h"

#include "cmsis.h"
#include "device.h"
#include "cyip_ipc.h"
#include "cy_ipc_drv.h"
#include "cy_syslib.h"
#include "cy_sysint.h"

#include "psoc6_utils.h"
#include "mbed_error.h"


/* ------------------------------------ Definitions ---------------------------------- */
Expand Down Expand Up @@ -65,9 +66,12 @@ void mailbox_init(void)

// Configure interrupts ISR / MUX and priority
cy_stc_sysint_t ipc_intr_Config;
ipc_intr_Config.intrSrc = (IRQn_Type)NvicMux3_IRQn; // Can be any Mux we choose
ipc_intr_Config.intrSrc = CY_M0_CORE_IRQ_CHANNEL_PSA_MAILBOX;
ipc_intr_Config.cm0pSrc = (cy_en_intr_t)cpuss_interrupts_ipc_0_IRQn + SPM_IPC_NOTIFY_CM0P_INTR; // Must match the interrupt we trigger using NOTIFY on CM4
ipc_intr_Config.intrPriority = 1;
if (cy_m0_nvic_reserve_channel(CY_M0_CORE_IRQ_CHANNEL_PSA_MAILBOX, CY_PSA_MAILBOX_IRQN_ID) == (IRQn_Type)(-1)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1 is oddly specific. What does the magic number map to?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It refers to targets/TARGET_Cypress/TARGET_PSOC6_FUTURE/psoc6_utils.h:

 *
 * \param channel IRQn_Type     Channel to be reserved.
 * \param allocation_id uint32_t    Identifier.
 * \return  IRQ channel allocated or (-1) if no free channel is available.
 *
 */
IRQn_Type cy_m0_nvic_reserve_channel(IRQn_Type channel, uint32_t allocation_id);

Yeah, it's sloppy. But fixing this requires a global HAL implementation change, that I would rather prepare as a separate PR.

error("PSA SPM Mailbox NVIC channel reservation conflict.");
}
(void)Cy_SysInt_Init(&ipc_intr_Config, ipc_interrupt_handler);

// Set specific NOTIFY interrupt mask only.
Expand Down
Loading