Skip to content

Commit

Permalink
Rename variable in snakecase
Browse files Browse the repository at this point in the history
  • Loading branch information
chiangkd committed May 27, 2024
1 parent 4518267 commit a100317
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions aclint.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

void aclint_timer_interrupts(vm_t *vm, aclint_state_t *aclint)
{
if ((vm->mtimeh > aclint->mtimecmph) ||
((vm->mtimeh == aclint->mtimecmph) && (vm->mtime >= aclint->mtimecmp)))
if ((vm->mtimeh > aclint->mtimecmp_hi) ||
((vm->mtimeh == aclint->mtimecmp_hi) &&
(vm->mtime >= aclint->mtimecmp_lo)))
vm->sip |= RV_INT_STI_BIT;
else
vm->sip &= ~RV_INT_STI_BIT;
Expand Down Expand Up @@ -34,11 +35,11 @@ static bool aclint_reg_read(aclint_state_t *aclint,
return true;
case _(MTIMECMP_LO):
/* mtimecmp */
*value = aclint->mtimecmp;
*value = aclint->mtimecmp_lo;
return true;
case _(MTIMECMP_HI):
/* mtimecmph */
*value = aclint->mtimecmph;
*value = aclint->mtimecmp_hi;
return true;
case _(MTIME_LO):
/* mtime */
Expand Down
4 changes: 2 additions & 2 deletions device.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ enum {

typedef struct {
vm_t *vm;
uint32_t mtimecmp;
uint32_t mtimecmph;
uint32_t mtimecmp_lo;
uint32_t mtimecmp_hi;
uint32_t setssip;
} aclint_state_t;

Expand Down
4 changes: 2 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ static inline sbi_ret_t handle_sbi_ecall_TIMER(vm_t *vm, int32_t fid)
emu_state_t *data = PRIV(vm);
switch (fid) {
case SBI_TIMER__SET_TIMER:
data->aclint.mtimecmp = vm->x_regs[RV_R_A0];
data->aclint.mtimecmph = vm->x_regs[RV_R_A1];
data->aclint.mtimecmp_lo = vm->x_regs[RV_R_A0];
data->aclint.mtimecmp_hi = vm->x_regs[RV_R_A1];
return (sbi_ret_t){SBI_SUCCESS, 0};
default:
return (sbi_ret_t){SBI_ERR_NOT_SUPPORTED, 0};
Expand Down

0 comments on commit a100317

Please sign in to comment.