?? eeprom.c
字號:
#endif
// Copy four (4) bytes to eeprom;
#if EXTRAS
enum EEPROM_RC data *memset_pr (uint32_t dst, int32_t src)
{
int32_t xdata xsrc = src;
return (memcpy_prx (dst, (uint8x_t *) &xsrc, 4));
}
#endif
#pragma save
#pragma NOAREGS
enum EEPROM_RC data *memcpy_prx (uint32_t Dst, uint8x_t *pSrc, uint16_t len) small reentrant
{
if (!done || !(DIO & DIO_EEX))
status = _ERR_PENDING;
else
{
cnt = len;
if (cnt)
{
mode = WRITE_MODE;
addr.l = Dst;
ptr = pSrc;
status = _PENDING;
done = FALSE;
state = START_WRITE; // Delay 'msWr' msec before next START.
if (NULL == stm_start (write_tick_cnt, 0, issue_START))
status = _ERR_OVERRUN;
}
else
status = _OK;
}
return (&status);
}
#pragma restore
#endif
#if CLI
// clear the EEPROM
enum EEPROM_RC data *memclr_pr (void)
{
if (!done || !(DIO & DIO_EEX))
status = _ERR_PENDING;
else
{
cnt = EEPROM_SIZE;
mode = CLEAR_MODE;
addr.l = 0;
status = _PENDING;
done = FALSE;
state = START_WRITE; // Delay 'msWr' msec before next START.
if (NULL == stm_start (write_tick_cnt, 0, issue_START))
status = _ERR_OVERRUN;
}
return (&status);
}
#endif
// Read four (4) bytes; A return of nonzero is a failure.
#if EXTRAS
enum EEPROM_RC data *memget_pr (int32x_t *dst, uint32_t src)
{
return (memcpy_xpr((uint8x_t *) dst, src, 4));
}
#endif
enum EEPROM_RC data *memcpy_xpr (uint8_t xdata *pDst, uint32_t Src, uint16_t len)
{
if (!done || !(DIO & DIO_EEX))
status = _ERR_PENDING;
else
{
cnt = len;
if (cnt)
{
mode = READ_MODE;
addr.l = Src;
ptr = pDst;
status = _PENDING;
done = FALSE;
state = START_WRITE; // Delay 'msWr' msec before next START.
if (NULL == stm_start (write_tick_cnt, 0, issue_START))
status = _ERR_OVERRUN;
}
else
status = _OK;
}
return (&status);
}
// returns 1 if it worked, 0 if it timed out or failed
#if CAL_SAVE && NV_SELECT == NV_EEPROM
bool eeprom_ok (enum EEPROM_RC data *pstatus)
{
#if TIMERS
STM stm;
bool ok;
RESET_WD();
ok = FALSE;
stm = stm_start ( milliseconds(7000), 0, NULL);
if (NULL == stm)
*pstatus = _ERR_OVERRUN;
while (stm_running(stm) && (_PENDING == *pstatus))
{
stm_run ();
}
RESET_WD();
ok = stm_running(stm) && (_OK == *pstatus);
stm_stop (stm);
return ok;
#else // no timers, so no timeout
while (PENDING == *pstatus)
{
RESET_WD();
delay_clks (3);
}
return (_OK == *pstatus);
#endif
}
#endif // calibration
#endif // EEPROM.
/***************************************************************************
* History:
* $Log: eeprom.c,v $
* Revision 1.30 2006/09/09 01:09:14 gmikef
* *** empty log message ***
*
* Revision 1.29 2006/09/06 02:10:52 tvander
* Spaces for tabs
*
* Revision 1.28 2006/08/30 21:55:08 gmikef
* *** empty log message ***
*
* Revision 1.27 2006/06/29 00:55:48 tvander
* Marked NOAREGS on reentrant routines that needed it.
*
* Revision 1.26 2006/06/15 16:36:55 tvander
* Fixed reentrancy on iiceep.c and eepromp.c
* Made parallel code changes to microwire eeprom drivers.
*
* Revision 1.25 2006/06/12 20:38:04 tvander
* Compiles.
*
* Revision 1.24 2006/05/18 23:18:43 tvander
* 16K and 32K
* First cut at new requirements.
* 32K 6521 is grossly tested.
* All others have a clean compile with C51 8.02
*
* Revision 1.23 2006/04/14 20:11:22 tvander
* Fixed, integrated with phased calibration
*
* Revision 1.22 2006/03/08 00:00:55 tvander
* Revised IO so that multiplexed interrupts are centralized in io65xx.c
* Added default interrupts to io65xx.c
* Clean build.
* Tested CE, serial.
* interrupting EEPROM driver fails.
*
* Revision 1.21 2006/03/06 03:30:37 Michael T. Fischer
* More 6530 prep.
*
* Revision 1.20 2006/02/08 22:36:25 gmikef
* *** empty log message ***
*
* Revision 1.19 2006/02/08 03:43:17 tvander
* Made "import" the default power measurement mode, rather than net-metering
*
* Revision 1.18 2006/01/10 03:56:45 gmikef
* Added PDATA support for CE Outputs.
*
* Revision 1.17 2006/01/04 04:47:50 gmikef
* Switched RMS and VA calculations to use floating point. (and Calibration).
*
* Revision 1.15 2005/11/29 01:14:13 tvander
* Automatic software watchdogs
*
* Revision 1.14 2005/11/05 02:13:59 tvander
* Fixed build
*
* Revision 1.13 2005/11/05 01:56:25 tvander
* Added EEPROM erase; Note uwreep.c is not working; don't know why.
*
* Revision 1.12 2005/10/31 17:37:59 tvander
* Includes improved EEPROM code with uwire.
* Clean build, all build trees (Thank-you, Mike!)
*
* Revision 1.11 2005/10/20 18:39:39 tvander
* Ported 2-wire EEPROM code from 6511/6513, including interrupting version, polling version for DIO, and polling version using the 2-wire logic.
*
* Revision 1.10 2005/09/22 23:45:03 tvander
* Clean build all models and unit tests, updated copyright to be fore Teridian
*
* Revision 1.9 2005/08/28 02:13:01 gmikef
* *** empty log message ***
*
* Revision 1.8 2005/08/16 02:28:29 gmikef
* Remapped LCD for 6520 Eval Board.
* Mapped CE code location to address of 'CeCode'.
*
* Revision 1.7 2005/08/12 21:51:37 tvander
* Added a synchronization and test function.
*
* Revision 1.6 2005/08/10 01:57:13 gmikef
* *** empty log message ***
*
* Revision 1.5 2005/04/30 02:10:04 gmikef
* *** empty log message ***
*
* Revision 1.9 2005/04/25 21:26:00 gmikef
* *** empty log message ***
*
* Revision 1.4 2005/04/21 01:58:50 gmikef
* *** empty log message ***
*
* Revision 1.8 2005/04/09 02:04:24 gmikef
* *** empty log message ***
*
* Revision 1.3 2005/03/12 00:16:58 tvander
* Integrated memory types.
*
* Revision 1.2 2005/03/11 22:57:02 tvander
* Added bool, and 8/16/32 data structures
*
* Revision 1.1 2005/03/11 22:19:13 tvander
* *** empty log message ***
*
* Revision 1.3 2005/03/08 19:06:42 tvander
* Self calibration in all software models
*
* Revision 1.2 2005/02/17 18:32:25 tvander
* Added automatic check-in logging to all source code.
*
* Copyright, 2004 Teridian SemiConductor, CORP. all rights reserved
* this program is fully protected by the United States copyright
* laws and is the property of Teridian SemiConductor CORPORATION.
***************************************************************************/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -