Blame view

RIOT/boards/native/board_init.c 1.35 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
  /**
   * Native Board board_init implementation
   *
   * Copyright (C) 2014 Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
   *
   * 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.
   *
   * @ingroup native_board
   * @{
   * @file
   * @author  Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
   * @}
   */
  #include <stdio.h>
  #include "board.h"
  
  #include "board_internal.h"
  
  #ifdef MODULE_MTD
  #include "mtd_native.h"
  #endif
  
  /**
   * Nothing to initialize at the moment.
   * Turns the red LED on and the green LED off.
   */
  void board_init(void)
  {
      LED0_OFF;
      LED1_ON;
      puts("RIOT native board initialized.");
  }
  
  #ifdef MODULE_MTD
  #ifndef MTD_NATIVE_PAGE_SIZE
  #define MTD_NATIVE_PAGE_SIZE     256
  #endif
  #ifndef MTD_NATIVE_SECTOR_SIZE
  #define MTD_NATIVE_SECTOR_SIZE   4096
  #endif
  #ifndef MTD_NATIVE_SECTOR_NUM
  #define MTD_NATIVE_SECTOR_NUM    2048
  #endif
  #ifndef MTD_NATIVE_FILENAME
  #define MTD_NATIVE_FILENAME    "MEMORY.bin"
  #endif
  
  static mtd_native_dev_t mtd0_dev = {
      .dev = {
          .driver = &native_flash_driver,
          .sector_count = MTD_NATIVE_SECTOR_NUM,
          .pages_per_sector = MTD_NATIVE_SECTOR_SIZE / MTD_NATIVE_PAGE_SIZE,
          .page_size = MTD_NATIVE_PAGE_SIZE,
      },
      .fname = MTD_NATIVE_FILENAME,
  };
  
  mtd_dev_t *mtd0 = (mtd_dev_t *)&mtd0_dev;
  #endif