⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 armul_method.h

📁 realview22.rar
💻 H
字号:
/*
 * armul_method.h
 *
 * Copyright (C) 1996-2000 ARM Limited. All rights reserved. 
 * RCS $Revision: 1.1.2.3.18.1.2.1 $
 * Checkin $Date: 2003/07/07 13:09:33 $
 * Revising $Author: dsinclai $
 */

#ifndef armul_method__h
#define armul_method__h

#if defined(__cplusplus) && !defined(CLX_CPP_LINKAGE)
extern "C" {
#endif

typedef int GenericMethodFunc(void *handle, void *index, void *data);
typedef struct { GenericMethodFunc *func; void *handle; } GenericMethod;

typedef struct { char const *name; GenericMethodFunc *func;} NamedMethodFunc;

/* Returns 0: Ok else error. */
typedef int InterfaceSourceFunc(void *handle, char const *TypedName, GenericMethod *cb);
/*
 * RDIInfo#QueryInterfaceSource takes an InterfaceID and returns (as *arg2)
 *  a GenericMethod whose function is an InterfaceSourceFunc.
 * An InterfaceID is the name of a port on an instance. (!WIP!)
 */
typedef struct { InterfaceSourceFunc *func; void *handle; } InterfaceSource;

/*
 * Function: FindMethodInterface
 * Purpose: A helper for RDIInfo-functions to implement QueryInterfaceSource,
 *           or for interface-sources themselves.
 * Parameters:
 *      Out: arg2 - has it's handle and func filled in.
 *       In: arg1 - name of interface element.
 *         handle - data handle to fill into arg2.
 *             mf - array of named methods to search in.
 * Returns 0 if Ok, else RDIError_UnimplementedMessage.
 */
extern int FindMethodInterface(GenericMethod *arg2, char const *arg1,
                               void *handle,NamedMethodFunc *mf);



/* As above, but returns pointer to text for pin-number, or NULL. */
char const *
FindPinMethod(GenericMethod *arg2, char const *arg1, char const *instname,
              void *handle,NamedMethodFunc *mf);


/* Purpose: allow, during configuration, a slow generic method-call to be made
 *          though an interface. (Makes configuration code simpler, at the
 *          expense of config-time speed.)
 * Parameters:
 *          arg1,arg2 - arguments for function fetched from interface.
 *       In: 
 */
extern int CallThroughInterfaceSource(InterfaceSource *ifsrc,
                                      char const *TypedName,
                                      void *arg1, void *arg2);

/* These are for use while invoking CALL_IFSRC_FN,
 * to package a set of parameters into one macro-parameters.
 * This relies on the C pre-processor expanding macro-parameters during
 * the macro-expansion, not before.
 * VC6, gccsolrs and the hpux compiler all satisfy that requirement,
 * and, since it's the cheapest way to implement a pre-processor, I
 * shall assume that all the C comnpilers we use do so.
 */
#define P2(x,y) x,y
#define P3(x,y,z) x,y,z
#define P4(x,y,z,t) x,y,z,t


/* Purpose: As CallThroughInterfaceSource, but allows a wider variety of 
 *    function-types to be called, and is more type-safe (but costs more code).
 * Parameters:
 *      Out: rv1 - RDIError if ifsrc cannot give you the required method,
 *                 else 0.
 *           rv2 - return value of the method.
 *       In: id  - name of interface-function, less the type, in quotes.
 *          type - type of interface function.
 *
 * Preconditions: ifsrc != NULL && ifsrc->func != NULL.
 * Notes: If params is more than one parameter,
 *        use one of the Pn macros above.
 */

#define CALL_IFSRC_FN(rv1,rv2,ifsrc,id,type,params) \
  {  GenericMethod cif_gm; \
        if ((rv1 = ifsrc->func(ifsrc->handle, id ":" #type, &cif_gm)) == 0 && \
                cif_gm.func != NULL) \
                rv2 = ((type*)(cif_gm.func))(cif_gm.handle,params);\
    else\
        rv1 = RDIError_UnimplementedMessage;\
   }
/* As above, but function has void return type. */
#define CALL_IFSRC_PROC(rv1,ifsrc,id,type,params) \
  {  GenericMethod cif_gm; \
        if ((rv1 = ifsrc->func(ifsrc->handle, id ":" #type, &cif_gm)) == 0 && \
                cif_gm.func != NULL) \
                ((type*)(cif_gm.func))(cif_gm.handle,params);\
    else\
        rv1 = RDIError_UnimplementedMessage;\
   }



#if defined(__cplusplus) && !defined(CLX_CPP_LINKAGE)
}
#endif

#endif /* ndef armul_method__h */
/* EOF armul_method.h */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -