2015-01-06 23:29:45 -05:00
|
|
|
// Copyright (C) 2014
|
2014-12-28 20:33:32 -05:00
|
|
|
//
|
|
|
|
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
|
|
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
|
|
|
// the license.
|
|
|
|
//-----------------------------------------------------------------------------
|
2015-01-18 18:13:32 -05:00
|
|
|
// Low frequency demod related commands
|
|
|
|
// marshmellow
|
|
|
|
// note that many of these demods are not the slickest code and they often rely
|
|
|
|
// on peaks and clock instead of converting to clean signal.
|
|
|
|
//
|
2014-12-28 20:33:32 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifndef LFDEMOD_H__
|
|
|
|
#define LFDEMOD_H__
|
2016-03-06 10:35:25 +01:00
|
|
|
#include <stdint.h> // for uint_32+
|
|
|
|
#include <stdbool.h> // for bool
|
2017-02-13 15:33:26 +01:00
|
|
|
#include <string.h> // for strcmp
|
|
|
|
#include <stdlib.h> // for
|
2017-03-03 12:27:35 +01:00
|
|
|
|
2015-04-08 01:07:39 -04:00
|
|
|
//generic
|
2017-03-03 12:27:35 +01:00
|
|
|
#ifndef ON_DEVICE
|
2017-03-03 12:24:02 +01:00
|
|
|
void SetGraphClock(int clock, int startidx);
|
2017-03-03 12:27:35 +01:00
|
|
|
#endif
|
2016-10-21 16:06:53 +02:00
|
|
|
uint8_t justNoise(uint8_t *bits, size_t size);
|
2015-11-22 17:33:41 +01:00
|
|
|
size_t addParity(uint8_t *BitSource, uint8_t *dest, uint8_t sourceLen, uint8_t pLen, uint8_t pType);
|
2015-04-08 01:07:39 -04:00
|
|
|
int askdemod(uint8_t *BinStream, size_t *size, int *clk, int *invert, int maxErr, uint8_t amp, uint8_t askType);
|
2017-01-20 10:03:53 +01:00
|
|
|
void askAmp(uint8_t *BitStream, size_t size);
|
2015-04-08 01:07:39 -04:00
|
|
|
int BiphaseRawDecode(uint8_t * BitStream, size_t *size, int offset, int invert);
|
|
|
|
uint32_t bytebits_to_byte(uint8_t* src, size_t numbits);
|
2015-06-04 10:33:55 +02:00
|
|
|
uint32_t bytebits_to_byteLSBF(uint8_t* src, size_t numbits);
|
2015-04-08 01:07:39 -04:00
|
|
|
uint16_t countFC(uint8_t *BitStream, size_t size, uint8_t fskAdj);
|
|
|
|
int DetectASKClock(uint8_t dest[], size_t size, int *clock, int maxErr);
|
|
|
|
uint8_t DetectCleanAskWave(uint8_t dest[], size_t size, uint8_t high, uint8_t low);
|
|
|
|
uint8_t detectFSKClk(uint8_t *BitStream, size_t size, uint8_t fcHigh, uint8_t fcLow);
|
2017-03-03 11:36:07 +01:00
|
|
|
uint8_t detectFSKClk_ext(uint8_t *BitStream, size_t size, uint8_t fcHigh, uint8_t fcLow, int *firstClockEdge);
|
2015-04-08 01:07:39 -04:00
|
|
|
int DetectNRZClock(uint8_t dest[], size_t size, int clock);
|
2017-03-03 11:36:07 +01:00
|
|
|
int DetectNRZClock_ext(uint8_t dest[], size_t size, int clock, int *clockStartIdx);
|
2015-04-08 01:07:39 -04:00
|
|
|
int DetectPSKClock(uint8_t dest[], size_t size, int clock);
|
2017-03-03 11:36:07 +01:00
|
|
|
int DetectPSKClock_ext(uint8_t dest[], size_t size, int clock, int *firstPhaseShift);
|
|
|
|
int DetectStrongAskClock(uint8_t dest[], size_t size, uint8_t high, uint8_t low, int *clock);
|
2016-02-19 22:30:19 +01:00
|
|
|
bool DetectST(uint8_t buffer[], size_t *size, int *foundclock);
|
2017-03-01 20:14:46 +01:00
|
|
|
bool DetectST_ext(uint8_t buffer[], size_t *size, int *foundclock, size_t *ststart, size_t *stend);
|
2015-04-08 01:07:39 -04:00
|
|
|
int fskdemod(uint8_t *dest, size_t size, uint8_t rfLen, uint8_t invert, uint8_t fchigh, uint8_t fclow);
|
|
|
|
int getHiLo(uint8_t *BitStream, size_t size, int *high, int *low, uint8_t fuzzHi, uint8_t fuzzLo);
|
2015-10-27 21:47:21 +01:00
|
|
|
uint32_t manchesterEncode2Bytes(uint16_t datain);
|
2015-04-08 01:07:39 -04:00
|
|
|
int ManchesterEncode(uint8_t *BitStream, size_t size);
|
|
|
|
int manrawdecode(uint8_t *BitStream, size_t *size, uint8_t invert);
|
2015-11-20 16:56:43 +01:00
|
|
|
int nrzRawDemod(uint8_t *dest, size_t *size, int *clk, int *invert);
|
2015-04-08 01:07:39 -04:00
|
|
|
uint8_t parityTest(uint32_t bits, uint8_t bitLen, uint8_t pType);
|
2017-02-23 00:52:40 +01:00
|
|
|
bool preambleSearch(uint8_t *BitStream, uint8_t *preamble, size_t pLen, size_t *size, size_t *startIdx);
|
|
|
|
bool preambleSearchEx(uint8_t *BitStream, uint8_t *preamble, size_t pLen, size_t *size, size_t *startIdx, bool findone);
|
2015-04-08 01:07:39 -04:00
|
|
|
int pskRawDemod(uint8_t dest[], size_t *size, int *clock, int *invert);
|
|
|
|
void psk2TOpsk1(uint8_t *BitStream, size_t size);
|
|
|
|
void psk1TOpsk2(uint8_t *BitStream, size_t size);
|
|
|
|
size_t removeParity(uint8_t *BitStream, size_t startIdx, uint8_t pLen, uint8_t pType, size_t bLen);
|
|
|
|
|
|
|
|
//tag specific
|
|
|
|
int AWIDdemodFSK(uint8_t *dest, size_t *size);
|
2017-02-28 14:47:25 +01:00
|
|
|
int Em410xDecode(uint8_t *BitStream, size_t *size, size_t *startIdx, uint32_t *hi, uint64_t *lo);
|
2015-11-02 20:46:17 +01:00
|
|
|
int FDXBdemodBI(uint8_t *dest, size_t *size);
|
2015-03-03 16:20:18 -05:00
|
|
|
int gProxII_Demod(uint8_t BitStream[], size_t *size);
|
2015-01-20 17:28:51 -05:00
|
|
|
int HIDdemodFSK(uint8_t *dest, size_t *size, uint32_t *hi2, uint32_t *hi, uint32_t *lo);
|
2014-12-28 20:33:32 -05:00
|
|
|
int IOdemodFSK(uint8_t *dest, size_t size);
|
2015-01-06 23:29:45 -05:00
|
|
|
int indala26decode(uint8_t *bitStream, size_t *size, uint8_t *invert);
|
2015-01-27 14:51:12 -05:00
|
|
|
int ParadoxdemodFSK(uint8_t *dest, size_t *size, uint32_t *hi2, uint32_t *hi, uint32_t *lo);
|
2015-11-10 11:42:59 +01:00
|
|
|
int PyramiddemodFSK(uint8_t *dest, size_t *size);
|
|
|
|
int VikingDemod_AM(uint8_t *dest, size_t *size);
|
2016-02-14 11:58:25 +01:00
|
|
|
int PrescoDemod(uint8_t *dest, size_t *size);
|
2016-05-02 13:42:06 +02:00
|
|
|
int NedapDemod(uint8_t *dest, size_t *size);
|
2016-07-29 11:04:12 +02:00
|
|
|
int JablotronDemod(uint8_t *dest, size_t *size);
|
2016-12-14 23:23:53 +01:00
|
|
|
int Visa2kDemod_AM(uint8_t *dest, size_t *size);
|
2016-12-15 15:50:12 +01:00
|
|
|
int NoralsyDemod_AM(uint8_t *dest, size_t *size);
|
2017-01-12 00:04:36 +01:00
|
|
|
int IdteckDemodPSK(uint8_t *dest, size_t *size);
|
2014-12-28 20:33:32 -05:00
|
|
|
#endif
|