dcmpitst.h



/* -----------------------------------------------------------------------
File dcmpitst.h
 
Defines, macros, includes for dcmpitst.c 
dcmpitst.c runs an interlaced output test of the SDL ROI decompressor board

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

/* ------------------------ Rev history -------------------------------

LRE 2-19-96 Created
LRE 2-22-96 Ready to run?

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

/* -------------------- include .h files ------------------------------ */

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <systypes.h>
#include <sysstat.h>
#include <mcos.h>
#include <rint.h>
#include <rio.h>
#include <fcntl.h>


/* ------------------- misc defines ---------------------------------- */


#define ulong unsigned long

#define TRUE  1
#define FALSE 0

#define EXIT_OK  0
#define EXIT_BAD 1


/* --------------------------- readability macros --------------------- */


#define CHK_RC(a,b) if(rc != a) exit_bad(rc,b) ;

#define CHK_VERB(a) if(verbose) print_msg(a) ;

/* --------------------------- error exit codes ----------------------- */

#define ERR_ID_BASE 100

#define DCMP_MEM_ATTACH_ERR (ERR_ID_BASE + 0)
#define DCMP_MEM_CREATE_ERR (ERR_ID_BASE + 1)
#define DCMP_MEM_MAP_ERR (ERR_ID_BASE + 2)

#define DCMP_LD_FILE_OPEN_ERR (ERR_ID_BASE + 3)
#define DCMP_LD_FILE_RD_ERR (ERR_ID_BASE + 4)

#define CMP_FRM_BUF_CREATE_ERR (ERR_ID_BASE + 5)
#define CMP_FRM_BUF_MAP_ERR (ERR_ID_BASE + 6)

#define CMP_FRM_FILE_OPEN_ERR (ERR_ID_BASE + 7)
#define CMP_FRM_FILE_RD_ERR (ERR_ID_BASE + 8)

#define DCMP_FRM_BUFS_CREATE_ERR (ERR_ID_BASE + 9)
#define DCMP_FRM_BUFS_MAP_ERR (ERR_ID_BASE + 10)

#define RINO_ATTACH_ERR (ERR_ID_BASE + 11)
#define CMP_FRM_TEMPL_CREATE_ERR (ERR_ID_BASE + 12)
#define CMP_FRM_XFR_SETUP_ERR (ERR_ID_BASE + 13)

#define DCMP_FRM_TEMPL_CREATE_ERR (ERR_ID_BASE + 14)
#define DCMP_FRM_XFR_SETUP_ERR (ERR_ID_BASE + 15)
#define DCMP_GRP_XFR_SETUP_ERR (ERR_ID_BASE + 16)

#define ROUT_RESET_ERR (ERR_ID_BASE + 17)
#define RINT_RESET_ERR (ERR_ID_BASE + 18)
#define RINT_1_STRT_ERR (ERR_ID_BASE + 19)
#define RINT_2_STRT_ERR (ERR_ID_BASE + 20)
#define ROUT_STRT_ERR (ERR_ID_BASE + 21)
#define WAIT_OUT_DONE_ERR (ERR_ID_BASE + 22)

#define WAIT_IN_1_DONE_ERR (ERR_ID_BASE + 23)
#define WAIT_IN_2_DONE_ERR (ERR_ID_BASE + 24)

#define CMP_FRM_FILE_CLOSE_ERR (ERR_ID_BASE + 25)
#define DCMP_LD_FILE_CLOSE_ERR (ERR_ID_BASE + 26)

#define DCMP_FRM_FILE_OPEN_ERR (ERR_ID_BASE + 27)
#define DCMP_FRM_FILE_WR_ERR (ERR_ID_BASE + 28)
#define DCMP_FRM_SHORT_FILE_WR_ERR (ERR_ID_BASE + 29)
#define DCMP_FRM_FILE_CLOSE_ERR (ERR_ID_BASE + 30)

#define DCMP_MALLOC_ERR (ERR_ID_BASE + 31)
#define DCMP_SHRT_FILE_ERR (ERR_ID_BASE + 32)

