PERFORCE change 95443 for review
Warner Losh
imp at FreeBSD.org
Mon Apr 17 20:48:41 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=95443
Change 95443 by imp at imp_hammer on 2006/04/17 20:48:25
Kill ^M
Affected files ...
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/Makefile#3 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/README#2 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/arm_init.s#3 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/debug_io.c#4 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/debug_io.h#2 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/eeprom.c#4 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/eeprom.h#2 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/emac.c#4 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/emac.h#2 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/env_vars.c#3 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/env_vars.h#2 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/linker.cfg#2 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/loader_prompt.c#3 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/loader_prompt.h#3 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/main.c#3 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/p_string.c#2 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/p_string.h#2 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/tag_list.c#2 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/tag_list.h#2 edit
Differences ...
==== //depot/projects/arm/src/sys/boot/arm/at91/bootiic/Makefile#3 (text+ko) ====
@@ -7,7 +7,7 @@
env_vars.c debug_io.c loader_prompt.c p_string.c emac.c
NO_MAN=
LDFLAGS=-e 0 -T linker.cfg
-CFLAGS=-O2 -mcpu=arm9 -ffreestanding -I${.CURDIR}/../inc -I${.CURDIR}/../boot0
+CFLAGS=-O2 -mcpu=arm9 -ffreestanding -I${.CURDIR}/../libat91 -I${.CURDIR}/../boot0
CFLAGS+=-DBOOT0_KB9202
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
CLEANFILES=${OBJS} ${PROG} ${PROG}.out
==== //depot/projects/arm/src/sys/boot/arm/at91/bootiic/README#2 (text+ko) ====
@@ -1,59 +1,59 @@
-This image is intended to be programmed into boot EEPROM. The image is nearly
-0x4000 so it will not fit in KB9200's 0x2000. It is intended for KB9201 or
-later. Alternatively, the KB9200 can be upgraded with larger EEPROM.
-It performs basic functions prior to executing an image at a
-specified address. The pre-boot functions can be modified and saved back into
-EEPROM.
-The MAC address is set with 0.0.0.0.0.0 by default. This is an invalid address
-and must be changed to a valid value in order to use the ethernet interface.
-
-Memory usage:
-
-EEPROM = 0x4000
-SDRAM =
- run stack = 0x21800000
- variables = 0x21200000
- ethernet = 0x21000000 (buffers and descriptors)
-
-
-Functions supported:
-
- c - copy
- d - display auto command table (in RAM)
- e - execute image
- ? - help
- ip - set local ip
- m - set mac
- server_ip - set server ip
- s - set auto command entry
- t - create linux boot tag list
- tftp - download image via tftp
- w - update auto command table
- x - download image via xmodem
-
-base files in this directory:
-
-arm_init.s
-AT91RM9200.h
-at91rm9200_lowlevel.c
-at91rm9200_lowlevel.h
-debug_io.c
-debug_io.h
-eeprom.c
-eeprom.h
-emac.c
-emac.h
-env_vars.c
-env_vars.h
-linker.cfg
-loader_prompt.c
-loader_prompt.h
-main.c
-Makefile
-p_string.c
-p_string.h
-tag_list.c
-tag_list.h
-xmodem.c
-xmodem.h
-README
+This image is intended to be programmed into boot EEPROM. The image is nearly
+0x4000 so it will not fit in KB9200's 0x2000. It is intended for KB9201 or
+later. Alternatively, the KB9200 can be upgraded with larger EEPROM.
+It performs basic functions prior to executing an image at a
+specified address. The pre-boot functions can be modified and saved back into
+EEPROM.
+The MAC address is set with 0.0.0.0.0.0 by default. This is an invalid address
+and must be changed to a valid value in order to use the ethernet interface.
+
+Memory usage:
+
+EEPROM = 0x4000
+SDRAM =
+ run stack = 0x21800000
+ variables = 0x21200000
+ ethernet = 0x21000000 (buffers and descriptors)
+
+
+Functions supported:
+
+ c - copy
+ d - display auto command table (in RAM)
+ e - execute image
+ ? - help
+ ip - set local ip
+ m - set mac
+ server_ip - set server ip
+ s - set auto command entry
+ t - create linux boot tag list
+ tftp - download image via tftp
+ w - update auto command table
+ x - download image via xmodem
+
+base files in this directory:
+
+arm_init.s
+AT91RM9200.h
+at91rm9200_lowlevel.c
+at91rm9200_lowlevel.h
+debug_io.c
+debug_io.h
+eeprom.c
+eeprom.h
+emac.c
+emac.h
+env_vars.c
+env_vars.h
+linker.cfg
+loader_prompt.c
+loader_prompt.h
+main.c
+Makefile
+p_string.c
+p_string.h
+tag_list.c
+tag_list.h
+xmodem.c
+xmodem.h
+README
==== //depot/projects/arm/src/sys/boot/arm/at91/bootiic/arm_init.s#3 (text+ko) ====
@@ -1,120 +1,120 @@
-/*******************************************************************************
- *
- * Filename: arm_init.s
- *
- * Initialization for C-environment and basic operation. Adapted from
- * ATMEL cstartup.s.
- *
- * Revision information:
- *
- * 20AUG2004 kb_admin initial creation
- * 12JAN2005 kb_admin updated for 16KB eeprom
- * Atmel stack prevents loading full size at once
- *
- * BEGIN_KBDD_BLOCK
- * No warranty, expressed or implied, is included with this software. It is
- * provided "AS IS" and no warranty of any kind including statutory or aspects
- * relating to merchantability or fitness for any purpose is provided. All
- * intellectual property rights of others is maintained with the respective
- * owners. This software is not copyrighted and is intended for reference
- * only.
- * END_BLOCK
- ******************************************************************************/
-
- .equ TWI_EEPROM_SIZE, 0x2000
- .equ ARM_MODE_USER, 0x10
- .equ ARM_MODE_FIQ, 0x11
- .equ ARM_MODE_IRQ, 0x12
- .equ ARM_MODE_SVC, 0x13
- .equ ARM_MODE_ABORT, 0x17
- .equ ARM_MODE_UNDEF, 0x1B
- .equ ARM_MODE_SYS, 0x1F
-
- .equ I_BIT, 0x80
- .equ F_BIT, 0x40
- .equ T_BIT, 0x20
-
-/*
- * Stack definitions
- *
- * Start near top of internal RAM.
- */
-
- .equ END_INT_SRAM, 0x4000
- .equ SVC_STACK_START, (END_INT_SRAM - 0x4)
- .equ SVC_STACK_USE, 0x21800000
-
-start:
-
-/* vectors - must reside at address 0 */
-/* the format of this table is defined in the datasheet */
- B InitReset @; reset
-undefvec:
- B undefvec @; Undefined Instruction
-swivec:
- B swivec @; Software Interrupt
-pabtvec:
- B pabtvec @; Prefetch Abort
-dabtvec:
- B dabtvec @; Data Abort
-rsvdvec:
- .long (TWI_EEPROM_SIZE >> 9)
-irqvec:
- ldr pc, [pc,#-0xF20] @; IRQ : read the AIC
-fiqvec:
- B fiqvec @; FIQ
-
-
-InitReset:
-
-/* Set stack and init for SVC */
- ldr r1, = SVC_STACK_START
- mov sp, r1 @; Init stack SYS
-
- msr cpsr_c, #(ARM_MODE_SVC | I_BIT | F_BIT)
- mov sp, r1 @ ; Init stack SYS
-
-/* Perform system initialization */
-
- .extern _init
-
- bl _init
-
- ldr r1, = SVC_STACK_USE
- mov sp, r1 @ ; Move the stack to SDRAM
-
-/* Copy the rest of the load image from EEPROM */
- .extern InitEEPROM
-
- bl InitEEPROM
-
- .extern ReadEEPROM
-
- mov r0, #8192
- mov r1, #8192
- mov r2, #8192
- bl ReadEEPROM
-
-/* Start execution at main */
-
- .extern main
-_main:
-__main:
- bl main
-
-/* main should not return. If it does, spin forever */
-
-infiniteLoop:
- b infiniteLoop
-
-/* the following section is used to store boot commands in */
-/* non-volatile memory. */
-
- .global BootCommandSection
-BootCommandSection:
- .string "Bootloader for KB9202 Evaluation Board."
- .string "c 0x20210000 0x10100000 0x80000 "
- .string "m 0 0 0 0 0 0 "
- .string "t 0x20000100 console=ttyS0,115200 root=/dev/ram rw initrd=0x20210000,654933"
- .string "e 0x10000000 "
- .string " "
+/*******************************************************************************
+ *
+ * Filename: arm_init.s
+ *
+ * Initialization for C-environment and basic operation. Adapted from
+ * ATMEL cstartup.s.
+ *
+ * Revision information:
+ *
+ * 20AUG2004 kb_admin initial creation
+ * 12JAN2005 kb_admin updated for 16KB eeprom
+ * Atmel stack prevents loading full size at once
+ *
+ * BEGIN_KBDD_BLOCK
+ * No warranty, expressed or implied, is included with this software. It is
+ * provided "AS IS" and no warranty of any kind including statutory or aspects
+ * relating to merchantability or fitness for any purpose is provided. All
+ * intellectual property rights of others is maintained with the respective
+ * owners. This software is not copyrighted and is intended for reference
+ * only.
+ * END_BLOCK
+ ******************************************************************************/
+
+ .equ TWI_EEPROM_SIZE, 0x2000
+ .equ ARM_MODE_USER, 0x10
+ .equ ARM_MODE_FIQ, 0x11
+ .equ ARM_MODE_IRQ, 0x12
+ .equ ARM_MODE_SVC, 0x13
+ .equ ARM_MODE_ABORT, 0x17
+ .equ ARM_MODE_UNDEF, 0x1B
+ .equ ARM_MODE_SYS, 0x1F
+
+ .equ I_BIT, 0x80
+ .equ F_BIT, 0x40
+ .equ T_BIT, 0x20
+
+/*
+ * Stack definitions
+ *
+ * Start near top of internal RAM.
+ */
+
+ .equ END_INT_SRAM, 0x4000
+ .equ SVC_STACK_START, (END_INT_SRAM - 0x4)
+ .equ SVC_STACK_USE, 0x21800000
+
+start:
+
+/* vectors - must reside at address 0 */
+/* the format of this table is defined in the datasheet */
+ B InitReset @; reset
+undefvec:
+ B undefvec @; Undefined Instruction
+swivec:
+ B swivec @; Software Interrupt
+pabtvec:
+ B pabtvec @; Prefetch Abort
+dabtvec:
+ B dabtvec @; Data Abort
+rsvdvec:
+ .long (TWI_EEPROM_SIZE >> 9)
+irqvec:
+ ldr pc, [pc,#-0xF20] @; IRQ : read the AIC
+fiqvec:
+ B fiqvec @; FIQ
+
+
+InitReset:
+
+/* Set stack and init for SVC */
+ ldr r1, = SVC_STACK_START
+ mov sp, r1 @; Init stack SYS
+
+ msr cpsr_c, #(ARM_MODE_SVC | I_BIT | F_BIT)
+ mov sp, r1 @ ; Init stack SYS
+
+/* Perform system initialization */
+
+ .extern _init
+
+ bl _init
+
+ ldr r1, = SVC_STACK_USE
+ mov sp, r1 @ ; Move the stack to SDRAM
+
+/* Copy the rest of the load image from EEPROM */
+ .extern InitEEPROM
+
+ bl InitEEPROM
+
+ .extern ReadEEPROM
+
+ mov r0, #8192
+ mov r1, #8192
+ mov r2, #8192
+ bl ReadEEPROM
+
+/* Start execution at main */
+
+ .extern main
+_main:
+__main:
+ bl main
+
+/* main should not return. If it does, spin forever */
+
+infiniteLoop:
+ b infiniteLoop
+
+/* the following section is used to store boot commands in */
+/* non-volatile memory. */
+
+ .global BootCommandSection
+BootCommandSection:
+ .string "Bootloader for KB9202 Evaluation Board."
+ .string "c 0x20210000 0x10100000 0x80000 "
+ .string "m 0 0 0 0 0 0 "
+ .string "t 0x20000100 console=ttyS0,115200 root=/dev/ram rw initrd=0x20210000,654933"
+ .string "e 0x10000000 "
+ .string " "
==== //depot/projects/arm/src/sys/boot/arm/at91/bootiic/debug_io.c#4 (text+ko) ====
==== //depot/projects/arm/src/sys/boot/arm/at91/bootiic/debug_io.h#2 (text+ko) ====
@@ -1,30 +1,30 @@
-/*******************************************************************************
- *
- * Filename: debug_io.h
- *
- * Definitions for basic debug uart support.
- *
- * Revision information:
- *
- * 20AUG2004 kb_admin initial creation
- *
- * BEGIN_KBDD_BLOCK
- * No warranty, expressed or implied, is included with this software. It is
- * provided "AS IS" and no warranty of any kind including statutory or aspects
- * relating to merchantability or fitness for any purpose is provided. All
- * intellectual property rights of others is maintained with the respective
- * owners. This software is not copyrighted and is intended for reference
- * only.
- * END_BLOCK
- ******************************************************************************/
-
-#ifndef _DEBUG_IO_H_
-#define _DEBUG_IO_H_
-
-extern void DebugPutc(char cValue);
-extern void DebugPrint(char *buffer);
-extern int DebugGetchar(char *retChar);
-extern int WaitForChar(char *cPtr, int seconds);
-extern void DebugPrintHex(int digits, int value);
-
-#endif
+/*******************************************************************************
+ *
+ * Filename: debug_io.h
+ *
+ * Definitions for basic debug uart support.
+ *
+ * Revision information:
+ *
+ * 20AUG2004 kb_admin initial creation
+ *
+ * BEGIN_KBDD_BLOCK
+ * No warranty, expressed or implied, is included with this software. It is
+ * provided "AS IS" and no warranty of any kind including statutory or aspects
+ * relating to merchantability or fitness for any purpose is provided. All
+ * intellectual property rights of others is maintained with the respective
+ * owners. This software is not copyrighted and is intended for reference
+ * only.
+ * END_BLOCK
+ ******************************************************************************/
+
+#ifndef _DEBUG_IO_H_
+#define _DEBUG_IO_H_
+
+extern void DebugPutc(char cValue);
+extern void DebugPrint(char *buffer);
+extern int DebugGetchar(char *retChar);
+extern int WaitForChar(char *cPtr, int seconds);
+extern void DebugPrintHex(int digits, int value);
+
+#endif
==== //depot/projects/arm/src/sys/boot/arm/at91/bootiic/eeprom.c#4 (text+ko) ====
==== //depot/projects/arm/src/sys/boot/arm/at91/bootiic/eeprom.h#2 (text+ko) ====
@@ -1,34 +1,34 @@
-/*******************************************************************************
- *
- * Filename: eeprom.h
- *
- * Definition of eeprom routines
- *
- * Revision information:
- *
- * 28AUG2004 kb_admin initial creation - adapted from Atmel sources
- * 12JAN2005 kb_admin add init
- *
- * BEGIN_KBDD_BLOCK
- * No warranty, expressed or implied, is included with this software. It is
- * provided "AS IS" and no warranty of any kind including statutory or aspects
- * relating to merchantability or fitness for any purpose is provided. All
- * intellectual property rights of others is maintained with the respective
- * owners. This software is not copyrighted and is intended for reference
- * only.
- * END_BLOCK
- ******************************************************************************/
-
-#ifndef _EEPROM_H_
-#define _EEPROM_H_
-
-#define AT91C_TWSI_CLOCK 100000
-#define TWSI_EEPROM_ADDRESS 0x50
-
-/* The following function write eeprom at ee_addr using data */
-/* from data_add for size bytes. */
-extern void ReadEEPROM(unsigned ee_addr, char *data_addr, unsigned size);
-extern void WriteEEPROM(unsigned ee_addr, char *data_addr, unsigned size);
-extern void InitEEPROM(void);
-
-#endif /* _EEPROM_H_ */
+/*******************************************************************************
+ *
+ * Filename: eeprom.h
+ *
+ * Definition of eeprom routines
+ *
+ * Revision information:
+ *
+ * 28AUG2004 kb_admin initial creation - adapted from Atmel sources
+ * 12JAN2005 kb_admin add init
+ *
+ * BEGIN_KBDD_BLOCK
+ * No warranty, expressed or implied, is included with this software. It is
+ * provided "AS IS" and no warranty of any kind including statutory or aspects
+ * relating to merchantability or fitness for any purpose is provided. All
+ * intellectual property rights of others is maintained with the respective
+ * owners. This software is not copyrighted and is intended for reference
+ * only.
+ * END_BLOCK
+ ******************************************************************************/
+
+#ifndef _EEPROM_H_
+#define _EEPROM_H_
+
+#define AT91C_TWSI_CLOCK 100000
+#define TWSI_EEPROM_ADDRESS 0x50
+
+/* The following function write eeprom at ee_addr using data */
+/* from data_add for size bytes. */
+extern void ReadEEPROM(unsigned ee_addr, char *data_addr, unsigned size);
+extern void WriteEEPROM(unsigned ee_addr, char *data_addr, unsigned size);
+extern void InitEEPROM(void);
+
+#endif /* _EEPROM_H_ */
==== //depot/projects/arm/src/sys/boot/arm/at91/bootiic/emac.c#4 (text+ko) ====
==== //depot/projects/arm/src/sys/boot/arm/at91/bootiic/emac.h#2 (text+ko) ====
@@ -1,128 +1,128 @@
-/*******************************************************************************
- *
- * Filename: emac.h
- *
- * Definition of routine to set the MAC address.
- *
- * Revision information:
- *
- * 28AUG2004 kb_admin initial creation
- *
- * BEGIN_KBDD_BLOCK
- * No warranty, expressed or implied, is included with this software. It is
- * provided "AS IS" and no warranty of any kind including statutory or aspects
- * relating to merchantability or fitness for any purpose is provided. All
- * intellectual property rights of others is maintained with the respective
- * owners. This software is not copyrighted and is intended for reference
- * only.
- * END_BLOCK
- ******************************************************************************/
-
-
-#ifndef _EMAC_H_
-#define _EMAC_H_
-
-extern void SetMACAddress(unsigned low_address, unsigned high_address);
-extern void SetServerIPAddress(unsigned address);
-extern void SetLocalIPAddress(unsigned address);
-extern void EMAC_Init(void);
-extern void TFTP_Download(unsigned address, char *filename);
-
-#define MAX_RX_PACKETS 8
-#define RX_PACKET_SIZE 1536
-#define RX_BUFFER_START 0x21000000
-#define RX_DATA_START (RX_BUFFER_START + (8 * MAX_RX_PACKETS))
-
-#define ARP_REQUEST 0x0001
-#define ARP_REPLY 0x0002
-#define PROTOCOL_ARP 0x0806
-#define PROTOCOL_IP 0x0800
-#define PROTOCOL_UDP 0x11
-
-#define SWAP16(x) (((x & 0xff) << 8) | (x >> 8))
-
-typedef struct {
- unsigned address;
- unsigned size;
-} receive_descriptor_t;
-
-typedef struct {
-
- unsigned char dest_mac[6];
-
- unsigned char src_mac[6];
-
- unsigned short frame_type;
- unsigned short hard_type;
- unsigned short prot_type;
- unsigned char hard_size;
- unsigned char prot_size;
-
- unsigned short operation;
-
- unsigned char sender_mac[6];
- unsigned char sender_ip[4];
-
- unsigned char target_mac[6];
- unsigned char target_ip[4];
-
-} arp_header_t;
-
-typedef struct {
- unsigned char ip_v_hl;
- unsigned char ip_tos;
- unsigned short ip_len;
- unsigned short ip_id;
- unsigned short ip_off;
- unsigned char ip_ttl;
- unsigned char ip_p;
- unsigned short ip_sum;
- unsigned char ip_src[4];
- unsigned char ip_dst[4];
-} ip_header_t;
-
-typedef struct {
- unsigned char dest_mac[6];
- unsigned char src_mac[6];
- unsigned char ip_tos;
- unsigned char ip_hl_v;
- unsigned short packet_length;
- unsigned short ip_id;
- unsigned short ip_len;
- unsigned char ip_p;
- unsigned char ip_ttl;
- unsigned short ip_off;
- unsigned short ip_sum;
- unsigned char ip_src[4];
- unsigned char ip_dst[4];
-} transmit_header_t;
-
-typedef struct {
- unsigned short src_port;
- unsigned short dst_port;
- unsigned short udp_len;
- unsigned short udp_cksum;
-} udp_header_t;
-
-typedef struct {
- unsigned short opcode;
- unsigned short block_num;
- unsigned char data[512];
-} tftp_header_t;
-
-#define TFTP_RRQ_OPCODE 1
-#define TFTP_WRQ_OPCODE 2
-#define TFTP_DATA_OPCODE 3
-#define TFTP_ACK_OPCODE 4
-#define TFTP_ERROR_OPCODE 5
-
-#define TFTP_WAITING_SERVER_MAC 1
-#define TFTP_SEND_REQUEST 2
-#define TFTP_GET_DATA 3
-#define TFTP_COMPLETE 4
-
-/* MII registers definition */
-#define MII_STS_REG 0x01
-#define MII_STS2_REG 0x11
-
-#endif /* _EMAC_H_ */
+/*******************************************************************************
+ *
+ * Filename: emac.h
+ *
+ * Definition of routine to set the MAC address.
+ *
+ * Revision information:
+ *
+ * 28AUG2004 kb_admin initial creation
+ *
+ * BEGIN_KBDD_BLOCK
+ * No warranty, expressed or implied, is included with this software. It is
+ * provided "AS IS" and no warranty of any kind including statutory or aspects
+ * relating to merchantability or fitness for any purpose is provided. All
+ * intellectual property rights of others is maintained with the respective
+ * owners. This software is not copyrighted and is intended for reference
+ * only.
+ * END_BLOCK
+ ******************************************************************************/
+
+
+#ifndef _EMAC_H_
+#define _EMAC_H_
+
+extern void SetMACAddress(unsigned low_address, unsigned high_address);
+extern void SetServerIPAddress(unsigned address);
+extern void SetLocalIPAddress(unsigned address);
+extern void EMAC_Init(void);
+extern void TFTP_Download(unsigned address, char *filename);
+
+#define MAX_RX_PACKETS 8
+#define RX_PACKET_SIZE 1536
+#define RX_BUFFER_START 0x21000000
+#define RX_DATA_START (RX_BUFFER_START + (8 * MAX_RX_PACKETS))
+
+#define ARP_REQUEST 0x0001
+#define ARP_REPLY 0x0002
+#define PROTOCOL_ARP 0x0806
+#define PROTOCOL_IP 0x0800
+#define PROTOCOL_UDP 0x11
+
+#define SWAP16(x) (((x & 0xff) << 8) | (x >> 8))
+
+typedef struct {
+ unsigned address;
+ unsigned size;
+} receive_descriptor_t;
+
+typedef struct {
+
+ unsigned char dest_mac[6];
+
+ unsigned char src_mac[6];
+
+ unsigned short frame_type;
+ unsigned short hard_type;
+ unsigned short prot_type;
+ unsigned char hard_size;
+ unsigned char prot_size;
+
+ unsigned short operation;
+
+ unsigned char sender_mac[6];
+ unsigned char sender_ip[4];
+
+ unsigned char target_mac[6];
+ unsigned char target_ip[4];
+
+} arp_header_t;
+
+typedef struct {
+ unsigned char ip_v_hl;
+ unsigned char ip_tos;
+ unsigned short ip_len;
+ unsigned short ip_id;
+ unsigned short ip_off;
+ unsigned char ip_ttl;
+ unsigned char ip_p;
+ unsigned short ip_sum;
+ unsigned char ip_src[4];
+ unsigned char ip_dst[4];
+} ip_header_t;
+
+typedef struct {
+ unsigned char dest_mac[6];
+ unsigned char src_mac[6];
+ unsigned char ip_tos;
+ unsigned char ip_hl_v;
+ unsigned short packet_length;
+ unsigned short ip_id;
+ unsigned short ip_len;
+ unsigned char ip_p;
+ unsigned char ip_ttl;
+ unsigned short ip_off;
+ unsigned short ip_sum;
+ unsigned char ip_src[4];
+ unsigned char ip_dst[4];
+} transmit_header_t;
+
+typedef struct {
+ unsigned short src_port;
+ unsigned short dst_port;
+ unsigned short udp_len;
+ unsigned short udp_cksum;
+} udp_header_t;
+
+typedef struct {
+ unsigned short opcode;
+ unsigned short block_num;
+ unsigned char data[512];
+} tftp_header_t;
+
+#define TFTP_RRQ_OPCODE 1
+#define TFTP_WRQ_OPCODE 2
+#define TFTP_DATA_OPCODE 3
+#define TFTP_ACK_OPCODE 4
+#define TFTP_ERROR_OPCODE 5
+
+#define TFTP_WAITING_SERVER_MAC 1
+#define TFTP_SEND_REQUEST 2
+#define TFTP_GET_DATA 3
+#define TFTP_COMPLETE 4
+
+/* MII registers definition */
+#define MII_STS_REG 0x01
+#define MII_STS2_REG 0x11
+
+#endif /* _EMAC_H_ */
==== //depot/projects/arm/src/sys/boot/arm/at91/bootiic/env_vars.c#3 (text+ko) ====
@@ -1,200 +1,200 @@
-/*******************************************************************************
- *
- * Filename: env_vars.c
- *
- * Instantiation of environment variables, structures, and other globals.
- *
- * Revision information:
- *
- * 20AUG2004 kb_admin initial creation
- *
- * BEGIN_KBDD_BLOCK
- * No warranty, expressed or implied, is included with this software. It is
- * provided "AS IS" and no warranty of any kind including statutory or aspects
- * relating to merchantability or fitness for any purpose is provided. All
- * intellectual property rights of others is maintained with the respective
- * owners. This software is not copyrighted and is intended for reference
- * only.
- * END_BLOCK
- ******************************************************************************/
-
-#include "env_vars.h"
-#include "loader_prompt.h"
-#include "p_string.h"
-#include "debug_io.h"
-#include "eeprom.h"
-#include "lib.h"
-
-/* ****************************** GLOBALS *************************************/
-char boot_commands[MAX_BOOT_COMMANDS][MAX_INPUT_SIZE];
-
-char env_table[MAX_ENV_SIZE_BYTES];
-
-extern char BootCommandSection;
-
-/* ************************* PRIVATE FUNCTIONS ********************************/
-
-
-static int currentIndex;
-static int currentOffset;
-
-
-/*
- * .KB_C_FN_DEFINITION_START
- * int ReadCharFromEnvironment(char *)
- * This private function reads characters from the enviroment variables
- * to service the command prompt during auto-boot or just to setup the
- * default environment. Returns positive value if valid character was
- * set in the pointer. Returns negative value to signal input stream
- * terminated. Returns 0 to indicate _wait_ condition.
- * .KB_C_FN_DEFINITION_END
- */
-static int ReadCharFromEnvironment(int timeout)
-{
- int ch;
-
- if (currentIndex < MAX_BOOT_COMMANDS) {
- ch = boot_commands[currentIndex][currentOffset++];
- if (ch == '\0' || (currentOffset >= MAX_INPUT_SIZE)) {
- currentOffset = 0;
- ++currentIndex;
- }
- return (ch);
- }
-
- return (-1);
-}
-
-
-/* ************************** GLOBAL FUNCTIONS ********************************/
-
-
-/*
- * .KB_C_FN_DEFINITION_START
- * void WriteCommandTable(void)
- * This global function write the current command table to the non-volatile
- * memory.
- * .KB_C_FN_DEFINITION_END
- */
-void WriteCommandTable(void) {
-
- int i, size = MAX_ENV_SIZE_BYTES, copySize;
- char *cPtr = env_table;
-
- p_memset(env_table, 0, sizeof(env_table));
-
- for (i = 0; i < MAX_BOOT_COMMANDS; ++i) {
-
- copySize = p_strlen(boot_commands[i]);
- size -= copySize + 1;
-
- if (size < 0) {
- continue;
- }
- p_memcpy(cPtr, boot_commands[i], copySize);
- cPtr += copySize;
- *cPtr++ = 0;
- }
-
- WriteEEPROM((unsigned)&BootCommandSection, env_table,
- sizeof(env_table));
-}
-
-
-/*
- * .KB_C_FN_DEFINITION_START
- * void SetBootCommand(int index, char *command)
- * This global function replaces the specified index with the string residing
- * at command. Execute this function with a NULL string to clear the
- * associated command index.
- * .KB_C_FN_DEFINITION_END
- */
-void SetBootCommand(int index, char *command) {
-
- int i;
-
- if ((unsigned)index < MAX_BOOT_COMMANDS) {
-
- p_memset(boot_commands[index], 0, MAX_INPUT_SIZE);
-
- if (!command)
- return ;
-
- for (i = 0; i < MAX_INPUT_SIZE; ++i) {
- boot_commands[index][i] = command[i];
- if (!(boot_commands[index][i]))
- return;
- }
- }
-}
-
-
-/*
- * .KB_C_FN_DEFINITION_START
- * void DumpBootCommands(void)
- * This global function displays the current boot commands.
- * .KB_C_FN_DEFINITION_END
- */
-void DumpBootCommands(void) {
- int i, j;
- char *cPtr;
-
- for (i = 0; i < MAX_BOOT_COMMANDS; ++i) {
- DebugPrintHex(2, i);
- DebugPrint(" : ");
- for (j = 0; j < MAX_INPUT_SIZE; ++j) {
- putc(boot_commands[i][j]);
- if (!(boot_commands[i][j]))
- break;
- }
- DebugPrint("[E]\n\r");
- }
-}
-
-
-/*
- * .KB_C_FN_DEFINITION_START
- * void LoadBootCommands(void)
- * This global function loads the existing boot commands from raw format and
- * coverts it to the standard, command-index format. Notice, the processed
- * boot command table has much more space allocated than the actual table
- * stored in non-volatile memory. This is because the processed table
- * exists in RAM which is larger than the non-volatile space.
- * .KB_C_FN_DEFINITION_END
- */
-void LoadBootCommands(void) {
- int index, j, size;
- char *cPtr;
-
- p_memset((char*)boot_commands, 0, sizeof(boot_commands));
-
- cPtr = &BootCommandSection;
-
- size = MAX_ENV_SIZE_BYTES;
-
- for (index = 0; (index < MAX_BOOT_COMMANDS) && size; ++index) {
- for (j = 0; (j < MAX_INPUT_SIZE) && size; ++j) {
- size--;
- boot_commands[index][j] = *cPtr++;
- if (!(boot_commands[index][j])) {
- break;
- }
- }
- }
-}
-
-
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list