Dear All :
void I2C2_MasterTRBInsert(
uint8_t count,
I2C2_TRANSACTION_REQUEST_BLOCK *ptrb_list,
I2C2_MESSAGE_STATUS *pflag)
{
// check if there is space in the queue
if (i2c2_object.trStatus.s.full != true)
{
//LATD = ~0x88; //test
*pflag = I2C2_MESSAGE_PENDING;
i2c2_object.pTrTail->ptrb_list = ptrb_list;
i2c2_object.pTrTail->count = count;
i2c2_object.pTrTail->pTrFlag = pflag;
i2c2_object.pTrTail++;
//LATD = ~ptrb_list->address;
NOP();
// check if the end of the array is reached
if (i2c2_object.pTrTail == (i2c2_tr_queue + I2C2_CONFIG_TR_QUEUE_LENGTH))
{
// adjust to restart at the beginning of the array
i2c2_object.pTrTail = i2c2_tr_queue;
}
// since we added one item to be processed, we know
// it is not empty, so set the empty status to false
i2c2_object.trStatus.s.empty = false;
// check if full
if (i2c2_object.pTrHead == i2c2_object.pTrTail)
{
// it is full, set the full status to true
i2c2_object.trStatus.s.full = true;
}
}
else
{
*pflag = I2C2_MESSAGE_FAIL;
}
// for interrupt based
if (*pflag == I2C2_MESSAGE_PENDING)
{
I2C2_WaitForLastPacketToComplete();
// The state machine has to be started manually because it runs only in the ISR.
// If we called the ISR function here function duplication would double the code size
// because this function would be called both from interrupt and from mainline code.
PIR3bits.SSP2IF = true;
//LATD = ~0x99; //test
} // block until request is complete
NOP();
}
/**/
Cause the i2c2_object.trStatus.s.full is full so cant set SSP2IE again,
How ca i solve it?
Thank u so much...