2007-04-25 21:05:03 +02:00
|
|
|
|
2007-04-20 18:20:22 +02:00
|
|
|
#ifndef _INCLUDE_MAIN_H_
|
|
|
|
|
#define _INCLUDE_MAIN_H_
|
|
|
|
|
|
|
|
|
|
#define _FILE_OFFSET_BITS 64
|
|
|
|
|
#define _GNU_SOURCE
|
|
|
|
|
|
2007-06-14 23:32:52 +02:00
|
|
|
// Forward declaration for use in function arguments.
|
|
|
|
|
struct devices;
|
2007-05-01 15:01:23 +02:00
|
|
|
|
2007-04-20 18:20:22 +02:00
|
|
|
int reverse_extract_pieces(char *dir);
|
|
|
|
|
void flash_image(char *filename, char *piece, char *version);
|
|
|
|
|
int fiasco_read_image(char *file);
|
|
|
|
|
void check_nolo_order();
|
|
|
|
|
extern struct usb_dev_handle *dev;
|
|
|
|
|
unsigned long get_file_size(char *file);
|
|
|
|
|
void progressbar(unsigned long long part, unsigned long long total);
|
|
|
|
|
char *fpid_file(char *filename);
|
|
|
|
|
int add_piece(char *piece);
|
|
|
|
|
|
2007-05-01 15:01:23 +02:00
|
|
|
#include <usb.h>
|
|
|
|
|
|
|
|
|
|
extern struct usb_device *device;
|
|
|
|
|
extern struct usb_dev_handle *dev;
|
|
|
|
|
int is_valid_device(struct usb_device_descriptor *udd);
|
|
|
|
|
void list_valid_devices();
|
2007-06-14 23:32:52 +02:00
|
|
|
int usb_device_found(struct usb_device_descriptor *udd, struct devices *it_device);
|
2007-06-10 00:38:55 +02:00
|
|
|
int console(const char *device);
|
2007-06-10 05:41:50 +02:00
|
|
|
int connect_via_usb();
|
|
|
|
|
int console_prompt();
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
void cmd_info(char *line);
|
2007-06-10 16:15:30 +02:00
|
|
|
int check_badblocks(char *mtddev);
|
2007-06-11 02:29:11 +02:00
|
|
|
int dump_config();
|
2007-05-01 15:01:23 +02:00
|
|
|
|
|
|
|
|
extern int verbose;
|
2007-04-20 18:20:22 +02:00
|
|
|
#define D if (verbose)
|
|
|
|
|
|
|
|
|
|
#define CMD_WRITE 64
|
|
|
|
|
#define CMD_QUERY 192
|
|
|
|
|
|
|
|
|
|
#define NOLO_GET_STATUS 1
|
|
|
|
|
#define NOLO_GET_BOARD_ID 2
|
|
|
|
|
#define NOLO_GET_VERSION 3
|
|
|
|
|
|
|
|
|
|
struct piece_t {
|
|
|
|
|
char *name;
|
|
|
|
|
char *type;
|
|
|
|
|
char *vers;
|
|
|
|
|
};
|
|
|
|
|
|
2007-05-01 15:01:23 +02:00
|
|
|
struct devices {
|
|
|
|
|
char *name;
|
|
|
|
|
unsigned short vendor_id;
|
|
|
|
|
unsigned short product_id;
|
|
|
|
|
unsigned short flags;
|
|
|
|
|
};
|
2007-06-14 23:32:52 +02:00
|
|
|
|
|
|
|
|
#define SUPPORTED_DEVICES 6
|
2007-05-01 15:01:23 +02:00
|
|
|
extern struct devices supported_devices[SUPPORTED_DEVICES];
|
|
|
|
|
|
2007-04-20 18:20:22 +02:00
|
|
|
extern int pcs_n;
|
|
|
|
|
extern struct piece_t pcs[10];
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
PIECE_XLOADER = 0,
|
|
|
|
|
PIECE_SECONDARY,
|
|
|
|
|
PIECE_KERNEL,
|
|
|
|
|
PIECE_INITFS,
|
|
|
|
|
PIECE_ROOTFS,
|
|
|
|
|
PIECE_OMAPNAND,
|
|
|
|
|
PIECE_LAST
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern char *pieces[];
|
|
|
|
|
extern char *modes[];
|
|
|
|
|
extern char *root_devices[];
|
|
|
|
|
|
2007-10-08 00:25:56 +02:00
|
|
|
// fiasco
|
|
|
|
|
extern void (*fiasco_callback)(struct header_t *header);
|
|
|
|
|
struct header_t {
|
|
|
|
|
char fwname[128];
|
|
|
|
|
char name[128];
|
|
|
|
|
char version[128];
|
|
|
|
|
unsigned short hash;
|
|
|
|
|
unsigned int size;
|
|
|
|
|
unsigned char *data;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2007-04-20 18:20:22 +02:00
|
|
|
#endif
|