##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.11A/W32               20/Jul/2004  18:58:46 #
# Copyright 1999-2004 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  arm                                                  #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  C:\medusa\init.c                                     #
#    Command line    =  -I "C:\Program Files\IAR Systems\Embedded Workbench  #
#                       4.0\ARM\INC\" -lc C:\medusa\Debug\List\ -la          #
#                       C:\medusa\Debug\List\ -o C:\medusa\Debug\Obj\ -s2    #
#                       --no_cse --no_unroll --no_inline --no_code_motion    #
#                       --no_tbaa --no_clustering --no_scheduling --debug    #
#                       --cpu_mode arm --endian little --cpu ARM7TDMI-S      #
#                       --stack_align 4 -e --fpu None                        #
#                       "-D_DLIB_CONFIG_FILE=C:\Program Files\IAR            #
#                       Systems\Embedded Workbench                           #
#                       4.0\ARM\LIB\dl4tpannl8n.h" C:\medusa\init.c          #
#    List file       =  C:\medusa\Debug\List\init.lst                        #
#    Object file     =  C:\medusa\Debug\Obj\init.r79                         #
#                                                                            #
#                                                                            #
##############################################################################

C:\medusa\init.c
      1          #include "archinc.h"
      2          #include "eventq.h"
      3          #include "timer0.h"
      4          #include "pll.h"
      5          #include "board.h"
      6          #include "uart0.h"
      7          #include "spi.h"
      8          #include "i2cmaster.h"
      9          #include "i2cswitch.h"
     10          #include "i2cport.h"
     11          #include "cli.h"
     12          #include "clichar.h"
     13          #include "clivar.h"

  #ifndef __CLIVAR_H__
                     ^
"C:\medusa\clivar.h",1  Warning[Pa050]: non-native end of line sequence
          detected (this diagnostic is only issued once)
     14          #include "sfp.h"
     15          #include "sfpdiag.h"
     16          #include "zarlink.h"
     17          #include "icmp.h"
     18          #include "watchdog.h"
     19          #include "pm.h"
     20          
     21          #include <stdio.h>
     22          
     23          static char buffer[256];
     24          
     25          static char *buildDate = __DATE__;
     26          static char *buildTime = __TIME__;
     27          
     28          static char *appVersion = "0.92";
     29          
     30          #ifdef CONFIG_TOOLCHAIN_ROWLEY
     31          static char *toolchain = "Rowley gcc";
     32          static char *toolVersion = __VERSION__;
     33          #endif
     34          
     35          #ifdef CONFIG_TOOLCHAIN_IAR
     36          static char *toolchain = "IAR ICC";
     37          static char *toolVersion = "4.1.1A";
     38          #endif
     39          
     40          int main(void)
     41          {
     42            volatile int wdogCount;
     43          
     44            // initialize Memory subsystem first (cacheability, flash timing)
     45            MAMCR  = (lpc210x_reg)0x00; // disable MAM, so we can change MAMTIM
     46            MAMTIM = (lpc210x_reg)0x03; // flash access = 3 CPU clock cycles
     47            MAMCR  = (lpc210x_reg)0x01; // partially enable MAM operation (prefetch on)
     48          
     49            // before all else, initialize PLL and VPB peripheral divider
     50            pllInit();
     51          
     52            // run VPB bus at 1/2 processor clock
     53            // pllSetPeriphDivider(2);
     54            pllSetPeriphDivider(1);
     55          
     56            // initialize the VIC
     57            armvicInit();
     58          
     59            // initialize the hardware
     60            boardInit();
     61          
     62            // Initialize periodic timer
     63            timer0Init();
     64          
     65            // initialize the event (work) queue
     66            eventqInit();
     67          
     68            // Initialize the command line interface
     69            cliInit();
     70          
     71            // Initialize on-chip peripherals
     72          
     73            // console UART
     74            uart0Init(38400);
     75          
     76            sprintf(buffer, "\r\nMBARI Medusa v %s (%s %s) %s %s\r\n", 
     77              appVersion, toolchain, toolVersion, buildDate, buildTime);
     78            uart0Puts(buffer);
     79          
     80            // initialize the rest of the CLI
     81            clicharInit();
     82            clivarInit();
     83          
     84          #ifdef CONFIG_INCLUDE_LPC210X_SPI_SLAVE
     85            spiInit(false);
     86          #endif
     87           
     88          #ifdef CONFIG_INCLUDE_LPC210X_I2C
     89            i2cmasterInit(0x10);
     90          #endif
     91          
     92            // lastly enable interrupts
     93            IRQ_ENABLE();
     94          
     95          #ifdef CONFIG_INCLUDE_EEPROM_24LC256
     96            ee24lc256Init((unsigned char)0);
     97          #endif
     98          
     99          #ifdef CONFIG_INCLUDE_I2C_PORT
    100            i2cportInit();
    101          
    102            // configure port 0 as all inputs
    103            i2cportDirConfig(0, ((unsigned short)0xffff));
    104          
    105            // initialize port 1 to all zeroes
    106            i2cportAssign(1, ((unsigned short)0x000f));
    107          
    108            // configure port 1 as all outputs
    109            i2cportDirConfig(1, ((unsigned short)0x0000));
    110          
    111          #endif /* CONFIG_INCLUDE_I2C_PORT */
    112          
    113          #ifdef CONFIG_INCLUDE_I2C_SWITCH
    114            i2cswitchInit(0xe0);
    115          #endif /* CONFIG_INCLUDE_I2C_SWITCH */
    116          
    117          #ifdef CONFIG_INCLUDE_I2C_SFP
    118            sfpInit();
    119          #ifdef CONFIG_INCLUDE_I2C_SFPDIAG
    120            sfpdiagInit();
    121          #endif
    122          #endif
    123          
    124          #ifdef CONFIG_INCLUDE_ZARLINK
    125            zarlinkInit();
    126            zarlinkMiiInit();
    127            zarlinkFrameInit();
    128            zarlinkRmonInit();
    129            zarlinkUtilInit();
    130            zarlinkMirrorInit();
    131            // zarlinkEventInit();
    132            icmpInit();
    133          #endif
    134          
    135          #ifdef CONFIG_INCLUDE_WATCHDOG
    136            wdogCount = 1000000;
    137            watchdogInit();
    138          #endif
    139          
    140          #if (defined(CONFIG_INCLUDE_PM_IDLE) || defined(CONFIG_INCLUDE_PM_SLEEP))
    141            pmInit();
    142          #endif /* (defined(CONFIG_INCLUDE_PM_IDLE) || defined(CONFIG_INCLUDE_PM_SLEEP)) */
    143          
    144          
    145            while(1) {
    146              // Give the event dispatcher a thread of execution
    147              eventqDispatch();
    148          
    149          #ifdef CONFIG_INCLUDE_WATCHDOG
    150              if (--wdogCount == 0) {
    151                watchdogKick();
    152                wdogCount = 1000000;
    153                }
    154          #endif /* CONFIG_INCLUDE_WATCHDOG */
    155          
    156          #ifdef CONFIG_INCLUDE_PM_IDLE
    157              // put the CPU into idle mode until the next irq
    158              pmIdle();
    159          #endif /* CONFIG_INCLUDE_PM_IDLE */
    160          
    161          #ifdef CONFIG_INCLUDE_PM_SLEEP
    162              // put the CPU into sleep mode until the next irq
    163              pmSleep();
    164          #endif /* CONFIG_INCLUDE_PM_SLEEP */
    165          
    166              }
    167          }
    168          

   Maximum stack usage in bytes:

     Function CSTACK
     -------- ------
     main        20


   Segment part sizes:

     Function/Label                 Bytes
     --------------                 -----
     buffer                          256
     buildDate                         4
     buildTime                         4
     appVersion                        4
     toolchain                         4
     toolVersion                       4
     main                            308
     ?<Initializer for buildDate>      4
     ?<Initializer for buildTime>      4
     ?<Initializer for appVersion>     4
     ?<Initializer for toolchain>      4
     ?<Initializer for toolVersion>    4
     ?<Constant "Jul 20 2004">        12
     ?<Constant "18:58:46">           12
     ?<Constant "0.92">                8
     ?<Constant "IAR ICC">             8
     ?<Constant "4.1.1A">              8
     ?<Constant "\r\nMBARI Medusa v %s (...">
                                      36
      Others                         360

 
 644 bytes in segment CODE
  84 bytes in segment DATA_C
  20 bytes in segment DATA_I
  20 bytes in segment DATA_ID
 256 bytes in segment DATA_Z
  24 bytes in segment INITTAB
 
 308 bytes of CODE  memory (+ 360 bytes shared)
 104 bytes of CONST memory
 276 bytes of DATA  memory

Errors: none
Warnings: 1
