📄 board.h
字号:
/*****************************************************************************/
/*****************************************************************************/
/* BOARD.H - Header file for board.c */
/* */
/* */
/* FUNCTIONS: */
/* */
/* brd_init() */
/* brd_init_bios() */
/* brd_fifo_read() */
/* brd_fifo_write() */
/* brd_led_enable() */
/* brd_led_disable() */
/* brd_led_toggle() */
/* */
/* */
/* STATIC FUNCTIONS: */
/* None */
/* */
/* */
/* GLOBAL VARIABLES DEFINED */
/* */
/* */
/*****************************************************************************/
#ifndef _BOARD_H
#define _BOARD_H
#include <type.h>
#undef OK
#define OK 0
#undef ERROR
#define ERROR -1
//port declarations used to access CPLD registers
volatile ioport u16 port0;
volatile ioport u16 port1;
volatile ioport u16 port2;
volatile ioport u16 port3;
volatile ioport u16 port4;
volatile ioport u16 port5;
volatile ioport u16 port6;
volatile ioport u16 port7;
/*----------------------------------------------------------------------------*/
/* MACRO DEFINITIONS */
/*----------------------------------------------------------------------------*/
#define MIN_CPU_FREQ 10
#define MAX_CPU_FREQ 100
#define DELAY_TIMER_PORT 0
#define LED0_MASK 0x1
#define LED1_MASK 0x2
#define LED2_MASK 0x4
#define CPLD_CTRL1_DEFAULT 0x10 //NMIEN=1
#define CPLD_DMCTRL_DEFAULT 0x00
#define CPLD_DBIO_DEFAULT 0x30
#define CPLD_CTRL2_DEFAULT 0x03
#define CPLD_SEM0_DEFAULT 0x00
#define CPLD_SEM1_DEFAULT 0x00
#define CPLD_SLIC_DEFAULT 0x00
#define CPLD_CTRL1_REG port0
#define CPLD_STAT_REG port1
#define CPLD_DMCTRL_REG port2
#define CPLD_DBIO_REG port3
#define CPLD_CTRL2_REG port4
#define CPLD_SEM0_REG port5
#define CPLD_SEM1_REG port6
#define CPLD_SLIC_REG port7
//CPLD register addresses used the C-callable portio routines
//DO NOT use the above defines with the c-callable portio
//routines prototyped in portio.h
#ifdef C5410
typedef enum
{
CpldCtrl1Reg = 0x00,
CpldStatReg = 0x01,
CpldDmctrlReg = 0x02,
CpldDbioReg = 0x03,
CpldCtrl2Reg = 0x04,
CpldSem0Reg = 0x05,
CpldSem1Reg = 0x06,
CpldSlicReg = 0x07
} CpldReg, *PCpldReg;
#else
typedef enum
{
CpldCtrl1Reg = 0x00,
CpldStatReg = 0x01,
CpldDmctrlReg = 0x02,
CpldDbioReg = 0x03,
CpldCtrl2Reg = 0x04,
CpldSem0Reg = 0x05,
CpldSem1Reg = 0x06
} CpldReg, *PCpldReg;
#endif
//dsk semaphores
typedef enum
{
BRD_SEM0,
BRD_SEM1
} BrdSem;
typedef enum
{
BRD_HINT,
BRD_HINT2
} BrdIntr;
typedef enum
{
BRD_LED0,
BRD_LED1,
BRD_LED2
} BrdLed;
typedef void (*Fp)(void);
/*****************************************************************************/
/* FUNCTIONS */
/*****************************************************************************/
/******************************************************************************/
/* brd_init(u16 freq) - Initialize DSK board for use */
/* */
/* Parameters: */
/* - freq: Desired board operating frequency. */
/* */
/* Return: */
/* - OK success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/* Board frequencies must be a multiple of 10 with the lowest being 20 MHz */
/* and the highest being 100 MHz. Board frequencies supported are: */
/* 20,30,40,50,60,70, */
/* */
/* WARNING: This function is not compatible with DSP/BIOS */
/* */
/******************************************************************************/
s16 brd_init(unsigned int cpuFreq);
/******************************************************************************/
/* brd_init_bios() - Initialize DSK board for use with DSP BIOS */
/* */
/* Parameters: none */
/* */
/* Return: */
/* - OK success */
/* - ERROR failure */
/* */
/* */
/******************************************************************************/
s16 brd_init_bios(void);
/*****************************************************************************/
/* s16 brd_interrupt_host(EvmInt intr) */
/* */
/* This routine interrupts the host application . */
/* */
/* Parameters: */
/* - intr: specified interrupt */
/* Return: */
/* - OK success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/*****************************************************************************/
s16 brd_interrupt_host(BrdIntr intr);
/*****************************************************************************/
/* s16 brd_led_enable(BrdLed led) */
/* */
/* This routine enables the dsk led. . */
/* */
/* Parameters: */
/* - led - specific led */
/* */
/* Return: */
/* - OK success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/*****************************************************************************/
s16 brd_led_enable(BrdLed led);
/*****************************************************************************/
/* s16 brd_led_disable(BrdLed led) */
/* */
/* This routine disables the dsk led. . */
/* */
/* Parameters: */
/* - led - specific led */
/* */
/* Return: */
/* - OK success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/*****************************************************************************/
s16 brd_led_disable(BrdLed led);
/*****************************************************************************/
/* s16 brd_toggle_led(BrdLed led) */
/* */
/* This routine enables the dsk led. . */
/* */
/* Parameters: */
/* - led - specific led */
/* */
/* Return: */
/* - OK success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/*****************************************************************************/
s16 brd_led_toggle(BrdLed led);
/*****************************************************************************/
/* s16 brd_sem_get(void) */
/* */
/* This routine tries to obtain the specified user semaphore. */
/* */
/* */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -