blob: 98b46708a041a542eea76ca8721d558775ecca60 [file] [log] [blame]
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* kal_hrt_defs.h
*
* Project:
* --------
* Maui_Software
*
* Description:
* ------------
* This file provides KAL Hard Realtime Domain definitions
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
#ifndef __KAL_HRT_DEFS_H__
#define __KAL_HRT_DEFS_H__
#if !defined(__PRODUCTION_RELEASE__)
/* under construction !*/
#endif /* __PRODUCTION_RELEASE__ */
typedef struct kal_workqueue_node {
void * func_ptr;
void * func_param;
kal_uint16 func_index;
//kal_uint8 reserved0;
//kal_uint8 reserved1;
#if defined(MT_FLOW_DEBUG)
kal_uint32 insert_timestamp;
#endif /*MT_FLOW_DEBUG*/
} kal_workqueue_node_t;
#define MT_Q_HDR \
kal_uint32 head; \
kal_uint32 tail; \
kal_uint32 total_item; \
kal_uint32 lock; \
kal_bool is_full; \
kal_uint8 is_nested_irq_shared;
typedef struct kal_workqueue_struct {
MT_Q_HDR
kal_workqueue_node_t queue[1];
} kal_workqueue_struct;
/* Circular queue definition for HRT domain */
#define HRT_CQUEUE(_q, _length) \
struct { \
MT_Q_HDR \
kal_workqueue_node_t queue[_length]; \
} _q = { \
.head = 0, \
.tail = 0, \
.total_item = _length, \
.lock = 0, \
.is_full = KAL_FALSE, \
.is_nested_irq_shared = KAL_FALSE, \
}
#if defined(MT_FLOW_DEBUG)
#define HRT_CQUEUE_INSERT(_q, _item) \
do { \
_item.insert_timestamp = ust_get_current_time(); \
(_q).queue[(_q).tail] = _item; \
(_q).tail++; \
if ((_q).tail == (_q).total_item) \
(_q).tail = 0; \
if ((_q).head == (_q).tail) \
(_q).is_full = KAL_TRUE; \
} while (0)
#else
#define HRT_CQUEUE_INSERT(_q, _item) \
do { \
(_q).queue[(_q).tail] = _item; \
(_q).tail++; \
if ((_q).tail == (_q).total_item) \
(_q).tail = 0; \
if ((_q).head == (_q).tail) \
(_q).is_full = KAL_TRUE; \
} while (0)
#endif
#define HRT_CQUEUE_DISCARD(_q) \
do { \
(_q).head++; \
if ((_q).head == (_q).total_item) \
(_q).head = 0; \
if ((_q).is_full == KAL_TRUE) \
(_q).is_full = KAL_FALSE; \
} while (0)
#define HRT_CQUEUE_IS_FULL(_q) ((_q).is_full)
#define HRT_CQUEUE_IS_EMPTY(_q) (((_q).head == (_q).tail) && !(_q).is_full)
#if defined(__MD97__) || defined(__MD97P__)
/* 3 vpes/core, each vpe has 1 child tc*/
#define MT_TCID_TO_WQID(tcid) 0
/* only parent tc can call this */
#define MT_WQID_TO_TCID(wqid) (miu_get_current_tc_id() + wqid + 1)
#else
#error no MT config yet
#endif
#define HRT_MT_SHARED_Q KAL_Q_MAX
/* LISR multi-threading structure */
#define LISR_MT_MAGIC_ID 0x454E4D54 // ENMT
typedef struct {
kal_uint32 magic_id;
kal_uint32 wait;
kal_workqueue_struct *wq[KAL_Q_MAX];
} kal_lisr_mt;
typedef struct {
void *mt_stack_ptr[KAL_Q_MAX];
} kal_mt_stack_ptr;
#endif /* __KAL_HRT_DEFS_H__ */