summaryrefslogtreecommitdiffhomepage
path: root/digital/zigbit/bitcloud/stack/Components/PersistDataServer/include/private/pdsMemAbstract.h
diff options
context:
space:
mode:
Diffstat (limited to 'digital/zigbit/bitcloud/stack/Components/PersistDataServer/include/private/pdsMemAbstract.h')
-rw-r--r--digital/zigbit/bitcloud/stack/Components/PersistDataServer/include/private/pdsMemAbstract.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/digital/zigbit/bitcloud/stack/Components/PersistDataServer/include/private/pdsMemAbstract.h b/digital/zigbit/bitcloud/stack/Components/PersistDataServer/include/private/pdsMemAbstract.h
new file mode 100644
index 00000000..ca95f064
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/PersistDataServer/include/private/pdsMemAbstract.h
@@ -0,0 +1,70 @@
+/***************************************************************************//**
+ \file pdsMemAbstract.h
+
+ \brief Memory abstract header
+
+ \author
+ Atmel Corporation: http://www.atmel.com \n
+ Support email: avr@atmel.com
+
+ Copyright (c) 2008-2011, Atmel Corporation. All rights reserved.
+ Licensed under Atmel's Limited License Agreement (BitCloudTM).
+
+ \internal
+ History:
+ 6/11/08 A. Khromykh - Created
+*****************************************************************************/
+#ifndef _PDSMEMABSTRACT_H
+#define _PDSMEMABSTRACT_H
+
+/* Type of usage memory */
+#define USE_EEPROM
+
+/* This header file performs persistence memory API redefinition.
+ * The goal is to achieve memory type independence for persist data server (PDS).
+ *
+ *
+ * MEMORY_DESCRIPTOR - persistence memory descriptor. It is a structure type, which
+ * includes the following variables:
+ * uint16_t address - internal persistence memory address to be accessed.
+ * uint8_t *data - pointer to the variable in RAM to be stored (or to be filled
+ * by read value from persistence).
+ * uint16_t length - "data" variable length (bytes). Equal to the number of bytes
+ * to be exchanged between persistence memory and RAM.
+ *
+ *
+ * WRITE_MEMORY, READ_MEMORY - persistence memory access functions. These functions
+ * should have the following form:
+ * int write/read(MEMORY_DESCRIPTOR *memoryDescr, void (*callback)(void));
+ * Parameters:
+ * memoryDescr - pointer to memory descriptor
+ * callback - pointer to callback function. Callback function will be called
+ * after read or write persistence memory operation is completed.
+ * Returns:
+ * 0 - successful access;
+ * -1 - the number of bytes to read (write) is too large.
+ * Persistence memory access functions should perform memory arbitration also, i.e.
+ * memory busy return status is illegal.
+ *
+ *
+ * IS_MEMORY_BUSY - persistence memory access function, should have the following form:
+ * bool isMemoryBusy(void);
+ * Parameters:
+ * none.
+ * Returns:
+ * true - memory is busy
+ * false - memory is free;
+*/
+
+#if defined(USE_EEPROM)
+
+#include <eeprom.h>
+
+#define WRITE_MEMORY HAL_WriteEeprom
+#define READ_MEMORY HAL_ReadEeprom
+#define IS_MEMORY_BUSY HAL_IsEepromBusy
+#define MEMORY_DESCRIPTOR HAL_EepromParams_t
+
+#endif
+
+#endif /* _PDSMEMABSTRACT_H */