/* Generated by CMunge 0.76 (10 May 2006) [with GCCSDK 4 changes r7132 at
 * /trunk/gcc4/riscos/cmunge]
 * CMunge Copyright (c) 1999-2006 Robin Watts/Justin Fletcher
 * Copyright (c) 2007-2014 GCCSDK Developers and contributors */

#ifndef _CMUNGE_vncserver_H_
#define _CMUNGE_vncserver_H_

#include "kernel.h"

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

#define Module_Title		"vncserver"
#define Module_Help		"vncserver"
#define Module_VersionString	"0.22"
#define Module_VersionNumber	22
#ifndef Module_Date
#define Module_Date		"05 Apr 2021"
#endif

#ifdef __cplusplus
extern "C" {
#endif


/***************************************************************************
 * Function:     main
 * Description:  Module entry point when entered by OS_Module 2. We are in
 *               user mode and will be using user mode stack in application
 *               space. If you're going to be a module task, then you will
 *               need to claim Service_Memory.
 * Parameters:   argc   = Count of the number of arguments passed to the
 *                        module in R2 when OS_Module 2 issued.
 *               argv[] = array of pointers to strings passed as arguments
 *                        to the module
 * On exit:      Return EXIT_SUCCESS for successful completion, or
 *               EXIT_FAILURE (or some other non-zero value for failure.
 **************************************************************************/
int main(int argc, char *argv[]);


/***************************************************************************
 * Function:     module_init
 * 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 *module_init(const char *tail, int podule_base, void *pw);


/***************************************************************************
 * Function:     module_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 NULL for successful finalisation, or a pointer to an
 *               error block if module was not shutdown properly.
 **************************************************************************/
_kernel_oserror *module_finalise(int fatal, int podule_base, void *pw);


/***************************************************************************
 * Function:     module_service
 * Description:  Service call handler routine. All services which are being
 *               received by the module will be passed to this routine.
 * Parameters:   service = service call number
 *               r       = pointer to register block on entry
 *               pw      = private word for module
 * On exit:      Update register values on return by updating r.
 **************************************************************************/
void module_service(int service, _kernel_swi_regs *r, void *pw);


/***************************************************************************
 * Description:  Star command and help request handler routines.
 * Parameters:   arg_string = pointer to argument string (control
 *                            terminated), or output buffer
 *               argc       = number of arguments passed
 *               number     = command number (see CMD_* definitions below)
 *               pw         = private word for module
 * On exit:      If number indicates a help entry:
 *                 To output, assemble zero terminated output into
 *                 arg_string, and return help_PRINT_BUFFER to print it.
 *                 To stay silent, return NULL.
 *                 To given an error, return an error pointer.
 *                 [In this case, you need to cast the 'const' away]
 *               If number indicates a configure option:
 *                 If arg_string is arg_STATUS, then print status, otherwise
 *                 use argc and arg_string to set option.
 *                 Return NULL for no error.
 *                 Return one of the four error codes below (configure_*)
 *                 for a generic error message.
 *                 Return an error pointer for a custom error.
 *               If number indicates a command entry:
 *                 Execute the command given by number, and arg_string.
 *                 Return NULL on success,
 *                 Return a pointer to an error block on failure.
 **************************************************************************/
_kernel_oserror *command_handler(const char *arg_string, int argc,
                                 int number, void *pw);
#define help_PRINT_BUFFER		((_kernel_oserror *) arg_string)
#define arg_CONFIGURE_SYNTAX		((char *) 0)
#define arg_STATUS			((char *) 1)
#define configure_BAD_OPTION		((_kernel_oserror *) -1)
#define configure_NUMBER_NEEDED		((_kernel_oserror *) 1)
#define configure_TOO_LARGE		((_kernel_oserror *) 2)
#define configure_TOO_MANY_PARAMS	((_kernel_oserror *) 3)

/* Command numbers, as passed to the command handler functions (see above) */
#undef CMD_vncserv_start
#define CMD_vncserv_start (0)
#undef CMD_vncserv_stop
#define CMD_vncserv_stop (1)
#undef CMD_vncserv_status
#define CMD_vncserv_status (2)
#undef CMD_vncserv_start_task
#define CMD_vncserv_start_task (3)
#undef CMD_vncserv_config
#define CMD_vncserv_config (4)


/***************************************************************************
 * 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:  IRQ handler function
 * Parameters:   r  = pointer to register block on entry
 *               pw = private word for module
 * On exit:      Update r to alter return values
 *               Return 0 to claim (return via stack)
 *               Return non-0 to pass on (return via r14)
 **************************************************************************/
int callback_handler(_kernel_swi_regs *r, void *pw);


/***************************************************************************
 * Function:     socket_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 socket_callback(void);


/***************************************************************************
 * Function:     socket_callback_handler
 * Description:  IRQ handler function
 * Parameters:   r  = pointer to register block on entry
 *               pw = private word for module
 * On exit:      Update r to alter return values
 *               Return 0 to claim (return via stack)
 *               Return non-0 to pass on (return via r14)
 **************************************************************************/
int socket_callback_handler(_kernel_swi_regs *r, void *pw);


/***************************************************************************
 * Function:     rect_filter_entry
 * 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 rect_filter_entry(void);


/***************************************************************************
 * Function:     rect_filter_handler
 * Description:  IRQ handler function
 * Parameters:   r  = pointer to register block on entry
 *               pw = private word for module
 * On exit:      Update r to alter return values
 *               Return 0 to claim (return via stack)
 *               Return non-0 to pass on (return via r14)
 **************************************************************************/
int rect_filter_handler(_kernel_swi_regs *r, void *pw);


/***************************************************************************
 * Function:     copy_filter_entry
 * 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 copy_filter_entry(void);


/***************************************************************************
 * Function:     copy_filter_handler
 * Description:  IRQ handler function
 * Parameters:   r  = pointer to register block on entry
 *               pw = private word for module
 * On exit:      Update r to alter return values
 *               Return 0 to claim (return via stack)
 *               Return non-0 to pass on (return via r14)
 **************************************************************************/
int copy_filter_handler(_kernel_swi_regs *r, void *pw);


/***************************************************************************
 * Function:     poll_filter_entry
 * 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 poll_filter_entry(void);


/***************************************************************************
 * Function:     poll_filter_handler
 * Description:  IRQ handler function
 * Parameters:   r  = pointer to register block on entry
 *               pw = private word for module
 * On exit:      Update r to alter return values
 *               Return 0 to claim (return via stack)
 *               Return non-0 to pass on (return via r14)
 **************************************************************************/
int poll_filter_handler(_kernel_swi_regs *r, void *pw);


/***************************************************************************
 * Function:     tick_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 tick_callback(void);


/***************************************************************************
 * Function:     tick_callback_handler
 * Description:  IRQ handler function
 * Parameters:   r  = pointer to register block on entry
 *               pw = private word for module
 * On exit:      Update r to alter return values
 *               Return 0 to claim (return via stack)
 *               Return non-0 to pass on (return via r14)
 **************************************************************************/
int tick_callback_handler(_kernel_swi_regs *r, void *pw);


/***************************************************************************
 * Function:     osword_entry
 * 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 osword_entry(void);


/***************************************************************************
 * Function:     osword_handler
 * Description:  Vector handler function
 * Parameters:   r  = pointer to register block on entry
 *               pw = private word for module
 * On exit:      Update r to alter return values
 *               Return VECTOR_CLAIM to claim (return via stack)
 *               Return VECTOR_PASSON to pass on (return via r14)
 **************************************************************************/
int osword_handler(_kernel_swi_regs *r, void *pw);


/***************************************************************************
 * Function:     osbyte_entry
 * 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 osbyte_entry(void);


/***************************************************************************
 * Function:     osbyte_handler
 * Description:  Vector handler function
 * Parameters:   r  = pointer to register block on entry
 *               pw = private word for module
 * On exit:      Update r to alter return values
 *               Return VECTOR_CLAIM to claim (return via stack)
 *               Return VECTOR_PASSON to pass on (return via r14)
 **************************************************************************/
int osbyte_handler(_kernel_swi_regs *r, void *pw);


/***************************************************************************
 * Function:     palettev_entry
 * 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 palettev_entry(void);


/***************************************************************************
 * Function:     palettev_handler
 * Description:  Vector handler function
 * Parameters:   r  = pointer to register block on entry
 *               pw = private word for module
 * On exit:      Update r to alter return values
 *               Return VECTOR_CLAIM to claim (return via stack)
 *               Return VECTOR_PASSON to pass on (return via r14)
 **************************************************************************/
int palettev_handler(_kernel_swi_regs *r, void *pw);


/***************************************************************************
 * Function:     tickerv_entry
 * 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 tickerv_entry(void);


/***************************************************************************
 * Function:     tickerv_handler
 * Description:  Vector handler function
 * Parameters:   r  = pointer to register block on entry
 *               pw = private word for module
 * On exit:      Update r to alter return values
 *               Return VECTOR_CLAIM to claim (return via stack)
 *               Return VECTOR_PASSON to pass on (return via r14)
 **************************************************************************/
int tickerv_handler(_kernel_swi_regs *r, void *pw);

/* VECTOR_PASSON can be returned from vectors to pass the call on to other
 * handlers. */
#define VECTOR_PASSON (1)
/* VECTOR_CLAIM can be returned from vectors to claim the vector and return
 * with the updated register block. */
#define VECTOR_CLAIM (0)

#ifdef __cplusplus
}
#endif

#endif
