/******************************************************************************
 *
 * @brief   On packet reception, process the data
 *  BSL-based protocol expects:
 *  HEADER  = 0x80
 *  Lenght  = lenght of CMD + [ADDR] + [DATA]
 *  CMD     = 1 byte with the corresponding command
 *  ADDR    = optional address depending on command
 *  DATA    = optional data depending on command
 *  CHKSUM  = 2 bytes (L:H) with CRC checksum of CMD + [ADDR] + [DATA]
 *
 * @return RET_OK: Communication protocol in progress
 *         RET_JUMP_TO_APP: Last byte received, request jump to application
 *****************************************************************************/
uint8_t TI_MSPBoot_CI_Process(void)
{
    uint8_t ret = RET_NO_DATA;
    uint8_t sendAck;

    if (readPacket())    // On complete packet reception
    {
        if ((gPacket.length > PACKET_DESTINATION) && 
            (gPacket.data[PACKET_PROTOCOL] == MSP430_BSL_PROTOCOL) && 
            (gPacket.data[PACKET_DESTINATION] == gPacket.myAddr)) {
            sendAck = verifyPacket();
            ackPacket(sendAck);
            if (sendAck == ACK)
            {
                /* CI_CMD_Intepreter will set up the packet response */
                ret = CI_CMD_Intepreter();
                updatePacket();
                writePacket();
            }
        }

        packetReset();
    }

    return ret;
}
예제 #2
0
void PxsFluidDynamics::processPacketRange(PxU32 taskDataIndex)
{
	const PxsParticleCell* packets = mParticleSystem.mSpatialHash->getPackets();
	const PxsFluidPacketSections* packetSections = mParticleSystem.mSpatialHash->getPacketSections();
	PxsFluidParticle* particles = mTempReorderedParticles;
	PxVec3* forceBuf = mTempParticleForceBuf;

	TaskData& taskData = mTaskData[taskDataIndex];

	for (PxU16 p = taskData.beginPacketIndex; p < taskData.endPacketIndex; ++p)
	{
		const PxsParticleCell& packet = packets[p];
		if(packet.numParticles == PX_INVALID_U32)
			continue;

		// Get halo regions with neighboring particles
		PxsFluidPacketHaloRegions haloRegions;
		PxsFluidSpatialHash::getHaloRegions(haloRegions, packet.coords, packets, packetSections, PXS_PARTICLE_SYSTEM_PACKET_HASH_SIZE);

		updatePacket(mCurrentUpdateType, forceBuf, particles, packet, packetSections[p], haloRegions, mTempBuffers[taskDataIndex]);	
	}
}