Loading...
Searching...
No Matches
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
29extern "C" {
30#endif
31
32#include <stddef.h>
33
34#include "riotboot/hdr.h"
35
42
49
57uint32_t riotboot_slot_get_image_startaddr(unsigned slot);
58
64void riotboot_slot_jump(unsigned slot);
65
74
82static inline int riotboot_slot_validate(unsigned slot)
83{
85}
86
93static inline void riotboot_slot_print_hdr(unsigned slot)
94{
96}
97
101size_t riotboot_slot_offset(unsigned slot);
102
108
116static inline size_t riotboot_slot_size(unsigned slot)
117{
118 switch (slot) {
119#if NUM_SLOTS >= 1
120 case 0:
121 return SLOT0_LEN;
122#endif
123#if NUM_SLOTS == 2
124 case 1:
125 return SLOT1_LEN;
126#endif
127 default:
128 return 0;
129 }
130}
131
135extern const unsigned riotboot_slot_numof;
136
140extern const riotboot_hdr_t *const riotboot_slots[];
141
142#ifdef __cplusplus
143}
144#endif
145
146#endif /* RIOTBOOT_SLOT_H */
RIOT "partition" header and tools.
int riotboot_hdr_validate(const riotboot_hdr_t *riotboot_hdr)
Validate image header.
void riotboot_hdr_print(const riotboot_hdr_t *riotboot_hdr)
Print formatted riotboot_hdr_t to STDIO.
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.
uint32_t riotboot_slot_get_image_startaddr(unsigned slot)
Get jump-to address of image slot.
static void riotboot_slot_print_hdr(unsigned slot)
Print formatted slot header to STDIO.
Definition slot.h:93
static size_t riotboot_slot_size(unsigned slot)
Get the size of a slot.
Definition slot.h:116
void riotboot_slot_jump(unsigned slot)
Boot into image in slot slot.
static int riotboot_slot_validate(unsigned slot)
Validate slot.
Definition slot.h:82
size_t riotboot_slot_offset(unsigned slot)
Get the offset (in flash, in bytes) for a given slot.
const unsigned riotboot_slot_numof
Number of configured firmware slots (incl.
int riotboot_slot_other(void)
Get currently not running image slot.
const riotboot_hdr_t * riotboot_slot_get_hdr(unsigned slot)
Get header from a given flash slot.
int riotboot_slot_current(void)
Get currently running image slot.
Structure to store image header - All members are little endian.
Definition hdr.h:51