Add logger and checks for initialising
This commit is contained in:
2023-11-06 21:44:18 +01:00
parent d84bd877e1
commit 315871af60
2 changed files with 16 additions and 13 deletions

View File

@@ -4,6 +4,8 @@
#ifndef PROJECT_TFTP_H #ifndef PROJECT_TFTP_H
#define PROJECT_TFTP_H #define PROJECT_TFTP_H
#define LOGGER_LEVEL_ALL
#include "log.h"
#include <tftp_server.h> #include <tftp_server.h>
extern struct tftp_context tftpContext_s; extern struct tftp_context tftpContext_s;

View File

@@ -4,34 +4,35 @@
#include "tftp.h" #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_open,
tftp_close, tftp_close,
tftp_read, tftp_read,
tftp_write tftp_write
}; };
void tftp_server_init(void) void tftp_server_init(void) {
{ LOG_INFO(TAG, "Initializing tftp server");
tftp_init(&tftpContext_s); if (tftp_init(&tftpContext_s) != ERR_OK) {
LOG_FATAL(TAG, "Could not initialize tftp server");
return;
}
LOG_INFO(TAG, "tftp server initialized successfully");
} }