📄 send_c30.c
字号:
/* SEND_C30.C - SENDOUT, GETINPUT : TMS320C30 CODE */
#include "c30.h" /* GENERIC SUPPORT MACROS & STRUCTURES */
#include "send_c30.h" /* APPLICATION MACROS, GLOBALS, STRUCTURES, PROTOTYPES*/
/* sendout function to put a sample in the output FIFO */
void sendout(float x)
{
if(!int_flag) {
input = (int *) calloc(BLOCK_SIZE, sizeof(int)); /* AIC INPUT */
output = (int *) calloc(BLOCK_SIZE, sizeof(int)); /* AIC OUTPUT */
int_flag = 1;
init_aic(); /* INITIALIZE TLC32044 ANALOG INTERFACE CHIP */
}
if((++out_inx) == BLOCK_SIZE) out_inx = 0;
while(out_inx == index);
output[out_inx] = (int)x;
}
/* getinput function to get a sample from the input FIFO */
float getinput()
{
if(!int_flag) {
input = (int *) calloc(BLOCK_SIZE, sizeof(int)); /* AIC INPUT */
output = (int *) calloc(BLOCK_SIZE, sizeof(int)); /* AIC OUTPUT */
int_flag = 1;
init_aic(); /* INITIALIZE TLC32044 ANALOG INTERFACE CHIP */
}
if((++in_inx) == BLOCK_SIZE) in_inx = 0;
while(in_inx == index);
return((float)input[in_inx]);
}
/* empty the output buffer */
void flush()
{
while(out_inx != index);
asm(" XOR 2000h,ST"); /* RESET GLOBAL INTERRUPT ENABLE BIT */
int_flag = 0;
}
/* C_INT05() */
/* SERIAL PORT 0 TRANSMIT INTERRUPT SERVICE ROUTINE */
/* 1. IF SECONDARY TRANSMISSION SEND AIC COMMAND WORD */
/* 2. OTHERWISE IF COMMAND SEND REQUESTED SETUP FOR SECONDARY */
/* TRANSMISSION ON NEXT INTERRUPT */
/* 3. OTHERWISE WRITE OUT OUTPUT DATA AND READ IN INPUT DATA */
void c_int05(void)
{
if (send_command)
{
if (secondary_transmit)
{
serial_port[0][X_DATA] = aic_secondary;
secondary_transmit = OFF;
send_command = OFF;
}
else
{
serial_port[0][X_DATA] = 3;
secondary_transmit = ON;
}
}
else
{
serial_port[0][X_DATA] = output[index] << 2;
input[index] = serial_port[0][R_DATA] << 16 >> 18;
if ((++index) == BLOCK_SIZE) index = 0;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -