Drop BeRTOS SD and FAT modules
[rmslog.git] / FAT16 / sd_raw_config.h
1
2 /*
3  * Copyright (c) 2006-2009 by Roland Riegel <feedback@roland-riegel.de>
4  *
5  * This file is free software; you can redistribute it and/or modify
6  * it under the terms of either the GNU General Public License version 2
7  * or the GNU Lesser General Public License version 2.1, both as
8  * published by the Free Software Foundation.
9  */
10
11 #ifndef SD_RAW_CONFIG_H
12 #define SD_RAW_CONFIG_H
13
14 #include <stdint.h>
15
16 #ifdef __cplusplus
17 extern "C"
18 {
19 #endif
20
21 /**
22  * \addtogroup sd_raw
23  *
24  * @{
25  */
26 /**
27  * \file
28  * MMC/SD support configuration (license: GPLv2 or LGPLv2.1)
29  */
30
31 /**
32  * \ingroup sd_raw_config
33  * Controls MMC/SD write support.
34  *
35  * Set to 1 to enable MMC/SD write support, set to 0 to disable it.
36  */
37 #define SD_RAW_WRITE_SUPPORT 1
38
39 /**
40  * \ingroup sd_raw_config
41  * Controls MMC/SD write buffering.
42  *
43  * Set to 1 to buffer write accesses, set to 0 to disable it.
44  *
45  * \note This option has no effect when SD_RAW_WRITE_SUPPORT is 0.
46  */
47 #define SD_RAW_WRITE_BUFFERING 1
48
49 /**
50  * \ingroup sd_raw_config
51  * Controls MMC/SD access buffering.
52  * 
53  * Set to 1 to save static RAM, but be aware that you will
54  * lose performance.
55  *
56  * \note When SD_RAW_WRITE_SUPPORT is 1, SD_RAW_SAVE_RAM will
57  *       be reset to 0.
58  */
59 #define SD_RAW_SAVE_RAM 1
60
61 /**
62  * \ingroup sd_raw_config
63  * Controls support for SDHC cards.
64  *
65  * Set to 1 to support so-called SDHC memory cards, i.e. SD
66  * cards with more than 2 gigabytes of memory.
67  */
68 #define SD_RAW_SDHC 0
69
70 /**
71  * @}
72  */
73
74 /* defines for customisation of sd/mmc port access */
75 /*#if defined(__AVR_ATmega8__) || \
76     defined(__AVR_ATmega48__) || \
77     defined(__AVR_ATmega88__) || \
78     defined(__AVR_ATmega168__) || \
79     defined(__AVR_ATmega328__) || \
80         defined(__AVR_atmega328p__)
81 */
82     #define configure_pin_mosi() DDRB |= (1 << DDB3)
83     #define configure_pin_sck() DDRB |= (1 << DDB5)
84     #define configure_pin_ss() DDRB |= (1 << DDB0)
85     #define configure_pin_miso() DDRB &= ~(1 << DDB4)
86
87     #define select_card() PORTB &= ~(1 << PINB0)
88     #define unselect_card() PORTB |= (1 << PINB0)
89 /*
90 #elif defined(__AVR_ATmega16__) || \
91       defined(__AVR_ATmega32__)
92     #define configure_pin_mosi() DDRB |= (1 << DDB5)
93     #define configure_pin_sck() DDRB |= (1 << DDB7)
94     #define configure_pin_ss() DDRB |= (1 << DDB4)
95     #define configure_pin_miso() DDRB &= ~(1 << DDB6)
96
97     #define select_card() PORTB &= ~(1 << PB4)
98     #define unselect_card() PORTB |= (1 << PB4)
99 #elif defined(__AVR_ATmega64__) || \
100       defined(__AVR_ATmega128__) || \
101       defined(__AVR_ATmega169__)
102     #define configure_pin_mosi() DDRB |= (1 << DDB2)
103     #define configure_pin_sck() DDRB |= (1 << DDB1)
104     #define configure_pin_ss() DDRB |= (1 << DDB0)
105     #define configure_pin_miso() DDRB &= ~(1 << DDB3)
106
107     #define select_card() PORTB &= ~(1 << PB0)
108     #define unselect_card() PORTB |= (1 << PB0)
109 #else
110     #error "no sd/mmc pin mapping available!"
111 #endif
112 */
113 /*
114 #define configure_pin_available() DDRC &= ~(1 << DDC4)
115 #define configure_pin_locked() DDRC &= ~(1 << DDC5)
116
117 #define get_pin_available() ((PINC >> PINC4) & 0x01)
118 #define get_pin_locked() ((PINC >> PINC5) & 0x01)
119 */
120 #define configure_pin_available() //NOTHING
121 #define configure_pin_locked() //Nothing
122
123 #define get_pin_available() 0
124 #define get_pin_locked() 1
125
126 #if SD_RAW_SDHC
127     typedef uint64_t offset_t;
128 #else
129     typedef uint32_t offset_t;
130 #endif
131
132 /* configuration checks */
133 #if SD_RAW_WRITE_SUPPORT
134 #undef SD_RAW_SAVE_RAM
135 #define SD_RAW_SAVE_RAM 0
136 #else
137 #undef SD_RAW_WRITE_BUFFERING
138 #define SD_RAW_WRITE_BUFFERING 0
139 #endif
140
141 #ifdef __cplusplus
142 }
143 #endif
144
145 #endif
146