| // Copyright 2023 Google LLC |
| // Copyright lowRISC contributors |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| // |
| // Camera control module for HiMax HM01B0 Image Sensor. |
| |
| `include "prim_assert.sv" |
| |
| module cam_ctrl |
| import cam_ctrl_reg_pkg::*; |
| ( |
| input clk_i, |
| input rst_ni, |
| |
| // Bus interface |
| input tlul_pkg::tl_h2d_t tl_i, |
| output tlul_pkg::tl_d2h_t tl_o, |
| |
| output intr_cam_motion_detect_o, |
| |
| input cio_cam_int_i, |
| output cio_cam_trig_o, |
| output cio_cam_trig_en_o |
| ); |
| |
| cam_ctrl_reg2hw_t reg2hw; |
| cam_ctrl_hw2reg_t hw2reg; |
| |
| // Register module |
| cam_ctrl_reg_top u_reg ( |
| .clk_i, |
| .rst_ni, |
| |
| .tl_i, |
| .tl_o, |
| |
| .reg2hw, |
| .hw2reg, |
| |
| .intg_err_o (), |
| .devmode_i (1'b1) |
| ); |
| |
| |
| prim_intr_hw #(.Width(1)) intr_hw_motion_detect ( |
| .clk_i, |
| .rst_ni, |
| .event_intr_i (cio_cam_int_i), |
| .reg2hw_intr_enable_q_i (reg2hw.intr_enable.q), |
| .reg2hw_intr_test_q_i (reg2hw.intr_test.q), |
| .reg2hw_intr_test_qe_i (reg2hw.intr_test.qe), |
| .reg2hw_intr_state_q_i (reg2hw.intr_state.q), |
| .hw2reg_intr_state_de_o (hw2reg.intr_state.de), |
| .hw2reg_intr_state_d_o (hw2reg.intr_state.d), |
| .intr_o (intr_cam_motion_detect_o) |
| ); |
| |
| //////////////////////////////////////////////////// |
| // Software controls cam_trig // |
| //////////////////////////////////////////////////// |
| |
| assign cio_cam_trig_o = reg2hw.ctrl[0]; |
| assign cio_cam_trig_en_o = 1'b1; |
| |
| endmodule |