-
Notifications
You must be signed in to change notification settings - Fork 2
/
sd_raw_config.h
executable file
·157 lines (126 loc) · 3.53 KB
/
sd_raw_config.h
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*
* Copyright (c) 2006-2009 by Roland Riegel <feedback@roland-riegel.de>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either the GNU General Public License version 2
* or the GNU Lesser General Public License version 2.1, both as
* published by the Free Software Foundation.
*/
#ifndef SD_RAW_CONFIG_H
#define SD_RAW_CONFIG_H
#include <stdint.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* \ingroup hardware
* \addtogroup sd_raw
*
* @{
*/
/**
* \file
* MMC/SD support configuration (license: GPLv2 or LGPLv2.1)
*/
/**
* \ingroup sd_raw_config
* Controls MMC/SD write support.
*
* Set to 1 to enable MMC/SD write support, set to 0 to disable it.
*/
#define SD_RAW_WRITE_SUPPORT 1
/**
* \ingroup sd_raw_config
* Controls MMC/SD write buffering.
*
* Set to 1 to buffer write accesses, set to 0 to disable it.
*
* \note This option has no effect when SD_RAW_WRITE_SUPPORT is 0.
*/
#define SD_RAW_WRITE_BUFFERING 0
/**
* \ingroup sd_raw_config
* Controls MMC/SD access buffering.
*
* Set to 1 to save static RAM, but be aware that you will
* lose performance.
*
* \note When SD_RAW_WRITE_SUPPORT is 1, SD_RAW_SAVE_RAM will
* be reset to 0.
*/
#define SD_RAW_SAVE_RAM 1
/**
* \ingroup sd_raw_config
* Controls support for SDHC cards.
*
* Set to 1 to support so-called SDHC memory cards, i.e. SD
* cards with more than 2 gigabytes of memory.
*/
#define SD_RAW_SDHC 0
/**
* @}
*/
/* defines for customisation of sd/mmc port access */
// defines for the MMC-interface on myAVR
#if defined(myAVR)
#define spi_bus_num 1
#define configure_pin_ss() DDRC |= (1 << DDC6)
#define ss_PIN PC6
#define ss_PORT PORTC
#define get_pin_available() 0
#define get_pin_locked() 1
#elif defined(ATXM2)
#define spi_bus_num 1
#define configure_pin_ss() PORTD.DIRSET |= (1 << 4)
#define ss_PIN 4
#define ss_PORT PORTD.OUT
#define get_pin_available() 0
#define get_pin_locked() 1
// defines for the AVR-NETIO addon MMC-interface and the OpenMCP MMC-addon on AVR-NETIO
#elif defined(AVRNETIO)
#if defined(AVRNETIO_ADDON)
#define spi_bus_num 0
#define configure_pin_ss() DDRB |= (1 << DDD3)
#define ss_PIN PB3
#define ss_PORT PORTB
#define configure_pin_available() DDRD &= ~(1 << DDD7)
#define configure_pin_available_pullup() PORTD |= (1 << PD7)
#define get_pin_available() 0
#define get_pin_locked() 1
#elif defined(NONE_ADDON)
#define spi_bus_num 1
#define configure_pin_ss() DDRD |= (1 << DDD3)
#define ss_PIN PD3
#define ss_PORT PORTD
#define configure_pin_available() DDRD &= ~(1 << DDD6)
#define configure_pin_available_pullup() PORTD |= (1 << PD6)
#define get_pin_available() ( (PIND >> PD6) & 0x01)
#define get_pin_locked() (~(PINB >> PB3) & 0x01)
#define configure_pin_locked() DDRB &= ~(1 << DDB3)
#define configure_pin_locked_pullup() PORTB |= (1 << PB3)
#define configure_power_up() DDRD |= ( 1 << DDD7 )
#define power_up() PORTD |= (1 << PD7 )
#else
#error "None MMC-interface defined."
#endif
#else
#error "Hardwareplattform doesn't support MMC-interface!"
#endif
#if SD_RAW_SDHC
typedef uint64_t offset_t;
#else
typedef uint32_t offset_t;
#endif
/* configuration checks */
#if SD_RAW_WRITE_SUPPORT
#undef SD_RAW_SAVE_RAM
#define SD_RAW_SAVE_RAM 0
#else
#undef SD_RAW_WRITE_BUFFERING
#define SD_RAW_WRITE_BUFFERING 0
#endif
#ifdef __cplusplus
}
#endif
#endif