Skip to content

Commit

Permalink
tn_sys_tslice_ticks() -> tn_sys_tslice_set()
Browse files Browse the repository at this point in the history
  • Loading branch information
dimonomid committed Oct 1, 2014
1 parent 80884d1 commit 202906e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
3 changes: 3 additions & 0 deletions src/core/tn_oldsymbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ typedef struct TN_Sem TN_SEM;
/// old TNKernel name of `#tn_sys_start`
#define tn_start_system tn_sys_start

/// old TNKernel name of `#tn_sys_tslice_set`
#define tn_sys_tslice_ticks tn_sys_tslice_set



/// old TNKernel name of `#TN_ARCH_STK_ATTR_BEFORE`
Expand Down
6 changes: 3 additions & 3 deletions src/core/tn_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ enum TN_RCode tn_tick_int_processing(void)
/*
* See comments in the header file (tn_sys.h)
*/
enum TN_RCode tn_sys_tslice_ticks(int priority, int value)
enum TN_RCode tn_sys_tslice_set(int priority, int ticks)
{
enum TN_RCode rc = TN_RC_OK;

Expand All @@ -345,15 +345,15 @@ enum TN_RCode tn_sys_tslice_ticks(int priority, int value)
}

if ( priority <= 0 || priority >= (TN_PRIORITIES_CNT - 1)
|| value < 0 || value > TN_MAX_TIME_SLICE)
|| ticks < 0 || ticks > TN_MAX_TIME_SLICE)
{
rc = TN_RC_WPARAM;
goto out;
}

TN_INT_DIS_SAVE();

tn_tslice_ticks[priority] = value;
tn_tslice_ticks[priority] = ticks;

TN_INT_RESTORE();

Expand Down
20 changes: 10 additions & 10 deletions src/core/tn_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ typedef void (TN_CBDeadlock)(
******************************************************************************/

/**
* Value to pass to `tn_sys_tslice_ticks()` to turn round-robin off.
* Value to pass to `tn_sys_tslice_set()` to turn round-robin off.
*/
#define TN_NO_TIME_SLICE 0

Expand Down Expand Up @@ -257,24 +257,24 @@ void tn_sys_start(
enum TN_RCode tn_tick_int_processing(void);

/**
* Set time slice ticks value for specified priority (round-robin scheduling).
* Set time slice ticks value for specified priority (see \ref round_robin).
*
* $(TN_CALL_FROM_TASK)
* $(TN_LEGEND_LINK)
*
* @param priority priority of tasks for which time slice value should be set
* @param value time slice value. Set to `#TN_NO_TIME_SLICE` for no
* round-robin scheduling for given priority
* (it's default value).
* Value can't be higher than `#TN_MAX_TIME_SLICE`.
* @param priority
* Priority of tasks for which time slice value should be set
* @param ticks
* Time slice value, in ticks. Set to `#TN_NO_TIME_SLICE` for no round-robin
* scheduling for given priority (it's default value). Value can't be
* higher than `#TN_MAX_TIME_SLICE`.
*
* @return
* * `#TN_RC_OK` on success;
* * `#TN_RC_WCONTEXT` if called from wrong context;
* * If `#TN_CHECK_PARAM` is non-zero, additional return codes
* are available: `#TN_RC_WPARAM` and `#TN_RC_INVALID_OBJ`.
* * `#TN_RC_WPARAM` if given `priority` or `ticks` are invalid.
*/
enum TN_RCode tn_sys_tslice_ticks(int priority, int value);
enum TN_RCode tn_sys_tslice_set(int priority, int ticks);

/**
* Get current system ticks count.
Expand Down
2 changes: 1 addition & 1 deletion stuff/doc_pages/quick_guide.dox
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ TNKernel has the ability to make round robin scheduling for tasks with
identical priority. By default, round robin scheduling is turned off for
all priorities. To enable round robin scheduling for tasks on certain
priority level and to set time slices for these priority, user must call the
`tn_sys_tslice_ticks()` function. The time slice value is the same for all
`tn_sys_tslice_set()` function. The time slice value is the same for all
tasks with identical priority but may be different for each priority level.
If the round robin scheduling is enabled, every system time tick interrupt
increments the currently running task time slice counter. When the time
Expand Down

0 comments on commit 202906e

Please sign in to comment.