📄 ac48drlo.c
字号:
/************************************************************************/
/* * AudioCodes Ltd. * Copyright (c) 1998 * */
/************************************************************************/
/* File Name: Ac48DrLo.c */
/************************************************************************/
/* DRIVERS PACKET VERSION: 481(1.30) / 480(1.60) / 483(1.00) */
/************************************************************************/
/* 4804 OPERATION SOFTWARE VERSION SUPPORT: */
/* V 1.60 (December 1999) and above */
/************************************************************************/
/* 481xx OPERATION SOFTWARE VERSION SUPPORT: */
/* V 1.30 (October 1999) and above */
/************************************************************************/
/* 4830x OPERATION SOFTWARE VERSION SUPPORT: */
/* V 1.00 (March 2000) and above */
/************************************************************************/
/* PURPOSE : This source file contains the Low Level Driver. */
/* The Low Level Drivers include routines that send */
/* individual commands to the AC48. */
/* */
/* DATE : May 1998 */
/* UPDATE REASON TO UPDATE */
/* ====== ================ */
/* 27/1/99 Voice Attributes, Command additions... */
/* 9/3/99 Change MSig.SignalingS field to SignalingSystem */
/* 5/9/99 Add Ac48xxDecoderDelayCommand() */
/************************************************************************/
#include <memory.h> /* or: #include <string.h> */
#include "Ac48DrHw.h"
#include "Ac48DrHi.h"
#include "Ac48DrDf.h"
/**************************************/
/* Init Mode Commands: */
/**************************************/
/*======================================================================*/
/* Name : Ac48xxPcmCommand */
/*======================================================================*/
/* Purpose : This function sends the AC48 PCM command to the AC48, */
/* to set PCM attributes. */
/* */
/* Inputs : int DeviceIndex: */
/* An integer, performing the device index. */
/* TPcmAttributes *PcmAttributes: */
/* Pointer to the attribute structure. */
/* */
/* TWaitMode WaitMode: */
/* Wait / don't wait for the AC48 to be */
/* ready to deal with a new Command, */
/* which uses the 'AC48xxTransmitPacket' */
/* function. */
/* */
/* Output : int: */
/* ( 0) "AC_OK" for successful operation. */
/* (-1) "PACKET-FULL" detection in */
/* "DONT_WAIT_PACKET_EMPTY" mode. */
/* AC48 is not ready to transmit a new packet */
/* (suitable mode for polling). */
/* ( 2) "STATUS_ERROR" detected by the AC48. */
/*======================================================================*/
int Ac48xxPcmCommand(int DeviceIndex, const TPcmAttributes *PcmAttributes,
TWaitMode WaitMode)
{
TPcmCommand PcmCommand;
PcmCommand.Header.ConstAA=0xAA;
PcmCommand.Header.Const_0_0_8=0;
PcmCommand.Header.InitCommandOpCode=PCM_COMMAND_OP_CODE;
PcmCommand.Header.InitCommandLength = sizeof(TPcmCommand);
PcmCommand.PcmClockDirection = PcmAttributes->PcmClockDirection;
PcmCommand.E1T1 = PcmAttributes->E1T1;
PcmCommand.LawSelect = PcmAttributes->LawSelect;
PcmCommand.FrameSyncPolarity = PcmAttributes->FrameSyncPolarity;
PcmCommand.ClockPolarity = PcmAttributes->ClockPolarity;
PcmCommand.TriState = PcmAttributes->TriState;
PcmCommand.Const_0_2_6=0;
#if AC48_DEVICE == AC4804_DEVICE
PcmCommand.Const_0_2_9=0;
#elif AC48_DEVICE == AC481XX_DEVICE || AC48_DEVICE == AC4830X_DEVICE
PcmCommand.NumberOfTimeSlotes = PcmAttributes->NumberOfTimeSlotes;
PcmCommand.IdlePattern = PcmAttributes->IdlePattern;
PcmCommand.IdlePatternEnable = PcmAttributes->IdlePatternEnable;
#endif /* AC48_DEVICE */
#if AC48_DEVICE == AC4830X_DEVICE
PcmCommand.ClockDivider = PcmAttributes->ClockDivider;
PcmCommand.FrameWidth = PcmAttributes->FrameWidth;
#endif /* AC48_DEVICE */
return Ac48xxTransmitPacket(DeviceIndex, (char*)&PcmCommand,
DEBUG_OFF, WaitMode);
}
/*======================================================================*/
/* Name : Ac48xxDebugCommand */
/*======================================================================*/
/* Purpose : This function sends the Debug Command to the AC48 */
/* device to activate the required debug mode. There are */
/* two driver functions which, according to the debug-mode,*/
/* deal with debug functionality: AC48xxTransmitPacket and */
/* AC48xxReceivePacket. In "DEBUG_ON" mode, both the */
/* packet Checksum and the Sequence number of the packet */
/* are executed. In addition, with "DEBUG_ON_REPORT_ON", */
/* the AC48 adds to the receiving packet, reports about */
/* any Error Flags as a result of the last transmitted */
/* packet and a sequence-number error. */
/* */
/* Inputs : int DeviceIndex: */
/* An integer, performing the device index. */
/* TDebugMode DebugMode: */
/* Debug mode to be used: DebugOff, DebugOn, or */
/* DebugOnReportOn. */
/* TWaitMode WaitMode: */
/* Wait / don't wait for the AC48 to be */
/* ready to deal with a new Command, */
/* which uses the 'AC48xxTransmitPacket' */
/* function. */
/* */
/* Output : int: */
/* ( 0) "AC_OK" for successful operation. */
/* (-1) "PACKET-FULL" detection in */
/* "DONT_WAIT_PACKET_EMPTY" mode. */
/* AC48 is not ready to transmit a new packet */
/* (suitable mode for polling). */
/* ( 2) "STATUS_ERROR" detected by the AC48. */
/*======================================================================*/
int Ac48xxDebugCommand(int DeviceIndex, TDebugingData DebugingData,
TWaitMode WaitMode)
{
TDebugCommand DebugCommand;
DebugCommand.Header.ConstAA=0xAA;
DebugCommand.Header.Const_0_0_8=0;
DebugCommand.Header.InitCommandOpCode=DEBUG_COMMAND_OP_CODE;
DebugCommand.Header.InitCommandLength = sizeof(TDebugCommand);
DebugCommand.DebugingData = DebugingData;
DebugCommand.Const_0_2_2=0;
DebugCommand.Const_0_2_8=0;
return Ac48xxTransmitPacket(DeviceIndex, (char*)&DebugCommand,
DEBUG_OFF, WaitMode);
}
/*======================================================================*/
/* Name : Ac48xxMSigCommand */
/*======================================================================*/
/* Purpose : This Command initialize the MS bit in all channels. */
/* It Send MSIG Command to the AC48 device. */
/* */
/* Inputs : int DeviceIndex: */
/* An integer, performing the device index. */
/* TMSig MSig: */
/* To set 0 or 1 */
/* TWaitMode WaitMode: */
/* Wait / don't wait for the AC48 to be */
/* ready to deal with a new Command, */
/* which uses the 'AC48xxTransmitPacket' */
/* function. */
/* */
/* Output : int: */
/* ( 0) "AC_OK" for successful operation. */
/* (-1) "PACKET-FULL" detection in */
/* "DONT_WAIT_PACKET_EMPTY" mode. */
/* AC48 is not ready to transmit a new packet */
/* (suitable mode for polling). */
/* ( 2) "STATUS_ERROR" detected by the AC48. */
/*======================================================================*/
int Ac48xxMSigCommand(int DeviceIndex, TMSig MSig, TWaitMode WaitMode)
{
TMSigCommand MSigCommand;
MSigCommand.Header.ConstAA=0xAA;
MSigCommand.Header.Const_0_0_8=0;
MSigCommand.Header.InitCommandOpCode=MSIG_COMMAND_OP_CODE;
MSigCommand.Header.InitCommandLength = sizeof(TMSigCommand);
#if AC48_SIGNALING_MODE == AC48_BASIC_SIGNALING_MODE
MSigCommand.IgnoreSignaling = MSig.IgnoreSignaling;
MSigCommand.MSignal = MSig.MSignal;
#elif AC48_SIGNALING_MODE == AC48_EXTENDED_SIGNALING_MODE
MSigCommand.SignalingSystem = MSig.SignalingSystem;
MSigCommand.SignalA = MSig.SignalA;
MSigCommand.SignalB = MSig.SignalB;
MSigCommand.SignalC = MSig.SignalC;
MSigCommand.SignalD = MSig.SignalD;
#endif /* AC48_SIGNALING_MODE */
MSigCommand.RingFrequency = MSig.RingFrequency;
MSigCommand.Const_0_2_2=0;
MSigCommand.Const_0_2_8=0;
return Ac48xxTransmitPacket(DeviceIndex, (char*)&MSigCommand,
DEBUG_OFF, WaitMode);
}
/*======================================================================*/
/* Name : Ac48xxDecoderDelayCommand */
/*======================================================================*/
/* Purpose : This Command initialize . */
/* */
/* */
/* Inputs : int DeviceIndex: */
/* An integer, performing the device index. */
/* TDecoderDelay DecoderDelay: */
/* */
/* TWaitMode WaitMode: */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -