xrock/rock.h

49 lines
1.2 KiB
C
Raw Normal View History

2021-08-02 17:29:22 +08:00
#ifndef __ROCK_H__
#define __ROCK_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <x.h>
#include <rc4.h>
#include <crc16.h>
#include <progress.h>
struct chip_t {
uint16_t pid;
char * name;
};
struct xrock_ctx_t {
libusb_device_handle * hdl;
struct chip_t * chip;
int epout;
int epin;
2021-08-03 18:34:22 +08:00
int maskrom;
};
enum reset_type_t {
RESET_TYPE_NORMAL = 0x00,
2021-08-03 18:34:22 +08:00
RESET_TYPE_MSC = 0x01,
RESET_TYPE_POWEROFF = 0x02,
RESET_TYPE_MASKROM = 0x03,
RESET_TYPE_DISCONNECT = 0x04,
2021-08-02 17:29:22 +08:00
};
int xrock_init(struct xrock_ctx_t * ctx);
void rock_maskrom_init_ddr(struct xrock_ctx_t * ctx, const char * filename);
void rock_maskrom_init_usbplug(struct xrock_ctx_t * ctx, const char * filename);
2021-08-03 18:34:22 +08:00
int rock_reset(struct xrock_ctx_t * ctx, enum reset_type_t type);
2021-08-03 21:02:36 +08:00
int rock_exec(struct xrock_ctx_t * ctx, uint32_t addr);
void rock_read(struct xrock_ctx_t * ctx, uint32_t addr, void * buf, size_t len);
void rock_write(struct xrock_ctx_t * ctx, uint32_t addr, void * buf, size_t len);
void rock_read_progress(struct xrock_ctx_t * ctx, uint32_t addr, void * buf, size_t len);
void rock_write_progress(struct xrock_ctx_t * ctx, uint32_t addr, void * buf, size_t len);
2021-08-03 18:34:22 +08:00
2021-08-02 17:29:22 +08:00
#ifdef __cplusplus
}
#endif
#endif /* __ROCK_H__ */