コード例 #1
0
ファイル: vp790_init.c プロジェクト: 12019/bcm63xx-phone
/**
 * Vp790InitDeviceObject()
 *  This function initializes the Vp790 Device object data structure. It is
 * called only in this file .
 */
static void
Vp790InitDeviceObject(
    Vp790DeviceObjectType *pDevObj)
{
    VpMemSet(pDevObj, 0, sizeof(Vp790DeviceObjectType));
    pDevObj->staticInfo.maxChannels = 4;
}
コード例 #2
0
VpStatusType
Vp792MakeLineObject(
    VpTermType termType,
    uint8 channelId,
    VpLineCtxType *pLineCtx,
    void *pVoidLineObj,
    VpDevCtxType *pDevCtx)
{
    Vp792LineObjectType *pLineObj = pVoidLineObj;
    Vp792DeviceObjectType *pDevObj = pDevCtx->pDevObj;

    /* Basic error checking */
    if (channelId >= pDevObj->maxChannels) {
        return VP_STATUS_INVALID_ARG;
    }

    switch (termType) {
        /* Internal ringing line termination types: */
        case VP_TERM_FXS_GENERIC:
        case VP_TERM_FXS_TI:
            break;

#if 0
        /* External ringing line termination types: */
        case VP_TERM_FXS_75282:
        case VP_TERM_FXS_RR:
        case VP_TERM_FXS_LCAS:
        case VP_TERM_FXS_RR_TI:
            break;
#endif

        default:
            return VP_STATUS_ERR_VTD_CODE;
    }

    /* Start with a clean slate. */
    VpMemSet(pLineObj, 0, sizeof(Vp792LineObjectType));

    /* Initialize line context */
    pLineCtx->pLineObj = pLineObj;

    /* Establish the links between device context and line context */
    pLineCtx->pDevCtx = pDevCtx;
    pDevCtx->pLineCtx[channelId] = pLineCtx;

    /* Initialize line object */
    pLineObj->termType = termType;
    pLineObj->channelId = channelId;
    pLineObj->options.debugSelect = VP_OPTION_DEFAULT_DEBUG_SELECT;
    pLineObj->metering.active = FALSE;
    pLineObj->metering.eventRate = 1;

    /* Note that we are not initializing the 'lineId' member because we do not
       know what the value should be; that information is not provided through
       the VpMakeLineObj() function).  Furthermore, VpLineIdType is defined by
       the customer, so it is impossible for us to know what a logical default
       would be.  VpMapLineId() should be called after this function. */

    return VP_STATUS_SUCCESS;
} /* VpMakeVp792LineObject() */
コード例 #3
0
/*******************************************************************************
 * Vp890InitDeviceObject()
 *  This function initializes the Vp890 Device object data structure. It is
 * called only in this file .
 ******************************************************************************/
static void
InitDeviceObject(
    Vp890DeviceObjectType *pDevObj)
{
    VpMemSet(pDevObj, 0, sizeof(Vp890DeviceObjectType));

    pDevObj->staticInfo.maxChannels = VP890_MAX_NUM_CHANNELS;

    /* Initialize the debug mask as soon as the device object in created */
    pDevObj->debugSelectMask = VP_OPTION_DEFAULT_DEBUG_SELECT;
} /* Vp890InitDeviceObject() */
コード例 #4
0
VpStatusType
Vp792MakeDeviceObject(
    VpDevCtxType *pDevCtx,
    Vp792DeviceObjectType *pDevObj)
{

    /* Start with a clean slate. */
    VpMemSet(pDevObj, 0, sizeof(Vp792DeviceObjectType));

    pDevObj->maxChannels = VP792_MAX_NUM_CHANNELS;
    pDevObj->slacId = VP792_MIN_SLAC_ID;
    pDevObj->options.debugSelect = VP_OPTION_DEFAULT_DEBUG_SELECT;

    if (pDevCtx == VP_NULL) {
        return VP_STATUS_SUCCESS;
    }

    return Vp792MakeDeviceCtx(pDevCtx, pDevObj);
} /* VpMakeVp792DeviceObject() */
コード例 #5
0
ファイル: ZL880_line_test.c プロジェクト: 12019/bcm63xx-phone
void
InitSetMasks(void)
{
    VpOptionEventMaskType eventMask;

    /* mask everything */
    VpMemSet(&eventMask, 0xFF, sizeof(VpOptionEventMaskType));

    /* unmask only the events the application is interested in */
    eventMask.faults = VP_EVCAT_FAULT_UNMASK_ALL;
    eventMask.signaling = VP_EVCAT_SIGNALING_UNMASK_ALL | VP_DEV_EVID_TS_ROLLOVER;
    eventMask.response = VP_EVCAT_RESPONSE_UNMASK_ALL;
    eventMask.test = VP_EVCAT_TEST_UNMASK_ALL;
    eventMask.process = VP_EVCAT_PROCESS_UNMASK_ALL;

    /* inform the API of the mask */
    VpSetOption(VP_NULL, &devCtx, VP_OPTION_ID_EVENT_MASK, &eventMask);

    return;
}
コード例 #6
0
ファイル: vp790_init.c プロジェクト: 12019/bcm63xx-phone
/**
 * Vp790InitLine
 *  This function initializes a line of a device with the specified parameters
 * and API default values. It is a "Line Reset".
 *
 * Preconditions:
 *  The device associated with this line must be initialized.
 *
 * Postconditions:
 *  The line pointed to be the line context passed is initialized with the
 * profile data specified.  This function returns the success code if the device
 * associated with this line is initialized.
 */
