/*****************************************************************************/
/* 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   phExample1_KI.c
    @brief  phKernelIfce proxies and handlers for phExample1 component.

@b  Component:  phExample1.

*//*

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 <phExample1.h>

/******************************************************************************/
/* phExample1_Function */
/******************************************************************************/

typedef struct phExample1_Function_CallData {
    phKernelIfce_CallData_t _KI_Header;
    int a;
    int b;
    char *s;
    int *c;
    int returnValue;
} phExample1_Function_CallData_t;

#ifdef __KERNEL__
static void phExample1_Function_Handler(phExample1_Function_CallData_t *_callDataPtr)
{
    _callDataPtr->returnValue = phExample1_Function(
        _callDataPtr->a,
        _callDataPtr->b,
        _callDataPtr->s,
        _callDataPtr->c);
}
#else /* #ifdef __KERNEL__ */
static phKernelIfce_NameSpace_t _KI_phExample1_NameSpaceData = {
    "phExample1",
    PH_KERNELIFCE_UNINITIALISED
};

/** User-mode proxy function calling kernel-mode function.
    @param a @b IN Input parameter. 
    @param b @b IN Input parameter. 
    @param s @b INOUT Input and output parameter. The string " Greetings from the kernel!" will be appended.
    @param c @b OUT Output parameter, set to 42.
    @return a + b
*/
int phExample1_Function(
    int a,
    int b,
    char *s,
    int *c
    )
{
    static phKernelIfce_Func_t _KI_FuncData = {
        &_KI_phExample1_NameSpaceData,
        "phExample1_Function",
        PH_KERNELIFCE_UNINITIALISED
    };
    phExample1_Function_CallData_t _KI_CallData;
    _KI_CallData._KI_Header.len = sizeof(_KI_CallData);
    _KI_CallData._KI_Header.pFunc = &_KI_FuncData;
    _KI_CallData.a = a;
    _KI_CallData.b = b;
    _KI_CallData.s = s;
    _KI_CallData.c = c;
    phKernelIfce_Call(&_KI_CallData._KI_Header);
    return _KI_CallData.returnValue;
}
#endif /* #ifdef __KERNEL__ */


/******************************************************************************/
/* next function... */
/******************************************************************************/

/* ADD MORE FUNCTIONS HERE */







/******************************************************************************/
#ifdef __KERNEL__

static phKernelIfce_FuncSetup_t phExample1_KI_Functions[] = {
    {"phExample1_Function", (pphKernelIfce_Handler_t)&phExample1_Function_Handler}
    /* ADD MORE FUNCTIONS HERE */
};

#endif /* #ifdef __KERNEL__ */
