TFTP code writing begin..
This commit is contained in:
@@ -20,6 +20,14 @@
|
||||
/* Extern Functions ---------------------------------------------*/
|
||||
#ifdef F_STORAGE
|
||||
extern void save_data(uint8_t *data, uint32_t data_len, uint16_t block_number);
|
||||
|
||||
void save_data(uint8_t *data, uint32_t data_len, uint16_t block_number)
|
||||
{
|
||||
//Nothing to do with received data yet..
|
||||
//TODO: Add your own handler here
|
||||
//Print out data as string
|
||||
PRINTF("Data #%d-%lu:\r\n%s\r\n", block_number, data_len, data);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Global Variable ----------------------------------------------*/
|
||||
|
||||
@@ -19,6 +19,13 @@ extern "C" {
|
||||
|
||||
#define F_STORAGE // If your target support a storage, you have to activate this feature and implement.
|
||||
|
||||
#if defined(F_STORAGE)
|
||||
#include "ff.h"
|
||||
FIL fil; // FatFs File objects
|
||||
FRESULT fr; // FatFs function common result code
|
||||
#endif
|
||||
|
||||
|
||||
#define SOCK_TFTP 2
|
||||
|
||||
#define INFO_DBG 0x01
|
||||
|
||||
3
21_m1284p_WIZNET_TFTP_client_FATFS/debug.log
Normal file
3
21_m1284p_WIZNET_TFTP_client_FATFS/debug.log
Normal file
@@ -0,0 +1,3 @@
|
||||
########## SW1 was pressed.
|
||||
TFTP IP address : 192.168.0.100
|
||||
TFTP IP address (32 bit) : 3232235620
|
||||
@@ -554,12 +554,18 @@ int main()
|
||||
//!! Здесь по факту нажатия кнопки (1->0 SW1)
|
||||
|
||||
|
||||
printf("\r\n########## SW2 was pressed.\r\n");
|
||||
strncpy(tftp_filename, 0x00, 50);
|
||||
printf("\r\n########## SW1 was pressed.\r\n");
|
||||
//strncpy(tftp_filename, 0x00, 50);
|
||||
memset(tftp_filename, 0x0, 50);
|
||||
strncpy(tftp_filename, "test.txt", 8);
|
||||
|
||||
tftp_server = (tftp_destip[0] << 24) | (tftp_destip[1] << 16) | (tftp_destip[2] << 8) | (tftp_destip[3]);
|
||||
tftp_server = ((uint32_t)tftp_destip[0] << 24) | ((uint32_t)tftp_destip[1] << 16) | ((uint32_t)tftp_destip[2] << 8) | ((uint32_t)tftp_destip[3]);
|
||||
|
||||
PRINTF("TFTP IP address : %d.%d.%d.%d\r\n",tftp_destip[0],tftp_destip[1],tftp_destip[2],tftp_destip[3]);
|
||||
PRINTF("TFTP IP address (32 bit) : %lu\r\n",tftp_server);
|
||||
|
||||
|
||||
/*
|
||||
TFTP_read_request(tftp_server, tftp_filename);
|
||||
|
||||
uint8_t _ret = 0;
|
||||
@@ -569,7 +575,7 @@ int main()
|
||||
if(_ret != TFTP_PROGRESS)
|
||||
break;
|
||||
}
|
||||
|
||||
*/
|
||||
//!! Debug only
|
||||
//PRINTF("SW1 is pressed\r\nADC0/PA0 is: %u\r\n", adc_read(0));
|
||||
//PRINTF("SW1 is pressed\r\n");
|
||||
|
||||
Reference in New Issue
Block a user