void frameq_enqueue_send_and_recv_vr(void* arg, struct modtest_result* result) { //int ret = 0; const char buf[] = { 0x7E, 0x00, 0x04, 0x08, 0x01, 0x56, 0x52, 0x4E }; const int count = 8; struct xb_device* xbdev = (struct xb_device*)arg; struct sk_buff* send_buf = alloc_skb(128, GFP_KERNEL); struct sk_buff* skb; unsigned char* tail = skb_put(send_buf, count); memcpy(tail, buf, count); frameq_enqueue_send(&xbdev->send_queue, send_buf); FAIL_IF_NOT_EQ(1, skb_queue_len(&xbdev->send_queue)); FAIL_IF_NOT_EQ(0, xbdev->recv_buf->len); xb_send(xbdev); skb = xb_recv(xbdev, 1, 1000); FAIL_IF_NULL(skb); FAIL_IF_NOT_EQ(0, skb_queue_len(&xbdev->send_queue)); TEST_SUCCESS(); }
void main(void) { //-------------------------------------------------------------------------------- // Program start // User can start to write/modify the program here //-------------------------------------------------------------------------------- //local variables unsigned short i,temp1; unsigned long address=0, SH, SL; // User is advised not to change or remove the initialization function called init(); // call initialization function of the setting in program delay(200000); // waiting for slave card to ready while(1) { //pls comment or uncomment the part needed if (cp1_sw(1)==0) { while(cp1_sw(1)==0); // start on button release // broadcast address setting============================================================= // ==========================transmitter================================================= // transmitter destination address is set to broadcast address led2=1; xb_MY(add_xb,0x1113); // set the source address, MY to ABCD xb_DL(add_xb,0x0000FFFF); // set the destination address, DL to 0xFFFF // which is the broadcast address for 16bits // addressing xb_CH(add_xb, 0x0B); // select a channel for transmission xb_ID(add_xb,0x4332); // select a PAN ID //===========================receiver==================================================== xb_MY(add_xb2,0x1234); // set the source address, MY to 1234 xb_DL(add_xb2,0x00001113); // set the destination address, DL to 0xABCD xb_CH(add_xb2, 0x0B); // receiver need to be in the same channel // to receive from transmitter xb_ID(add_xb2,0x4332); // set PAN ID to be same } if (cp1_sw(2)==0) { while(cp1_sw(2)==0); // start on button release // broadcast address setting============================================================= // ==========================transmitter================================================= // transmitter PAN ID is set to broadcast value led2=1; xb_MY(add_xb,0x1113); // set the source address, MY to ABCD xb_DL(add_xb,0x00007E7D); // set the destination address, DL to 0xFFFF // which is the broadcast address for 16bits // addressing xb_CH(add_xb, 0x0C); // select a channel for transmission xb_ID(add_xb,0xFFFF); // broadcast PAN ID. this will broadcast to // every PANID in the same CH. //===========================receiver==================================================== xb_MY(add_xb2,0x7E7D); // set the source address, MY to 1234 xb_DL(add_xb2,0x00001113); // set the destination address, DL to 0xABCD xb_CH(add_xb2, 0x0C); // receiver need to be in the same channel // to receive from transmitter xb_ID(add_xb2,0x3332); // set PAN ID } if (cp1_sw(3)==0) { led3=1; while(cp1_sw(3)==0); xb_send(add_xb, 'I','F','C','-','X','B','0','1'); // send out data } if (cp1_sw(4)==0) { while(cp1_sw(4)==0); xb_send(add_xb, '1','2','3','4','5','6','7','8'); // send out data // xb_send(add_xb, 0x7E,0x7E,0x13,0x7E,0x11,0x7E,0x7E,0x7D); // send out data } xb_receive(add_xb2); //poll the IFC-XB01 to get data cp1_goto(0,0); cp1_str("receive:"); cp1_char(rec_data[0]); //display receive data on IFC-CP cp1_char(rec_data[1]); cp1_char(rec_data[2]); cp1_char(rec_data[3]); cp1_char(rec_data[4]); cp1_char(rec_data[5]); cp1_char(rec_data[6]); cp1_char(rec_data[7]); cp1_goto(1,0); cp1_str("RSSI:"); cp1_dec(xb_RSSI(add_xb2),3); // delay(1000); } } //endmain