Dallas Semiconductor DS80C400 C Libraries Home Page

Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

rom400_init.h File Reference


Detailed Description

ROM Initialization functions in the DS80C400 ROM.

This library contains functions for initializing the functionality in the ROM. Note that the preferred way of initializing the ROM is to simply call the init_rom function. However, you can also initialize the various modules individually. To do this, call these functions in this order:

  1. init_clearXSEG
  2. init_copyivt
  3. init_redirect
  4. init_sched
  5. init_mm
  6. init_km
  7. init_ow
  8. init_network
  9. init_eth
  10. init_sockets
  11. init_tick
  12. task_genesis [in the process scheduler library]
  13. init_enableinterrupts

For detailed information on the DS80C400 please see the High-Speed Microcontroller User's Guide: DS80C400 Supplement.

Functions in this library should only be called once on startup. The safety of calling these functions from multiple processes at the same time is irrelevant.

Go to the source code of this file.

Defines

#define ROM400_INIT_VERSION   19
#define USE_KEIL_MONITOR
#define INIT_DIVISOR_3MHZ   0x01
#define INIT_DIVISOR_4MHZ   0x08
#define INIT_DIVISOR_5MHZ   0x02
#define INIT_DIVISOR_6MHZ   0x05
#define INIT_DIVISOR_7MHZ   0x03
#define INIT_DIVISOR_8MHZ   0x0C
#define INIT_DIVISOR_10MHZ   0x06
#define INIT_DIVISOR_12MHZ   0x09
#define INIT_DIVISOR_14MHZ   0x07
#define INIT_DIVISOR_16MHZ   0x10
#define INIT_DIVISOR_20MHZ   0x0A
#define INIT_DIVISOR_24MHZ   0x0D
#define INIT_DIVISOR_28MHZ   0x0B
#define INIT_DIVISOR_32MHZ   0x14
#define INIT_DIVISOR_40MHZ   0x0E
#define INIT_DIVISOR_48MHZ   0x11
#define INIT_DIVISOR_56MHZ   0x0F
#define INIT_DIVISOR_64MHZ   0x18
#define INIT_DIVISOR_80MHZ   0x12
#define INIT_DIVISOR_96MHZ   0x15
#define INIT_DIVISOR_112MHZ   0x13
#define INIT_DIVISOR_128MHZ   0x1C
#define INIT_POWERFAIL_RESET   0x08
#define INIT_WATCHDOG_RESET   0x10
#define INIT_CRYSTALFAIL_RESET   0x20
#define DEFAULT_HEAP_START   ((((long)&HEAP_START)&0x7fffffL)-0x10000L)
#define init_setfrequency(clock)   init_setclock(((clock)*5L)/60)
 Sets the crystal frequency.

Functions

void HEAP_START (void)
void init_rom (unsigned long mem_start_address, unsigned long mem_end_address)
 Initializes the modules in the ROM.
void init_netboot (void)
 Starts the netboot functionality. Note that this will negate any initialization that has already been performed.
void init_copyivt (void)
 Copies the interrupt vector table into memory.
void init_redirect (void)
 Sets up the redirect table for ROM redirected calls.
void init_sched (void)
 Sets up the default task scheduler.
void init_clearXSEG (void)
 Clears system variables in external RAM.
void init_mm (unsigned long mem_start_address, unsigned long mem_end_address)
 Initializes the heap.
void init_km (void)
 Initializes fast kernel memory.
void init_ow (unsigned char DIVISOR)
 Initializes the internal 1-Wire.
void init_network (void)
 Initializes the network.
void init_eth (void)
 Initializes the ethernet support.
void init_sockets (void)
 Initializest the socket layer.
void init_tick (void)
 Initializes the system timer.
void init_enableinterrupts (void)
 Enables system interrupts.
void init_usekeilmonitor (void)
 Performs initialization necessary for using the Keil Monitor.
unsigned int init_version (void)
 Returns the version number of this initialization library.
unsigned char init_getbootstate (void)
 Returns the boot status flags.
void init_setclock (unsigned int value)
 Sets the crystal frequency.


Define Documentation

#define DEFAULT_HEAP_START   ((((long)&HEAP_START)&0x7fffffL)-0x10000L)
 

Defines the default start address for the heap.

See also:
init_rom

