Skip to content

Commit

Permalink
Add the function event_value_get to identify the signal status.
Browse files Browse the repository at this point in the history
  • Loading branch information
At-EC committed Sep 21, 2024
1 parent 43cb9fe commit f261c26
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 6 deletions.
6 changes: 3 additions & 3 deletions build_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
extern "C" {
#endif

#define ATOS_BUILD_TIME "2024-09-16,20:37"
#define ATOS_COMMIT_HEAD_ID "cd3e2967e916777ec355b6540cbad7eb3deb491a"
#define ATOS_BUILD_TIME "2024-09-21,10:30"
#define ATOS_COMMIT_HEAD_ID "43cb9fe9b7a846e8ab4cd77bb902389f4b0ab214"
#define ATOS_VERSION_MAJOR_NUMBER (1u)
#define ATOS_VERSION_MINOR_NUMBER (7u)
#define ATOS_VERSION_PATCH_NUMBER (1u)
#define ATOS_VERSION_PATCH_NUMBER (2u)

#define ATOS_VERSION_MAJOR_NUMBER_MASK (0x03FFu)
#define ATOS_VERSION_MAJOR_NUMBER_POS (22u)
Expand Down
15 changes: 15 additions & 0 deletions include/kernel/at_rtos.h
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,21 @@ static inline os_evt_id_t os_evt_init(u32_t anyMask, u32_t modeMask, u32_t dirMa
return id;
}

/**
* @brief Read or write the event signal value.
*
* @param id: Event unique id.
* @param pValue: The pointer of the private event value.
*
* @return The result of the operation.
*/
static inline i32p_t os_evt_value_get(os_evt_id_t id, u32_t* pValue)
{
extern i32p_t _impl_event_value_get(os_id_t id, u32_t *pValue);

return (i32p_t)_impl_event_value_get(id.val, pValue);
}

/**
* @brief Set/clear/toggle a event bits.
*
Expand Down
46 changes: 46 additions & 0 deletions kernel/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,26 @@ static u32_t _event_init_privilege_routine(arguments_t *pArgs)
return OS_INVALID_ID_VAL;
}

/**
* @brief It's sub-routine running at privilege mode.
*
* @param pArgs The function argument packages.
*
* @return The result of privilege routine.
*/
static i32p_t _event_value_get_privilege_routine(arguments_t *pArgs)
{
ENTER_CRITICAL_SECTION();

os_id_t id = (os_id_t)pArgs[0].u32_val;
u32_t* pValue = (u32_t*)pArgs[1].pv_val;
event_context_t *pCurEvent = _event_object_contextGet(id);
*pValue = pCurEvent->value;

EXIT_CRITICAL_SECTION();
return 0u;
}

/**
* @brief It's sub-routine running at privilege mode.
*
Expand Down Expand Up @@ -450,6 +470,32 @@ i32p_t _impl_event_wait_callfunc_register(pEvent_callbackFunc_t pCallFun)
return 0u;
}

/**
* @brief Read or write the event signal value.
*
* @param id: Event unique id.
* @param pValue: The pointer of the private event value.
*
* @return The result of the operation.
*/
i32p_t _impl_event_value_get(os_id_t id, u32_t *pValue)
{
if (_event_id_isInvalid(id)) {
return _PCER;
}

if (!_event_object_isInit(id)) {
return _PCER;
}

arguments_t arguments[] = {
[0] = {.u32_val = (u32_t)id},
[1] = {.pv_val = (void *)pValue},
};

return kernel_privilege_invoke((const void *)_event_value_get_privilege_routine, arguments);
}

/**
* @brief Set/clear/toggle event signal bits.
*
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "At-RTOS",
"homepage": "https://github.com/At-EC/At-RTOS",
"version": "1.7.1",
"timestamp": "2024-09-16,20:37",
"commit_id": "48c4a82eeb48ad1d87e5502fec173bc596206e09"
"version": "1.7.2",
"timestamp": "2024-09-21,10:30",
"commit_id": "cd3e2967e916777ec355b6540cbad7eb3deb491a"
}

0 comments on commit f261c26

Please sign in to comment.