RT-AC56 3.0.0.4.374.37 core
[tomato.git] / release / src-rt-6.x.4708 / cfe / cfe / arch / mips / board / bcm963xx / include / bcm63xx_util.h
blob4257080eba85882534b6b77be25cb795adee60b6
1 /***************************************************************************
2 * Broadcom Corp. Confidential
3 * Copyright 2001, 2002 Broadcom Corp. All Rights Reserved.
5 * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED
6 * SOFTWARE LICENSE AGREEMENT BETWEEN THE USER AND BROADCOM.
7 * YOU HAVE NO RIGHT TO USE OR EXPLOIT THIS MATERIAL EXCEPT
8 * SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
10 ***************************************************************************
11 * File Name : bcm63xx_util.h
13 * Created on : 04/18/2002 seanl
14 ***************************************************************************/
16 #if !defined(_BCM63XX_UTIL_H_)
17 #define _BCM63XX_UTIL_H_
19 #include "lib_types.h"
20 #include "lib_string.h"
21 #include "lib_queue.h"
22 #include "lib_malloc.h"
23 #include "lib_printf.h"
24 #include "cfe_iocb.h"
25 #include "cfe_device.h"
26 #include "cfe_console.h"
27 #include "cfe_devfuncs.h"
28 #include "cfe_timer.h"
29 #include "cfe_ioctl.h"
30 #include "cfe_error.h"
31 #include "env_subr.h"
32 #include "ui_command.h"
33 #include "cfe.h"
34 #include "net_ebuf.h"
35 #include "net_ether.h"
36 #include "net_api.h"
37 #include "cfe_fileops.h"
38 #include "bsp_config.h"
39 #include "cfe_mem.h"
40 #include "cfe_loader.h"
41 #include "addrspace.h"
43 #include "dev_bcm63xx_flash.h"
44 #include "board.h"
45 #include "bcmTag.h"
47 #define ETH_ALEN 6
48 #define OK 0
49 #define ERROR -1
50 #define MAX_PROMPT_LEN 50 // assume no one wants to type more than 50 chars
51 #define MAX_MAC_STR_LEN 19 // mac address string 18+1 in regular format
52 #define PROMPT_DEFINE_LEN 2
53 #define MASK_LEN 8 // vxworks like ffffff00
56 typedef struct
58 char* promptName;
59 char* errorPrompt;
60 char promptDefine[PROMPT_DEFINE_LEN];
61 char parameter[MAX_PROMPT_LEN];
62 int (*func)(char *);
63 } PARAMETER_SETTING, *PPARAMETER_SETTING;
65 #define IP_PROMPT "Invalid ip address. eg. 192.168.1.200[:ffffff00]"
66 #define RUN_FROM_PROMPT "f = jump to flash; h = tftpd from host"
67 #define HOST_FN_PROMPT "eg. vmlinux"
68 #define FLASH_FN_PROMPT "eg. bcm963xx_fs_kernel"
69 #define BOOT_DELAY_PROMPT "range 0-9, 0=forever prompt"
71 // error input prompts
72 #define BOARDID_STR_PROMPT "Invalid board id string size: 1 - 16 bytes"
73 #define MAC_CT_PROMPT "Invalid Mac addresses number: 1 - 32"
74 #define MAC_ADDR_PROMPT "Invalid Mac address format! eg. 12:34:56:ab:cd:ef"
75 #define PSI_SIZE_PROMPT "Invalid PSI size (in KB): 1 - 128"
76 #define MEM_CONFIG_PROMPT "Invalid memory configuration type: 0 - 3"
78 #define DEFAULT_BOOTLINE_6345 "e=192.168.1.1:ffffff00 h=192.168.1.100 g= r=f f=vmlinux i=bcm96345_fs_kernel d=1 "
79 #define DEFAULT_BOOTLINE_635X "e=192.168.1.1:ffffff00 h=192.168.1.100 g= r=f f=vmlinux i=bcm9635x_fs_kernel d=1 "
81 #define DEFAULT_BOARD_IP "192.168.1.1"
82 #define DEFAULT_MASK "255.255.255.0"
83 // bootline definition:
84 // Space is the deliminator of the parameters. Currently supports following parameters:
85 // f=vmlinux (if r=h) i=bcm96345_fs_kernel d=3 (default delay, range 0-9, 0=forever prompt)
87 #define BOOT_IP_LEN 18
88 #define BOOT_FILENAME_LEN 50 // "f=vmlinux"
90 typedef struct
92 char boardIp[BOOT_IP_LEN];
93 char boardMask[BOOT_IP_LEN]; // set for the board only and ignore for the host/gw. fmt :ffffff00
94 char hostIp[BOOT_IP_LEN];
95 char gatewayIp[BOOT_IP_LEN];
96 char runFrom;
97 char hostFileName[BOOT_FILENAME_LEN];
98 char flashFileName[BOOT_FILENAME_LEN];
99 int bootDelay;
100 } BOOT_INFO, *PBOOT_INFO;
102 extern void setDefaultBootline(void);
103 extern void convertBootInfo(void);
104 extern int printSysInfo(void);
105 extern int changeBootLine(void);
106 extern void dumpHex(unsigned char *start, int len);
107 extern BOOT_INFO bootInfo;
108 extern void enet_init(void);
109 extern int flashImage(uint8_t *ptr);
110 extern int writeWholeImage(uint8_t *ptr, int size);
111 extern void bcm63xx_run(void);
113 extern int setBoardParam(void);
114 extern void getBoardParam(void);
115 extern void displayBoardParam(void);
116 extern int parseBoardIdStr(char *);
117 extern int parseMacAddrCount(char *);
118 extern int parseMacAddr(char *);
119 extern int macNumToStr(unsigned char *macAddr, unsigned char *str);
120 extern int processPrompt(PPARAMETER_SETTING promptPtr, int promptCt);
121 extern int parsehwaddr(unsigned char *str,uint8_t *hwaddr);
122 extern int parseBoardIdStr(char *boardIdStr);
123 extern UINT32 getCrc32(byte *pdata, UINT32 size, UINT32 crc);
124 extern int yesno(void);
125 extern void writeNvramData(void);
127 #endif // _BCM63XX_UTIL_H_