blob: de49bb4899af5015e81484ed7da84e1b0c748f9f [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001/*!
2 * @file hif_ior.h
3 * @author Roger Huang <chaomin.haung@mediatek.com>
4 * @version 1.0
5 * @section LICENSE
6 *
7 * This software is protected by Copyright and the information contained
8 * herein is confidential. The software may not be copied and the information
9 * contained herein may not be used or disclosed except with the written
10 * permission of MediaTek Inc. (C) 2005
11 *
12 * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
13 * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
14 * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
15 * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
18 * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
19 * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
20 * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
21 * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
22 * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
23 * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
24 *
25 * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
26 * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
27 * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
28 * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
29 * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
30 *
31 * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
32 * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
33 * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
34 * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
35 * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
36 *
37 * @section DESCRIPTION
38 * This file provides generic HIF IO Request interface of all HIF module
39 */
40
41#ifndef __HIF_IOR_H__
42#define __HIF_IOR_H__
43
44#include "qmu_bm.h"
45
46/*!
47 * @brief hif_io_request_t is a typedef of struct _hif_io_request
48 */
49typedef struct _hif_io_request hif_io_request_t;
50/*!
51 * @brief struct _hif_io_request describe io request used to communicate
52 * between hif modules
53 */
54struct _hif_io_request {
55 /*!
56 * @brief next io request
57 */
58 hif_io_request_t* next_request;
59 /*!
60 * @brief pointer to current gpd of this io request
61 */
62 qbm_gpd* first_gpd;
63 /*!
64 * @brief pointer to last gpd of this io request
65 */
66 qbm_gpd* last_gpd;
67};
68
69
70/*!
71 * @brief hif_io_request_list_t is a typedef of struct _hif_io_request_list
72 */
73typedef struct _hif_io_request_list hif_io_request_list_t;
74/*!
75 * @brief struct _hif_io_request_list describe io request list used to
76 * store io request
77 */
78struct _hif_io_request_list {
79 /*!
80 * @brief pointer to head of this io request list
81 */
82 hif_io_request_t* head;
83 /*!
84 * @brief pointer to tail of this io request list
85 */
86 hif_io_request_t* tail;
87};
88
89
90#define HIF_LIST_INIT(_list) \
91 ((_list)->head = (_list)->tail = NULL)
92
93
94#define HIF_LIST_IS_EMPTY(_list) \
95 ((_list)->head == NULL)
96
97
98#define HIF_LIST_GET_HEAD(_list) \
99 ((_list)->head)
100
101
102#define HIF_LIST_GET_TAIL(_list) \
103 ((_list)->tail)
104
105
106#define HIF_LIST_POP_HEAD(_list) \
107 ((_list)->head); \
108 { \
109 void* next; \
110 next = (_list)->head->next_request; \
111 (_list)->head = next; \
112 if (next == NULL) { \
113 (_list)->tail = NULL; \
114 } \
115 }
116
117
118#define HIF_LIST_PUSH_TAIL(_list, _entry) \
119 { \
120 (_entry)->next_request = NULL; \
121 if ((_list)->tail) { \
122 (_list)->tail->next_request = (_entry); \
123 } else { \
124 (_list)->head = (_entry); \
125 } \
126 (_list)->tail = (_entry); \
127 }
128
129#endif // __HIF_IOR_H__