#define INIT_CRYSTALFAIL_RESET   0x20
 

Crystal failure reset status.

See also:
init_getbootstate

#define INIT_DIVISOR_10MHZ   0x06
 

1-Wire divisor value for operating frequencies greater than 10 MHz but less than 12 MHz.

See also:
init_ow

#define INIT_DIVISOR_112MHZ   0x13
 

1-Wire divisor value for operating frequencies greater than 112 MHz but less than 128 MHz.

See also:
init_ow

#define INIT_DIVISOR_128MHZ   0x1C
 

1-Wire divisor value for operating frequencies greater than 128 MHz.

See also:
init_ow

#define INIT_DIVISOR_12MHZ   0x09
 

1-Wire divisor value for operating frequencies greater than 12 MHz but less than 14 MHz.

See also:
init_ow

#define INIT_DIVISOR_14MHZ   0x07
 

1-Wire divisor value for operating frequencies greater than 14 MHz but less than 16 MHz.

See also:
init_ow

#define INIT_DIVISOR_16MHZ   0x10
 

1-Wire divisor value for operating frequencies greater than 16 MHz but less than 20 MHz.

See also:
init_ow

#define INIT_DIVISOR_20MHZ   0x0A
 

1-Wire divisor value for operating frequencies greater than 20 MHz but less than 24 MHz.

See also:
init_ow

#define INIT_DIVISOR_24MHZ   0x0D
 

1-Wire divisor value for operating frequencies greater than 24 MHz but less than 28 MHz.

See also:
init_ow

#define INIT_DIVISOR_28MHZ   0x0B
 

1-Wire divisor value for operating frequencies greater than 28 MHz but less than 32 MHz.

See also:
init_ow

#define INIT_DIVISOR_32MHZ   0x14
 

1-Wire divisor value for operating frequencies greater than 32 MHz but less than 40 MHz.

See also:
init_ow

#define INIT_DIVISOR_3MHZ   0x01
 

1-Wire divisor value for operating frequencies greater than 3 MHz but less than 4 MHz.

See also:
init_ow

#define INIT_DIVISOR_40MHZ   0x0E
 

1-Wire divisor value for operating frequencies greater than 40 MHz but less than 48 MHz.

See also:
init_ow

#define INIT_DIVISOR_48MHZ   0x11
 

1-Wire divisor value for operating frequencies greater than 48 MHz but less than 56 MHz.

See also:
init_ow

#define INIT_DIVISOR_4MHZ   0x08
 

1-Wire divisor value for operating frequencies greater than 4 MHz but less than 5 MHz.

See also:
init_ow

#define INIT_DIVISOR_56MHZ   0x0F
 

1-Wire divisor value for operating frequencies greater than 56 MHz but less than 64 MHz.

See also:
init_ow

#define INIT_DIVISOR_5MHZ   0x02
 

1-Wire divisor value for operating frequencies greater than 5 MHz but less than 6 MHz.

See also:
init_ow

#define INIT_DIVISOR_64MHZ   0x18
 

1-Wire divisor value for operating frequencies greater than 64 MHz but less than 80 MHz.

See also:
init_ow

#define INIT_DIVISOR_6MHZ   0x05
 

1-Wire divisor value for operating frequencies greater than 6 MHz but less than 7 MHz.

See also:
init_ow

#define INIT_DIVISOR_7MHZ   0x03
 

1-Wire divisor value for operating frequencies greater than 7 MHz but less than 8 MHz.

See also:
init_ow

#define INIT_DIVISOR_80MHZ   0x12
 

1-Wire divisor value for operating frequencies greater than 80 MHz but less than 96 MHz.

See also:
init_ow

#define INIT_DIVISOR_8MHZ   0x0C
 

1-Wire divisor value for operating frequencies greater than 8 MHz but less than 10 MHz.

See also:
init_ow

#define INIT_DIVISOR_96MHZ   0x15
 

1-Wire divisor value for operating frequencies greater than 96 MHz but less than 112 MHz.

See also:
init_ow

#define INIT_POWERFAIL_RESET   0x08
 

Power fail reset status.

See also:
init_getbootstate

#define init_setfrequency clock   )     init_setclock(((clock)*5L)/60)
 

Sets the crystal frequency.

