易企秀里放全景图可以放进u盘吗

wince 驱动热门博客列表 -
ITeye博客频道 -
博客专栏推荐
本月博客排行
年度博客排行
最新文章列表
上一篇文章中将24C02电路搭建起来了,参考
http://blog.csdn.net/lyx123/article/details/7884026
现在调试驱动程序和测试,在网上下载了测试程序,地址为http://dow ...
相关知识库
21186关注/468收录
17585关注/708收录
5068关注/1217收录
8848关注/1733收录
博客人气排行榜
博客电子书下载排行Dialog位置整合 - 移动开发当前位置:& &&&Dialog位置整合Dialog位置整合&&网友分享于:&&浏览:250次Dialog位置调整在顶端显示对话框
AlertDialog alertDialog = new AlertDialog.Builder(this)
&&&&.setMessage(&在顶端显示对话框&).setPositiveButton(&确定&, null).create();
&&Window window = alertDialog.getWindow();
&&window.setGravity(Gravity.TOP);
&&alertDialog.show();
在底端显示对话框
AlertDialog alertDialog = new AlertDialog.Builder(this).setMessage(&在底端显示对话框&)
&&&&.setPositiveButton(&确定&, null).create();
&&Window window = alertDialog.getWindow();
&&window.setGravity(Gravity.BOTTOM);
&&alertDialog.show();
在任意位置显示对话框
AlertDialog alertDialog = new AlertDialog.Builder(this).setMessage(&在任意位置显示对话框&)
&&&&.setPositiveButton(&确定&, null).create();
&&Window window = alertDialog.getWindow();
&&WindowManager.LayoutParams lp = window.getAttributes();
&&lp.x = -20;
&&lp.y = -120;
&&window.setAttributes(lp);
&&alertDialog.show();
12345678910
12345678910
12345678910 上一篇:下一篇:文章评论相关解决方案 12345678910 Copyright & &&版权所有念一出是一出 - 移动开发当前位置:& &&&念一出是一出念一出是一出&&网友分享于:&&浏览:0次想一出是一出8月1号是被辞职的第一天 ,恍然到今天3周过去了,智联和前程无忧的简历也被粗劣的浏览了上百次,不过通知面试的却很少,可能自己的经验不足吧,难以适应现在大多数公司开出的"3年-5年的开发经验"。
我曾经参与为国内一家专注与网上购彩企业开发过android客户端,把这个项目写上简历之后,有几家同样做网上购彩的公司给我打过电话,让我过去公司面试,明儿就开始面试了。 之前没想说被辞职之后,找工作这么难,因为去年海投简历的时候,极短的时间内很多公司都让过去面试, 而今年,随着android设备的普及,很多人包括大学生、程序员、其他行业的各类人士都纷纷加入android开发大军, 薪资下来了 ,公司需求的人才条件上去了,其实也是一件好事情,避免了一些看了几页书就嚷着自己做过多少多少项目的南郭先生。
面试的时候,放轻松真的很重要 ,面试官手里拿着你打印出来的几页4k纸,表情或欣喜或矛盾或惊奇或失落,你要注意察言观色,该说的东西一句也别拉下,特别注意要了解面试管给出的这个问题,他真实想要的答案是什么。当然, 一个好的出场亮相总是好的,别让面试官觉得你过于邋遢或者过于另类,咱们就是普普通通的程序员,干净的去面试就好。面试官在询问技术方面的问题时,尽可能结合自己的项目回答问题,这样显得你活学活用,而不是一味的像刚毕业的大学生,机械般的背诵课文。一个在业界稍微出名并且你完整参与的项目必然会给你加分,而对于我这种曾经做过的项目与现在面试你的人所在公司同属与一个领域的时候,首先恭喜你,你不单单了解整个代码的结构,而且在正式编码之前,你的上司肯定完整的给你分析过整个项目的各种需求。所以在回答面试官的提问时,结合业务诉说,会更好。
你所要面试的公司,在前一天最好登录公司的官方网站,大体了解一下公司的主营业务,公司曾经参与或者现阶段正在开发的android项目,结合自己的经验,理性的判断出自己能否胜任这份工作。
12345678910
12345678910
12345678910 上一篇:下一篇:文章评论相关解决方案 12345678910 Copyright & &&版权所有当前位置: →
→ 6410操作24C02驱动bug批改及测试
6410操作24C02驱动bug批改及测试
& 作者:佚名 & 来源: 互联网 & 热度:
&收藏到→_→:
摘要: 6410操作24C02驱动bug修改及测试上一篇文章中将24C02电路搭建起来了,参考 http://blog.csdn.net/lyx123/article/details/7884...
"6410操作24C02驱动bug批改及测试"::
6410操作24c02驱动bug修改及测试上一篇文章中将24c02电路搭建起来了,参考
http://blog.马开东/lyx123/article/details/7884026
现在调试驱动程序和测试,在网上下载了测试程序,地址为http://download.马开东/detail/lh9011
发现操作不了,不能写也不能读,程序作者介绍说:“本测试程序专门针对s3c6410读写at24c02的iic驱动的测试程序。 三星提供的iic驱动有点问题,需要修改,要不然测试会发生数据异常。”
所以,必须修改驱动程序。
由此,参考了网上的牛人程序,修改为如下:
1.s3c6410_iic_lib.cpp
// copyright (c) samsung electronics. co. ltd.& all rights reserved.
/*++
this code and information is provided &as is& without warranty of
any kind, either expressed or implied, including but not limited to
the implied warranties of merchantability and/or fitness for a
particular purpose.
/**************************************************************************************
*&&& project name : iic driver
*&&& project description :
*&&&&&&& this software is pdd layer for iic samsung driver.
*--------------------------------------------------
*&&& file name : s3c6410_iic_lib.cpp
*&&& file description : this file implements pdd layer functions
**************************************************************************************/
#include &bsp.h&
#include &types.h&
#include &linklist.h&
#include &devload.h&
#include &pm.h&
#include &drvlib.h&
#include &iic_mdd.h&
#include &iic_pdd.h&
#define debug&& 0
#define zone_error&&&&&&&&& debugzone(0)
#define zone_warn&&&&&&&&&& debugzone(1)
#define zone_function&&&&&& debugzone(2)
#define zone_init&&&&&&&&&& debugzone(3)
#define zone_info&&&&&&&&&& debugzone(4)
#define zone_ist&&&&&&&&&&& debugzone(5)
#define default_filter_enable&&&&&&& 1
#define default_delay&&&&&&&&&&&&&&& clk_0
#define default_clock&&&&&&&&&&&&&&& 3000
#define default_mode&&&&&&&&&&&&&&&& master_transmit
#define timeout_ms_tx&&&&&&&&&&&&&&& 3000
#define timeout_ms_rx&&&&&&&&&&&&&&& 3000
#define iic_power_on&& (1&&17)&&& // pclk_gate bit 17
#define unusedparameter(x)& x = x
#define icc_st_idle&&&&&&&&&&&&&&&& 0x00
#define icc_st_wraddr&&&&&&&&&&&&&& 0x02
static volatile s3c6410_gpio_reg&&&& *g_pgpioreg&&&&&&& =
static volatile s3c6410_syscon_reg&& *g_psysconreg&&&&& =
static volatile s3c6410_iic_reg&&&&& *g_piicreg&&&&&&&& =
static handle&&&&&&&&&&&&&&& g_&&&&&&& // transmit event done, both rx and tx
static handle&&&&&&&&&&&&&&& g_&&&&&&& // iic event, both rx and tx
static handle&&&&&&&&&&&&&&& g_&&&&&&& // transmit thread, both rx and tx
static dword&&&&&&&&&&&&&&&& g_intriic&&&&&&&& = sysintr_
static phw_open_info&&&&&&&& g_ownercontext =
static puchar&&&&&&&&&&&&&&& g_pciic_buffer=
static uint32&&&&&&&&&&&&&&& g_uiic_pt=0;
static uint32&&&&&&&&&&&&&&& g_uiic_datalen=0;
//static uchar&&&& g_iic_ist_buffer[4096];
static bool&&& mapvirtualaddress(void);
static void&&& initializegpioport(void);
static void&&& calculateclockset(phw_open_info popencontext);
static bool&&& waitforreg(pvoid pregaddress, uint32 tmask, uint32 twaitforequal, dword dwtimeout);
static dword&& iic_ist(lpvoid context);
//////////
// function name : hw_init
// function description : iic device h/w initialization.
// input :&&&& phw_init_info&&& pinitcontext
// output :the return is a bool, representing success (true) or failure (false).
// version : v0.1
bool&&&&&&&& hw_init (phw_init_info pinitcontext)
&&& bool&&& retval&&&&&&&&&& =&&&&&&& // initialize to success
&&& uint32&&&&
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&+hw_init(0x%x)\r\n&),
&&&&&&&&&&&&&& pinitcontext));
&&& if(!mapvirtualaddress())
&&&&&&& retval =
&&& initializegpioport();
&&& /* create tx and rx events. check return.
&&& g_htransferevent = createevent(0,false,false,null);
&&& if ( !g_htransferevent ) {
&&&&&&& debugmsg(zone_error,
&&&&&&&&&&&&&&&& (text(&error creating event, hw_init failed\n\r&)));
&&&&&&& retval =
&&& g_htransferdone = createevent(0,false,false,null);
&&& if ( !g_htransferdone ) {
&&&&&&& debugmsg(zone_error,
&&&&&&&&&&&&&&&& (text(&error creating done event, hw_init failed\n\r&)));
&&&&&&& retval =
&&& // obtain sysintr values from the oal for the iic interrupt.
&&& irq = irq_i2c;
&&& if (!kerneliocontrol(ioctl_hal_request_sysintr, &irq, sizeof(uint32), &g_intriic, sizeof(uint32), null))
&&&&&&& debugmsg(zone_error, (text(&error: failed to request the iic sysintr.\r\n&)));
&&&&&&& g_intriic = sysintr_
&&&&&&& retval =
&&& debugmsg(zone_info, (text(&iic irq mapping: [irq:%d-&sysirq:%d].\r\n&), irq, g_intriic));
&&& // initialize the interrupt
&&& if( !interruptinitialize(g_intriic, g_htransferevent, null, 0) )
&&&&&&& debugmsg(zone_error,(text(&hw_init error: unable to initialize interrupt: %u\r\n&), getlasterror()));
&&&&&&& retval =
&&& // create the ist
&&& if ( (g_htransferthread = createthread(null, 0, iic_ist, (lpvoid)pinitcontext, 0, null)) == null)
&&&&&&& debugmsg(zone_error,(text(&hw_init error: unable to create ist: %u\r\n&), getlasterror()));
&&&&&&& retval =
&&& if ( !cesetthreadpriority(g_htransferthread, pinitcontext-&priority256)) {
&&&&&&& debugmsg(zone_error,(text(&hw_init error: cesetthreadpriority error:%d\n&), getlasterror()));
&&&&&&& retval =
&&& debugmsg (zone_function|(retval == false?zone_error:0),
&&&&&&&&&&&&& (text(&-hw_init %s ecode=%d\r\n&),
&&&&&&&&&&&&&& (retval == true) ? text(&success&) : text(&error&),
&&&&&&&&&&&&&& getlasterror()));
&&& return (retval);
//////////
// function name : hw_deinit
// function description : iic device h/w de-initialization.
// input :&&&& phw_init_info&&& pinitcontext
// output :&& void
// version : v0.1
bool&&&&&&&& hw_deinit (phw_init_info pinitcontext)
&bool&&&&&&&&&&& retval&&&&&&&&&& =&&&&&&& // initialize to success
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&+hw_deinit(0x%x)\r\n&),
&&&&&&&&&&&&&& pinitcontext));
&&& if (g_htransferdone)
&&&&&&& closehandle(g_htransferdone);
&&&&&&& g_htransferdone =
&&& if (g_intriic != sysintr_undefined)
&&&&&&& interruptdisable(g_intriic);
&&& if (g_htransferevent)
&&&&&&& closehandle(g_htransferevent);
&&&&&&& g_htransferevent =
&&& if (g_intriic != sysintr_undefined)
&&&&&&& kerneliocontrol(ioctl_hal_release_sysintr, &g_intriic, sizeof(dword), null, 0, null);
&&& g_intriic = sysintr_
&&& if (g_htransferthread)
&&&&&&& closehandle(g_htransferthread);
&&&&&&& g_htransferthread =
&&& if (g_pgpioreg)
&&&&&&& drvlib_unmapiospace((pvoid)g_pgpioreg);
&&&&&&& g_pgpioreg =
&&& if (g_psysconreg)
&&&&&&& drvlib_unmapiospace((pvoid)g_psysconreg);
&&&&&&& g_psysconreg =
&&& if (g_piicreg)
&&&&&&& drvlib_unmapiospace((pvoid)g_piicreg);
&&&&&&& g_piicreg =
&&& if (g_pgpioreg)
&&&&&&& mmunmapiospace((pvoid)g_pgpioreg, sizeof(s3c6410_gpio_reg));
&&&&&&& g_pgpioreg =
&&& if (g_psysconreg)
&&&&&&& mmunmapiospace((pvoid)g_psysconreg, sizeof(s3c6410_syscon_reg));
&&&&&&& g_psysconreg =
&&& if (g_piicreg)
&&&&&&& mmunmapiospace((pvoid)g_piicreg, sizeof(s3c6410_iic_reg));
&&&&&&& g_piicreg =
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&-hw_deinit\r\n&)));
&return (retval);
//////////
// function name : mapvirtualaddress
// function description : mapping virtual address of registers.
// input :
// output :the return is a bool, representing success (true) or failure (false).
// version : v0.1
bool&&&&&&&& mapvirtualaddress(void)
&&& bool&&&&&&&&&&& retval&&&&&&&&&& =&&&&&&& // initialize to success
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&++%s\r\n&), __function__));
&&& // gpio sfr
&&& g_pgpioreg = (s3c6410_gpio_reg *)drvlib_mapiospace(s3c6410_base_reg_pa_gpio, sizeof(s3c6410_gpio_reg), false);
&&& if (g_pgpioreg == null)
&&&&&&& debugmsg(zone_error, (_t(&mapvirtualaddress() : g_pgpioreg drvlib_mapiospace() failed \n\r&)));
&&& // syscon sfr
&&& g_psysconreg = (s3c6410_syscon_reg *)drvlib_mapiospace(s3c6410_base_reg_pa_syscon, sizeof(s3c6410_syscon_reg), false);
&&& if (g_psysconreg == null)
&&&&&&& debugmsg(zone_error, (_t(&mapvirtualaddress() : g_psysconreg drvlib_mapiospace() failed \n\r&)));
&&& // iic sfr
&&& g_piicreg = (s3c6410_iic_reg *)drvlib_mapiospace(s3c6410_base_reg_pa_iicbus, sizeof(s3c6410_iic_reg), false);
&&& if (g_piicreg == null)
&&&&&&& debugmsg(zone_error, (_t(&mapvirtualaddress() : g_piicreg drvlib_mapiospace() failed \n\r&)));
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&--%s\r\n&),__function__));
&&& return (retval);
//////////
// function name : mapvirtualaddress
// function description : mapping virtual address of registers.
// input :
// output :the return is a bool, representing success (true) or failure (false).
// version : v0.1
bool&&&&&&&& mapvirtualaddress(void)
&&& bool&&&&&&&&&&& retval&&&&&&&&&& =&&&&&&& // initialize to success
&&& physical_address&&& iophysicalbase = {0,0};
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&++%s\r\n&), __function__));
&&& // gpio sfr
&&& iophysicalbase.lowpart = s3c6410_base_reg_pa_
&&& g_pgpioreg = (s3c6410_gpio_reg *)mmmapiospace(iophysicalbase, sizeof(s3c6410_gpio_reg), false);
&&& if (g_pgpioreg == null)
&&&&&&& debugmsg(zone_error, (_t(&%s : g_pgpioreg mmmapiospace() failed \n\r&), __function__));
&&& // syscon sfr
&&& iophysicalbase.lowpart = s3c6410_base_reg_pa_
&&& g_psysconreg = (s3c6410_syscon_reg *)mmmapiospace(iophysicalbase, sizeof(s3c6410_syscon_reg), false);
&&& if (g_psysconreg == null)
&&&&&&& debugmsg(zone_error, (_t(&%s : g_psysconreg mmmapiospace() failed \n\r&), __function__));
&&& // iic sfr
&&& iophysicalbase.lowpart = s3c6410_base_reg_pa_
&&& g_piicreg = (s3c6410_iic_reg *)mmmapiospace(iophysicalbase, sizeof(s3c6410_iic_reg), false);
&&& if (g_piicreg == null)
&&&&&&& debugmsg(zone_error, (_t(&%s : g_piicreg mmmapiospace() failed \n\r&), __function__));
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&--%s\r\n&),__function__));
&&& return (retval);
//////////
// function name : initializegpioport
// function description : initializing gpio port for iic.
// input :
// output :
// version : v0.9
void&&&& initializegpioport(void)
&&& // set scl gpb5
&&& g_pgpioreg-&gpbcon = (g_pgpioreg-&gpbcon & ~(0xf&&20)) | (0x2&&20);
&&& // set sda gpb6
&&& g_pgpioreg-&gpbcon = (g_pgpioreg-&gpbcon & ~(0xf&&24)) | (0x2&&24);
&&& // set scl pull-up
&&& g_pgpioreg-&gpbpud = (g_pgpioreg-&gpbpud & ~(0x3&&10)) | (0x0&&10);
&&& // set sda pull-up
&&& g_pgpioreg-&gpbpud = (g_pgpioreg-&gpbpud & ~(0x3&&12)) | (0x0&&12);
//////////
// function name : hw_powerup
// function description : power control for iic.
// input :&&&& phw_init_info pinitcontext
// output : the return is a bool, representing success (true) or failure (false).
// version : v0.9
hw_powerup(
&&& phw_init_info pinitcontext&&& /* value from i2c_init */
&&& unusedparameter(pinitcontext);
&&& debugmsg(zone_function,(text(&+[iic]hw_powerup\r\n&)));
&&& g_psysconreg-&pclk_gate |= iic_power_
&&& debugmsg(zone_function,(text(&-[iic]hw_powerup\r\n&)));
//////////
// function name : hw_powerdown
// function description : power control for iic.
// input :&&&& phw_init_info pinitcontext
// output : the return is a bool, representing success (true) or failure (false).
// version : v0.9
hw_powerdown(
&&& phw_init_info pinitcontext&&& /* value from i2c_init */
&&& unusedparameter(pinitcontext);
&&& debugmsg(zone_function,(text(&+[iic]hw_powerdown\r\n&)));
&&& g_psysconreg-&pclk_gate &= ~iic_power_
&&& g_ownercontext = // this is for power management. when power up, iic set register again.
&&& debugmsg(zone_function,(text(&-[iic]hw_powerdown\r\n&)));
//////////
// function name : hw_openfirst
// function description : iic device dirver is opened first.
// input :&&&& phw_open_info&&& popencontext
// output :the return is a bool, representing success (true) or failure (false).
// version : v0.1
bool&&&&&&&& hw_openfirst (phw_open_info popencontext)
&&& bool&&&&&&&&&&& retval&&&&&&&&& =&&&&&&&&&&& // initialize to success
&&& phw_init_info&&& pinitcontext&&& =&&& popencontext-&
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&+hw_openfirst(0x%x)\r\n&),
&&&&&&&&&&&&&& popencontext));
&&& // slave address setting
&&& pinitcontext-&pddcommonval.slaveaddress = default_slave_
&&& pinitcontext-&pddcommonval.interruptenable = default_interrupt_
&&& debugmsg (zone_function|(retval == false?zone_error:0),
&&&&&&&&&&&&& (text(&-hw_openfirst %s ecode=%d\r\n&),
&&&&&&&&&&&&&& (retval == true) ? text(&success&) : text(&error&),
&&&&&&&&&&&&&& getlasterror()));
&&& return (retval);
//////////
// function name : hw_closelast
// function description : iic device dirver is closed last.
// input :&&&& phw_open_info&&& popencontext
// output :the return is a bool, representing success (true) or failure (false).
// version : v0.1
bool&&&&&&&& hw_closelast (phw_open_info popencontext)
&&& bool&&& retval&&&&&&&&&& =&&&&&&& // initialize to success
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&+hw_closelast(0x%x)\r\n&),
&&&&&&&&&&&&&& popencontext));
&&& debugmsg (zone_function|(retval == false?zone_error:0),
&&&&&&&&&&&&& (text(&-hw_closelast %s ecode=%d\r\n&),
&&&&&&&&&&&&&& (retval == true) ? text(&success&) : text(&error&),
&&&&&&&&&&&&&& getlasterror()));
&&& return (retval);
//////////
// function name : hw_open
// function description : iic device dirver is opened.
// input :&&&& phw_open_info&&& popencontext
// output :the return is a bool, representing success (true) or failure (false).
// version : v0.1
bool&&&&&&&& hw_open&&&&&&&& (phw_open_info popencontext)
&&& bool&&&&&&&&&&& retval&&&&&& =&&&&&&& // initialize to success
&&& phw_init_info&&& pinitcontext = popencontext-&
&&& debugchk(popencontext!= null);
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&+hw_open(0x%x)\r\n&),
&&&&&&&&&&&&&& popencontext));
//&&& retailmsg (1,
//&&&&&&&&&&&&& (text(&iic0 +hw_open(0x%x)\r\n&),
//&&&&&&&&&&&&&& popencontext));
&&& popencontext-&pddcontextval.clock&&&&&&&&&&&&&& = default_
&&& popencontext-&pddcontextval.modesel&&&&&&&&&&&& = default_
&&& popencontext-&pddcontextval.filterenable&&&&&&& = default_filter_
&&& popencontext-&pddcontextval.delay&&&&&&&&&&&&&& = default_
&&& calculateclockset(popencontext);
&&& popencontext-&dirtybit =
&&& hw_setregister(popencontext);
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&-hw_open(0x%x)\r\n&),
&&&&&&&&&&&&&& popencontext));
&&& return (retval);
//////////
// function name : hw_close
// function description : iic device dirver is closed.
// input :&&&& phw_open_info&&& popencontext
// output :the return is a bool, representing success (true) or failure (false).
// version : v0.1
bool&&&&&&&& hw_close&&&& (phw_open_info popencontext)
&&& bool&&& retval&&&&&&&&&& =&&&&&&& // initialize to success
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&+hw_close(0x%x)\r\n&),
&&&&&&&&&&&&&& popencontext));
//&&& retailmsg (1,
//&&&&&&&&&&&&& (text(&iic0 -hw_close(0x%x)\r\n&),
//&&&&&&&&&&&&&& popencontext));
&&& return (retval);
//////////
// function name : calculateclockset
// function description : calculate clock and save its setting value in clksrc, clkdiv.
// input : phw_open_info popencontext
// output :
// version : v1.0
void&&& calculateclockset(phw_open_info popencontext)
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&+calculateclockset(0x%x), clock(%d)\r\n&),
&&&&&&&&&&&&&& popencontext, popencontext-&pddcontextval.clock));
&&& debugchk(popencontext-&pddcontextval.clock!= null);
&&& if (((s3c6410_pclk&&4)/popencontext-&pddcontextval.clock)&0xf)
&&&&&&&&&&& popencontext-&pddcontextval.clocksel&&& =&&& 1;
&&&&&&&&&&& popencontext-&pddcontextval.clockdiv&&& =&&& ((s3c6410_pclk&&9)/popencontext-&pddcontextval.clock);&&&&&&& //&&& pclk/512/freq
&&&&&&&&&&& if(popencontext-&pddcontextval.clockdiv != 0)
&&&&&&&&&&&&&&& popencontext-&pddcontextval.clockdiv -=1;
&&&&&&&&&&& popencontext-&pddcontextval.clocksel&&& =&&& 0;
&&&&&&&&&&& popencontext-&pddcontextval.clockdiv&&& =&&& ((s3c6410_pclk&&4)/popencontext-&pddcontextval.clock);&&&&&&& //&&& pclk/16/freq
&&&&&&&&&&& if(popencontext-&pddcontextval.clockdiv != 0)
&&&&&&&&&&&&&&& popencontext-&pddcontextval.clockdiv -=1;
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&-calculateclockset(0x%x), clocksel(%d), clockdiv(%d)\r\n&),
&&&&&&&&&&&&&& popencontext, popencontext-&pddcontextval.clocksel, popencontext-&pddcontextval.clockdiv));
//////////
// function name : hw_setregister
// function description : set registers when device owner is changed.
// input : phw_open_info popencontext
// output :
// version : v0.5
void&&&&&&&& hw_setregister (phw_open_info popencontext)
&&& phw_init_info&&& pinitcontext = popencontext-&
&&& debugchk(g_piicreg!= null);
&&& if(g_ownercontext != popencontext || popencontext-&dirtybit == true)
&&&&&&& debugmsg (zone_function,
&&&&&&&&&&&&&&&&& (text(&+hw_setregister(0x%x)\r\n&),
&&&&&&&&&&&&&&&&&& popencontext));
&&&&&&& g_piicreg-&iicadd = popencontext-&pinitcontext-&pddcommonval.
&&&&&&& g_piicreg-&iicstat = (g_piicreg-&iicstat & ~(0x3&&6)) | (1&&4) | (popencontext-&pddcontextval.modesel&&6);
&&&&&&& g_piicreg-&iiclc = (popencontext-&pddcontextval.filterenable&&2) | (popencontext-&pddcontextval.delay);
&&&&&&& g_piicreg-&iiccon = (popencontext-&pddcontextval.clocksel && 6) | (pinitcontext-&pddcommonval.interruptenable && 5) |
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& (popencontext-&pddcontextval.clockdiv & 0xf);
&&&&&&& g_ownercontext =
&&&&&&& popencontext-&dirtybit =
&&&&&&& debugmsg (zone_function,
&&&&&&&&&&&&&&&&& (text(&-hw_setregister(0x%x)\r\n&),
&&&&&&&&&&&&&&&&&& popencontext));
//////////
// function name : hw_setclock
// function description : set clock, this is called by iic_iocontrol
// input : phw_open_info popencontext
// output :
// version : v0.5
void&&&&&&&& hw_setclock (phw_open_info popencontext)
&&& calculateclockset(popencontext);
//////////
// function name : hw_read
// function description : iic read operation, sync function, so wait for transfer done or time out.
// input : phw_open_info popencontext
//&&&&&&&&&& piic_io_desc poutdata
// output :
// version : v0.5
bool&&&&&&& hw_read&&&&&&&&&&&& (phw_open_info popencontext, piic_io_desc pindata ,piic_io_desc poutdata)
&&& bool&&& retval&&&&&&&&&& =&&&&&&& // initialize to success
&&& pbyte&&&&
&&& pbyte&&&&
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&+hw_read(0x%x)\r\n&),
&&&&&&&&&&&&&& popencontext));
&&& hw_setregister(popencontext);
&&& hw_write(popencontext, pindata);
&&& resetevent(g_htransferdone);
&&& //&&& wait until iic bus is free.
&&& if(!waitforreg((pvoid)&(g_piicreg-&iicstat), (1&&5), 0x0, timeout_ms_rx))
&&&&&&& debugmsg(zone_error,(text(&[iic error]iis bus is busy.\r\n&)));
&&&&&&& retval =
&&& //& 内核地址映射
&&& hr = ceopencallerbuffer((pvoid*) &mappedembedded, poutdata-&data, poutdata-&count, arg_o_ptr, false);
&&& hr = ceallocasynchronousbuffer((pvoid*) &marshalled, mappedembedded, poutdata-&count, arg_o_ptr);
&&& g_pciic_buffer&&& =&&&
&&& g_uiic_pt&&&&&&&& =&&& 0;
&&& g_uiic_datalen&&& =&&& poutdata-&
&&& g_piicreg-&iiccon |= (1&&7);&&&&&&& //&&& ack generation enable
&&& g_piicreg-&iicds& =&&&& poutdata-&
&&& g_piicreg-&iicstat = mrx_
&&& if(waitforsingleobject(g_htransferdone, timeout_ms_rx) == wait_timeout)
&&&&&&& debugmsg(zone_error,(text(&[iic error]rx time out.\r\n&)));
&&&&&&& retval =
&&& hr = cefreeasynchronousbuffer((pvoid)marshalled, mappedembedded, poutdata-&count, arg_o_ptr);
&&& hr = ceclosecallerbuffer((pvoid)& mappedembedded, poutdata-&data, poutdata-&count, arg_o_ptr);
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&+hw_read(0x%x)\r\n&),
&&&&&&&&&&&&&& popencontext));
//////////
// function name : hw_write
// function description : iic write operation, sync function, so wait for transfer done or time out.
// input : phw_open_info popencontext
//&&&&&&&&&& piic_io_desc pindata
// output :
// version : v0.5
bool&&&&&&& hw_write&&&&&&& (phw_open_info popencontext, piic_io_desc pindata)
&&& hresult&&
&&& bool&&&&& retval&&&&&&&&&& =&&&&&&& // initialize to success
&&& pbyte&&&&
&&& pbyte&&&&
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&+hw_write(0x%x)\r\n&),
&&&&&&&&&&&&&& popencontext));
&&& hw_setregister(popencontext);
&&& resetevent(g_htransferdone);
&&& //&&& wait until iic bus is free.
&&& if(!waitforreg((pvoid)&(g_piicreg-&iicstat), (1&&5), 0x0, timeout_ms_tx))
&&&&&&& debugmsg(zone_error,(text(&[iic error]iic bus is busy.\r\n&)));
&&& hr = ceopencallerbuffer((pvoid*) &mappedembedded, pindata-&data, pindata-&count, arg_i_ptr, false);
&&& hr = ceallocasynchronousbuffer((pvoid*) &marshalled, mappedembedded, pindata-&count, arg_i_ptr);
&&& g_pciic_buffer&&& =&&&
&&& g_uiic_pt&&&&&&& =&&&& 0;
&&& g_uiic_datalen&&& =&&& pindata-&
&&& g_piicreg-&iiccon |= (1&&7);&&&&&&& //&&& ack generation enable
&&& g_piicreg-&iicds = pindata-&
&&& debugmsg(zone_info,(text(&[iic tx]slave address is 0x%02x\n&),pindata-&slaveaddress));
&&& g_piicreg-&iicstat = mtx_
&&& if(waitforsingleobject(g_htransferdone, timeout_ms_tx) == wait_timeout)
&&&&&&& debugmsg(zone_error,(text(&[iic error]tx time out.\r\n&)));
&&&&&&& retval =
&&& hr = cefreeasynchronousbuffer((pvoid)marshalled, mappedembedded, pindata-&count, arg_i_ptr);
&&& hr = ceclosecallerbuffer((pvoid)& mappedembedded, pindata-&data, pindata-&count, arg_i_ptr);
//cleanup:
&&& debugmsg (zone_function,
&&&&&&&&&&&&& (text(&-hw_write(0x%x)\r\n&),
&&&&&&&&&&&&&& popencontext));
//////////
// function name : waitforreg
// function description : wait for register value, or time out.
// input :&&&& dword dwregaddress,&&&& // address of register for check
//&&&&&&&&&&&&&&& uint32 tmask,&&&&&&&& // mask for check position
//&&&&&&&&&&&&&&& uint32 twaitforequal,&&& // compare value.
//&&&&&&&&&&&&&&& dword dwtimeout&&&&&&&&&&& // time out (ms)
// output : true (the value is set), false (time out)
// version : v0.5
waitforreg(
&&& pvoid pregaddress,
&&& uint32 tmask,
&&& uint32 twaitforequal,
&&& dword dwtimeout
&&& const dword dwstart = gettickcount();
&&& uint32
&&& bool fret =
&&& dword dwiteration = 1;
&&& // verify that reset has completed.
&&&&&&& tvalue = *(volatile uint32*)(pregaddress);
&&&&&&& if ( (dwiteration % 16) == 0 ) {
&&&&&&&&&&& // check time
&&&&&&&&&&& dword dwcurr = gettickcount();
&&&&&&&&&&& // unsigned arithmetic handles rollover.
&&&&&&&&&&& dword dwtotal = dwcurr -
&&&&&&&&&&& if (dwtotal & dwtimeout) {
&&&&&&&&&&&&&&& // timeout
&&&&&&&&&&&&&&& fret =
&&&&&&&&&&&&&&& debugmsg(zone_warn&&& , (_t(&timeout (%u ms) waiting for register & 0x%08x == 0x%08x\r\n&),
&&&&&&&&&&&&&&&&&&& dwtimeout, tmask, twaitforequal));
&&&&&&&&&&&&&&&
&&&&&&&&&&& }
&&&&&&& ++
&&& } while ((tvalue & tmask) != twaitforequal);
static dword
&&& lpvoid context
&&& static dword&&& dwtimeout =
&&& phw_init_info pinitcontext = (phw_init_info)
&&& bool bdone =
&&& dword&&&
//&retailmsg(1(text(&****iic_ist**********test*****&)));
&&& if ( !pinitcontext )
&&&&&&& return error_invalid_
&&& while(pinitcontext-&state == iic_run)
&&&&&&& dwwaitresult = waitforsingleobject(g_htransferevent, dwtimeout);
&&&&&&& if(pinitcontext-&state == iic_finish)&&&&&&& // when we destruct iic thread.
&&&&&&& iicstat = g_piicreg-&
&&&&&&& if (iicstat & arbitration_failed)
&&&&&&&&&&& debugmsg(zone_error,(text(&i2c_ist[0x%x, %d]: bus arbitration failed \r\n&),
&&&&&&&&&&&&&&& g_ownercontext, g_uiic_pt));
&&&&&&&&&&& retailmsg(1,(text(&i2c_ist[0x%x, %d]: bus arbitration failed \r\n&),
&&&&&&&&&&&&&&& g_ownercontext, g_uiic_pt));
&&&&&&& if (iicstat & slave_address_matched)
&&&&&&&&&&& debugmsg(zone_error,(text(&i2c_ist[0x%x, %d]: slave address matches iicadd \r\n&),
&&&&&&&&&&&&&&& g_ownercontext, g_uiic_pt));
&&&&&&&&&&& retailmsg(1,(text(&i2c_ist[0x%x, %d]: slave address matches iicadd \r\n&),
&&&&&&&&&&&&&&& g_ownercontext, g_uiic_pt));
&&&&&&& if (iicstat & slave_address_zero)
&&&&&&&&&&& debugmsg(zone_error,(text(&i2c_ist[0x%x, %d]: received slave address 0x0 \r\n&),
&&&&&&&&&&&&&&& g_ownercontext, g_uiic_pt));
&&&&&&&&&&& retailmsg(1,(text(&i2c_ist[0x%x, %d]: received slave address 0x0 \r\n&),
&&&&&&&&&&&&&&& g_ownercontext, g_uiic_pt));
&&&&&&& if (iicstat & ack_not_received)
&&&&&&&&&&& debugmsg(zone_error,(text(&i2c_ist[0x%x, %d]: ack not received \r\n&),
&&&&&&&&&&&&&&& g_ownercontext, g_uiic_pt));
//&&&&&&&&&&& retailmsg(1,(text(&i2c_ist[0x%x, %d]: ack not received \r\n&),
//&&&&&&&&&&&&&&& g_ownercontext, g_uiic_pt));
&&&&&&& switch( (iicstat&&6)&0x3)
&&&&&&&&&&& case slave_receive:
&&&&&&&&&&&&&&&
&&&&&&&&&&& case slave_transmit:
&&&&&&&&&&&&&&&
&&&&&&&&&&& case master_receive:
&&&&&&&&&&&&&&& if (g_uiic_pt&0 && g_uiic_pt &=g_uiic_datalen)
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& g_pciic_buffer[g_uiic_pt-1] = g_piicreg-&
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& g_uiic_pt++;
&&&&&&&&&&&&&&& if (g_uiic_pt==g_uiic_datalen)
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& g_piicreg-&iiccon &= ~(1&&7);
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& else if (g_uiic_pt & g_uiic_datalen)
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& bdone =
&&&&&&&&&&&&&&&&&&& g_piicreg-&iicstat = mrx_
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& g_piicreg-&iiccon &= ~(1&&4);
&&&&&&&&&&&&&&&
&&&&&&&&&&& case master_transmit:
&&&&&&&&&&&&&&& if (g_uiic_pt&g_uiic_datalen)
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& g_piicreg-&iicds = g_pciic_buffer[g_uiic_pt];
&&&&&&&&&&&&&&&&&&& debugmsg(zone_ist,(text(&[iic tx thread]g_piicreg-&iicds is 0x%02x\n&),g_piicreg-&iicds));
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& bdone =
&&&&&&&&&&&&&&&&&&& g_piicreg-&iicstat = mtx_&&&&&&& //&&& stop master tx condition, ack flag clear
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& g_uiic_pt++;
&&&&&&&&&&&&&&& g_piicreg-&iiccon &= ~(1&&4);
&&&&&&&&&&&&&&&
&&&&&&&&&&& default :
&&&&&&&&&&&&&&&
&&&&&&& interruptdone(g_intriic);
&&&&&&& if (bdone)
&&&&&&&&&&& debugmsg(zone_info, (text(&setevent done\r\n&)));
&&&&&&&&&&& bdone =
&&&&&&&&&&& setevent(g_htransferdone);
&&& return error_
如果build的话会报错。由此需要修改iic_pdd.h
2.iic_pdd.h修改后的代码如下:
/**************************************************************************************
*&&& project name : iic driver
*&&& copyright 2006 by samsung electronics, inc.
*&&& all rights reserved.
*&&& project description :
*&&&&&&& this software is pdd layer for iic samsung driver.
*--------------------------------------------------
*&&& file name : iic_pdd.h
*&&& file description : this file declare pdd functions for iic driver.
*&&& author : jegeon.jung
*&&& dept. : ap development team
*&&& created date :
*&&& version : 0.1
*&&& history
*&&& - created(jegeon.jung )
**************************************************************************************/
#ifndef __iic_pdd_h__
#define __iic_pdd_h__
#if __cplusplus
extern &c&
#include &iic.h&
#define default_slave_address&&&&&&& 0xc0
#define default_interrupt_enable&&& 1
// i2c master commands (iicstat)
#define m_idle&&&&&&&&& 0x00&&& // disable rx/tx
#define m_active&&&&& 0x10&&& // enable rx/tx
#define mtx_start&&& 0xf0&&& // master tx start
#define mtx_stop&&&&& 0xd0&&& // master tx stop
#define mrx_start&&& 0xb0&&& // master rx start
#define mrx_stop&&&&& 0x90&&& // master rx stop
// i2c state (iicstat)
#define arbitration_failed&&&&&&&&&&&&& 0x08
#define slave_address_matched&&&&& 0x04
#define slave_address_zero&&&&&&&&&&&& 0x02
#define ack_not_received&&&&&&&&&&&&&&&&& 0x01
//&&&&&&& declare functions
bool&&&&&&&& hw_init&&&&&&&& (phw_init_info pinitcontext);
void&&&&&&&& hw_deinit&&&&&&&& (phw_init_info pinitcontext);
bool&&&&&&&& hw_openfirst&&&& (phw_open_info popencontext);
bool&&&&&&&& hw_closelast&&&& (phw_open_info popencontext);
bool&&&&&&&& hw_open&&&&&&&&&&&& (phw_open_info popencontext);
bool&&&&&&&& hw_close&&&&&&& (phw_open_info popencontext);
bool&&&&&&& hw_powerup&&&&&&& (phw_init_info pinitcontext);
bool&&&&&&& hw_powerdown&&& (phw_init_info pinitcontext);
void&&&&&&&& hw_setregister&&&& (phw_open_info popencontext);
void&&&&&&&& hw_setclock&&&&&&& (phw_open_info popencontext);
bool&&&&&&& hw_read&&&&&&&&&&&& (phw_open_info popencontext, piic_io_desc pindata ,piic_io_desc poutdata);
bool&&&&&&& hw_write&&&&&&& (phw_open_info popencontext, piic_io_desc pindata);
#if __cplusplus
#endif //&&& __iic_pdd_h__
3.build ok ,下载,测试,ok。
先在0位置写0,1位置写1,2位置写2,如下图,成功。
&然后,再读回来。
4.疑问:不知道操作其他iic器件是否有问题?
& 搜索此文相关文章:此文来自: 马开东博客
网址: 站长QQ
上一篇:没有了
6410操作24C02驱动bug批改及测试_移动开发相关文章
移动开发_总排行榜
移动开发_最新
移动开发_月排行榜
移动开发_周排行榜
移动开发_日排行榜

我要回帖

更多关于 易企秀可以放视频吗 的文章

 

随机推荐