Skip to content

Commit

Permalink
updated stream buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
rajszym committed Oct 22, 2018
1 parent 64d5739 commit 9a6b639
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions StateOS/kernel/src/osstreambuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@file StateOS: osstreambuffer.c
@author Rajmund Szymanski
@date 16.10.2018
@date 22.10.2018
@brief This file provides set of functions for StateOS.
******************************************************************************
Expand Down Expand Up @@ -400,6 +400,22 @@ unsigned stm_sendUntil( stm_t *stm, const void *data, unsigned size, cnt_t time
return event;
}

/* -------------------------------------------------------------------------- */
static
unsigned priv_stm_push( stm_t *stm, const void *data, unsigned size )
/* -------------------------------------------------------------------------- */
{
if (size <= stm->limit)
{
priv_stm_skipUpdate(stm, size);
priv_stm_putUpdate(stm, data, size);

return E_SUCCESS;
}

return E_FAILURE;
}

/* -------------------------------------------------------------------------- */
unsigned stm_push( stm_t *stm, const void *data, unsigned size )
/* -------------------------------------------------------------------------- */
Expand All @@ -414,16 +430,7 @@ unsigned stm_push( stm_t *stm, const void *data, unsigned size )

sys_lock();
{
if (size <= stm->limit)
{
priv_stm_skipUpdate(stm, size);
priv_stm_putUpdate(stm, data, size);
event = E_SUCCESS;
}
else
{
event = E_FAILURE;
}
event = priv_stm_push(stm, data, size);
}
sys_unlock();

Expand Down

0 comments on commit 9a6b639

Please sign in to comment.