Cleaned up headers
This commit is contained in:
15
c8_remote/include/tool/command.h
Normal file
15
c8_remote/include/tool/command.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef CHECKM8_TOOL_COMMAND_H
|
||||
#define CHECKM8_TOOL_COMMAND_H
|
||||
|
||||
#include "checkm8.h"
|
||||
|
||||
#define CMD_USB_READ_LIMIT 0xFF0
|
||||
|
||||
struct dev_cmd_resp *dev_memset(struct pwned_device *dev, unsigned long long addr, unsigned char c, int len);
|
||||
struct dev_cmd_resp *dev_memcpy(struct pwned_device *dev, unsigned long long dest, unsigned long long src, int len);
|
||||
struct dev_cmd_resp *dev_exec(struct pwned_device *dev, int response_len, int nargs, unsigned long long *args);
|
||||
|
||||
struct dev_cmd_resp *dev_read_memory(struct pwned_device *dev, unsigned long long addr, int len);
|
||||
struct dev_cmd_resp *dev_write_memory(struct pwned_device *dev, unsigned long long addr, unsigned char *data, int len);
|
||||
|
||||
#endif //CHECKM8_TOOL_COMMAND_H
|
||||
44
c8_remote/include/tool/payload.h
Normal file
44
c8_remote/include/tool/payload.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef CHECKM8_TOOL_PAYLOAD_H
|
||||
#define CHECKM8_TOOL_PAYLOAD_H
|
||||
|
||||
#include "checkm8.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PAYLOAD_AES_BUSY,
|
||||
PAYLOAD_AES_SW_BERN,
|
||||
PAYLOAD_AES_SW_CORR,
|
||||
PAYLOAD_CACHELIB,
|
||||
PAYLOAD_EXIT_USB_TASK,
|
||||
PAYLOAD_FLOPPYSLEEP,
|
||||
PAYLOAD_SYNC,
|
||||
} PAYLOAD_T;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SRAM,
|
||||
DRAM
|
||||
} LOCATION_T;
|
||||
|
||||
#define DEV_PTR_NULL -1ull
|
||||
typedef unsigned long long DEV_PTR_T;
|
||||
|
||||
int install_payload(struct pwned_device *dev, PAYLOAD_T p, LOCATION_T loc);
|
||||
int uninstall_payload(struct pwned_device *dev, PAYLOAD_T p);
|
||||
int uninstall_all_payloads(struct pwned_device *dev);
|
||||
DEV_PTR_T get_payload_address(struct pwned_device *dev, PAYLOAD_T p);
|
||||
|
||||
struct dev_cmd_resp *execute_payload(struct pwned_device *dev, PAYLOAD_T p, int response_len, int nargs, ...);
|
||||
DEV_PTR_T setup_payload_async(struct pwned_device *dev, PAYLOAD_T p, int bufsize, int nargs, ...);
|
||||
int run_payload_async(struct pwned_device *dev, PAYLOAD_T p);
|
||||
int kill_payload_async(struct pwned_device *dev, PAYLOAD_T p, DEV_PTR_T buf_addr);
|
||||
|
||||
DEV_PTR_T install_data(struct pwned_device *dev, LOCATION_T loc, unsigned char *data, int len);
|
||||
int uninstall_data(struct pwned_device *dev, DEV_PTR_T ptr);
|
||||
int uninstall_all_data(struct pwned_device *dev);
|
||||
|
||||
struct dev_cmd_resp *read_gadget(struct pwned_device *dev, DEV_PTR_T addr, int len);
|
||||
struct dev_cmd_resp *write_gadget(struct pwned_device *dev, DEV_PTR_T addr, unsigned char *data, int len);
|
||||
struct dev_cmd_resp *execute_gadget(struct pwned_device *dev, DEV_PTR_T addr, int response_len, int nargs, ...);
|
||||
|
||||
#endif //CHECKM8_TOOL_PAYLOAD_H
|
||||
47
c8_remote/include/tool/usb_helpers.h
Normal file
47
c8_remote/include/tool/usb_helpers.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef CHECKM8_TOOL_LIBUSB_HELPERS_H
|
||||
#define CHECKM8_TOOL_LIBUSB_HELPERS_H
|
||||
|
||||
#include "checkm8.h"
|
||||
|
||||
#define MAX_PACKET_SIZE 0x800
|
||||
|
||||
#ifndef WITH_ARDUINO
|
||||
struct libusb_device_bundle
|
||||
{
|
||||
struct libusb_context *ctx;
|
||||
struct libusb_device *device;
|
||||
struct libusb_device_handle *handle;
|
||||
struct libusb_device_descriptor *descriptor;
|
||||
};
|
||||
#endif
|
||||
|
||||
int partial_ctrl_transfer(struct pwned_device *dev,
|
||||
unsigned char bmRequestType, unsigned char bRequest,
|
||||
unsigned short wValue, unsigned short wIndex,
|
||||
unsigned char *data, unsigned short data_len,
|
||||
unsigned int timeout);
|
||||
|
||||
int no_error_ctrl_transfer(struct pwned_device *dev,
|
||||
unsigned char bmRequestType, unsigned char bRequest,
|
||||
unsigned short wValue, unsigned short wIndex,
|
||||
unsigned char *data, unsigned short data_len,
|
||||
unsigned int timeout);
|
||||
|
||||
int no_error_ctrl_transfer_data(struct pwned_device *dev,
|
||||
unsigned char bmRequestType, unsigned char bRequest,
|
||||
unsigned short wValue, unsigned short wIndex,
|
||||
unsigned char *data, unsigned short data_len,
|
||||
unsigned int timeout);
|
||||
|
||||
int ctrl_transfer(struct pwned_device *dev,
|
||||
unsigned char bmRequestType, unsigned char bRequest,
|
||||
unsigned short wValue, unsigned short wIndex,
|
||||
unsigned char *data, unsigned short data_len,
|
||||
unsigned int timeout, unsigned int trigger);
|
||||
|
||||
int reset(struct pwned_device *dev);
|
||||
int serial_descriptor(struct pwned_device *dev, unsigned char *serial_buf, int len);
|
||||
|
||||
const char *usb_error_name(int ret);
|
||||
|
||||
#endif //CHECKM8_TOOL_LIBUSB_HELPERS_H
|
||||
Reference in New Issue
Block a user