/*****************************************************************************/ /** * Description: MPC protocol head file. * * Date: 2023-05-06 10:12 * Last Edit Time: [2023-05-06 10:13] * * Revisions: Rev 0.0 * History: * [2023-05-06]: Initial version. * * Copyright(c) 2021 Beijing Institute of Technology. * ******************************************************************************/ #ifndef __MPC_H_ #define __MPC_H_ /***************************** Include Files *********************************/ #include #include #include "mpc_hw.h" // MPC driver #include "circ_queue.h" #include "../system_monitor.h" /************************** Constant Definitions *****************************/ /************************** Data Type Definitions ****************************/ // Definition of MPC instance. typedef struct { uint32_t bramId; uint32_t gpioId; uint32_t txQueueMax; uint32_t rxQueueMax; } MPC_CONFIG; typedef struct { MPC_CONFIG config; SYSBUSLOG mpcLog; // mpc log LINKLOG linkLog; // Link layer log PHYLOG phyLog; // Physical layer log HWSTATE hwState; // Hardware status MPC_HW *mpchwDesc; CIRC_QUEUE *txQueue; CIRC_QUEUE *rxQueue; bool isEnable; bool isRxDone; bool isTxDone; } MPC; /************************** Function Prototypes ******************************/ int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config); void Mpc_Destroy(MPC *instPtr); int32_t Mpc_HandleCmd(MPC *instPtr); int32_t Mpc_PendRemoteTest(MPC *instPtr); int32_t Mpc_MakeResp(MPC *instPtr); int32_t Mpc_TxIrqHandler(MPC *instPtr); int32_t Mpc_RxIrqHandler(MPC *instPtr); bool Mpc_IsEnable(MPC *instPtr); bool Mpc_IsReqPending(MPC *instPtr); bool Mpc_IsRsqPending(MPC *instPtr); bool Mpc_IsTxBusy(MPC *instPtr); bool Mpc_IsRxBusy(MPC *instPtr); #endif //__MPC_H_