set_interrupt_handler

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
maqu67
Member++
Posts: 19
Joined: Tue Jan 23, 2018 3:26 pm

set_interrupt_handler

Postby maqu67 » Fri Feb 14, 2020 7:31 pm

Hello,

I've problems to understand the following definition I found in interrupt.h (USB Audio 2.0 software) :

#define set_interrupt_handler(f, args, c, ...)

In the decouple.xc file is called in the form:

set_interrupt_handler(handle_audio_request, 1, c_mix_out, 0);

Can someone explain me how it works ? I can't undestand the arguments. "handle_audio_request" is the function that is called when I have a request
on c_mix_out but '1' and '0' in the arguments list what do they represent?

Thanks a lot

Massimiliano
User avatar
mon2
XCore Legend
Posts: 1647
Joined: Thu Jun 10, 2010 11:43 am

Postby mon2 » Sat Feb 15, 2020 4:06 pm

Can be of partial help:

Code: Select all


#define set_interrupt_handler(f, nstackwords, args, c, ...) \
  asm (" .section .dp.data,       \"adw\", @progbits\n" \
       " .align 4\n" \
       "__" #f "_kernel_stack:\n" \
       " .space  " #nstackwords ", 0\n" \
       " .text\n"); \
  asm("mov r10, %0; ldaw r11, dp[__" #f "_kernel_stack];add r11, r11, r10;ldaw r10, sp[0]; "\
      "set sp,r11;stw r10, sp[0]; krestsp 0"::"r"(nstackwords-8):"r10","r11"); \
  store_args ## args(c, __VA_ARGS__) \
  do_interrupt_handler(f, args) \
  asm("ldap r11, __" #f "_handler; setv res[%0],r11"::"r"(c):"r11");    \
  asm("setc res[%0], 0xa; eeu res[%0]"::"r"(c));                        \
  asm("setsr (((0) & ~(((1 << 0x1) - 1) << 0x1)) | (((1) << 0x1) & (((1 << 0x1) - 1) << 0x1)))");

where:

#define set_interrupt_handler(f, nstackwords, args, c, ...)

Who is online

Users browsing this forum: No registered users and 1 guest