1 |
/* |
---|
2 |
* Copyright (C) 2009 by Jonathan Woithe |
---|
3 |
* |
---|
4 |
* This file is part of FFADO |
---|
5 |
* FFADO = Free Firewire (pro-)audio drivers for linux |
---|
6 |
* |
---|
7 |
* FFADO is based upon FreeBoB. |
---|
8 |
* |
---|
9 |
* This program is free software: you can redistribute it and/or modify |
---|
10 |
* it under the terms of the GNU General Public License as published by |
---|
11 |
* the Free Software Foundation, either version 2 of the License, or |
---|
12 |
* (at your option) version 3 of the License. |
---|
13 |
* |
---|
14 |
* This program is distributed in the hope that it will be useful, |
---|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 |
* GNU General Public License for more details. |
---|
18 |
* |
---|
19 |
* You should have received a copy of the GNU General Public License |
---|
20 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
21 |
* |
---|
22 |
*/ |
---|
23 |
|
---|
24 |
#ifndef _RME_SHM_H |
---|
25 |
#define _RME_SHM_H |
---|
26 |
|
---|
27 |
#include <stdint.h> |
---|
28 |
#include <pthread.h> |
---|
29 |
#include "fireface_def.h" |
---|
30 |
|
---|
31 |
/* Structure used within shared memory object */ |
---|
32 |
|
---|
33 |
typedef struct rme_shm_t { |
---|
34 |
signed int ref_count; |
---|
35 |
signed int settings_valid, tco_settings_valid; |
---|
36 |
FF_software_settings_t settings; |
---|
37 |
signed int tco_present; |
---|
38 |
FF_TCO_settings_t tco_settings; |
---|
39 |
|
---|
40 |
signed int dds_freq; // Optionally explicitly set hardware freq |
---|
41 |
signed int software_freq; // Sampling frequency in use by software |
---|
42 |
signed int hardware_freq; // Frequency actually programmed into hardware |
---|
43 |
|
---|
44 |
signed int is_streaming; |
---|
45 |
|
---|
46 |
pthread_mutex_t lock; |
---|
47 |
} rme_shm_t; |
---|
48 |
|
---|
49 |
/* Return values from rme_shm_open(). RSO = Rme Shared Object. */ |
---|
50 |
#define RSO_ERR_MMAP -3 |
---|
51 |
#define RSO_ERR_SHM -2 |
---|
52 |
#define RSO_ERROR -1 |
---|
53 |
#define RSO_OPEN_CREATED 0 |
---|
54 |
#define RSO_OPEN_ATTACHED 1 |
---|
55 |
|
---|
56 |
/* Return values from rme_shm_close() */ |
---|
57 |
#define RSO_CLOSE 0 |
---|
58 |
#define RSO_CLOSE_DELETE 1 |
---|
59 |
|
---|
60 |
/* Functions */ |
---|
61 |
|
---|
62 |
void rme_shm_lock(rme_shm_t *shm_data); |
---|
63 |
void rme_shm_unlock(rme_shm_t *shm_data); |
---|
64 |
signed int rme_shm_open(rme_shm_t **shm_data); |
---|
65 |
signed int rme_shm_close(rme_shm_t *shm_data); |
---|
66 |
|
---|
67 |
#endif |
---|