Files
0xFFFF/src/main.h
T

137 lines
2.8 KiB
C
Raw Normal View History

2007-04-20 18:20:22 +02:00
#ifndef _INCLUDE_MAIN_H_
#define _INCLUDE_MAIN_H_
#include "hash.h"
2008-02-18 01:25:00 +01:00
#include "nolo.h"
#include "os.h"
extern char strbuf[1024];
2007-04-20 18:20:22 +02:00
#define _FILE_OFFSET_BITS 64
#define _GNU_SOURCE
// Forward declaration for use in function arguments.
struct devices;
int queue_mode();
2007-04-20 18:20:22 +02:00
int reverse_extract_pieces(char *dir);
void flash_image(const char *filename, const char *piece, const char *version);
2007-04-20 18:20:22 +02:00
int fiasco_read_image(char *file);
void check_nolo_order();
extern struct usb_dev_handle *dev;
unsigned long get_file_size(const char *file);
2007-04-20 18:20:22 +02:00
void progressbar(unsigned long long part, unsigned long long total);
const char *fpid_file(const char *filename);
2007-04-20 18:20:22 +02:00
int add_piece(char *piece);
void eprintf(const char *format, ...);
2007-04-20 18:20:22 +02:00
#include <limits.h>
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
2008-01-14 11:25:08 +01:00
#if HAVE_USB
#include <usb.h>
2008-12-14 03:05:19 +01:00
int fiasco_flash(const char *file);
extern struct usb_device *device;
extern struct usb_dev_handle *dev;
int is_valid_device(struct usb_device_descriptor *udd);
void list_valid_devices();
int usb_device_found(struct usb_device_descriptor *udd, struct devices *it_device);
int console(const char *device);
int connect_via_usb();
2008-01-14 11:25:08 +01:00
#endif
int console_prompt();
//
void cmd_info(char *line);
int check_badblocks(char *mtddev);
int dump_config();
extern int verbose;
2007-04-20 18:20:22 +02:00
#define D if (verbose)
#define CMD_WRITE 64
#define CMD_QUERY 192
struct piece_t {
char *name;
char *type;
char *device;
char *hwrevs;
char *version;
2007-04-20 18:20:22 +02:00
};
enum flash_mode {
FLASH_COLD,
FLASH_NORMAL,
FLASH_EMMC,
FLASH_MKII,
};
struct devices {
char *name;
unsigned short vendor_id;
unsigned short product_id;
enum flash_mode mode;
};
#define SUPPORTED_DEVICES 8
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_2ND,
2007-04-20 18:20:22 +02:00
PIECE_SECONDARY,
PIECE_KERNEL,
PIECE_INITFS,
PIECE_ROOTFS,
PIECE_OMAPNAND,
PIECE_MMC,
PIECE_CMT_2ND,
PIECE_CMT_ALGO,
PIECE_CMT_MCUSW,
PIECE_FIASCO,
2007-04-20 18:20:22 +02:00
PIECE_LAST
};
struct header_t {
int fd;
char fwname[128];
char version[128];
char type[128];
char device[16];
char hwrev[128];
char name[128];
unsigned short hash;
unsigned int size;
unsigned char *data;
char *layout;
};
2007-04-20 18:20:22 +02:00
extern char *pieces[];
extern char *modes[];
extern char *root_devices[];
// fiasco
int openfiasco(const char *name, const char *grep, int v);
2007-10-11 03:14:11 +02:00
int fiasco_new(const char *filename, const char *name);
void fiasco_data_read(struct header_t *header);
int fiasco_add_eof(int fd);
extern int (*fiasco_callback)(struct header_t *header);
2007-10-11 03:14:11 +02:00
int fiasco_add(int fd, const char *name, const char *file, const char *version);
int fiasco_pack(int optind, char *argv[]);
int nanddump(char *mtddev, unsigned long start_addr, unsigned long length, char *dumpfile, int isbl, int ioob);
//
int reboot_board();
int get_rd_flags();
int get_usb_mode();
int get_nolo_version();
2007-04-20 18:20:22 +02:00
#endif