fix one too small
[RRG-proxmark3.git] / client / src / graph.h
blob6f0822f96dfc8e0309f0fcfa4908a561a894c698
1 //-----------------------------------------------------------------------------
2 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // See LICENSE.txt for the text of the license.
15 //-----------------------------------------------------------------------------
16 // Graph utilities
17 //-----------------------------------------------------------------------------
19 #ifndef GRAPH_H__
20 #define GRAPH_H__
22 #include "common.h"
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 typedef struct {
29 const uint8_t type; // Used for sanity checks
30 const uint32_t *buffer; // The storage buffer for this save state
31 const size_t bufferSize; // The size of the buffer
32 const uint8_t padding; // The amount of padding at the end of the buffer, if needed
33 uint32_t offset; // (optional) Any offset the buffer needs after restoring
34 uint32_t clock; // (optional) Clock data for the buffer
35 } buffer_savestate_t;
37 typedef struct {
38 uint32_t pos;
39 char label[30];
40 } marker_t;
42 void AppendGraph(bool redraw, uint16_t clock, int bit);
43 size_t ClearGraph(bool redraw);
44 bool HasGraphData(void);
45 void setGraphBuffer(const uint8_t *src, size_t size);
46 size_t getFromGraphBuffer(uint8_t *dest);
47 size_t getFromGraphBufferEx(uint8_t *dest, size_t maxLen);
48 size_t getGraphBufferChunk(uint8_t *dest, size_t start, size_t end);
49 void convertGraphFromBitstream(void);
50 void convertGraphFromBitstreamEx(int hi, int low);
51 bool isGraphBitstream(void);
53 int GetAskClock(const char *str, bool verbose);
54 int GetPskClock(const char *str, bool verbose);
55 int GetPskCarrier(bool verbose);
56 int GetNrzClock(const char *str, bool verbose);
57 int GetFskClock(const char *str, bool verbose);
58 bool fskClocks(uint8_t *fc1, uint8_t *fc2, uint8_t *rf1, int *firstClockEdge);
60 extern void add_temporary_marker(uint32_t position, const char *label);
61 extern void remove_temporary_markers(void);
63 buffer_savestate_t save_buffer32(uint32_t *src, size_t length);
64 buffer_savestate_t save_bufferS32(int32_t *src, size_t length);
65 buffer_savestate_t save_buffer8(uint8_t *src, size_t length);
66 size_t restore_buffer32(buffer_savestate_t saveState, uint32_t *dest);
67 size_t restore_bufferS32(buffer_savestate_t saveState, int32_t *dest);
68 size_t restore_buffer8(buffer_savestate_t saveState, uint8_t *dest);
70 #define MAX_GRAPH_TRACE_LEN (40000 * 32)
71 #define GRAPH_SAVE 1
72 #define GRAPH_RESTORE 0
74 extern int32_t g_GraphBuffer[MAX_GRAPH_TRACE_LEN];
75 extern int32_t g_OperationBuffer[MAX_GRAPH_TRACE_LEN];
76 extern int32_t g_OverlayBuffer[MAX_GRAPH_TRACE_LEN];
77 extern bool g_useOverlays;
78 extern size_t g_GraphTraceLen;
80 extern marker_t g_MarkerA, g_MarkerB, g_MarkerC, g_MarkerD;
81 extern marker_t *g_TempMarkers;
82 extern uint8_t g_TempMarkerSize;
84 extern double g_GridOffset;
86 extern buffer_savestate_t g_saveState_gb;
88 #ifdef __cplusplus
90 #endif
91 #endif