blob: 357694a0aa7a3ec7f7c1a0ed21dafd0010f89194 [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/*******************************************************************************
2 * Copyright (C) 2007, ZTE Corporation.
3 *
4 * File Name:request_queue.h
5 * File Mark:
6 * Description:
7 * Others:
8 * Version: 1.0
9 * Author: geanfeng
10 * Date: 2013-09-25
11 * History 1:
12 * Date:
13 * Version:
14 * Author:
15 * Modification:
16 * History 2:
17 ********************************************************************************/
18
19#ifndef _REQUEST_QUEUE_H
20#define _REQUEST_QUEUE_H
21
22/****************************************************************************
23* Include files
24****************************************************************************/
25#include "drvs_general.h"
26#include "ring_queue.h"
27/****************************************************************************
28* Macros
29****************************************************************************/
30
31/****************************************************************************
32* Types
33****************************************************************************/
34typedef enum _T_QUEUE_STATE{
35 QUEUE_IDLE,
36 QUEUE_SUBMITING,
37 QUEUE_SUSPEND,
38 QUEUE_WORKING,
39}T_QUEUE_STATE;
40
41
42typedef struct _T_Request_Queue T_Request_Queue;
43typedef struct _T_Request T_Request;
44
45typedef SINT32 (*queue_notify)(T_Request_Queue *);
46
47
48/*
49 * request state
50 */
51typedef struct _T_Request_Queue {
52 T_Ring_Queue *queue;
53
54 T_QUEUE_STATE work_state;
55 T_QUEUE_STATE process_state;
56
57 queue_notify notify_fn;
58 VOID *queue_data;
59}T_Request_Queue;
60
61/*
62 * request
63 */
64typedef struct _T_Request {
65 VOID *data;
66}T_Request;
67
68
69
70/****************************************************************************
71* Constants
72****************************************************************************/
73
74/****************************************************************************
75* Global Variables
76****************************************************************************/
77
78/****************************************************************************
79* Function Prototypes
80****************************************************************************/
81T_Request_Queue *requestQueue_Create(unsigned long req_count, unsigned long req_size, queue_notify notify_fn, VOID* queue_data);
82
83SINT32 requestQueue_SubmitRequest(T_Request_Queue *q, T_Request *req);
84
85SINT32 requestQueue_FetchRequest(T_Request_Queue *q, T_Request *req);
86
87SINT32 requestQueue_Suspend(T_Request_Queue *q);
88
89SINT32 requestQueue_Resume(T_Request_Queue *q);
90
91VOID requestQueue_Destroy(T_Request_Queue *q);
92
93#endif/*_REQUEST_QUEUE_H*/
94