Re:irqserver in rtems master version and libbsd

葡萄 29171383 at qq.com
Sun Jul 3 12:09:05 UTC 2016


I used rtems4.11 irqserver.c  replace rtems4.12 irqserver.c , now it can work, because rtems4.11 irqserver.c did not support irq server share, so I change libbsd irq back to RTEMS_INTERRUPT_UNIQUE


test for 4G wireless net card , still can not let gethostbyname work,the error is same as rtems4.11 and libbsd 4.11,


in freebsd/lib/libc line 674 function _nsdispatch  


int
_nsdispatch(void *retval, const ns_dtab disp_tab[], const char *database,
	    const char *method_name, const ns_src defaults[], ...)
{
	va_list		 ap;
	const ns_dbt	*dbt;
	const ns_src	*srclist;
	nss_method	 method, fb_method;
	void		*mdata;
	int		 isthreaded, serrno, i, result, srclistsize;
	struct fb_state	*st;


#ifdef NS_CACHING
	nss_cache_data	 cache_data;
	nss_cache_data	*cache_data_p;
	int		 cache_flag;
#endif
	
	dbt = NULL;
	fb_method = NULL;


	isthreaded = __isthreaded;
	serrno = errno;
	if (isthreaded) {
		result = _pthread_rwlock_rdlock(&nss_lock);
		if (result != 0) {
			printf("_pthread_rwlock_rdlock failure %d\n",result);
			result = NS_UNAVAIL;
			goto fin;
		}
	}





output is still 22 ,error code for invalid


+ZGIPDNS: 1,1,"IP","10.115.225.252","0.0.0.0","112.4.1.36","112.4.12.200"


AT+ZGACT=1,1
:
OK


+ZCONSTAT: 1,1




[/] # 
[/] # 
[/] # 
[/] # ls /etc 
dhcpcd.conf  group        issue.net    resolv.conf
dhcpcd.duid  issue        passwd
[/] # 
[/] # ping www.baidu.com
_pthread_rwlock_rdlock failure 22
ping: cannot resolve www.baidu.com: Unknown host



now my rtems version is head verion from rtems git, libbsd version is head version from  rtems git,tools is compile use rsb
arm-rtems4.12-gcc --version
arm-rtems4.12-gcc (GCC) 6.1.1 20160609 (RTEMS 4.12, RSB c476de6150f39afdf142c6f4420c59ba2f1aa2fe-modified, Newlib 2.4.0.20160527)
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.







------------------ 原始邮件 ------------------
发件人: "葡萄";<29171383 at qq.com>;
发送时间: 2016年7月3日(星期天) 晚上7:11
收件人: "users"<users at rtems.org>; 

主题: irqserver  in rtems master version and libbsd



I migrate from rtems 4.11 and libbsd 4.11 to rtems git head and libbsd git head, I find when I start up my application ,system crashed,  the crash point when use rtems irq services, I track code, find when libbsd use rtems irq service ,the system crash, in rtems/c/src/lib/libbsp/shared/src/irq_service.c

static rtems_status_code bsp_interrupt_server_call_helper(
  rtems_vector_number vector,
  rtems_option options,
  rtems_interrupt_handler handler,
  void *arg,
  void (*helper)(void *)
)
{
  bsp_interrupt_server_helper_data hd = {
    .vector = vector,
    .options = options,
    .handler = handler,
    .arg = arg,
    .task = rtems_task_self()
  };
  bsp_interrupt_server_action a = {
    .handler = helper,
    .arg = &hd
  };
  bsp_interrupt_server_entry e = {
    .vector = BSP_INTERRUPT_VECTOR_MAX + 1,
    .actions = &a
  };
 /* this line confuse me*/
  bsp_interrupt_server_trigger(&e);
  rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT);


  return hd.sc;
}



static void bsp_interrupt_server_trigger(void *arg)
{
  rtems_interrupt_lock_context lock_context;
  bsp_interrupt_server_entry *e = arg;


  bsp_interrupt_vector_disable(e->vector);


  rtems_interrupt_lock_acquire(&bsp_interrupt_server_lock, &lock_context);


  if (rtems_chain_is_node_off_chain(&e->node)) {
    rtems_chain_append_unprotected(&bsp_interrupt_server_chain, &e->node);
  } else {
    ++bsp_interrupt_server_errors;
  }


  rtems_interrupt_lock_release(&bsp_interrupt_server_lock, &lock_context);


  rtems_event_system_send(bsp_interrupt_server_id, RTEMS_EVENT_SYSTEM_SERVER);
}





in  /*this line confuse me*/
1. in bsp_interrupt_server_trigger functon , bsp_interrupt_vector_disable(e->vector) often provided by bsp,in many bsp code,operation hardware register direct,the but the e->vector num is BSP_INTERRUPT_VECTOR_MAX + 1,not vertor in parmeter
2. e is store in stack, but rtems_chain_is_node_off_chain(&e->node)  used??


another question, I find the head version of libbsd and head version of rtems will crash when use bsd command  ,just bsd commond to list all bsd thread and irq, ifconfig  netstate ping work fine




regards
yao0718
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20160703/9ae4a84a/attachment.html>


More information about the users mailing list