ITC Team,
Here's my action item from the 4-8-04 meeting regarding IM 11.
According to my notes, the following changes were required:
- Send missing scemicommontypes.h which is referenced in each of the
two files
- Correct line 26
- Remove SceMiMessageProxy base class
- GetBitRange() should const
- Default binding should be NULL for input and output binding calls.
The attached files contain all these corrections except for
the second one which I could not remember what needed to be
corrected. Anyone remember ?
-- johnS
This email may contain material that is confidential, privileged
and/or attorney work product for the sole use of the intended
recipient. Any review, reliance or distribution by others or
forwarding without express permission /\
is strictly prohibited. If you are /\ | \
not the intended recipient please | \ / |
contact the sender and delete / \ \
all copies. /\_/ K2 \_ \_
______________________________/\/ \ \
John Stickley \ \ \
Principal Engineer \ \________________
Mentor Graphics - MED \_
17 E. Cedar Place \ john_stickley@mentor.com
Ramsey, NJ 07446 \ Phone: (201) 818-2585
________________________________________________________________
//
// scemi.h - SCE-MI C++ Interface
//
#ifndef INCLUDED_SCEMI
#define INCLUDED_SCEMI
class SceMiParameters;
class SceMiMessageData;
class SceMiMessageInPortProxy;
class SceMiMessageOutPortProxy;
#include "scemicommontypes.h"
class SceMiParameters {
public:
// CREATORS
//
// This constructor initializes some parameters from the
// parameters file in the config directory, and some other
// parameters directly from the config file.
//
SceMiParameters(
const char* configBasePath = "scemi",
SceMiEC* ec = NULL);
~SceMiParameters();
// ACCESSORS
//
// This accessor returns the number of instances of objects of
// the specified objectKind name.
//
unsigned int NumberOfObjects(
const char* objectKind, // Input: Object kind name.
SceMiEC* ec = 0) const; // Input/Output: Error status.
//
// These accessors return an integer or string attribute values of the
// given object kind. It is considered an error if the index > number
// returned by ::NumberOfObjects() or the objectKind and attributeName
// arguments are unrecognized.
//
int AttributeIntegerValue(
const char* objectKind, // Input: Object kind name.
unsigned int index, // Input: Index of object instance.
const char* attributeName, // Input: Name of attribute being read.
SceMiEC* ec = NULL) const; // Input/Output: Error status.
const char* AttributeStringValue(
const char* objectKind, // Input: Object kind name.
unsigned int index, // Input: Index of object instance.
const char* attributeName, // Input: Name of attribute being read.
SceMiEC* ec = NULL) const; // Input/Output: Error status.
// MANIPULATORS
//
// These manipulators override an integer or string attribute values of the
// given object kind. It is considered an error if the index > number
// returned by ::NumberOfObjects(). or the objectKind and attributeName
// arguments are unrecognized.
//
void OverrideAttributeIntegerValue(
const char* objectKind, // Input: Object kind name.
unsigned int index, // Input: Index of object instance.
const char* attributeName, // Input: Name of attribute being read.
int value, // Input: New integer value of attribute.
SceMiEC* ec = NULL); // Input/Output: Error status.
void OverrideAttributeStringValue(
const char* objectKind, // Input: Object kind name.
unsigned int index, // Input: Index of object instance.
const char* attributeName, // Input: Name of attribute being read.
const char* value, // Input: New string value of attribute.
SceMiEC* ec = NULL); // Input/Output: Error status.
};
//
// class SceMiMessageInPortProxy
//
// Description
// -----------
// The class SceMiMessageInPortProxy presents a C++ proxy for a transactor
// message input port. The input channel to that transactor is represented
// by the Send() method.
//
class SceMiMessageInPortProxy : public SceMiMessagePortProxy {
public:
// ACCESSORS
const char* TransactorName() const;
const char* PortName() const;
const unsigned PortWidth() const;
//
// This method sends message to the transactor input port.
//
void Send(
const SceMiMessageData &data, // Message payload to be sent.
SceMiEC* ec = NULL);
//
// Replace port binding.
// The binding argument represents a callback function and context
// pointer tray (see comments in scemicommontypes.h for struct
// SceMiMessageInPortBinding).
//
void ReplaceBinding(
const SceMiMessageInPortBinding* binding = NULL,
SceMiEC* ec = NULL);
};
//
// class SceMiMessageOutPortProxy
//
// Description
// -----------
// The class SceMiMessageOutPortProxy presents a C++ proxy for a transactor
// message output port.
//
class SceMiMessageOutPortProxy : public SceMiMessagePortProxy {
public:
// ACCESSORS
const char* TransactorName() const;
const char* PortName() const;
const unsigned PortWidth() const;
//
// Replace port binding.
// The binding argument represents a callback function and context
// pointer tray (see comments in scemicommontypes.h for struct
// SceMiMessageOutPortBinding).
//
void ReplaceBinding(
const SceMiMessageOutPortBinding* binding = NULL,
SceMiEC* ec = NULL);
};
//
// class SceMiMessageData
//
// Description
// -----------
// The class SceMiMessageData represents a fixed length array of data which
// is transferred between models.
//
class SceMiMessageData {
public:
// CREATORS
//
// Constructor: The message in port proxy for which
// this message data object must be suitably sized.
//
SceMiMessageData(
const SceMiMessageInPortProxy& messageInPortProxy,
SceMiEC* ec = NULL);
~SceMiMessageData();
// Return size of vector in bits
unsigned WidthInBits() const;
// Return size of array in 32 bit words.
unsigned WidthInWords() const;
void Set( unsigned i, SceMiU32 word, SceMiEC* ec = NULL);
void SetBit( unsigned i, int bit, SceMiEC* ec = NULL);
void SetBitRange(
unsigned int i, unsigned int range, SceMiU32 bits, SceMiEC* ec = NULL);
SceMiU32 Get( unsigned i, SceMiEC* ec = NULL) const;
int GetBit( unsigned i, SceMiEC* ec = NULL) const;
SceMiU32 GetBitRange(
unsigned int i, unsigned int range, SceMiEC* ec = NULL) const;
SceMiU64 CycleStamp() const;
};
//
// class SceMi
//
// Description
// -----------
// This file defines the public interface to class SceMi.
//
class SceMi {
public:
//
// Check version string against supported versions.
// Returns -1 if passed string not supported.
// Returns interface version # if it is supported.
// This interface version # can be passed to SceMi::Init().
//
static int Version(
const char* versionString);
//
// This function wraps constructor of class SceMi. If an instance
// of class SceMi has been established on a prior call to the
// SceMi::Init() function, that pointer is returned since a single
// instance of class SceMi is reusable among all C models.
// Returns NULL if error occurred, check ec for status or register
// an error callback.
//
// The caller is required to pass in the version of SceMi it is
// expecting to work with. Call SceMi::Version to convert a version
// string to an integer suitable for this version's "version" argument.
//
// The caller is also expected to have instantiated a SceMiParameters
// object, and pass a pointer to that object into this function.
//
static SceMi*
Init(
int version,
const SceMiParameters* parameters,
SceMiEC* ec = NULL);
//
// Shut down the SCEMI interface.
//
static void
Shutdown(
SceMi* mct,
SceMiEC* ec = NULL);
//
// Create proxy for message input port.
//
// Pass in the instance name in the bridge netlist of
// the transactor and port to which binding is requested.
//
// The binding argument is a callback function and context
// pointer tray. For more details, see the comments in
// scemicommontypes.h by struct SceMiMessageInPortBinding.
//
SceMiMessageInPortProxy*
BindMessageInPort(
const char* transactorName,
const char* portName,
const SceMiMessageInPortBinding* binding,
SceMiEC* ec = NULL);
//
// Create proxy for message output port.
//
// Pass in the instance name in the bridge netlist of
// the transactor and port to which binding is requested.
//
// The binding argument is a callback function and context
// pointer tray. For more details, see the comments in
// scemicommontypes.h by struct SceMiMessageOutPortBinding.
//
SceMiMessageOutPortProxy*
BindMessageOutPort(
const char* transactorName,
const char* portName,
const SceMiMessageOutPortBinding* binding,
SceMiEC* ec = NULL);
//
// Service arriving transactions from the portal.
// Messages enqueued by SceMiMessageOutPortProxy methods, or which are
// are from output transactions that pending dispatch to the
// SceMiMessageOutPortProxy callbacks, may not be handled until
// ServiceLoop() is called. This function returns the # of output
// messages that were dispatched.
//
// Regarding the service loop handler (aka "g function"):
// If g is NULL, check for transfers to be performed and
// dispatch them returning immediately afterwards. If g is
// non-NULL, enter into a loop of performing transfers and
// calling 'g'. When 'g' returns 0 return from the loop.
// When 'g' is called, an indication of whether there is at
// least 1 message pending will be made with the 'pending' flag.
//
// The user context object pointer is uninterpreted by
// ServiceLoop() and is passed straight to the 'g' function.
//
int
ServiceLoop(
SceMiServiceLoopHandler g = NULL,
void* context = NULL,
SceMiEC* ec = NULL);
//
// Register an error handler which is called in the event
// that an error occurs. If no handler is registered, the
// default error handler is called.
//
static void
RegisterErrorHandler(
SceMiErrorHandler errorHandler,
void* context);
//
// Register an info handler which is called in the event
// that a text message needs to be issued. If no handler
// is registered, the message is printed to stdout in
// Ikos message format.
//
static void
RegisterInfoHandler(
SceMiInfoHandler infoHandler,
void* context);
};
#endif
/*
* scemicommontypes.h
*
* This file defines commonly used types between the C++ scemi.h
* header file and the ANSI C scemi.h header file. Each of those
* header files includes this file. This file should not be included
* directly by SCEMI clients applications. Rather, those applications
* should include the appropriate scemi.h.
*/
#ifndef INCLUDED_SCEMICOMMONTYPES
#define INCLUDED_SCEMICOMMONTYPES
#include<stdlib.h>
/* 32 bit unsigned word type for building and reading messages */
typedef unsigned SceMiU32;
/* 64 bit unsigned word used for CycleStamps */
typedef unsigned long long SceMiU64;
#ifndef __cplusplus
typedef int bool;
#endif
typedef int (*SceMiServiceLoopHandler)(void* context, bool pending);
/*
* struct SceMiEC - SceMi Error Context
*/
typedef enum {
SceMiOK = 0,
SceMiError = 1
} SceMiErrorType;
typedef struct {
const char* Culprit; /* The offending function */
const char* Message; /* Descriptive message describing problem */
SceMiErrorType Type; /* Error code describing the nature of the error */
int Id; /* A code to uniquely identify each error */
} SceMiEC;
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*SceMiErrorHandler)(void* context, SceMiEC* ec);
#ifdef __cplusplus
}
#endif
/*
* struct SceMiIC - SceMi Informational Message Context
*/
typedef enum {
SceMiInfo = 0,
SceMiWarning = 1,
SceMiNonFatalError = 2
} SceMiInfoType;
typedef struct {
const char* Originator;
const char* Message;
SceMiInfoType Type;
int Id;
} SceMiIC;
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*SceMiInfoHandler)(void* context, SceMiIC* ic);
#ifdef __cplusplus
}
#endif
/*
* struct SceMiMessageInPortBinding
*
* Description
* -----------
* This structure defines a tray of callback functions that support
* propagation of message input readiness back to the software.
*
* If an input ready callback is registered (optionally) on a given
* input port, the port will dispatch the callback whenever becomes
* ready for more input.
*
* Note: All callbacks must take their data and return promptly as they
* are called possibly deep down in a non-preemptive thread. Typically,
* the callback might to some minor manipulation to the context object
* then return and let a suspended thread resume and do the main processing
* of the received transaction.
*/
typedef struct {
/*
* This is the user's context object pointer.
* The application is free to use this pointer for any purposes it
* wishes. Neither the class SceMi nor class MessageInputPortProxy do
* anything with this pointer other than store it and pass it when
* calling functions.
*/
void* Context;
/*
* Receive a response transaction. This function is called when data
* from the message output port arrives. This callback acts as a proxy
* for the message output port of the transactor.
*/
void (*IsReady)(
void* context);
/*
* This function is called from the MessageInputPortProxy destructor
* to notify the user code that the reference to the 'context' pointer
* has been deleted.
*/
int (*Close)(
void* context);
} SceMiMessageInPortBinding;
/*
* struct SceMiMessageOutPortBinding
*
* Description
* -----------
* This structure defines a tray of callback functions are passed to the class
* SceMi when the application model binds to a message output port proxy and
* which are called on message receipt and close notification. It is the means
* by which the MessageOutputPort forwards received transactions to the C model.
*
* Note: All callbacks must take their data and return promptly as they
* are called possibly deep down in a non-preemptive thread. Typically,
* the callback might to some minor manipulation to the context object
* then return and let a suspended thread resume and do the main processing
* of the received transaction.
*
* Additionally, the message data passed into the receive callback is
* not guaranteed to remain the same once the callback returns. All
* data therein then must be processed while inside the callback.
*/
typedef struct {
/*
* This is the user's context object pointer.
* The application is free to use this pointer for any purposes it
* wishes. Neither the class SceMi nor class SceMiMessageOutPortProxy do
* anything with this pointer other than store it and pass it when
* calling callback functions Receive and Close.
*/
void* Context;
/*
* Receive a response transaction. This function is called when data
* from the message output port arrives. This callback acts as a proxy
* for the message output port of the transactor.
*/
void (*Receive)(
void* context,
const SceMiMessageData* data);
/*
* This function is called from the MessageOutputPortProxy destructor
* to notify the user code that the reference to the 'context' pointer
* has been deleted.
*/
int (*Close)(
void* context);
} SceMiMessageOutPortBinding;
#endif // INCLUDED_SCEMICOMMONTYPES
Received on Tue Apr 27 12:51:52 2004
This archive was generated by hypermail 2.1.8 : Tue Apr 27 2004 - 12:52:01 PDT