mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-11-14 02:02:39 +08:00
2000-08-11 Charles-Antoine Gauthier <charles.gauthier@nrc.ca>
* README: * console/console.c: * include/bsp.h: * network/network.c: * startup/bspstart.c: Add support for configuration parameters in NVRAM
This commit is contained in:
1 parent
060d5387a4
commit
00ff4cd6ac
6 files changed
+570
-158
No files matched your search
@@ -1,3 +1,12 @@
|
||||
2000-08-11 Charles-Antoine Gauthier <charles.gauthier@nrc.ca>
|
||||
|
||||
* README:
|
||||
* console/console.c:
|
||||
* include/bsp.h:
|
||||
* network/network.c:
|
||||
* startup/bspstart.c:
|
||||
Add support for configuration parameters in NVRAM
|
||||
|
||||
2000-08-11 Charles-Antoine Gauthier <charles.gauthier@nrc.ca>
|
||||
|
||||
* console/console.c: Fix polled input.
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -30,6 +30,30 @@ extern "C" {
|
||||
#include <mpc8xx/mmu.h>
|
||||
#include <mpc8xx/console.h>
|
||||
|
||||
|
||||
/*
|
||||
* Representation of initialization data in NVRAM
|
||||
*/
|
||||
typedef volatile struct nvram_config_ {
|
||||
unsigned char cache_mode; /* 0xFA001000 */
|
||||
unsigned char console_mode; /* 0xFA001001 */
|
||||
unsigned char console_printk_port; /* 0xFA001002 */
|
||||
unsigned char eppcbug_smc1; /* 0xFA001003 */
|
||||
unsigned long ipaddr; /* 0xFA001004 */
|
||||
unsigned long netmask; /* 0xFA001008 */
|
||||
unsigned char enaddr[6]; /* 0xFA00100C */
|
||||
unsigned short processor_id; /* 0xFA001012 */
|
||||
unsigned long rma_start; /* 0xFA001014 */
|
||||
unsigned long vma_start; /* 0xFA001018 */
|
||||
unsigned long ramsize; /* 0xFA00101C */
|
||||
} nvram_config;
|
||||
|
||||
/*
|
||||
* Pointer to the base of User Area NVRAM
|
||||
*/
|
||||
#define nvram ((nvram_config * const) 0xFA001000)
|
||||
|
||||
|
||||
/*
|
||||
* Network driver configuration
|
||||
*/
|
||||
@@ -70,11 +94,6 @@ extern int rtems_enet_driver_attach (struct rtems_bsdnet_ifconfig *config, int a
|
||||
|
||||
#define Lower_tm27_intr()
|
||||
|
||||
/* Constants -- THESE SHOULD BE DEFINED IN THE LINKER SCRIPT */
|
||||
|
||||
#define RAM_START 0
|
||||
#define RAM_END 0x100000
|
||||
|
||||
/* miscellaneous stuff assumed to exist */
|
||||
|
||||
extern rtems_configuration_table BSP_Configuration;
|
||||
|
||||
@@ -52,6 +52,9 @@
|
||||
#define TX_BUF_COUNT 8
|
||||
#define TX_BD_PER_BUF 4
|
||||
|
||||
#define INET_ADDR_MAX_BUF_SIZE (sizeof "255.255.255.255")
|
||||
|
||||
|
||||
/*
|
||||
* RTEMS event used by interrupt handler to signal daemons.
|
||||
* This must *not* be the same event used by the TCP/IP task synchronization.
|
||||
@@ -1537,6 +1540,8 @@ rtems_scc1_driver_attach (struct rtems_bsdnet_ifconfig *config)
|
||||
int mtu;
|
||||
int unitNumber;
|
||||
char *unitName;
|
||||
char *pAddr;
|
||||
unsigned long addr;
|
||||
|
||||
/*
|
||||
* Parse driver name
|
||||
@@ -1561,12 +1566,60 @@ rtems_scc1_driver_attach (struct rtems_bsdnet_ifconfig *config)
|
||||
/*
|
||||
* Process options
|
||||
*/
|
||||
#if NVRAM_CONFIGURE == 1
|
||||
|
||||
/* Configure from NVRAM */
|
||||
if ( (addr = nvram->ipaddr) ) {
|
||||
/* We have a non-zero entry, copy the value */
|
||||
if ( (pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT )) )
|
||||
config->ip_address = (char *)inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 );
|
||||
else
|
||||
rtems_panic("Can't allocate ip_address buffer!\n");
|
||||
}
|
||||
|
||||
if ( (addr = nvram->netmask) ) {
|
||||
/* We have a non-zero entry, copy the value */
|
||||
if ( (pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT )) )
|
||||
config->ip_netmask = (char *)inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 );
|
||||
else
|
||||
rtems_panic("Can't allocate ip_netmask buffer!\n");
|
||||
}
|
||||
|
||||
/* Ethernet address requires special handling -- it must be copied into
|
||||
* the arpcom struct. The following if construct serves only to give the
|
||||
* User Area NVRAM parameter the highest priority.
|
||||
*
|
||||
* If the ethernet address is specified in NVRAM, go ahead and copy it.
|
||||
* (ETHER_ADDR_LEN = 6 bytes).
|
||||
*/
|
||||
if ( nvram->enaddr[0] || nvram->enaddr[1] || nvram->enaddr[2] ) {
|
||||
/* Anything in the first three bytes indicates a non-zero entry, copy value */
|
||||
memcpy ((void *)sc->arpcom.ac_enaddr, &nvram->enaddr, ETHER_ADDR_LEN);
|
||||
}
|
||||
else if ( config->hardware_address ) {
|
||||
/* There is no entry in NVRAM, but there is in the ifconfig struct, so use it. */
|
||||
memcpy ((void *)sc->arpcom.ac_enaddr, config->hardware_address, ETHER_ADDR_LEN);
|
||||
}
|
||||
else {
|
||||
/* There is no ethernet address provided, so it could be read
|
||||
* from the Ethernet protocol block of SCC1 in DPRAM.
|
||||
*/
|
||||
rtems_panic("No Ethernet address specified!\n");
|
||||
}
|
||||
|
||||
#else /* NVRAM_CONFIGURE != 1 */
|
||||
|
||||
if (config->hardware_address) {
|
||||
memcpy (sc->arpcom.ac_enaddr, config->hardware_address, ETHER_ADDR_LEN);
|
||||
}
|
||||
else {
|
||||
/* FIXME to read the enaddr from NVRAM */
|
||||
/* There is no ethernet address provided, so it could be read
|
||||
* from the Ethernet protocol block of SCC1 in DPRAM.
|
||||
*/
|
||||
rtems_panic("No Ethernet address specified!\n");
|
||||
}
|
||||
|
||||
#endif /* NVRAM_CONFIGURE != 1 */
|
||||
|
||||
if (config->mtu)
|
||||
mtu = config->mtu;
|
||||
|
||||
@@ -135,13 +135,19 @@ void bsp_start(void)
|
||||
/*
|
||||
* Enable instruction and data caches. Do not force writethrough mode.
|
||||
*/
|
||||
#ifdef INSTRUCTION_CACHE_ENABLE
|
||||
rtems_cache_enable_instruction();
|
||||
#endif
|
||||
|
||||
#ifdef DATA_CACHE_ENABLE
|
||||
rtems_cache_enable_data();
|
||||
#endif
|
||||
#if NVRAM_CONFIGURE == 1
|
||||
if ( nvram->cache_mode & 0x02 )
|
||||
rtems_cache_enable_instruction();
|
||||
if ( nvram->cache_mode & 0x01 )
|
||||
rtems_cache_enable_data();
|
||||
#else
|
||||
#ifdef INSTRUCTION_CACHE_ENABLE
|
||||
rtems_cache_enable_instruction();
|
||||
#endif
|
||||
#ifdef DATA_CACHE_ENABLE
|
||||
rtems_cache_enable_data();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Allocate the memory for the RTEMS Work Space. This can come from
|
||||
|
||||
Reference in new issue
Block a user