FreeCalypso > hg > freecalypso-reveng
view fluid-mnf/calplus/ram_load.h @ 401:4b6b595ae0a0
compal/boot/code-deriv: new analysis
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 14 Jan 2023 23:59:23 +0000 |
parents | 9cecc930d78f |
children |
line wrap: on
line source
/* %Z% nom : %M% SID: %I% date : %G% */ /* Filename: %M% */ /* Version: %I% */ /****************************************************************************** * WIRELESS COMMUNICATION SYSTEM DEVELOPMENT * * (C) 2002 Texas Instruments France. All rights reserved * * Author : Francois AMAND * * * Important Note * -------------- * * This S/W is a preliminary version. It contains information on a product * under development and is issued for evaluation purposes only. Features * characteristics, data and other information are subject to change. * * The S/W is furnished under Non Disclosure Agreement and may be used or * copied only in accordance with the terms of the agreement. It is an offence * to copy the software in any way except as specifically set out in the * agreement. No part of this document may be reproduced or transmitted in any * form or by any means, electronic or mechanical, including photocopying and * recording, for any purpose without the express written permission of Texas * Instruments Inc. * ****************************************************************************** * * FILE NAME: ram_load.c * * * PURPOSE: Describe the RAM loader state machine used during boot procedure * in order to download a FLASH programmer into the Internal RAM if * CALYPSOPLUS chip. * * * * FILE REFERENCES: * * Name IO Description * ------------- -- --------------------------------------------- * * * * EXTERNAL VARIABLES: * * Source: * * Name Type IO Description * ------------------- --------------- -- ---------------------------- * * * EXTERNAL REFERENCES: * * Name Description * ------------------ ------------------------------------------------------- * * * * ABNORMAL TERMINATION CONDITIONS, ERROR AND WARNING MESSAGES: * * * * ASSUMPTION, CONSTRAINTS, RESTRICTIONS: * * * * NOTES: * * * * REQUIREMENTS/FUNCTIONAL SPECIFICATION REFERENCES: * * * * * DEVELOPMENT HISTORY: * * Date Name(s) Version Description * ---------- -------------- ------- -------------------------------------- * 31-May-02 Francois AMAND V1.0.0 Import from CALYPSO * * ALGORITHM: Use the RAM loader state machine defined in CALPLUS208 specifica- * tion. * * *****************************************************************************/ #ifndef _RAM_LOADER_H_ #define _RAM_LOADER_H_ /* * Include files */ #include "standard.h" #include "secure_types.h" #define C_MAX_PLATFORM_DATA 64192 /* * Main buffer size */ // Include manufacture certificate + platform data + manufacturer certificate signature #define C_MAX_BUFFER_SIZE (sizeof(T_MANUFACTURER_CERTIFICATE) + C_MAX_PLATFORM_DATA + C_MANUF_SIG_SIZE * C_WORD32LGB) /* * Serial interface choice */ enum { #ifdef _SERIAL_IRDA_ C_SERIAL_ID_MODEM = 0, C_SERIAL_ID_IRDA = 1 #else C_SERIAL_ID_MODEM = 0 #endif }; /* * RAM loader state */ typedef enum { C_RESET_STATE = 0, C_SIGNALLING_STATE = 1, C_AWAIT_PARAMETER_STATE = 2, C_COMMAND_PHASE_STATE = 3 } T_RAM_LOADER_PC_STATE; /* * RAM loader event */ typedef enum { C_NO_EVENT = 0, C_USER_DOWNLOAD_REQUEST = 1, C_USER_ABORT_REQUEST = 2, C_SIGNALLING_TIMEOUT = 3, C_WATCHDOG_TIMEOUT = 4, C_SIGNALLING_RESPONSE = 5, C_PARAMETER_ACK_RESPONSE = 6, C_PARAMETER_NACK_RESPONSE = 7, C_WRITE_ACK_RESPONSE = 8, C_WRITE_NACK_RESPONSE = 9, C_CERTIFICATE_ACK_RESPONSE = 10 } T_RAM_LOADER_PC_EVENT; /* * RAM loader command */ typedef enum { C_SIGNALLING_REQUEST_CMD = 0, C_PARAMETER_REQUEST_CMD = 1, C_WRITE_REQUEST_CMD = 2, C_ABORT_REQUEST_CMD = 3, C_CERTIFICATE_REQUEST_CMD = 4 } T_RAM_LOADER_PC_COMMAND; /* * RAM loader timer */ typedef enum { C_SIGNALLING_TIMER = 0, C_WATCHDOG_TIMER = 1 } T_RAM_LOADER_PC_TIMER; #define C_RAM_LOADER_PC_NB_TIMER 2 /* * Timeout definition in ms */ #define C_SIGNALLING_TIMEOUT_VALUE 4L /* 2 ms */ #define C_WATCHDOG_TIMEOUT_VALUE 120000L /* 2 mn */ /* * RAM loader status */ typedef enum { C_NO_STATUS = 0, C_BAD_INPUT_FILE = 1, C_SUCCESS = 2, C_BAD_PARAMETERS = 3, C_ERROR_DURING_WRITE = 4, C_BAD_ADDRESS_OF_BRANCH = 5, C_WATCHDOG_TIMER_REACHED = 6, C_USER_ABORT = 7 } T_RAM_LOADER_PC_STATUS; enum { C_COMMAND_NOT_RECEIVED = 0, C_COMMAND_RECEIVED = 1, C_SERIAL_TIMEOUT = 2 }; typedef struct { UWORD8 d_nb_data; UWORD32 d_address; UWORD8 *p_block; } T_WRITE_REQUEST; typedef struct { UWORD16 d_max_byte; UWORD8 a_data[sizeof(T_MANUFACTURER_CERTIFICATE_FLASH_PROGRAMMER)]; } T_FRAME; typedef struct { UWORD8 d_device_id; UWORD8 d_baud_rate; char *p_file_name; /* * Signalling response variable */ UWORD16 d_romcode_version; UWORD8 a_hash_man_pub_key[C_MD5HASHLG * C_WORD32LGB]; UWORD8 a_die_id[C_WORD32LGB * C_DIE_ID_SIZE]; UWORD8 a_Certsig[C_WORD32LGB * C_MANUF_SIG_SIZE]; /* * Parameter NACK response variable */ UWORD8 d_param_req_sts; /* * Certificate request variable */ BOOLEAN b_certificate_request; /* * Certificate response variable */ union { UWORD8 a_firm_cert[C_MAX_BUFFER_SIZE]; /* Take into account max data_platform size */ T_MANUFACTURER_CERTIFICATE_PLATFORM_DATA d_firm_cert; } u_firm_cert; /* * Command request variable */ UWORD32 d_uart_timeout; union { UWORD8 a_code_certificate[sizeof(T_MANUFACTURER_CERTIFICATE_FLASH_PROGRAMMER)]; T_MANUFACTURER_CERTIFICATE_FLASH_PROGRAMMER d_code_certificate; } u_code_certificate; /* * Write request variable */ UWORD32 d_nb_byte_in_block; UWORD32 d_nb_byte_sent; UWORD8 *p_block_buffer; UWORD32 d_block_address; UWORD32 d_block_size; /* * Mobile received variable */ //UWORD16 d_max_block_size; //UWORD16 d_mobile_buffer_size; UWORD8 d_write_status; //T_WRITE_REQUEST d_parameter_request; } T_RAM_LOADER; /* * RAM loader baud rate definition */ typedef enum { C_BAUD_RATE_812500 = 0, C_BAUD_RATE_406250 = 1, C_BAUD_RATE_203125 = 2, C_BAUD_RATE_115200 = 3, C_BAUD_RATE_57600 = 4, C_BAUD_RATE_38400 = 5, C_BAUD_RATE_28800 = 6, C_BAUD_RATE_19200 = 7, C_BAUD_RATE_DEFAULT = 7, C_BAUD_RATE_9600 = 8 } T_BAUD_RATE; #define C_BLOCK_INDEX_OFFSET 0 #define C_NB_BLOCK_OFFSET 1 #define C_BLOCK_SIZE_OFFSET 2 #define C_BLOCK_ADDRESS_OFFSET 4 #define C_BLOCK_DATA_OFFSET 8 #endif