HiDEOS User Messages and Classes Manual

IpModule
IP_ID_PROM
IpManager
ip_task_map
ip_modules.h
ip_modules.cc

LongMsg
StringMsg
DirectStringMsg
IndirectStringMsg
AdcMsg
SerialConfigMsg

AdcTask
aiTask
bpTask
SerialTask
OctalUartTask

Reference Manual
Generated Header Files


IpModule

This class manipulates an industry pack slot.

#include "task/ipic.h"

IpModule(char slot,unsigned short* mem_start,unsigned long mem_size);
Construct an IpModule for slot slot. Allocate D32 memory for the industry pack starting at mem_start for a length of mem_size. This method is only used by the IPIC controller class IpManager.

void MemSpaceOn();
void MemSpaceOff();
Disable and enable the extended memory space (D32).

void DataWidth(int width);
Set the data path width to the industry pack. The MVME162 uses 16 bits. Valid settings here are 32, 16, and 8 bits.

void RecoveryTimer(int usec);
Set the bus recovery timer of this slot to 0, 2, 4, or 8 microseconds.

int ErrStatus();
Return the slot controller error status.

void IntLevelSensitive(int num);
void IntEdgeSensitive(int num);
void IntLowLevelTriggered(int num);
void IntHighLevelTriggered(int num);
void IntFallingEdgeTriggered(int num);
void IntRisingEdgeTriggered(int num);
Each slot can interrupt on two different lines, num is 0 for IRQ0 and 1 for IRQ1. Set the interrupt trigger type for each of the interrupt request lines. To use interrupts, the type (level/edge) should be set, and the direction (low/high or rising/falling).

void IntSetLevel(int num,int level);
Set the interrupt level for the corresponding interrupt request line. The value of num is the same as above.

void IntClear(int num);
Clear the interrupt condition for the coresponding interrupt request line. This must be invoked first in an industry pack interrupt handler if the interrupt is edge sensitive.

void IntClear(void);
Clear the interrupt condition for both interrupt request lines (IRQ0,IRQ1). This must be invoked first in an industry pack interrupt handler if the interrupts is edge sensitive. This is useful if there is one interrupt handler for both IRQ lines and it cannot easily be determined which caused the interrupt.

void IntEnable(int num);
void IntDisable(int num);
Enable and disable the corresponding interrupt request lines.

int IntStatus(int num);
Return 1 if there is a pending interrupt condition on IRQ line num. Return 0 if there is not an interrupt condition.

int IntIsEnabled(int num);
Return 1 if the corresponding IRQ line num is enabled. Return 0 if it is not.

void Reset();
Reset the industry pack. Only this slot will be reset.

int SetFlag();
This method can be used to identify if initialization has been done. Many tasks can be manipuling the industry pack. At initialization time, all tasks can try to do SetFlag(), only the first will succeed and perform global initialization of this industry pack. Return code of -1 indicates the flag has been set, return code of 0 indicates the flag was not set (and is now).

unsigned short* GetMemSpace();
Get a pointer to the industry pack's memory space. All HiDEOS memory space for industry packs is allocated automatically in D32.

unsigned short* GetIoSpace();
Get a pointer to the industry pack's I/O space. This is the general register area for the industry pack, all industry packs define this fixed size space. See the particular industry pack documentation for the register layout.

IP_ID_PROM* GetIdSpace();
Get a pointer to the industry pack's ID space. All industry packs have an PROM which contains identification information such as make/model and memory requirements. See each industry pack documentation and the IP_ID_PROM structure for information contained here.

char GetSlot();
Return the slot identifier. The valid slots on the MVME162 are 'a','b','c', and 'd'.

int GetIntBlock(int num);
This class dynamically allocates interrupt vectors. This method can be used to reserve a contiguous block of interrupt vectors aligned to num byte boundary. The return value is the first interrupt vector of the block.

int GetIntVector();
This class dynamically allocates interrupt vectors. This method can be used to get an interrupt vector for this industry pack.


IP_ID_PROM

The definition of the generic portion of the industry pack ID prom. The ID PROM space on an industry pack is 64 bytes. The first 22 bytes are defined by a standard and this structure, the rest are user defined.

#include "task/ipic.h"

unsigned char ascii_1; = 'I'
unsigned char ascii_2; = 'P'
unsigned char ascii_3; = 'A'
unsigned char ascii_4; = 'C'

unsigned char manufacturer_id;
unsigned char model_id;

unsigned char revision;
unsigned char reserved;

unsigned char driver_id_low;
unsigned char driver_id_high;

unsigned char num_bytes_used;

unsigned char user_stuff[64-22];


IpManager

This is the overall industry pack controller. This class starts registered drivers for industry packs is recognizes. This manager if not started automatically by the system, the user must create one instance of it in the user initialization routine. The manager will pass the IpModule instance to the driver constructor. See the main HiDEOS document.

#include "task/ipic.h"

IpManager(int interrupt_block_start);
Construct the IpManager. Interrupt vectors will be allocated starting at interrupt_block_start. This constructor probes the industry pack slots for the make/model in the ID PROM and starts a driver for the slot if it recognizes the make/model.

IpModule* GetModule(char slot);
Return the IpModule for slot slot if an industry pack is installed in that slot.


ip_task_map

This is the database structure of the IpManager. Users register industry pack drivers with the IpManager by defining an entry in the IpManager database using this structure.

#include "task/ip_modules.h"

typedef Task* (*TASK_CREATE_FUNC)(const char*,IpModule*);

int man;
The manufacture ID (make) of the industry pack that is to be recognized.

int model;
The model number of the industry pack that is to be recognized.

char* name;
The suffix portion of the name assigned by the IpManager. The IpManager automatcally assigns driver names, this is the user portion of that name.

TASK_CREATE_FUNC make_task;
A pointer to the user defined function that creates the driver for this industry pack make/model. The IpManager will call this function with two parameters, the assigned name and the IpModule when it finds an industry pack matching the make/model.

unsigned long mem_size;
The D32 RAM needed by the industry pack. This is the number of 64KB chunks needed. Industry pack memory is allocated in 64KB chunks.


ip_modules.h

This is the header file containing the cpp defines for industry pack makes, models, and user assigned names. Adding a new driver to the IpManager will usually require editting this file to add new model numbers and names.

#include "task/ip_modules.h"


ip_modules.cc

The IpManager database is defined here along with the industry pack driver creation functions (TASK_CREATE_FUNC). Users are required to edit this file when adding a new industry pack controller. Be sure to include the driver's header file, and define a function that will create an instance of the driver when called.

task/ip_modules.cc

IP_TASK_MAP IpTaskMap[];
This is the database used by the IpManager. There is one ip_task_map line here for each industry pack driver in the system.


LongMsg

A generic message for sending and receiving a long value.

#include "msg/long_msg.h"

long return_code;
A user defined return code generally used to indicate transaction success, or failure such as timeout or device not available.

long time_out;
The transaction time-out value usually expressed in milliseconds. All HiDEOS message handlers should honor the timeout parameter.

long status;
This is the device specific status.

long cmd;
Device specific outgoing command information

long address;
Device specific addressing information.

unsigned long value;
Value to send to a device or value returned from the device.


StringMsg

A generic base class message for sending and receiving strings.

#include "msg/string_msg.h"

void SetSimpleDelimiter(unsigned char);
Set a one character delimiter for a transaction that performs a read. The transaction will terminate when this delimiter appears.

void SetComplexDelimiter(char* d, char* mask, int len);
Set a mult-character delimiter string d (up to 4 bytes) for a transaction that performs a read. The transaction will terminate when this delimiter string appears. Len is the length of the delimiter string. Mask is a character string the same size as d. The mask allows for masking characters in the delimiter string, each byte in the mask that is NULL indicates to ignore the corresponding delimiter byte. Example: delimiter="abcd", mask={0xff,0x00,0xff,0xff}, len=4 means match any string "a*cd" where * is any character. To set no delimiter currently requires a call to this method with NULLs for d and mask, and a length of zero.

int GetDelimiterLegnth();
char* GetDelimiter();
char* GetMask();
Return information about the delimiter.

char TransType();
Return the transaction type.

void SetRead();
void SetWrite();
void SetWriteRead();
void SetPurgeWriteRead();
Set the type of transaction.

int return_code;
The transaction return code.

int time_out;
The transaction time-out value expressed in milliseconds.


DirectStringMsg

A message for sending and receiving strings where the data is located within the message. This is a subclass of StringMsg.

#include "msg/string_msg.h"

int SetBuffer(unsigned char* buf,int length);
Put the data from buf into the message's data buffer. Length bytes will be copied.

void GetData(int& size,unsigned char*& buf);
Return a pointer to the message's data buffer in buf, return the buffer length in size.

void SetLength(int length);
Set the number of bytes in the message's data buffer.

int GetMaxLength();
Return the maximum length string that can be stored in the message's data buffer.


IndirectStringMsg

