blob: 851cb2323b1374a5922b99e0240b755855192657 [file] [log] [blame]
/*
* Copyright (c) [2009-2013] Marvell International Ltd. and its affiliates.
* All rights reserved.
* This software file (the "File") is owned and distributed by Marvell
* International Ltd. and/or its affiliates ("Marvell") under the following
* licensing terms.
* If you received this File from Marvell, you may opt to use, redistribute
* and/or modify this File in accordance with the terms and conditions of
* the General Public License Version 2, June 1991 (the "GPL License"), a
* copy of which is available along with the File in the license.txt file
* or by writing to the Free Software Foundation, Inc., 59 Temple Place,
* Suite 330, Boston, MA 02111-1307 or on the worldwide web at
* http://www.gnu.org/licenses/gpl.txt. THE FILE IS DISTRIBUTED AS-IS,
* WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED WARRANTIES OF
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY
* DISCLAIMED. The GPL License provides additional details about this
* warranty disclaimer.
*/
#include "tee_client_api.h"
#include "tee_cm_internal.h"
#include "tee_cm.h"
extern void *in_header;
extern void *out_header;
static int32_t _g_idx_out_write;
/* _g_idx_in_read is initialized in tee_cm_init */
int32_t _g_idx_in_read;
/* get in read idx's pointer */
inline int32_t *_cm_in_read_idx(void)
{
return &_g_idx_in_read;
}
/* get in write idx's pointer(the other end modify) */
inline int32_t *_cm_in_write_idx(void)
{
cm_index_header_t *in_head = (cm_index_header_t *) in_header;
return &(in_head->idx_write);
}
/* get out read idx's pointer(the other and modify */
/* _cm_out_read_idx and _cm_out_write_idx are replaced
* by _cm_get_out_write_idx and _cm_update_out_write_idx
*/
inline int32_t *_cm_out_read_idx(void)
{
cm_index_header_t *out_head = (cm_index_header_t *) out_header;
return &(out_head->idx_read);
}
/* get out write idx's pointer */
inline int32_t *_cm_out_write_idx(void)
{
static int32_t idx_out_write;
return &idx_out_write;
}
inline int32_t _cm_get_out_write_idx(void)
{
return _g_idx_out_write;
}
inline void _cm_update_out_write_idx(int32_t idx)
{
cm_index_header_t *out_head = (cm_index_header_t *) out_header;
_g_idx_out_write = idx;
out_head->idx_write = idx;
return;
}
inline uint32_t _cm_get_cb_req_num(void)
{
cm_index_header_t *in_head = (cm_index_header_t*)in_header;
return in_head->req_tw;
}
inline uint32_t _cm_get_cb_rsp_num(void)
{
cm_index_header_t *in_head = (cm_index_header_t*)in_header;
return in_head->rsp_tw;
}