Line 8... |
Line 8... |
* Software 'as is' without warranty. Author liable for nothing.
|
* Software 'as is' without warranty. Author liable for nothing.
|
* DESCRIPTION:
|
* DESCRIPTION:
|
* Plasma FTP server and FTP client and TFTP server and client
|
* Plasma FTP server and FTP client and TFTP server and client
|
* and Telnet server.
|
* and Telnet server.
|
*--------------------------------------------------------------------*/
|
*--------------------------------------------------------------------*/
|
|
#define INCLUDE_FILESYS
|
#ifdef WIN32
|
#ifdef WIN32
|
#include <stdio.h>
|
#include <stdio.h>
|
#include <stdlib.h>
|
#include <stdlib.h>
|
#include <string.h>
|
#include <string.h>
|
#include <ctype.h>
|
#include <ctype.h>
|
#define _LIBC
|
#define _LIBC
|
#undef INCLUDE_FILESYS
|
|
#define INCLUDE_FILESYS
|
|
#else
|
|
#define INCLUDE_FILESYS
|
|
#endif
|
#endif
|
#include "rtos.h"
|
#include "rtos.h"
|
#include "tcpip.h"
|
#include "tcpip.h"
|
#ifdef WIN32
|
|
#define UartPrintf printf
|
|
#define OS_MQueueCreate(A,B,C) 0
|
|
#define OS_MQueueGet(A,B,C) 0
|
|
#define OS_ThreadCreate(A,B,C,D,E) 0
|
|
#endif
|
|
|
|
|
|
//******************* FTP Server ************************
|
//******************* FTP Server ************************
|
typedef struct {
|
typedef struct {
|
IPSocket *socket;
|
IPSocket *socket;
|
Line 535... |
Line 526... |
CommandPtr[CommandIndex] = CommandHistory;
|
CommandPtr[CommandIndex] = CommandHistory;
|
strcpy(CommandHistory, command);
|
strcpy(CommandHistory, command);
|
}
|
}
|
if(strncmp(command, "help", 4) == 0)
|
if(strncmp(command, "help", 4) == 0)
|
{
|
{
|
sprintf((char*)bufOut, "Commands: help, exit, cat, cp, ls, mkdir, rm");
|
sprintf((char*)bufOut, "Commands: help, exit, cat, cp, ls, mkdir, rm, flasherase");
|
for(i = 0; TelnetFuncList[i].name; ++i)
|
for(i = 0; TelnetFuncList[i].name; ++i)
|
{
|
{
|
strcat((char*)bufOut, ", ");
|
strcat((char*)bufOut, ", ");
|
strcat((char*)bufOut, TelnetFuncList[i].name);
|
strcat((char*)bufOut, TelnetFuncList[i].name);
|
}
|
}
|
Line 676... |
Line 667... |
}
|
}
|
fclose(fileIn);
|
fclose(fileIn);
|
}
|
}
|
return 0;
|
return 0;
|
}
|
}
|
|
#ifdef INCLUDE_FLASH
|
|
else if(strcmp(bufA, "flasherase") == 0)
|
|
{
|
|
strcpy(bufD, "\r\nErasing");
|
|
IPWrite(socket, (uint8*)bufD, strlen(bufD));
|
|
IPWriteFlush(socket);
|
|
strcpy(bufD, ".");
|
|
for(bytes = 1024*128; bytes < 1024*1024*16; bytes += 1024*128)
|
|
{
|
|
IPWrite(socket, (uint8*)bufD, strlen(bufD));
|
|
IPWriteFlush(socket);
|
|
FlashErase(bytes);
|
|
}
|
|
strcpy(bufD, "\r\nMust Reboot\r\n");
|
|
IPWrite(socket, (uint8*)bufD, strlen(bufD));
|
|
IPWriteFlush(socket);
|
|
OS_ThreadSleep(OS_WAIT_FOREVER);
|
|
return 0;
|
|
}
|
|
#endif
|
return -1;
|
return -1;
|
}
|
}
|
|
|
|
|
void TransferDone(uint8 *data, int bytes)
|
void TransferDone(uint8 *data, int bytes)
|