/* Generated by CMunge 0.76 (10 May 2006)
 * CMunge Copyright (c) 1999-2006 Robin Watts/Justin Fletcher */

#ifndef _CMUNGE_Wiresalmon_H_
#define _CMUNGE_Wiresalmon_H_

#include "kernel.h"

#define CMUNGE_VERSION (76)
#define CMHG_VERSION   (531) /* Nearest equivalent version */

#define Module_Title		"Wiresalmon"
#define Module_Help		"Wiresalmon"
#define Module_VersionString	"1.00"
#define Module_VersionNumber	100
#ifndef Module_Date
#define Module_Date		"18 Nov 2007"
#endif

#ifdef __cplusplus
extern "C" {
#endif


/***************************************************************************
 * Function:     initialise
 * Description:  Initialise the module, setting up vectors, callbacks and
 *               any other parts of the system necessary for the module to
 *               function.
 * Parameters:   tail        = pointer to command line (control terminated)
 *               podule_base = address of podule module was started from, or
 *                             NULL if none
 *               pw          = private word for module
 * On exit:      Return NULL for successful initialisation, or a pointer to
 *               an error block if the module could not start properly.
 **************************************************************************/
_kernel_oserror *initialise(const char *tail, int podule_base, void *pw);


/***************************************************************************
 * Function:     finalise
 * Description:  Finalise the module, shutting down any systems necessary,
 *               freeing vectors and releasing workspace
 * Parameters:   fatal       = fatality indicator; 1 if fatal, 0 if
 *                             reinitialising
 *               podule_base = address of podule module was started from, or
 *                             NULL if none
 *               pw          = private word for module
 * On exit:      Return 0 for successful finalisation, or a pointer to an
 *               error block if module was not shutdown properly.
 **************************************************************************/
_kernel_oserror *finalise(int fatal, int podule_base, void *pw);


/***************************************************************************
 * Description:  SWI handler routine. All SWIs for this module will be
 *               passed to these routines.
 * Parameters:   number = SWI number within SWI chunk (i.e. 0 to 63)
 *               r      = pointer to register block on entry
 *               pw     = private word for module
 * On exit:      Return NULL if SWI handled sucessfully, setting return
 *               register values (r0-r9) in r.
 *               Return error_BAD_SWI for out of range SWIs.
 *               Return an error block for a custom error.
 **************************************************************************/
/* Function called to handle SWI calls */
_kernel_oserror *swi(int number, _kernel_swi_regs *r, void *pw);
/* SWI number definitions */
#define Wiresalmon_00 (0x00058c80)
#undef Wiresalmon_Start
#undef XWiresalmon_Start
#define Wiresalmon_Start          (0x00058c80)
#define XWiresalmon_Start         (0x00078c80)
#undef Wiresalmon_Stop
#undef XWiresalmon_Stop
#define Wiresalmon_Stop           (0x00058c81)
#define XWiresalmon_Stop          (0x00078c81)

/* Special error for 'SWI values out of range for this module' */
#define error_BAD_SWI ((_kernel_oserror *) -1)


/***************************************************************************
 * Function:     callevery
 * Description:  Symbol for entry point to module - NOT a C function.
 *               This name should be used as an argument to
 *               OS_Claim/OS_Release as required, but should never be called
 *               from C.
 **************************************************************************/
extern void callevery(void);


/***************************************************************************
 * Function:     callevery_handler
 * Description:  Generic handler function
 * Parameters:   r  = pointer to register block on entry
 *               pw = private word for module
 * On exit:      Update r to alter return values
 *               Return NULL to return with V clear
 *               Return an error pointer to set V and r0
 **************************************************************************/
_kernel_oserror *callevery_handler(_kernel_swi_regs *r, void *pw);


/***************************************************************************
 * Function:     callback
 * Description:  Symbol for entry point to module - NOT a C function.
 *               This name should be used as an argument to
 *               OS_Claim/OS_Release as required, but should never be called
 *               from C.
 **************************************************************************/
extern void callback(void);


/***************************************************************************
 * Function:     callback_handler
 * Description:  Generic handler function
 * Parameters:   r  = pointer to register block on entry
 *               pw = private word for module
 * On exit:      Update r to alter return values
 *               Return NULL to return with V clear
 *               Return an error pointer to set V and r0
 **************************************************************************/
_kernel_oserror *callback_handler(_kernel_swi_regs *r, void *pw);

#ifdef __cplusplus
}
#endif

#endif
