Commit | Line | Data |
---|---|---|
fd6f4b0d TS |
1 | /* |
2 | * bebob.h - a part of driver for BeBoB based devices | |
3 | * | |
4 | * Copyright (c) 2013-2014 Takashi Sakamoto | |
5 | * | |
6 | * Licensed under the terms of the GNU General Public License, version 2. | |
7 | */ | |
8 | ||
9 | #ifndef SOUND_BEBOB_H_INCLUDED | |
10 | #define SOUND_BEBOB_H_INCLUDED | |
11 | ||
12 | #include <linux/compat.h> | |
13 | #include <linux/device.h> | |
14 | #include <linux/firewire.h> | |
15 | #include <linux/firewire-constants.h> | |
16 | #include <linux/module.h> | |
17 | #include <linux/mod_devicetable.h> | |
18 | #include <linux/delay.h> | |
19 | #include <linux/slab.h> | |
20 | ||
21 | #include <sound/core.h> | |
22 | #include <sound/initval.h> | |
23 | ||
24 | #include "../lib.h" | |
25 | #include "../fcp.h" | |
26 | ||
27 | /* basic register addresses on DM1000/DM1100/DM1500 */ | |
28 | #define BEBOB_ADDR_REG_INFO 0xffffc8020000 | |
29 | #define BEBOB_ADDR_REG_REQ 0xffffc8021000 | |
30 | ||
31 | struct snd_bebob { | |
32 | struct snd_card *card; | |
33 | struct fw_unit *unit; | |
34 | int card_index; | |
35 | ||
36 | struct mutex mutex; | |
37 | spinlock_t lock; | |
38 | }; | |
39 | ||
40 | static inline int | |
41 | snd_bebob_read_block(struct fw_unit *unit, u64 addr, void *buf, int size) | |
42 | { | |
43 | return snd_fw_transaction(unit, TCODE_READ_BLOCK_REQUEST, | |
44 | BEBOB_ADDR_REG_INFO + addr, | |
45 | buf, size, 0); | |
46 | } | |
47 | ||
48 | static inline int | |
49 | snd_bebob_read_quad(struct fw_unit *unit, u64 addr, u32 *buf) | |
50 | { | |
51 | return snd_fw_transaction(unit, TCODE_READ_QUADLET_REQUEST, | |
52 | BEBOB_ADDR_REG_INFO + addr, | |
53 | (void *)buf, sizeof(u32), 0); | |
54 | } | |
55 | ||
56 | #define SND_BEBOB_DEV_ENTRY(vendor, model) \ | |
57 | { \ | |
58 | .match_flags = IEEE1394_MATCH_VENDOR_ID | \ | |
59 | IEEE1394_MATCH_MODEL_ID, \ | |
60 | .vendor_id = vendor, \ | |
61 | .model_id = model, \ | |
62 | } | |
63 | ||
64 | #endif |