📄 edmahst.c
字号:
/*-------------------------------------------------------------------------*/
/* FILENAME: edmahst.c -- DSK - HOST Code */
/* */
/* Rev 2.10 05 June 2000 T.J.Dillon */
/* */
/*-------------------------------------------------------------------------*/
/* HISTORY */
/* Rev 1.00 Created */
/* Rev 1.10 Added -pa, -pb, -pc, -pd options */
/* Rev 2.10 Fixed error in help mode logic */
/* */
/*-------------------------------------------------------------------------*/
#include <stdio.h>
#include <windows.h>
#include "dsk6211.h"
#define ULONG unsigned long
/*-------------------------------------------------------------------------*/
/* main() */
/*-------------------------------------------------------------------------*/
void main(int argc1, char *argv1[])
{
dskHANDLE hBd; /* Board device handle */
short iBd = 0; /* Board index */
BOOL bExcl = 1; /* Exclusive open = TRUE */
short iMp = 1; /* Map selector = MAP1 */
char coffNam[20]= "codec_edma.out";
/* COFF file name */
BOOL bVerbose = 0; /* COFF load verbose mode = FALSE */
BOOL bClr = 0; /* Clear bss mode = FALSE */
BOOL bDump = 0; /* Dump mode = FALSE */
ULONG nPort=0xa;
int i;
/*-----------------------------------------------------------------------*/
/* Parse Command Line. */
/*-----------------------------------------------------------------------*/
for(i=1; argc1 > i; i++)
{
if( argv1[i][0] != '-' )
{
printf( "\nERROR: \n A dash (-) is required before all options!\n",argv1[i][1]);
}
else
{
switch(tolower(argv1[i][1]))
{
case 'h':
case '?':
printf( "Syntax: edmahst [-?] [-pport] \n");
printf( "\n");
printf( " -?,h : Displays command line help info.\n");
printf( " -pport : Specifies board to test (a,b,c or d).\n");
exit(0);
break;
case 'p':
switch(tolower(argv1[i][2]))
{
case 'a':
nPort=0xa;
break;
case 'b':
nPort=0xb;
break;
case 'c':
nPort=0xc;
break;
case 'd':
nPort=0xd;
break;
default:
nPort=0xa;
break;
}
break;
default:
printf( "\nOPTION (-%c) IGNORED: \n Valid options are -?,-h and -pport!\n",argv1[i][1]);
break;
}
}
}
/*-----------------------------------------------------------------------*/
/* Open a driver connection to a dsk6x board. */
/*-----------------------------------------------------------------------*/
if ( !dsk6x_open(nPort,&hBd) )
{
printf("FAILED: dsk6x_open()!\n");
exit(1);
}
/*-----------------------------------------------------------------------*/
/* Cause a DSP reset. */
/*-----------------------------------------------------------------------*/
if ( !dsk6x_reset_dsp(hBd,0,1) )
{
printf("FAILED: dsk6x_reset_dsp()!\n");
exit(2);
}
/*-----------------------------------------------------------------------*/
/* Establish a connection to the HPI of a target board. */
/*-----------------------------------------------------------------------*/
if ( !dsk6x_hpi_open(hBd))
{
printf("FAILED: dsk6x_hpi_open()!\n");
exit(3);
}
/*-----------------------------------------------------------------------*/
/* Read a COFF file and write the data to DSP memory. */
/*-----------------------------------------------------------------------*/
if (dsk6x_coff_load(hBd,coffNam,bVerbose,bClr,bDump))
{
printf("FAILED: dsk6x_coff_load()!\n");
exit(4);
}
/*-----------------------------------------------------------------------*/
/* Generate a DSPINT to start program */
/*-----------------------------------------------------------------------*/
if (!dsk6x_hpi_generate_int(hBd))
{
printf("FAILED: dsk6x_hpi_generate_int()!\n");
exit(5);
}
/*-----------------------------------------------------------------------*/
/* Close the new HPI session started with evm6x_hpi_open() */
/*-----------------------------------------------------------------------*/
if (!dsk6x_hpi_close(hBd))
{
printf("FAILED: dsk6x_hpi_close()!\n");
exit(6);
}
/*-----------------------------------------------------------------------*/
/* Close a previously opened driver connection to a board. */
/*-----------------------------------------------------------------------*/
if (!dsk6x_close(hBd))
{
printf("FAILED: dsk6x_close()!\n");
exit(7);
}
/*-----------------------------------------------------------------------*/
/* Cleanup */
/*-----------------------------------------------------------------------*/
printf("PASSED: HOST Program Complete!\n");
exit(0);
} /* end of main() */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -