FreeCalypso > hg > freecalypso-reveng
view fluid-mnf/fluid.h @ 315:bc3391aa3d35
frbl/reconst/boot.c: import from TI's FLUID package
with defenestrated line endings
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 04 Mar 2020 23:17:27 +0000 |
parents | 9cecc930d78f |
children | 37b5f94de802 |
line wrap: on
line source
/****************************************************************************** * FLUID (Flash Loader and Utility Independent of Device) * Idea, design and coding by Mads Meisner-Jensen, mmj@ti.com * * Main * * $Id: fluid.h 1.43 Fri, 25 Oct 2002 14:46:33 +0200 tsj $ * ******************************************************************************/ /****************************************************************************** * Exception definitions ******************************************************************************/ enum Exceptions { E_OK = 0, /* Ok */ E_DRIVER_INIT = -3, /* Driver failed to initialize */ E_DRIVER_WAIT = -4, /* Driver recv_wait() failed */ E_UART_INIT = -5, /* UART failed to initialize */ E_UART_PARAM = -6, /* UART parameter bad or unsupported */ E_UART_DRV_SEND = -7, /* UART driver transmit error */ E_UART_DRV_RECV = -8, /* UART driver receive error */ E_RECV_TIMEOUT = -10, /* Receive timeout (no target reply) */ E_RECV_ANTITIMEOUT = -11, /* Receive anti-timeout (target replied!?) */ E_SEND_CHECKSUM = -12, /* Transmit checksum error */ E_RECV_CHECKSUM = -13, /* Receive checksum error */ E_PROTO_ERROR = -14, /* Protocol error (bad char from target) */ E_INVALID = -15, /* Invalid command parameter */ E_FIFO_OVERFLOW = -16, /* RX FIFO overflow in target */ E_FLASH_UNKNOWN = -20, /* Flash device unknown */ E_FLASH_TIMEOUT = -21, /* Flash operation timeout */ E_FLASH_VERIFY = -22, /* Flash verify error */ E_FLASH_COMMAND = -23, /* Flash command sequence error */ E_FLASH_VPPRANGE = -24, /* Flash Vpp range error */ E_FLASH_LOCKED = -25, /* Flash block locked error */ E_FLASH_ERROR = -26, /* Flash error (unknown!?) */ E_TARGET_TYPE = -27, /* Target type not detected, unspecified or unknown */ E_TARGET_MEMORY = -28, /* Target out of memory */ E_PARSER_EOF = -30, /* Unexpected end of file */ E_PARSER_KEYWORD = -31, /* Syntax error: keyword expected */ E_PARSER_STRING = -32, /* Syntax error: string expected */ E_PARSER_NUMBER = -33, /* Syntax error: number expected */ E_PARSER_END_BRACE = -34, /* Syntax error: missing end brace */ E_PARSER_SYNTAX = -35, /* Syntax error */ E_PARSER_MEMMAP = -36, /* Undefined flash memmap */ E_PARSER_ALGORITHM = -37, /* Undefined flash algorithm */ E_BOOTLOADER = -40, /* Unsupported bootloader */ E_FILE_OPEN = -50, /* File open error */ E_FILE_CLOSE = -52, /* File close error */ E_FILE_READ = -53, /* File read error */ E_FILE_WRITE = -54, /* File write error */ E_FILE_FORMAT = -55, /* File format/syntax error */ E_FILE_EMPTY = -56, /* File empty or unreadable? */ E_FILE_BUF_SMALL = -57, /* File buffer too small */ E_FILE_INPUT = -58, /* No input file name supplied */ E_FILE_OUTPUT = -59, /* No output file name supplied */ E_ADDR_RANGE = -70, /* Bad address range */ E_ERASE_SPEC = -71, /* Bad erase override specifier */ E_READ_SPEC = -72, /* Bad memory read specifier */ E_WRITE_SPEC = -73, /* Bad memory write specifier */ E_BADARG = -80, /* Bad argument or out of range */ E_ARG_MULTI = -81, /* Multiple ambiguous arguments supplied */ E_ARG_TOOMANY = -82, /* Too many arguments supplied */ E_MEMORY = -85, /* Out of memory */ E_BUFFER = -86, /* Internal (static) buffer too small */ E_ROM_SSERVICE = -90, /* Secure ROM service error */ E_INTERNAL = -99, /* Internal program state error */ E_OS = -100 }; /****************************************************************************** * Typedefs and Prototypes ******************************************************************************/ typedef unsigned char uint8; typedef unsigned short uint16; typedef unsigned long uint32; typedef signed char int8; typedef signed short int16; typedef signed long int32; void main_warning(int error); void main_error(int error); void main_fatal(int error); void main_msg(char *format, ...); int flowf(int level, char *format, ...); /****************************************************************************** * Globals ******************************************************************************/ #define ARG_FILE_LIST_SIZE_MAX 8 extern char *arg_file_list[ARG_FILE_LIST_SIZE_MAX]; extern int arg_file_list_size; extern char *arg_erase_override; extern char *arg_read; extern char *arg_write; extern int arg_checksum; extern int arg_compress; extern int arg_flash_read; extern int arg_dry_run; extern int arg_list_devices; extern char arg_target_type; extern int arg_image_map_show; extern int arg_sector_map_show; extern int arg_sector_list_show; extern int arg_timers_show; extern int arg_timers_extended_show; extern int arg_checksum_show; extern int arg_show_hexdump; extern int arg_target_trace_enable; extern int arg_progress; extern char arg_hexfile_type; extern char arg_hexfile_memwidth; extern int arg_target_reset; extern int arg_rom_bootloader; extern int arg_boot_delay_rom; extern int arg_boot_delay_fluid; extern int arg_device_id0; extern int arg_device_id1; extern int arg_uart_port; extern int arg_uart_baudrate; extern char arg_uart_flowcontrol[2]; extern char arg_uart_level_convert; extern char arg_verbose; extern int arg_debug_resume; extern int arg_debug_trace_pe; extern int arg_keep_going; extern char *argv_0; extern int arg_trlevel; extern int arg_trmask; extern int arg_trspaces; extern int arg_skip_erase; extern int arg_errorfd; // Secure Calypso Plus extern char *arg_die_id_file_name; extern char *arg_imeisv; extern char *arg_platform_certificate_addr; extern int arg_request_certificate; extern int arg_delay_for_changing_cs5; extern int arg_uart_baudrate_during_cmd_download; extern int arg_uart_timeout_configuration; extern int arg_block_size; // IMEI protection #define C_IMEISV_DIGITS 16 #define C_IMEISV_BYTES 8 #define C_PLATFORM_CERT_ADDR_DIGITS 8 #define C_PLATFORM_CERT_ADDR_BYTES 4 // End Secure Calypso Plus enum VERBOSITY_LEVELS { TESTOUTPUT = -2, // Only test output. ALWAYS = -2, QUIET = -1, // No messsages at all. NORMAL = 0, // Overview message level. VERBOSE = 1, // Detailed messages. Useful for diagnosing problems. BLABBER = 2, // Very verbose messages. Useful for debugging. DEBUG = 3 // Very very verbose messages. Useful for debugging. }; /****************************************************************************** * Trace mask bits definition ******************************************************************************/ enum TraceMaskBits { TrMAIN = 1 << 24, TrUtility = TrMAIN | 0x000002, TrMachines = TrMAIN | 0x000004, TrTargetDrv = TrMAIN | 0x000010, TrTargetWait = TrMAIN | 0x000020, TrGetChar = TrMAIN | 0x000100, TrPutChar = TrMAIN | 0x000200, TrDriverGet = TrMAIN | 0x000400, TrDriverPut = TrMAIN | 0x000800, TrHexRead = TrMAIN | 0x001000, TrHexWrite = TrMAIN | 0x002000, TrArgParser = TrMAIN | 0x004000, TrCmdLineParser = TrMAIN | 0x008000, TrParser = TrMAIN | 0x010000 };