Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebase camera interface demo #3

Merged
merged 4 commits into from Oct 30, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

picorv32 image acquisition

Signed-off-by: David Shah <davey1576@gmail.com>
  • Loading branch information
daveshah1 authored and elms committed Oct 29, 2018
commit 81a4569c0bc2890c65ffd88346972bbf75f1210b
@@ -19,7 +19,7 @@
#define CAMERA_BASE 0x03000000

#define reg_camera_i2c (*(volatile uint32_t*)CAMERA_BASE)
#define reg_camera_fb ((volatile uint32_t*)(CAMERA_BASE + 0x8000))
#define reg_camera_fb ((volatile uint8_t*)(CAMERA_BASE + 0x8000))

static void i2c_delay() {
for (volatile int i = 0; i < 10; i++)
@@ -94,7 +94,7 @@ module dphy_rx_byte_align(
found_sync = 1'b0;
sync_offs = 0;
for (i = 0; i < 8; i = i + 1) begin
if ((concat_word[(1+i) +: 8] == sync_word) /*&& (last_byte[i:0] == 0)*/) begin
if ((concat_word[(1+i) +: 8] == sync_word) && (last_byte[i:0] == 0)) begin
was_found = 1'b1;
offset = i;
end
@@ -30,6 +30,8 @@ extern uint32_t sram;
#define RUN_LOOP 0
#define SER_TIMEOUT 1500000
#define ML_TIMEOUT 100
#define NUM_IMAGES 10
#define IMAGE_NOPS 10000

#define reg_leds (*(volatile uint32_t*)0x02000000)
#define reg_uart (*(volatile uint32_t*)0x02000004)
@@ -411,11 +413,37 @@ void ml_test()

// --------------------------------------------------------

void print_image() {
uint8_t buf[30*40];
print("Acquiring image\n");
acquire_image(buf);
print("----------------------------------------\n");

int addr = 0;
for (int y = 0; y < 30; y++) {
for (int x = 0; x < 40; x++) {
print_hex(buf[addr++], 2);
print(" ");
}
print("\n");
}
}

// --------------------------------------------------------

void main()
{
print("\n\n\n\n\n");
print("Booting..\n");

camera_init();
print ("Initialised camera\n");
for (int ii=0; ii< NUM_IMAGES; ++ii) {
print_image();
for (volatile int i = 0; i < IMAGE_NOPS; i++)
;
}

ml_test();
print("\n");
camera_init();
ProTip! Use n and p to navigate between commits in a pull request.