DSP 之(HPI) 编程:
/*--------------------------------------------------------------------------
* Project: HPI.c
* Name: zwp
* Date: 2014.2
*-------------------------------------------------------------------------*/
#include <csl.h>
#include <csl_hpi.h>
#include <csl_dma.h>
ioport Uint16* hpi_ctl;
HPI_Config myconfig;
DMA_Handle hDma;
HPI_Config myConfig = {
0x3, /* HPWREMU, Select FREE = SOFT = 1 */
0x0, /* HGPIOEN, Disable all GPIO pins */
0x80, /* HPIC, Reset HPI */
};
int main(void)
{
Uint16 myregval;
Uint16 myvar;
/*初始化CSL库*/
CSL_init();
/* Writes to HPI register using values in configuration structure */
HPI_config(&myConfig);
/* Reads current HPI configuration */
HPI_getConfig(&myconfig);
/* gets the address of an HPI register */
hpi_ctl = HPI_ADDR(HPIC);
printf("HPI register's address = %d\n", hpi_ctl);
/* enable HA[0:7], HD[8:15], HD[0:7] for GPIO */
myregval = HPI_HGPIOEN_RMK (0,1,1,1,0,0,0,0,0);
/* set HPI register value */
HPI_RSET(HPIC, 1);
/* get HPI register value */
myval = HPI_RGET(HPIC);
return 0;
}