dragoon  4383
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
nrf_mbr.h
1 /*
2  * Copyright (c) 2014 - 2017, Nordic Semiconductor ASA
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without modification,
6  * are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice, this
9  * list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form, except as embedded into a Nordic
12  * Semiconductor ASA integrated circuit in a product or a software update for
13  * such product, must reproduce the above copyright notice, this list of
14  * conditions and the following disclaimer in the documentation and/or other
15  * materials provided with the distribution.
16  *
17  * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
18  * contributors may be used to endorse or promote products derived from this
19  * software without specific prior written permission.
20  *
21  * 4. This software, with or without modification, must only be used with a
22  * Nordic Semiconductor ASA integrated circuit.
23  *
24  * 5. Any software provided in binary form under this license must not be reverse
25  * engineered, decompiled, modified and/or disassembled.
26  *
27  * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
28  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29  * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
30  * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
31  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
33  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
36  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  */
38 
47 #ifndef NRF_MBR_H__
48 #define NRF_MBR_H__
49 
50 #include "nrf_svc.h"
51 #include <stdint.h>
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
61 #define MBR_SVC_BASE (0x18)
62 
64 #define MBR_PAGE_SIZE_IN_WORDS (1024)
65 
68 #define MBR_SIZE (0x1000)
69 
77 {
78  SD_MBR_COMMAND = MBR_SVC_BASE,
79 };
80 
82 enum NRF_MBR_COMMANDS
83 {
84  SD_MBR_COMMAND_COPY_BL,
85  SD_MBR_COMMAND_COPY_SD,
86  SD_MBR_COMMAND_INIT_SD,
87  SD_MBR_COMMAND_COMPARE,
88  SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET,
89  SD_MBR_COMMAND_RESERVED,
90  SD_MBR_COMMAND_IRQ_FORWARD_ADDRESS_SET,
91 };
92 
108 typedef struct
109 {
110  uint32_t *src;
111  uint32_t *dst;
112  uint32_t len;
114 
115 
121 typedef struct
122 {
123  uint32_t *ptr1;
124  uint32_t *ptr2;
125  uint32_t len;
127 
128 
144 typedef struct
145 {
146  uint32_t *bl_src;
147  uint32_t bl_len;
149 
163 typedef struct
164 {
165  uint32_t address;
167 
174 typedef struct
175 {
176  uint32_t address;
178 
179 typedef struct
180 {
181  uint32_t command;
182  union
183  {
184  sd_mbr_command_copy_sd_t copy_sd;
185  sd_mbr_command_compare_t compare;
186  sd_mbr_command_copy_bl_t copy_bl;
188  sd_mbr_command_irq_forward_address_set_t irq_forward_address_set;
189  } params;
190 } sd_mbr_command_t;
191 
217 SVCALL(SD_MBR_COMMAND, uint32_t, sd_mbr_command(sd_mbr_command_t* param));
218 
221 #ifdef __cplusplus
222 }
223 #endif
224 #endif // NRF_MBR_H__
225