Skip to content
Snippets Groups Projects
Commit 4010ce00 authored by Reinier van der Walle's avatar Reinier van der Walle
Browse files

Prcocessed review comments

parent 0520fa5a
No related branches found
No related tags found
2 merge requests!100Removed text for XSub that is now written in Confluence Subband correlator...,!64Resolve L2SDP-189
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include <ihc_apint.h> #include <ihc_apint.h>
#define DIVIDE_AND_ROUND_UP(A,B) (((A)+(B)-1)/(B))
enum mm_channel { enum mm_channel {
CH_PROCESS_A, CH_PROCESS_A,
CH_PROCESS_B, CH_PROCESS_B,
...@@ -48,12 +50,12 @@ struct param_process_b_struct { ...@@ -48,12 +50,12 @@ struct param_process_b_struct {
union param_process_a { union param_process_a {
struct param_process_a_struct parameters; struct param_process_a_struct parameters;
uint arr[sizeof(struct param_process_a_struct)/sizeof(uint)]; uint arr[DIVIDE_AND_ROUND_UP(sizeof(struct param_process_a_struct),sizeof(uint))];
}; };
union param_process_b { union param_process_b {
struct param_process_b_struct parameters; struct param_process_b_struct parameters;
uint arr[sizeof(struct param_process_b_struct)/sizeof(uint)]; uint arr[DIVIDE_AND_ROUND_UP(sizeof(struct param_process_b_struct),sizeof(uint))];
}; };
...@@ -66,7 +68,7 @@ struct reg { ...@@ -66,7 +68,7 @@ struct reg {
struct mm_in { struct mm_in {
uint wrdata; uint wrdata;
uint address; uint address;
uchar wr; bool wr;
} __attribute__((packed)); } __attribute__((packed));
struct mm_out { struct mm_out {
...@@ -88,8 +90,8 @@ __kernel void mm_in_controller() ...@@ -88,8 +90,8 @@ __kernel void mm_in_controller()
{ {
// Regmap table with offset, size // Regmap table with offset, size
const struct reg regmap[LAST_MM_CHANNEL_ENTRY] = { const struct reg regmap[LAST_MM_CHANNEL_ENTRY] = {
{0x00, sizeof(struct param_process_a_struct)/sizeof(uint)}, {0x00, DIVIDE_AND_ROUND_UP(sizeof(struct param_process_a_struct),sizeof(uint))},
{0x02, sizeof(struct param_process_b_struct)/sizeof(uint)} {0x02, DIVIDE_AND_ROUND_UP(sizeof(struct param_process_b_struct),sizeof(uint))}
}; };
while(1) while(1)
{ {
...@@ -159,7 +161,7 @@ __kernel void process_a() ...@@ -159,7 +161,7 @@ __kernel void process_a()
// handle MM read/write requests // handle MM read/write requests
struct mm_in mm_request = read_channel_intel(mm_channel_in[CH_PROCESS_A]); //blocking read struct mm_in mm_request = read_channel_intel(mm_channel_in[CH_PROCESS_A]); //blocking read
struct mm_out mm_response; struct mm_out mm_response;
if(mm_request.wr > 0) //write request if(mm_request.wr) //write request
{ {
reg.arr[mm_request.address] = mm_request.wrdata; reg.arr[mm_request.address] = mm_request.wrdata;
} else { //read request } else { //read request
...@@ -187,7 +189,7 @@ __kernel void process_b() ...@@ -187,7 +189,7 @@ __kernel void process_b()
// handle MM read/write requests // handle MM read/write requests
struct mm_in mm_request = read_channel_intel(mm_channel_in[CH_PROCESS_B]); //blocking read struct mm_in mm_request = read_channel_intel(mm_channel_in[CH_PROCESS_B]); //blocking read
struct mm_out mm_response; struct mm_out mm_response;
if(mm_request.wr > 0) //write request if(mm_request.wr) //write request
{ {
reg.arr[mm_request.address] = mm_request.wrdata; reg.arr[mm_request.address] = mm_request.wrdata;
} else { //read request } else { //read request
...@@ -196,7 +198,7 @@ __kernel void process_b() ...@@ -196,7 +198,7 @@ __kernel void process_b()
} }
// Do someting with parameters // Do someting with parameters
if(mm_request.wr > 0 && mm_request.address == 1) if(mm_request.wr && mm_request.address == 1)
reg.parameters.acc += 2; reg.parameters.acc += 2;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment