board.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Benjamin Valentin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
21 #ifndef BOARD_H
22 #define BOARD_H
23 
24 #include "cpu.h"
25 #include "periph_conf.h"
26 #include "mtd.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
36 #define LED_PORT PORT->Group[PA]
37 
38 #define LED0_PIN GPIO_PIN(PA, 22)
39 #define LED0_MASK (1 << 22)
40 #define LED0_NAME "LED(Red)"
41 
42 #define LED0_OFF (LED_PORT.OUTSET.reg = LED0_MASK)
43 #define LED0_ON (LED_PORT.OUTCLR.reg = LED0_MASK)
44 #define LED0_TOGGLE (LED_PORT.OUTTGL.reg = LED0_MASK)
45 
46 #define LED1_PIN GPIO_PIN(PA, 19)
47 #define LED1_MASK (1 << 19)
48 #define LED1_NAME "LED(Green)"
49 
50 #define LED1_OFF (LED_PORT.OUTSET.reg = LED1_MASK)
51 #define LED1_ON (LED_PORT.OUTCLR.reg = LED1_MASK)
52 #define LED1_TOGGLE (LED_PORT.OUTTGL.reg = LED1_MASK)
53 
54 #define LED2_PIN GPIO_PIN(PA, 23)
55 #define LED2_MASK (1 << 23)
56 #define LED2_NAME "LED(Blue)"
57 
58 #define LED2_OFF (LED_PORT.OUTSET.reg = LED2_MASK)
59 #define LED2_ON (LED_PORT.OUTCLR.reg = LED2_MASK)
60 #define LED2_TOGGLE (LED_PORT.OUTTGL.reg = LED2_MASK)
61 
67 #define SERPENTE_NOR_PAGE_SIZE (256)
68 #define SERPENTE_NOR_PAGES_PER_SECTOR (16)
69 #define SERPENTE_NOR_SECTOR_COUNT (1024)
70 #define SERPENTE_NOR_FLAGS (SPI_NOR_F_SECT_4K | SPI_NOR_F_SECT_32K)
71 #define SERPENTE_NOR_SPI_DEV SPI_DEV(0)
72 #define SERPENTE_NOR_SPI_CLK SPI_CLK_10MHZ
73 #define SERPENTE_NOR_SPI_CS GPIO_PIN(PA, 15)
74 #define SERPENTE_NOR_SPI_MODE SPI_MODE_3
75 
81 extern mtd_dev_t *mtd0;
82 #define MTD_0 mtd0
83 
89 #define INTERNAL_PERIPHERAL_VID (0x239A)
90 #define INTERNAL_PERIPHERAL_PID (0x0057)
91 
96 void board_init(void);
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif /* BOARD_H */
102 
mtd_dev_t
MTD device descriptor.
Definition: mtd.h:58
mtd0
mtd_dev_t * mtd0
mtd flash emulation device
periph_conf.h
Configuration of CPU peripherals for the Serpente board.
board_init
void board_init(void)
Board level initialization.