mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
targets/TARGET_STM/TARGET_STM32L1/TARGET_MTB_MTS_XDOT/xdot_eeprom.h@189:f392fc9709a3, 2019-02-20 (annotated)
- Committer:
- AnnaBridge
- Date:
- Wed Feb 20 22:31:08 2019 +0000
- Revision:
- 189:f392fc9709a3
- Parent:
- 187:0387e8f68319
mbed library release version 165
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 181:57724642e740 | 1 | /* mbed Microcontroller Library |
AnnaBridge | 181:57724642e740 | 2 | ******************************************************************************* |
AnnaBridge | 181:57724642e740 | 3 | * Copyright (c) 2016, MultiTech Systems |
AnnaBridge | 181:57724642e740 | 4 | * All rights reserved. |
AnnaBridge | 181:57724642e740 | 5 | * |
AnnaBridge | 181:57724642e740 | 6 | * Redistribution and use in source and binary forms, with or without |
AnnaBridge | 181:57724642e740 | 7 | * modification, are permitted provided that the following conditions are met: |
AnnaBridge | 181:57724642e740 | 8 | * |
AnnaBridge | 181:57724642e740 | 9 | * 1. Redistributions of source code must retain the above copyright notice, |
AnnaBridge | 181:57724642e740 | 10 | * this list of conditions and the following disclaimer. |
AnnaBridge | 181:57724642e740 | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
AnnaBridge | 181:57724642e740 | 12 | * this list of conditions and the following disclaimer in the documentation |
AnnaBridge | 181:57724642e740 | 13 | * and/or other materials provided with the distribution. |
AnnaBridge | 181:57724642e740 | 14 | * 3. Neither the name of MultiTech nor the names of its contributors |
AnnaBridge | 181:57724642e740 | 15 | * may be used to endorse or promote products derived from this software |
AnnaBridge | 181:57724642e740 | 16 | * without specific prior written permission. |
AnnaBridge | 181:57724642e740 | 17 | * |
AnnaBridge | 181:57724642e740 | 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
AnnaBridge | 181:57724642e740 | 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
AnnaBridge | 181:57724642e740 | 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
AnnaBridge | 181:57724642e740 | 21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
AnnaBridge | 181:57724642e740 | 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
AnnaBridge | 181:57724642e740 | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
AnnaBridge | 181:57724642e740 | 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
AnnaBridge | 181:57724642e740 | 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
AnnaBridge | 181:57724642e740 | 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
AnnaBridge | 181:57724642e740 | 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
AnnaBridge | 181:57724642e740 | 28 | ******************************************************************************* |
AnnaBridge | 181:57724642e740 | 29 | */ |
AnnaBridge | 181:57724642e740 | 30 | |
AnnaBridge | 181:57724642e740 | 31 | #ifndef __XDOT_EEPROM_H__ |
AnnaBridge | 181:57724642e740 | 32 | #define __XDOT_EEPROM_H__ |
AnnaBridge | 181:57724642e740 | 33 | |
AnnaBridge | 181:57724642e740 | 34 | #include "cmsis.h" |
AnnaBridge | 181:57724642e740 | 35 | |
AnnaBridge | 181:57724642e740 | 36 | #ifdef __cplusplus |
AnnaBridge | 181:57724642e740 | 37 | extern "C" { |
AnnaBridge | 181:57724642e740 | 38 | #endif |
AnnaBridge | 181:57724642e740 | 39 | |
AnnaBridge | 181:57724642e740 | 40 | /* xdot_eeprom_write_buf |
AnnaBridge | 181:57724642e740 | 41 | * attempts to write size bytes from buf to addr |
AnnaBridge | 181:57724642e740 | 42 | * implements read-before-write because writes are expensive |
AnnaBridge | 181:57724642e740 | 43 | * uses most efficient write possible (byte, half-word, or word write) based on alignment |
AnnaBridge | 181:57724642e740 | 44 | * and number of bytes that need to be written |
AnnaBridge | 181:57724642e740 | 45 | * buf must be non-null and size bytes or larger |
AnnaBridge | 181:57724642e740 | 46 | * valid addresses are 0x0000 - 0x1FFF |
AnnaBridge | 181:57724642e740 | 47 | * returns 0 if all data was successfully written otherwise -1 |
AnnaBridge | 181:57724642e740 | 48 | */ |
AnnaBridge | 187:0387e8f68319 | 49 | int xdot_eeprom_write_buf(uint32_t addr, uint8_t *buf, uint32_t size); |
AnnaBridge | 181:57724642e740 | 50 | |
AnnaBridge | 181:57724642e740 | 51 | /* xdot_eeprom_read_buf |
AnnaBridge | 181:57724642e740 | 52 | * attempts to read size bytes into buf starting at addr |
AnnaBridge | 181:57724642e740 | 53 | * buf must be non-null and size bytes or larger |
AnnaBridge | 181:57724642e740 | 54 | * valid addresses are 0x0000 - 0x1FFF |
AnnaBridge | 181:57724642e740 | 55 | * returns 0 if all data was successfully read otherwise -1 |
AnnaBridge | 181:57724642e740 | 56 | */ |
AnnaBridge | 187:0387e8f68319 | 57 | int xdot_eeprom_read_buf(uint32_t addr, uint8_t *buf, uint32_t size); |
AnnaBridge | 181:57724642e740 | 58 | |
AnnaBridge | 181:57724642e740 | 59 | #ifdef __cplusplus |
AnnaBridge | 181:57724642e740 | 60 | } |
AnnaBridge | 181:57724642e740 | 61 | #endif |
AnnaBridge | 181:57724642e740 | 62 | |
AnnaBridge | 181:57724642e740 | 63 | #endif /* __XDOT_EEPROM_H__ */ |