/* -------------------------- verbosity msg codes --------------------- */

#define MSG_ID_BASE 100

#define START_MSG_ID (MSG_ID_BASE + 0)
#define STRT_VME_ATTACH_MSG_ID (MSG_ID_BASE + 1)
#define VME_ATTACHED_MSG_ID (MSG_ID_BASE + 2)
#define STRT_VME_CREATE_MSG_ID (MSG_ID_BASE + 3)
#define VME_CREATED_MSG_ID (MSG_ID_BASE + 4)
#define STRT_VME_MAP_MSG_ID (MSG_ID_BASE + 5)
#define VME_MAPPED_MSG_ID (MSG_ID_BASE + 6)
#define STRT_DCMP_LD_FILE_OPEN_MSG_ID (MSG_ID_BASE + 7)
#define DCMP_LD_FILE_OPENED_MSG_ID (MSG_ID_BASE + 8)
#define STRT_BIN_LD_MSG_ID (MSG_ID_BASE + 9)
#define BIN_LDED_MSG_ID (MSG_ID_BASE + 10)
#define STRT_CMP_FRM_BUF_CREATE_MSG_ID (MSG_ID_BASE + 11)
#define CMP_FRM_BUF_CREATED_MSG_ID (MSG_ID_BASE + 12)
#define STRT_CMP_FRM_BUF_MAP_MSG_ID (MSG_ID_BASE + 13)
#define CMP_FRM_BUF_MAPPED_MSG_ID (MSG_ID_BASE + 14)
#define STRT_CMP_FRM_FILE_OPEN_MSG_ID (MSG_ID_BASE + 15)
#define CMP_FRM_FILE_OPENED_MSG_ID (MSG_ID_BASE + 16)
#define STRT_CMP_FRM_LD_MSG_ID (MSG_ID_BASE + 17)
#define CMP_FRM_LDED_MSG_ID (MSG_ID_BASE + 18)
#define STRT_DCMP_FRM_BUFS_CREATE_MSG_ID (MSG_ID_BASE + 19)
#define DCMP_FRM_BUFS_CREATED_MSG_ID (MSG_ID_BASE + 20)
#define STRT_DCMP_FRM_BUFS_MAP_MSG_ID (MSG_ID_BASE + 21)
#define DCMP_FRM_BUFS_MAPPED_MSG_ID (MSG_ID_BASE + 22)
#define STRT_RINO_ATTACH_MSG_ID (MSG_ID_BASE + 23)
#define RINO_ATTACHED_MSG_ID (MSG_ID_BASE + 24)
#define STRT_CMP_FRM_TEMPL_CREATE_MSG_ID (MSG_ID_BASE + 25)
#define CMP_FRM_TEMPL_CREATED_MSG_ID (MSG_ID_BASE + 26)
#define STRT_CMP_FRM_SETUP_XFR_MSG_ID (MSG_ID_BASE + 27)
#define CMP_FRM_XFR_SETUP_MSG_ID (MSG_ID_BASE + 28)
#define STRT_SETUP_DCMP_FRMS_XFR_MSG_ID (MSG_ID_BASE + 29)
#define DCMP_FRMS_GRP_SETUP_MSG_ID (MSG_ID_BASE + 30)
#define STRT_ROUT_RESET_MSG_ID (MSG_ID_BASE + 31)
#define END_ROUT_RESET_MSG_ID (MSG_ID_BASE + 32)
#define STRT_RINT_RESET_MSG_ID (MSG_ID_BASE + 33)
#define END_RINT_RESET_MSG_ID (MSG_ID_BASE + 34)
#define RESETTING_IO_MSG_ID (MSG_ID_BASE + 35)
#define STRT_DCMP_MSG_ID (MSG_ID_BASE + 36)
#define STRT_IO_MSG_ID (MSG_ID_BASE + 37)
#define IO_STRTED_MSG_ID (MSG_ID_BASE + 38)
#define WAIT_OUT_DONE_MSG_ID (MSG_ID_BASE + 39)
#define RESET_DCMP_MSG_ID (MSG_ID_BASE + 40)
#define WAIT_IN_DONE_MSG_ID (MSG_ID_BASE + 41)
#define ALL_DONE_MSG_ID (MSG_ID_BASE + 42)
#define STRT_CMP_FRM_FILE_CLOSE_MSG_ID (MSG_ID_BASE + 43)
#define CMP_FRM_FILE_CLOSED_MSG_ID (MSG_ID_BASE + 44)
#define STRT_DCMP_LD_FILE_CLOSE_MSG_ID (MSG_ID_BASE + 45)
#define DCMP_LD_FILE_CLOSED_MSG_ID (MSG_ID_BASE + 46)
#define STRT_DCMP_FRM_OUT_FILE_OPEN_MSG_ID (MSG_ID_BASE + 47)
#define DCMP_FRM_OUT_FILE_OPENED_MSG_ID (MSG_ID_BASE + 48)
#define STRT_DCMP_FRM_WR_MSG_ID (MSG_ID_BASE + 49)
#define DCMP_FRM_WRITTEN_MSG_ID (MSG_ID_BASE + 50)
#define STRT_DCMP_FRM_OUT_FILE_CLOSE_MSG_ID (MSG_ID_BASE + 51)
#define DCMP_FRM_OUT_FILE_CLOSED_MSG_ID (MSG_ID_BASE + 52)

