##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.11A/W32               20/Jul/2004  18:58:51 #
# Copyright 1999-2004 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  arm                                                  #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  C:\medusa\zl_ssi.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\zl_ssi.c        #
#    List file       =  C:\medusa\Debug\List\zl_ssi.lst                      #
#    Object file     =  C:\medusa\Debug\Obj\zl_ssi.r79                       #
#                                                                            #
#                                                                            #
##############################################################################

C:\medusa\zl_ssi.c
      1          #include "archinc.h"
      2          #include "cli.h"
      3          #include "strutil.h"
      4          #include "zarlink.h"
      5          
      6          #ifdef CONFIG_INCLUDE_ZARLINK
      7          
      8          #include <stdlib.h>
      9          
     10          static void ssiDelay(void)
     11          {
     12            volatile int i;
     13            lpc210x_reg dummy;
     14          
     15            for(i=0;i<128;i++) 
     16              dummy = CTIME0;
     17          }
     18          
     19          #ifdef CONFIG_TOOLCHAIN_IAR
     20          #pragma inline
     21          #endif
     22          static void INLINE_KEYWORD ssiStrobeHi(void) { IOSET = (lpc210x_reg)0x0200; }
     23          
     24          #ifdef CONFIG_TOOLCHAIN_IAR
     25          #pragma inline
     26          #endif
     27          static void INLINE_KEYWORD ssiStrobeLo(void) { IOCLR = (lpc210x_reg)0x0200; }
     28          
     29          #ifdef CONFIG_TOOLCHAIN_IAR
     30          #pragma inline
     31          #endif
     32          static void INLINE_KEYWORD ssiDataOutHi(void) { IOSET = (lpc210x_reg)0x0800; }
     33          
     34          #ifdef CONFIG_TOOLCHAIN_IAR
     35          #pragma inline
     36          #endif
     37          static void INLINE_KEYWORD ssiDataOutLo(void) { IOCLR = (lpc210x_reg)0x0800; }
     38          
     39          #ifdef CONFIG_TOOLCHAIN_IAR
     40          #pragma inline
     41          #endif
     42          static int INLINE_KEYWORD ssiGetDataIn(void)
     43          {
     44            lpc210x_reg pins = IOPIN;
     45            return ((pins & 0x0400) ? 1 : 0);
     46          }
     47          
     48          #ifdef CONFIG_TOOLCHAIN_IAR
     49          #pragma inline
     50          #endif
     51          static void INLINE_KEYWORD ssiStart(void)
     52          {
     53            ssiDataOutHi(); ssiDelay();
     54            ssiStrobeHi(); ssiDelay();
     55            ssiDataOutLo(); ssiDelay();
     56            ssiStrobeLo(); ssiDelay();
     57          }
     58          
     59          #ifdef CONFIG_TOOLCHAIN_IAR
     60          #pragma inline
     61          #endif
     62          static void INLINE_KEYWORD ssiAbort(void)
                                            ^
Warning[Pe177]: function "ssiAbort" was declared but never referenced
     63          {
     64            /* bring strobe then data high */
     65            ssiStrobeHi(); ssiDelay();
     66            ssiDataOutHi(); ssiDelay();
     67          
     68            ssiStrobeLo(); ssiDelay();
     69          }
     70          
     71          static void INLINE_KEYWORD ssiWriteBit(int bitVal)
     72          {
     73            /* setup data */
     74            if (bitVal == 0)
     75              ssiDataOutLo();
     76            else 
     77              ssiDataOutHi();
     78            
     79             // setup delay for dataOut
     80             ssiDelay(); 
     81             
     82             // ensure clock is low
     83             ssiStrobeLo(); ssiDelay();
     84          
     85            /* strobe clock */
     86            ssiStrobeHi();  ssiDelay();
     87            ssiStrobeLo();  ssiDelay();
     88          
     89          }
     90          
     91          static INLINE_KEYWORD int ssiReadBit(void)
     92          {
     93            int retVal;
     94          
     95            ssiStrobeLo();  ssiDelay();
     96          
     97            ssiStrobeHi();  ssiDelay();
     98            retVal = ssiGetDataIn();
     99            ssiStrobeLo();  ssiDelay();
    100          
    101            return retVal;
    102          }
    103          
    104          static void ssiWrite(unsigned char addr, unsigned short writeData, boolean twoClocks)
    105          {
    106            int i;
    107            unsigned char deviceId = 0;
    108            unsigned char devAddr = (addr & 0x7);
    109          
    110            // send start condition
    111            ssiStart();
    112          
    113            // send device ID
    114            for(i=0;i<3;i++)
    115              ssiWriteBit((deviceId >> i) & 0x01);
    116          
    117            // send register index to write
    118            for(i=0;i<3;i++)
    119              ssiWriteBit((devAddr >> i) & 0x01);
    120          
    121            // send a '1' for write
    122            ssiWriteBit(1);
    123          
    124            // send the data
    125            for(i=0;i<16;i++)
    126              ssiWriteBit((writeData >> i) & 0x01);
    127          
    128            // leave dataOut hi as per timing diagram
    129            ssiDataOutHi();  ssiDelay();
    130          
    131            if (twoClocks == true) {
    132              // generate two trailing clock pulses
    133              ssiStrobeHi();  ssiDelay(); 
    134              ssiStrobeLo();  ssiDelay();
    135              ssiStrobeHi();  ssiDelay();
    136              ssiStrobeLo();  ssiDelay();  
    137              }
    138          }
    139          
    140          static unsigned short ssiRead(unsigned char addr)
    141          {
    142            int i;
    143            unsigned char deviceId = 0;
    144            unsigned char devAddr = (addr & 0x7);
    145            unsigned short readData;
    146          
    147            // send start condition
    148            ssiStart();
    149          
    150            // send device ID
    151            for(i=0;i<3;i++)
    152              ssiWriteBit((deviceId >> i) & 0x01);
    153          
    154            // send register index to read
    155            for(i=0;i<3;i++)
    156              ssiWriteBit((devAddr >> i) & 0x01);
    157          
    158            // send a '0' for read
    159            ssiWriteBit(0);
    160          
    161            // leave dataOut high
    162            ssiDataOutHi(); 
    163          
    164            // get the data
    165            for(readData=0,i=0;i<16;i++)
    166              if (ssiReadBit() != 0)
    167                readData |= (unsigned short)(0x01 << i);
    168          
    169            return readData;
    170          }
    171          
    172          static void ssiIndexedWrite(unsigned short index, unsigned char data)
                             ^
Warning[Pe177]: function "ssiIndexedWrite" was declared but never referenced
    173          {
    174            ssiWrite(0x00, index, true);
    175            ssiWrite(0x02, ((unsigned short)data), true);
    176          }
    177          
    178          static unsigned char ssiIndexedRead(unsigned short index)
                                      ^
Warning[Pe177]: function "ssiIndexedRead" was declared but never referenced
    179          {
    180            ssiWrite(0x00, index, true);
    181            return ((unsigned char)(ssiRead(0x02) & 0x00ff));
    182          }
    183          
    184          #endif


   Segment part sizes:

     Function/Label Bytes
     -------------- -----

 
 
 0 bytes of memory

Errors: none
Warnings: 3
