示例#1
0
int rp_LaAcqDefaultSettings(rp_handle_uio_t *handle) {
    rp_LaAcqGlobalTrigSet(handle,RP_TRG_ALL_MASK);

    rp_LaAcqSetConfig(handle, 0);
    //rp_LaAcqSetConfig(handle, RP_LA_ACQ_CFG_AUTO_MASK);

    rp_la_cfg_regset_t cfg;
    cfg.pre=0;
    cfg.pst=LA_ACQ_BUF_SIZE;
    rp_LaAcqSetCntConfig(handle,cfg);

    rp_la_trg_regset_t trg;
    trg.cmp_msk=0;
    trg.cmp_val=0;
    trg.edg_pos=0;
    trg.edg_neg=0;
    rp_LaAcqSetTrigSettings(handle,trg);

    rp_la_decimation_regset_t dec;
    dec.dec=0;
    rp_LaAcqSetDecimation(handle,dec);

    rp_LaAcqDisableRLE(handle);

    return RP_OK;
}
示例#2
0
/**
 * Enable digital port
 *
 * This function will set the individual digital channels' trigger directions. Each trigger
 * direction consists of a channel name and a direction. If the channel is not included in
 * the array of RP_DIGITAL_CHANNEL_DIRECTIONS the driver assumes the
 * digital channel's trigger direction is RP_DIGITAL_DONT_CARE.
 *
 * @param directions      A pointer to an array of structures describing the
 *                         requested properties.
 *                         If directions is NULL, digital triggering is switched off.
 *                         A digital channel that is not included in the array will be set to RP_DIGITAL_DONT_CARE.
 * @param nDirections      The number of digital channel directions being
 *                      passed to the driver.
 *
 */
RP_STATUS rp_SetTriggerDigitalPortProperties(RP_DIGITAL_CHANNEL_DIRECTIONS * directions,
                                            int16_t nDirections)
{
    // disable triggering by default
    rp_LaAcqGlobalTrigSet(&la_acq_handle, RP_TRG_ALL_MASK);

    rp_la_trg_regset_t trg;
    memset(&trg,0,sizeof(rp_la_trg_regset_t));

    // none of triggers is enabled
    if(directions==NULL){
        return RP_API_OK;
    }

    uint32_t n;
    uint32_t edge_cnt=0;
    // set trigger pattern settings
    for(n=0; n < nDirections; n++){
        uint32_t mask = (1<<directions[n].channel);
        if(edge_cnt>1){
            // more than one pin is set to rising/falling edge
            return RP_INVALID_PARAMETER;
        }
        switch(directions[n].direction){
            case RP_DIGITAL_DONT_CARE:
                // default value is don't care
                break;
            case RP_DIGITAL_DIRECTION_LOW:
                trg.cmp_msk|=mask;
                // default val is low
                break;
            case RP_DIGITAL_DIRECTION_HIGH:
                trg.cmp_msk|=mask;
                trg.cmp_val|=mask;
                break;
            case RP_DIGITAL_DIRECTION_RISING:
                trg.edg_pos|=mask;
                edge_cnt++;
                break;
            case RP_DIGITAL_DIRECTION_FALLING:
                trg.edg_neg|=mask;
                edge_cnt++;
                break;
            case RP_DIGITAL_DIRECTION_RISING_OR_FALLING:
                trg.edg_pos|=mask;
                trg.edg_neg|=mask;
                edge_cnt++;
                break;
            default:
                return RP_INVALID_PARAMETER;
                break;
        }
    }

    // update settings
    if(edge_cnt==1){
    	// edge - enable pattern & software trigger
        rp_LaAcqSetTrigSettings(&la_acq_handle, trg);
        rp_LaAcqGlobalTrigSet(&la_acq_handle, RP_TRG_LOA_PAT_MASK|RP_TRG_LOA_SWE_MASK);
    }
    else{
    	// else leave only software trigger on
        rp_LaAcqSetTrigSettings(&la_acq_handle, trg);
        rp_LaAcqGlobalTrigSet(&la_acq_handle, RP_TRG_LOA_SWE_MASK);
    }

    //rp_LaAcqFpgaRegDump(&la_acq_handle);

    return RP_API_OK;
}