// +FHDR------------------------------------------------------------
//                 Copyright (c) 2022 SmartLogic.
//                       ALL RIGHTS RESERVED
// -----------------------------------------------------------------
// Filename      : spu_hw_queue.h
// Author        : lishuang.xie
// Created On    : 2023-02-06
// Last Modified :
// -----------------------------------------------------------------
// Description:
//
//
// -FHDR------------------------------------------------------------

#ifndef __SPU_HW_QUEUE_H__
#define __SPU_HW_QUEUE_H__

#include "typedef.h"
#include "ucp_utility.h"

#define ECS_RFM_SPU0_HW_QUEUE   (14)//(6)
#define ECS_RFM_SPU1_HW_QUEUE   (15)//(7)

/* message head */
typedef struct ECS_MSG_HEAD
{
    uint32_t msg_size;      /* message size */
    uint8_t  msg_type;      /* message type */
    uint8_t  msg_type_oam;/* padding */
    uint8_t  msg_padding[2];

    uint8_t  src_core_id;   /* src core ID */
    uint8_t  dst_core_id;   /* dst core ID */
    uint8_t  src_task_id;   /* src task ID */
    uint8_t  dst_task_id;   /* dst task ID */

    uint8_t  data[0];
}ecs_msg_head;

#define ECS_MSG_HEAD_LEN sizeof(ecs_msg_head)

/* calback function type */
typedef void(*ECS_HWQUE_IRQ_FUNC)();

typedef struct ECS_HW_QUE_INFO_withirq
{
    int32_t ecs_hq_id;
    int32_t ecs_hq_vector;
    ECS_HWQUE_IRQ_FUNC irq_entry;
}ecs_hw_que_info_withirq_t;

typedef struct ECS_HW_QUE_INFO_NOIRQ
{
    int32_t ecs_hq_id;
    int32_t ecs_hq_vector;
}ecs_hw_que_info_noirq_t;

void ecs_hw_que_init(uint8_t core_id);
void ecs_hw_que_init_withirq(uint8_t core_id, uint8_t que_id);
void ecs_hw_que_init_noirq(uint8_t core_id, uint8_t que_id);
ALWAYS_INLINE int32_t ecs_hw_que_send(uint8_t u8dst_que_id, uint32_t u32value);
ALWAYS_INLINE int32_t ecs_hw_que_recv(uint8_t u8dst_que_id, uint32_t *pu32value);


#endif /* __SPU_HW_QUEUE_H__ */

