board/sg-nfc.c: Add initial emu for NFC board

This board also supports FeliCa and probably some other stuff.
Need to analyze and implement these features later, Mifare card
support only for now.
This commit is contained in:
Tau
2018-11-20 20:26:11 -05:00
parent 0135236209
commit 4936fc2bcc
4 changed files with 448 additions and 0 deletions

31
board/sg-nfc.h Normal file
View File

@ -0,0 +1,31 @@
#pragma once
#include <windows.h>
#include <stddef.h>
#include <stdint.h>
#include "hook/iobuf.h"
struct sg_nfc_ops {
HRESULT (*mifare_poll)(void *ctx);
HRESULT (*mifare_read_luid)(void *ctx, uint8_t *luid, size_t nbytes);
};
struct sg_nfc {
const struct sg_nfc_ops *ops;
void *ops_ctx;
uint8_t addr;
};
void sg_nfc_init(
struct sg_nfc *nfc,
uint8_t addr,
const struct sg_nfc_ops *ops,
void *ops_ctx);
void sg_nfc_transact(
struct sg_nfc *nfc,
struct iobuf *resp_frame,
const void *req_bytes,
size_t req_nbytes);