fome-fw/firmware/console/binary/tunerstudio.h

90 lines
2.0 KiB
C
Raw Normal View History

2015-07-10 06:01:56 -07:00
/**
* @file tunerstudio.h
*
* @date Aug 26, 2013
2020-01-13 18:57:43 -08:00
* @author Andrey Belomutskiy, (c) 2012-2020
2015-07-10 06:01:56 -07:00
*/
2020-04-01 16:00:56 -07:00
#pragma once
2018-09-16 19:25:17 -07:00
#include "global.h"
2015-07-10 06:01:56 -07:00
#include "tunerstudio_io.h"
typedef struct {
int queryCommandCounter;
int outputChannelsCommandCounter;
int readPageCommandsCounter;
int burnCommandCounter;
int pageCommandCounter;
int writeValueCommandCounter;
int crc32CheckCommandCounter;
int writeChunkCommandCounter;
int errorCounter;
2017-03-26 14:19:08 -07:00
int totalCounter;
int textCommandCounter;
2017-05-09 09:07:52 -07:00
int testCommandCounter;
2015-07-10 06:01:56 -07:00
} tunerstudio_counters_s;
2019-10-08 18:02:51 -07:00
extern tunerstudio_counters_s tsState;
void tunerStudioDebug(TsChannelBase* tsChannel, const char *msg);
void tunerStudioError(TsChannelBase* tsChannel, const char *msg);
uint8_t* getWorkingPageAddr();
#if EFI_TUNER_STUDIO
#include "thread_controller.h"
#include "thread_priority.h"
#define CONNECTIVITY_THREAD_STACK (2 * UTILITY_THREAD_STACK_SIZE)
2018-04-01 20:38:34 -07:00
/**
* handle non CRC wrapped command
*/
bool handlePlainCommand(TsChannelBase* tsChannel, uint8_t command);
2015-07-10 06:01:56 -07:00
2018-04-01 20:38:34 -07:00
/**
* this command is part of protocol initialization
*/
void handleQueryCommand(TsChannelBase* tsChannel, ts_response_format_e mode);
2015-07-10 06:01:56 -07:00
2021-12-15 17:11:08 -08:00
void updateTunerStudioState();
2015-07-10 06:01:56 -07:00
void printTsStats(void);
void requestBurn(void);
void startTunerStudioConnectivity(void);
#if defined __GNUC__
// GCC
#define pre_packed
#define post_packed __attribute__((packed))
#else
// IAR
#define pre_packed __packed
#define post_packed
#endif
typedef pre_packed struct
post_packed {
short int offset;
short int count;
} TunerStudioWriteChunkRequest;
2015-07-10 06:01:56 -07:00
class TunerstudioThread : public ThreadController<CONNECTIVITY_THREAD_STACK> {
public:
TunerstudioThread(const char* name)
: ThreadController(name, PRIO_CONSOLE)
{
}
// Initialize and return the channel to use for this thread.
virtual TsChannelBase* setupChannel() = 0;
void ThreadTask() override;
};
2015-07-10 06:01:56 -07:00
#endif /* EFI_TUNER_STUDIO */
void handleWriteChunkCommand(TsChannelBase* tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count, void *content);
void handleBurnCommand(TsChannelBase* tsChannel, ts_response_format_e mode);