Добавить протокол Altera Logic и общие клиенты прошивки
This commit is contained in:
35
c/set-protocol/include/altera_logic.h
Normal file
35
c/set-protocol/include/altera_logic.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/** Altera logic analyzer UART client. C99, caller-owned memory, no OS/heap.
|
||||
* One request at a time; no automatic retries (ARM is not idempotent).
|
||||
* Initialize aligned storage of la_context_size() bytes, then call la_next,
|
||||
* la_feed and la_tick from one thread. tick receives elapsed milliseconds.
|
||||
*/
|
||||
#ifndef ALTERA_LOGIC_H
|
||||
#define ALTERA_LOGIC_H
|
||||
#include "pcan_abi.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
enum { LA_CONNECTING, LA_READY, LA_CAPTURING, LA_DONE, LA_ERROR };
|
||||
enum { LA_OK, LA_BAD_FRAME, LA_CHECKSUM, LA_DEVICE_ERROR, LA_TIMEOUT,
|
||||
LA_UNSUPPORTED, LA_ARGUMENT, LA_IO_ERROR };
|
||||
enum { LA_STATE, LA_ERROR_CODE, LA_CHANNELS, LA_DEPTH, LA_CLOCK_HZ,
|
||||
LA_FLAGS, LA_TRIGGER_INDEX, LA_READ_COUNT, LA_DIVIDER };
|
||||
PCAN_ABI_API size_t la_context_size(void);
|
||||
PCAN_ABI_API void la_init(void *ctx);
|
||||
/** Return 0 on success. Configuration is immutable throughout this capture. */
|
||||
PCAN_ABI_API int la_start(void *ctx, uint32_t divider, uint32_t mask,
|
||||
uint32_t value, uint32_t edge_mask, uint32_t edge_value);
|
||||
/** Returns 6 when a request is ready, otherwise 0. Capacity must be >=6. */
|
||||
PCAN_ABI_API size_t la_next(void *ctx, uint8_t *out, size_t capacity);
|
||||
PCAN_ABI_API void la_feed(void *ctx, const uint8_t *data, size_t size);
|
||||
PCAN_ABI_API void la_tick(void *ctx, uint32_t elapsed_ms);
|
||||
PCAN_ABI_API void la_fail(void *ctx, uint32_t code);
|
||||
PCAN_ABI_API uint32_t la_get(const void *ctx, uint32_t field);
|
||||
PCAN_ABI_API size_t la_samples(const void *ctx, uint16_t *out, size_t capacity);
|
||||
/** Offline fixture, never communicates with hardware or claims a real trigger. */
|
||||
PCAN_ABI_API void la_demo_init(void *ctx);
|
||||
PCAN_ABI_API int la_demo_capture(void *ctx, uint32_t divider);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user