2021-11-05 17:01:45 +01:00

36 lines
1.2 KiB
C

// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include <stdint.h>
#include <stdio.h>
#include <sys/types.h>
#define TEMP_PROG_FOLDER_NAME "/var/tmp/"
#define TEMP_PROG_FOLDER_NAME_ALL_FILES "/var/tmp/*"
#define TEMP_PROG_FILE_NAME TEMP_PROG_FOLDER_NAME "tmp.rawbin"
int defineGPIOpins(char *mess);
int FPGAdontTouchFlash(char *mess);
int FPGATouchFlash(char *mess);
int resetFPGA(char *mess);
int emptyTempFolder(char *mess);
/**
* deletes old file
* verify memory available to copy
* open file to copy
*/
int preparetoCopyProgram(FILE **fd, uint64_t fsize, char *mess);
int copyToFlash(enum PROGRAMINDEX index, char *mType, ssize_t fsize,
char *clientChecksum, char *mess);
int getDrive(enum PROGRAMINDEX index, char *mess);
/** Notify fpga not to touch flash, open src and flash drive to write */
int openFileForFlash(FILE **flashfd, FILE **srcfd, char *mess);
int eraseFlash(char *mess);
/* write from tmp file to flash */
int writeToFlash(ssize_t fsize, FILE *flashfd, FILE *srcfd, char *mess);
/** Notify fpga to pick up firmware from flash and wait for status confirmation
*/
int waitForFPGAtoTouchFlash(char *mess);