##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.40A/W32 EVALUATION    24/Mar/2008  21:03:08 #
# Copyright 1999-2005 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  interwork                                            #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  E:\Ivo\arm\IVOPLAY\conf_loader.c                     #
#    Command line    =  E:\Ivo\arm\IVOPLAY\conf_loader.c -D X75 -lC          #
#                       E:\Ivo\arm\IVOPLAY\ReleaseX75\List\ -lA              #
#                       E:\Ivo\arm\IVOPLAY\ReleaseX75\List\ -o               #
#                       E:\Ivo\arm\IVOPLAY\ReleaseX75\Obj\ -s9 --no_cse      #
#                       --no_unroll --no_inline --no_code_motion --no_tbaa   #
#                       --no_clustering --no_scheduling --cpu_mode arm       #
#                       --endian little --cpu ARM926EJ-S --stack_align 4     #
#                       --interwork -e --fpu None --dlib_config              #
#                       D:\arm\ARM\LIB\dl5tpainl8n.h -I D:\arm\ARM\INC\      #
#    List file       =  E:\Ivo\arm\IVOPLAY\ReleaseX75\List\conf_loader.lst   #
#    Object file     =  E:\Ivo\arm\IVOPLAY\ReleaseX75\Obj\conf_loader.r79    #
#                                                                            #
#                                                                            #
##############################################################################

E:\Ivo\arm\IVOPLAY\conf_loader.c
      1          #include "..\inc\swilib.h"
      2          #include "..\inc\cfg_items.h"
      3          #include "conf_loader.h"
      4          

   \                                 In segment DATA_I, align 4, align-sorted
      5          const char *successed_config_filename="";
   \                     successed_config_filename:
   \   00000000                      DS8 4
   \   00000004                      REQUIRE `?<Initializer for successed_config_filename>`
      6          
      7          #pragma segment="CONFIG_C"

   \                                 In segment CODE, align 4, keep-with-next
      8          int SaveConfigData(const char *fname)
      9          {
   \                     SaveConfigData:
   \   00000000   F0402DE9           PUSH     {R4-R7,LR}
   \   00000004   04D04DE2           SUB      SP,SP,#+4
     10            int f;
     11            unsigned int ul;
     12            int result=-1;
   \   00000008   0040E0E3           MVN      R4,#+0
     13            unsigned int wlen;
     14            unsigned int len=(char *)__segment_end("CONFIG_C")-(char *)__segment_begin("CONFIG_C");
   \   0000000C   50509FE5           LDR      R5,??SaveConfigData_0  ;; SFE(CONFIG_C) - SFB(CONFIG_C)
     15          
     16            if ((f=fopen(fname,A_WriteOnly+A_BIN+A_Create+A_Truncate,P_WRITE,&ul))!=-1)
   \   00000010   0D30A0E1           MOV      R3,SP
   \   00000014   402FA0E3           MOV      R2,#+256
   \   00000018   0110A0E3           MOV      R1,#+1
   \   0000001C   831C81E3           ORR      R1,R1,#0x8300
   \   00000020   0A0000EF           SWI      +10
   \   00000024   0060A0E1           MOV      R6,R0
   \   00000028   010076E3           CMN      R6,#+1
   \   0000002C   0900000A           BEQ      ??SaveConfigData_1
     17            {
     18              wlen=fwrite(f,__segment_begin("CONFIG_C"),len,&ul);
   \   00000030   0D30A0E1           MOV      R3,SP
   \   00000034   0520A0E1           MOV      R2,R5
   \   00000038   28109FE5           LDR      R1,??SaveConfigData_0+0x4  ;; SFB(CONFIG_C)
   \   0000003C   0C0000EF           SWI      +12
   \   00000040   0070A0E1           MOV      R7,R0
     19              fclose(f,&ul);
   \   00000044   0D10A0E1           MOV      R1,SP
   \   00000048   0600A0E1           MOV      R0,R6
   \   0000004C   0D0000EF           SWI      +13
     20              if (wlen==len) result=0;
   \   00000050   050057E1           CMP      R7,R5
   \   00000054   0040A003           MOVEQ    R4,#+0
     21            }
     22            return(result);
   \                     ??SaveConfigData_1:
   \   00000058   0400A0E1           MOV      R0,R4
   \   0000005C   04D08DE2           ADD      SP,SP,#+4        ;; stack cleaning
   \   00000060   F080BDE8           POP      {R4-R7,PC}       ;; return
   \                     ??SaveConfigData_0:
   \   00000064   ........           DC32     SFE(CONFIG_C) - SFB(CONFIG_C)
   \   00000068   ........           DC32     SFB(CONFIG_C)
     23          }
     24          
     25          
     26          #pragma segment="CONFIG_C"

   \                                 In segment CODE, align 4, keep-with-next
     27          int LoadConfigData(const char *fname)
     28          {
   \                     LoadConfigData:
   \   00000000   F04F2DE9           PUSH     {R4-R11,LR}
   \   00000004   04D04DE2           SUB      SP,SP,#+4
   \   00000008   0040A0E1           MOV      R4,R0
     29            int f;
     30            unsigned int ul;
     31            char *buf;
     32            int result=0;
   \   0000000C   0050A0E3           MOV      R5,#+0
     33            void *cfg;
     34            unsigned int rlen, end;
     35          
     36            extern const CFG_HDR cfghdr0; //first var in CONFIG
     37            cfg=(void*)&cfghdr0;
   \   00000010   C4609FE5           LDR      R6,??LoadConfigData_0  ;; cfghdr0
     38          
     39            unsigned int len=(int)__segment_end("CONFIG_C")-(int)__segment_begin("CONFIG_C");
   \   00000014   C4709FE5           LDR      R7,??LoadConfigData_0+0x4  ;; SFE(CONFIG_C) - SFB(CONFIG_C)
     40          
     41            if (!(buf=malloc(len))) return -1;
   \   00000018   0700A0E1           MOV      R0,R7
   \   0000001C   140000EF           SWI      +20
   \   00000020   0080B0E1           MOVS     R8,R0
   \   00000024   0500E001           MVNEQ    R0,R5
   \   00000028   2900000A           BEQ      ??LoadConfigData_1
     42            if ((f=fopen(fname,A_ReadOnly+A_BIN,P_READ,&ul))!=-1)
   \   0000002C   0D30A0E1           MOV      R3,SP
   \   00000030   8020A0E3           MOV      R2,#+128
   \   00000034   801CA0E3           MOV      R1,#+32768
   \   00000038   0400A0E1           MOV      R0,R4
   \   0000003C   0A0000EF           SWI      +10
   \   00000040   00A0A0E1           MOV      R10,R0
   \   00000044   01007AE3           CMN      R10,#+1
   \   00000048   1800000A           BEQ      ??LoadConfigData_2
     43            {
     44              rlen=fread(f,buf,len,&ul);
   \   0000004C   0D30A0E1           MOV      R3,SP
   \   00000050   0720A0E1           MOV      R2,R7
   \   00000054   0810A0E1           MOV      R1,R8
   \   00000058   0B0000EF           SWI      +11
   \   0000005C   0090A0E1           MOV      R9,R0
     45              end=lseek(f,0,S_END,&ul,&ul);
   \   00000060   0D00A0E1           MOV      R0,SP
   \   00000064   01002DE9           PUSH     {R0}
   \   00000068   04308DE2           ADD      R3,SP,#+4
   \   0000006C   0220A0E3           MOV      R2,#+2
   \   00000070   0010A0E3           MOV      R1,#+0
   \   00000074   0A00A0E1           MOV      R0,R10
   \   00000078   0F0000EF           SWI      +15
   \   0000007C   00B0A0E1           MOV      R11,R0
     46              fclose(f,&ul);
   \   00000080   04108DE2           ADD      R1,SP,#+4
   \   00000084   0A00A0E1           MOV      R0,R10
   \   00000088   0D0000EF           SWI      +13
     47              if (rlen!=end || rlen!=len)  goto L_SAVENEWCFG;
   \   0000008C   0B0059E1           CMP      R9,R11
   \   00000090   04D08DE2           ADD      SP,SP,#+4        ;; stack cleaning
   \   00000094   07005901           CMPEQ    R9,R7
   \   00000098   0400001A           BNE      ??LoadConfigData_2
     48              memcpy(cfg,buf,len);
   \   0000009C   0720A0E1           MOV      R2,R7
   \   000000A0   0810A0E1           MOV      R1,R8
   \   000000A4   0600A0E1           MOV      R0,R6
   \   000000A8   1E0100EF           SWI      +286
   \   000000AC   020000EA           B        ??LoadConfigData_3
     49            }
     50            else
     51            {
     52            L_SAVENEWCFG:
     53              result=SaveConfigData(fname);
   \                     ??LoadConfigData_2:
   \   000000B0   0400A0E1           MOV      R0,R4
   \   000000B4   ........           BL       SaveConfigData
   \   000000B8   0050A0E1           MOV      R5,R0
     54            }
     55            mfree(buf);
   \                     ??LoadConfigData_3:
   \   000000BC   0800A0E1           MOV      R0,R8
   \   000000C0   150000EF           SWI      +21
     56            if (result>=0) successed_config_filename=fname;
   \   000000C4   000055E3           CMP      R5,#+0
   \   000000C8   14009F55           LDRPL    R0,??LoadConfigData_0+0x8  ;; successed_config_filename
   \   000000CC   00408055           STRPL    R4,[R0, #+0]
     57            return(result);
   \   000000D0   0500A0E1           MOV      R0,R5
   \                     ??LoadConfigData_1:
   \   000000D4   04D08DE2           ADD      SP,SP,#+4        ;; stack cleaning
   \   000000D8   F08FBDE8           POP      {R4-R11,PC}      ;; return
   \                     ??LoadConfigData_0:
   \   000000DC   ........           DC32     cfghdr0
   \   000000E0   ........           DC32     SFE(CONFIG_C) - SFB(CONFIG_C)
   \   000000E4   ........           DC32     successed_config_filename
     58          }
     59          

   \                                 In segment CODE, align 4, keep-with-next
     60          void InitConfig()
     61          {
   \                     InitConfig:
   \   00000000   00402DE9           PUSH     {LR}
     62            if (LoadConfigData("4:\\ZBin\\etc\\Ivoplay.bcfg")<0)
   \   00000004   14009FE5           LDR      R0,??InitConfig_0  ;; `?<Constant "4:\\\\ZBin\\\\etc\\\\Ivoplay.bcfg">`
   \   00000008   ........           BL       LoadConfigData
   \   0000000C   000050E3           CMP      R0,#+0
   \   00000010   0080BD58           POPPL    {PC}
     63            {
     64              LoadConfigData("0:\\ZBin\\etc\\Ivoplay.bcfg");
   \   00000014   08009FE5           LDR      R0,??InitConfig_0+0x4  ;; `?<Constant "0:\\\\ZBin\\\\etc\\\\Ivoplay.bcfg">`
   \   00000018   0040BDE8           POP      {LR}             ;; Pop
   \   0000001C   ........           B        LoadConfigData   ;; tailcall
   \                     ??InitConfig_0:
   \   00000020   ........           DC32     `?<Constant "4:\\\\ZBin\\\\etc\\\\Ivoplay.bcfg">`
   \   00000024   ........           DC32     `?<Constant "0:\\\\ZBin\\\\etc\\\\Ivoplay.bcfg">`
     65            }
     66          }

   \                                 In segment DATA_ID, align 4, align-sorted
   \                     `?<Initializer for successed_config_filename>`:
   \   00000000   ........           DC32 `?<Constant "">`

   \                                 In segment CONFIG_C, align 1

   \                                 In segment DATA_C, align 1, align-sorted
   \                     `?<Constant "">`:
   \   00000000   00                 DC8 ""

   \                                 In segment DATA_C, align 4, align-sorted
   \                     `?<Constant "0:\\\\ZBin\\\\etc\\\\Ivoplay.bcfg">`:
   \   00000000   303A5C5A4269       DC8 "0:\\ZBin\\etc\\Ivoplay.bcfg"
   \              6E5C6574635C
   \              49766F706C61
   \              792E62636667
   \              00          
   \   00000019   000000             DC8 0, 0, 0

   \                                 In segment DATA_C, align 4, align-sorted
   \                     `?<Constant "4:\\\\ZBin\\\\etc\\\\Ivoplay.bcfg">`:
   \   00000000   343A5C5A4269       DC8 "4:\\ZBin\\etc\\Ivoplay.bcfg"
   \              6E5C6574635C
   \              49766F706C61
   \              792E62636667
   \              00          
   \   00000019   000000             DC8 0, 0, 0

   Maximum stack usage in bytes:

     Function       CSTACK
     --------       ------
     InitConfig         4
     LoadConfigData    44
     SaveConfigData    24


   Segment part sizes:

     Function/Label                 Bytes
     --------------                 -----
     successed_config_filename         4
     SaveConfigData                  108
     LoadConfigData                  232
     InitConfig                       40
     ?<Initializer for successed_config_filename>
                                       4
     ?<Constant "">                    1
     ?<Constant "0:\\ZBin\\etc\\Ivoplay.bcfg">
                                      28
     ?<Constant "4:\\ZBin\\etc\\Ivoplay.bcfg">
                                      28
      Others                          24

 
 392 bytes in segment CODE
  57 bytes in segment DATA_C
   4 bytes in segment DATA_I
   4 bytes in segment DATA_ID
  12 bytes in segment INITTAB
 
 380 bytes of CODE  memory (+ 24 bytes shared)
  61 bytes of CONST memory
   4 bytes of DATA  memory

Errors: none
Warnings: none
