Commit 013c7087971efd18a425c47d422d5790ced74b75

Henrik Nordstrom 2014-06-30T21:18:05

Update to current knc-asic library for KNC_IS_ERROR()

diff --git a/knc-asic.c b/knc-asic.c
index b499dfa..7c164f9 100644
--- a/knc-asic.c
+++ b/knc-asic.c
@@ -422,6 +422,8 @@ int knc_decode_response(uint8_t *rxbuf, int request_length, uint8_t **response, 
         ret |= KNC_ERR_CRCACK;
     if ((ack & KNC_ASIC_ACK_ACCEPT))
         ret |= KNC_ACCEPTED;
+    if (ret && memcmp(&rxbuf[len-4], "\377\377\377\377", 4) == 0)
+	ret = KNC_ERR_UNAVAIL;
     return ret;
 }
 
diff --git a/knc-asic.h b/knc-asic.h
index 0f80336..7c48317 100644
--- a/knc-asic.h
+++ b/knc-asic.h
@@ -68,7 +68,9 @@ void knc_prepare_neptune_message(int request_length, const uint8_t *request, uin
 #define KNC_ERR_CRC     (1<<1)
 #define KNC_ERR_ACK     (1<<2)
 #define KNC_ERR_CRCACK  (1<<3)
+#define KNC_ERR_UNAVAIL (1<<4)
 #define KNC_ERR_MASK	(~(KNC_ACCEPTED))
+#define KNC_IS_ERROR(x) (((x) & KNC_ERR_MASK) != 0)
 
 int knc_prepare_transfer(uint8_t *txbuf, int offset, int size, int channel, int request_length, const uint8_t *request, int response_length);
 int knc_decode_response(uint8_t *rxbuf, int request_length, uint8_t **response, int response_length);