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QHRIWKHPRVWSRSXODUDQGFRPPRQO\XVHGIRUPDWV$Q,QWHO6WDQGDUG+(;
ILOHLVDQ$6&,,ILOHZLWKRQHUHFRUGSHUOLQH(DFKOLQHKDVWKHIROORZLQJIRUPDW
/* Define ’C0’ Interrupt for code relocation. Interrupt ’C0’ may not be
required for the application, however is still defined as it is
is a workaround for ZDS-II to do code relocation*/
#pragma interrupt
void isr_C0(void)
{
}
void init_PC0(void)
{
SET_VECTOR(C0, isr_C0);
}
3RVLWLRQ
'HVFULSWLRQ
5HFRUG0DUNHU7KHILUVWFKDUDFWHURIWKHOLQHLVDOZD\VDFRORQ$6&,,[$WRLGHQWLI\
WKHOLQHDVDQ,QWHO+(;ILOH
±
5HFRUG/HQJWK7KLVILHOGFRQWDLQVWKHQXPEHURIGDWDE\WHVLQWKHUHJLVWHUUHSUHVHQWHG
DVDGLJLWKH[DGHFLPDOQXPEHU7KLVLVWKHWRWDOQXPEHURIGDWDE\WHVQRWLQFOXGLQJWKH
FKHFNVXPE\WHQRUWKHILUVWFKDUDFWHUVRIWKHOLQH
±
$GGUHVV7KLVILHOGFRQWDLQVWKHDGGUHVVZKHUHWKHGDWDVKRXOGEHORDGHGLQWRWKHFKLS
7KLVLVDYDOXHIURPWRUHSUHVHQWHGDVDGLJLWKH[DGHFLPDOYDOXH
5HFRUG7\SH7KLVILHOGLQGLFDWHVWKHW\SHRIUHFRUGIRUWKLVOLQH7KHSRVVLEOHYDOXHVDUH
5HJLVWHUFRQWDLQVQRUPDOGDWD (QGRI)LOH
"
'DWD%\WHV7KHIROORZLQJE\WHVDUHWKHDFWXDOGDWDWKDWDUHEXUQHGLQWRWKH(35207KH
GDWDLVUHSUHVHQWHGDVGLJLWKH[DGHFLPDOYDOXHV
/DVW
FKDUDFWHUV
&KHFNVXP7KHODVWWZRFKDUDFWHUVRIWKHOLQHDUHDFKHFNVXPIRUWKHOLQH7KHFKHFNVXP
YDOXHLVFDOFXODWHGE\WDNLQJWKHWZRVFRPSOHPH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RDGHUIRU=(QFRUH
70
$1
)LJXUH='6,,&&RPSLOHU*HQHUDO&DWHJRU\6HWWLQJV
)LJXUH='6,,&&RPSLOHU&RGH*HQHUDWLRQ6HWWLQJV
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
)LJXUH='6,,&&RPSLOHU2SWLPL]DWLRQV6HWWLQJV
)LJXUH='6,,/LQNHU,QSXW6HWWLQJV
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
)LJXUH='6,,7DUJHW6HWWLQJVIRU)ODVK/RDGHU
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
)ODVK/RDGHU&RGH
+HDGHUILOHV
)ODVKB,2K+HDGHUILOHIRU)ODVK'ULYHU
/
*************************************************
* Copyright (C) 1999-2002 by ZiLOG, Inc.
* All Rights Reserved
*
* Flash_IO.h : Header file for Flash Driver
**************************************************/
#define PAGE_SIZE
512
//Prototype definitions
unsigned int UnlockFlash(void);
void LockFlash(void);
unsigned int EraseFlash(unsigned int pagenum);
void WriteByteToFlash(int location, unsigned int value);
void WriteByteToFlash1(int location, unsigned int value);
unsigned int ReadByteFromFlash(int location);
(9%K(YDOXDWLRQERDUGKHDGHUILOHDQG5DP,2GHILQHV
/************************************************************
* Copyright (C) 1999-2002 by ZiLOG, Inc.
* All Rights Reserved
*
* EVB.h :Evaluation board header file and RAM I/O defines
************************************************************/
typedef unsigned char volatile far *IORegInt8;
#define IO_ADDR(addr) *((IORegInt8) addr)
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
VLRK+HDGHUILOHIRU6HULDO'ULYHUV
/*************************************************
* Copyright (C) 1999-2002 by ZiLOG, Inc.
* All Rights Reserved
*
* SIO.h : Header file for Serial Drivers
**************************************************/
// Function Prototypes
void init_uart(void);
char putch(char c);
int kbhit(void);
char getch(void);
void init_UART1_Int(void);
void dis_UART1_Int(void);
void modem_access(void);
void DMA_modem_access(void);
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
ORDGKH[K+HDGHUILOHIRU+5(;ILOHSDUVHUDQGORDGHU
/***********************************************************
* Copyright (C) 1999-2002 by ZiLOG, Inc.
* All Rights Reserved
*
* loadhex.h : Header file for HEX file parser and loader
***********************************************************/
// prototype definitions
void InitLoadHex(void);
void LoadHexMain(void);
char HexCharToLowNibble(char c);
#define VersionString "\r\nZiLOG eZ8 Flash Loader Version 0.95"
#define PromptString "\r\neZ8>"
#define USER_START_ADDR0
x4000
#define JUMP_TO_USER_CODE
"jp 4000H"
// "jp USER_START_ADDR"
#define USER_START_PAGE
0x20
// (USER_START_ADDDR >> 9)
#define USER_END_PAGE
0x7F
// (0xFFFF >> 9)
#define BL_STA_HIGH
0x02
// Boot Loader Start Address High Nibble
#define BL_STA_LOW
0x00
// Boot Loader Start Address Low Nibble
//----------------------------------------------------------
//General constants
#define FALSE
0
#define TRUE
1
//-----------------------------------------------------------
//ASCII char values for some special keys used in the monitor
#define BACKSPACE
8
#define CTRL_Q
17
#define CTRL_S
19
#define ESC
27
#define CTRL_C
3
#defineBELL
7
//Various record types used in eZ8 Hex files
#define DATARECORD 0x00
#define EOFRECORD 0x01
//Various return codes
#define LOADHEX_OK 0
#define LOADHEX_USERABORT 1
#define LOADHEX_ERRONEOUS 2
//---------------------------------------------------------------------------
//Various states of the hex file downloader function
#define WAITFOR_RECORDBEGIN 1
#define RECORDLENGTH 2
#define COMMENTFIELD 3
#define RECORDADDRESS 4
#define RECORDTYPE 5
#define DATAFIELD 6
#define SUMCHECK 7
#define EXTENDEDADDRESS 8
#define STARTADDRESS 9
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
8VHU,)K+HDGHUILOHIRU)ODVK/RDGHU8VHU,QWHUIDFH
/***********************************************************
* Copyright (C) 1999-2002 by ZiLOG, Inc.
* All Rights Reserved
*
* UserIF.h : Header file for Flash Loader User Interface
***********************************************************/
// Function Prototypes
void LoadHex(void);
void Write_Flash1(void);
void Read_Flash1 (void);
void inputIOport(void);
void outputIOport(void);
void prompt(void);
void display_help(void);
void execute_user_code(void);
void process_char(int c);
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
8WLOLW\K+HDGHUILOHIRU)ODVK/RDGHUXWLOLWLHV
/********************************************************
* Copyright (C) 1999-2002 by ZiLOG, Inc.
* All Rights Reserved
*
* utlity.h :Header file for Flash Loader Utilties
*******************************************************/
// Prototype Definitions
void clear_screen (void);
unsigned int ScanHex (unsigned char num);
int ascii_to_hex(int c);
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
&ILOHV
IODVKORDGHUFFRQWDLQVPDLQSURJUDPIRU)ODVK%RRW/RDGHU
/*************************************************
* Copyright (C) 1999-2002 by ZiLOG, Inc.
* All Rights Reserved
*
* flashloader.c: contains main program
* for Flash Boot Loader
*************************************************/
#include <stdio.h>
#include <string.h>
#include <ez8.h>
#include "SIO.h"
#include "utility.h"
#include "loadhex.h"
#include "UserIF.h"
/*************************************************
* Main Program
**************************************************/
main ()
{
int i;
unsigned char ch;
init_uart();
// check for special sequence key - space tab
for(i=0; i< 0x2000; i++)
if(U0STAT0 & 0x80) //Wait for receive data available
ch = U0D;
// if Special sequence key is not present - transfer PC
// to user application code area
if( ch != ’ ’)
execute_user_code();
// if Special sequence key is present -- clear screen, put Version String
// and prompt for User input
clear_screen();
puts(VersionString);
puts("\r\n\n Type H for help\n");
prompt();
while(1)
{
do
{
ch = getch ();
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
putch (ch);
} while(ch < 0);
process_char(ch);
}
} // end of main
/* Define ’C0’ Interrupt for code relocation. Interrupt ’C0’ is not
required for the boot loader, however is still defined as it is
a workaround for ZDS-II to perform code relocation*/
#pragma interrupt
void isr_C0(void)
{
}
void init_PC0(void)
{
SET_VECTOR(C0, isr_C0);
}
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
IODVKB,2F)ODVK,2'ULYHU5RXWLQHV
/*************************************************
* Copyright (C) 1999-2002 by ZiLOG, Inc.
* All Rights Reserved
*
* flash_IO.c:Flash I/O Driver routines
*************************************************/
#include <ez8.h>
#include "flash_IO.h"
char far Flash_Page[PAGE_SIZE];// Far is used so this variable is placed in
//Edata
char near RamByte;
/* This function unlocks Flash for Flash Programming */
unsigned int UnlockFlash(void)
{
if( (FSTAT & 0x3F) == 0x00 )// Flash Controller Locked state
{
FCTL = 0x73;// First unlock command
if ( (FSTAT & 0x3F) == 0x01 )// First unlock Command recieved
{
FCTL = 0x8C;// Second unlock command
if ( (FSTAT & 0x3F) == 0x02 )// Unlocked programming state
return 0x00;
else
return 0xFF;
}
else
return 0xFF;
}
else
return 0xFF;
}
/* Locks the Flash controller */
void LockFlash(void)
{
while( (FSTAT & 0x3F) != 0x00 )
{
FCTL = 0xFF;// write some value other than 0x73, 0x8c, 0x95, and 0x63
// to Flash control Register
}
}
/* This function Erases the page "pagenum" in Flash */
unsigned int EraseFlash(unsigned int pagenum)
{
unsigned int status;
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
status = UnlockFlash();
if (status == 0x00)
{
// check if Flash is unlocked
FPS = pagenum; // Set the page to be erased
FCTL = 0x95;// Page erase
}
// No need to unlock as Flash controller locks immediatetly after page erase
}
/* This function writes a single byte value to the Flash location. It assumes the Page
that corresponds to the location needs to be erased. */
void WriteByteToFlash(int location, unsigned int value)
{
unsigned int pagenum;
int i, TempLoc;
pagenum = (location>>9);// compute the page number of byte address
TempLoc = (location & 0xFE00);
for(i=0; i< PAGE_SIZE; i++)// save the Flash page in RAM
Flash_Page[i] = ReadByteFromFlash(TempLoc+i);
// Modify the byte location in RAM that corresponds to Flash saved page
Flash_Page[location - TempLoc] = value;
EraseFlash(pagenum);// erase Flash Page
// Restore the page from RAM back to Flash
for(i=0; i< PAGE_SIZE; i++)
WriteByteToFlash1(TempLoc+i, Flash_Page[i]);
LockFlash();
}
/* This function writes a single byte value in the Flash location. It assumes the Byte
value of the Flash location is 0xFF and need NOT be erased before programming */
void WriteByteToFlash1(int location, unsigned int value)
{
UnlockFlash();
RamByte=(location>>8);
asm("LD R8, _RamByte");
RamByte = (location & 0x00FF);
asm("LD R9, _RamByte");
RamByte = value;
asm("LD R10, _RamByte");
asm("LDC @RR8, R10");// Load Byte into Flash location
}
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
/* This function returns a single byte value read from the Flash location */
unsigned int ReadByteFromFlash(int location)
{
unsigned int value;
RamByte=(location>>8);
asm("LD R8, _RamByte");
RamByte = (location & 0x00FF);
asm("LD R9, _RamByte");
asm("LDC R10, @RR8");
asm("LD _RamByte, R10");
value = RamByte;
return (value&0xFF);
}
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
ORDGKH[F)XQFWLRQVWRSDUVHDKH[ILOHDQGGRZQORDGLQWRWKH)ODVK
/*************************************************
* Copyright (C) 1999-2002 by ZiLOG, Inc.
* All Rights Reserved
*
* loadhex.c : Functions to parse a hex file and
* download into the Flash
**************************************************/
#include <ez8.h>
#include <stdio.h>
#include <ctype.h>
#include "loadhex.h"
#include "flash_IO.h"
#include "SIO.h"
#include "utility.h"
extern char far Flash_Page[];
far char InterruptTable[0x38];
//------------------------------------------------------------------------------
char Ch, PrevCh;
unsigned int DownLoadState, HexCharCount, SumCheckValue, DownLoadErrors;
unsigned int Record_Address, RecType, CheckSumByte, DataCount, Count, index;
unsigned int LinesInFile, TotalBytes, NotWritable;
char done, SumByte, ChUpper, DataByte;
//------------------------------------------------------------------------------
char GetNextChar(void)
{
PrevCh = Ch;
Ch = getch();
return(Ch);
}
//------------------------------------------------------------------------------
void InitLoadHex(void)
{
unsigned int ch;
for(ch=0; ch < 0x38 ; ch++)
InterruptTable[ch] = 0xFF;
// Erase from location USER_START_ADDRESS(0x20) - 0xFFFF
for(ch = USER_START_PAGE; ch <= USER_END_PAGE; ch++)
EraseFlash(ch);
done = FALSE; PrevCh = ’\0’;
DownLoadState = WAITFOR_RECORDBEGIN; //wait for ’:’
DownLoadErrors = 0;
TotalBytes = 0;
NotWritable = 0;
LinesInFile = 0;
}
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
void LoadHexMain(void )
{
unsigned int ch;
Ch = GetNextChar();
if(Ch == ESC)
{
done = TRUE;
DownLoadState=LOADHEX_USERABORT;//User terminated load by pressing ESC key
}
else if(Ch == ’:’ && (DownLoadState != WAITFOR_RECORDBEGIN))
{
if (PrevCh == ’\n’)
LinesInFile++;
else
DownLoadErrors++;
DownLoadState=WAITFOR_RECORDBEGIN;
}
//Process te char depending on the state of download
switch(DownLoadState)
{
case WAITFOR_RECORDBEGIN:
switch(Ch)
{
case ’ ’: //Ignore white space before record begins
case ’\t’:
case ’\r’: //keep track of No.of Lines in hex file
LinesInFile++;
break;
case ’\n’:
if(PrevCh == ’\r’) break;
else LinesInFile++;
break;
case ’:’:
SumCheckValue = 0;
//Init the byte checksum to 0
DownLoadState = RECORDLENGTH;
HexCharCount = 0;
Count = 0;
break;
case ’*’:
//Allow for * delimited lines
DownLoadState = COMMENTFIELD;
break;
default: //We are recving out of place characters/ damaged record stream
DownLoadState = COMMENTFIELD;
DownLoadErrors++;
break;
}
break;
//---------------------------------------------------------
case COMMENTFIELD:
//Wait till resynchronization opportunity
if(Ch == ’\n’ || Ch == ’\r’)
DownLoadState = WAITFOR_RECORDBEGIN;
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
break;
//----------------------------------------------------------
case RECORDLENGTH:
if(!isxdigit(Ch))
{
DownLoadState = COMMENTFIELD;
break;
}
Count = ((Count << 4) | ascii_to_hex(Ch)) & 0xFF;
HexCharCount++;
if((HexCharCount & 0x01) == 0) SumCheckValue += Count & 0xFF;
if(HexCharCount == 2)
{
DownLoadState = RECORDADDRESS;
Record_Address = 0;
HexCharCount=0;
}
break;
//-----------------------------------------------------------
case RECORDADDRESS:
//A 4 character offset address field
if(!isxdigit(Ch))
{
DownLoadState = COMMENTFIELD;
break;
}
Record_Address = ((Record_Address << 4) | ascii_to_hex(Ch)) & 0xFFFF;
HexCharCount++;
if((HexCharCount & 0x01) == 0) SumCheckValue += Record_Address & 0xFF;
if(HexCharCount > 3)
{
DownLoadState = RECORDTYPE;
HexCharCount = 0;
RecType=0;
}
break;
//----------------------------------------------------------
case RECORDTYPE:
if(!isxdigit(Ch))
{
DownLoadState = COMMENTFIELD;
break;
}
RecType = ((RecType << 4) | ascii_to_hex(Ch)) & 0xFF;
HexCharCount++;
if(HexCharCount > 1)
{
HexCharCount = 0;
SumCheckValue += RecType;
index =0;
switch(RecType)
{
//----------------------------
case DATARECORD:
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
HexCharCount = 0;
if(Count>0)
DownLoadState = DATAFIELD;
else
DownLoadState = SUMCHECK;
SumByte = 0;
break;
//---------------------------
case EOFRECORD:
DownLoadState = SUMCHECK;
HexCharCount = 0;
SumByte = 0; //This used to recv incoming chksum
// Program the Option bits and Interrupt Vector Table
EraseFlash(0x00);
// Save User Reset Address
Record_Address =
(InterruptTable[03] + (InterruptTable[02]<<8) );
// Write BootLoader Reset Address
InterruptTable[02] = BL_STA_HIGH;
InterruptTable[03] = BL_STA_LOW;
for(ch=0; ch < 0x38 ; ch++)
{
WriteByteToFlash1((int)ch, (
unsigned int)InterruptTable[ch]);
LockFlash();
done = TRUE;
break;
//--------------------------
default:
DownLoadState = COMMENTFIELD;
DownLoadErrors++;
break;
//--------------------------
}//switch(RecType)
}//if
break;
//---------------------------------------------------------------
case DATAFIELD:
if(!isxdigit(Ch))
{
DownLoadErrors++;
DownLoadState = COMMENTFIELD;
break;
}
//Shift in the newest nibble and mask off leakage into upper nibbles
DataByte = ((DataByte << 4) | ascii_to_hex(Ch)) & 0xFF; //FF mask
HexCharCount++;
if((HexCharCount & 0x01) == 0)
{
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
SumCheckValue += DataByte;
Flash_Page[index] = DataByte;
if( Flash_Page[index] != DataByte)
{
NotWritable++;
DownLoadErrors++;
}
TotalBytes++;
index++;
}
//Same as "Hexchars >= Count*2" bytes
if(HexCharCount >= (Count << 1))
{
DownLoadState = SUMCHECK;
SumByte = 0;
HexCharCount = 0;
if (Record_Address > 0x3FFF)
{
// Program flash
for(ch=0; ch < Count ; ch++)
WriteByteToFlash1(Record_Address+ch,
(unsigned int)Flash_Page[ch]);
LockFlash();
}
else if (Record_Address < 0x0038)
{
for(ch=0; ch < Count; ch++)
InterruptTable[ch + (Record_Address& 0xFF)] =
Flash_Page[ch];
}
else
{
NotWritable += Count;
printf("\nHex file conflict with boot loader at
Record Address: %4x\n", Record_Address);
}
}
break;
//--------------------------------------------------------------
case SUMCHECK:
if(!isxdigit(Ch))
{
DownLoadState = COMMENTFIELD;
break;
}
SumByte = ((SumByte << 4) | ascii_to_hex(Ch)) & 0xFF;
HexCharCount++;
if(HexCharCount > 1)
{
putch(’.’);
HexCharCount = 0;
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
if(((SumByte + SumCheckValue)&0xFF) != 0)
DownLoadErrors++;
if(RecType == EOFRECORD)
done = TRUE;
else
{
DownLoadState = WAITFOR_RECORDBEGIN;
HexCharCount = 0;
}
}
break;
//-------------------------------------------------------------
default:
DownLoadErrors++;
DownLoadState = COMMENTFIELD;
break;
//-------------------------------------------------------------
}// end of switch
}// end of loadhex
//---------------------------------------------------------------------------
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
6LRF6HULDO,2'ULYHU5RXWLQHV
/*************************************************
* Copyright (C) 1999-2002 by ZiLOG, Inc.
* All Rights Reserved
*
* Sio.c :Serial I/O Driver Routines
*************************************************/
#include <stdio.h>
#include <eZ8.h>
// BRG = freq/( baud * 16)
#define FREQ
18432000
// 18.432MHz
#define BAUD
9600
// 9.6K baud
#define BRG
FREQ/(BAUD*16)
#define UART0
/*****************************************************************************/
void init_uart(void)
{
PAAF |= 0x30;
// Enable TxD0/RxD0 pins
U0BRH = (char)(BRG >> 8);
U0BRL = (char)(BRG & 0xff);
U0CTL0 = 0xc0; // Transmit enable, Receive Enable, No Parity, 1 Stop
}
/****************************************************************/
char putch(char c)
{
if (c == ’\n’)
{
do
{
#if defined(UART0)
U0CTL0 |= 0x20;
// Clear to send enable
} while (!(U0STAT0 & 0x04)); // Transmit Data register enabled
U0D = ’\r’; // Send data
#elif defined(UART1)
U1CTL0 |= 0x20; // Clear to send enable
} while (!(U1STAT1 & 0x04)); // Transmit Data register enabled
U1D = ’\r’; // Send data
#endif
}
do
{
#if defined(UART0)
U0CTL0 |= 0x20; // Clear to send enable
} while (!(U0STAT0 & 0x04)); // Transmit Data register enabled
U0D = c; // Send data
#elif defined(UART1)
U1CTL0 |= 0x20; // Clear to send enable
} while (!(U1STAT1 & 0x04));// Transmit Data register enabled
U1D = c; // Send data
#endif
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
}
/****************************************************************/
int kbhit(void)
{
#if defined(UART0)
if (U0STAT0 & 0x80) // check for receive data available
#elif defined(UART1)
if (U1STAT1 & 0x80) // check for receive data available
#endif
return(1);
return(0);
}
/****************************************************************/
char getch(void)
{
char ch;
#if defined(UART0)
while (!(U0STAT0 & 0x80)); // Wait for receive data available
ch = U0D;
#elif defined(UART1)
while (!(U1STAT1 & 0x80)); // Wait for receive data available
ch = U1D;
#endif
if (ch == ’\r’ || ch == (’\r’|0x80))
return ’\n’;
return(ch);
}
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
XVHULIF8VHU,QWHUIDFHIRUWKH)ODVK/RDGHU
/*************************************************
* Copyright (C) 1999-2002 by ZiLOG, Inc.
* All Rights Reserved
*
* userif.c : User Interface for the Flash Loader
**************************************************/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <ez8.h>
#include "UserIF.h"
#include "utility.h"
#include "Flash_IO.h"
#include "EVB.h"
#include "SIO.h"
#include "loadhex.h"
extern unsigned int DownLoadState, DownLoadErrors;
extern unsigned int Record_Address, LinesInFile, TotalBytes, NotWritable;
extern char done;
//---------------------------------------------------------------------------
void LoadHex(void)
{
printf ("\r\n\tLoad Hex file.. ");
InitLoadHex();
while(!done)
{
LoadHexMain();
}
if(DownLoadState == LOADHEX_USERABORT)
printf("\r\nTerminated by ESC\r\n");
else
{
printf("\r\nDownload Completed\n\n");
printf("\r\n\tDownload Summary of User Application");
printf("\r\n\t====================================\n");
printf("\r\nStart/Reset Address \t\t: %X", Record_Address);
printf("\r\nNo. of Bytes \t\t\t: %d", TotalBytes);
printf("\r\nNo. of Bytes Not Writable \t: %d", NotWritable);
printf("\r\nNo. of Lines \t\t\t: %d", LinesInFile);
printf("\r\nNo. of Download Errors \t\t: %d", DownLoadErrors);
}
}
/****************************************************************/
// This funcction writes to FLASH
/****************************************************************/
void Write_Flash1(void)
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
{
unsigned char data;
unsigned int addr;
printf ("\n\r\nEnter Memory Location = ");
addr = ScanHex (4);
data = ReadByteFromFlash(addr);
printf ("\n\rCurrent FLASH Value [%4X] = %2X", addr, data);
printf ("\n\r\nEnter New data = ");
data = ScanHex (2);
WriteByteToFlash(addr, data);
}
/****************************************************************/
// This funcction reads from FLASH
/****************************************************************/
void Read_Flash1(void)
{
unsigned char data;
unsigned int addr;
printf ("\n\r\nEnter Memory Location = ");
addr = ScanHex (4);
data = ReadByteFromFlash(addr);
printf("\n\r\nFLASH [%4X] = %2X", addr, data);
}
/****************************************************************/
// This function reads IO port
/****************************************************************/
void inputIOport(void)
{
unsigned char ch;
int address;
printf ("\r\n\tEnter I/O Address [HEX]: ");
address = ScanHex (3);
ch = IO_ADDR (address);
printf ("\n\r\tCurrent I/O Data = %xH [%xH]",ch,address);
}
/****************************************************************/
// This function writes IO port
/****************************************************************/
void outputIOport(void)
{
unsigned char ch;
int address;
printf ("\r\n\tEnter I/O Addr [HEX]: ");
address = ScanHex (3);
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
printf ("\r\n\tEnter I/O data (Current: %2xH [%xH]): ",IO_ADDR (address), address);
ch = ScanHex (2);
IO_ADDR (address) = ch;
}
/****************************************************************/
// This displays the system prompt
/****************************************************************/
void prompt(void)
{
printf(PromptString);
}
/****************************************************************/
// This displays the list of valid commands.
// This is the "help" screen.
/****************************************************************/
void display_help(void)
{
puts("\r\n");
puts("\r H\tDisplay this help");
puts("\r V\tVersion");
puts("\r I\tInput RAM or I/O Port");
puts("\r O\tOutput RAM or I/O Port");
puts("\r R\tRead FLASH");
puts("\r W\tWrite FLASH");
puts("\r L\tLoad Hex File");
printf(" G\tExecute User Application code from %X H \n", USER_START_ADDR);
}
// Function to Execute User Application code from location JUMP_TO_USER_CODE
void execute_user_code(void)
{
asm(JUMP_TO_USER_CODE);
}
/****************************************************************/
// This parses the commands received from main, sorts
// through to determine what type of command it is, then calls
// the appropriate routine to handle it.
/****************************************************************/
void process_char(int c)
{
switch( c )
{
case ’?’:
case ’h’:
case ’H’:
display_help();
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
break;
case ’w’:
case ’W’:
Write_Flash1();
break;
case ’r’:
case ’R’:
Read_Flash1();
break;
case ’i’:
case ’I’:
inputIOport ();
break;
case ’o’:
case ’O’:
outputIOport ();
break;
case ’l’:
case ’L’:
LoadHex();
break;
case ’g’:
case ’G’:
printf("\r\n Executing User Application code from %X H \n",
USER_START_ADDR);
execute_user_code();
break;
case ’v’:
case ’V’:
puts(VersionString);
break;
default:
break;
}
prompt();
}
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
XWLOLW\F8VHU,QWHUIDFH8WLOLWLHV
/*************************************************
* Copyright (C) 1999-2002 by ZiLOG, Inc.
* All Rights Reserved
*
* utility.c : User Interface Utilities
**************************************************/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "SIO.h"
#include <eZ8.h>
/****************************************************************/
// Clear Screen
/****************************************************************/
void clear_screen (void)
{
unsigned int i;
i=32;
while (i > 0)
{
printf ("\n");
i=i-1;
}
}
/****************************************************************/
// This converts an ascii hex character to it’s binary value
// return -1 on error
/****************************************************************/
int ascii_to_hex(int c)
{
if((c >= ’0’) && (c <= ’9’))
return c - ’0’;
else if((c >= ’A’) && (c <= ’F’))
return c - ’A’ + 10;
else if((c >= ’a’) && (c <= ’f’))
return c - ’a’ + 10;
else
return -1;
}
/****************************************************************/
unsigned int ScanHex (unsigned char num)
{
unsigned char ch;
unsigned int addr;
int temp1, temp2, temp3, temp4;
do {
ch=getch ();
temp1 = ascii_to_hex (ch);
} while (temp1 < 0);
printf ("%X",temp1);
if (num == 1) {
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1
ch = temp1 & 0xf;
return (ch);
}
do {
ch=getch ();
temp2 = ascii_to_hex (ch);
} while (temp2 < 0);
printf ("%X",temp2);
if (num == 2) {
ch = (temp1 << 4) & 0xF0;
ch = (ch | temp2) & 0xFF;
return (ch);
}
do {
ch=getch ();
temp3 = ascii_to_hex (ch);
} while (temp3 < 0);
printf ("%X",temp3);
if (num == 3) {
addr = 0x0000;
addr = (temp1 << 4) & 0x00F0;
addr = (addr | temp2);
addr = (addr << 4) & 0x0FF0;
addr = (addr | temp3) & 0x0FFF;
return (addr);
}
do {
ch=getch ();
temp4 = ascii_to_hex (ch);
} while (temp4 < 0);
printf ("%X",temp4);
addr = 0x0000;
addr = (temp1 << 4) & 0x00F0;
addr = (addr | temp2);
addr = (addr << 4) & 0x0FF0;
addr = (addr | temp3);
addr = (addr << 4) & 0xFFF0;
addr = (addr | temp4) & 0xFFFF;
return (addr);
}
$SSOLFDWLRQ1RWH
)ODVK/RDGHUIRU=(QFRUH
70
$1