common.h

来自「DSP课程课堂作业程序」· C头文件 代码 · 共 54 行

H
54
字号
/******************************************************************************/
/******************************************************************************/
/*  COMMON.H - This file contains macros and data structures used to implement */
/*             the fifo.                                                      *
/*                                                                            */
/*                                                                            */
/******************************************************************************/
#ifndef _COMMON_H_
#define _COMMON_H_

#include <type.h>

/*----------------------------------------------------------------------------*/
/* MACRO DEFINITIONS                                                          */
/*----------------------------------------------------------------------------*/
#define OK                       0
#undef  ERROR
#define ERROR                   -1

#define CLOSED                   0
#define OPEN                     1
#define BUSY                     2


//these two will be properly defined later
#define  FIFO_ADDR               0x043a
//#define  CIO_ADDR                0x02fe 

#define FIFO_SIZE                32

#define ABORT                    -2

/*----------------------------------------------------------------------------*/
/* ERROR CODES                                                                */
/*----------------------------------------------------------------------------*/
#define ERR_BOARD_NOT_INITIALIZED  -1
#define ERR_CODEC_NOT_OPENED       -2
#define ERR_INVALID_CMD            -5


typedef struct _FifoChannel{
   u16	state;					   //indicates state of I/O 
   u16	takePtr;				   //ptr to end of written data
   u16	putPtr;					   //ptr to beginning of non-read data
   u16	data[FIFO_SIZE];		   //fifo buffer
} FifoChannel, *PFifoChannel;

typedef struct _FIFO {
   FifoChannel dsp_ch;
   FifoChannel host_ch;
} FIFO, *PFIFO;

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?