91 lines
3.8 KiB
C
91 lines
3.8 KiB
C
/* ************************************************************************** */
|
|
/* _____ _ */
|
|
/* libp7/packetio.h |_ _|__ _ _| |__ ___ _ _ */
|
|
/* | Project: libp7 | |/ _ \| | | | '_ \ / _ \ | | | */
|
|
/* | | (_) | |_| | | | | __/ |_| | */
|
|
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
|
|
/* Last updated: 2016/10/13 07:36:52 |___/ */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
#ifndef LIBP7_PACKETIO_H
|
|
# define LIBP7_PACKETIO_H
|
|
# include <libp7/packet.h>
|
|
# define MAX_RAWDATA_SIZE 256
|
|
# ifdef __cplusplus
|
|
extern "C" {
|
|
# endif
|
|
|
|
/* ************************************************************************** */
|
|
/* Utilities */
|
|
/* ************************************************************************** */
|
|
/* send some data */
|
|
int p7_send_filestream(p7_handle_t *handle, FILE *stream, p7uint_t size,
|
|
int shift, void (*disp)(p7ushort_t, p7ushort_t));
|
|
/* get some data */
|
|
int p7_get_filestream(p7_handle_t *handle, FILE *stream, p7uint_t size,
|
|
int shift, void (*disp)(p7ushort_t, p7ushort_t));
|
|
|
|
/* ************************************************************************** */
|
|
/* Packet sending */
|
|
/* ************************************************************************** */
|
|
/* Commands */
|
|
/* - system commands - */
|
|
int p7_send_cmdsys_getinfo(p7_handle_t *handle);
|
|
/* - flash commands - */
|
|
int p7_send_cmdfls_reqfile(p7_handle_t *handle,
|
|
const char *dirname, const char *filename, const char *devname);
|
|
int p7_send_cmdfls_sendfile(p7_handle_t *handle,
|
|
p7_commandoverwrite_t ow, p7uint_t fs,
|
|
const char *dirname, const char *filename, const char *devname);
|
|
int p7_send_cmdfls_delfile(p7_handle_t *handle,
|
|
const char *dirname, const char *filename, const char *devname);
|
|
int p7_send_cmdfls_copyfile(p7_handle_t *handle,
|
|
const char *dirname, const char *filename,
|
|
const char *newdir, const char *newname, const char *devname);
|
|
int p7_send_cmdfls_reset(p7_handle_t *handle, const char *devname);
|
|
int p7_send_cmdfls_reqallinfo(p7_handle_t *handle, const char *devname);
|
|
int p7_send_cmdfls_opt(p7_handle_t *handle, const char *devname);
|
|
/* - backup commands - */
|
|
int p7_send_cmdbak_reqrom(p7_handle_t *handle);
|
|
int p7_send_cmdbak_reqboot(p7_handle_t *handle);
|
|
/* - OS update commands - */
|
|
int p7_send_cmdosu_upandrun(p7_handle_t *handle,
|
|
p7uint_t upsize, p7uint_t loadaddr, p7uint_t straddr);
|
|
|
|
/* Data */
|
|
int p7_send_data(p7_handle_t *handle, p7ushort_t total, p7ushort_t id,
|
|
const void *data, p7ushort_t datasize, int resp);
|
|
int p7_send_data_quicker(p7_handle_t *handle, p7ushort_t total, p7ushort_t id,
|
|
void *buf, p7ushort_t datasize, int resp);
|
|
|
|
/* Errors */
|
|
int p7_send_err_overwrite_no(p7_handle_t *handle);
|
|
|
|
/* Acknowledgements */
|
|
int p7_send_ack(p7_handle_t *handle, int resp);
|
|
int p7_send_ack_confirm_ow(p7_handle_t *handle);
|
|
|
|
/* Checks */
|
|
int p7_send_ini_check(p7_handle_t *handle);
|
|
|
|
/* Roleswap */
|
|
int p7_send_roleswp(p7_handle_t *handle);
|
|
|
|
/* Terminations */
|
|
int p7_send_term(p7_handle_t *handle);
|
|
int p7_send_term_timeout(p7_handle_t *handle);
|
|
|
|
/* ************************************************************************** */
|
|
/* Packet response */
|
|
/* ************************************************************************** */
|
|
/* Get the decoded packet response */
|
|
const p7_packet_t *p7_get_response(p7_handle_t *handle);
|
|
|
|
/* Unshift (get response without sending) */
|
|
int p7_unshift(p7_handle_t *handle);
|
|
|
|
# ifdef __cplusplus
|
|
}
|
|
# endif
|
|
#endif /* LIBP7_PACKETIO_H */
|