49 lines
1.1 KiB
C
49 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
#ifndef GXFP_CONFIG_H
|
|
#define GXFP_CONFIG_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#define GXFP_CONFIG_SIZE 0xE0u
|
|
#define GXFP_CONFIG_SECTION_COUNT 8u
|
|
|
|
enum gxfp_config_write_mode {
|
|
GXFP_CONFIG_WRITE_WORD = 0,
|
|
GXFP_CONFIG_WRITE_LOW_BYTE = 1,
|
|
GXFP_CONFIG_WRITE_HIGH_BYTE = 2,
|
|
};
|
|
|
|
struct gxfp_dac_info;
|
|
|
|
struct gxfp_chicagohu_config_info {
|
|
uint8_t tcode_diff;
|
|
uint16_t tcode;
|
|
uint8_t fdt_delta;
|
|
uint8_t fdt_offset;
|
|
uint16_t checksum;
|
|
};
|
|
|
|
uint16_t gxfp_config_checksum(const uint8_t config[GXFP_CONFIG_SIZE]);
|
|
|
|
int gxfp_config_update_checksum(uint8_t config[GXFP_CONFIG_SIZE]);
|
|
|
|
int gxfp_config_modify_register(uint8_t config[GXFP_CONFIG_SIZE],
|
|
uint16_t reg,
|
|
uint16_t value,
|
|
unsigned int section,
|
|
enum gxfp_config_write_mode mode,
|
|
uint16_t *old_value);
|
|
|
|
int gxfp_config_patch_dac(uint8_t config[GXFP_CONFIG_SIZE],
|
|
const uint16_t register_values[4]);
|
|
|
|
int gxfp_config_build_chicagohu_2504(
|
|
uint8_t config[GXFP_CONFIG_SIZE],
|
|
const void *otp,
|
|
size_t otp_len,
|
|
const struct gxfp_dac_info *dac,
|
|
struct gxfp_chicagohu_config_info *info);
|
|
|
|
#endif
|