From b743be736870f09cb98e8debd12f67c26148638d Mon Sep 17 00:00:00 2001 From: Nathael Pajani Date: Wed, 18 Nov 2015 21:28:00 +0100 Subject: [PATCH] Rename and move dtplug protocol files under approriate directory in lib/protocols Associated changes in source files --- Makefile | 1 + .../{dtplug_protocol.h => protocols/dtplug/defs.h} | 14 +++++++------- .../dtplug/slave.h} | 10 +++++----- .../dtplug/slave.c} | 6 +++--- 4 files changed, 16 insertions(+), 15 deletions(-) rename include/lib/{dtplug_protocol.h => protocols/dtplug/defs.h} (95%) rename include/lib/{dtplug_protocol_slave.h => protocols/dtplug/slave.h} (93%) rename lib/{dtplug_protocol.c => protocols/dtplug/slave.c} (99%) diff --git a/Makefile b/Makefile index ad467e0..63412d3 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,7 @@ OBJDIR = objs SRC = $(wildcard */*.c) SRC += $(wildcard lib/*/*.c) +SRC += $(wildcard lib/protocols/*/*.c) OBJS = ${SRC:%.c=${OBJDIR}/%.o} DEPS = ${OBJS:%.o=$(OBJDIR)/%.d} diff --git a/include/lib/dtplug_protocol.h b/include/lib/protocols/dtplug/defs.h similarity index 95% rename from include/lib/dtplug_protocol.h rename to include/lib/protocols/dtplug/defs.h index 186356c..f2b525f 100644 --- a/include/lib/dtplug_protocol.h +++ b/include/lib/protocols/dtplug/defs.h @@ -1,8 +1,8 @@ /* - * lib/dtplug_protocol.h + * lib/protocols/dtplug/defs.h * * - * Copyright 2013-2014 Nathael Pajani + * Copyright 2013-2015 Nathael Pajani * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,8 +19,8 @@ * */ -#ifndef LIB_DTPLUG_PROTOCOL_H -#define LIB_DTPLUG_PROTOCOL_H +#ifndef LIB_PROTOCOLS_DTPLUG_DEFS_H +#define LIB_PROTOCOLS_DTPLUG_DEFS_H #include @@ -203,9 +203,9 @@ enum reply_statuses { * When a slave has an internal error, it has two options. * Either it's the first one, and the master requested a reply. The slave can then send the error * code in the reply. - * Or it's not the first one or the master did not ask for an reply or ACK. Then the slave stores the + * Or it's not the first one or the master did not ask for a reply or ACK. Then the slave stores the * error code for future transmission. - * When the master asked for a reply, the slave then uses "GOT_MANY_ERRORS" as error code. + * If the master asked for a reply and the slave has many errors, the slave send "GOT_MANY_ERRORS" as error code. * When the master receives the "GOT_MANY_ERRORS" error code, it must send a "PKT_TYPE_GET_ERRORS" request. * The slave then replies with a list of all errors in the packet data with a header which does not indicate an * error packet (this is the normal reply to a PKT_TYPE_GET_ERRORS request. @@ -215,4 +215,4 @@ enum reply_statuses { -#endif /* LIB_DTPLUG_PROTOCOL_H */ +#endif /* LIB_PROTOCOLS_DTPLUG_DEFS_H */ diff --git a/include/lib/dtplug_protocol_slave.h b/include/lib/protocols/dtplug/slave.h similarity index 93% rename from include/lib/dtplug_protocol_slave.h rename to include/lib/protocols/dtplug/slave.h index c3dbb15..e0bec14 100644 --- a/include/lib/dtplug_protocol_slave.h +++ b/include/lib/protocols/dtplug/slave.h @@ -1,5 +1,5 @@ /* - * lib/dtplug_protocol_slave.h + * lib/protocols/dtplug/slave.h * * * Copyright 2013-2014 Nathael Pajani @@ -19,12 +19,12 @@ * */ -#ifndef LIB_DTPLUG_PROTOCOL_SLAVE_H -#define LIB_DTPLUG_PROTOCOL_SLAVE_H +#ifndef LIB_PROTOCOLS_DTPLUG_SLAVE_H +#define LIB_PROTOCOLS_DTPLUG_SLAVE_H #include -#include "lib/dtplug_protocol.h" +#include "lib/protocols/dtplug/defs.h" /******************************************************************************/ @@ -84,4 +84,4 @@ void dtplug_protocol_send_reply(struct dtplug_protocol_handle* handle, -#endif /* LIB_DTPLUG_PROTOCOL_SLAVE_H */ +#endif /* LIB_PROTOCOLS_DTPLUG_SLAVE_H */ diff --git a/lib/dtplug_protocol.c b/lib/protocols/dtplug/slave.c similarity index 99% rename from lib/dtplug_protocol.c rename to lib/protocols/dtplug/slave.c index 91267e8..81e5d67 100644 --- a/lib/dtplug_protocol.c +++ b/lib/protocols/dtplug/slave.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/dtplug_protocol.c + * lib/protocol/dtplug/slave.c * * * Copyright 2013-2015 Nathael Pajani @@ -29,9 +29,9 @@ #include "drivers/serial.h" #include "extdrv/status_led.h" #include "lib/time.h" -#include "lib/dtplug_protocol.h" -#include "lib/dtplug_protocol_slave.h" +#include "lib/protocols/dtplug/defs.h" +#include "lib/protocols/dtplug/slave.h" /******************************************************************************/ /* DTPlug (or DomoTab, PC, ...) Communication */ -- 2.43.0