Bsc.c
/******************************************************************************
* *
* M O D U L E D E F I N E *
* *
******************************************************************************/
#define BSC_C
/******************************************************************************
* *
* C O M P I L E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#include <string.h>
#include <ctype.h>
/******************************************************************************
* *
* U S E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#include "Common.h"
#include "XCore.h"
#include "XProFile.h"
#include "XFuseFlash.h"
#include "..\Parser.h"
#include "..\ParserUtil.h"
#include "BscImmed.h"
#include "BscReport.h"
#include "BscFactory.h"
#include "BscFunc.h"
#include "Bsc.h"
/******************************************************************************
* *
* L O C A L D E F I N E S *
* *
******************************************************************************/
/******************************************************************************
* *
* L O C A L T Y P E D E F S *
* *
******************************************************************************/
/******************************************************************************
* *
* L O C A L F U N C T I O N P R O T O T Y P E S *
* *
******************************************************************************/
/******************************************************************************
* *
* L O C A L I N I T I A L I Z E D D A T A D E F I N I T I O N S *
* *
******************************************************************************/
CONST STATIC _CmdEntry BscEntry[] =
{
{"LIMITFEED", FN_LIMITFEED},
{"RESET_CNT", FN_CLEAR_M},
{"CLEAR_MIL", FN_CLEAR_M},
{"CLEAR_LABLE", FN_CLEAR_L},
{"CLEAR_CONT", FN_CLEAR_C},
{"TEST_BRN", FN_TEST_BURN},
{"TEST_FACT", FN_TEST_FACTORY},
{"ALLCONFIG", FN_CONFIG},
{"CONFIGIP", FN_IPCONFIG},
{"SELFTEST", FN_SELFTEST},
{"FILES", FN_FILES},
{"TEXTDUMP", FN_DUMP_TEXT},
{"CHECKSUM", FN_CHECKSUM},
{"VER", FN_VER},
#if defined(GRAPHIC_PRODUCT)
{"FILETCF", FN_PROFILE},
#else
{"CONFFILE", FN_PROFILE},
#endif
{"DBUG", FN_DEBUG},
{"INITIALPRINTER", FN_INITIALPRINTER},
{"GAPDETECT", FN_GAPDETECT},
{"BLINEDETECT", FN_BLINEDETECT},
{"AUTODETECT", FN_AUTODETECT},
{"DIGNOSTIC", FN_DIAGNOSTIC},
{"FACTORY", FN_FACTORY},
{"NET", FN_NET},
{"TestCard", FN_CardTest},
//{"FuseDF", FN_FuseDF},
{"UpdataDF", FN_FuseDF},
#if defined(TTP245P_PCB) ||defined(TTP245P_PCB)||defined(T045_PCB) ||defined(T40_PCB)
//{"Fuse245P", FN_FuseFlash},
#if defined(UPDATE_MODEL_NAME)
{"Updata"UPDATE_MODEL_NAME, FN_FuseFlash},
#else
{"Updata"MODEL_NAME, FN_FuseFlash},
#endif
#endif
{(CHAR *)_NULL, _NULL}
};
/******************************************************************************
* *
* L O C A L U N I T I A L I Z E D D A T A D E F I N I T I O N S *
* *
******************************************************************************/
/******************************************************************************
*
* Function:
* InitialBsc
*
* Description:
*
*
* Input:
* None
*
* Output:
* None.
*
******************************************************************************/
BOOL InitialBsc(VOID)
{
InitialImmCmd();
InitialBscReport();
return TRUE;
}
/******************************************************************************
*
* Function:
* BaseSysCmdSyntaxParsing
*
* Description:
*
*
* Input:
* None
*
* Output:
* None.
*
******************************************************************************/
BOOL BscSyntaxParsing(VOID)
{
_CmdEntry *CmdEntry;
CHAR abString[TOKEN_LEN];
CHAR bTemp;
#ifdef DEBUG_PRNT
sysprintf("Enter BscSyntaxParsing()...\n"); // ch_20211209
#endif
ClearParserPool();
bTemp = NextByte();
//sysprintf("bTemp_0 : %c\n", bTemp); // ch_20211209
BackByte(bTemp);
//sysprintf("bTemp_1 : %c\n", bTemp); // ch_20211209
if (isalpha(bTemp))
{
//sysprintf("abString_0 : %s\n", abString); // ch_20211209
// get command token
if (GetToken(abString, &bTemp, "\r\n\t =", sizeof(abString)) < sizeof(abString) - 1)
{
BackByte(bTemp);
//sysprintf("bTemp_2 : %c\n", bTemp); // ch_20211209
#ifdef DEBUG_PRNT
sysprintf("abString_1 : %s\n", abString); // ch_20211209
#endif
// check system command
if (CmdEntry = CheckStringCommand(abString, BscEntry))
{
if (CmdEntry->func() == _SUCCESS)
#ifdef DEBUG_PRNT
sysprintf("check %s success\n",CmdEntry->keyword);
#endif
return TRUE;
}
}
}
if (!BackParsePool())
return TRUE;
return FALSE;
}
/******************************************************************************
*
* Function:
* CheckAutoUpdate
*
* Description:
*
*
* Input:
* None
*
* Output:
* None.
*
******************************************************************************/
VOID CheckAutoUpdate(VOID)
{
#if defined(SDCARD_MODEL)
FuseFlashFromCard("AUTO.NEW");
FuseFlashFromCard("AUTO.ALL");
#endif
}
Bsc.h ///
#ifndef BSC_H
/******************************************************************************
* *
* M O D U L E D E F I N E *
* *
******************************************************************************/
#define BSC_H
/******************************************************************************
* *
* C O M P I L E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
/******************************************************************************
* *
* U S E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
/******************************************************************************
* *
* G L O B A L D E F I N E S *
* *
******************************************************************************/
/******************************************************************************
* *
* S T R U C T U R E D E F I N I T I O N S *
* *
******************************************************************************/
/******************************************************************************
* *
* G L O B A L V A R I A B L E S - N O I N I T I A L I Z E R S *
* *
******************************************************************************/
#ifdef BSC_C
#define EXTERN
#else
#define EXTERN extern
#endif
/******************************************************************************
* *
* G L O B A L V A R I A B L E S - I N I T I A L I Z E R S *
* *
******************************************************************************/
/******************************************************************************
* *
* F U N C T I O N P R O T O T Y P E S *
* *
******************************************************************************/
//--- Bsc ---//
BOOL InitialBsc(VOID);
BOOL BscSyntaxParsing(VOID);
VOID CheckAutoUpdate(VOID);
//--- BscImmed ---//
BOOL CtrlImmedCmd(BOOL);
INT CheckImmedCmd(CHAR, CHAR *, INT);
//--- BscReport ---//
REPORT *IpConfigReport(REPORT *, BOOL, _OutputWay);
REPORT *BtConfigReport(REPORT *, BOOL, _OutputWay);
REPORT *SelfTestReport(REPORT *, BOOL, _OutputWay);
REPORT *FileReport(REPORT *, BOOL, _OutputWay);
VOID DumpText(REPORT *);
//--- BscFactory ---//
VOID TestBurn(VOID);
#undef EXTERN
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */
#endif
BscFactory.c ///
/******************************************************************************
* *
* M O D U L E D E F I N E *
* *
******************************************************************************/
#define BSCFACTORY_C
/******************************************************************************
* *
* C O M P I L E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
/* None */
/******************************************************************************
* *
* U S E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#include "Common.h"
#include "XCore.h"
#include "XADC.h"
#include "XLED.h"
#include "XBuzzer.h"
#include "XTimer.h"
#include "XVarBank.h"
#include "XDisplay.h"
#include "XFunction.h"
#include "..\Parser.h"
#include "..\ParserUtil.h"
#include "BscFactory.h"
/******************************************************************************
* *
* L O C A L D E F I N E S *
* *
******************************************************************************/
/* None */
/******************************************************************************
* *
* L O C A L T Y P E D E F S *
* *
******************************************************************************/
/* None */
/******************************************************************************
* *
* L O C A L F U N C T I O N P R O T O T Y P E S *
* *
******************************************************************************/
/* None */
/******************************************************************************
* *
* L O C A L I N I T I A L I Z E D D A T A D E F I N I T I O N S *
* *
******************************************************************************/
/* None */
/******************************************************************************
* *
* L O C A L U N I T I A L I Z E D D A T A D E F I N I T I O N S *
* *
******************************************************************************/
#if defined(TTP2410M) || defined(TTP246MP) || defined(TTP346M) || defined(TTP344MP) || defined(TTP644M) || defined(TTP384M) || defined(DL9000)
STATIC VOID ErrorBurnSound(VOID)
{
#ifdef DEBUG_PRNT
sysprintf("Enter ErrorBurnSound()...\n"); // ch_20211210
#endif
while ( 1 )
{
EnableBuzzer(10, 50); while (CheckBuzzerStatus()){}
EnableBuzzer(5, 50); while (CheckBuzzerStatus()){}
EnableBuzzer(0, 50); while (CheckBuzzerStatus()){}
}
}
VOID TestBurn(VOID)
{
_PrintCfg *pBurnCfg = GrabPrintConfig();
INT loop = 0;
if ( pBurnCfg->TestBurn == FALSE )
return;
StopCheckCarriageOpen();
while ( 1 )
{
#if defined(LCD_MODEL)
ShowLCDString(0, 0, "BURN TESTING...", 0);
#endif
EnableSensor(GAP_SENSOR, 1, 0, HALF_AD_SCALE);
EnableSensor(RIBBON_SENSOR, 1, 0, HALF_AD_SCALE);
ShowLED(HID_LED_OFF, HID_LED_OFF, HID_LED_OFF); DelayTime(10000000);
ShowLED(HID_LED_ON, HID_LED_ON, HID_LED_ON); DelayTime(10000000);
if ( ++loop >= 100 )
loop = 0;
if ( loop == 3 )
{
MotorMove(300, pBurnCfg, MOTOR_FORWARD, _NULL);
WaitWorkJobEnd();
}
if ( loop == 6 )
{
MotorMove(300, pBurnCfg, MOTOR_BACKWARD, _NULL);
WaitWorkJobEnd();
}
if ( GetSensorSignal(GAP_SENSOR) == SENSOR_UNDETECTED )
{
#if defined(LCD_MODEL)
ShowLCDString(0, 0, "GAP ERROR", 0);
#endif
ErrorBurnSound();
}
if ( !IsCarriageOpen() )
{
#if defined(LCD_MODEL)
ShowLCDString(0, 0, "CARRIAGE CLOSE", 0);
#endif
ErrorBurnSound();
}
if ( GetSensorSignal(RIBBON_SENSOR) == SENSOR_UNDETECTED )
{
#if defined(LCD_MODEL)
ShowLCDString(0, 0, "RIBBON ERROR", 0);
#endif
ErrorBurnSound();
}
}
}
#endif
BscFactory.h ///
#ifndef BSCFACTORY_H
/******************************************************************************
* *
* M O D U L E D E F I N E *
* *
******************************************************************************/
#define BSCFACTORY_H
/******************************************************************************
* *
* C O M P I L E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
/* None */
/******************************************************************************
* *
* U S E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
/******************************************************************************
* *
* G L O B A L D E F I N E S *
* *
******************************************************************************/
/* None */
/******************************************************************************
* *
* S T R U C T U R E D E F I N I T I O N S *
* *
******************************************************************************/
/* None */
/******************************************************************************
* *
* G L O B A L V A R I A B L E S - N O I N I T I A L I Z E R S *
* *
******************************************************************************/
#ifdef BSCFACTORY_C
#define EXTERN
#else
#define EXTERN extern
#endif
/******************************************************************************
* *
* G L O B A L V A R I A B L E S - I N I T I A L I Z E R S *
* *
******************************************************************************/
/* None */
/******************************************************************************
* *
* F U N C T I O N P R O T O T Y P E S *
* *
******************************************************************************/
VOID TestBurn(VOID);
#undef EXTERN
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */
#endif
BscFunc.c /
/******************************************************************************
* *
* M O D U L E D E F I N E *
* *
******************************************************************************/
#define BSCFUNC_C
/******************************************************************************
* *
* C O M P I L E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
/******************************************************************************
* *
* U S E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#include "Common.h"
#include "XCore.h"
#include "XADC.h"
#include "XLCD.h"
#include "XLED.h"
#include "XKey.h"
#include "XGPIO.h"
#include "XBuzzer.h"
#include "XFlash.h"
#include "XSDCard.h"
#include "XRTC.h"
#include "XTimer.h"
#include "XFuseFlash.h"
#include "XDisplay.h"
#include "XFunction.h"
#include "..\Parser.h"
#include "..\ParserUtil.h"
#include "BscUtil.h"
#include "BscReport.h"
#include "BscFactory.h"
#include "BscFunc.h"
/******************************************************************************
* *
* L O C A L D E F I N E S *
* *
******************************************************************************/
/******************************************************************************
* *
* L O C A L T Y P E D E F S *
* *
******************************************************************************/
/******************************************************************************
* *
* L O C A L F U N C T I O N P R O T O T Y P E S *
* *
******************************************************************************/
/******************************************************************************
* *
* L O C A L I N I T I A L I Z E D D A T A D E F I N I T I O N S *
* *
******************************************************************************/
CONST STATIC _CmdEntry DiagnosticEntry[] =
{
{"DIGPWD", FN_DIAG_PASSWORD},
{"DIGINTERFACE", FN_DIAG_INTERFACE},
{"DIGREPORT", FN_DIAG_REPORT},
{"DIGFILE", FN_DIAG_FILE},
{(CHAR *)_NULL, _NULL}
};
CONST STATIC _CmdEntry FactoryEntry[] =
{
{"FACLABEL", FN_FAC_LABEL},
{"FACMILAGE", FN_FAC_MILAGE},
{"CUTTERCOUNTER", FN_FAC_CUTCOUNTER},
{"FACONTRAST", FN_FAC_CONTRAST},
{"FACSERIAL", FN_FAC_SERIAL},
{"FACTHPSERIAL", FN_FAC_TPH_SERIAL},
{"FACRESPONSE", FN_FAC_RESPONSE},
{"FACSETTING", FN_FAC_SETTING},
{"FACTEST", FN_FAC_TEST},
{"FACPS2TEST", FN_FAC_PS2TEST},
{(CHAR *)_NULL, _NULL}
};
CONST STATIC _CmdEntry NetEntry[] =
{
{"MAC", FN_NET_MAC},
{"DHCP", FN_NET_DHCP},
{"IP", FN_NET_IP},
{"PORT", FN_NET_PORT},
{"NAME", FN_NET_NAME},
{(CHAR *)_NULL, _NULL}
};
/******************************************************************************
* *
* L O C A L U N I T I A L I Z E D D A T A D E F I N I T I O N S *
* *
******************************************************************************/
INT FN_LIMITFEED(VOID)
{
INT data;
if (!BscGetSize(LINE_END, &data))
return _ERROR;
if (data < 0)
return _ERROR;
pPrintCfg->LimitFeed = (WORD)data;
return _SUCCESS;
}
//extern INT RibbonCount ;
extern INT PrintCnt;
extern INT Mcont;
STATIC WORD BLINE_1K_data[4] = {928,251,139,99};
STATIC WORD GAP_1K_data[16] = {929,695,579,479,397,350,316,283,
253,229,216,201,186,174,162,154
};
INT FN_DEBUG(VOID)
{
INT Arg1, Arg2, Arg3,count,i_reg;
WORD wData;
// get first argument
if (!BscGetNumber(COMMA_END, &Arg1))
return _ERROR;
// get second argument
if (!BscGetNumber(COMMA_END, &Arg2))
return _ERROR;
// get third argument
if (!BscGetNumber(LINE_END, &Arg3))
return _ERROR;
switch (Arg1)
{
case 0:
#if defined(GAP_SENSOR_AD)
StartADConvert(GAP_SENSOR_AD);
wData = ReadAD(GAP_SENSOR_AD);
SendPrintf("\r\n GAP Sensor AD:%d", wData);
#else
SendPrintf("\r\n GAP Sensor %d", GetSensorSignal(GAP_SENSOR));
#endif
break;
case 1:
#if defined(BLINE_SENSOR_AD)
StartADConvert(BLINE_SENSOR_AD);
wData = ReadAD(BLINE_SENSOR_AD);
SendPrintf("\r\n Black Mark Sensor AD:%d", wData);
#else
SendPrintf("\r\n Black Mark Sensor %d", GetSensorSignal(BLINE_SENSOR));
#endif
break;
case 2:
#if defined(RIBBON_SENSOR_AD)
StartADConvert(RIBBON_SENSOR_AD);
wData = ReadAD(RIBBON_SENSOR_AD);
SendPrintf("\r\n RIBBON Sensor AD:%d", wData);
#else
SendPrintf("\r\n RIBBON Sensor %d", GetSensorSignal(RIBBON_SENSOR));
#endif
break;
case 3:
#if defined(PEEL_SENSOR_AD)
StartADConvert(PEEL_SENSOR_AD);
wData = ReadAD(PEEL_SENSOR_AD);
SendPrintf("\r\n PEEL Sensor AD:%d", wData);
#else
SendPrintf("\r\n PEEL Sensor %d", PeelSensorSignal());
#endif
break;
case 4:
#if defined(CUTTER_CUR_AD)
StartADConvert(CUTTER_CUR_AD);
wData = ReadAD(CUTTER_CUR_AD);
SendPrintf("\r\n Cutter Curren AD:%d", wData);
#elif defined(MOTOR_TEMP_AD)
StartADConvert(MOTOR_TEMP_AD);
wData = ReadAD(MOTOR_TEMP_AD);
SendPrintf("\r\n Motor Temp AD:%d", wData);
#endif
break;
case 5:
#if defined(VERSION_AD)
SendPrintf("StartADConvert");
StartADConvert(VERSION_AD);
wData = ReadAD(VERSION_AD);
SendPrintf("\r\n Version AD:%d", wData);
#endif
break;
case 6:
#if defined(TPH_TEMP_AD)
StartADConvert(TPH_TEMP_AD);
wData = ReadAD(TPH_TEMP_AD);
SendPrintf("\r\n TPH Temp AD:%d", wData);
#endif
break;
case 7:
#if defined(TPH_VOLT_AD)
StartADConvert(TPH_VOLT_AD);
wData = ReadAD(TPH_VOLT_AD);
SendPrintf("\r\n TPH Volt AD:%d", wData);
#endif
break;
case 8:
SendPrintf("\r\n Feed Key:%d", !CheckKeyPin(FEED_KEY));
SendPrintf("\r\n Pause Key:%d", !CheckKeyPin(PAUSE_KEY));
break;
case 9:
{
while (Arg2)
{
VOID *p = malloc(Arg2 * 1024);
if (p)
{
SendPrintf("\r\n Heap space remaining %u KByte", Arg2);
free(p);
break;
}
Arg2 -= ((Arg2-Arg3) ? Arg3 : 1);
}
break;
}
case 10:
{
#if defined(AT91SAM9260)
SendString("\r\n Capture");
while (1)
{
if (GetKey(FEED_KEY))
{
SendString("\r\n Press Feed Key");
break;
}
if (AT91C_BASE_TC1->TC_SR & AT91C_TC_LDRAS)
SendPrintf("\r\n Capture Value = %d", AT91C_BASE_TC1->TC_RA);
}
#endif
break;
}
case 11:
SendString("\r\n Run Buzzer");
while (CheckBuzzerStatus()) {}
EnableBuzzer(Arg2, Arg3);
break;
case 12:
EnableSensor(GAP_SENSOR, Arg2, Arg3, 0);
SendPrintf("\r\n Set Gap Sensor:%d%s", Arg2, Arg3 ? " Heighten" : "");
break;
case 13:
EnableSensor(BLINE_SENSOR, Arg2, Arg3, 0);
SendPrintf("\r\n Set Bline Sensor:%d%s", Arg2, Arg3 ? " Heighten" : "");
break;
case 14:
EnableSensor(RIBBON_SENSOR, Arg2, Arg3, 0);
SendPrintf("\r\n Set Ribbon Sensor:%d%s", Arg2, Arg3 ? " Heighten" : "");
break;
case 15:
if (Arg2) EnablePeel();
else DisablePeel();
SendPrintf("\r\n Set Peel Sensor:%d", Arg2);
break;
case 16:
#if defined(CARRIAGE_OPEN_MODEL)
SendPrintf("\r\n Carriage Open:%d", IsCarriageOpen());
#endif
break;
case 17:
FlashInformation();
break;
case 18:
{
SendBuffer((BYTE *)Arg2, Arg3);
break;
}
case 19:
SendPrintf("\r\n Peel Switch:%d", IsPeelSwitchON());
break;
#if defined(DEFAULT_MCARD_MODEL) || defined(FLASH_MCARD_MODEL)
// check memory card
case 20:
{
_FlashInfo *info;
WORD *pAddr;
INT i;
SendString("\r\n Test Memory Card");
pAddr = (WORD *)MEMORY_CARD_ADDR;
for (i = 0; i < 4; i++)
{
SendPrintf("\r\n Flash Addr:%08X", (LONG)pAddr);
if ((info = GetFlashInfo((ULONG)pAddr)) == _NULL)
{
SendPrintf("\r\n Memory card Flash %d not exist", i);
}
else
{
SendPrintf("\r\n Memory card Flash %d OK", i);
SendPrintf("\r\n Flash ID code:%08X", info->FlashID);
}
pAddr = (WORD *)((BYTE *)pAddr + 0x100000);
}
break;
}
// check memory card
case 21:
{
_FlashInfo *info;
WORD *pAddr;
SendString("\r\n Test Memory Card");
pAddr = (WORD *)((BYTE *)MEMORY_CARD_ADDR + 0x100000 * Arg2);
SendPrintf("\r\n Flash Addr:%08X", (LONG)pAddr);
if ((info = GetFlashInfo((ULONG)pAddr)) == _NULL)
{
SendPrintf("\r\n Memory card Flash %d not exist", Arg2);
}
else
{
SendPrintf("\r\n Memory card Flash %d OK", Arg2);
SendPrintf("\r\n Flash ID code:%08X", info->FlashID);
}
break;
}
case 22:
{
VOLATILE BYTE *pAddr;
BYTE bData;
INT i;
pAddr = (VOLATILE BYTE *)MEMORY_CARD_ADDR + 0x100000 * Arg3;
SendPrintf("\r\n Read Memory Card Addr:%08X", (LONG)pAddr);
for (i = 0; i < Arg2; i++)
bData = *pAddr;
bData += 1;
SendString("\r\n Read Memory Card End");
break;
}
#endif
case 23:
{
INT DelayNum;
BOOL LedFlag = FALSE;
BYTE Data;
SendString("\r\n Test Comm:");
DelayNum = SetDelayTime(500);
while (1)
{
if (!CheckDelayTimer(DelayNum))
{
ClrDelayTime(DelayNum);
DelayNum = SetDelayTime(500);
#if defined(MONO_LED)
if (LedFlag)
ShowLED(HID_LED_IDLE, HID_LED_ON, HID_LED_IDLE);
else
ShowLED(HID_LED_IDLE, HID_LED_OFF, HID_LED_IDLE);
#elif defined(POLY_LED)
if (LedFlag)
ShowLED(HID_LED_GREEN);
else
ShowLED(HID_LED_DARK);
#endif
LedFlag = !LedFlag;
}
if (GetKey(FEED_KEY))
SendString("\r\n Press Feed Key");
if (GetKey(PAUSE_KEY))
SendString("\r\n Press Pause Key");
if (GetByte(&Data))
SendChar(Data);
}
ClrDelayTime(DelayNum);
break;
}
case 24:
{
break;
}
// Strat RTC
case 25:
{
StartRTC();
SendString("\r\n Start RTC");
break;
}
// set rtc hour , minute
case 26:
{
SetRTC(RTC_MIN, Arg2);
SetRTC(RTC_SEC, Arg3);
SendPrintf("\r\n Set Minute:%d", Arg2);
SendPrintf("\r\n Set Second:%d", Arg3);
break;
}
// set rtc hour , minute
case 27:
{
SendPrintf("\r\n RTC Minute:%d", GetRTC(RTC_MIN));
SendPrintf("\r\n RTC Second:%d", GetRTC(RTC_SEC));
break;
}
#if defined(LCD_MODEL)
case 30:
{
LcdInitialize();
break;
}
case 31:
{
UCHAR buf[] = {0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa};
LcdPut(Arg2, 10, Arg3, 1, buf, 0);
break;
}
case 32:
{
LcdClr(Arg2, Arg3, 5, 5);
break;
}
case 33:
{
LcdPutDot(Arg2, Arg3);
break;
}
case 34:
{
LcdClrDot(Arg2, Arg3);
break;
}
case 35:
{
// DspPutString(Arg2, Arg3, "0123456789ABCDEF", 0, 0);
break;
}
case 36:
{
ShowMessage(0, 0, Arg2, 0);
break;
}
#endif
case 37:
{
break;
}
case 38:
{
break;
}
case 39:
{
break;
}
#if defined(SDCARD_MODEL)
case 40:
{
InitialMCI();
SendString("\r\n Initial MCI");
break;
}
case 41:
{
SendPrintf("\r\n Initial SDCard, Capacity is %lu Sectors", InitialSDCard());
break;
}
case 42:
{
UCHAR buf[512];
INT i, j, k;
InitialMCI();
if (InitialSDCard() != 0 && IsSDCardDetect())
{
SendPrintf("start:\n");
for (i = 0; i < Arg3; i++)
{
SDCardReadBlock(Arg2+i, buf);
for (j = 0; j < 512 / 16; j++)
{
SendPrintf("%08xh:", (Arg2 + i) * 512 + (j * 16));
for (k = 0; k < 16; k++)
SendPrintf(" %02X", buf[(j * 16) + k]);
SendPrintf(" ; ");
for (k = 0; k < 16; k++)
SendPrintf("%c", isprint(buf[(j * 16) + k]) ? buf[(j * 16) + k] : '.');
SendPrintf("\r\n");
}
}
SendPrintf("end:\n");
}
else
{
if ( IsSDCardDetect() )
{
SendPrintf("InitialSDCard==0\n");
}
else
{
SendPrintf("IsSDCardDetect()==0\n");
}
}
break;
}
case 43:
{
UCHAR buf[512];
INT i;
InitialMCI();
if (InitialSDCard() != 0 && IsSDCardDetect())
{
for (i = 0; i < Arg3; i++)
{
if(!SDCardReadBlock(Arg2 + i, buf))
{
SendPrintf("fail\n");
}
SendBuffer(buf, 512);
}
}
else
{
if ( IsSDCardDetect() )
{
SendPrintf("InitialSDCard==0\n");
}
else
{
SendPrintf("IsSDCardDetect()==0\n");
}
}
break;
}
case 44:
{
UINT buf[128];
INT i, j;
InitialMCI();
if (InitialSDCard() != 0 && IsSDCardDetect() && !IsSDCardWriteProtect())
{
for (i = 0; i < Arg3; i++)
{
for (j = 0; j < 128; j++)
buf[j] = i * 128 + j;
SendBuffer(buf,128*4);
if(!SDCardWriteBlock(Arg2 + i, buf))
{
SendPrintf("fail\n");
}
}
}
else
{
if ( IsSDCardDetect() )
{
SendPrintf("InitialSDCard==0\n");
}
else
{
SendPrintf("IsSDCardDetect()==0\n");
}
}
break;
}
case 45:
{
SDCardInformation();
break;
}
case 46:
{
SendPrintf("\r\n SDCard is%s detect", IsSDCardDetect() ? "" : "n't");
break;
}
case 47:
{
SendPrintf("\r\n SDCard has%s write protect", IsSDCardWriteProtect() ? "" : "n't");
break;
}
#endif
case 50:
{
WaitWorkJobEnd();
break;
}
case 51:
{
if (Arg2) EnableCutter(CUT_DIR_FORWARD);
else DisableCutter();
SendPrintf("\r\n Cutter Forward %s", Arg2 ? "On" : "Off");
break;
}
case 52:
{
if (Arg2) EnableCutter(CUT_DIR_BACKWARD);
else DisableCutter();
SendPrintf("\r\n Cutter Backward %s", Arg2 ? "On" : "Off");
break;
}
case 53:
{
#if defined(RIBBON_MODEL)
DCMotorRewindCtrl(Arg2, MOTOR_FORWARD, Arg3);
if (Arg2) SendPrintf("\r\n DCM Forward %d%%", Arg3);
else SendPrintf("\r\n DCM Forward Off");
#endif
break;
}
case 54:
{
#if defined(RIBBON_MODEL)
DCMotorRewindCtrl(Arg2, MOTOR_BACKWARD, Arg3);
if (Arg2) SendPrintf("\r\n DCM Backward %d%%", Arg3);
else SendPrintf("\r\n DCM Backward Off");
#endif
break;
}
#if defined(GPIO_MODEL)
case 60:
{
SendPrintf("\r\n GPIO Input %d ", Arg2);
if (Arg2 == 1) SendPrintf("%s", GeneralPurposeInput(GPIO_INPUT_1) ? "High" : "Low");
if (Arg2 == 2) SendPrintf("%s", GeneralPurposeInput(GPIO_INPUT_2) ? "High" : "Low");
if (Arg2 == 3) SendPrintf("%s", GeneralPurposeInput(GPIO_INPUT_3) ? "High" : "Low");
if (Arg2 == 4) SendPrintf("%s", GeneralPurposeInput(GPIO_INPUT_4) ? "High" : "Low");
break;
}
case 61:
{
SendPrintf("\r\n GPIO Output %d %s", Arg2, Arg3 ? "High" : "Low");
if (Arg2 == 1) GeneralPurposeOutput(GPIO_OUTPUT_1, Arg3 ? HIGH : LOW);
if (Arg2 == 2) GeneralPurposeOutput(GPIO_OUTPUT_2, Arg3 ? HIGH : LOW);
if (Arg2 == 3) GeneralPurposeOutput(GPIO_OUTPUT_3, Arg3 ? HIGH : LOW);
if (Arg2 == 4) GeneralPurposeOutput(GPIO_OUTPUT_4, Arg3 ? HIGH : LOW);
if (Arg2 == 5) GeneralPurposeOutput(GPIO_OUTPUT_5, Arg3 ? HIGH : LOW);
if (Arg2 == 6) GeneralPurposeOutput(GPIO_OUTPUT_6, Arg3 ? HIGH : LOW);
if (Arg2 == 7) GeneralPurposeOutput(GPIO_OUTPUT_7, Arg3 ? HIGH : LOW);
break;
}
#endif
case 62:
{
break;
}
#if defined(AT91SAM9260)
case 70:
{
/* Enable management port. */
AT91C_BASE_EMACB->EMAC_NCR |= AT91C_EMAC_MPE;
/* PHY read command. */
AT91C_BASE_EMACB->EMAC_MAN = (AT91C_EMAC_SOF & (0x1 << 30)) | // Fixed value.
(AT91C_EMAC_RW & (0x2 << 28)) | // PHY read.
(AT91C_EMAC_CODE & (0x2 << 16)) | // Fixed value.
(AT91C_EMAC_PHYA & (0x1 << 23)) | // PHY address.
(AT91C_EMAC_REGA & (Arg2 << 18));
/* Wait until PHY logic completed. */
while ((AT91C_BASE_EMACB->EMAC_NSR & AT91C_EMAC_IDLE) == 0);
/* Get data from PHY maintenance register. */
wData = (u_short) (AT91C_BASE_EMACB->EMAC_MAN & AT91C_EMAC_DATA);
/* Disable management port. */
AT91C_BASE_EMACB->EMAC_NCR &= ~AT91C_EMAC_MPE;
SendPrintf("\r\n Read PHY register %02X: %04X", Arg2, wData);
break;
}
case 71:
{
/* Enable management port. */
AT91C_BASE_EMACB->EMAC_NCR |= AT91C_EMAC_MPE;
/* PHY write command. */
AT91C_BASE_EMACB->EMAC_MAN = (AT91C_EMAC_SOF & (0x1 << 30)) | // Fixed value.
(AT91C_EMAC_RW & (0x1 << 28)) | // PHY write.
(AT91C_EMAC_CODE & (0x2 << 16)) | // Fixed value.
(AT91C_EMAC_PHYA & (0x1 << 23)) | // PHY address.
(AT91C_EMAC_REGA & (Arg2 << 18)) |
(AT91C_EMAC_DATA & (Arg3 << 0));
/* Wait until PHY logic completed. */
while ((AT91C_BASE_EMACB->EMAC_NSR & AT91C_EMAC_IDLE) == 0);
/* Disable management port. */
AT91C_BASE_EMACB->EMAC_NCR &= ~AT91C_EMAC_MPE;
SendPrintf("\r\n Write PHY register %02X: %04X", Arg2, Arg3);
break;
}
#endif
case 80:
{
#if defined(UART2_DEVICE)
BYTE Data;
SendPrintf("\r\n Test RFID module:");
#if defined(UART2_BT)
BtComMode(Arg2, Arg3);
#endif
while (1)
{
if (GetKey(FEED_KEY))
{
SendString("\r\n Press Feed Key");
break;
}
if (GetByte(&Data))
Uart2Char(Data);
if (Uart2GetByte(&Data))
SendChar(Data);
}
#if defined(UART2_BT)
BtComMode(FALSE, FALSE);
#endif
#endif
break;
}
#if defined(UART2_BT)
case 81:
SendPrintf("BT Name: %s",pPrintCfg->BtSetting.name);
break;
case 82:
SendPrintf("BT Pin: %s",pPrintCfg->BtSetting.pin);
break;
case 83:
{
STATIC BYTE name[21];
strncpy((CHAR *)name, (CHAR *)pPrintCfg->BtSetting.name, 20);
name[0] ++;
if(name[0]>'Z'&&name[0]<'a')
name[0] = 'a';
else if(name[0]>'9'&&name[0]<'A')
name[0] = 'A';
else if(name[0]<'0'||name[0]>'a')
name[0] = '0';
if(BtSetName(name))
SendPrintf("BT Set Name: %s",pPrintCfg->BtSetting.name);
else
SendPrintf("BT Set Name Error!");
break;
}
case 84:
{
STATIC BYTE pin[11];
strncpy((CHAR *)pin, (CHAR *)pPrintCfg->BtSetting.pin, 10);
pin[0] ++;
if(pin[0]>'Z'&&pin[0]<'a')
pin[0] = 'a';
else if(pin[0]>'9'&&pin[0]<'A')
pin[0] = 'A';
else
pin[0] = '0';
if(BtSetPin(pin))
SendPrintf("BT Set Pin: %s",pPrintCfg->BtSetting.pin);
else
SendPrintf("BT Set Pin Error!");
break;
}
case 85:
{
BYTE i_buffer[32];
memset(i_buffer, 0, 32);
if(BtGetMsg(Arg2 ,i_buffer))
SendPrintf("BT Get Msg %d:%s\n",Arg2,i_buffer);
else
SendPrintf("BT Get Msg Error!\n");
break;
}
#endif
case 100:
{
//#if defined(TSPL)
// OutBasicStatus();
//#endif
break;
}
case 101:
{
pPrintCfg->Speed = Arg2;
break;
}
case 102:
{
pPrintCfg->Language = Arg2;
break;
}
case 198:
#if defined(UPDATE_MODEL_NAME)
SendPrintf(UPDATE_MODEL_NAME"\r\n");
#else
SendPrintf(MODEL_NAME"\r\n");
#endif
break;
case 199:
SendPrintf("data:%s,time:%s\r\n", __DATE__,__TIME__);
break;
case 200:
#if defined(GAP_SENSOR_AD)
i_reg = 0;
ShowLED(HID_LED_DARK);
for ( count = 0 ; count < GAP_SENSOR_SCALE; count++ )
{
EnableSensor(GAP_SENSOR, count, Arg3, 0);
StartADConvert(GAP_SENSOR_AD);
wData = ReadAD(GAP_SENSOR_AD);
if(wData>(GAP_1K_data[count]-10)&&wData<(GAP_1K_data[count]+10)&&i_reg==0)
{
;
}
else if(wData<10 && (i_reg ==1 || i_reg ==0))
{
i_reg =1;
}
else
{
i_reg =2;
}
}
switch ( i_reg )
{
case 2 :
ShowLED(HID_LED_RED);
break;
case 1 :
ShowLED(HID_LED_ORANGE);
break;
case 0 :
ShowLED(HID_LED_GREEN);
break;
}
#endif
break;
case 201:
#if defined(BLINE_SENSOR_AD)
i_reg = 0;
ShowLED(HID_LED_DARK);
for ( count = 0 ; count < BLINE_SENSOR_SCALE; count++ )
{
EnableSensor(BLINE_SENSOR, count, Arg3, 0);
StartADConvert(BLINE_SENSOR_AD);
wData = ReadAD(BLINE_SENSOR_AD);
if((wData>BLINE_1K_data[count]-10)&&(wData<BLINE_1K_data[count]+10) &&i_reg==0)
{
;
}
else if(wData<20 && (i_reg ==1 || i_reg ==0))
{
i_reg =1;
}
else
{
i_reg =2;
}
}
switch ( i_reg )
{
case 2 :
ShowLED(HID_LED_RED);
break;
case 1 :
ShowLED(HID_LED_ORANGE);
break;
case 0 :
ShowLED(HID_LED_GREEN);
break;
}
#endif
break;
case 202:
i_reg = 0;
ShowLED(HID_LED_DARK);
EnablePeel();
delay_msec(2);
StartADConvert(PEEL_SENSOR_AD);
delay_msec(2);
wData = ReadAD(PEEL_SENSOR_AD);
if(wData>=130&&wData<=150)
{
DisablePeel();
delay_msec(2);
StartADConvert(PEEL_SENSOR_AD);
delay_msec(2);
wData = ReadAD(PEEL_SENSOR_AD);
if(wData>=920&&wData<=940)
{
i_reg = 0;
}
else if(wData<=10)
{
i_reg = 1;
}
else
{
i_reg = 2;
}
}
else if(wData<=10)
{
i_reg = 1;
}
else
{
i_reg = 2;
}
switch ( i_reg )
{
case 2 :
ShowLED(HID_LED_RED);
break;
case 1 :
ShowLED(HID_LED_ORANGE);
break;
case 0 :
ShowLED(HID_LED_GREEN);
break;
}
break;
case 300:
SetPositionData((SHORT)0,(SHORT)0,(SHORT)Arg2,(SHORT)0,(SHORT)0);
break;
case 301:
SetPositionData((SHORT)Arg2,(SHORT)Arg3,(SHORT)0,(SHORT)0,(SHORT)0);
break;
case 302:
SetPositionData((SHORT)0,(SHORT)0,(SHORT)0,(SHORT)Arg2,(SHORT)Arg3);
break;
case 303:
SetDensityBase((SHORT)Arg2,((SHORT)Arg3)/10.0);
break;
case 304:
SetHistoryCompensate((SHORT)Arg2);
break;
#if defined(RIBBON_MODEL)
case 404:
//bbonCount=Arg2;
break;
#endif
case 405:
pPrintRec->UsbSerial=Arg3;
break;
}
return _SUCCESS;
}
INT FN_CLEAR_M(VOID)
{
pPrintRec->DotMilage = 0;
return _SUCCESS;
}
INT FN_CLEAR_L(VOID)
{
pPrintRec->LabelMilage = 0;
return _SUCCESS;
}
INT FN_CLEAR_C(VOID)
{
pPrintRec->CutCounter = 0;
return _SUCCESS;
}
INT FN_TEST_BURN(VOID)
{
INT data;
if (!BscGetNumber(LINE_END, &data))
return _ERROR;
if (data != 1)
return _ERROR;
pPrintCfg->TestBurn = TRUE;
#if defined(TTP2410M) || defined(TTP246MP) || defined(TTP346M) || defined(TTP344MP) || defined(TTP644M) || defined(TTP384M) || defined(DL9000)
TestBurn();
#endif
return _SUCCESS;
}
INT FN_TEST_FACTORY(VOID)
{
return _SUCCESS;
}
INT FN_CONFIG(VOID)
{
ConfigReport();
return _SUCCESS;
}
INT FN_IPCONFIG(VOID)
{
#if defined(NUTNET)
if (GetThreadByName("ethernet"))
IpConfigReport(NULL, TRUE, OUTPUT_LABEL);
#endif
return _SUCCESS;
}
INT FN_SELFTEST(VOID)
{
REPORT *Report = SelfTestReport(NULL, FALSE, OUTPUT_LABEL);
#if defined(NUTNET)
if (GetThreadByName("ethernet"))
Report = IpConfigReport(Report, FALSE, OUTPUT_LABEL);
#endif
Report = BtConfigReport(Report, FALSE, OUTPUT_LABEL);
FileReport(Report, TRUE, OUTPUT_LABEL);
return _SUCCESS;
}
INT FN_FILES(VOID)
{
if (pPrintCfg->DebugMode == DEBUG_RS232)
FileReport(NULL, TRUE, OUTPUT_RS232);
else
FileReport(NULL, TRUE, OUTPUT_LABEL);
return _SUCCESS;
}
/******************************************************************************
*
* TSPL Commands
* DUMP_TEXT PRINT
*
* Description:
* Print label
*
* Syntax:
* DUMP_TEXT PRINT,
*
* Parameters:
*
******************************************************************************/
STATIC INT FN_DUMP_PRINT(VOID)
{
BYTE Data;
RemoveSpace();
Data = NextByte();
if (!CheckTokenEnd(COMMA_END, Data))
return _ERROR;
HexDumpMode();
return _SUCCESS;
}
/******************************************************************************
*
* TSPL Commands
* DUMP_TEXT OUTPUT
*
* Description:
* Output communication
*
* Syntax:
* DUMP_TEXT OUTPUT [time],
*
* Parameters:
* time = Exit time
*
******************************************************************************/
STATIC INT FN_DUMP_OUTPUT(VOID)
{
BYTE Data;
INT EndTime;
INT RxFlash;
INT FlashCnt;
INT DelayNum;
RemoveSpace();
Data = NextByte();
EndTime = 0;
if (!CheckTokenEnd(COMMA_END, Data))
{
if (!BscGetNumber(COMMA_END, &EndTime))
return _ERROR;
}
#if defined(LCD_MODEL)
SetDisplayStatus(DIS_DUMP_MODE);
#endif
#if defined(MONO_LED)
StartPeriodFunc(FlashLED2);
#elif defined(POLY_LED)
StartPeriodFunc(FlashGreenLED);
#endif
CtrlImmedCmd(FALSE);
#if defined(EPL2)
EplCtrlImmedCmd(FALSE);
#endif
#if defined(DPL)
DplCtrlImmedCmd(FALSE);
#endif
StopKeyFunc();
GetKey(FEED_KEY);
// Start EndTime after first data
while (!GetByte(&Data)) {}
SendChar(Data);
RxFlash = 0;
if (EndTime)
DelayNum = SetDelayTime(EndTime);
while (1)
{
if (GetByte(&Data))
{
SendChar(Data);
if (EndTime)
{
ClrDelayTime(DelayNum);
DelayNum = SetDelayTime(EndTime);
}
if (RxFlash == 0)
{
RxFlash = 1;
FlashCnt = 0;
}
}
if (RxFlash == 1)
{
#if defined(MONO_LED)
ShowLED(HID_LED_OFF, HID_LED_IDLE, HID_LED_ON);
#elif defined(POLY_LED)
ShowLED(HID_LED_ORANGE);
#endif
if (++FlashCnt > 1000)
RxFlash = 2;
}
if (RxFlash == 2)
{
#if defined(MONO_LED)
ShowLED(HID_LED_ON, HID_LED_IDLE, HID_LED_OFF);
#elif defined(POLY_LED)
ShowLED(HID_LED_RED);
#endif
if (++FlashCnt > 2000)
RxFlash = 0;
}
if (EndTime && !CheckDelayTimer(DelayNum))
break;
if (GetKey(FEED_KEY))
break;
}
if (EndTime)
ClrDelayTime(DelayNum);
StartKeyFunc(TRUE);
CtrlImmedCmd(TRUE);
#if defined(EPL2)
EplCtrlImmedCmd(TRUE);
#endif
#if defined(DPL)
DplCtrlImmedCmd(TRUE);
#endif
#if defined(MONO_LED)
CancelPeriodFunc(FlashLED2);
ShowLED(HID_LED_ON, HID_LED_ON, HID_LED_OFF);
#elif defined(POLY_LED)
CancelPeriodFunc(FlashGreenLED);
ShowLED(HID_LED_GREEN);
#endif
#if defined(LCD_MODEL)
ClrDisplayStatus(DIS_DUMP_MODE);
#endif
return _SUCCESS;
}
/******************************************************************************
*
* TSPL Commands
* DUMP_TEXT SAVE
*
* Description:
* Save file
*
* Syntax:
* DUMP_TEXT SAVE [time,][dev,]name,
*
* Parameters:
* time = Exit time
* dev = Save device
* name = Save file name
*
******************************************************************************/
STATIC INT FN_DUMP_SAVE(VOID)
{
CHAR FileName[FILENAME_LENGTH];
_eFileDevice Device;
_FileHandle *Handle;
BYTE Data;
INT EndTime;
INT RxFlash;
INT FlashCnt;
INT DelayNum;
INT state;
RemoveSpace();
Data = NextByte();
BackByte(Data);
EndTime = 0;
if (isdigit(Data))
{
if (!BscGetNumber(COMMA_END, &EndTime))
return _ERROR;
}
if (!BscGetFileDevice(&Device))
return _ERROR;
if (!BscGetString(COMMA_END, FileName, sizeof(FileName)))
return _ERROR;
if (strchr(FileName, '*') || strlen(FileName) == 0)
return _ERROR;
#if defined(LCD_MODEL)
SetDisplayStatus(DIS_DUMP_MODE);
#endif
#if defined(MONO_LED)
StartPeriodFunc(FlashLED2);
#elif defined(POLY_LED)
StartPeriodFunc(FlashGreenLED);
#endif
CtrlImmedCmd(FALSE);
#if defined(EPL2)
EplCtrlImmedCmd(FALSE);
#endif
#if defined(DPL)
DplCtrlImmedCmd(FALSE);
#endif
StopKeyFunc();
GetKey(FEED_KEY);
Remove(Device, FileName);
Handle = Fopen(Device, FileName, "w");
state = _NULL;
// Start EndTime after first data
while (!GetByte(&Data)) {}
if (state != END_OF_FILE)
state = Fputc((INT)Data, Handle);
RxFlash = 0;
FlashCnt = 0;
if (EndTime)
DelayNum = SetDelayTime(EndTime);
while (1)
{
if (GetByte(&Data))
{
if (state != END_OF_FILE)
state = Fputc((INT)Data, Handle);
if (EndTime)
{
ClrDelayTime(DelayNum);
DelayNum = SetDelayTime(EndTime);
}
if (RxFlash == 0)
{
RxFlash = 1;
FlashCnt = 0;
}
}
if (RxFlash == 1)
{
#if defined(MONO_LED)
ShowLED(HID_LED_OFF, HID_LED_IDLE, HID_LED_ON);
#elif defined(POLY_LED)
ShowLED(HID_LED_ORANGE);
#endif
if (++FlashCnt > 2000)
RxFlash = 2;
}
if (RxFlash == 2)
{
#if defined(MONO_LED)
ShowLED(HID_LED_ON, HID_LED_IDLE, HID_LED_OFF);
#elif defined(POLY_LED)
ShowLED(HID_LED_RED);
#endif
if (++FlashCnt > 4000)
RxFlash = 0;
}
if (EndTime && !CheckDelayTimer(DelayNum))
break;
if (GetKey(FEED_KEY))
break;
}
if (EndTime)
ClrDelayTime(DelayNum);
Fclose(Handle);
StartKeyFunc(TRUE);
CtrlImmedCmd(TRUE);
#if defined(EPL2)
EplCtrlImmedCmd(TRUE);
#endif
#if defined(DPL)
DplCtrlImmedCmd(TRUE);
#endif
if (state == END_OF_FILE)
{
Remove(Device, FileName);
MemoryFailed();
}
#if defined(MONO_LED)
CancelPeriodFunc(FlashLED2);
ShowLED(HID_LED_ON, HID_LED_ON, HID_LED_OFF);
#elif defined(POLY_LED)
CancelPeriodFunc(FlashGreenLED);
ShowLED(HID_LED_GREEN);
#endif
#if defined(LCD_MODEL)
ClrDisplayStatus(DIS_DUMP_MODE);
#endif
return _SUCCESS;
}
/******************************************************************************
*
* TSPL Commands
* DUMP_TEXT
*
* Description:
*
* Syntax:
* DUMP_TEXT
* DUMP_TEXT PRINT,
* DUMP_TEXT OUTPUT [time],
* DUMP_TEXT SAVE [time,][dev,]name,
*
* Parameters:
* PRINT = Print label
* OUTPUT = Output communication
* SAVE = Save file
*
******************************************************************************/
INT FN_DUMP_TEXT(VOID)
{
_CmdEntry *CmdEntry;
CHAR Token[STRING_LEN];
CHAR data;
CONST STATIC _CmdEntry DumpEntry[] =
{
{"PRINT", FN_DUMP_PRINT},
{"OUTPUT", FN_DUMP_OUTPUT},
{"SAVE", FN_DUMP_SAVE},
{(CHAR *)_NULL, _NULL}
};
RemoveSpace();
data = NextByte();
if (CheckChar(data, "\r\n"))
{
HexDumpMode();
return _SUCCESS;
}
BackByte(data);
if (!BscGetToken(BACK_WITH_SPACE, Token, sizeof(Token)))
return _ERROR;
if (CmdEntry = CheckStringCommand(Token, DumpEntry))
return CmdEntry->func();
return _ERROR;
}
INT FN_CHECKSUM(VOID)
{
ChecksumReport(NULL, TRUE, OUTPUT_LABEL);
return _SUCCESS;
}
INT FN_VER(VOID)
{
VersionReport(NULL, TRUE, OUTPUT_LABEL);
return _SUCCESS;
}
INT FN_PROFILE(VOID)
{
ProfileReport();
return _SUCCESS;
}
INT FN_INITIALPRINTER(VOID)
{
StartRTC();
InitialDefaultVar();
PrinterReboot();
return _SUCCESS;
}
INT FN_GAPDETECT(VOID)
{
INT PrePaper = 0;
INT PreGap = 0;
BYTE Data;
#ifdef DEBUG_PRNT
sysprintf("Enter FN_GAPDETECT()...\n"); // ch_20211208
#endif
RemoveSpace();
Data = NextByte();
if (!CheckTokenEnd(LINE_END, Data))
{
if (!BscGetNumber(BACK_WITHOUT_SPACE, &PrePaper))
return _ERROR;
Data = NextByte();
if (CheckChar(Data, ",;"))
{
if (!BscGetNumber(LINE_END, &PreGap))
return _ERROR;
}
else if (!CheckTokenEnd(LINE_END, Data))
return _ERROR;
}
pPrintCfg->SensorMode = GAP_MODE;
#if defined(LCD_MODEL)
SetDisplayStatus(DIS_CALIBRATION);
#endif
#if defined(DIVIDE_INTENSION)
DetectSensorInten(pPrintCfg, TRUE, FALSE, PrePaper, PreGap);
#elif defined(PWM_INTENSION)
if (DetectGapInten(pPrintCfg, FALSE))
{
#if defined(TTP244)
DetectLabelSize(pPrintCfg, 2, TEAR_MODE);
#else
DetectLabelSize(pPrintCfg, 2, OFF_MODE);
#endif
}
#endif
#if defined(LCD_MODEL)
ClrDisplayStatus(DIS_CALIBRATION);
#endif
return _SUCCESS;
}
INT FN_BLINEDETECT(VOID)
{
INT PrePaper = 0;
INT PreBline = 0;
BYTE Data;
#ifdef DEBUG_PRNT
sysprintf("Enter FN_BLINEDETECT()...\n"); // ch_20211208
#endif
RemoveSpace();
Data = NextByte();
if(ProfileLimit("NO BLINE MODE")==1)
return _ERROR;
if (!CheckTokenEnd(LINE_END, Data))
{
if (!BscGetNumber(BACK_WITHOUT_SPACE, &PrePaper))
return _ERROR;
Data = NextByte();
if (CheckChar(Data, ",;"))
{
if (!BscGetNumber(LINE_END, &PreBline))
return _ERROR;
}
else if (!CheckTokenEnd(LINE_END, Data))
return _ERROR;
}
pPrintCfg->SensorMode = BLINE_MODE;
#if defined(LCD_MODEL)
SetDisplayStatus(DIS_CALIBRATION);
#endif
#if defined(DIVIDE_INTENSION)
DetectSensorInten(pPrintCfg, TRUE, FALSE, PrePaper, PreBline);
#endif
#if defined(LCD_MODEL)
ClrDisplayStatus(DIS_CALIBRATION);
#endif
return _SUCCESS;
}
INT FN_AUTODETECT(VOID)
{
INT PrePaper = 0;
INT PreBline = 0;
BYTE Data;
#ifdef DEBUG_PRNT
sysprintf("Enter FN_AUTODETECT()...\n"); // ch_20211208
#endif
RemoveSpace();
Data = NextByte();
#ifdef DEBUG_PRNT
sysprintf("Data = %d\n", Data); // ch_20211211
#endif
if (!CheckTokenEnd(LINE_END, Data))
{
if (!BscGetNumber(BACK_WITHOUT_SPACE, &PrePaper))
return _ERROR;
Data = NextByte();
#ifdef DEBUG_PRNT
sysprintf("Data = %d\n", Data); // ch_20211211
#endif
if (CheckChar(Data, ",;"))
{
if (!BscGetNumber(LINE_END, &PreBline))
return _ERROR;
}
else if (!CheckTokenEnd(LINE_END, Data))
return _ERROR;
}
#if defined(LCD_MODEL)
SetDisplayStatus(DIS_CALIBRATION);
#endif
#if defined(DIVIDE_INTENSION)
#ifdef DEBUG_PRNT
sysprintf("pPrintCfg->SensorMode = %d\n", pPrintCfg->SensorMode); // ch_20211211
sysprintf("pPrintCfg-AutoSensorRef = %d\n", pPrintCfg->AutoSensorRef); // ch_20211211
sysprintf("pPrintCfg->ContinuousRef = %d\n", pPrintCfg->ContinuousRef); // ch_20211211
sysprintf("pPrintCfg->ContinuePaperFeed = %d\n", pPrintCfg->ContinuePaperFeed); // ch_20211211
sysprintf("pPrintCfg->FeedLength = %d\n", pPrintCfg->FeedLength); // ch_20211211
sysprintf("pPrintCfg->ContinuousInten = %d\n", pPrintCfg->ContinuousInten); // ch_20211211
sysprintf("PrePaper = %d\tPreBline = %d\n",PrePaper, PreBline); // ch_20211211
#endif
DetectSensorInten(pPrintCfg, TRUE, TRUE, PrePaper, PreBline);
#endif
#if defined(LCD_MODEL)
ClrDisplayStatus(DIS_CALIBRATION);
#endif
return _SUCCESS;
}
INT FN_DIAGNOSTIC(VOID)
{
CHAR Token[STRING_LEN];
_CmdEntry *CmdEntry;
#ifdef DEBUG_PRNT
sysprintf("Enter FN_DIAGNOSTIC()...\n"); // ch_20211211
#endif
if (!BscGetToken(BACK_WITH_SPACE, Token, sizeof(Token)))
return _ERROR;
#ifdef DEBUG_PRNT
sysprintf("Token = %s\n", Token); // ch_20211211
#endif
if (CmdEntry = CheckStringCommand(Token, DiagnosticEntry))
return CmdEntry->func();
return _ERROR;
}
INT FN_FACTORY(VOID)
{
CHAR Token[STRING_LEN];
_CmdEntry *CmdEntry;
if (!BscGetToken(BACK_WITH_SPACE, Token, sizeof(Token)))
return _ERROR;
if (CmdEntry = CheckStringCommand(Token, FactoryEntry))
return CmdEntry->func();
return _ERROR;
}
INT FN_NET(VOID)
{
CHAR Token[STRING_LEN];
_CmdEntry *CmdEntry;
if (!BscGetToken(BACK_WITH_SPACE, Token, sizeof(Token)))
return _ERROR;
if (CmdEntry = CheckStringCommand(Token, NetEntry))
return CmdEntry->func();
return _ERROR;
}
INT FN_CardTest(VOID)
{
#if defined(DEFAULT_MCARD_MODEL)
MemoryCardReport(NULL, TRUE, OUTPUT_LABEL);
#endif
return _SUCCESS;
}
INT FN_FuseDF(VOID)
{
WaitWorkJobEnd();
#if defined(LCD_MODEL)
SetDisplayStatus(DIS_UPDATE);
#endif
CtrlImmedCmd(FALSE);
#if defined(EPL2)
EplCtrlImmedCmd(FALSE);
#endif
#if defined(DPL)
DplCtrlImmedCmd( FALSE );
#endif
#if defined(MONO_LED)
FlashLED();
#endif
#if defined(AT91SAM9260)
FuseDataFlash();
#endif
#if defined(LCD_MODEL)
ClrDisplayStatus(DIS_UPDATE);
#endif
return _SUCCESS;
}
INT FN_FuseFlash(VOID)
{
#ifdef DEBUG_PRNT
sysprintf("Enter FN_FuseFlash()...\n"); // ch_20211211
#endif
WaitWorkJobEnd();
#if defined(LCD_MODEL)
SetDisplayStatus(DIS_UPDATE);
#endif
CtrlImmedCmd(FALSE);
#if defined(EPL2)
EplCtrlImmedCmd(FALSE);
#endif
#if defined(DPL)
DplCtrlImmedCmd( FALSE );
#endif
#if defined(MONO_LED)
FlashLED();
#endif
SaveVarBank();
FuseFlash();
#if defined(LCD_MODEL)
ClrDisplayStatus(DIS_UPDATE);
#endif
return _SUCCESS;
}
BscFunc.h //
#ifndef BSCFUNC_H
/******************************************************************************
* *
* M O D U L E D E F I N E *
* *
******************************************************************************/
#define BSCFUNC_H
/******************************************************************************
* *
* C O M P I L E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
/******************************************************************************
* *
* U S E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
/******************************************************************************
* *
* G L O B A L D E F I N E S *
* *
******************************************************************************/
/******************************************************************************
* *
* S T R U C T U R E D E F I N I T I O N S *
* *
******************************************************************************/
/******************************************************************************
* *
* G L O B A L V A R I A B L E S - N O I N I T I A L I Z E R S *
* *
******************************************************************************/
#ifdef BSCFUNC_C
#define EXTERN
#else
#define EXTERN extern
#endif
/******************************************************************************
* *
* G L O B A L V A R I A B L E S - I N I T I A L I Z E R S *
* *
******************************************************************************/
/******************************************************************************
* *
* F U N C T I O N P R O T O T Y P E S *
* *
******************************************************************************/
//--- BscFunc ---//
INT FN_LIMITFEED(VOID);
INT FN_DEBUG(VOID);
INT FN_CLEAR_M(VOID);
INT FN_CLEAR_L(VOID);
INT FN_CLEAR_C(VOID);
INT FN_TEST_BURN(VOID);
INT FN_TEST_FACTORY(VOID);
INT FN_CONFIG(VOID);
INT FN_IPCONFIG(VOID);
INT FN_SELFTEST(VOID);
INT FN_FILES(VOID);
INT FN_DUMP_TEXT(VOID);
INT FN_CHECKSUM(VOID);
INT FN_VER(VOID);
INT FN_PROFILE(VOID);
INT FN_INITIALPRINTER(VOID);
INT FN_GAPDETECT(VOID);
INT FN_BLINEDETECT(VOID);
INT FN_AUTODETECT(VOID);
INT FN_DIAGNOSTIC(VOID);
INT FN_FACTORY(VOID);
INT FN_NET(VOID);
INT FN_CardTest(VOID);
INT FN_FuseDF(VOID);
INT FN_FuseFlash(VOID);
INT FN_RenewAllCode(VOID);
//--- BscFuncDiag ---//
INT FN_DIAG_REP_Edition(VOID);
INT FN_DIAG_REP_Password(VOID);
INT FN_DIAG_REP_DPI(VOID);
INT FN_DIAG_REP_Version(VOID);
INT FN_DIAG_REP_Serial(VOID);
INT FN_DIAG_REP_CheckSum(VOID);
INT FN_DIAG_REP_Milage(VOID);
INT FN_DIAG_REP_CutCounter(VOID);
INT FN_DIAG_REP_Speed(VOID);
INT FN_DIAG_REP_Density(VOID);
INT FN_DIAG_REP_DensityBase(VOID);
INT FN_DIAG_REP_PaperWidth(VOID);
INT FN_DIAG_REP_PaperHeight(VOID);
INT FN_DIAG_REP_SensorMode(VOID);
INT FN_DIAG_REP_GapSize(VOID);
INT FN_DIAG_REP_GapOffset(VOID);
INT FN_DIAG_REP_PrintOut(VOID);
INT FN_DIAG_REP_CutterPiece(VOID);
INT FN_DIAG_REP_ReferenceX(VOID);
INT FN_DIAG_REP_ReferenceY(VOID);
INT FN_DIAG_REP_Direction(VOID);
INT FN_DIAG_REP_Mirror(VOID);
INT FN_DIAG_REP_Offset(VOID);
INT FN_DIAG_REP_OffsetBase(VOID);
INT FN_DIAG_REP_Shift(VOID);
INT FN_DIAG_REP_ShiftBase(VOID);
INT FN_DIAG_REP_ShiftX(VOID);
INT FN_DIAG_REP_ShiftXBase(VOID);
INT FN_DIAG_REP_Ribbon(VOID);
INT FN_DIAG_REP_CodePage(VOID);
INT FN_DIAG_REP_Country(VOID);
INT FN_DIAG_REP_Head(VOID);
INT FN_DIAG_REP_Reprint(VOID);
INT FN_DIAG_REP_MaxLength(VOID);
INT FN_DIAG_REP_GapInten(VOID);
INT FN_DIAG_REP_BlineInten(VOID);
INT FN_DIAG_REP_ConInten(VOID);
INT FN_DIAG_REP_BaudRate(VOID);
INT FN_DIAG_REP_DataBit(VOID);
INT FN_DIAG_REP_Parity(VOID);
INT FN_DIAG_REP_StopBit(VOID);
INT FN_DIAG_REP_ZDarkness(VOID);
INT FN_DIAG_REP_ZSpeed(VOID);
INT FN_DIAG_REP_ZPosition(VOID);
INT FN_DIAG_REP_ZPrintMode(VOID);
INT FN_DIAG_REP_ZLabelWidth(VOID);
INT FN_DIAG_REP_ZControl(VOID);
INT FN_DIAG_REP_ZFormat(VOID);
INT FN_DIAG_REP_ZDelimiter(VOID);
INT FN_DIAG_REP_ZFeedPowerUp(VOID);
INT FN_DIAG_REP_ZFeedHeadClose(VOID);
INT FN_DIAG_REP_ZLabelTop(VOID);
INT FN_DIAG_REP_ZLabelShift(VOID);
INT FN_DIAG_REP_DHeat(VOID);
INT FN_DIAG_REP_DPrintSpeed(VOID);
INT FN_DIAG_REP_DLabelWidth(VOID);
INT FN_DIAG_REP_DPresentSensor(VOID);
INT FN_DIAG_REP_DCutterEquipped(VOID);
INT FN_DIAG_REP_DControlCodes(VOID);
INT FN_DIAG_REP_DColumnOffset(VOID);
INT FN_DIAG_REP_DRowOffset(VOID);
INT FN_DIAG_REP_DramFileList(VOID);
INT FN_DIAG_REP_FlashFileList(VOID);
INT FN_DIAG_REP_CardFileList(VOID);
INT FN_DIAG_REP_DramPhySpace(VOID);
INT FN_DIAG_REP_FlashPhySpace(VOID);
INT FN_DIAG_REP_CardPhySpace(VOID);
INT FN_DIAG_REP_DramFreeSpace(VOID);
INT FN_DIAG_REP_FlashFreeSpace(VOID);
INT FN_DIAG_REP_CardFreeSpace(VOID);
INT FN_DIAG_REP_NetName(VOID);
INT FN_DIAG_REP_MACAddr(VOID);
INT FN_DIAG_REP_ConfigIP(VOID);
INT FN_DIAG_REP_Gateway(VOID);
INT FN_DIAG_REP_IPMask(VOID);
INT FN_DIAG_REP_LastUsedIP(VOID);
INT FN_DIAG_REP_Bt(VOID);
INT FN_DIAG_REP_BtName(VOID);
INT FN_DIAG_REP_BtPin(VOID);
INT FN_DIAG_REP_BtAddr(VOID);
INT FN_DIAG_REP_BtVer(VOID);
INT FN_DIAG_REP_Year(VOID);
INT FN_DIAG_REP_Month(VOID);
INT FN_DIAG_REP_Date(VOID);
INT FN_DIAG_REP_Hour(VOID);
INT FN_DIAG_REP_Minute(VOID);
INT FN_DIAG_REP_Second(VOID);
INT FN_DIAG_REP_GapSensor(VOID);
INT FN_DIAG_REP_BlineSensor(VOID);
INT FN_DIAG_PASSWORD(VOID);
INT FN_DIAG_INTERFACE(VOID);
INT FN_DIAG_REPORT(VOID);
INT FN_DIAG_FILE(VOID);
//--- BscFuncFac ---//
INT FN_FAC_LABEL(VOID);
INT FN_FAC_MILAGE(VOID);
INT FN_FAC_CUTCOUNTER(VOID);
INT FN_FAC_CONTRAST(VOID);
INT FN_FAC_SERIAL(VOID);
INT FN_FAC_TPH_SERIAL(VOID);
INT FN_FAC_RESPONSE(VOID);
INT FN_FAC_SETTING(VOID);
INT FN_FAC_TEST(VOID);
INT FN_FAC_PS2TEST(VOID);
//--- BscFuncNet ---//
INT FN_NET_MAC(VOID);
INT FN_NET_DHCP(VOID);
INT FN_NET_IP(VOID);
INT FN_NET_PORT(VOID);
INT FN_NET_NAME(VOID);
#undef EXTERN
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */
#endif