libvpb  4.2.61
Comm Class Reference
Collaboration diagram for Comm:
Collaboration graph

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. More...
 
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. More...
 
void PutMessageVPB (unsigned short board, uint16_t *mess)
 Send a message to the DSP message queue. More...
 
int GetMessageVPB (unsigned short board, uint16_t *mess)
 Gets a message from the DSP message queue. More...
 
void WaitForMessageVPB (unsigned short board, uint16_t *mess, unsigned short mtype, unsigned short wait)
 Wait for a DSP message of a certain type. More...
 
const VPBHANDLELookupHandle (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.
 
VPBREGvpbreg (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.

References VPBRegister::GetCountryCode().

Referenced by VTCore::Reset().

◆ 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
boardThe VPB board number.
messA 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, VPBRegister::GetBoardCount(), 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
boardThe VPB board number.
messA 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 V4PCIToneGen::ImplStart(), V4PCIToneGen::ImplStop(), ring_station_async(), set_codec_reg(), V4PCI_DSP::SetHookState(), and OpenPri::SetHookState().

◆ 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
boardThe VPB board number.
messA pointer to storage for the message. It must be sufficient to store the desired message.
mtypeThe type of message to wait for.
waitThe number of seconds to wait for it.
Exceptions
Wobblywill be thrown if the wait time elapses and the message has not been received.

References GetMessageVPB(), and Timer::start().