I also changed:
case RTBTH_IOCDMAC: do { struct rtbth_dmac dmac;
if (copy_from_user(&dmac, (void *)arg, sizeof(dmac))) { retval = -EFAULT; DebugPrint(ERROR, DBG_INIT,"copy_from_user failed at %d\n", __LINE__); break; } DebugPrint(ERROR, DBG_INIT,"RTBTH_IOCDMAC: dmac.dmac_op=%d\n", dmac.dmac_op);
if(dmac.dmac_op == 0){ RtbtResetPDMA(gpAd); }else if(dmac.dmac_op == 1){ BthEnableRxTx(gpAd); }else if(dmac.dmac_op == 2){ DebugPrint(TRACE, DBG_MISC, "%s:kfifo reset ==>\n", __func__); kfifo_reset(gpAd->acl_fifo); kfifo_reset(gpAd->hci_fifo); kfifo_reset(gpAd->evt_fifo); kfifo_reset(gpAd->sco_fifo); kfifo_reset(gpAd->rx_fifo); DebugPrint(TRACE, DBG_MISC, "%s:kfifo reset <== \n", __func__); } else { DebugPrint(ERROR, DBG_INIT,"No such the dma op = %d\n", dmac.dmac_op); } }while(0); break;
to:
if(dmac.dmac_op == 2){ DebugPrint(TRACE, DBG_MISC, "%s:kfifo reset ==>\n", __func__); kfifo_reset(gpAd->acl_fifo); kfifo_reset(gpAd->hci_fifo); kfifo_reset(gpAd->evt_fifo); kfifo_reset(gpAd->sco_fifo); kfifo_reset(gpAd->rx_fifo); DebugPrint(TRACE, DBG_MISC, "%s:kfifo reset <== \n", __func__); }
if(dmac.dmac_op == 0){ RtbtResetPDMA(gpAd); } if(dmac.dmac_op == 1){ BthEnableRxTx(gpAd); } else { DebugPrint(ERROR, DBG_INIT,"No such the dma op = %d\n", dmac.dmac_op); }
}while(0); break;
Now it is the pairing even more reliable. Paired 5 different devices including bluetooth audio device.
Somehow the execution was not reaching this part:
It is the interrupt causing it?
I also changed:
case RTBTH_IOCDMAC:
struct rtbth_dmac dmac;
do {
if (copy_from_ user(&dmac, (void *)arg, sizeof(dmac))) {
retval = -EFAULT;
DebugPrin t(ERROR, DBG_INIT, "copy_from_ user failed at %d\n", __LINE__);
break;
DebugPrint( ERROR, DBG_INIT, "RTBTH_ IOCDMAC: dmac.dmac_op=%d\n", dmac.dmac_op);
}
}
}
break;
to:
case RTBTH_IOCDMAC:
struct rtbth_dmac dmac;
do {
if (copy_from_ user(&dmac, (void *)arg, sizeof(dmac))) {
retval = -EFAULT;
DebugPrin t(ERROR, DBG_INIT, "copy_from_ user failed at %d\n", __LINE__);
break;
DebugPrint( ERROR, DBG_INIT, "RTBTH_ IOCDMAC: dmac.dmac_op=%d\n", dmac.dmac_op);
}
}
}
} else {
}
break;
Now it is the pairing even more reliable. Paired 5 different devices including bluetooth audio device.
Somehow the execution was not reaching this part:
if(dmac.dmac_op == 2){
DebugPrin t(TRACE, DBG_MISC, "%s:kfifo reset ==>\n", __func__);
kfifo_ reset(gpAd- >acl_fifo) ;
kfifo_ reset(gpAd- >hci_fifo) ;
kfifo_ reset(gpAd- >evt_fifo) ;
kfifo_ reset(gpAd- >sco_fifo) ;
kfifo_ reset(gpAd- >rx_fifo) ;
DebugPrin t(TRACE, DBG_MISC, "%s:kfifo reset <== \n", __func__);
}
It is the interrupt causing it?