diff --git a/project/Core/Inc/tftp.h b/project/Core/Inc/tftp.h index 3ff4cbb..6446e4e 100644 --- a/project/Core/Inc/tftp.h +++ b/project/Core/Inc/tftp.h @@ -4,6 +4,8 @@ #ifndef PROJECT_TFTP_H #define PROJECT_TFTP_H +#define LOGGER_LEVEL_ALL +#include "log.h" #include extern struct tftp_context tftpContext_s; diff --git a/project/Core/Src/tftp.c b/project/Core/Src/tftp.c index 8c880c4..9876e9c 100644 --- a/project/Core/Src/tftp.c +++ b/project/Core/Src/tftp.c @@ -4,34 +4,35 @@ #include "tftp.h" -void *tftp_open(const char *fname, const char *mode, u8_t write) -{ +static const char* TAG = "tftp_server"; + +void *tftp_open(const char *fname, const char *mode, u8_t write) { } -void tftp_close(void *handle) -{ +void tftp_close(void *handle) { } -int tftp_read(void* handle, void* buf, int bytes) -{ +int tftp_read(void* handle, void* buf, int bytes) { } -int tftp_write(void* handle, struct pbuf* p) -{ +int tftp_write(void* handle, struct pbuf* p) { } -struct tftp_context tftpContext_s = - { +struct tftp_context tftpContext_s = { tftp_open, tftp_close, tftp_read, tftp_write }; -void tftp_server_init(void) -{ - tftp_init(&tftpContext_s); +void tftp_server_init(void) { + LOG_INFO(TAG, "Initializing tftp server"); + if (tftp_init(&tftpContext_s) != ERR_OK) { + LOG_FATAL(TAG, "Could not initialize tftp server"); + return; + } + LOG_INFO(TAG, "tftp server initialized successfully"); } \ No newline at end of file