Добавить идентификацию прошивки и чтение EEPROM Бальзам-167
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "balsam167_eeprom_layout.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -25,6 +26,30 @@ extern "C" {
|
||||
#define PERIPH28335_REQUEST_SIZE 8U
|
||||
#define PERIPH28335_COMMAND_COUNT 17U
|
||||
|
||||
/* Balsam-167 fitted AT25256B (marking 5EBL): 256 Kbit, NOT 256 Kbyte.
|
||||
* All reader positions below count physical EEPROM octets, not C28x words.
|
||||
* Four uint32_t fields make the caller-owned state stable for ctypes/JNI. */
|
||||
#define PERIPH28335_EEPROM_BYTES BALSAM167_EEPROM_BYTES
|
||||
typedef struct {
|
||||
uint32_t controller;
|
||||
uint32_t start;
|
||||
uint32_t length;
|
||||
uint32_t received;
|
||||
} periph28335_eeprom_reader;
|
||||
|
||||
/* No writes or capacity probes. Odd starts/lengths are allowed: the core reads
|
||||
* the containing 16-bit word and returns only the requested physical octets. */
|
||||
int periph28335_eeprom_begin(periph28335_eeprom_reader *reader,
|
||||
uint32_t controller, uint32_t start, uint32_t length);
|
||||
size_t periph28335_eeprom_request(const periph28335_eeprom_reader *reader,
|
||||
uint8_t *output, size_t capacity);
|
||||
/* Returns 1/2 decoded octets, or a negative status; errors do not advance state.
|
||||
* PEEK payload = little-endian data WORD + timer WORD, not four memory bytes.
|
||||
* SPI16 shifts the data word high-octet first, so physical EEPROM order is
|
||||
* response[3], response[2]. This differs from a C28x little-endian RAM dump. */
|
||||
int periph28335_eeprom_accept(periph28335_eeprom_reader *reader,
|
||||
const uint8_t *reply, size_t size, uint8_t *output, size_t capacity);
|
||||
|
||||
typedef enum {
|
||||
PERIPH28335_OK = 0,
|
||||
PERIPH28335_ERROR_ARGUMENT = -1,
|
||||
|
||||
Reference in New Issue
Block a user