Android L 5.1.1 Rear Camera - DB410c AISTARVISION

本文介绍了如何在Android L 5.1.1系统上,针对DB410c板子,配置并启用OV5645后置摄像头。主要涉及kernel和user space部分的修改,包括DTSI文件和sensor初始化参数。完成配置后,摄像头成功捕获图像。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Coming back!

接着上一篇,我们基于AISTARVISION MIPI CSI Adapter V2.0继续分享ov5645 rear camera的porting方法。因为在DB410c的android L 5.1.1系统中默认带有ov5645的sensor driver,所以同学们对于这一颗sensor只需要修改configuration就ok了。


1. kernel部分修改camera cci dtsi文件,我截取了需要修改的字段,

qcom,camera@78 {

               compatible = "ovti,ov5645";

               qcom,csiphy-sd-index = <0>;                             /*should contain csiphy instance that will used toreceive sensor data*/

               qcom,csid-sd-index = <0>;                                 /*should contain csid core instance that will used toreceive sensor data*/

               gpios= <&msm_gpio 26 0>,

                            <&msm_gpio 35 0>,

                            <&msm_gpio 34 0>;          /*should contain phandle to gpio controller node and array of #gpio-cells specifying specific gpio (controller specific)*/

               qcom,csi-lane-assign = <0x4320>;                    /*should contain lane assignment value to map CSIPHYlanes to CSID lanes*/

               qcom,csi-lane-mask = <0x3>;                            /*should contain lane mask that specifies CSIPHY lanes tobe enabled*/

               qcom,sensor-position = <0>;                             /*should contain the mount angle of the camera sensor*/ /*0 -> back camera  1 -> front camera*/

               qcom,sensor-mode = <0>;            /*should contain sensor mode supported*/ /*0 -> back camera 2D  1 -> front camera 2D  2 -> back camera 3D  3 -> back camera int 3D*/

               qcom,cci-master = <0>;                                     /*should contain i2c master id to be used for this camerasensor*/

               clocks = <&clock_gcc clk_mclk0_clk_src>, <&clock_gcc clk_gcc_camss_mclk0_clk>;

               clock-names = "cam_src_clk", "cam_clk";      /*name of the clocks required for the device*/

        };


2. user space部分修改ov5645_lib.c,这里也同样截取需要修改的字段,字段的意思比较容易理解,我就不额外加注释了。微笑

static struct msm_sensor_init_params sensor_init_params = {

      .modes_supported =1,

      .position = 0,

      .sensor_mount_angle= 0,

};

static struct csi_lane_params_t csi_lane_params = {

      .csi_lane_assign =0x4320,

      .csi_lane_mask =0x7,

      .csi_if = 1,

      .csid_core = {0},

      .csi_phy_sel = 0,

};

static struct msm_camera_csi2_params ov5645_csi_params = {

      .csid_params = {

        .lane_cnt = 2,

      },

      .csiphy_params = {

        .lane_cnt = 2,

        .settle_cnt = 29,

      },

};


3. 通过以上两部分对ov5645 sensor configuration file的修改,再结合上篇博文的AISTARVISION MIPI CSI Adapter V2.0的硬件连接说明,“如果使用rear camera,sensor连接到J3 connector,J13就只需要用跳线帽(pin19连pin20,pin21连pin22)即可。”大家就可以看到Rear Camera的图像啦!share两张靓照得意

第一张是拍摄到影像的屏幕截图,这清晰度有点……,第二张是AISTARVISION MIPI Adapter V2.0, camera接在J3 connector。



OK,这篇博文就先写到这,后续我们会有更多的camera sensor porting的案例(包括3A tuning)和machine vision的系统方案share给大家,see you next time.

### 函数 `AppendP` 的分析 该函数的作用是在链表的尾部插入一个新的节点,并更新指针使得新节点成为新的尾节点。让我们逐步解析这个函数: ```c void AppendP(struct Node** rear, struct Node* p) { // 分配内存给新节点并初始化数据域和指针域 p = (struct Node*)malloc(sizeof(struct Node)); if (p == NULL) { // 内存分配失败处理 printf("Memory allocation failed\n"); return; } p->data = 0; // 初始化数据为0 p->next = NULL; // 新节点指向NULL // 将新节点连接到当前链表的最后面 p->next = (*rear)->next; // 这一步实际上是多余的,因为(*rear)->next 应该是NULL (*rear)->next = p; // 把新节点挂接到原来的最后一个节点之后 (*rear) = p; // 更新rear使其指向新添加的节点作为新的尾节点 } ``` #### 关键点说明: 1. **参数解释** - `struct Node** rear`: 指向指向链表尾结点的指针的指针。通过双重解引用可以修改原链表的实际结构。 - `struct Node* p`: 原本用于接收返回的新节点地址;但在实际实现过程中直接在内部创建了新的节点。 2. **存在问题及优化建议** - 上述代码中有部分操作多余或可能导致误解的地方需要改进: - 变量 `p` 被传入却没有使用其初始值,在函数体内又被重新赋值了一个新分配的空间; - 表达式 `p->next = (*rear)->next;` 实际上并没有意义,因为在正常情况下 `(*rear)->next` 总是指向 `NULL` (即空),因此这行完全可以省略掉; - 如果想让此函数返回新增加元素的位置,则应将 `p` 改成输出型参数(如改为 `struct Node** p`),并在结束前设置它等于新建的那个节点。 3. **改进建议后的版本** ```c void AppendP(struct Node** rear) { struct Node* new_node = (struct Node*)malloc(sizeof(struct Node)); if (!new_node) { printf("Failed to allocate memory.\n"); return; } new_node->data = 0; // 设置默认值或其他必要信息 new_node->next = NULL; if (*rear != NULL) // 确保不是首次插入的情况下的正确链接 (*rear)->next = new_node; *rear = new_node; // 更新尾指针至最新位置 } ``` 这种改动不仅简化了不必要的步骤,还提高了程序的安全性和健壮性,避免了一些潜在的问题。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值