コード例 #1
0
ファイル: 3780i.c プロジェクト: CSCLOG/beaglebone
int dsp3780I_WriteIStore(unsigned short usDspBaseIO, void __user *pvBuffer,
                         unsigned uCount, unsigned long ulDSPAddr)
{
    unsigned long flags;
    unsigned short __user *pusBuffer = pvBuffer;

    PRINTK_5(TRACE_3780I,
             "3780i::dsp3780I_WriteIStore entry usDspBaseIO %x, pusBuffer %p, uCount %x, ulDSPAddr %lx\n",
             usDspBaseIO, pusBuffer, uCount, ulDSPAddr);


    /*
    * Set the initial MSA address. To convert from an instruction store
    * address to an MSA address
    * shift the address two bits to the left and set bit 22
    */
    ulDSPAddr = (ulDSPAddr << 2) | (1 << 22);
    spin_lock_irqsave(&dsp_lock, flags);
    OutWordDsp(DSP_MsaAddrLow, (unsigned short) ulDSPAddr);
    OutWordDsp(DSP_MsaAddrHigh, (unsigned short) (ulDSPAddr >> 16));
    spin_unlock_irqrestore(&dsp_lock, flags);

    /* Transfer the memory block */
    while (uCount-- != 0) {
        unsigned short val_lo, val_hi;
        if(get_user(val_lo, pusBuffer++))
            return -EFAULT;
        if(get_user(val_hi, pusBuffer++))
            return -EFAULT;
        spin_lock_irqsave(&dsp_lock, flags);
        OutWordDsp(DSP_MsaDataISLow, val_lo);
        OutWordDsp(DSP_MsaDataDSISHigh, val_hi);
        spin_unlock_irqrestore(&dsp_lock, flags);

        PRINTK_4(TRACE_3780I,
                 "3780I::dsp3780I_WriteIStore uCount %x val_lo %x val_hi %x\n",
                 uCount, val_lo, val_hi);

        PaceMsaAccess(usDspBaseIO);

    }

    PRINTK_1(TRACE_3780I,
             "3780I::dsp3780I_WriteIStore exit bRC=TRUE\n");

    return 0;
}
コード例 #2
0
int dsp3780I_WriteIStore(unsigned short usDspBaseIO, void __user *pvBuffer,
                         unsigned uCount, unsigned long ulDSPAddr)
{
	unsigned long flags;
	unsigned short __user *pusBuffer = pvBuffer;

	PRINTK_5(TRACE_3780I,
		"3780i::dsp3780I_WriteIStore entry usDspBaseIO %x, pusBuffer %p, uCount %x, ulDSPAddr %lx\n",
		usDspBaseIO, pusBuffer, uCount, ulDSPAddr);


	
	ulDSPAddr = (ulDSPAddr << 2) | (1 << 22);
	spin_lock_irqsave(&dsp_lock, flags);
	OutWordDsp(DSP_MsaAddrLow, (unsigned short) ulDSPAddr);
	OutWordDsp(DSP_MsaAddrHigh, (unsigned short) (ulDSPAddr >> 16));
	spin_unlock_irqrestore(&dsp_lock, flags);

	
	while (uCount-- != 0) {
		unsigned short val_lo, val_hi;
		if(get_user(val_lo, pusBuffer++))
			return -EFAULT;
		if(get_user(val_hi, pusBuffer++))
			return -EFAULT;
		spin_lock_irqsave(&dsp_lock, flags);
		OutWordDsp(DSP_MsaDataISLow, val_lo);
		OutWordDsp(DSP_MsaDataDSISHigh, val_hi);
		spin_unlock_irqrestore(&dsp_lock, flags);

		PRINTK_4(TRACE_3780I,
			"3780I::dsp3780I_WriteIStore uCount %x val_lo %x val_hi %x\n",
			uCount, val_lo, val_hi);

		PaceMsaAccess(usDspBaseIO);

	}

	PRINTK_1(TRACE_3780I,
		"3780I::dsp3780I_WriteIStore exit bRC=TRUE\n");

	return 0;
}
コード例 #3
0
ファイル: 3780i.c プロジェクト: CSCLOG/beaglebone
int dsp3780I_ReadAndClearDStore(unsigned short usDspBaseIO,
                                void __user *pvBuffer, unsigned uCount,
                                unsigned long ulDSPAddr)
{
    unsigned long flags;
    unsigned short __user *pusBuffer = pvBuffer;
    unsigned short val;


    PRINTK_5(TRACE_3780I,
             "3780i::dsp3780I_ReadAndDStore entry usDspBaseIO %x, pusBuffer %p, uCount %x, ulDSPAddr %lx\n",
             usDspBaseIO, pusBuffer, uCount, ulDSPAddr);


    /* Set the initial MSA address. No adjustments need to be made to data store addresses */
    spin_lock_irqsave(&dsp_lock, flags);
    OutWordDsp(DSP_MsaAddrLow, (unsigned short) ulDSPAddr);
    OutWordDsp(DSP_MsaAddrHigh, (unsigned short) (ulDSPAddr >> 16));
    spin_unlock_irqrestore(&dsp_lock, flags);

    /* Transfer the memory block */
    while (uCount-- != 0) {
        spin_lock_irqsave(&dsp_lock, flags);
        val = InWordDsp(DSP_ReadAndClear);
        spin_unlock_irqrestore(&dsp_lock, flags);
        if(put_user(val, pusBuffer++))
            return -EFAULT;

        PRINTK_3(TRACE_3780I,
                 "3780I::dsp3780I_ReadAndCleanDStore uCount %x val %x\n",
                 uCount, val);

        PaceMsaAccess(usDspBaseIO);
    }


    PRINTK_1(TRACE_3780I,
             "3780I::dsp3780I_ReadAndClearDStore exit bRC=TRUE\n");

    return 0;
}
コード例 #4
0
int dsp3780I_ReadDStore(unsigned short usDspBaseIO, void __user *pvBuffer,
                        unsigned uCount, unsigned long ulDSPAddr)
{
	unsigned long flags;
	unsigned short __user *pusBuffer = pvBuffer;
	unsigned short val;


	PRINTK_5(TRACE_3780I,
		"3780i::dsp3780I_ReadDStore entry usDspBaseIO %x, pusBuffer %p, uCount %x, ulDSPAddr %lx\n",
		usDspBaseIO, pusBuffer, uCount, ulDSPAddr);


	
	spin_lock_irqsave(&dsp_lock, flags);
	OutWordDsp(DSP_MsaAddrLow, (unsigned short) ulDSPAddr);
	OutWordDsp(DSP_MsaAddrHigh, (unsigned short) (ulDSPAddr >> 16));
	spin_unlock_irqrestore(&dsp_lock, flags);

	
	while (uCount-- != 0) {
		spin_lock_irqsave(&dsp_lock, flags);
		val = InWordDsp(DSP_MsaDataDSISHigh);
		spin_unlock_irqrestore(&dsp_lock, flags);
		if(put_user(val, pusBuffer++))
			return -EFAULT;

		PRINTK_3(TRACE_3780I,
			"3780I::dsp3780I_ReadDStore uCount %x val %x\n",
			uCount, val);

		PaceMsaAccess(usDspBaseIO);
	}


	PRINTK_1(TRACE_3780I,
		"3780I::dsp3780I_ReadDStore exit bRC=TRUE\n");

	return 0;
}