VpStatusType
Vp790InitLine(
    VpLineCtxType *pLineCtx,
    VpProfilePtrType pAcProfile,    /**< Pointer to AC coefficient data or
                                     * profile index to be applied to this line.
                                     */

    VpProfilePtrType pDcOrFxoProfile,   /**< Pointer to DC Feed (FXS) or Cfg
                                         * (FX0) profile or profile index to be
                                         * applied to this line.
                                         */

    VpProfilePtrType pRingProfile)  /**< Pointer to Ringing profile or profile
                                     * index to apply to this line
                                     */
{
    Vp790LineObjectType *pLineObj = pLineCtx->pLineObj;
    VpDevCtxType *pDevCtx = pLineCtx->pDevCtx;
    Vp790DeviceObjectType *pDevObj = pDevCtx->pDevObj;

    uint8 ecVal[] = {VP790_EC_CH1, VP790_EC_CH2, VP790_EC_CH3, VP790_EC_CH4};
    uint8 channelId = pLineObj->channelId;
    uint8 data;

#ifdef VP_CSLAC_SEQ_EN
    uint8 seqByte;
#endif

    uint8 ioReg[VP790_IO_REG_LEN];
    uint8 disableVals[VP790_LOOP_SUP_LEN] =
        {0x0D, 0x64, 0x0D, 0x01, 0x30, 0x00, 0x00, 0x7F};

    VpDeviceIdType deviceId = pDevObj->deviceId;

    /* Proceed if initialized or in progress, and not calibrating */
    if (pDevObj->status.state & (VP_DEV_INIT_CMP | VP_DEV_INIT_IN_PROGRESS)) {
        if (pDevObj->status.state & VP_DEV_IN_CAL) {
            return VP_STATUS_DEVICE_BUSY;
        }
    } else {
        return VP_STATUS_DEV_NOT_INITIALIZED;
    }

    VpSysEnterCritical(deviceId, VP_CODE_CRITICAL_SEC);

#ifdef VP_CSLAC_SEQ_EN
    for (seqByte = 0; seqByte < VP790_INT_SEQ_LEN; seqByte++) {
        pLineObj->intSequence[seqByte] = 0x00;
    }

    pLineObj->callerId.status = VP_CID_RESET_VALUE;

    pLineObj->thisFskCid = FALSE;
#endif

    pLineObj->pRingingCadence = VP_PTABLE_NULL;
    pLineObj->pCidProfileType1 = VP_PTABLE_NULL;
    pLineObj->pCidProfileType2 = VP_PTABLE_NULL;

    pLineObj->lineState.currentState = VP_LINE_DISCONNECT;
    pLineObj->lineState.previous = VP_LINE_DISCONNECT;

    pLineObj->codec = VP_NUM_OPTION_CODEC_TYPE_IDS;

    pLineObj->lineTimers.type = VP_CSLAC_FXS_TIMER;
    InitTimerVars(pLineCtx);

#ifdef VP_CSLAC_SEQ_EN
    VpMemSet(&pLineObj->cadence, 0, sizeof(VpSeqDataType));
#endif

    /* Software reset the channel */
    VpMpiCmdWrapper(deviceId, ecVal[channelId], VP790_SW_RESET_CMD, NO_DATA, &data);
    VpSysWait(3);

    VpMpiCmdWrapper(deviceId, ecVal[channelId], VP790_LOOP_SUP_WRT,
        VP790_LOOP_SUP_LEN, disableVals);

    VpSysWait(1);

    /* Set the default line state */
    Vp790SetLineState(pLineCtx, VP_LINE_DISCONNECT);

    /* Deactiveate the CODEC for the channel */
    VpMpiCmdWrapper(deviceId, ecVal[channelId], VP790_DEACTIVATE_CMD, NO_DATA, &data);

    /***************** C3 Operational Issue 3 ******************/
    /* This errata fix does not harm D3 operation */
    data = 0x00;
    VpMpiCmdWrapper(deviceId, ecVal[channelId], VP790_CCR9_WRT, VP790_CCR9_LEN, &data);

    /* We've already deactivated the device */
    VpSysWait(3);
    /**************** End Operational Issue 3 ******************/

    pLineObj->ringCtrl.zeroCross = VP_OPTION_DEFAULT_ZERO_CROSS;
    Vp790ConfigLine(pLineCtx, pAcProfile, pDcOrFxoProfile, pRingProfile);

    VpMpiCmdWrapper(deviceId, ecVal[channelId], VP790_IO_REG_RD,
        VP790_IO_REG_LEN, ioReg);
    ioReg[0] |= VP790_IO_REG_RD1_MANUAL;
    VpMpiCmdWrapper(deviceId, ecVal[channelId], VP790_IO_REG_WRT,
        VP790_IO_REG_LEN, ioReg);

    VpImplementDefaultSettings(VP_NULL, pLineCtx);

    /* Force an initial test of the hook state */
    pLineObj->lineState.condition = VP_CSLAC_STATUS_INVALID;
    pLineObj->dpStruct.hookSt = FALSE;

    VpInitDP(&pLineObj->dpStruct);

    /* Re-activate the channel due to a silicon bug -- and it doesn't hurt */
    VpMpiCmdWrapper(deviceId, ecVal[channelId], VP790_ACTIVATE_CMD, NO_DATA,
        VP_NULL);

    /* Post the line init complete event */
    pLineObj->lineEvents.response |= VP_LINE_EVID_LINE_INIT_CMP;

    VpSysExitCritical(deviceId, VP_CODE_CRITICAL_SEC);
    return VP_STATUS_SUCCESS;
} /* Vp790InitLine */
コード例 #7
0
ファイル: vp790_init.c プロジェクト: 12019/bcm63xx-phone
/**
 * Vp790InitLineObject()
 *  This function initializes the Vp790 Line Object data structure. It is
 * called only in this file .
 */
