Example #1
0
static err_t l2ca_connect_ind_cb(void *arg, struct l2cap_pcb *pcb, err_t err)
{
	struct ds3wiibt_context *ctx = (struct ds3wiibt_context *)arg;
	if (ctx == NULL || pcb == NULL) return -1;
	
	//LOG("l2ca_connect_ind_cb, PSM: 0x%02X\n", l2cap_psm(pcb));
	
	if (l2cap_psm(pcb) == HIDP_PSM) {
		/* Control PSM is connected */
		l2cap_disconnect_ind(ctx->ctrl_pcb, l2ca_disconnect_ind_cb);
		l2cap_timeout_ind(ctx->ctrl_pcb, l2ca_timeout_ind_cb);
		l2cap_recv(ctx->ctrl_pcb, l2ca_recv_cb);
	} else if (l2cap_psm(pcb) == INTR_PSM) {
		/* Both Control PSM and Data PSM are connected */
		l2cap_disconnect_ind(ctx->data_pcb, l2ca_disconnect_ind_cb);
		l2cap_timeout_ind(ctx->data_pcb, l2ca_timeout_ind_cb);
		l2cap_recv(ctx->data_pcb, l2ca_recv_cb);
		set_operational(ctx);
	}
	return ERR_OK;
}
Example #2
0
void port_monitor(void)
{
 unsigned long control,irq_status,status1,status2;
 unsigned int start_y=10;
 unsigned int user_in;

// clrscr();

 set_operational();

 w32(HcRhP1,0x00000102);
 w32(HcRhP2,0x00000102);
 w32(HcRhA,0x20000002);
 w32(HcRhB,0x00000000);
 w32(HcRhStatus,0x00010000);	//set Global Power

 do
 {
  control   =r32(HcControl);
  irq_status=r32(HcIntStatus);
  status1   =r32(HcRhP1);
  status2   =r32(HcRhP2);

  if((status1&0x00000001)==1)
  {
//   gotoxy(20,start_y+6);
   w32(HcRhP1,0x00000102);
   if((status1&0x00000200)!=0)
   {
	printf("LS Device connected to Port 1");
	set_port_speed(1,1);
   }
   else
   {
	printf("FS Device connected to Port 1");
	set_port_speed(1,0);
   }
  }

  else
  {
//   gotoxy(20,start_y+6);
   printf("                                      ");
  }

  if((status2&0x00000001)==1)
  {
//   gotoxy(20,start_y+7);
   w32(HcRhP2,0x00000102);
   if((status2&0x00000200)!=0)
   {
	printf("LS Device connected to Port 2");
	set_port_speed(2,1);
   }
   else
   {
	printf("FS Device connected to Port 2");
	set_port_speed(2,0);
   }
  }

  else
  {
//   gotoxy(20,start_y+7);
   printf("                                      ");
  }

//  gotoxy(20,start_y);
  printf("Port Status Monitor");
 // gotoxy(20,start_y-1);
  printf("OTGStatus  Register = %8X.\n",r16(0x67));
 // gotoxy(20,start_y+1);
  printf("OTGControl Register = %8X.\n",r16(0x62));
//  gotoxy(20,start_y+2);
  printf("Control    Register = %8lX.\n",control);
//  gotoxy(20,start_y+3);
  printf("Int Status Register = %8lX.\n",irq_status);
//  gotoxy(20,start_y+4);
  printf("P1  Status Register = %8lX.\n",status1);
//  gotoxy(20,start_y+5);
  printf("P2  Status Register = %8lX.\n",status2);
//  gotoxy(20,start_y+8);
  printf("Press '1' to go back to main menu\n");

  user_in='1';//read_key(0);
 }
 while(user_in!='1');
}