blob: 7493da9875133bafd3d073467e77eae06f739985 [file] [log] [blame]
#pragma once
#include <stdint.h>
#include "gonk/pin_config.h"
#include "pw_result/result.h"
#include "pw_span/span.h"
#include "pw_status/status.h"
using gonk::pin_config::PinConfig;
using pw::span;
using pw::Status;
namespace gonk::fpga_control {
const int BitstreamFileLength = 135100;
class FpgaControl {
public:
FpgaControl(PinConfig *pin_config);
Status StartConfig();
Status FpgaConfigFromSerial();
Status WaitForBitstreamStart();
Status ReadBitstream();
Status VerifyBitstream();
Status SendBitstreamToFpga(const uint32_t config_timeout_ms = 2000);
private:
PinConfig *pin_config_;
int bitstream_file_position = 0;
char bitstream_file[BitstreamFileLength];
uint8_t read_buffer[4] = {0, 0, 0, 0};
int bytes_written = 0;
};
} // namespace gonk::fpga_control