/*****************************************************************************/
/* 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_Kmodule.c
    @brief  Kernel module 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.
  4 20090121   batelaan    Update author.
  5 20090122   batelaan    Use MODULE_LICENSE("Dual BSD/GPL");
--------------------------------------------------------------------------------
    For consistency and standardisation retain the Section Separators.
*/

#include <linux/module.h>
#include <linux/kernel.h>

#include <phStbDbg.h>

/* Include another C file here. This implements the phKernelIfce init
   and exit functions, and handlers, for this namespace.  We use this
   mechanism to save having a separate header file for the functions
   we need. */
#include <phExample1_KI.c>

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

#define THIS_MODULE_DESCRIPTION "phExample1 Kernel Module"
MODULE_LICENSE("Dual BSD/GPL");
MODULE_DESCRIPTION(THIS_MODULE_DESCRIPTION);
MODULE_AUTHOR("NXP B.V.");

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

static int __init Example1Init(void);
static void __exit Example1Exit(void);

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

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

module_init(Example1Init);
module_exit(Example1Exit);

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

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

/******************************************************************************/
/** Module Creation function.
    @retval int On success 0.
*/
static int __init Example1Init(void)
{
    tmErrorCode_t err;

    err = phKernelIfce_Register(
        "phExample1",
        phExample1_KI_Functions,
        sizeof(phExample1_KI_Functions) / sizeof(phExample1_KI_Functions[0]));
    DBG_ASSERT2(err == TM_OK, ("err=0x%x\n", err));

    return 0;
}

/******************************************************************************/
/** Module Exit function.
*/
static void __exit Example1Exit(void)
{
    tmErrorCode_t err;
    err = phKernelIfce_NameSpaceUnregister("phExample1");
    DBG_ASSERT2(err == TM_OK, ("err=0x%x\n", err));
}

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