• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/net/irda/ircomm/

Lines Matching refs:self

49 static void ircomm_tty_ias_register(struct ircomm_tty_cb *self);
55 static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self,
59 static int ircomm_tty_state_idle(struct ircomm_tty_cb *self,
63 static int ircomm_tty_state_search(struct ircomm_tty_cb *self,
67 static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self,
71 static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self,
75 static int ircomm_tty_state_setup(struct ircomm_tty_cb *self,
79 static int ircomm_tty_state_ready(struct ircomm_tty_cb *self,
113 static int (*state[])(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event,
131 int ircomm_tty_attach_cable(struct ircomm_tty_cb *self)
135 IRDA_ASSERT(self != NULL, return -1;);
136 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
139 if (ircomm_is_connected(self->ircomm)) {
145 self->tty->hw_stopped = 1;
147 ircomm_tty_ias_register(self);
149 ircomm_tty_do_event(self, IRCOMM_TTY_ATTACH_CABLE, NULL, NULL);
160 void ircomm_tty_detach_cable(struct ircomm_tty_cb *self)
164 IRDA_ASSERT(self != NULL, return;);
165 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
167 del_timer(&self->watchdog_timer);
170 if (self->ckey) {
171 irlmp_unregister_client(self->ckey);
172 self->ckey = NULL;
175 if (self->skey) {
176 irlmp_unregister_service(self->skey);
177 self->skey = NULL;
180 if (self->iriap) {
181 iriap_close(self->iriap);
182 self->iriap = NULL;
186 if (self->obj) {
187 irias_delete_object(self->obj);
188 self->obj = NULL;
191 ircomm_tty_do_event(self, IRCOMM_TTY_DETACH_CABLE, NULL, NULL);
194 self->daddr = self->saddr = 0;
195 self->dlsap_sel = self->slsap_sel = 0;
197 memset(&self->settings, 0, sizeof(struct ircomm_params));
201 * Function ircomm_tty_ias_register (self)
206 static void ircomm_tty_ias_register(struct ircomm_tty_cb *self)
213 IRDA_ASSERT(self != NULL, return;);
214 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
218 if (self->service_type & IRCOMM_3_WIRE_RAW)
222 if (!self->skey)
223 self->skey = irlmp_register_service(hints);
225 if (!self->ckey)
226 self->ckey = irlmp_register_client(hints,
228 NULL, (void *) self);
231 if (self->obj)
234 if (self->service_type & IRCOMM_3_WIRE_RAW) {
236 self->obj = irias_new_object("IrLPT", IAS_IRLPT_ID);
237 irias_add_integer_attrib(self->obj, "IrDA:IrLMP:LsapSel",
238 self->slsap_sel, IAS_KERNEL_ATTR);
241 self->obj = irias_new_object("IrDA:IrCOMM", IAS_IRCOMM_ID);
242 irias_add_integer_attrib(self->obj, "IrDA:TinyTP:LsapSel",
243 self->slsap_sel, IAS_KERNEL_ATTR);
247 IRCOMM_SERVICE_TYPE, 1, self->service_type,
251 irias_add_octseq_attrib(self->obj, "Parameters", oct_seq, 6,
254 irias_insert_object(self->obj);
258 * Function ircomm_tty_ias_unregister (self)
263 static void ircomm_tty_ias_unregister(struct ircomm_tty_cb *self)
265 if (self->obj) {
266 irias_delete_object(self->obj);
267 self->obj = NULL;
273 * Function ircomm_send_initial_parameters (self)
278 int ircomm_tty_send_initial_parameters(struct ircomm_tty_cb *self)
280 IRDA_ASSERT(self != NULL, return -1;);
281 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
283 if (self->service_type & IRCOMM_3_WIRE_RAW)
291 self->settings.data_rate);
292 if (!self->settings.data_rate)
293 self->settings.data_rate = 9600;
295 self->settings.data_format);
296 if (!self->settings.data_format)
297 self->settings.data_format = IRCOMM_WSIZE_8; /* 8N1 */
300 self->settings.flow_control);
301 /*self->settings.flow_control = IRCOMM_RTS_CTS_IN|IRCOMM_RTS_CTS_OUT;*/
304 self->settings.dte = IRCOMM_DTR | IRCOMM_RTS;
307 if (self->client)
308 ircomm_param_request(self, IRCOMM_SERVICE_TYPE, FALSE);
309 ircomm_param_request(self, IRCOMM_DATA_RATE, FALSE);
310 ircomm_param_request(self, IRCOMM_DATA_FORMAT, FALSE);
313 if (self->settings.service_type == IRCOMM_3_WIRE) {
314 ircomm_param_request(self, IRCOMM_FLOW_CONTROL, TRUE);
319 ircomm_param_request(self, IRCOMM_FLOW_CONTROL, FALSE);
321 ircomm_param_request(self, IRCOMM_DTE, TRUE);
337 struct ircomm_tty_cb *self;
348 self = (struct ircomm_tty_cb *) priv;
349 ircomm_tty_do_event(self, IRCOMM_TTY_DISCOVERY_INDICATION,
363 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
367 IRDA_ASSERT(self != NULL, return;);
368 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
370 if (!self->tty)
374 self->flow = FLOW_STOP;
377 self->tty->hw_stopped = 1;
379 ircomm_tty_do_event(self, IRCOMM_TTY_DISCONNECT_INDICATION, NULL,
393 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) priv;
397 IRDA_ASSERT(self != NULL, return;);
398 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
401 iriap_close(self->iriap);
402 self->iriap = NULL;
414 irda_param_extract_all(self, value->t.oct_seq, value->len,
417 ircomm_tty_do_event(self, IRCOMM_TTY_GOT_PARAMETERS, NULL,
428 self->dlsap_sel = value->t.integer;
430 ircomm_tty_do_event(self, IRCOMM_TTY_GOT_LSAPSEL, NULL, NULL);
454 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
458 IRDA_ASSERT(self != NULL, return;);
459 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
461 self->client = TRUE;
462 self->max_data_size = max_data_size;
463 self->max_header_size = max_header_size;
464 self->flow = FLOW_START;
466 ircomm_tty_do_event(self, IRCOMM_TTY_CONNECT_CONFIRM, NULL, NULL);
484 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
489 IRDA_ASSERT(self != NULL, return;);
490 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
492 self->client = FALSE;
493 self->max_data_size = max_data_size;
494 self->max_header_size = max_header_size;
495 self->flow = FLOW_START;
499 irda_param_extract_all(self, skb->data+1,
503 ircomm_tty_do_event(self, IRCOMM_TTY_CONNECT_INDICATION, NULL, NULL);
509 * Function ircomm_tty_link_established (self)
514 void ircomm_tty_link_established(struct ircomm_tty_cb *self)
518 IRDA_ASSERT(self != NULL, return;);
519 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
521 if (!self->tty)
524 del_timer(&self->watchdog_timer);
532 if ((self->flags & ASYNC_CTS_FLOW) && ((self->settings.dce & IRCOMM_CTS) == 0)) {
538 self->tty->hw_stopped = 0;
541 wake_up_interruptible(&self->open_wait);
544 schedule_work(&self->tqueue);
548 * Function ircomm_tty_start_watchdog_timer (self, timeout)
554 static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self,
557 IRDA_ASSERT(self != NULL, return;);
558 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
560 irda_start_timer(&self->watchdog_timer, timeout, (void *) self,
572 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) data;
576 IRDA_ASSERT(self != NULL, return;);
577 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
579 ircomm_tty_do_event(self, IRCOMM_TTY_WD_TIMER_EXPIRED, NULL, NULL);
584 * Function ircomm_tty_do_event (self, event, skb)
589 int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event,
592 IRDA_ASSERT(self != NULL, return -1;);
593 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
596 ircomm_tty_state[self->state], ircomm_tty_event[event]);
598 return (*state[self->state])(self, event, skb, info);
602 * Function ircomm_tty_next_state (self, state)
607 static inline void ircomm_tty_next_state(struct ircomm_tty_cb *self, IRCOMM_TTY_STATE state)
610 IRDA_ASSERT(self != NULL, return;);
611 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
614 ircomm_tty_state[self->state], self->service_type);
616 self->state = state;
620 * Function ircomm_tty_state_idle (self, event, skb, info)
625 static int ircomm_tty_state_idle(struct ircomm_tty_cb *self,
633 ircomm_tty_state[self->state], ircomm_tty_event[event]);
637 ircomm_tty_start_watchdog_timer(self, 3*HZ);
638 ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH);
643 self->daddr = info->daddr;
644 self->saddr = info->saddr;
646 if (self->iriap) {
652 self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self,
655 iriap_getvaluebyclass_request(self->iriap,
656 self->saddr, self->daddr,
659 ircomm_tty_start_watchdog_timer(self, 3*HZ);
660 ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_PARAMETERS);
663 del_timer(&self->watchdog_timer);
666 ircomm_connect_response(self->ircomm, NULL);
667 ircomm_tty_next_state(self, IRCOMM_TTY_READY);
673 ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
684 * Function ircomm_tty_state_search (self, event, skb, info)
689 static int ircomm_tty_state_search(struct ircomm_tty_cb *self,
697 ircomm_tty_state[self->state], ircomm_tty_event[event]);
701 self->daddr = info->daddr;
702 self->saddr = info->saddr;
704 if (self->iriap) {
710 self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self,
713 if (self->service_type == IRCOMM_3_WIRE_RAW) {
714 iriap_getvaluebyclass_request(self->iriap, self->saddr,
715 self->daddr, "IrLPT",
717 ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_LSAP_SEL);
719 iriap_getvaluebyclass_request(self->iriap, self->saddr,
720 self->daddr,
724 ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_PARAMETERS);
726 ircomm_tty_start_watchdog_timer(self, 3*HZ);
729 del_timer(&self->watchdog_timer);
730 ircomm_tty_ias_unregister(self);
733 ircomm_connect_response(self->ircomm, NULL);
734 ircomm_tty_next_state(self, IRCOMM_TTY_READY);
740 ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
751 * Function ircomm_tty_state_query (self, event, skb, info)
756 static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self,
764 ircomm_tty_state[self->state], ircomm_tty_event[event]);
768 if (self->iriap) {
774 self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self,
777 iriap_getvaluebyclass_request(self->iriap, self->saddr,
778 self->daddr, "IrDA:IrCOMM",
781 ircomm_tty_start_watchdog_timer(self, 3*HZ);
782 ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_LSAP_SEL);
786 ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH);
787 ircomm_tty_start_watchdog_timer(self, 3*HZ);
790 del_timer(&self->watchdog_timer);
791 ircomm_tty_ias_unregister(self);
794 ircomm_connect_response(self->ircomm, NULL);
795 ircomm_tty_next_state(self, IRCOMM_TTY_READY);
798 ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
809 * Function ircomm_tty_state_query_lsap_sel (self, event, skb, info)
814 static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self,
822 ircomm_tty_state[self->state], ircomm_tty_event[event]);
827 ret = ircomm_connect_request(self->ircomm, self->dlsap_sel,
828 self->saddr, self->daddr,
829 NULL, self->service_type);
830 ircomm_tty_start_watchdog_timer(self, 3*HZ);
831 ircomm_tty_next_state(self, IRCOMM_TTY_SETUP);
835 ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH);
836 ircomm_tty_start_watchdog_timer(self, 3*HZ);
839 del_timer(&self->watchdog_timer);
840 ircomm_tty_ias_unregister(self);
843 ircomm_connect_response(self->ircomm, NULL);
844 ircomm_tty_next_state(self, IRCOMM_TTY_READY);
847 ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
858 * Function ircomm_tty_state_setup (self, event, skb, info)
863 static int ircomm_tty_state_setup(struct ircomm_tty_cb *self,
871 ircomm_tty_state[self->state], ircomm_tty_event[event]);
875 del_timer(&self->watchdog_timer);
876 ircomm_tty_ias_unregister(self);
882 ircomm_tty_send_initial_parameters(self);
883 ircomm_tty_link_established(self);
884 ircomm_tty_next_state(self, IRCOMM_TTY_READY);
887 del_timer(&self->watchdog_timer);
888 ircomm_tty_ias_unregister(self);
891 ircomm_connect_response(self->ircomm, NULL);
892 ircomm_tty_next_state(self, IRCOMM_TTY_READY);
896 ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH);
897 ircomm_tty_start_watchdog_timer(self, 3*HZ);
900 /* ircomm_disconnect_request(self->ircomm, NULL); */
901 ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
912 * Function ircomm_tty_state_ready (self, event, skb, info)
917 static int ircomm_tty_state_ready(struct ircomm_tty_cb *self,
926 ret = ircomm_data_request(self->ircomm, skb);
929 ircomm_disconnect_request(self->ircomm, NULL);
930 ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
933 ircomm_tty_ias_register(self);
934 ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH);
935 ircomm_tty_start_watchdog_timer(self, 3*HZ);
937 if (self->flags & ASYNC_CHECK_CD) {
939 self->settings.dce = IRCOMM_DELTA_CD;
940 ircomm_tty_check_modem_status(self);
943 if (self->tty)
944 tty_hangup(self->tty);