blob: 9823506a571f7f71a329189f3b3de446649df23e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/* Copyright (c) 2011,2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/*
* Function and data structure declarations.
*/
#ifndef _SPS_CORE_H_
#define _SPS_CORE_H_
#include <linux/types.h> /* u32 */
#include <linux/mutex.h> /* mutex */
#include <linux/list.h> /* list_head */
#include "spsi.h"
#include "sps_bam.h"
/* Connection state definitions */
#define SPS_STATE_DEF(x) ('S' | ('P' << 8) | ('S' << 16) | ((x) << 24))
#define IS_SPS_STATE_OK(x) \
(((x)->client_state & 0x00ffffff) == SPS_STATE_DEF(0))
/* Configuration indicating satellite connection */
#define SPS_CONFIG_SATELLITE 0x11111111
/* Client connection state */
#define SPS_STATE_DISCONNECT 0
#define SPS_STATE_ALLOCATE SPS_STATE_DEF(1)
#define SPS_STATE_CONNECT SPS_STATE_DEF(2)
#define SPS_STATE_ENABLE SPS_STATE_DEF(3)
#define SPS_STATE_DISABLE SPS_STATE_DEF(4)
/* Connection mapping control struct */
struct sps_rm {
struct list_head connections_q;
struct mutex lock;
};
/**
* Find the BAM device from the handle
*
* This function finds a BAM device in the BAM registration list that
* matches the specified device handle.
*
* @h - device handle of the BAM
*
* @return - pointer to the BAM device struct, or NULL on error
*
*/
struct sps_bam *sps_h2bam(unsigned long h);
/**
* Initialize resource manager module
*
* This function initializes the resource manager module.
*
* @rm - pointer to resource manager struct
*
* @options - driver options bitflags (see SPS_OPT_*)
*
* @return 0 on success, negative value on error
*
*/
int sps_rm_init(struct sps_rm *rm, u32 options);
/**
* De-initialize resource manager module
*
* This function de-initializes the resource manager module.
*
*/
void sps_rm_de_init(void);
/**
* Initialize client state context
*
* This function initializes a client state context struct.
*
* @connect - pointer to client connection state struct
*
*/
void sps_rm_config_init(struct sps_connect *connect);
/**
* Process connection state change
*
* This function processes a connection state change.
*
* @pipe - pointer to pipe context
*
* @state - new state for connection
*
* @return 0 on success, negative value on error
*
*/
int sps_rm_state_change(struct sps_pipe *pipe, u32 state);
#endif /* _SPS_CORE_H_ */
|