updated handshake flow for customers
This commit is contained in:
parent
af057e2fd7
commit
cf0f7b4ccc
@ -31,6 +31,9 @@ typedef struct tUcpHandshake{
|
|||||||
} UcpHandshake_t;
|
} UcpHandshake_t;
|
||||||
|
|
||||||
void ucp_handshake(void);
|
void ucp_handshake(void);
|
||||||
|
void send_handshake_request(void);
|
||||||
|
void receive_handshake_response(void);
|
||||||
|
uint32_t get_handshake_status(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -42,3 +42,55 @@ void ucp_handshake(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void send_handshake_request(void)
|
||||||
|
{
|
||||||
|
uint32_t core_id = NPU_CORE_ID;
|
||||||
|
uint32_t request= (core_id + HANDSHKAE_REQ_VALUE);
|
||||||
|
//volatile uint32_t response;
|
||||||
|
|
||||||
|
PetSmLocalMgt_t* pPetSmLocalMgt = get_pet_sm_local_mgt();
|
||||||
|
UcpHandshake_t* pHandshake = pPetSmLocalMgt->pHandshake;
|
||||||
|
|
||||||
|
pHandshake->request[core_id] = request;
|
||||||
|
UCP_PRINT_DEBUG("core[0x%08x] send handshake request message,value[0x%08x].",core_id,request);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t get_handshake_status(void)
|
||||||
|
{
|
||||||
|
volatile uint32_t response;
|
||||||
|
uint32_t core_id = NPU_CORE_ID;
|
||||||
|
uint32_t coreReadyBitMap = SUCCESS;//0:ready, 1:not ready
|
||||||
|
uint32_t handshake_coremask = 0x6FF;
|
||||||
|
|
||||||
|
PetSmLocalMgt_t* pPetSmLocalMgt = get_pet_sm_local_mgt();
|
||||||
|
UcpHandshake_t* pHandshake = pPetSmLocalMgt->pHandshake;
|
||||||
|
|
||||||
|
response = pHandshake->response[core_id];
|
||||||
|
if (response == (core_id + HANDSHKAE_RESP_VALUE)) {
|
||||||
|
return coreReadyBitMap;
|
||||||
|
} else {
|
||||||
|
for(uint32_t i = 0; i < MAX_NUM_SPU; i++) {
|
||||||
|
response = pHandshake->response[i];
|
||||||
|
if (response != (i + HANDSHKAE_RESP_VALUE)) {
|
||||||
|
coreReadyBitMap |= (1 << i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
coreReadyBitMap &= handshake_coremask;
|
||||||
|
return coreReadyBitMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
//return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void receive_handshake_response(void)
|
||||||
|
{
|
||||||
|
uint32_t stauts = SUCCESS;
|
||||||
|
do {
|
||||||
|
stauts = get_handshake_status();
|
||||||
|
} while(SUCCESS != stauts);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user