Parameters:
clock Clock frequency in kHz (e.g. 14746 for a 14.7456 MHz crystal). The operating frequency is the oscillator adjusted by any setting of the frequency multiplier (i.e. a 14 MHz oscillator with the clock doubler enabled should set 28 MHz)
Note that this macro has to be called before init_rom.

See also:
task_settickreload

init_rom

init_setclock

#define INIT_WATCHDOG_RESET   0x10
 

Watchdog reset status.

See also:
init_getbootstate

#define ROM400_INIT_VERSION   19
 

Version number associated with this header file. Should be the same as the version number returned by the init_version function.

See also:
init_version

#define USE_KEIL_MONITOR
 

Macro that allows the use of a define to determine whether or not to call the function init_usekeilmonitor. This macro can be called after calling init_rom, and will correct some monitor configuration details that are destroyed when init_rom is called.

See also:
init_rom

init_usekeilmonitor


Function Documentation

void HEAP_START void   ) 
 

Used to calculate the default start address for the heap.

See also:
init_rom

void init_clearXSEG void   ) 
 

Clears system variables in external RAM.

Note that calling init_rom is the preferred way of initializing the ROM.

This function also sets the EPFI bit.

See also:
init_rom

void init_copyivt void   ) 
 

Copies the interrupt vector table into memory.

Note that calling init_rom is the preferred way of initializing the ROM.

See also:
init_rom

void init_enableinterrupts void   ) 
 

Enables system interrupts.

Note that calling init_rom is the preferred way of initializing the ROM.

See also:
init_rom

void init_eth void   ) 
 

Initializes the ethernet support.

Note that calling init_rom is the preferred way of initializing the ROM.

See also:
init_rom

unsigned char init_getbootstate void   ) 
 

Returns the boot status flags.

The status flags are defined as follows: Status.3 (0x08) - Power Fail Reset INIT_POWERFAIL_RESET Status.4 (0x10) - Watchdog Reset INIT_WATCHDOG_RESET Status.5 (0x20) - Crystal Oscillator Failure Reset INIT_CRYSTALFAIL_RESET All other bits are reserved, but not necessarily 0.

Returns:
Status flags
See also:
INIT_POWERFAIL_RESET

INIT_WATCHDOG_RESET

INIT_CRYSTALFAIL_RESET

void init_km void   ) 
 

Initializes fast kernel memory.

Note that calling init_rom is the preferred way of initializing the ROM.

See also:
init_rom

void init_mm unsigned long  mem_start_address,
unsigned long  mem_end_address
 

Initializes the heap.

Note that calling init_rom is the preferred way of initializing the ROM.

Parameters:
mem_start_address The absolute beginning address for the heap (see init_rom for a detailed discussion of the input parameters). Unlike the init_rom function, this function cannot accept 0 for default parameters. The start address must be specified. Use DEFAULT_HEAP_START to specify the default start address.
mem_end_address The absolute ending address for the heap (see init_rom for a detailed discussion of the input parameters). Unlike the init_rom function, this function cannot accept 0 for default parameters. The end address must be specified.
See also:
init_rom

DEFAULT_HEAP_START

void init_netboot void   ) 
 

Starts the netboot functionality. Note that this will negate any initialization that has already been performed.

See also:
init_rom

void init_network void   ) 
 

Initializes the network.

Note that calling init_rom is the preferred way of initializing the ROM.

See also:
init_rom

void init_ow unsigned char  DIVISOR  ) 
 

Initializes the internal 1-Wire.

Note that calling init_rom is the preferred way of initializing the ROM.

Parameters:
DIVISOR Divisor value for given the DS80C400's operating frequency. The operating frequency is the oscillator adjusted by any setting of the frequency multiplier (i.e. a 14 MHz oscillator with the clock doubler enabled should look for a divisor for 28 MHz)
See also:
init_rom

INIT_DIVISOR_3MHZ

INIT_DIVISOR_4MHZ

INIT_DIVISOR_5MHZ

INIT_DIVISOR_6MHZ

INIT_DIVISOR_7MHZ

INIT_DIVISOR_8MHZ

INIT_DIVISOR_10MHZ

INIT_DIVISOR_12MHZ

INIT_DIVISOR_14MHZ

INIT_DIVISOR_16MHZ