/* ------------------- development and portability defines ------------ */


#define TST

#define DCMP_BD_SIZE (2 * 0x18000)
#define CNTL_WORD_OFFSET 0x3803
#define SET_FRM_VALID 0x1
#define SET_INIT_MODE 0x2
#define SET_SLAVE 0x4
#define SET_MS_MODE 0x8
#define SET_LINEAR 0x10
#define LINE_LNGTH_OFFSET 0x380e
#define LIN_LINE_LNGTH 3016
#define AREA_LINE_LNGTH 630
#define MI_COEF1_OFFSET 0x3380
#define COEF_REGA_OFFSET 0x339C
#define MI_COEF3_OFFSET (MI_COEF1_OFFSET + 12)
#define MI_COEF4_OFFSET 0x3390
#define MI_COEF6_OFFSET (MI_COEF4_OFFSET + 12)
#define COEF_REGD_OFFSET (COEF_REGA_OFFSET + 3)
#define STATUS_OFFSET 0x3800
#define LUT_OFFSET 0X1000
#define HALF_RES 25
#define FULL_RES 45
#define SEQ_VALID_OFFSET 0x380a

#define CMP_FRM_BUF_NAME "cmp_frm_buf"
#define CMP_FRM_BUF_SIZE 0x800000
#define NUM_DCMP_FRM_BUFS 4
#define DCMP_FRM_SIZE (5040 * 5040)
#define CMP_FRM_BUF_CEID 3
#define FIRST_DCMP_FRM_BUF_CEID 4
#define SECOND_DCMP_FRM_BUF_CEID 5
#define DCMP_BUF_BASE_NAME "dcmp_buf_"
#define TEST_DATA 0x55aa
/* #define NUM_LINES 2520 */
#define NUM_LINES 5040 
#define LINES_PER_BUF (NUM_LINES / NUM_DCMP_FRM_BUFS)
#define LINE_LNGTH (DCMP_FRM_SIZE / NUM_LINES)

#define DCMP_1_VME_NAME "DCMP_VME_A"
#define DCMP_2_VME_NAME "DCMP_VME_B"



#ifdef  TST

#define ROUT_NAME "CA_ROUT"
#define RINT_NAME_1 "CA_RINT"
#define RINT_NAME_2 "CA_RINT"

#else

#define ROUT_NAME "DCMP_1_ROUT"
#define RINT_NAME_1 "DCMP_1_RINT"
#define RINT_NAME_2 "DCMP_2_RINT"

#endif