2020-08-23 21:40:16 +02:00
|
|
|
/* Reflow Oven Controller
|
|
|
|
*
|
|
|
|
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
|
|
|
*
|
|
|
|
* This file is part of the Reflow Oven Controller Project.
|
|
|
|
*
|
|
|
|
* The reflow oven controller is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with the reflow oven controller project.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2020-09-04 21:33:54 +02:00
|
|
|
#include <stdbool.h>
|
2020-08-23 21:40:16 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Init the backup ram and make it accesible
|
2020-09-04 21:33:54 +02:00
|
|
|
* @param use_backup_regulator Enable the Backup VBAT regulator. It will be used, when VDD is powered off
|
2020-08-23 21:40:16 +02:00
|
|
|
*/
|
2020-09-04 21:33:54 +02:00
|
|
|
void backup_ram_init(bool use_backup_regulator);
|
2020-08-23 21:40:16 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Disable access to the backup RAM. This saves power
|
|
|
|
*/
|
2020-09-04 21:03:53 +02:00
|
|
|
void backup_ram_disable(void);
|
2020-08-23 21:40:16 +02:00
|
|
|
|
|
|
|
/**
|
2020-09-04 21:03:53 +02:00
|
|
|
* @brief Whis function overwrites the backup RAM with 0x00000000
|
2020-08-23 21:40:16 +02:00
|
|
|
*/
|
2020-09-04 21:03:53 +02:00
|
|
|
void backup_ram_wipe(void);
|
2020-08-23 21:40:16 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Read data from the backup RAM
|
|
|
|
* @param addr Address offset inside memory
|
2020-09-04 21:03:53 +02:00
|
|
|
* @param data Read data
|
|
|
|
* @param count amount of 32 bit words to read
|
|
|
|
* @return 0 if successful
|
2020-08-23 21:40:16 +02:00
|
|
|
*/
|
2020-09-04 21:03:53 +02:00
|
|
|
int backup_ram_get_data(uint32_t addr, uint32_t *data, uint32_t count);
|
2020-08-23 21:40:16 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Write data structure to backup RAM
|
2020-09-04 21:03:53 +02:00
|
|
|
* @param[in] data Data to write.
|
|
|
|
* @param count Count of 32 bit words to write
|
|
|
|
* @return 0 if successful
|
2020-08-23 21:40:16 +02:00
|
|
|
*/
|
2020-09-04 21:03:53 +02:00
|
|
|
int backup_ram_write_data(uint32_t addr, const uint32_t *data, uint32_t count);
|
2020-09-05 15:15:31 +02:00
|
|
|
|
|
|
|
uint32_t backup_ram_get_size_in_words(void);
|
2020-11-01 20:43:59 +01:00
|
|
|
|
|
|
|
volatile void *backup_ram_get_base_ptr(void);
|