Skip to content

Commit

Permalink
optimized set_intpri() for v850
Browse files Browse the repository at this point in the history
  • Loading branch information
ytoi committed Feb 23, 2021
1 parent c9e42ab commit c6eb62d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
20 changes: 20 additions & 0 deletions apl/include/athrill_syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ struct api_arg_exit {
sys_int32 status;
};

// for v850 optimize
struct api_arg_v850_set_intpri {
sys_addr imr_table;
sys_addr disint_table;
};


typedef enum {
SYS_API_ID_NONE = 0,
SYS_API_ID_SOCKET,
Expand Down Expand Up @@ -206,6 +213,7 @@ typedef enum {
SYS_API_ID_EV3_CLOSEDIR,
SYS_API_ID_EV3_SERIAL_OPEN,
SYS_API_ID_EXIT,
SYS_API_ID_V850_SET_INTPRI,
SYS_API_ID_NUM,
} AthrillSyscallApiIdType;

Expand Down Expand Up @@ -254,6 +262,7 @@ typedef struct {
struct api_arg_ev3_closedir api_ev3_closedir;
struct api_arg_ev3_serial_open api_ev3_serial_open;
struct api_arg_exit api_exit;
struct api_arg_v850_set_intpri api_v850_set_intpri;
} body;
} AthrillSyscallArgType;

Expand Down Expand Up @@ -736,6 +745,17 @@ static inline sys_int32 athrill_posix_exit(sys_int32 status)
return args.ret_value;
}

static inline void athrill_v850_set_intpri(sys_addr imr_table,sys_addr disint_table)
{
volatile AthrillSyscallArgType args;
args.api_id = SYS_API_ID_V850_SET_INTPRI;
args.body.api_v850_set_intpri.imr_table = imr_table;
args.body.api_v850_set_intpri.disint_table = disint_table;

ATHRILL_SYSCALL(&args);

}

#endif /* ATHRILL_SYSCALL_DEVICE */

#endif /* _ATHRILL_SYSCALL_H_ */
30 changes: 30 additions & 0 deletions src/device/peripheral/athrill_syscall_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ static void athrill_syscall_ev3_closedir(AthrillSyscallArgType *arg);
static void athrill_syscall_ev3_serial_open(AthrillSyscallArgType *arg);
static void athrill_syscall_exit(AthrillSyscallArgType *arg);

static void athrill_syscall_v850_set_intpri(AthrillSyscallArgType *arg);




Expand Down Expand Up @@ -92,6 +94,8 @@ static struct athrill_syscall_functable syscall_table[SYS_API_ID_NUM] = {
{ athrill_syscall_ev3_serial_open },

{ athrill_syscall_exit },

{ athrill_syscall_v850_set_intpri },
};

void athrill_syscall_device(uint32 addr)
Expand Down Expand Up @@ -1047,3 +1051,29 @@ static void athrill_syscall_exit(AthrillSyscallArgType *arg)
arg->ret_value = SYS_API_ERR_OK;
return;
}


static void athrill_syscall_v850_set_intpri(AthrillSyscallArgType *args)
{
uint8_t *write_top;
uint16_t *imr_table;
uint16_t *disint_table;
Std_ReturnType err;

// 0xfffff100 is IMR0 in arch/v850_gcc/v850esfk3.h
err = mpu_get_pointer(0U, (uint32_t)0xfffff100 ,(uint8_t**)&write_top);
err = mpu_get_pointer(0U, (uint32)args->body.api_v850_set_intpri.imr_table ,(uint8_t**)&imr_table);
err = mpu_get_pointer(0U, (uint32)args->body.api_v850_set_intpri.disint_table ,(uint8_t**)&disint_table);

int i;
// copy first 7 index by uint16_t
for ( i = 0; i < 7; i++ ) {
*(uint16_t*)write_top = (*imr_table|*disint_table);
write_top += 2;
imr_table++;
disint_table++;
}
// last index is uint8
*write_top = (uint8_t)(*imr_table|*disint_table);

}

0 comments on commit c6eb62d

Please sign in to comment.