A message for sending and receiving strings where the data is located in user allocated buffers, only the buffer addresses are passed to HiDEOS. This is a subclass of StringMsg.

#include "msg/string_msg.h"

void SetBuffers(unsigned char* src,int ssize,unsigned char* dest,int dsize);
Set up the input/output buffer locations and there sizes in the message.

void GetSourceData(unsigned char*& src, int& ssize);
Get the source data buffer location and the size of it.

void GetDestData(unsigned char*& dest, int& dsize);
Get the destination data buffer location and the size of it.

int GetDestSize();
void SetDestSize(int l);
Get and set the size of the destination data buffer.


AdcMsg

This is a message for sending data to an ADC. This is a subclass of LongMsg.

#include "msg/adc_msg.h"

int SetGain(int value);
int Gain();
Set the gain value for the ADC. The value is determined by the ADC. Return the gain setting.

int Gain();
Set the gain value for the ADC. The value is determined by the ADC.

int SetChannel(int value);
int Channel()
Set the channel to read from to be value. Return the channel setting.

int SetTypeDifferential();
int SetTypeSingleEnded();
int TypeDifferential();
int TypeSingleEnded();
Set the channel type to single ended or differential. Find out the channel type.


SerialConfigMsg

This is a message for configuring a serial port.

#include "msg/serial_config_msg.h"

char Parity();
void SetEvenParity();
void SetOddParity();
void SetParityNone();
Functions for setting up and determining the parity.

int Baud();
void SetBaud(int b);
Functions for setting and determining the baud rate.

int StopBits();
void SetStopBits(int b);
Functions for setting and determining the number of stop bits.

char FlowControl();
void SetFlowHardware();
void SetFlowNone();
Functions for setting and determining the type of flow control.

int BitsPerCharacter();
void SetBitsPerCharacter(int b);
Functions for setting and determining the number of bits per character.

int return_code;
The return code code from the configuration request.


AdcTask

Run the Green Strings IP-Precision ADC (12 bit).

#include "task/adctask.h"

AdcTask(const char* name, IpModule* ip);
Constructor designed to be called by the IpManager. Automatically registered name in the HiDEOS system, Ip is the industry pack control class instance for the slot in which the ADC is installed.

virtual void Receive(Message*);
This method decodes and executes the AdcMsg.

unsigned short ReadAdc();
Read the raw value off the ADC.

long GetValue();
Read the corrected value off the ADC.


aiTask

Test task to increment a counter and send it's value back to the caller.

#include "task/ai.h"

AdcTask(const char* name);
Construct an AdcTask with name name, clear the counter.

virtual void Receive(Message*);
Decode and execute the LongMsg.


bpTask

The backplane communication task and message router.

#include "task/bptask.h"

bpTask(const char* name);
Construct an bpTask with name name. Initialize the backplane communication interface.

virtual void Receive(Message*);
This method forwards all messages across the backplane except BindMsg. The BindMsg is directly interpreted here.


SerialTask

The driver for the Green Springs IP-Serial dual UART (8530). There is one instance of this driver per UART port. The octal and quad drivers have identical functionality.

#include "task/serialtask.h"

typedef int (*BYTE_HANDLER)(void* parm,unsigned char& byte,int type);

SerialTask(const char* name,int,unsigned char*,int,IpModule*);
Construct an SerialTask with name name. This is only called by the IpManager driver creation function.

virtual void Receive(Message*);
This method decodes DirectStringMsg, IndirectStringMsg, and SerialConfigMsg.

void Config(baud,char parity,stop_bits,bits_char,char flow_control);
Set the port options. Parity is 'E' for even, 'N' for none, or 'O' for odd. Flow_control is 'H' for hardware, 'N' for none.

void SetModeRS485();
void SetModeRS232();
Set the operating mode to be RS485 or RS232. RS485 is set up for multi-drop operation, so it is run in half-duplex mode.

void SetByteHandler(void* parm,BYTE_HANDLER func);
Install a private receive byte handler. The function func is invoked at interrupt level with parameter parm along with the incoming byte. Func will return 0 if the interrupt handler should proceed normally, 1 to end a pending transaction if one is present, or -1 to throw away the current byte. The type parameter of func indicates the caller. A type of 0 indicates the interrupt service routine, the type of 1 indicates the serial driver task.

RingBuffer* GetRingBuffer();
Simple way to get access to the ring buffer within the byte handler function.


Argonne National Laboratory Copyright Information
Jim Kowalkowski ([email protected])
updated 4/12/95