已回答假定已回答

一个关于SPORT口传输的简单问题

cuckoo 在 2016-3-13 詢問的問題
最後回覆由hpkamen於2016-6-5提供

刚刚接触到SHARC DSP,看到例程中有类似这样的语句:

fract SPORT_Buffer[num_SPORT_Buf][num_I2S_AD][num_samples_ISR];

int SPORT_TCB[num_SPORT_Buf][num_I2S_AD][4];
int receivetcb[num_SPORT_Buf][num_I2S_AD][4];
int transmittcb[num_SPORT_Buf][num_I2S_DA][4];


int AudioCodec_ID, Buffer_ID;
for(Buffer_ID = num_SPORT_Buf - 1; Buffer_ID >= 0; Buffer_ID--)
{
  for(AudioCodec_ID = num_I2S_AD-1; AudioCodec_ID >= 0; AudioCodec_ID--)
  {
   receivetcb[Buffer_ID][AudioCodec_ID][0] = (((int) receivetcb[(Buffer_ID + 1) % num_SPORT_Buf][AudioCodec_ID] + 3) & 0x7FFFF) | (1<<19); //  Switch to the next TCB
   receivetcb[Buffer_ID][AudioCodec_ID][1] = num_samples_ISR;
   receivetcb[Buffer_ID][AudioCodec_ID][2] = 1;   // I/O step size
   receivetcb[Buffer_ID][AudioCodec_ID][3] = (int)SPORT_Buffer[Buffer_ID][AudioCodec_ID];  // The buffer being filled, to be processed
  }
 
  //  (int)SPORT_Buffer[(Buffer_ID-1)%num_SPORT_Buf][AudioCodec_ID]  is the buffer being processed, to be transmitted
 
  for(AudioCodec_ID = num_I2S_DA - 1; AudioCodec_ID >= 0; AudioCodec_ID--)
  {
   transmittcb[Buffer_ID][AudioCodec_ID][0] = (((int) transmittcb[(Buffer_ID + 1) % num_SPORT_Buf][AudioCodec_ID] + 3) & 0x7FFFF) | (1<<19);  //  Switch to the next TCB
   transmittcb[Buffer_ID][AudioCodec_ID][1] = num_samples_ISR;
   transmittcb[Buffer_ID][AudioCodec_ID][2] = 1;   // I/O step size
   transmittcb[Buffer_ID][AudioCodec_ID][3] = (int)SPORT_Buffer[(Buffer_ID + 1) % num_SPORT_Buf][AudioCodec_ID];  // The buffer being transmitted, to be filled
  }
}

从代码中看出好像这样数据就接收到SPORT_Buffer中了,我的疑问是:SPORT_Buffer仅仅是在内存中自己定义的一个变量,它是怎样和物理的sport buffer产生关联的呢?

結果