meh

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Fri Aug 15 15:28:31 2014 +0100
Revision:
88:9327015d4013
Parent:
TARGET_ARCH_BLE/TARGET_NORDIC/TARGET_NRF51822/Lib/s110_nrf51822_7_0_0/s110_nrf51822_7.0.0_API/include/nrf_mbr.h@87:6213f644d804
Release 88 of the mbed library

Main changes:

- changed "error.h" to "mbed_error.h" to avoid conflicts with 3rd party code
- LPC1549 SPI driver fixes
- K64F Ethernet TX buffer reclaim mechanism fix
- STDIO initialization fix
- NUCLEO_F334R8 I2C clock fix
- various other fixes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 87:6213f644d804 1 /*
bogdanm 87:6213f644d804 2 * Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
bogdanm 87:6213f644d804 3 *
bogdanm 87:6213f644d804 4 * The information contained herein is confidential property of Nordic Semiconductor. The use,
bogdanm 87:6213f644d804 5 * copying, transfer or disclosure of such information is prohibited except by express written
bogdanm 87:6213f644d804 6 * agreement with Nordic Semiconductor.
bogdanm 87:6213f644d804 7 *
bogdanm 87:6213f644d804 8 */
bogdanm 87:6213f644d804 9 /**
bogdanm 87:6213f644d804 10 @defgroup nrf_mbr_api Master Boot Record API
bogdanm 87:6213f644d804 11 @{
bogdanm 87:6213f644d804 12
bogdanm 87:6213f644d804 13 @brief APIs for updating SoftDevice and BootLoader
bogdanm 87:6213f644d804 14
bogdanm 87:6213f644d804 15 */
bogdanm 87:6213f644d804 16
bogdanm 87:6213f644d804 17 /* Header guard */
bogdanm 87:6213f644d804 18 #ifndef NRF_MBR_H__
bogdanm 87:6213f644d804 19 #define NRF_MBR_H__
bogdanm 87:6213f644d804 20
bogdanm 87:6213f644d804 21 #include "nrf_svc.h"
bogdanm 87:6213f644d804 22 #include <stdint.h>
bogdanm 87:6213f644d804 23
bogdanm 87:6213f644d804 24
bogdanm 87:6213f644d804 25 /** @addtogroup NRF_MBR_DEFINES Defines
bogdanm 87:6213f644d804 26 * @{ */
bogdanm 87:6213f644d804 27
bogdanm 87:6213f644d804 28 /**@brief MBR SVC Base number. */
bogdanm 87:6213f644d804 29 #define MBR_SVC_BASE 0x18
bogdanm 87:6213f644d804 30 /** @} */
bogdanm 87:6213f644d804 31
bogdanm 87:6213f644d804 32 /** @addtogroup NRF_MBR_ENUMS Enumerations
bogdanm 87:6213f644d804 33 * @{ */
bogdanm 87:6213f644d804 34
bogdanm 87:6213f644d804 35 /**@brief nRF Master Boot Record API SVC numbers. */
bogdanm 87:6213f644d804 36 enum NRF_MBR_SVCS
bogdanm 87:6213f644d804 37 {
bogdanm 87:6213f644d804 38 SD_MBR_COMMAND = MBR_SVC_BASE, /**< ::sd_mbr_command */
bogdanm 87:6213f644d804 39 };
bogdanm 87:6213f644d804 40
bogdanm 87:6213f644d804 41 /**@brief Possible values for ::sd_mbr_command_t.command */
bogdanm 87:6213f644d804 42 enum NRF_MBR_COMMANDS
bogdanm 87:6213f644d804 43 {
bogdanm 87:6213f644d804 44 SD_MBR_COMMAND_COPY_BL, /**< Copy a new a new BootLoader. @see sd_mbr_command_copy_bl_t */
bogdanm 87:6213f644d804 45 SD_MBR_COMMAND_COPY_SD, /**< Copy a new SoftDevice. @see ::sd_mbr_command_copy_sd_t*/
bogdanm 87:6213f644d804 46 SD_MBR_COMMAND_INIT_SD, /**< Init forwarding interrupts to SD, and run reset function in SD*/
bogdanm 87:6213f644d804 47 SD_MBR_COMMAND_COMPARE, /**< This command works like memcmp. @see ::sd_mbr_command_compare_t*/
bogdanm 87:6213f644d804 48 SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET, /**< Start forwarding all exception to this address @see ::sd_mbr_command_vector_table_base_set_t*/
bogdanm 87:6213f644d804 49 };
bogdanm 87:6213f644d804 50
bogdanm 87:6213f644d804 51 /** @} */
bogdanm 87:6213f644d804 52
bogdanm 87:6213f644d804 53 /** @addtogroup NRF_MBR_TYPES Types
bogdanm 87:6213f644d804 54 * @{ */
bogdanm 87:6213f644d804 55
bogdanm 87:6213f644d804 56 /**@brief This command copies part of a new SoftDevice
bogdanm 87:6213f644d804 57 * The destination area is erased before copying.
bogdanm 87:6213f644d804 58 * If dst is in the middle of a flash page, that whole flash page will be erased.
bogdanm 87:6213f644d804 59 * If (dst+len) is in the middle of a flash page, that whole flash page will be erased.
bogdanm 87:6213f644d804 60 *
bogdanm 87:6213f644d804 61 * The user of this function is responsible for setting the PROTENSET registers.
bogdanm 87:6213f644d804 62 *
bogdanm 87:6213f644d804 63 * @retval ::NRF_SUCCESS indicates that the contents of the memory blocks where copied correctly.
bogdanm 87:6213f644d804 64 * @retval ::NRF_ERROR_INTERNAL indicates that the contents of the memory blocks where not verified correctly after copying.
bogdanm 87:6213f644d804 65 */
bogdanm 87:6213f644d804 66 typedef struct
bogdanm 87:6213f644d804 67 {
bogdanm 87:6213f644d804 68 uint32_t *src; /**< Pointer to the source of data to be copied.*/
bogdanm 87:6213f644d804 69 uint32_t *dst; /**< Pointer to the destination where the content is to be copied.*/
bogdanm 87:6213f644d804 70 uint32_t len; /**< Number of 32 bit words to copy. Must be a multiple of 256 words*/
bogdanm 87:6213f644d804 71 }sd_mbr_command_copy_sd_t;
bogdanm 87:6213f644d804 72
bogdanm 87:6213f644d804 73
bogdanm 87:6213f644d804 74 /**@brief This command works like memcmp, but takes the length in words.
bogdanm 87:6213f644d804 75 *
bogdanm 87:6213f644d804 76 * @retval ::NRF_SUCCESS indicates that the contents of both memory blocks are equal.
bogdanm 87:6213f644d804 77 * @retval ::NRF_ERROR_NULL indicates that the contents of the memory blocks are not equal.
bogdanm 87:6213f644d804 78 */
bogdanm 87:6213f644d804 79 typedef struct
bogdanm 87:6213f644d804 80 {
bogdanm 87:6213f644d804 81 uint32_t *ptr1; /**< Pointer to block of memory */
bogdanm 87:6213f644d804 82 uint32_t *ptr2; /**< Pointer to block of memory */
bogdanm 87:6213f644d804 83 uint32_t len; /**< Number of 32 bit words to compare*/
bogdanm 87:6213f644d804 84 }sd_mbr_command_compare_t;
bogdanm 87:6213f644d804 85
bogdanm 87:6213f644d804 86
bogdanm 87:6213f644d804 87 /**@brief This command copies a new BootLoader.
bogdanm 87:6213f644d804 88 * With this command, destination of BootLoader is always the address written in NRF_UICR->BOOTADDR.
bogdanm 87:6213f644d804 89 *
bogdanm 87:6213f644d804 90 * Destination is erased by this function.
bogdanm 87:6213f644d804 91 * If (destination+bl_len) is in the middle of a flash page, that whole flash page will be erased.
bogdanm 87:6213f644d804 92 *
bogdanm 87:6213f644d804 93 * This function will use PROTENSET to protect the flash that is not intended to be written.
bogdanm 87:6213f644d804 94 *
bogdanm 87:6213f644d804 95 * On Success, this function will not return. It will start the new BootLoader from reset-vector as normal.
bogdanm 87:6213f644d804 96 *
bogdanm 87:6213f644d804 97 * @retval ::NRF_ERROR_INVALID_STATE indicates that something was wrong.
bogdanm 87:6213f644d804 98 * @retval ::NRF_ERROR_INTERNAL indicates an internal error that should not happen.
bogdanm 87:6213f644d804 99 * @retval ::NRF_ERROR_FORBIDDEN if NRF_UICR->BOOTADDR is not set
bogdanm 87:6213f644d804 100 * @retval ::NRF_ERROR_INVALID_LENGTH is invalid.
bogdanm 87:6213f644d804 101 */
bogdanm 87:6213f644d804 102 typedef struct
bogdanm 87:6213f644d804 103 {
bogdanm 87:6213f644d804 104 uint32_t *bl_src; /**< Pointer to the source of the Bootloader to be be copied.*/
bogdanm 87:6213f644d804 105 uint32_t bl_len; /**< Number of 32 bit words to copy for BootLoader */
bogdanm 87:6213f644d804 106 }sd_mbr_command_copy_bl_t;
bogdanm 87:6213f644d804 107
bogdanm 87:6213f644d804 108 /**@brief Sets the base address of the interrupt vector table for interrupts forwarded from the MBR
bogdanm 87:6213f644d804 109 *
bogdanm 87:6213f644d804 110 * Once this function has been called, this address is where the MBR will start to forward interrupts to after a reset.
bogdanm 87:6213f644d804 111 *
bogdanm 87:6213f644d804 112 * To restore default forwarding thiss function should be called with @param address set to 0.
bogdanm 87:6213f644d804 113 * The MBR will then start forwarding to interrupts to the adress in NFR_UICR->BOOTADDR or to the SoftDevice if the BOOTADDR is not set.
bogdanm 87:6213f644d804 114 *
bogdanm 87:6213f644d804 115 * @retval ::NRF_SUCCESS
bogdanm 87:6213f644d804 116 */
bogdanm 87:6213f644d804 117 typedef struct
bogdanm 87:6213f644d804 118 {
bogdanm 87:6213f644d804 119 uint32_t address; /**< The base address of the interrupt vector table for forwarded interrupts.*/
bogdanm 87:6213f644d804 120 }sd_mbr_command_vector_table_base_set_t;
bogdanm 87:6213f644d804 121
bogdanm 87:6213f644d804 122 typedef struct
bogdanm 87:6213f644d804 123 {
bogdanm 87:6213f644d804 124 uint32_t command; /**< type of command to be issued see @ref NRF_MBR_COMMANDS. */
bogdanm 87:6213f644d804 125 union
bogdanm 87:6213f644d804 126 {
bogdanm 87:6213f644d804 127 sd_mbr_command_copy_sd_t copy_sd; /**< Parameters for copy*/
bogdanm 87:6213f644d804 128 sd_mbr_command_copy_bl_t copy_bl; /**< Parameters for copy SoftDevice and BootLoader*/
bogdanm 87:6213f644d804 129 sd_mbr_command_compare_t compare; /**< Parameters for verify*/
bogdanm 87:6213f644d804 130 sd_mbr_command_vector_table_base_set_t base_set; /**< Parameters for vector table base set.*/
bogdanm 87:6213f644d804 131 } params;
bogdanm 87:6213f644d804 132 }sd_mbr_command_t;
bogdanm 87:6213f644d804 133
bogdanm 87:6213f644d804 134 /** @} */
bogdanm 87:6213f644d804 135
bogdanm 87:6213f644d804 136 /** @addtogroup NRF_MBR_FUNCTIONS Functions
bogdanm 87:6213f644d804 137 * @{ */
bogdanm 87:6213f644d804 138
bogdanm 87:6213f644d804 139 /**@brief Issue Master Boot Record commands
bogdanm 87:6213f644d804 140 *
bogdanm 87:6213f644d804 141 * Commands used when updating a SoftDevice and bootloader
bogdanm 87:6213f644d804 142 *
bogdanm 87:6213f644d804 143 * @param[in] param Pointer to a struct describing the command
bogdanm 87:6213f644d804 144 *
bogdanm 87:6213f644d804 145 *@note for retvals see ::sd_mbr_command_copy_sd_t ::sd_mbr_command_copy_bl_t ::sd_mbr_command_compare_t
bogdanm 87:6213f644d804 146
bogdanm 87:6213f644d804 147 */
bogdanm 87:6213f644d804 148 SVCALL(SD_MBR_COMMAND, uint32_t, sd_mbr_command(sd_mbr_command_t* param));
bogdanm 87:6213f644d804 149
bogdanm 87:6213f644d804 150 /** @} */
bogdanm 87:6213f644d804 151 #endif // NRF_MBR_H__
bogdanm 87:6213f644d804 152
bogdanm 87:6213f644d804 153 /**
bogdanm 87:6213f644d804 154 @}
bogdanm 87:6213f644d804 155 */