/*****************************************************************************/
/* Copyright (c) 2008 NXP B.V.  All rights are reserved.                     */
/*                                                                           */
/* Redistribution and use in source and binary forms, with or without        */
/* modification, are permitted provided that the following conditions        */
/* are met:                                                                  */
/*                                                                           */
/* Redistributions of source code must retain the above copyright            */
/* notice, this list of conditions and the following disclaimer.             */
/*                                                                           */
/* Redistributions in binary form must reproduce the above copyright         */
/* notice, this list of conditions and the following disclaimer in the       */
/* documentation and/or other materials provided with the distribution.      */
/*                                                                           */
/* Neither the name of NXP nor the names of its                              */
/* contributors may be used to endorse or promote products derived from      */
/* this software without specific prior written permission.                  */
/*                                                                           */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS       */
/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT         */
/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR     */
/* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT      */
/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,     */
/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT          */
/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     */
/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY     */
/* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT       */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE         */
/* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH          */
/* DAMAGE.                                                                   */
/*                                                                           */
/*****************************************************************************/
/**
    @file   phKernelIfce_Example1_UserMode.c
    @brief  Example of a usermode use of phKernelIfce.

@b  Component:  phKernelIfce.

*//*

Rev Date       Author      Comments
--------------------------------------------------------------------------------
  1 20061012   batelaan    Initial
  2 20061020   batelaan    Crosscheck fixes
  3 20080619   batelaan    Update copyright header.
--------------------------------------------------------------------------------
    For consistency and standardisation retain the Section Separators.
*/

#include <phKernelIfce.h>
#include <phStbDbg.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

#include <phExample1.h>

/***********************************************
* LOCAL MACROS                                 *
* recommendation only: <MODULE><_WORD>+        *
************************************************/

/******************************************************************
* FUNCTION PROTOTYPES                    [p]ph<Module>_<Word>+    *
*******************************************************************/

/******************************************************************
* LOCAL TYPEDEFS                                                  *
* recommendation only:                   [p]ph<Module>_<Word>+_t  *
*******************************************************************/

/*******************************************************************
* EXPORTED DATA                 g[k|p|kp|pk|kpk]ph<Module>_<Word>+ *
********************************************************************/

/*******************************************************************
* LOCAL DATA                                                       *
********************************************************************/

//PH_KERNELIFCE_DATA(KernelIfceTest0_func0);

/*******************************************************************************
* FUNCTION IMPLEMENTATION  <Module>[_<Word>+] for static functions             *
*                          tm[<layer>]<Module>[_<Word>+] for exported functions*
********************************************************************************/

/******************************************************************************/

int main(int argc, char **argv)
{
    int c;
    int ret;
    char s[200] = "Anyone there??? ";
    char *expectedString = "Anyone there???  Greetings from the kernel!";
    
    printf("phKernelIfce_Example1: start\n");

    ret = phExample1_Function(10, 31, s, &c);

    printf("phExample1_Function(10, 31, \"Anyone there??? \", &c) => %d (s=\"%s\" c=%d)\n",
           ret, s, c);

    /* Check results: */
    if (c != 42)
    {
        fprintf(stderr, "\n**ERROR: %d not the right answer, expecting %d!\n", c, 42);
    }
    if (strcmp(expectedString, s) != 0)
    {
        fprintf(stderr, "\n**ERROR: \"%s\" not the right response,\n  expecting \"%s\"\n",
                s, expectedString);
    }
    
    printf("phKernelIfce_Example1: end\n");
    return 0;
}

/******************************************************************************/
/******************************************************************************/
/******************************************************************************/
/******************************************************************************/
