#include "rtxcapi.h" //defines TIMEBASE
//#include "kproject.h" //defines CLKTICK
#include "cpu.h"
#include "example.h"
#include "util.h"
char *mypage_body;
int mypage_header_len = 0;
extern unsigned long gcycle;
extern int gUserRun;
extern int isConActive;
extern int storedBytes;
extern char *gjtag_fptr, *gjtag_fstart;
extern int gjtag_fsize;
//extern int Https_TestIndexPage_len;
//extern char *Https_TestIndexPage;
#define Https_TestIndexPage_Len 80*40 //&RA if more than 80*50 then compilation error: "region .DATA full"
int Https_TestIndexPage_len = Https_TestIndexPage_Len;
static char mypage[Https_TestIndexPage_Len];
char *Https_TestIndexPage = (char*)mypage;
const char mypage_header[]=
"HTTP/1.0 200 OK\r\n\
Server: ESERV-10/1.0\nContent-type: text/html\r\n\
Content-length: 400\r\n\
\r\n\
\
InSyst\
\
N3C System Status
";
const char mypage_footer[]=
"
\
\
\r\n\
N3C ColdFire System, BNL\
\r\n\
\
\
Andrey Sukhanov\
";
void insyst_init()
{
char *ptri,*ptro;
char *buf="CLKTICK=1234\n";
printl("Starting insyst.c\r\n");
itoa_q((int)CLKTICK, buf+8, 4, 10);
printl(buf);
strcpy(Https_TestIndexPage,mypage_header);
mypage_header_len = strlen(Https_TestIndexPage);
strcat(Https_TestIndexPage,mypage_footer);
}
TICKS gcycle_tick=0;
extern TICKS gticks_played;
void insyst_update_status()
{
TICKS tick_diff=0;
unsigned long diff_time=0;
static char *string = "12345: UserRun=12345678. \n";
static char *srcvd = "Received 1234567 bytes. \n";
static char *sticks = "123456: Elapsed ticks 1234567\n";
static char *slast_update = "1234567ms since last update.
";
static char *sjtag = "Played 1234567 bytes in 123456ms
";
unsigned long bytes_processed=0;
if(gcycle_tick == 0){
TS_GetElapsedCounterTicks(TIMEBASE,&gcycle_tick);
}else{
tick_diff = TS_GetElapsedCounterTicks(TIMEBASE,&gcycle_tick);//
}
diff_time = tick_diff*CLKTICK/CPU_TICKS_PER_MS;
//looks like CLKTICK is wrong, correct it as defined in cpu.h
// print cycle and elapsed tick, note it is called twice per http update
itoa_q(gcycle,sticks,6,10);
itoa_q(tick_diff,sticks+22,7,10);
printl(sticks);
// do not update page too often
if(0