Skip to content

Commit

Permalink
sw: Format c files
Browse files Browse the repository at this point in the history
  • Loading branch information
thommythomaso authored and alex96295 committed Sep 12, 2023
1 parent f1ed93d commit c1012ae
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 31 deletions.
42 changes: 16 additions & 26 deletions sw/future/axirt.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,49 +19,39 @@ void __axirt_release() {
*reg32(&__base_axirtgrd, 0) = 0;
}


// setter functions
void __axirt_set_len_limit(uint8_t limit, uint8_t mgr_id){
void __axirt_set_len_limit(uint8_t limit, uint8_t mgr_id) {
*reg8(&__base_axirt, AXI_RT_LEN_LIMIT_0_REG_OFFSET + mgr_id) = limit;
}

void __axirt_set_region(uint64_t start_addr, uint64_t end_addr,
uint8_t region_id, uint8_t mgr_id) {
void __axirt_set_region(uint64_t start_addr, uint64_t end_addr, uint8_t region_id, uint8_t mgr_id) {

*reg32(&__base_axirt, AXI_RT_END_ADDR_SUB_HIGH_0_REG_OFFSET +
AXI_RT_PARAM_NUM_SUB * mgr_id * 4 +
region_id * 4) = end_addr >> 32;
*reg32(&__base_axirt, AXI_RT_END_ADDR_SUB_LOW_0_REG_OFFSET +
AXI_RT_PARAM_NUM_SUB * mgr_id * 4 +
region_id * 4) = end_addr & 0xffffffff;
AXI_RT_PARAM_NUM_SUB * mgr_id * 4 + region_id * 4) = end_addr >> 32;
*reg32(&__base_axirt, AXI_RT_END_ADDR_SUB_LOW_0_REG_OFFSET + AXI_RT_PARAM_NUM_SUB * mgr_id * 4 +
region_id * 4) = end_addr & 0xffffffff;

*reg32(&__base_axirt, AXI_RT_START_ADDR_SUB_LOW_0_REG_OFFSET +
AXI_RT_PARAM_NUM_SUB * mgr_id * 4 +
region_id * 4) = start_addr & 0xffffffff;
AXI_RT_PARAM_NUM_SUB * mgr_id * 4 + region_id * 4) =
start_addr & 0xffffffff;
*reg32(&__base_axirt, AXI_RT_START_ADDR_SUB_HIGH_0_REG_OFFSET +
AXI_RT_PARAM_NUM_SUB * mgr_id * 4 +
region_id * 4) = start_addr >> 32;
AXI_RT_PARAM_NUM_SUB * mgr_id * 4 + region_id * 4) = start_addr >> 32;
}

void __axirt_set_period(uint32_t period, uint8_t region_id, uint8_t mgr_id) {
*reg32(&__base_axirt, AXI_RT_WRITE_PERIOD_0_REG_OFFSET +
AXI_RT_PARAM_NUM_SUB * mgr_id * 4 +
region_id * 4) = period;
*reg32(&__base_axirt, AXI_RT_READ_PERIOD_0_REG_OFFSET +
AXI_RT_PARAM_NUM_SUB * mgr_id * 4 +
region_id * 4) = period;
*reg32(&__base_axirt, AXI_RT_WRITE_PERIOD_0_REG_OFFSET + AXI_RT_PARAM_NUM_SUB * mgr_id * 4 +
region_id * 4) = period;
*reg32(&__base_axirt, AXI_RT_READ_PERIOD_0_REG_OFFSET + AXI_RT_PARAM_NUM_SUB * mgr_id * 4 +
region_id * 4) = period;
}

void __axirt_set_budget(uint32_t budget, uint8_t region_id, uint8_t mgr_id) {
*reg32(&__base_axirt, AXI_RT_WRITE_BUDGET_0_REG_OFFSET +
AXI_RT_PARAM_NUM_SUB * mgr_id * 4 +
region_id * 4) = budget;
*reg32(&__base_axirt, AXI_RT_READ_BUDGET_0_REG_OFFSET +
AXI_RT_PARAM_NUM_SUB * mgr_id * 4 +
region_id * 4) = budget;
*reg32(&__base_axirt, AXI_RT_WRITE_BUDGET_0_REG_OFFSET + AXI_RT_PARAM_NUM_SUB * mgr_id * 4 +
region_id * 4) = budget;
*reg32(&__base_axirt, AXI_RT_READ_BUDGET_0_REG_OFFSET + AXI_RT_PARAM_NUM_SUB * mgr_id * 4 +
region_id * 4) = budget;
}


// config functions
void __axirt_enable(uint32_t enable) {
*reg32(&__base_axirt, AXI_RT_RT_ENABLE_REG_OFFSET) = enable;
Expand Down
5 changes: 1 addition & 4 deletions sw/future/axirt.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,15 @@ void __axirt_claim(bool read_excl, bool write_excl);

void __axirt_release();


// setter functions
void __axirt_set_len_limit(uint8_t limit, uint8_t mgr_id);

void __axirt_set_region(uint64_t start_addr, uint64_t end_addr,
uint8_t region_id, uint8_t mgr_id);
void __axirt_set_region(uint64_t start_addr, uint64_t end_addr, uint8_t region_id, uint8_t mgr_id);

void __axirt_set_period(uint32_t period, uint8_t region_id, uint8_t mgr_id);

void __axirt_set_budget(uint32_t budget, uint8_t region_id, uint8_t mgr_id);


// config functions
void __axirt_enable(uint32_t enable);

Expand Down
2 changes: 1 addition & 1 deletion sw/tests/helloaxirt.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int main(void) {
__axirt_claim(1, 1);
for (int m = 0; m < AXI_RT_PARAM_NUM_MRG; m++) {
__axirt_set_len_limit(8, m);
__axirt_set_region(0, 0xffffffff, 0, m);
__axirt_set_region(0, 0xffffffff, 0, m);
__axirt_set_region(0x100000000, 0xffffffffffffffff, 1, m);
__axirt_set_budget(0x10000000, 0, m);
__axirt_set_budget(0x10000000, 1, m);
Expand Down

0 comments on commit c1012ae

Please sign in to comment.