]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Support for Chibios compilation
authorFred Sundvik <fsundvik@gmail.com>
Sun, 21 Feb 2016 21:17:59 +0000 (23:17 +0200)
committerFred Sundvik <fsundvik@gmail.com>
Sun, 21 Feb 2016 21:17:59 +0000 (23:17 +0200)
Remove some warnings, change the include paths.

19 files changed:
serial_link.mk
serial_link/protocol/byte_stuffer.c
serial_link/protocol/byte_stuffer.h
serial_link/protocol/frame_router.c
serial_link/protocol/frame_router.h
serial_link/protocol/frame_validator.c
serial_link/protocol/frame_validator.h
serial_link/protocol/physical.h
serial_link/protocol/transport.c
serial_link/protocol/transport.h
serial_link/protocol/triple_buffered_object.c
serial_link/protocol/triple_buffered_object.h
serial_link/system/system.h
serial_link/tests/Makefile
serial_link/tests/byte_stuffer_tests.c
serial_link/tests/frame_router_tests.c
serial_link/tests/frame_validator_tests.c
serial_link/tests/transport_tests.c
serial_link/tests/triple_buffered_object_tests.c

index de2364108a39777c3870ab0908cd594ca23a69c2..e8915a33f96d96586c03d40e9432747dc019c970 100644 (file)
@@ -20,4 +20,5 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-INC += $(SERIAL_DIR)
\ No newline at end of file
+INC += $(SERIAL_DIR)
+SRC += $(wildcard $(SERIAL_DIR)/serial_link/protocol/*.c)
\ No newline at end of file
index 8b529667fd14877fc94fed0ee8ec537b02a292d6..fb4c45a8dc04a87549844e52cfa6adbec55ecc87 100644 (file)
@@ -22,10 +22,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 */
 
-#include "protocol/byte_stuffer.h"
-#include "protocol/frame_validator.h"
-#include "protocol/physical.h"
-#include <stdio.h>
+#include "serial_link/protocol/byte_stuffer.h"
+#include "serial_link/protocol/frame_validator.h"
+#include "serial_link/protocol/physical.h"
+#include <stdbool.h>
 
 // This implements the "Consistent overhead byte stuffing protocol"
 // https://en.wikipedia.org/wiki/Consistent_Overhead_Byte_Stuffing
index 839a876fe816974e8680c657782ad388fcd70b9f..2cc88beb42a1144584fe0f568684ab6cc8bca6f9 100644 (file)
@@ -22,6 +22,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 */
 
+#ifndef SERIAL_LINK_BYTE_STUFFER_H
+#define SERIAL_LINK_BYTE_STUFFER_H
+
+#include <stdint.h>
+
 void init_byte_stuffer(void);
 void byte_stuffer_recv_byte(uint8_t link, uint8_t data);
 void byte_stuffer_send_frame(uint8_t link, uint8_t* data, uint16_t size);
+
+#endif
index 890ebbe9ea339a5a8d59f66b79ee02ea2d86ff2c..04b8c2e75ca60a15fc29080ffd8505cb0a1e91d0 100644 (file)
@@ -22,8 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 */
 
-#include "protocol/frame_router.h"
-#include "protocol/transport.h"
+#include "serial_link/protocol/frame_router.h"
+#include "serial_link/protocol/transport.h"
+#include "serial_link/protocol/frame_validator.h"
 
 static bool is_master;
 
index 67db3122fa40d567221e07b30cf62971af9a3650..712250ff359faf32abe8fa3bf4026f4d9b4be224 100644 (file)
@@ -22,9 +22,17 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 */
 
+#ifndef SERIAL_LINK_FRAME_ROUTER_H
+#define SERIAL_LINK_FRAME_ROUTER_H
+
+#include <stdint.h>
+#include <stdbool.h>
+
 #define UP_LINK 0
 #define DOWN_LINK 1
 
 void router_set_master(bool master);
 void route_incoming_frame(uint8_t link, uint8_t* data, uint16_t size);
 void router_send_frame(uint8_t destination, uint8_t* data, uint16_t size);
+
+#endif
index a3face6506e6c803e5e43b03bc2455aa22325f1f..474f80ee8ecd60243bee4c9ed6cb08057dcf100f 100644 (file)
@@ -22,9 +22,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 */
 
-#include "protocol/frame_validator.h"
-#include "protocol/frame_router.h"
-#include "protocol/byte_stuffer.h"
+#include "serial_link/protocol/frame_validator.h"
+#include "serial_link/protocol/frame_router.h"
+#include "serial_link/protocol/byte_stuffer.h"
+#include <string.h>
 
 const uint32_t poly8_lookup[256] =
 {
index c35fc27260b6dea095c3da03cc027e64112bf80d..4a910d510b922b5f4cc0ca992e54de623cb8fc8f 100644 (file)
@@ -22,6 +22,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 */
 
+#ifndef SERIAL_LINK_FRAME_VALIDATOR_H
+#define SERIAL_LINK_FRAME_VALIDATOR_H
+
+#include <stdint.h>
+
 void validator_recv_frame(uint8_t link, uint8_t* data, uint16_t size);
 // The buffer pointed to by the data needs 4 additional bytes
 void validator_send_frame(uint8_t link, uint8_t* data, uint16_t size);
+
+#endif
index ee5883d36bfc34d6269e36e3263e27c3f8d9f184..425e06cdd294d541d5383aa72d935590cc01e279 100644 (file)
@@ -22,4 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 */
 
+#ifndef SERIAL_LINK_PHYSICAL_H
+#define SERIAL_LINK_PHYSICAL_H
+
 void send_data(uint8_t link, const uint8_t* data, uint16_t size);
+
+#endif
index 03f83a8068c0b758865262cf227c7049918876fb..4542a7a050e4ab832cbb5ca2817b205c41ac0a70 100644 (file)
@@ -22,9 +22,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 */
 
-#include "protocol/transport.h"
-#include "protocol/frame_router.h"
-#include "protocol/triple_buffered_object.h"
+#include "serial_link/protocol/transport.h"
+#include "serial_link/protocol/frame_router.h"
+#include "serial_link/protocol/triple_buffered_object.h"
+#include <string.h>
 
 static remote_object_t** remote_objects;
 static uint32_t num_remote_objects;
@@ -32,7 +33,7 @@ static uint32_t num_remote_objects;
 void init_transport(remote_object_t** _remote_objects, uint32_t _num_remote_objects) {
     remote_objects = _remote_objects;
     num_remote_objects = _num_remote_objects;
-    int i;
+    unsigned int i;
     for(i=0;i<num_remote_objects;i++) {
         remote_object_t* obj = remote_objects[i];
         if (obj->object_type == MASTER_TO_ALL_SLAVES) {
@@ -44,7 +45,7 @@ void init_transport(remote_object_t** _remote_objects, uint32_t _num_remote_obje
         }
         else if(obj->object_type == MASTER_TO_SINGLE_SLAVE) {
             uint8_t* start = obj->buffer;
-            int j;
+            unsigned int j;
             for (j=0;j<NUM_SLAVES;j++) {
                 triple_buffer_object_t* tb = (triple_buffer_object_t*)start;
                 triple_buffer_init(tb);
@@ -58,7 +59,7 @@ void init_transport(remote_object_t** _remote_objects, uint32_t _num_remote_obje
             triple_buffer_object_t* tb = (triple_buffer_object_t*)start;
             triple_buffer_init(tb);
             start += LOCAL_OBJECT_SIZE(obj->object_size);
-            int j;
+            unsigned int j;
             for (j=0;j<NUM_SLAVES;j++) {
                 tb = (triple_buffer_object_t*)start;
                 triple_buffer_init(tb);
@@ -88,11 +89,8 @@ void transport_recv_frame(uint8_t from, uint8_t* data, uint16_t size) {
     triple_buffer_end_write_internal(tb);
 }
 
-uint32_t transport_send_frame(uint8_t to, uint8_t* data, uint16_t size) {
-}
-
 void update_transport(void) {
-    int i;
+    unsigned int i;
     for(i=0;i<num_remote_objects;i++) {
         remote_object_t* obj = remote_objects[i];
         if (obj->object_type == MASTER_TO_ALL_SLAVES || obj->object_type == SLAVE_TO_MASTER) {
@@ -106,7 +104,7 @@ void update_transport(void) {
         }
         else {
             uint8_t* start = obj->buffer;
-            int j;
+            unsigned int j;
             for (j=0;j<NUM_SLAVES;j++) {
                 triple_buffer_object_t* tb = (triple_buffer_object_t*)start;
                 uint8_t* ptr = (uint8_t*)triple_buffer_read_internal(obj->object_size + LOCAL_OBJECT_EXTRA, tb);
index a1a83b8f76c768a080c143fba215fccdc97f07e4..9e9e22462c7417ca7704e76448d3f297872cdebf 100644 (file)
@@ -25,8 +25,8 @@ SOFTWARE.
 #ifndef SERIAL_LINK_TRANSPORT_H
 #define SERIAL_LINK_TRANSPORT_H
 
-#include "protocol/triple_buffered_object.h"
-#include "system/system.h"
+#include "serial_link/protocol/triple_buffered_object.h"
+#include "serial_link/system/system.h"
 
 #define NUM_SLAVES 8
 #define LOCAL_OBJECT_EXTRA 16
@@ -146,7 +146,6 @@ typedef struct { \
 
 void init_transport(remote_object_t** remote_objects, uint32_t num_remote_objects);
 void transport_recv_frame(uint8_t from, uint8_t* data, uint16_t size);
-uint32_t transport_send_frame(uint8_t to, uint8_t* data, uint16_t size);
 void update_transport(void);
 
 #endif
index 6b3cf75adf503cdcdcf70b551ffb2608bc959acc..c6bf28af0aa5462843bd92e05c0de21b46f8cb32 100644 (file)
@@ -22,8 +22,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 */
 
-#include "protocol/triple_buffered_object.h"
-#include "system/system.h"
+#include "serial_link/protocol/triple_buffered_object.h"
+#include "serial_link/system/system.h"
+#include <stdbool.h>
+#include <stddef.h>
 
 #define GET_READ_INDEX() object->state & 3
 #define GET_WRITE_INDEX() (object->state >> 2) & 3
index 03209709cbccc2f463f064bcbf3e919f0b6202dd..2e57db3f50f58c678ff94f0363851a8bc3ef6081 100644 (file)
@@ -25,6 +25,8 @@ SOFTWARE.
 #ifndef SERIAL_LINK_TRIPLE_BUFFERED_OBJECT_H
 #define SERIAL_LINK_TRIPLE_BUFFERED_OBJECT_H
 
+#include <stdint.h>
+
 typedef struct {
     uint8_t state;
     uint8_t buffer[] __attribute__((aligned(4)));
index 163349953df45c7dc587e149a9d1a7cfd2a66bea..1e4c610b1d6f30a2a409812b86785eccb4c30d6d 100644 (file)
@@ -25,12 +25,18 @@ SOFTWARE.
 #ifndef SERIAL_LINK_SYSTEM_H
 #define SERIAL_LINK_SYSTEM_H
 
-void serial_link_lock() {
+inline void serial_link_lock(void) {
 }
 
-void serial_link_unlock() {
+inline void serial_link_unlock(void) {
 }
 
-void signal_data_written(void);
+void singal_data_written(void);
+
+#if defined(PROTOCOL_CHIBIOS)
+
+inline void signal_data_written(void) {
+}
+#endif
 
 #endif
index 0d8ba4b7b65a2102534b4da4d5aff324a5a0f3b2..1b072c6f1d2f38fdb95348fbe631a905b3e6b425 100644 (file)
@@ -22,7 +22,7 @@
 
 CC = gcc
 CFLAGS = 
-INCLUDES = -I. -I../
+INCLUDES = -I. -I../../
 LDFLAGS = -L$(BUILDDIR)/cgreen/build-c/src -shared
 LDLIBS = -lcgreen
 UNITOBJ = $(BUILDDIR)/serialtest/unitobj
index 912c4d3211cfd5a14e029710338492b3bcce9876..64b170e8c1d076bff7b2cd086a32e7a3259da634 100644 (file)
@@ -24,10 +24,10 @@ SOFTWARE.
 
 #include <cgreen/cgreen.h>
 #include <cgreen/mocks.h>
-#include "protocol/byte_stuffer.h"
-#include "protocol/byte_stuffer.c"
-#include "protocol/frame_validator.h"
-#include "protocol/physical.h"
+#include "serial_link/protocol/byte_stuffer.h"
+#include "serial_link/protocol/byte_stuffer.c"
+#include "serial_link/protocol/frame_validator.h"
+#include "serial_link/protocol/physical.h"
 
 static uint8_t sent_data[MAX_FRAME_SIZE*2];
 static uint16_t sent_data_size;
index 0b0ea6e7f48304f3e8e56ee0749d6155a4661399..6c806fa939f7ec64e5d4993977e7fb1fde8a6ce1 100644 (file)
@@ -24,10 +24,10 @@ SOFTWARE.
 
 #include <cgreen/cgreen.h>
 #include <cgreen/mocks.h>
-#include "protocol/byte_stuffer.c"
-#include "protocol/frame_validator.c"
-#include "protocol/frame_router.c"
-#include "protocol/transport.h"
+#include "serial_link/protocol/byte_stuffer.c"
+#include "serial_link/protocol/frame_validator.c"
+#include "serial_link/protocol/frame_router.c"
+#include "serial_link/protocol/transport.h"
 
 static uint8_t received_data[256];
 static uint16_t received_data_size;
index f4abd14d1be82d09dd8aa292cfb7cb992f9f4fa2..d20947e2c9c61746fc2a13091c744a5e690dcd22 100644 (file)
@@ -24,7 +24,7 @@ SOFTWARE.
 
 #include <cgreen/cgreen.h>
 #include <cgreen/mocks.h>
-#include "protocol/frame_validator.c"
+#include "serial_link/protocol/frame_validator.c"
 
 void route_incoming_frame(uint8_t link, uint8_t* data, uint16_t size) {
     mock(data, size);
index 3fa8eab4ac8aefce99b8d3660950fb55c2d48996..3e9bffdfa713959d5635f396b4413de4369fd54e 100644 (file)
@@ -24,8 +24,8 @@ SOFTWARE.
 
 #include <cgreen/cgreen.h>
 #include <cgreen/mocks.h>
-#include "protocol/transport.c"
-#include "protocol/triple_buffered_object.c"
+#include "serial_link/protocol/transport.c"
+#include "serial_link/protocol/triple_buffered_object.c"
 
 void signal_data_written(void) {
     mock();
index 1017df8f5ef5c1076224a5f571c03cb5595f0a40..6f7c82b468fc0028720180d0c8b0f98a16b531b9 100644 (file)
@@ -23,7 +23,7 @@ SOFTWARE.
 */
 
 #include <cgreen/cgreen.h>
-#include "protocol/triple_buffered_object.c"
+#include "serial_link/protocol/triple_buffered_object.c"
 
 typedef struct {
     uint8_t state;