• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/net/irda/ircomm/

Lines Matching refs:self

48 static void ircomm_tty_ias_register(struct ircomm_tty_cb *self);
54 static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self,
58 static int ircomm_tty_state_idle(struct ircomm_tty_cb *self,
62 static int ircomm_tty_state_search(struct ircomm_tty_cb *self,
66 static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self,
70 static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self,
74 static int ircomm_tty_state_setup(struct ircomm_tty_cb *self,
78 static int ircomm_tty_state_ready(struct ircomm_tty_cb *self,
112 static int (*state[])(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event,
130 int ircomm_tty_attach_cable(struct ircomm_tty_cb *self)
134 IRDA_ASSERT(self != NULL, return -1;);
135 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
138 if (ircomm_is_connected(self->ircomm)) {
144 self->tty->hw_stopped = 1;
146 ircomm_tty_ias_register(self);
148 ircomm_tty_do_event(self, IRCOMM_TTY_ATTACH_CABLE, NULL, NULL);
159 void ircomm_tty_detach_cable(struct ircomm_tty_cb *self)
163 IRDA_ASSERT(self != NULL, return;);
164 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
166 del_timer(&self->watchdog_timer);
169 if (self->ckey) {
170 irlmp_unregister_client(self->ckey);
171 self->ckey = NULL;
174 if (self->skey) {
175 irlmp_unregister_service(self->skey);
176 self->skey = NULL;
179 if (self->iriap) {
180 iriap_close(self->iriap);
181 self->iriap = NULL;
185 if (self->obj) {
186 irias_delete_object(self->obj);
187 self->obj = NULL;
190 ircomm_tty_do_event(self, IRCOMM_TTY_DETACH_CABLE, NULL, NULL);
193 self->daddr = self->saddr = 0;
194 self->dlsap_sel = self->slsap_sel = 0;
196 memset(&self->settings, 0, sizeof(struct ircomm_params));
200 * Function ircomm_tty_ias_register (self)
205 static void ircomm_tty_ias_register(struct ircomm_tty_cb *self)
212 IRDA_ASSERT(self != NULL, return;);
213 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
217 if (self->service_type & IRCOMM_3_WIRE_RAW)
221 if (!self->skey)
222 self->skey = irlmp_register_service(hints);
224 if (!self->ckey)
225 self->ckey = irlmp_register_client(hints,
227 NULL, (void *) self);
230 if (self->obj)
233 if (self->service_type & IRCOMM_3_WIRE_RAW) {
235 self->obj = irias_new_object("IrLPT", IAS_IRLPT_ID);
236 irias_add_integer_attrib(self->obj, "IrDA:IrLMP:LsapSel",
237 self->slsap_sel, IAS_KERNEL_ATTR);
240 self->obj = irias_new_object("IrDA:IrCOMM", IAS_IRCOMM_ID);
241 irias_add_integer_attrib(self->obj, "IrDA:TinyTP:LsapSel",
242 self->slsap_sel, IAS_KERNEL_ATTR);
246 IRCOMM_SERVICE_TYPE, 1, self->service_type,
250 irias_add_octseq_attrib(self->obj, "Parameters", oct_seq, 6,
253 irias_insert_object(self->obj);
257 * Function ircomm_tty_ias_unregister (self)
262 static void ircomm_tty_ias_unregister(struct ircomm_tty_cb *self)
264 if (self->obj) {
265 irias_delete_object(self->obj);
266 self->obj = NULL;
272 * Function ircomm_send_initial_parameters (self)
277 int ircomm_tty_send_initial_parameters(struct ircomm_tty_cb *self)
279 IRDA_ASSERT(self != NULL, return -1;);
280 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
282 if (self->service_type & IRCOMM_3_WIRE_RAW)
290 self->settings.data_rate);
291 if (!self->settings.data_rate)
292 self->settings.data_rate = 9600;
294 self->settings.data_format);
295 if (!self->settings.data_format)
296 self->settings.data_format = IRCOMM_WSIZE_8; /* 8N1 */
299 self->settings.flow_control);
300 /*self->settings.flow_control = IRCOMM_RTS_CTS_IN|IRCOMM_RTS_CTS_OUT;*/
303 self->settings.dte = IRCOMM_DTR | IRCOMM_RTS;
306 if (self->client)
307 ircomm_param_request(self, IRCOMM_SERVICE_TYPE, FALSE);
308 ircomm_param_request(self, IRCOMM_DATA_RATE, FALSE);
309 ircomm_param_request(self, IRCOMM_DATA_FORMAT, FALSE);
312 if (self->settings.service_type == IRCOMM_3_WIRE) {
313 ircomm_param_request(self, IRCOMM_FLOW_CONTROL, TRUE);
318 ircomm_param_request(self, IRCOMM_FLOW_CONTROL, FALSE);
320 ircomm_param_request(self, IRCOMM_DTE, TRUE);
336 struct ircomm_tty_cb *self;
347 self = (struct ircomm_tty_cb *) hashbin_get_first(ircomm_tty);
348 while (self != NULL) {
349 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
351 ircomm_tty_do_event(self, IRCOMM_TTY_DISCOVERY_INDICATION,
354 self = (struct ircomm_tty_cb *) hashbin_get_next(ircomm_tty);
368 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
372 IRDA_ASSERT(self != NULL, return;);
373 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
375 if (!self->tty)
379 self->flow = FLOW_STOP;
382 self->tty->hw_stopped = 1;
384 ircomm_tty_do_event(self, IRCOMM_TTY_DISCONNECT_INDICATION, NULL,
398 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) priv;
402 IRDA_ASSERT(self != NULL, return;);
403 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
406 iriap_close(self->iriap);
407 self->iriap = NULL;
419 irda_param_extract_all(self, value->t.oct_seq, value->len,
422 ircomm_tty_do_event(self, IRCOMM_TTY_GOT_PARAMETERS, NULL,
433 self->dlsap_sel = value->t.integer;
435 ircomm_tty_do_event(self, IRCOMM_TTY_GOT_LSAPSEL, NULL, NULL);
459 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
463 IRDA_ASSERT(self != NULL, return;);
464 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
466 self->client = TRUE;
467 self->max_data_size = max_data_size;
468 self->max_header_size = max_header_size;
469 self->flow = FLOW_START;
471 ircomm_tty_do_event(self, IRCOMM_TTY_CONNECT_CONFIRM, NULL, NULL);
489 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
494 IRDA_ASSERT(self != NULL, return;);
495 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
497 self->client = FALSE;
498 self->max_data_size = max_data_size;
499 self->max_header_size = max_header_size;
500 self->flow = FLOW_START;
504 irda_param_extract_all(self, skb->data+1,
508 ircomm_tty_do_event(self, IRCOMM_TTY_CONNECT_INDICATION, NULL, NULL);
514 * Function ircomm_tty_link_established (self)
519 void ircomm_tty_link_established(struct ircomm_tty_cb *self)
523 IRDA_ASSERT(self != NULL, return;);
524 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
526 if (!self->tty)
529 del_timer(&self->watchdog_timer);
537 if ((self->flags & ASYNC_CTS_FLOW) && ((self->settings.dce & IRCOMM_CTS) == 0)) {
543 self->tty->hw_stopped = 0;
546 wake_up_interruptible(&self->open_wait);
549 schedule_work(&self->tqueue);
553 * Function ircomm_tty_start_watchdog_timer (self, timeout)
559 static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self,
562 IRDA_ASSERT(self != NULL, return;);
563 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
565 irda_start_timer(&self->watchdog_timer, timeout, (void *) self,
577 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) data;
581 IRDA_ASSERT(self != NULL, return;);
582 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
584 ircomm_tty_do_event(self, IRCOMM_TTY_WD_TIMER_EXPIRED, NULL, NULL);
589 * Function ircomm_tty_do_event (self, event, skb)
594 int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event,
597 IRDA_ASSERT(self != NULL, return -1;);
598 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
601 ircomm_tty_state[self->state], ircomm_tty_event[event]);
603 return (*state[self->state])(self, event, skb, info);
607 * Function ircomm_tty_next_state (self, state)
612 static inline void ircomm_tty_next_state(struct ircomm_tty_cb *self, IRCOMM_TTY_STATE state)
615 IRDA_ASSERT(self != NULL, return;);
616 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
619 ircomm_tty_state[self->state], self->service_type);
621 self->state = state;
625 * Function ircomm_tty_state_idle (self, event, skb, info)
630 static int ircomm_tty_state_idle(struct ircomm_tty_cb *self,
638 ircomm_tty_state[self->state], ircomm_tty_event[event]);
642 ircomm_tty_start_watchdog_timer(self, 3*HZ);
643 ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH);
648 self->daddr = info->daddr;
649 self->saddr = info->saddr;
651 if (self->iriap) {
657 self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self,
660 iriap_getvaluebyclass_request(self->iriap,
661 self->saddr, self->daddr,
664 ircomm_tty_start_watchdog_timer(self, 3*HZ);
665 ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_PARAMETERS);
668 del_timer(&self->watchdog_timer);
671 ircomm_connect_response(self->ircomm, NULL);
672 ircomm_tty_next_state(self, IRCOMM_TTY_READY);
678 ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
689 * Function ircomm_tty_state_search (self, event, skb, info)
694 static int ircomm_tty_state_search(struct ircomm_tty_cb *self,
702 ircomm_tty_state[self->state], ircomm_tty_event[event]);
706 self->daddr = info->daddr;
707 self->saddr = info->saddr;
709 if (self->iriap) {
715 self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self,
718 if (self->service_type == IRCOMM_3_WIRE_RAW) {
719 iriap_getvaluebyclass_request(self->iriap, self->saddr,
720 self->daddr, "IrLPT",
722 ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_LSAP_SEL);
724 iriap_getvaluebyclass_request(self->iriap, self->saddr,
725 self->daddr,
729 ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_PARAMETERS);
731 ircomm_tty_start_watchdog_timer(self, 3*HZ);
734 del_timer(&self->watchdog_timer);
735 ircomm_tty_ias_unregister(self);
738 ircomm_connect_response(self->ircomm, NULL);
739 ircomm_tty_next_state(self, IRCOMM_TTY_READY);
745 ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
756 * Function ircomm_tty_state_query (self, event, skb, info)
761 static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self,
769 ircomm_tty_state[self->state], ircomm_tty_event[event]);
773 if (self->iriap) {
779 self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self,
782 iriap_getvaluebyclass_request(self->iriap, self->saddr,
783 self->daddr, "IrDA:IrCOMM",
786 ircomm_tty_start_watchdog_timer(self, 3*HZ);
787 ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_LSAP_SEL);
791 ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH);
792 ircomm_tty_start_watchdog_timer(self, 3*HZ);
795 del_timer(&self->watchdog_timer);
796 ircomm_tty_ias_unregister(self);
799 ircomm_connect_response(self->ircomm, NULL);
800 ircomm_tty_next_state(self, IRCOMM_TTY_READY);
803 ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
814 * Function ircomm_tty_state_query_lsap_sel (self, event, skb, info)
819 static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self,
827 ircomm_tty_state[self->state], ircomm_tty_event[event]);
832 ret = ircomm_connect_request(self->ircomm, self->dlsap_sel,
833 self->saddr, self->daddr,
834 NULL, self->service_type);
835 ircomm_tty_start_watchdog_timer(self, 3*HZ);
836 ircomm_tty_next_state(self, IRCOMM_TTY_SETUP);
840 ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH);
841 ircomm_tty_start_watchdog_timer(self, 3*HZ);
844 del_timer(&self->watchdog_timer);
845 ircomm_tty_ias_unregister(self);
848 ircomm_connect_response(self->ircomm, NULL);
849 ircomm_tty_next_state(self, IRCOMM_TTY_READY);
852 ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
863 * Function ircomm_tty_state_setup (self, event, skb, info)
868 static int ircomm_tty_state_setup(struct ircomm_tty_cb *self,
876 ircomm_tty_state[self->state], ircomm_tty_event[event]);
880 del_timer(&self->watchdog_timer);
881 ircomm_tty_ias_unregister(self);
887 ircomm_tty_send_initial_parameters(self);
888 ircomm_tty_link_established(self);
889 ircomm_tty_next_state(self, IRCOMM_TTY_READY);
892 del_timer(&self->watchdog_timer);
893 ircomm_tty_ias_unregister(self);
896 ircomm_connect_response(self->ircomm, NULL);
897 ircomm_tty_next_state(self, IRCOMM_TTY_READY);
901 ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH);
902 ircomm_tty_start_watchdog_timer(self, 3*HZ);
905 /* ircomm_disconnect_request(self->ircomm, NULL); */
906 ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
917 * Function ircomm_tty_state_ready (self, event, skb, info)
922 static int ircomm_tty_state_ready(struct ircomm_tty_cb *self,
931 ret = ircomm_data_request(self->ircomm, skb);
934 ircomm_disconnect_request(self->ircomm, NULL);
935 ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
938 ircomm_tty_ias_register(self);
939 ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH);
940 ircomm_tty_start_watchdog_timer(self, 3*HZ);
942 if (self->flags & ASYNC_CHECK_CD) {
944 self->settings.dce = IRCOMM_DELTA_CD;
945 ircomm_tty_check_modem_status(self);
948 if (self->tty)
949 tty_hangup(self->tty);