解释这段代码逻辑 void TPS929120_CorrespondDriverIndexFrmtypeSts(uint8 u8_bus_id_in,uint8 u8_frmtype) { uint8 u8_ValidDrvNum = 0; uint8 u8_RepeatRnblDrvNum = 0; u8_RepeatRnblDrvNum = un_BusShareRam[u8_bus_id_in].st_Tps929120.u8_RepeatRnblMatrixDriverNumber; u8_ValidDrvNum = un_BusShareRam[u8_bus_id_in].st_Tps929120.u8_ValidMatrixDriverNumber; if(un_BusShareRam[u8_bus_id_in].st_Tps929120.st_DrvRnblSts.u8_Refresh_Driver_index == 0) { if( (u8_ValidDrvNum - un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_CpltDrvCount < u8_RepeatRnblDrvNum) && \ (u8_ValidDrvNum - un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_CpltDrvCount > 0) ) { un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_CpltFrmtypeCount = 0; un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_SendCpltDrvCounter = 0; if(u8_frmtype == TPS929120_PWMFRMMODE) { if(g_u8_Tps92912xFixedOperationAddressflg == 1) { if(TPS929120_FIXEDCHIPNUM == 2) { un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_FrmPackDrvNumPerRnbl = u8_RepeatRnblDrvNum; } else if(TPS929120_FIXEDCHIPNUM == 1) { un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_FrmPackDrvNumPerRnbl = TPS929120_FIXEDCHIPNUM + \ (u8_ValidDrvNum - un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_CpltDrvCount); } } else { un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_FrmPackDrvNumPerRnbl = \ (u8_ValidDrvNum - un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_CpltDrvCount) ; } } else { un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_FrmPackDrvNumPerRnbl = \ (u8_ValidDrvNum - un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_CpltDrvCount) ; } } else if(0 == (u8_ValidDrvNum - un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_CpltDrvCount)) { un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_CpltFrmtypeCount = 0; un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_SendCpltDrvCounter = 0; un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_CpltDrvCount = 0; if(u8_ValidDrvNum >= u8_RepeatRnblDrvNum) { un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_FrmPackDrvNumPerRnbl = u8_RepeatRnblDrvNum; } else { un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_FrmPackDrvNumPerRnbl = u8_ValidDrvNum; } } else { un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_CpltFrmtypeCount = 0; un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_SendCpltDrvCounter = 0; un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_FrmPackDrvNumPerRnbl = u8_RepeatRnblDrvNum; } un_BusShareRam[u8_bus_id_in].st_Tps929120.st_DrvRnblSts.u8_Refresh_Driver_index = 1; } else { /NO CODE/ } }
时间: 2023-06-04 20:02:38 浏览: 98
unit8_2_int32_.rar_uint8 int32_unit8
5星 · 资源好评率100%
&& (un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_CpltDrvCount != u8_ValidDrvNum) )
{
un_BusShareRam[u8_bus_id_in].st_Tps929120.u8_CurRnblDrvIndex = un_BusShareRam[u8_bus_id_in].st_Tps929120.st_FrmtypeSts[u8_frmtype].u8_CpltDrvCount;
un_BusShareRam[u8_bus_id_in].st_Tps929120.st_DrvRnblSts.u8_Refresh_Driver_index = 1;
}
else
{
un_BusShareRam[u8_bus_id_in].st_Tps929120.u8_CurRnblDrvIndex ++;
if(un_BusShareRam[u8_bus_id_in].st_Tps929120.u8_CurRnblDrvIndex >= u8_ValidDrvNum)
{
un_BusShareRam[u8_bus_id_in].st_Tps929120.u8_CurRnblDrvIndex = 0;
}
un_BusShareRam[u8_bus_id_in].st_Tps929120.st_DrvRnblSts.u8_Refresh_Driver_index = 1;
}
}
答:这段代码实现的逻辑是,根据输入的总线ID和帧类型,来确定当前可用的驱动器数量以及可重复的驱动器数量。然后根据当前驱动器的处理状态来决定当前要处理的驱动器的索引值,并通过更新刷新驱动器索引的状态值来确保下次处理时能正确地获取当前可用的驱动器数量和可重复的驱动器数量以及处理状态。具体是根据当前帧类型下已完成处理的驱动器数量以及可重复的驱动器数量来计算当前处理的驱动器索引值,并在更新当前驱动器索引值后更新刷新驱动器索引的状态为1,确保下次处理时能更新正确的驱动器索引进行处理。
阅读全文