1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/boards/native/board_init.c
2018-01-27 08:42:31 +01:00

70 lines
1.5 KiB
C

/**
* 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 "periph/rtc.h"
#include "periph/hwrng.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;
#ifdef MODULE_PERIPH_RTC
rtc_init();
#endif
#ifdef MODULE_PERIPH_HWRNG
hwrng_init();
#endif
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