Skip to content

Commit

Permalink
minor porting modifs
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizoku-oh committed Apr 11, 2021
1 parent 53ebe2d commit 08b85d1
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 50 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: Build

on:
push:
branches: [ main ]
branches:
- '*'
pull_request:
branches: [ main ]
branches:
- '*'

jobs:
build:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/rtcos_doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions examples/arduino/include/RTCOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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 */
2 changes: 1 addition & 1 deletion examples/arduino/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion examples/arduino/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
6 changes: 3 additions & 3 deletions examples/linux/RTCOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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 */
2 changes: 1 addition & 1 deletion examples/linux/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
14 changes: 7 additions & 7 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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 */
2 changes: 1 addition & 1 deletion include/rtcos.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -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":
Expand Down
58 changes: 29 additions & 29 deletions src/rtcos.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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();
}

/** ***********************************************************************************************
Expand Down Expand Up @@ -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)
{
Expand All @@ -372,7 +372,7 @@ static rtcos_status_t _rtcos_add_future_event(_u08 u08TaskID,
}
}
}
EXIT_CRITICAL_SECTION();
RTCOS_EXIT_CRITICAL_SECTION();
return eRetVal;
}

Expand Down Expand Up @@ -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
{
Expand All @@ -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
{
Expand All @@ -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;
Expand All @@ -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;
}

Expand All @@ -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;
Expand All @@ -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;
}

Expand All @@ -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;
Expand All @@ -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;
}

Expand All @@ -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) >
Expand All @@ -649,7 +649,7 @@ _bool rtcos_timer_expired(_u08 u08TimerID)
bExpired = TRUE;
}
}
EXIT_CRITICAL_SECTION();
RTCOS_EXIT_CRITICAL_SECTION();
return bExpired;
}

Expand All @@ -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
{
Expand All @@ -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;
}
Expand All @@ -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;
}

Expand Down Expand Up @@ -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);
Expand All @@ -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)
{
Expand Down Expand Up @@ -831,7 +831,7 @@ void rtcos_update_tick(void)
}
}
}
EXIT_CRITICAL_SECTION();
RTCOS_EXIT_CRITICAL_SECTION();
}
/**
* @}
Expand Down

0 comments on commit 08b85d1

Please sign in to comment.