void check_factory_uart1 (void) { uint8_t * buf_ptr; buf_ptr = getUSART1buf(); if(strncmp(buf_ptr, FACTORY_CHECK_STR, sizeof(FACTORY_CHECK_STR)) == 0) { // Serial data buffer clear USART1_flush(); factory_test_2nd(); #if defined(FACTORY_FW_FLASH) release_factory_flag(); #else //g_factoryfw_flag = 0; #endif //delay_ms(200); //NVIC_SystemReset(); } }
int main(void) { uint8_t ret = 0; //int32_t loopback_ret; #if defined (__USE_LPCOPEN) #if !defined(NO_BOARD_LIB) // Read clock settings and update SystemCoreClock variable SystemCoreClockUpdate(); // Set up and initialize all required blocks and // functions related to the board hardware Board_Init(); // Set the LED to the state of "On" Board_LED_Set(0, true); //Board_LED_Set(1, true); //Board_LED_Set(2, true); #endif #endif SPI_Init(); W5500_Init(); Net_Conf(gWIZNETINFO); #ifdef _MAIN_DEBUG_ uint8_t tmpstr[6] = {0,}; ctlwizchip(CW_GET_ID,(void*)tmpstr); /* printf("\r\n=======================================\r\n"); printf(" WIZnet %s EVB Demos v%d.%.2d\r\n", tmpstr, VER_H, VER_L); printf("=======================================\r\n"); printf(">> W5500 based FTP Client Example\r\n"); printf("=======================================\r\n"); */ Display_Net_Conf(); // Print out the network information to serial terminal #endif /* Enable and setup SysTick Timer at a periodic rate */ SysTick_Config(SystemCoreClock / TICKRATE_HZ1); /* Initialize buttons on the W5500 EVB board */ Board_Buttons_Init(); g_sdcard_done = 0; #if defined(F_APP_FTPC) ftpc_init(gWIZNETINFO.ip); #endif ret = flash_mount(); if(ret > 0) { display_SDcard_Info(ret); } while(1) { /* Button: SW1 */ if(Check_Buttons_Pressed() == BUTTONS_BUTTON1) { printf("\r\n########## SW1 was pressed.\r\n"); printf("########## Data flash flag was cleared.\r\n"); printf("########## Please reset a target.\r\n"); release_factory_flag(); } #if defined(F_APP_FTPC) ftpc_run(gFTPBUF); #endif /* Loopback Test: TCP Server and UDP */ // Test for Ethernet data transfer validation { //loopback_tcps(SOCK_TCPS, gDATABUF, PORT_TCPS); //loopback_udps(SOCK_UDPS, gDATABUF, PORT_UDPS); //loopback_ret = loopback_tcpc(SOCK_TCPS, gDATABUF, destip, destport); //if(loopback_ret < 0) printf("loopback ret: %ld\r\n", loopback_ret); // TCP Socket Error code } } return 0 ; }