Blame view

RIOT/drivers/include/mtd_sdcard.h 1.56 KB
a752c7ab   elopes   add first test an...
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
  /*
   * Copyright (C) 2017 HAW-Hamburg
   *
   * This file is subject to the terms and conditions of the GNU Lesser
   * General Public License v2.1. See the file LICENSE in the top level
   * directory for more details.
   */
  
  /**
   * @defgroup    drivers_mtd_sdcard mtd wrapper for sdcard_spi
   * @ingroup     drivers_storage
   * @brief       Driver for SD-cards using mtd interface
   *
   * @{
   *
   * @file
   * @brief       Interface definition for mtd_sdcard driver
   *
   * @author      Michel Rottleuthner <michel.rottleuthner@haw-hamburg.de>
   */
  
  #ifndef MTD_SDCARD_H
  #define MTD_SDCARD_H
  
  #include <stdint.h>
  
  #include "sdcard_spi.h"
  #include "mtd.h"
  
  #ifdef __cplusplus
  extern "C"
  {
  #endif
  
  /**
   * @brief   Device descriptor for mtd_sdcard device
   *
   * This is an extension of the @c mtd_dev_t struct
   */
  typedef struct {
      mtd_dev_t base;                    /**< inherit from mtd_dev_t object */
      sdcard_spi_t *sd_card;             /**< sdcard_spi dev descriptor */
      const sdcard_spi_params_t *params; /**< params for sdcard_spi init */
  } mtd_sdcard_t;
  
  
  /**
   * @brief   sdcards handle sector erase internally so it's possible to directly
   *          write to the card without erasing the sector first.
   *          Attention: an erase call will therefore NOT touch the content,
   *                     so disable this feature to ensure overriding the data.
   */
  #ifndef MTD_SDCARD_SKIP_ERASE
  #define MTD_SDCARD_SKIP_ERASE (1)
  #endif
  
  /**
   * @brief   sdcard device operations table for mtd
   */
  extern const mtd_desc_t mtd_sdcard_driver;
  
  #ifdef __cplusplus
  }
  #endif
  
  #endif /* MTD_SDCARD_H */
  /** @} */