kopia lustrzana https://github.com/cariboulabs/cariboulite
smi firmware and software
rodzic
879638639e
commit
0806246a55
|
@ -97,6 +97,9 @@ module smi_ctrl
|
|||
reg r_fifo_24_pull;
|
||||
reg [7:0] r_smi_test_count_09;
|
||||
reg [7:0] r_smi_test_count_24;
|
||||
wire soe_change_falling;
|
||||
|
||||
assign soe_change_falling = (r_last_soe_2 == 1'b1 && r_last_soe_1 == 1'b0);
|
||||
|
||||
always @(posedge i_sys_clk)
|
||||
begin
|
||||
|
@ -114,23 +117,19 @@ module smi_ctrl
|
|||
// 0.9 GHz Data Sender
|
||||
//==========================
|
||||
if (i_smi_a == smi_address_read_900) begin
|
||||
if (r_last_soe_2 == 1'b0 && r_last_soe_1 == 1'b1) begin
|
||||
if (i_smi_test) begin
|
||||
if (soe_change_falling) begin
|
||||
if (i_smi_test == 1'b1) begin
|
||||
o_smi_data_out <= r_smi_test_count_09;
|
||||
r_smi_test_count_09 <= r_smi_test_count_09 + 1'b1;
|
||||
end
|
||||
end
|
||||
/*if (r_last_soe != i_smi_soe_se) begin
|
||||
if (int_cnt_09 > 8) int_cnt_09 <= int_cnt_09 - 8;
|
||||
end else begin
|
||||
if (int_cnt_09 > 8) int_cnt_09 <= int_cnt_09 - 8;
|
||||
|
||||
if (i_smi_test) begin
|
||||
r_smi_test_count_09 <= r_smi_test_count_09 + 1'b1;
|
||||
o_smi_data_out <= r_smi_test_count_09;
|
||||
end else if (r_fifo_09_pull) begin
|
||||
r_fifo_09_pull <= 1'b0;
|
||||
o_smi_data_out <= i_fifo_09_pulled_data[int_cnt_09-1:int_cnt_09-8];
|
||||
if (r_fifo_09_pull) begin
|
||||
r_fifo_09_pull <= 1'b0;
|
||||
o_smi_data_out <= i_fifo_09_pulled_data[int_cnt_09-1:int_cnt_09-8];
|
||||
end
|
||||
end
|
||||
end else if (i_smi_soe_se == 1'b1) begin
|
||||
end else if (r_last_soe_1 == 1'b1 && i_smi_test == 1'b0) begin
|
||||
if (int_cnt_09 > 0) begin
|
||||
r_fifo_09_pull <= 1'b0;
|
||||
o_smi_data_out <= i_fifo_09_pulled_data[int_cnt_09-1:int_cnt_09-8];
|
||||
|
@ -138,29 +137,25 @@ module smi_ctrl
|
|||
r_fifo_09_pull <=1'b1;
|
||||
int_cnt_09 <= 6'd32;
|
||||
end
|
||||
end*/
|
||||
end
|
||||
end
|
||||
//==========================
|
||||
// 2.4 GHz Data Sender
|
||||
//==========================
|
||||
else if (i_smi_a == smi_address_read_2400) begin
|
||||
if (r_last_soe_2 == 1'b0 && i_smi_soe_se == 1'b1) begin
|
||||
if (i_smi_test) begin
|
||||
if (soe_change_falling) begin
|
||||
if (i_smi_test == 1'b1) begin
|
||||
o_smi_data_out <= r_smi_test_count_24;
|
||||
r_smi_test_count_24 <= r_smi_test_count_24 + 1'b1;
|
||||
end
|
||||
end
|
||||
/*if (r_last_soe != i_smi_soe_se) begin
|
||||
if (int_cnt_24 > 8) int_cnt_24 <= int_cnt_24 - 8;
|
||||
end else begin
|
||||
if (int_cnt_24 > 8) int_cnt_24 <= int_cnt_24 - 8;
|
||||
|
||||
if (i_smi_test) begin
|
||||
r_smi_test_count_24 <= r_smi_test_count_24 + 1'b1;
|
||||
o_smi_data_out <= r_smi_test_count_24;
|
||||
end else if (r_fifo_24_pull) begin
|
||||
r_fifo_24_pull <= 1'b0;
|
||||
o_smi_data_out <= i_fifo_24_pulled_data[int_cnt_24-1:int_cnt_24-8];
|
||||
if (r_fifo_24_pull) begin
|
||||
r_fifo_24_pull <= 1'b0;
|
||||
o_smi_data_out <= i_fifo_24_pulled_data[int_cnt_24-1:int_cnt_24-8];
|
||||
end
|
||||
end
|
||||
end else if (i_smi_soe_se == 1'b1) begin
|
||||
end else if (r_last_soe_1 == 1'b1 && i_smi_test == 1'b0) begin
|
||||
if (int_cnt_24 > 0) begin
|
||||
r_fifo_24_pull <= 1'b0;
|
||||
o_smi_data_out <= i_fifo_24_pulled_data[int_cnt_24-1:int_cnt_24-8];
|
||||
|
@ -168,10 +163,10 @@ module smi_ctrl
|
|||
r_fifo_24_pull <=1'b1;
|
||||
int_cnt_24 <= 6'd32;
|
||||
end
|
||||
end*/
|
||||
end
|
||||
end
|
||||
else begin
|
||||
o_smi_data_out <= 8'b00000000;
|
||||
//o_smi_data_out <= 8'b00000000;
|
||||
// error with address
|
||||
o_address_error <= 1'b1;
|
||||
end
|
||||
|
|
16064
firmware/top.asc
16064
firmware/top.asc
Plik diff jest za duży
Load Diff
BIN
firmware/top.bin
BIN
firmware/top.bin
Plik binarny nie jest wyświetlany.
20813
firmware/top.json
20813
firmware/top.json
Plik diff jest za duży
Load Diff
|
@ -335,7 +335,7 @@ module top(
|
|||
wire w_smi_test;
|
||||
|
||||
//assign w_smi_data_output = 8'b10100101;
|
||||
assign w_smi_test = 1'b1;
|
||||
assign w_smi_test = 1'b0;
|
||||
assign w_smi_addr = {i_smi_a3, i_smi_a2, i_smi_a1};
|
||||
assign io_smi_data = (w_smi_writing)?w_smi_data_output:1'bZ;
|
||||
assign w_smi_data_input = io_smi_data;
|
||||
|
|
|
@ -8,51 +8,19 @@
|
|||
|
||||
../../zf_log/zf_log.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/caribou_smi/bcm2835_smi.h
|
||||
linux/ioctl.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/caribou_smi/caribou_smi.h
|
||||
pthread.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
stdbool.h
|
||||
-
|
||||
linux/dmaengine.h
|
||||
-
|
||||
linux/of.h
|
||||
-
|
||||
linux/semaphore.h
|
||||
-
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/caribou_smi/caribou_smi.c
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/caribou_smi/test_caribou_smi.c
|
||||
zf_log/zf_log.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/caribou_smi/zf_log/zf_log.h
|
||||
caribou_smi.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/caribou_smi/caribou_smi.h
|
||||
bcm2835_smi.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/caribou_smi/bcm2835_smi.h
|
||||
string.h
|
||||
-
|
||||
fcntl.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
stdio.h
|
||||
-
|
||||
stdlib.h
|
||||
-
|
||||
sys/ioctl.h
|
||||
-
|
||||
sys/stat.h
|
||||
-
|
||||
unistd.h
|
||||
-
|
||||
sched.h
|
||||
-
|
||||
pthread.h
|
||||
-
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/caribou_smi/caribou_smi.h
|
||||
pthread.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
caribou_smi.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/caribou_smi/caribou_smi.h
|
||||
|
||||
|
|
Plik binarny nie jest wyświetlany.
|
@ -10,17 +10,36 @@
|
|||
|
||||
caribou_smi_st dev = {0};
|
||||
|
||||
|
||||
|
||||
void caribou_smi_data_event(void *ctx, caribou_smi_stream_type_en type, caribou_smi_channel_en ch,
|
||||
uint32_t byte_count, uint8_t *buffer, uint32_t buffer_len_bytes)
|
||||
{
|
||||
static int c = 1;
|
||||
static uint8_t last_byte = 0;
|
||||
static int err_count = 0;
|
||||
switch(type)
|
||||
{
|
||||
//-------------------------------------------------------
|
||||
case caribou_smi_stream_type_read:
|
||||
{
|
||||
ZF_LOGD("data event: stream channel %d, received %d bytes\n", ch, byte_count);
|
||||
//ZF_LOGD("data event: stream channel %d, received %d bytes\n", ch, byte_count);
|
||||
for (int i = 0; i< byte_count; i++)
|
||||
{
|
||||
uint8_t dist = (uint8_t)(buffer[i] - last_byte);
|
||||
if ( dist > 1)
|
||||
{
|
||||
err_count ++;
|
||||
float bER = (float)(err_count) / (float)(c);
|
||||
printf("ERR > at %d, dist: %d, V: %d, bER: %.7f\n", c, dist, buffer[i], bER);
|
||||
}
|
||||
/*printf("CUR CHUNK > %d %d %d %d ... %d %d %d %d\n", buffer[0],buffer[1],buffer[2],buffer[3],
|
||||
buffer[byte_count-4],
|
||||
buffer[byte_count-3],
|
||||
buffer[byte_count-2],
|
||||
buffer[byte_count-1]);
|
||||
*/
|
||||
last_byte = buffer[i];
|
||||
c++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue