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_NONE = 0x00,
|
|
|
|
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);
|
2021-08-03 18:34:22 +08:00
|
|
|
|
2021-08-02 17:29:22 +08:00
|
|
|
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-02 17:29:22 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __ROCK_H__ */
|