A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita
audio
rust
zig
deno
mpris
rockbox
mpd
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Alan Korr
11 * Copyright (C) 2008 by Frank Gevaerts
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ****************************************************************************/
22#ifndef __MMC_H__
23#define __MMC_H__
24
25#include <stdbool.h>
26#include "config.h"
27#include "mv.h" /* for HAVE_MULTIDRIVE or not */
28
29struct storage_info;
30
31void mmc_enable(bool on);
32void mmc_spindown(int seconds);
33void mmc_sleep(void);
34void mmc_sleepnow(void);
35bool mmc_disk_is_active(void);
36int mmc_soft_reset(void);
37int mmc_init(void) STORAGE_INIT_ATTR;
38void mmc_close(void);
39int mmc_read_sectors(IF_MD(int drive,) sector_t start, int count, void* buf);
40int mmc_write_sectors(IF_MD(int drive,) sector_t start, int count, const void* buf);
41void mmc_spin(void);
42int mmc_spinup_time(void);
43
44#ifdef STORAGE_GET_INFO
45void mmc_get_info(IF_MD(int drive,) struct storage_info *info);
46#endif
47#ifdef HAVE_HOTSWAP
48bool mmc_removable(IF_MD_NONVOID(int drive));
49bool mmc_present(IF_MD_NONVOID(int drive));
50#endif
51
52long mmc_last_disk_activity(void);
53
54#ifdef CONFIG_STORAGE_MULTI
55int mmc_num_drives(int first_drive);
56#endif
57
58/* MMC States */
59#define MMC_IDLE 0
60#define MMC_READY 1
61#define MMC_IDENT 2
62#define MMC_STBY 3
63#define MMC_TRAN 4
64#define MMC_DATA 5
65#define MMC_RCV 6
66#define MMC_PRG 7
67#define MMC_DIS 8
68#define MMC_BTST 9
69
70/* MMC Commands */
71#define MMC_GO_IDLE_STATE 0
72#define MMC_SEND_OP_COND 1
73#define MMC_ALL_SEND_CID 2
74#define MMC_SET_RELATIVE_ADDR 3
75#define MMC_SET_DSR 4
76#define MMC_SWITCH 6
77#define MMC_SELECT_CARD 7 /* with card's rca */
78#define MMC_DESELECT_CARD 7 /* with rca = 0 */
79#define MMC_SEND_EXT_CSD 8
80#define MMC_SEND_CSD 9
81#define MMC_SEND_CID 10
82#define MMC_READ_DAT_UNTIL_STOP 11
83#define MMC_STOP_TRANSMISSION 12
84#define MMC_SEND_STATUS 13
85#define MMC_BUSTEST_R 14
86#define MMC_GO_INACTIVE_STATE 15
87#define MMC_SET_BLOCKLEN 16
88#define MMC_READ_SINGLE_BLOCK 17
89#define MMC_READ_MULTIPLE_BLOCK 18
90#define MMC_BUSTEST_W 19
91#define MMC_WRITE_DAT_UNTIL_STOP 20
92#define MMC_SET_BLOCK_COUNT 23
93#define MMC_WRITE_BLOCK 24
94#define MMC_WRITE_MULTIPLE_BLOCK 25
95#define MMC_PROGRAM_CID 26
96#define MMC_PROGRAM_CSD 27
97#define MMC_SET_WRITE_PROT 28
98#define MMC_CLR_WRITE_PROT 29
99#define MMC_SEND_WRITE_PROT 30
100#define MMC_ERASE_GROUP_START 35
101#define MMC_ERASE_GROUP_END 36
102#define MMC_ERASE 38
103#define MMC_FAST_IO 39
104#define MMC_GO_IRQ_STATE 40
105#define MMC_LOCK_UNLOCK 42
106#define MMC_APP_CMD 55
107#define MMC_GEN_CMD 56
108
109#endif