1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
7 //-----------------------------------------------------------------------------
8 // Data and Graph commands
9 //-----------------------------------------------------------------------------
20 //#include <stdlib.h> //size_t
22 int CmdData(const char *Cmd
);
24 // Still quite work to do here to provide proper functions for internal usage...
26 int Cmdaskrawdemod(const char *Cmd);
27 int Cmdaskmandemod(const char *Cmd);
28 int CmdAskEdgeDetect(const char *Cmd);
29 int CmdAutoCorr(const char *Cmd);
30 int CmdBiphaseDecodeRaw(const char *Cmd);
31 int CmdBitsamples(const char *Cmd);
32 int CmdBuffClear(const char *Cmd);
33 int CmdDec(const char *Cmd);
34 int CmdDetectClockRate(const char *Cmd);
35 int CmdFSKrawdemod(const char *Cmd);
36 int CmdPSK2rawDemod(const char *Cmd);
37 int CmdHexsamples(const char *Cmd);
38 int CmdHide(const char *Cmd);
39 int CmdLoad(const char *Cmd);
40 int CmdRtrim(const char *Cmd);
41 int Cmdmandecoderaw(const char *Cmd);
42 int CmdNRZrawDemod(const char *Cmd);
43 int CmdPrintDemodBuff(const char *Cmd);
44 int CmdRawDemod(const char *Cmd);
45 int CmdSamples(const char *Cmd);
46 int CmdSave(const char *Cmd);
47 int CmdScale(const char *Cmd);
48 int CmdDirectionalThreshold(const char *Cmd);
49 int CmdZerocrossings(const char *Cmd);
50 int CmdDataIIR(const char *Cmd);
52 int CmdPrintDemodBuff(const char *Cmd
); // used by cmd lf keri, lf nexwatch
53 int CmdPSK1rawDemod(const char *Cmd
); // used by cmd lf
54 int CmdGetBitStream(const char *Cmd
); // used by cmd lf
55 int CmdGrid(const char *Cmd
); // used by cmd lf cotag
56 int CmdHpf(const char *Cmd
); // used by cmd lf data (!)
57 int CmdLtrim(const char *Cmd
); // used by cmd lf em4x, lf t55xx
58 int CmdNorm(const char *Cmd
); // used by cmd lf data (!)
59 int CmdPlot(const char *Cmd
); // used by cmd lf cotag
60 int CmdSave(const char *Cmd
); // used by cmd auto
61 int CmdTuneSamples(const char *Cmd
); // used by cmd lf hw
63 int ASKbiphaseDemod(int offset
, int clk
, int invert
, int maxErr
, bool verbose
); // used by cmd lf em4x, lf fdxb, lf guard, lf jablotron, lf nedap, lf t55xx
64 int ASKDemod(int clk
, int invert
, int maxErr
, size_t maxlen
, bool amplify
, bool verbose
, bool emSearch
, uint8_t askType
); // used by cmd lf em4x, lf t55xx, lf viking
65 int ASKDemod_ext(int clk
, int invert
, int maxErr
, size_t maxlen
, bool amplify
, bool verbose
, bool emSearch
, uint8_t askType
, bool *stCheck
); // used by cmd lf, lf em4x, lf noralsy, le presco, lf securekey, lf t55xx, lf visa2k
66 int FSKrawDemod(uint8_t rfLen
, uint8_t invert
, uint8_t fchigh
, uint8_t fclow
, bool verbose
); // used by cmd lf, lf em4x, lf t55xx
67 int PSKDemod(int clk
, int invert
, int maxErr
, bool verbose
); // used by cmd lf em4x, lf indala, lf keri, lf nexwatch, lf t55xx
68 int NRZrawDemod(int clk
, int invert
, int maxErr
, bool verbose
); // used by cmd lf pac, lf t55xx
71 int printDemodBuff(uint8_t offset
, bool strip_leading
, bool invert
, bool print_hex
);
73 void setDemodBuff(uint8_t *buff
, size_t size
, size_t start_idx
);
74 bool getDemodBuff(uint8_t *buff
, size_t *size
);
75 void save_restoreDB(uint8_t saveOpt
);// option '1' to save DemodBuffer any other to restore
76 int AutoCorrelate(const int *in
, int *out
, size_t len
, size_t window
, bool SaveGrph
, bool verbose
);
78 int getSamples(uint32_t n
, bool verbose
);
79 int getSamplesEx(uint32_t start
, uint32_t end
, bool verbose
);
81 void setClockGrid(uint32_t clk
, int offset
);
82 int directionalThreshold(const int *in
, int *out
, size_t len
, int8_t up
, int8_t down
);
83 int AskEdgeDetect(const int *in
, int *out
, int len
, int threshold
);
85 #define MAX_DEMOD_BUF_LEN (1024*128)
86 extern uint8_t DemodBuffer
[MAX_DEMOD_BUF_LEN
];
87 extern size_t DemodBufferLen
;
89 extern int g_DemodClock
;
90 extern int32_t g_DemodStartIdx
;