📄 access_x.c
字号:
/***************************************************************************
* This code and information is provided "as is" without warranty of any *
* kind, either expressed or implied, including but not limited to the *
* implied warranties of merchantability and/or fitness for a particular *
* purpose. *
* *
* Copyright (C) 2005 Teridian Semiconductor Corp. All Rights Reserved. *
* *
***************************************************************************/
//*************************************************************************
//
// DESCRIPTION: 71M651x POWER METER - Memory access routines (Extended).
//
// AUTHOR: MTF
//
// HISTORY: See end of file
//
//***************************************************************************
//
// File: ACCESS_X.C
//
#include "options.h"
#if (SERIAL0_CLI | SERIAL1_CLI) && TRACE10
#include "ce_ce.h"
#include "cli.h"
#include "flash.h"
#include "io.h"
#include "help.h"
#include <ctype.h>
/*** Private functions declared within this module ***/
// None.
/*** Private variables declared within this module ***/
// None.
#define NUM_CODE_PAGES (0x1000 / FPAGE_SIZE)
//--------------------------------------//
#if TRACE10
void cmd_ce_code_access (void) // '!' CE code access.
{
uint8_t c;
uint8_t data d;
uint16x_t *x;
if (CE_ACTIVE)
{
start_tx_rslt ("\r\nCE Active, can not read or write CE code space\r\n");
return;
}
// Get data's two-byte address.
x = (uint16x_t *) (CE_CODE_BASE | ((uint16_t) get_short () << 1));
#if FLASH
c = get_char_d (&d); // Check for possible FLASH update.
if ('U' == c)
{
uint8_t page;
uint16r_t *r;
r = (uint16r_t *) CeCode; // Copy updated CE_CODE back to FLASH.
x = (uint16x_t *) CE_CODE_BASE;
for (c = 0; c < NUM_CODE_PAGES; c++)
{
page = (uint16_t) r >> 8; // Extract page number x 2.
EA = FALSE; // Turn OFF all interrupts.
FPAGE = page; // Set Flash Page Erase Enable.
ERASE = PAGE_ERASE_; // Initiate page erase, MPU halted.
EA = TRUE; // Turn interrupts back ON.
memcpy_rx ((uint8r_t *) r, (uint8x_t *) x, FPAGE_SIZE);
r += FPAGE_SIZE / sizeof (uint16_t);
x += FPAGE_SIZE / sizeof (uint16_t);
}
return;
}
#endif
switch (c)
{
case '?':
case '$':
do
{
if ('?' == c)
send_short (*x++);
else
send_short_hex (*x++);
c = get_char_d (&d) ;
} while (('?' == c) || ('$' == c));
send_crlf ();
break;
case '=':
do
{
*x++ = get_short ();
} while ('=' == get_char_d (&d));
break;
}
cli_index = d; // Unget last character.
}
#endif
/***************************************************************************
* History:
* $Log: access_x.c,v $
* Revision 1.8 2006/10/13 00:46:18 tvander
* Removed compile options for 6530, 6515; renamed 6511 and 6513 to trace11 and trace13; Binary verified unchanged from previous version.
*
* Revision 1.7 2006/09/09 01:08:01 gmikef
* *** empty log message ***
*
* Revision 1.6 2006/06/24 05:27:04 tvander
* Clean build
*
* Revision 1.5 2006/03/07 23:57:06 tvander
* Revised help system for accuracy.
* Revised help system for compile flags.
* Clean build
*
* Revision 1.4 2006/03/03 11:24:02 Michael T. Fischer
* Prep for 6530 LCD, etc.
*
* Revision 1.3 2006/02/08 03:43:16 tvander
* Made "import" the default power measurement mode, rather than net-metering
*
* Revision 1.3 2005/08/03 18:34:48 tvander
* Changed copyright to "Teridian Semiconductor Co."
* Put in alt-mux change in MPU parameters in api_struct.h
* Revised validity date of cal.c
*
* Revision 1.2 2005/02/17 18:32:21 tvander
* Added automatic check-in logging to all source code.
*
* 2004 OCTOBER 21; First Version.
* Copyright (C) 2005 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. *
***************************************************************************/
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -