slot.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Kaspar Schleiser <kaspar@schleiser.de>
3  * 2018 Inria
4  * 2018 Freie Universit├Ąt Berlin
5  *
6  * This file is subject to the terms and conditions of the GNU Lesser
7  * General Public License v2.1. See the file LICENSE in the top level
8  * directory for more details.
9  */
10 
25 #ifndef RIOTBOOT_SLOT_H
26 #define RIOTBOOT_SLOT_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include "riotboot/hdr.h"
33 
39 int riotboot_slot_current(void);
40 
46 int riotboot_slot_other(void);
47 
55 uint32_t riotboot_slot_get_image_startaddr(unsigned slot);
56 
62 void riotboot_slot_jump(unsigned slot);
63 
71 const riotboot_hdr_t *riotboot_slot_get_hdr(unsigned slot);
72 
80 static inline int riotboot_slot_validate(unsigned slot)
81 {
83 }
84 
91 static inline void riotboot_slot_print_hdr(unsigned slot)
92 {
94 }
95 
99 size_t riotboot_slot_offset(unsigned slot);
100 
105 void riotboot_slot_dump_addrs(void);
106 
110 extern const unsigned riotboot_slot_numof;
111 
115 extern const riotboot_hdr_t * const riotboot_slots[];
116 
117 #ifdef __cplusplus
118 }
119 #endif
120 
121 #endif /* RIOTBOOT_SLOT_H */
void riotboot_slot_jump(unsigned slot)
Boot into image in slot slot.
RIOT "partition" header and tools.
size_t riotboot_slot_offset(unsigned slot)
Get the offset (in flash, in bytes) for a given slot.
static int riotboot_slot_validate(unsigned slot)
Validate slot.
Definition: slot.h:80
int riotboot_slot_other(void)
Get currently not running image slot.
int riotboot_hdr_validate(const riotboot_hdr_t *riotboot_hdr)
Validate image header.
static void riotboot_slot_print_hdr(unsigned slot)
Print formatted slot header to STDIO.
Definition: slot.h:91
void riotboot_hdr_print(const riotboot_hdr_t *riotboot_hdr)
Print formatted riotboot_hdr_t to STDIO.
uint32_t riotboot_slot_get_image_startaddr(unsigned slot)
Get jump-to address of image slot.
void riotboot_slot_dump_addrs(void)
Dump the addresses of all configured slots.
const riotboot_hdr_t *const riotboot_slots[]
Storage for header pointers of the configured slots.
const unsigned riotboot_slot_numof
Number of configured firmware slots (incl.
int riotboot_slot_current(void)
Get currently running image slot.
Structure to store image header - All members are little endian.
Definition: hdr.h:51
const riotboot_hdr_t * riotboot_slot_get_hdr(unsigned slot)
Get header from a given flash slot.