pass fido2 tests

This commit is contained in:
Conor Patrick
2018-10-28 16:30:55 -04:00
parent 2f911368da
commit 2fd96f8e4b
23 changed files with 900 additions and 318 deletions

View File

@@ -3,7 +3,9 @@
#include "app.h"
#ifndef TEST_FIFO
#define TEST_FIFO 0
#endif
#define FIFO_CREATE(NAME,LENGTH,BYTES)\
int __##NAME##_WRITE_PTR = 0;\
@@ -13,7 +15,7 @@ static uint8_t __##NAME##_WRITE_BUF[BYTES * LENGTH];\
\
int fifo_##NAME##_add(uint8_t * c)\
{\
if (__##NAME##_WRITE_PTR != __##NAME##_READ_PTR || !__##NAME##_SIZE)\
if (__##NAME##_SIZE < LENGTH)\
{\
memmove(__##NAME##_WRITE_BUF + __##NAME##_WRITE_PTR * BYTES, c, BYTES);\
__##NAME##_WRITE_PTR ++;\
@@ -28,7 +30,7 @@ int fifo_##NAME##_add(uint8_t * c)\
int fifo_##NAME##_take(uint8_t * c)\
{\
memmove(c, __##NAME##_WRITE_BUF + __##NAME##_READ_PTR * BYTES, BYTES);\
if (__##NAME##_READ_PTR != __##NAME##_WRITE_PTR || __##NAME##_SIZE)\
if ( __##NAME##_SIZE > 0)\
{\
__##NAME##_READ_PTR ++;\
if (__##NAME##_READ_PTR >= LENGTH)\
@@ -43,17 +45,27 @@ uint32_t fifo_##NAME##_size()\
{\
return (__##NAME##_SIZE);\
}\
uint32_t fifo_##NAME##_rhead()\
{\
return (__##NAME##_READ_PTR);\
}\
uint32_t fifo_##NAME##_whead()\
{\
return (__##NAME##_WRITE_PTR);\
}\
#define FIFO_CREATE_H(NAME,LENGTH,BYTES)\
#define FIFO_CREATE_H(NAME)\
int fifo_##NAME##_add(uint8_t * c);\
int fifo_##NAME##_take(uint8_t * c);\
uint32_t fifo_##NAME##_size();\
uint32_t fifo_##NAME##_rhead();\
uint32_t fifo_##NAME##_whead();\
FIFO_CREATE_H(hidmsg,10,64)
FIFO_CREATE_H(hidmsg)
FIFO_CREATE_H(debug,1024,1)
FIFO_CREATE_H(debug)
FIFO_CREATE_H(test,100,100)
FIFO_CREATE_H(test)
void fifo_test();