dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_bl_helper.c
Go to the documentation of this file.
1 
16 /*
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation; either version 3 of the License, or
20  * (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful, but
23  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25  * for more details.
26  *
27  * You should have received a copy of the GNU General Public License along
28  * with this program; if not, see <http://www.gnu.org/licenses/>
29  */
30 
31 /* Project Includes */
32 #include "pios.h"
33 #if defined(PIOS_INCLUDE_BL_HELPER)
34 #include <pios_board_info.h>
35 #include "stm32f30x_flash.h"
36 
37 uint8_t *PIOS_BL_HELPER_FLASH_If_Read(uint32_t SectorAddress)
38 {
39  return (uint8_t *) (SectorAddress);
40 }
41 
43 {
44  const struct pios_board_info * bdinfo = &pios_board_info_blob;
45 
47  CRC_ResetDR();
48  CRC_CalcBlockCRC((uint32_t *) bdinfo->fw_base, (bdinfo->fw_size) >> 2);
49  return CRC_GetCRC();
50 }
51 
52 void PIOS_BL_HELPER_FLASH_Read_Description(uint8_t * array, uint8_t size)
53 {
54  const struct pios_board_info * bdinfo = &pios_board_info_blob;
55  uint8_t x = 0;
56  if (size > bdinfo->desc_size) size = bdinfo->desc_size;
57  for (uint32_t i = bdinfo->fw_base + bdinfo->fw_size; i < bdinfo->fw_base + bdinfo->fw_size + size; ++i) {
58  array[x] = *PIOS_BL_HELPER_FLASH_If_Read(i);
59  ++x;
60  }
61 }
62 
64 {
65  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE);
66 }
67 #endif
uint8_t * PIOS_BL_HELPER_FLASH_If_Read(uint32_t SectorAddress)
Main PiOS header to include all the compiled in PiOS options.
uint32_t PIOS_BL_HELPER_CRC_Memory_Calc()
const struct pios_board_info pios_board_info_blob
uint32_t fw_base
void PIOS_BL_HELPER_FLASH_Read_Description(uint8_t *array, uint8_t size)
uint8_t i
Definition: msp_messages.h:97
void PIOS_BL_HELPER_CRC_Ini()