blob: f78c939f2ec8e37c3ec51f1ef6f9e7ebbc518d75 [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2000-2019 Ericsson Telecom AB //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v2.0 //
// which accompanies this distribution, and is available at //
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// Module: EPTF_CLL_RingBuffer_PrivateFunctions
//
// Purpose:
// This module supports private functions of ring buffer management
//
// Module Parameters:
// -
//
// Module depends on:
// <EPTF_CLL_RingBuffer_Definitions>
//
// Current Owner:
// Istvan Falusi (EISTFAL)
//
// Last Review Date:
// 2007-11-19
//
///////////////////////////////////////////////////////////
module EPTF_CLL_RingBuffer_PrivateFunctions
{
friend module EPTF_CLL_IntegerRingBuffer_Functions;
//=========================================================================
// Import Part
//=========================================================================
import from EPTF_CLL_RingBuffer_Definitions all;
//=========================================================================
// Private Functions
//=========================================================================
///////////////////////////////////////////////////////////
// Function: f_EPTF_RB_increment_tail
//
// Purpose:
// Function to increment the tail of a ring buffer.
//
// Parameters:
// pl_status - *inout* <EPTF_RingBufferStatus> - the status structure of ring buffer to be modified
//
// Return Value:
// -
//
///////////////////////////////////////////////////////////
friend function f_EPTF_RB_increment_tail( inout EPTF_RingBufferStatus pl_status )
{
pl_status.content_size := pl_status.content_size + 1;
pl_status.tail := (pl_status.tail + 1) mod pl_status.capacity;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_RB_increment_head
//
// Purpose:
// Function to increment the head of a ring buffer.
//
// Parameters:
// pl_status - *inout* <EPTF_RingBufferStatus> - the status structure of ring buffer to be modified
//
// Return Value:
// -
//
// Detailed Comments:
// Precondition of calling this function: ring buffer is not empty.
//
///////////////////////////////////////////////////////////
friend function f_EPTF_RB_increment_head( inout EPTF_RingBufferStatus pl_status )
{
pl_status.head := (pl_status.head + 1) mod pl_status.capacity;
pl_status.content_size := pl_status.content_size - 1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_RB_decrement_tail
//
// Purpose:
// Function to decrement the tail of a ring buffer.
//
// Parameters:
// pl_status - *inout* <EPTF_RingBufferStatus> - the status structure of ring buffer to be modified
//
// Return Value:
// -
//
// Detailed Comments:
// Precondition of calling this function: ring buffer is not empty.
//
///////////////////////////////////////////////////////////
friend function f_EPTF_RB_decrement_tail( inout EPTF_RingBufferStatus pl_status )
{
pl_status.tail := (pl_status.tail - 1) mod pl_status.capacity;
pl_status.content_size := pl_status.content_size - 1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_RB_decrement_head
//
// Purpose:
// Function to decrement the head of a ring buffer.
//
// Parameters:
// pl_status - *inout* <EPTF_RingBufferStatus> - the status structure of ring buffer to be modified
//
// Return Value:
// -
//
///////////////////////////////////////////////////////////
friend function f_EPTF_RB_decrement_head( inout EPTF_RingBufferStatus pl_status )
{
pl_status.content_size := pl_status.content_size + 1;
pl_status.head := (pl_status.head - 1) mod pl_status.capacity;
}
} // end of module