INIT_DIVISOR_20MHZ

INIT_DIVISOR_24MHZ

INIT_DIVISOR_28MHZ

INIT_DIVISOR_32MHZ

INIT_DIVISOR_40MHZ

INIT_DIVISOR_48MHZ

INIT_DIVISOR_56MHZ

INIT_DIVISOR_64MHZ

INIT_DIVISOR_80MHZ

INIT_DIVISOR_96MHZ

INIT_DIVISOR_112MHZ

INIT_DIVISOR_128MHZ

void init_redirect void   ) 
 

Sets up the redirect table for ROM redirected calls.

Note that calling init_rom is the preferred way of initializing the ROM.

See also:
init_rom

void init_rom unsigned long  mem_start_address,
unsigned long  mem_end_address
 

Initializes the modules in the ROM.

Initializes the network stack, memory manager, process scheduler, and other modules in the DS80C400 Silicon Software. Calling this method is the preferred way of initializing the ROM.

Note that calling this function will cause the ROM to copy its own interrupt table into memory. If you have any interrupts installed before calling this function (for instance, you use the Keil compilers interrupt keyword to declare your function an interrupt handler), the entry in the interrupt table will be erased.

init_rom prints status information to the serial port if serial 0 is set to use timer 2. If that is not desired, clear tr2. ... TR2 = 0; init_rom(...); TR2 = 1; ...

init_rom will probe all available 1-Wire devices for an approximate clock frequency and it will try to find a DS2502-E48 for an Ethernet MAC address. If no DS2502-E48 is present, you must use init_setfrequency to specify a clock frequency, and you must modify startup.a51 to manually set a MAC address.

Parameters:
mem_start_address The absolute beginning address for the heap.
mem_end_address The absolute ending address for the heap.
Use mem_start_address==0 to use the default settings for both start and end, or pass a value to mem_start_address and use mem_end_address==0 to use the remaining memory in the same bank, or use valid values for both addresses. Make sure the heap does not conflict with the XDATA segment (adjustable in project settings); you can examine the MAP file to determine the size of XDATA. Also note that the reentrant stack starts at the top of the XDATA segment (start address adjustable in startup400.a51).

Start address examples...

mem_start_address mem_end_address actual start actual end size of heap
0x000000 0x000000 0x002900 0x00FFFF 55040
DEFAULT_HEAP_START 0x07FFFF 0x002900 0x07FFFF 513792
0x010440 0x000000 0x010440 0x01FFFF 64448
0x010440 0x07FFFF 0x010440 0x07FFFF 457663

See also:
DEFAULT_HEAP_START

void init_sched void   ) 
 

Sets up the default task scheduler.

Note that calling init_rom is the preferred way of initializing the ROM.

See also:
init_rom

void init_setclock unsigned int  value  ) 
 

Sets the crystal frequency.

Parameters:
value Clock frequency in kHz * 5/60 (e.g. 1229 for a 14.7456 MHz crystal). The operating frequency is the oscillator adjusted by any setting of the frequency multiplier (i.e. a 14 MHz oscillator with the clock doubler enabled should set 28 MHz)
Note that this function has to be called before init_rom. Users should call the more friendly macro init_setfrequency.

See also:
task_settickreload

init_rom

init_setfrequency

void init_sockets void   ) 
 

Initializest the socket layer.

Note that calling init_rom is the preferred way of initializing the ROM.

See also:
init_rom

void init_tick void   ) 
 

Initializes the system timer.

Note that calling init_rom is the preferred way of initializing the ROM.

See also:
init_rom

void init_usekeilmonitor void   ) 
 

Performs initialization necessary for using the Keil Monitor.

Performs initialization needed when using the Keil MON390 Monitor to debug programs that access the DS80C400's ROM. This function should be called after calling init_rom, and only if the monitor will be used.

This file includes a macro USE_KEIL_MONITOR which is defined to call this function if MONITOR is defined. Use the following code to make use of this macro:

        init_rom();
         USE_KEIL_MONITOR
 

See also:
init_rom

USE_KEIL_MONITOR

unsigned int init_version void   ) 
 

Returns the version number of this initialization library.

Returns:
Version number of this INIT library.


Copyright 2005 Dallas Semiconductor, Inc.. Documentation generated by Doxygen.