Loading...
Searching...
No Matches
Comm Class Reference
Collaboration diagram for Comm:

## Public Member Functions

| Comm ()
| Constructor. The `InitBoards()` method actually opens the comm links.
| ~Comm ()
| Closes down the comm link to the VPBs.
void | InitBoards ()
| Second stage initialisation.
unsigned int | GetBoardCount () const
| Return the total number of VPB boards currently registered.
unsigned int | GetCountryCode () const
| Return the global country code from vpb.conf.
void | PutMessageVPB (unsigned short board, uint16_t *mess)
| Send a message to the DSP message queue.
int | GetMessageVPB (unsigned short board, uint16_t *mess)
| Gets a message from the DSP message queue.
void | WaitForMessageVPB (unsigned short board, uint16_t *mess, unsigned short mtype, unsigned short wait)
| Wait for a DSP message of a certain type.
const VPBHANDLE & | LookupHandle (int handle) const
| Look up the `VPBHANDLE` entry for handle.
int | NewHandle (int board, int port)
| Return a new handle for a port on some board.
VPBREG * | vpbreg (unsigned short board)
| Return a pointer to the `VPBREG` structure for some board.

## Member Function Documentation

## GetCountryCode()

unsigned int Comm::GetCountryCode | ( |  | ) | const

inline

Return the global country code from vpb.conf.

If no global country code was configured there, it will return 0.

## GetMessageVPB()

int Comm::GetMessageVPB | ( | unsigned short | board,
|  | uint16_t * | mess )

Gets a message from the DSP message queue.

The length of the message is stored in its first word.

Parameters

  board | The VPB board number.
  mess | A pointer to storage for the message.

Returns
  `VPB_OK` if a message was read, else `COMM_EMPTY` if no messages were in the queue.

Warning
  NEVER call this function. It is only safe to be called from a single thread at a time and the `MonitorMessageQueue` thread already has that privilege.

References DD_PCI, VPBREG::ddmodel, VPBREG::hostdsp, and VPBREG::upmess.

Referenced by WaitForMessageVPB().

## InitBoards()

void Comm::InitBoards | ( |  | ) |

Second stage initialisation.

This permits the board specific code to access the global `Comm` object and the `VPBRegister` during their initialisation.

References VPBREG::cardnum, VPBREG::cardtypnum, VPBREG::model, VPB_OPCI, VPB_OSW, VPB_PRI, VPB_V4LOG, and VPB_V4PCI.

## PutMessageVPB()

void Comm::PutMessageVPB | ( | unsigned short | board,
|  | uint16_t * | mess )

Send a message to the DSP message queue.

Parameters

  board | The VPB board number.
  mess | A pointer to the message to send. Its length is in the first word.

References DD_PCI, VPBREG::ddmodel, VPBREG::dnmess, and VPBREG::hostdsp.

Referenced by set_codec_reg().

## WaitForMessageVPB()

void Comm::WaitForMessageVPB | ( | unsigned short | board,
|  | uint16_t * | mess,
|  | unsigned short | mtype,
|  | unsigned short | wait )

Wait for a DSP message of a certain type.

Messages of other types are discarded.

Parameters

  board | The VPB board number.
  mess | A pointer to storage for the message. It must be sufficient to store the desired message.
  mtype | The type of message to wait for.
  wait | The number of seconds to wait for it.

Exceptions

  Wobbly | will be thrown if the wait time elapses and the message has not been received.

References Timer::check_timeout(), DD_PCI, VPBREG::ddmodel, GetMessageVPB(), VPBREG::hostdsp, and Timer::start().