将为结构元素命令设置什么值?

时间:2013-12-14 05:26:11

标签: c networking operating-system

struct Descriptor *Rx_Descriptors = (struct Descriptor *)0x100000;
void setup_rx_descriptors()
 {
     unsigned int OWN = 0x80000000, EOR = 0x40000000; 
     int i;
     for(i = 0; i < num_of_rx_descriptors; i++) 
     {
         if(i == (num_of_rx_descriptors - 1)) 
           Rx_Descriptors[i].command = (OWN | EOR | (rx_buffer_len & 0x3FFF));
         else
           Rx_Descriptors[i].command = (OWN | (rx_buffer_len & 0x3FFF));

         Rx_Descriptors[i].low_buf = (unsigned int)&packet_buffer_address;
     }
 }

来自Rx_Descriptors结构的命令会发生什么???

1 个答案:

答案 0 :(得分:1)

对于Rx_Descriptors数组中的每个描述符,命令将被设置为rx_buffer_len的低14位(可能是因为0x3fff(16383)是允许的最大值和/或其他位用于其他内容)。

将为每个标志值设置标志值OWN,并且仅为最后一个设置EOR。