CCS Modul   R_FAULTMEM
 
   $Id: r_faultmem.C,v 1.5 2006/01/17 15:20:27 nit3an Exp $
   ---------------------------------------------------------------------
   Kurzbeschreibung: 	checks for target errors and states
   ---------------------------------------------------------------------
   Projekt:		testlisten_anw_module
   Sourcefile:		r_faultmem.C
   Autor:		AnW/TEF7-Thomas Nickel (09.08.2004)
   Zielsystem:		HP9000/V743 (HP-RT 3.01), /7/C/D (HP-UX 10.20), Linux
   Sprache:		ANSI-C/C++
   ---------------------------------------------------------------------
   Prototyp:
   
   int r_faultmem 
   (shm_stringpointer *zeilen_wert  // <I> Pointer to anzahl STRING parameters
   ,long index   		    // <I> Index number
   ,long anzahl)		    // <I> Number of values
   
   ---------------------------------------------------------------------
   Aufruf:
   error = r_faultmem
   (*zeilen_wert	// <I> Pointer to anzahl STRING parameters
   ,index		// <I> Index number
   ,anzahl)		// <I> Number of values
   
   if (error != 0) 	// Fehlerbeschreibung ... 
   {
   // Fehlerhandling ... 
   }
   
   ---------------------------------------------------------------------
   Function description: This module parses a hexadecimal ECU fault
   memory input string for a target fault number depending on platform
   and search option.
   The fault memory number is returned in RESULT_NO (0 if not found)
   The state flags are returned in RESULT_STATE.
   The position of the fault memory number is returned in RESULT_ADDRESS.
   
   When using this module you should pay attention to the call sequence:
   - 1st search all fault memory numbers which must exist (ALWAYS),
   - 2nd search possible fault memory numbers which may exist (POSSIBLE),
   - 3rd search for unknown errors (TARGET_FLTNO = 0).


   Description of module parameters:
1 PRUEFSCHRITT
   GAUDI teststep
2 POSITION
   PAV position
3 INPUT_STRING
(input)
   Hexadecimal ECU fault memory string (got with module P_AUFTRAG),
   e.g. for platform AB9:
   INPUT_STRING="A753B60FCFAB" will be separated into the parts:
        A753 B60F CFAB
   separation into bits:
      A753 --> 1010 0111 0101 0011, B60F --> 1011 0110 0000 1111, ...
   separation into state flags and error numbers:
          A753   		   B60F   	       CFAB
   state: 1010 01=0x29=41   	   1011 01=0x2D=45     1100 11=0x33=51
   error: 11 0101 0011=0x353=851   10 0000 1111=0x20F  11 1010 1011=0x3AB
                                   =527                =939
4 PLATFORM
(input)
   The INPUT_STRING is evaluated depending on PLATFORM
   Possible values:
   AB9:  A fault memory cell has 2 bytes:
         The 6 high bits contain error state flags,
         the 10 low bits contain the error number;
         Bit  0 - 9: error number,
         Bit 10 -15: state flags (values 0 or 1)
   AB10: not yet implemented, for future use.
5 TARGET_FLTNO
(input)
   A target fault number as a decimal value.
   If TARGET_FLTNO = 0: it is expected that all not already processed
   fault memory cells are empty (value 0).
6 SEARCH_OPTION
(input)
   Search options for TARGET_FLTNO, possible values:
   ALWAYS:   TARGET_FLTNO must exist in INPUT_STRING,
   POSSIBLE: TARGET_FLTNO may  exist in INPUT_STRING.
7 FLT_VALIDAT
(input/output)
   A string with bit flags for every fault memory cell position:
      - not processed fault memory cells are marked with 0,
      - processed fault memory cells are marked with "1".
   If FLT_VALIDAT = "", "0" or "-": it is initialized with
      number of fault memory cells "0"s.
8 RESULT_NO
(output)
   Decimal error number

   Case TARGET_FLTNO > 0:
        RESULT_NO = TARGET_FLTNO if TARGET_FLTNO was found,
                  = -1           if TARGET_FLTNO was not found;

   Case TARGET_FLTNO = 0:
        Case: all not already processed fault memory cells are empty:
           RESULT_NO = 0
        else Case:
           RESULT_NO = first fault memory number not already found > 0
9 RESULT_STATE
(output)
   A hexadecimal result string containing 8 bits for the error state.
   The state flags are filled with 1 bits at the lower end to 8 bits if
   less than 8 state flags exist. The result is written as a hexadecimal
   string, e.g. 101010 --> 10101011 --> AB
   If TARGET_FLTNO was not found or in error case, the result is "FF".
10 RESULT_ADDR
(output)
   The position of TARGET_FLTNO in INPUT_STRING (the first position has
   address 0).
11 ERRORFLAG
(output)
   =0 o.k.; >0: error case

   ...