static void
Vp790InitLineObject(
    Vp790LineObjectType *pLineObj)
{
    VpMemSet(pLineObj, 0, sizeof(Vp790LineObjectType));
}
コード例 #8
0
ファイル: ZL880_line_test.c プロジェクト: 12019/bcm63xx-phone
void
StartLineTest(
    uint8 lineNum,
    LtTestIdType testId)
{
    LtTestStatusType ltStatus = LT_STATUS_RUNNING;
    
    /* user handle value (can be any number)*/
    uint16 ltParamHandle = 0xBEEF; 
    
    /* 
     * if the LtTestAttributesType argument to LtStartTest is NULL
     * then the LT-API will use a set of default inputs,
     * criteria, and topology value
     */
    LtTestAttributesType *pTestAtts = &gTestAtts;
    VpMemSet(pTestAtts, 0, sizeof(LtTestAttributesType));

    /* is a line test already in progress */
    if (plineCtxUnderTest != NULL) {
        QS_DEBUG("Line Test is already in progress\n");
        return;
    }

    /* 
     * The following shows examples of the different ways that input
     * parameters can be passed to the LT-API. These are for example
     * purposes and should be modified to fit the customer's needs.
     */
    switch (testId) {
    
        case LT_TID_LINE_V:
            /* using all default input and criteria values built into the LT-API */
            pTestAtts->ltDbgFlag = 0xFFFFFFFF;
            break;

        case LT_TID_ROH:
            /* disable runtime debug */
            pTestAtts->ltDbgFlag = 0;
            break;

        case LT_TID_RINGERS:
            /* configure the input params */
            gTestInputs.ringersInp.ringerTestType = LT_RINGER_ELECTRONIC_PHNE_TEST_3_ELE;
            gTestInputs.ringersInp.vRingerTest = 56000;
            gTestInputs.ringersInp.freq = 20000;
            gTestInputs.ringersInp.renFactor = 1210000;

            /* set the input params pointer to the global variable */
            pTestAtts->inputs.pRingersInp = &gTestInputs.ringersInp;

            /* disable runtime debug */
            pTestAtts->ltDbgFlag = 0;
            break;

        default: 
            QS_DEBUG("Unsupported quick start testid %i\n", testId);
            return;    
    }

    /* Start the line test */
    ltStatus = LtStartTest(&lineCtx[lineNum], testId, ltParamHandle, &gTestAtts, 
        &gTestTempData, &gTestResults, &gTestCtx);

    if (ltStatus != LT_STATUS_RUNNING) {
        QS_DEBUG("Unable to start testId %i: ltStatus = %i\n", testId, ltStatus);
        exit(1);
    }
    
    /* indicate that a test is in progress */
    plineCtxUnderTest = &lineCtx[lineNum];
    
    return;
}