openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

ui_cli_files.h (3592B)


      1 /* 
      2  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      3  * 
      4  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      5 */
      6 #ifndef UI_CLI_FILES_INCLUDED
      7 /* { */
      8 #define UI_CLI_FILES_INCLUDED
      9 /*
     10  * General include file for reference design.
     11  */
     12 #include <appl/diag/dpp/ref_sys.h>
     13 
     14 #include <appl/diag/dpp/ui_defx.h>
     15 #include <appl/diag/dpp/utils_defx.h>
     16 
     17 
     18 /*
     19  * When in 'cli input file' mode, count the time and occasionally
     20  * delay the system (to let watchdog relax. This
     21  * is a simulation of the user's typing in at a human rate.
     22  */
     23 #define NUM_10MS_BETWEEN_DELAY    50
     24 #define NUM_TICKS_IN_CLI_DELAY    4
     25 /*
     26  * Maximal number of ram CLI files supported by this system.
     27  * Note that each file takes SIZEOF_CLI_FILE bytes of RAM memory.
     28  */
     29 #define NUM_CLI_FILES             5
     30 /*
     31  * Maximal number of bytes allowed per one CLI file.
     32  */
     33 #if LINK_FE600_LIBRARIES
     34   /* SOC_SAND_FE600 cpu has less memory, and the RBF files are not as big as in Soc_petra,
     35    * so maximal file size is smaller */
     36   #define SIZEOF_CLI_FILE           2000000
     37 #else
     38   #define SIZEOF_CLI_FILE           8000000
     39 #endif
     40 
     41 /*
     42  * Maximal number of characters in name of CLI
     43  * file (on downloading host and on this system) which
     44  * contains CLI 'program'.
     45  * This is a string which must be null terminated.
     46  */
     47 #define CLI_FILE_NAME_LEN         25
     48 /*****************************************************
     49 *NAME
     50 *  file_via_tftp_send
     51 *TYPE: PROC
     52 *FUNCTION:
     53 *  Send a file through TFTP.
     54 *INPUT:
     55 *  SOC_SAND_DIRECT:
     56 *    char *file_name -
     57 *      Pointer to name of file on this system. This
     58 *      is a null terminated string  whose size
     59 *      must be less than (CLI_FILE_NAME_LEN+1)
     60 *    char * -
     61 *      If an error is encountered then, on output,
     62 *      this program will load pointed memory by
     63 *      a null terminated string with a description
     64 *      of the error.
     65 *      Calling program is supposed to prepare
     66 *      a memry block, for that, of size 320 or more.
     67 *  SOC_SAND_INDIRECT:
     68 *    CLI static structures.
     69 *OUTPUT:
     70 *  SOC_SAND_DIRECT:
     71 *    int -
     72 *      If non zero then some error has occurred.
     73 *  SOC_SAND_INDIRECT:
     74 *    CLI static structures.
     75 *    err_msg
     76 *REMARKS:
     77 *  None.
     78 *SEE ALSO:
     79  */
     80 uint32
     81   file_via_tftp_send(
     82     uint8   *buffer,
     83     uint32  buffer_size,
     84     uint8   *file_name
     85   );
     86 int
     87   init_cli_files(
     88     void
     89   ) ;
     90 int
     91   get_num_loaded_cli_files(
     92     int *num_loaded_ptr
     93   ) ;
     94 unsigned int
     95   get_max_num_cli_files(
     96     void
     97   ) ;
     98 unsigned int
     99   get_max_cli_file_size(
    100     void
    101   ) ;
    102 unsigned int
    103   get_max_cli_filename_size(
    104     void
    105   ) ;
    106 int
    107   get_cli_file_loaded(
    108     int   handle,
    109     void  *val
    110   ) ;
    111 int
    112   get_cli_file_name(
    113     int   handle,
    114     void  *val
    115   ) ;
    116 int
    117   get_cli_file_mem_base(
    118     int   handle,
    119     void  *val
    120   ) ;
    121 int
    122   get_cli_file_size(
    123     int   handle,
    124     void  *val
    125   ) ;
    126 int
    127   get_cli_file_info(
    128     int   handle,
    129     char  *description
    130   ) ;
    131 int
    132   get_cli_file_system_info(
    133     char  *description
    134   ) ;
    135 int
    136   get_first_free_cli_file_handle(
    137     int *handle
    138   ) ;
    139 int
    140   get_cli_file_name_handle(
    141     const char *file_name,
    142           char *err_msg,
    143           int  *handle
    144   ) ;
    145 
    146 int
    147   download_cli_file(
    148     const char *file_name,
    149           char *err_msg,
    150   const unsigned long host_ip
    151   );
    152 int
    153   load_cli_file_from_memory(
    154     char *file_name,
    155     char *inp_mem_base,
    156     int   inp_mem_size,
    157     char *err_msg
    158   );
    159 int
    160   erase_cli_file(
    161     const char *file_name,
    162           char *err_msg
    163   );
    164 
    165 int
    166   start_cli_file_running(
    167     int  handle,
    168     char *err_msg
    169   );
    170 
    171 /* } */
    172 #endif
    173