From 08b85d16f96af884f2b82994153171b1b9728e7a Mon Sep 17 00:00:00 2001 From: kaizoku-oh Date: Sun, 11 Apr 2021 13:35:52 +0100 Subject: [PATCH] minor porting modifs --- .github/workflows/main.yaml | 12 +++++- docs/rtcos_doxyfile | 2 +- examples/arduino/include/RTCOSConfig.h | 6 +-- examples/arduino/platformio.ini | 2 +- examples/arduino/src/main.cpp | 2 +- examples/linux/RTCOSConfig.h | 6 +-- examples/linux/main.c | 2 +- include/config.h | 14 +++---- include/rtcos.h | 2 +- library.json | 2 +- src/rtcos.c | 58 +++++++++++++------------- 11 files changed, 58 insertions(+), 50 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 5bbc57c..95a6285 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -2,9 +2,11 @@ name: Build on: push: - branches: [ main ] + branches: + - '*' pull_request: - branches: [ main ] + branches: + - '*' jobs: build: @@ -33,6 +35,12 @@ jobs: cd examples/arduino pio run + # Check the firmware + - name: Check Firmware + run: | + cd examples/arduino + pio check + # Generate doxygene documentation - name: Generate documentation uses: mattnotmitt/doxygen-action@v1 diff --git a/docs/rtcos_doxyfile b/docs/rtcos_doxyfile index ab472e1..030eb86 100644 --- a/docs/rtcos_doxyfile +++ b/docs/rtcos_doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = RTCOS # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.1.0 +PROJECT_NUMBER = 1.1.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/examples/arduino/include/RTCOSConfig.h b/examples/arduino/include/RTCOSConfig.h index 68fcbf7..d313805 100644 --- a/examples/arduino/include/RTCOSConfig.h +++ b/examples/arduino/include/RTCOSConfig.h @@ -3,7 +3,7 @@ * * @file : RTCOSConfig.h * @author : Bayrem GHARSELLAOUI - * @version : 1.1.0 + * @version : 1.1.1 * @date : April 2021 * @brief : RTCOS user configuration example used to overrite os default configuration * @@ -29,7 +29,7 @@ /*-----------------------------------------------------------------------------------------------*/ /* Macros */ /*-----------------------------------------------------------------------------------------------*/ -#define ENTER_CRITICAL_SECTION() noInterrupts(); -#define EXIT_CRITICAL_SECTION() interrupts(); +#define RTCOS_ENTER_CRITICAL_SECTION() noInterrupts(); +#define RTCOS_EXIT_CRITICAL_SECTION() interrupts(); #endif /* RTCOS_CONFIG_H */ diff --git a/examples/arduino/platformio.ini b/examples/arduino/platformio.ini index 68ba2e9..0e8ffeb 100644 --- a/examples/arduino/platformio.ini +++ b/examples/arduino/platformio.ini @@ -16,4 +16,4 @@ monitor_speed = 9600 build_flags = -I include lib_deps = paulstoffregen/TimerOne@^1.1 - kaizoku-oh/RTCOS@^1.1.0 + kaizoku-oh/RTCOS@^1.1.1 diff --git a/examples/arduino/src/main.cpp b/examples/arduino/src/main.cpp index 456e9da..0a91fa6 100644 --- a/examples/arduino/src/main.cpp +++ b/examples/arduino/src/main.cpp @@ -3,7 +3,7 @@ * * @file : main.cpp * @author : Bayrem GHARSELLAOUI - * @version : 1.1.0 + * @version : 1.1.1 * @date : April 2021 * @brief : Arduino example sketch * diff --git a/examples/linux/RTCOSConfig.h b/examples/linux/RTCOSConfig.h index e1ad629..9696417 100644 --- a/examples/linux/RTCOSConfig.h +++ b/examples/linux/RTCOSConfig.h @@ -3,7 +3,7 @@ * * @file : RTCOSConfig.h * @author : Bayrem GHARSELLAOUI - * @version : 1.1.0 + * @version : 1.1.1 * @date : April 2021 * @brief : RTCOS user configuration example used to overrite os default configuration * @@ -24,7 +24,7 @@ /*-----------------------------------------------------------------------------------------------*/ /* Macros */ /*-----------------------------------------------------------------------------------------------*/ -#define ENTER_CRITICAL_SECTION() -#define EXIT_CRITICAL_SECTION() +#define RTCOS_ENTER_CRITICAL_SECTION() +#define RTCOS_EXIT_CRITICAL_SECTION() #endif /* RTCOS_CONFIG_H */ diff --git a/examples/linux/main.c b/examples/linux/main.c index d074aa9..c086e32 100644 --- a/examples/linux/main.c +++ b/examples/linux/main.c @@ -3,7 +3,7 @@ * * @file : main.c * @author : Bayrem GHARSELLAOUI - * @version : 1.1.0 + * @version : 1.1.1 * @date : April 2021 * @brief : Linux example program * diff --git a/include/config.h b/include/config.h index fe5a994..4914175 100644 --- a/include/config.h +++ b/include/config.h @@ -3,7 +3,7 @@ * * @file : config.h * @author : Bayrem GHARSELLAOUI - * @version : 1.1.0 + * @version : 1.1.1 * @date : April 2021 * @brief : RTCOS default configuration file * @@ -42,12 +42,12 @@ /*-----------------------------------------------------------------------------------------------*/ /* Macros */ /*-----------------------------------------------------------------------------------------------*/ -#ifndef ENTER_CRITICAL_SECTION -#define ENTER_CRITICAL_SECTION() -#endif /* ENTER_CRITICAL_SECTION */ +#ifndef RTCOS_ENTER_CRITICAL_SECTION +#define RTCOS_ENTER_CRITICAL_SECTION() +#endif /* RTCOS_ENTER_CRITICAL_SECTION */ -#ifndef EXIT_CRITICAL_SECTION -#define EXIT_CRITICAL_SECTION() -#endif /* EXIT_CRITICAL_SECTION */ +#ifndef RTCOS_EXIT_CRITICAL_SECTION +#define RTCOS_EXIT_CRITICAL_SECTION() +#endif /* RTCOS_EXIT_CRITICAL_SECTION */ #endif /* CONFIG_H */ diff --git a/include/rtcos.h b/include/rtcos.h index d1331fd..b49f61e 100644 --- a/include/rtcos.h +++ b/include/rtcos.h @@ -3,7 +3,7 @@ * * @file : rtcos.h * @author : Bayrem GHARSELLAOUI - * @version : 1.1.0 + * @version : 1.1.1 * @date : April 2021 * @brief : RTCOS header file * diff --git a/library.json b/library.json index 77b3f60..659f092 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "RTCOS", - "version": "1.1.0", + "version": "1.1.1", "description": "An event-driven RTC (Run To Completion) OS/scheduler dedicated to ultra constrained devices.", "keywords": "cooperative, event, scheduler, os", "repository": diff --git a/src/rtcos.c b/src/rtcos.c index 7d5d996..615ae57 100644 --- a/src/rtcos.c +++ b/src/rtcos.c @@ -3,7 +3,7 @@ * * @file : rtcos.c * @author : Bayrem GHARSELLAOUI - * @version : 1.1.0 + * @version : 1.1.1 * @date : April 2021 * @brief : RTCOS source file * @@ -239,18 +239,18 @@ static void _rtcos_run_ready_task(_u08 u08NewCurrTaskID) _u32 u32UnhandledEvents; _u32 u32CurrentEvents; - ENTER_CRITICAL_SECTION(); + RTCOS_ENTER_CRITICAL_SECTION(); stRtcosCtx.u08CurrentTaskID = u08NewCurrTaskID; u32CurrentEvents = stRtcosCtx.tstTasks[stRtcosCtx.u08CurrentTaskID].u32EventFlags; stRtcosCtx.tstTasks[stRtcosCtx.u08CurrentTaskID].u32EventFlags = 0; - EXIT_CRITICAL_SECTION(); + RTCOS_EXIT_CRITICAL_SECTION(); u32UnhandledEvents = (stRtcosCtx.tstTasks[stRtcosCtx.u08CurrentTaskID].pfTaskHandlerCb) (u32CurrentEvents, _rtcos_fifo_count(stRtcosCtx.u08CurrentTaskID), stRtcosCtx.tstTasks[stRtcosCtx.u08CurrentTaskID].u32TaskParam); - ENTER_CRITICAL_SECTION(); + RTCOS_ENTER_CRITICAL_SECTION(); stRtcosCtx.tstTasks[stRtcosCtx.u08CurrentTaskID].u32EventFlags |= u32UnhandledEvents; - EXIT_CRITICAL_SECTION(); + RTCOS_EXIT_CRITICAL_SECTION(); } /** *********************************************************************************************** @@ -346,7 +346,7 @@ static rtcos_status_t _rtcos_add_future_event(_u08 u08TaskID, _u08 u08FoundEventIdx; rtcos_status_t eRetVal; - ENTER_CRITICAL_SECTION(); + RTCOS_ENTER_CRITICAL_SECTION(); eRetVal = _rtcos_find_future_event(u08TaskID, u32EventFlags, &u08FoundEventIdx); if(RTCOS_ERR_NONE == eRetVal) { @@ -372,7 +372,7 @@ static rtcos_status_t _rtcos_add_future_event(_u08 u08TaskID, } } } - EXIT_CRITICAL_SECTION(); + RTCOS_EXIT_CRITICAL_SECTION(); return eRetVal; } @@ -520,9 +520,9 @@ rtcos_status_t rtcos_send_message(_u08 u08TaskID, void *pMsg) if(u08TaskID < stRtcosCtx.u08TasksCount) { - ENTER_CRITICAL_SECTION(); + RTCOS_ENTER_CRITICAL_SECTION(); eRetVal = _rtcos_fifo_push(u08TaskID, pMsg); - EXIT_CRITICAL_SECTION(); + RTCOS_EXIT_CRITICAL_SECTION(); } else { @@ -542,9 +542,9 @@ rtcos_status_t rtcos_get_message(void **ppMsg) if(stRtcosCtx.u08CurrentTaskID < stRtcosCtx.u08TasksCount) { - ENTER_CRITICAL_SECTION(); + RTCOS_ENTER_CRITICAL_SECTION(); eRetVal = _rtcos_fifo_pop(stRtcosCtx.u08CurrentTaskID, ppMsg); - EXIT_CRITICAL_SECTION(); + RTCOS_EXIT_CRITICAL_SECTION(); } else { @@ -564,7 +564,7 @@ _s08 rtcos_create_timer(rtcos_timer_type_t ePeriodType, pf_timer_cb_t pfTimerCb, { _s08 s08RetVal; - ENTER_CRITICAL_SECTION(); + RTCOS_ENTER_CRITICAL_SECTION(); if(stRtcosCtx.u08TimersCount >= RTCOS_MAX_TIMERS_COUNT) { s08RetVal = RTCOS_ERR_OUT_OF_RESOURCES; @@ -575,7 +575,7 @@ _s08 rtcos_create_timer(rtcos_timer_type_t ePeriodType, pf_timer_cb_t pfTimerCb, stRtcosCtx.tstTimers[stRtcosCtx.u08TimersCount].pfTimerCb = pfTimerCb; s08RetVal = stRtcosCtx.u08TimersCount++; } - EXIT_CRITICAL_SECTION(); + RTCOS_EXIT_CRITICAL_SECTION(); return s08RetVal; } @@ -589,7 +589,7 @@ rtcos_status_t rtcos_start_timer(_u08 u08TimerID, _u32 u32PeriodInTicks) { rtcos_status_t eRetVal; - ENTER_CRITICAL_SECTION(); + RTCOS_ENTER_CRITICAL_SECTION(); if(u08TimerID >= RTCOS_MAX_TIMERS_COUNT) { eRetVal = RTCOS_ERR_OUT_OF_RESOURCES; @@ -601,7 +601,7 @@ rtcos_status_t rtcos_start_timer(_u08 u08TimerID, _u32 u32PeriodInTicks) stRtcosCtx.tstTimers[u08TimerID].bInUse = TRUE; eRetVal = RTCOS_ERR_NONE; } - EXIT_CRITICAL_SECTION(); + RTCOS_EXIT_CRITICAL_SECTION(); return eRetVal; } @@ -614,7 +614,7 @@ rtcos_status_t rtcos_stop_timer(_u08 u08TimerID) { rtcos_status_t eRetVal; - ENTER_CRITICAL_SECTION(); + RTCOS_ENTER_CRITICAL_SECTION(); if(u08TimerID >= RTCOS_MAX_TIMERS_COUNT) { eRetVal = RTCOS_ERR_OUT_OF_RESOURCES; @@ -624,7 +624,7 @@ rtcos_status_t rtcos_stop_timer(_u08 u08TimerID) stRtcosCtx.tstTimers[u08TimerID].bInUse = FALSE; eRetVal = RTCOS_ERR_NONE; } - EXIT_CRITICAL_SECTION(); + RTCOS_EXIT_CRITICAL_SECTION(); return eRetVal; } @@ -640,7 +640,7 @@ _bool rtcos_timer_expired(_u08 u08TimerID) bExpired = FALSE; u32CurrentTicksCount = stRtcosCtx.u32SysTicksCount; - ENTER_CRITICAL_SECTION(); + RTCOS_ENTER_CRITICAL_SECTION(); if((stRtcosCtx.tstTimers[u08TimerID].bInUse) && (u08TimerID < RTCOS_MAX_TIMERS_COUNT)) { if((u32CurrentTicksCount - stRtcosCtx.tstTimers[u08TimerID].u32StartTickCount) > @@ -649,7 +649,7 @@ _bool rtcos_timer_expired(_u08 u08TimerID) bExpired = TRUE; } } - EXIT_CRITICAL_SECTION(); + RTCOS_EXIT_CRITICAL_SECTION(); return bExpired; } @@ -673,9 +673,9 @@ rtcos_status_t rtcos_send_event(_u08 u08TaskID, { if(0 == u32EventDelay) { - ENTER_CRITICAL_SECTION(); + RTCOS_ENTER_CRITICAL_SECTION(); stRtcosCtx.tstTasks[u08TaskID].u32EventFlags |= u32EventFlags; - EXIT_CRITICAL_SECTION(); + RTCOS_EXIT_CRITICAL_SECTION(); } else { @@ -700,10 +700,10 @@ rtcos_status_t rtcos_clear_event(_u08 u08TaskID, _u32 u32EventFlags) eRetVal = _rtcos_check_event_input(u08TaskID, u32EventFlags); if(RTCOS_ERR_NONE == eRetVal) { - ENTER_CRITICAL_SECTION(); + RTCOS_ENTER_CRITICAL_SECTION(); stRtcosCtx.tstTasks[u08TaskID].u32EventFlags &= ~(u32EventFlags); _rtcos_delete_future_event(u08TaskID, u32EventFlags); - EXIT_CRITICAL_SECTION(); + RTCOS_EXIT_CRITICAL_SECTION(); } return eRetVal; } @@ -727,9 +727,9 @@ _u32 rtcos_get_tick_count(void) { _u32 u32CurrTickCount; - ENTER_CRITICAL_SECTION(); + RTCOS_ENTER_CRITICAL_SECTION(); u32CurrTickCount = stRtcosCtx.u32SysTicksCount; - EXIT_CRITICAL_SECTION(); + RTCOS_EXIT_CRITICAL_SECTION(); return u32CurrTickCount; } @@ -759,9 +759,9 @@ void rtcos_run(void) while(1) { - ENTER_CRITICAL_SECTION(); + RTCOS_ENTER_CRITICAL_SECTION(); bFoundReadyTask = _rtcos_find_ready_task(&u08NewCurrTaskID); - EXIT_CRITICAL_SECTION(); + RTCOS_EXIT_CRITICAL_SECTION(); if(TRUE == bFoundReadyTask) { _rtcos_run_ready_task(u08NewCurrTaskID); @@ -784,7 +784,7 @@ void rtcos_update_tick(void) { _u08 u08Index; - ENTER_CRITICAL_SECTION(); + RTCOS_ENTER_CRITICAL_SECTION(); ++stRtcosCtx.u32SysTicksCount; for(u08Index = 0; u08Index < RTCOS_MAX_FUTURE_EVENTS_COUNT; ++u08Index) { @@ -831,7 +831,7 @@ void rtcos_update_tick(void) } } } - EXIT_CRITICAL_SECTION(); + RTCOS_EXIT_CRITICAL_SECTION(); } /** * @}