Skip to content

Commit

Permalink
ports: riscv-eclic: chcore: add missing port lock functions
Browse files Browse the repository at this point in the history
These added defines have been introduced in ChibiOS[1] and guard the
CH_PORT_SUPPORTS_RECURSIVE_LOCKS feature. The needed functionality is
already implemented in the port layer, thus the implementation is a
simple wrapper.

[1]: git-svn-id: https://svn.code.sf.net/p/chibios/code/branches/stable_21.11.x@16537 085d63ac-f8f8-4fb4-a5e5-c089fd4f3ff4

Signed-off-by: Stefan Kerkmann <[email protected]>
  • Loading branch information
KarlK90 committed Jan 8, 2025
1 parent 13d24b4 commit cb3b6ce
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions os/common/ports/RISCV-ECLIC/chcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,23 @@ struct port_context {
}
#endif

/**
* @brief Returns a word representing a critical section status.
*
* @return The critical section status.
*/
#define port_get_lock_status() port_get_irq_status()

/**
* @brief Determines if in a critical section.
*
* @param[in] sts status word returned by @p port_get_lock_status()
* @return The current status.
* @retval false if running outside a critical section.
* @retval true if running within a critical section.
*/
#define port_is_locked(sts) !port_irq_enabled(sts)

/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
Expand Down

0 comments on commit cb3b6ce

Please sign in to comment.