summaryrefslogtreecommitdiffhomepage
path: root/digital/zigbit/bitcloud/stack/Components/HAL/include/eeprom.h
diff options
context:
space:
mode:
authorFlorent Duchon2012-12-26 17:36:00 +0100
committerFlorent Duchon2013-02-13 21:21:12 +0100
commitb24866225a6301d3a663f874725e83c012dc25d3 (patch)
treeca527a2aab9abcdfbaf244c53ca63f0c531892b0 /digital/zigbit/bitcloud/stack/Components/HAL/include/eeprom.h
parent2ba279f4eb2f23fa08a7c13465d16ae6ba5d0f96 (diff)
digital/beacon: add bitcloud stack into common directory digital/zigbit
Diffstat (limited to 'digital/zigbit/bitcloud/stack/Components/HAL/include/eeprom.h')
-rw-r--r--digital/zigbit/bitcloud/stack/Components/HAL/include/eeprom.h113
1 files changed, 113 insertions, 0 deletions
diff --git a/digital/zigbit/bitcloud/stack/Components/HAL/include/eeprom.h b/digital/zigbit/bitcloud/stack/Components/HAL/include/eeprom.h
new file mode 100644
index 00000000..a4a21966
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/HAL/include/eeprom.h
@@ -0,0 +1,113 @@
+/**************************************************************************//**
+ \file eeprom.h
+
+ \brief The header file describes the EEPROM interface.
+
+ \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:
+ 5/12/07 A. Khromykh - Created
+ ******************************************************************************/
+/******************************************************************************
+ * WARNING: CHANGING THIS FILE MAY AFFECT CORE FUNCTIONALITY OF THE STACK. *
+ * EXPERT USERS SHOULD PROCEED WITH CAUTION. *
+ ******************************************************************************/
+
+#ifndef _EEPROM_H
+#define _EEPROM_H
+
+// \cond
+/******************************************************************************
+ Includes section
+******************************************************************************/
+#include <types.h>
+
+/******************************************************************************
+ Define(s) section
+******************************************************************************/
+#if defined(AT91SAM7X256)
+ #define EEPROM_DATA_MEMORY_SIZE 0x400u
+#elif defined(ATMEGA1281) || defined(ATMEGA2561) || defined(ATMEGA1284) || defined(AT90USB1287) \
+ || defined(ATXMEGA256A3) || defined(ATXMEGA256D3) || defined(ATMEGA128RFA1) \
+ || defined(AT91SAM3S4C)
+ #define EEPROM_DATA_MEMORY_SIZE 0x1000u
+#elif defined(ATXMEGA128A1)
+ #define EEPROM_DATA_MEMORY_SIZE 0x800u
+#endif
+// \endcond
+
+/******************************************************************************
+ Types section
+******************************************************************************/
+/**************************************************************************//**
+\brief eeprom access control structure
+******************************************************************************/
+typedef struct
+{
+ /** \brief EEPROM address */
+ uint16_t address;
+ /** \brief pointer to data memory */
+ uint8_t *data;
+ /** \brief number of bytes */
+ uint16_t length;
+} HAL_EepromParams_t;
+
+/******************************************************************************
+ Prototypes section
+******************************************************************************/
+/******************************************************************************
+\brief Reads a number of bytes defined by HAL_EepromParams_t from the EEPROM.
+\param[in]
+ param - address of HAL_EepromParams_t structure. \n
+ fields of structure set by user: \n
+ address - eeprom address \n
+ data - pointer to data memory \n
+ length - number of bytes
+\param[in]
+ readDone - pointer to the function that will notify about reading completion.
+\return
+ 0 - success, \n
+ -1 - the number of bytes to read is too large, \n
+ -2 - the previous EEPROM request is not completed yet.
+******************************************************************************/
+int HAL_ReadEeprom(HAL_EepromParams_t *params, void (*readDone)());
+
+/******************************************************************************
+\brief Writes a number of bytes defined by HAL_EepromParams_t to EEPROM.
+By writeDone parameter user can control if write operation will be asynchronous
+or synchronous.
+\param[in]
+ param - address of HAL_EepromParams_t structure. \n
+ fields of structure set by user: \n
+ address - eeprom address \n
+ data - pointer to data memory \n
+ length - number of bytes
+\param[in]
+ writeDone - pointer to the function that will notify about writing completion. \n
+ Only for avr: \n
+ if writeDone is NULL write operation will be synchronous.
+\return
+ 0 - success, \n
+ -1 - the number of bytes to write is too large, \n
+ -2 - the previous EEPROM request is not completed yet.
+******************************************************************************/
+int HAL_WriteEeprom(HAL_EepromParams_t *params, void (*writeDone)());
+
+/**************************************************************************//**
+\brief Checks the eeprom state.
+
+\return
+ true - eeprom is busy; \n
+ false - eeprom is free;
+******************************************************************************/
+bool HAL_IsEepromBusy(void);
+
+#endif /*_EEPROM_H*/
+
+//eof eeprom.h