Изменена функция приема данных
This commit is contained in:
parent
215e743f07
commit
16695a6885
|
|
@ -19,10 +19,79 @@ void CanSpamReceiver_Init(tCanSpamReceiver *env,
|
|||
env->logger = logger;
|
||||
env->access = osMutexNew(NULL);
|
||||
|
||||
|
||||
env->ccu_candb_rx_TM_CP = osMessageQueueNew(1, sizeof(ccu_candb_rx.TM_CP), NULL);
|
||||
env->ccu_candb_rx_FIU_CCU1 = osMessageQueueNew(1, sizeof(ccu_candb_rx.FIU_CCU1), NULL);
|
||||
env->ccu_candb_rx_FIU_CCU2 = osMessageQueueNew(1, sizeof(ccu_candb_rx.FIU_CCU2), NULL);
|
||||
env->ccu_candb_rx_BCM_Powertrain = osMessageQueueNew(1, sizeof(ccu_candb_rx.BCM_Powertrain), NULL);
|
||||
env->ccu_candb_rx_BCM_CLIMATIC_DATA = osMessageQueueNew(1, sizeof(ccu_candb_rx.BCM_CLIMATIC_DATA), NULL);
|
||||
env->ccu_candb_rx_EMS_Veh = osMessageQueueNew(1, sizeof(ccu_candb_rx.EMS_Veh), NULL);
|
||||
env->ccu_candb_rx_ESC_04 = osMessageQueueNew(1, sizeof(ccu_candb_rx.ESC_04), NULL);
|
||||
env->ccu_candb_rx_BCM_VEH_STATE = osMessageQueueNew(1, sizeof(ccu_candb_rx.BCM_VEH_STATE), NULL);
|
||||
env->ccu_candb_rx_EMS_HVC_Req_Msg = osMessageQueueNew(1, sizeof(ccu_candb_rx.EMS_HVC_Req_Msg), NULL);
|
||||
env->ccu_candb_rx_HVC_Err_Status_Msg = osMessageQueueNew(1, sizeof(ccu_candb_rx.HVC_Err_Status_Msg), NULL);
|
||||
|
||||
|
||||
InitThreadAtrStatic(&env->thread.attr, "CanSpamRec", env->thread.controlBlock, env->thread.stack,
|
||||
osPriorityNormal);
|
||||
}
|
||||
|
||||
static void set_CanSpamReceiver(tCanSpamReceiver *env, uint32_t recid) {
|
||||
osStatus_t status = osOK;
|
||||
|
||||
uint32_t countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_TM_CP);
|
||||
if ((countQueue_ccu_candb_rx) && (recid == TM_CP_CANID)) {
|
||||
status = osMessageQueuePut(env->ccu_candb_rx_TM_CP, &ccu_candb_rx.TM_CP, 0, 0U);
|
||||
}
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_FIU_CCU1);
|
||||
if ((countQueue_ccu_candb_rx) && (recid == FIU_CCU1_CANID)) {
|
||||
status = osMessageQueuePut(env->ccu_candb_rx_FIU_CCU1, &ccu_candb_rx.FIU_CCU1, 0, 0U);
|
||||
}
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_FIU_CCU2);
|
||||
if ((countQueue_ccu_candb_rx) && (recid == FIU_CCU2_CANID)) {
|
||||
status = osMessageQueuePut(env->ccu_candb_rx_FIU_CCU2, &ccu_candb_rx.FIU_CCU2, 0, 0U);
|
||||
}
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_BCM_Powertrain);
|
||||
if ((countQueue_ccu_candb_rx) && (recid == BCM_Powertrain_CANID)) {
|
||||
status = osMessageQueuePut(env->ccu_candb_rx_BCM_Powertrain, &ccu_candb_rx.BCM_Powertrain, 0, 0U);
|
||||
}
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_BCM_CLIMATIC_DATA);
|
||||
if ((countQueue_ccu_candb_rx) && (recid == BCM_CLIMATIC_DATA_CANID)) {
|
||||
status = osMessageQueuePut(env->ccu_candb_rx_BCM_CLIMATIC_DATA, &ccu_candb_rx.BCM_CLIMATIC_DATA, 0, 0U);
|
||||
}
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_EMS_Veh);
|
||||
if ((countQueue_ccu_candb_rx) && (recid == EMS_Veh_CANID)) {
|
||||
status = osMessageQueuePut(env->ccu_candb_rx_EMS_Veh, &ccu_candb_rx.EMS_Veh, 0, 0U);
|
||||
}
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_ESC_04);
|
||||
if ((countQueue_ccu_candb_rx) && (recid == ESC_04_CANID)) {
|
||||
status = osMessageQueuePut(env->ccu_candb_rx_ESC_04, &ccu_candb_rx.ESC_04, 0, 0U);
|
||||
}
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_BCM_VEH_STATE);
|
||||
if ((countQueue_ccu_candb_rx) && (recid == BCM_VEH_STATE_CANID)) {
|
||||
status = osMessageQueuePut(env->ccu_candb_rx_BCM_VEH_STATE, &ccu_candb_rx.BCM_VEH_STATE, 0, 0U);
|
||||
}
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_EMS_HVC_Req_Msg);
|
||||
if ((countQueue_ccu_candb_rx) && (recid == EMS_HVC_Req_Msg_CANID)) {
|
||||
status = osMessageQueuePut(env->ccu_candb_rx_EMS_HVC_Req_Msg, &ccu_candb_rx.EMS_HVC_Req_Msg, 0, 0U);
|
||||
}
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_HVC_Err_Status_Msg);
|
||||
if ((countQueue_ccu_candb_rx) && (recid == HVC_Err_Status_Msg_CANID)) {
|
||||
status = osMessageQueuePut(env->ccu_candb_rx_HVC_Err_Status_Msg, &ccu_candb_rx.HVC_Err_Status_Msg, 0, 0U);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void ListenCanSpamReceiver(tCanSpamReceiver *env) {
|
||||
|
||||
uint16_t recv = env->ioCanFrame->receive(env->ioCanFrame->env, PROTOCOL_CAN_RAW, (uint8_t *) &env->canFrame, 1,
|
||||
|
|
@ -43,7 +112,9 @@ static void ListenCanSpamReceiver(tCanSpamReceiver *env) {
|
|||
env->logger->loggingCan(env->logger->env, 1, 0, env->canFrame.dlc, env->canFrame.standard_id,
|
||||
env->canFrame.data, SystemGetMs());
|
||||
|
||||
uint32_t result = ccu_candb_Receive(&ccu_candb_rx, env->canFrame.data, id, env->canFrame.dlc);
|
||||
uint32_t recid = ccu_candb_Receive(&ccu_candb_rx, env->canFrame.data, id, env->canFrame.dlc);
|
||||
|
||||
set_CanSpamReceiver(env, recid);
|
||||
|
||||
osMutexRelease(env->access);
|
||||
} else {
|
||||
|
|
@ -75,6 +146,63 @@ bool get_is_NoNull_CanSpam_BCM_PowerTrain_Receiver(tCanSpamReceiver *env) {
|
|||
}
|
||||
|
||||
void get_CanSpamReceiver(tCanSpamReceiver *env) {
|
||||
|
||||
osStatus_t status = osOK;
|
||||
|
||||
uint32_t countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_TM_CP);
|
||||
if (countQueue_ccu_candb_rx == 0) {
|
||||
status = osMessageQueueGet(env->ccu_candb_rx_TM_CP, &rtDW.TM_CP_model, 0, 0U);
|
||||
}
|
||||
|
||||
memset(&rtDW.FIU_CCU1_MODEL, 0, sizeof(rtDW.FIU_CCU1_MODEL));
|
||||
memset(&rtDW.FIU_CCU2_MODEL, 0, sizeof(rtDW.FIU_CCU2_MODEL));
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_FIU_CCU1);
|
||||
if (countQueue_ccu_candb_rx == 0) {
|
||||
status = osMessageQueueGet(env->ccu_candb_rx_FIU_CCU1, &rtDW.FIU_CCU1_MODEL, 0, 0U);
|
||||
}
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_FIU_CCU2);
|
||||
if (countQueue_ccu_candb_rx == 0) {
|
||||
status = osMessageQueueGet(env->ccu_candb_rx_FIU_CCU2, &rtDW.FIU_CCU2_MODEL, 0, 0U);
|
||||
}
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_BCM_Powertrain);
|
||||
if (countQueue_ccu_candb_rx == 0) {
|
||||
status = osMessageQueueGet(env->ccu_candb_rx_BCM_Powertrain, &rtDW.CCUCAN_BCM_Powertrain_model, 0, 0U);
|
||||
}
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_BCM_CLIMATIC_DATA);
|
||||
if (countQueue_ccu_candb_rx == 0) {
|
||||
status = osMessageQueueGet(env->ccu_candb_rx_BCM_CLIMATIC_DATA, &rtDW.CCUCAN_BCM_Climatic_model, 0, 0U);
|
||||
}
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_EMS_Veh);
|
||||
if (countQueue_ccu_candb_rx == 0) {
|
||||
status = osMessageQueueGet(env->ccu_candb_rx_EMS_Veh, &rtDW.CCUCAN_EMS_Veh_model, 0, 0U);
|
||||
}
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_ESC_04);
|
||||
if (countQueue_ccu_candb_rx == 0) {
|
||||
status = osMessageQueueGet(env->ccu_candb_rx_ESC_04, &rtDW.CCUCAN_ESC_04_model, 0, 0U);
|
||||
}
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_BCM_VEH_STATE);
|
||||
if (countQueue_ccu_candb_rx == 0) {
|
||||
status = osMessageQueueGet(env->ccu_candb_rx_BCM_VEH_STATE, &rtDW.CCUCAN_BCM_VEH_STATE_model, 0, 0U);
|
||||
}
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_EMS_HVC_Req_Msg);
|
||||
if (countQueue_ccu_candb_rx == 0) {
|
||||
status = osMessageQueueGet(env->ccu_candb_rx_EMS_HVC_Req_Msg, &rtDW.CCUCAN_EMS_HVC_REQ_MSG_MODEL, 0, 0U);
|
||||
}
|
||||
|
||||
countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_HVC_Err_Status_Msg);
|
||||
if (countQueue_ccu_candb_rx == 0) {
|
||||
status = osMessageQueueGet(env->ccu_candb_rx_HVC_Err_Status_Msg, &rtDW.HVC_ERR_STATUS_MSG_MODEL, 0, 0U);
|
||||
}
|
||||
|
||||
/*
|
||||
if (osMutexAcquire(env->access, 5000) == osOK) {
|
||||
memcpy(&rtDW.TM_CP_model, &ccu_candb_rx.TM_CP, sizeof(rtDW.TM_CP_model));
|
||||
memcpy(&rtDW.FIU_CCU1_MODEL, &ccu_candb_rx.FIU_CCU1, sizeof(rtDW.FIU_CCU1_MODEL));
|
||||
|
|
@ -96,9 +224,12 @@ void get_CanSpamReceiver(tCanSpamReceiver *env) {
|
|||
memcpy(&rtDW.HVC_ERR_STATUS_MSG_MODEL, &ccu_candb_rx.HVC_Err_Status_Msg, sizeof(rtDW.HVC_ERR_STATUS_MSG_MODEL));
|
||||
|
||||
osMutexRelease(env->access);
|
||||
|
||||
} else {
|
||||
LoggerErrorStatic(LOGGER, LOG_SIGN, "Access error get_CanSpamReceiver");
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
static _Noreturn void CanSpamReceiver_Thread(tCanSpamReceiver *env) {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,17 @@ typedef struct {
|
|||
osMutexId_t access;
|
||||
can_rx_message_type canFrame;
|
||||
|
||||
osMessageQueueId_t ccu_candb_rx_TM_CP;
|
||||
osMessageQueueId_t ccu_candb_rx_FIU_CCU1;
|
||||
osMessageQueueId_t ccu_candb_rx_FIU_CCU2;
|
||||
osMessageQueueId_t ccu_candb_rx_BCM_Powertrain;
|
||||
osMessageQueueId_t ccu_candb_rx_BCM_CLIMATIC_DATA;
|
||||
osMessageQueueId_t ccu_candb_rx_EMS_Veh;
|
||||
osMessageQueueId_t ccu_candb_rx_ESC_04;
|
||||
osMessageQueueId_t ccu_candb_rx_BCM_VEH_STATE;
|
||||
osMessageQueueId_t ccu_candb_rx_EMS_HVC_Req_Msg;
|
||||
osMessageQueueId_t ccu_candb_rx_HVC_Err_Status_Msg;
|
||||
|
||||
tLoggerInterface *logger;
|
||||
|
||||
struct {
|
||||
|
|
|
|||
Loading…
Reference in New Issue