/*-------------------------------------------------------------------------------------------------
--
-- File Name    : coaxpressHost.h



-- Description  : This module replicates the CoaXPress Host Driver modules.




-- Targeted device : Microchip FPGAs
-- Author          : India Solutions Team




--
-- COPYRIGHT 2023 BY MICROCHIP
-- THE INFORMATION CONTAINED IN THIS DOCUMENT IS SUBJECT TO LICENSING RESTRICTIONS
-- FROM MICROCHIP CORP.  IF YOU ARE NOT IN POSSESSION OF WRITTEN AUTHORIZATION FROM
-- MICROCHIP FOR USE OF THIS FILE, THEN THE FILE SHOULD BE IMMEDIATELY DESTROYED AND
-- NO BACK-UP OF THE FILE SHOULD BE MADE.
--



-------------------------------------------------------------------------------------------------*/

#ifndef COAXPRESSHOST_H_
#define COAXPRESSHOST_H_

#define CMD_RATE_SEL_ADDR     (0x71000000 + 0x00)
#define CMD_WR_ADDRESS        (0x71000000 + 0x08)
#define HSDC_RX_SW_PKT_VAL    (0x71000000 + 0x0C)
#define RD_ACK_ADDRESS        (0x71000000 + 0x10)
#define RX_STREAM_SID         (0x71000000 + 0x38)

#define CONTROL_CMD_WITHOUT_TAG                     0x02020202
#define CONTROL_CMD_WITH_TAG                        0x05050505
#define CONTROL_ACK_WITHOUT_TAG                     0x03030303
#define CONTROL_ACK_WITH_TAG                        0x06060606
#define CONTROL_CMD_READ                            0x00000000
#define CONTROL_CMD_WRITE                           0x01000000
#define ACK_CMD_EXEC_OK_APPEND_REPLY                0x00000000
#define ACK_CMD_EXEC_OK_NO_APPEND_REPLY             0x01010101
#define ACK_CMD_INVALID_DATA_FOR_ADDRESS            0x41414141
#define ACK_CMD_INVALID_CONTROL_OPERATION           0x42424242
#define ACK_CMD_WRITE_ATTEMPT_TO_READONLY_ADDRESS   0x43434343
#define START_OF_THE_PACKET                         0xfbfbfbfb
#define END_OF_THE_PACKET                           0xfdfdfdfd

#define FOUR_BYTES 4

uint8_t receive_resp_cmd(uint32_t rd_pkt[]);
void send_read_cmd(uint32_t crc_buffer[], uint32_t host_cmd_address, uint8_t tag, uint16_t size);
void send_write_cmd(uint32_t crc_buffer[], uint32_t host_cmd_address, uint32_t host_cmd_wdata, uint8_t tag, uint16_t size);

#endif /* COAXPRESSHOST_H_ */
