/* * Stereo, replacing, without level control. */ static void o_delay_process_r_s(delay_t *d, int *in, int *out, unsigned frames) { int *delaybuf = d->delaybuf; int inspos = d->inspos; int cl = d->cl; int cr = d->cr; unsigned s = frames; int outl, outr; unsigned i; while(s--) { /* Tail taps */ outl = outr = 0; for(i = 0; i < d->tailtaps; i += 2) { outl += TTAP(i); outr += TTAP(i+1); } /* LPF */ // cl += (outl - (cl>>INTERNAL_BITS)) * d->lpf; // cr += (outr - (cr>>INTERNAL_BITS)) * d->lpf; cl += (outl - cl) * d->lpf >> INTERNAL_BITS; cr += (outr - cr) * d->lpf >> INTERNAL_BITS; /* Feedback */ DB(0) = cl;// >> INTERNAL_BITS; DB(1) = cr;// >> INTERNAL_BITS; /* "Tap 0" */ outl = cl; outr = cr; /* Taps */ for(i = 0; i < d->taps; i += 2) { outl += TAP(i); outr += TAP(i+1); } /* Input */ DB(0) += in[0] << INTERNAL_BITS; DB(1) += in[1] << INTERNAL_BITS; /* Output */ out[0] = outl >> INTERNAL_BITS; out[1] = outr >> INTERNAL_BITS; inspos += 2; in += 2; out += 2; } d->cl = cl; d->cr = cr; d->inspos = inspos; }
/* * Stereo, replacing, with silent input and no level control. * Returns the approximate peak level of the generated output. */ static int o_delay_process_tail_s(delay_t *d, int *out, unsigned frames) { int level = 0; int *delaybuf = d->delaybuf; int inspos = d->inspos; int cl = d->cl; int cr = d->cr; int outl, outr; unsigned i, s; frames <<= 1; for(s = 0; s < frames; s += 2) { /* Tail taps */ outl = outr = 0; for(i = 0; i < d->tailtaps; i += 2) { outl += TTAP(i); outr += TTAP(i+1); } /* LP filters */ // cl += (outl - (cl>>INTERNAL_BITS)) * d->lpf; // cr += (outr - (cr>>INTERNAL_BITS)) * d->lpf; cl += (outl - cl) * d->lpf >> INTERNAL_BITS; cr += (outr - cr) * d->lpf >> INTERNAL_BITS; /* Feedback (No input!) */ DB(0) = cl; DB(1) = cr; /* "Tap 0" - the Feedback Signal */ outl = cl; outr = cr; /* Early Reflection Taps */ for(i = 0; i < d->taps; i += 2) { outl += TAP(i); outr += TAP(i+1); } /* Output */ out[s] = outl >> INTERNAL_BITS; out[s+1] = outr >> INTERNAL_BITS; /* Level meter */ level |= labs(outl) | labs(outr); inspos += 2; } d->cl = cl; d->cr = cr; d->inspos = inspos; return level >> INTERNAL_BITS; }
/* * Stereo, replacing in-place, without output level control * (for inserts) */ static void o_delay_process_s(delay_t *d, int *buf, unsigned frames) { int *delaybuf = d->delaybuf; int inspos = d->inspos; int cl = d->cl; int cr = d->cr; int outl, outr; unsigned i, s; frames <<= 1; for(s = 0; s < frames; s += 2) { /* Tail taps */ outl = outr = 0; for(i = 0; i < d->tailtaps; i += 2) { outl += TTAP(i); outr += TTAP(i+1); } /* LP filters */ // cl += (outl - (cl>>INTERNAL_BITS)) * d->lpf; // cr += (outr - (cr>>INTERNAL_BITS)) * d->lpf; cl += (outl - cl) * d->lpf >> INTERNAL_BITS; cr += (outr - cr) * d->lpf >> INTERNAL_BITS; /* Input + Feedback */ DB(0) = cl + (buf[s] << INTERNAL_BITS); DB(1) = cr + (buf[s+1] << INTERNAL_BITS); /* "Tap 0" - the Feedback Signal */ outl = cl; outr = cr; /* Early Reflection Taps */ for(i = 0; i < d->taps; i += 2) { outl += TAP(i); outr += TAP(i+1); } /* Output */ buf[s] = outl >> INTERNAL_BITS; buf[s+1] = outr >> INTERNAL_BITS; inspos += 2; } d->cl = cl; d->cr = cr; d->inspos = inspos; }
static int netdev_fill_tuntap_message(NetDev *netdev, struct ifreq *ifr) { TunTap *t; assert(netdev); assert(netdev->ifname); assert(ifr); if (netdev->kind == NETDEV_KIND_TAP) { t = TAP(netdev); ifr->ifr_flags |= IFF_TAP; } else { t = TUN(netdev); ifr->ifr_flags |= IFF_TUN; } if (!t->packet_info) ifr->ifr_flags |= IFF_NO_PI; if (t->one_queue) ifr->ifr_flags |= IFF_ONE_QUEUE; if (t->multi_queue) ifr->ifr_flags |= IFF_MULTI_QUEUE; if (t->vnet_hdr) ifr->ifr_flags |= IFF_VNET_HDR; strncpy(ifr->ifr_name, netdev->ifname, IFNAMSIZ-1); return 0; }
static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) { _cleanup_close_ int fd; TunTap *t = NULL; const char *user; const char *group; uid_t uid; gid_t gid; int r; assert(netdev); assert(ifr); fd = open(TUN_DEV, O_RDWR); if (fd < 0) return log_netdev_error_errno(netdev, -errno, "Failed to open tun dev: %m"); r = ioctl(fd, TUNSETIFF, ifr); if (r < 0) return log_netdev_error_errno(netdev, -errno, "TUNSETIFF failed on tun dev: %m"); if (netdev->kind == NETDEV_KIND_TAP) t = TAP(netdev); else t = TUN(netdev); assert(t); if(t->user_name) { user = t->user_name; r = get_user_creds(&user, &uid, NULL, NULL, NULL); if (r < 0) return log_netdev_error_errno(netdev, r, "Cannot resolve user name %s: %m", t->user_name); r = ioctl(fd, TUNSETOWNER, uid); if (r < 0) return log_netdev_error_errno(netdev, -errno, "TUNSETOWNER failed on tun dev: %m"); } if (t->group_name) { group = t->group_name; r = get_group_creds(&group, &gid); if (r < 0) return log_netdev_error_errno(netdev, r, "Cannot resolve group name %s: %m", t->group_name); r = ioctl(fd, TUNSETGROUP, gid); if (r < 0) return log_netdev_error_errno(netdev, -errno, "TUNSETGROUP failed on tun dev: %m"); } r = ioctl(fd, TUNSETPERSIST, 1); if (r < 0) return log_netdev_error_errno(netdev, -errno, "TUNSETPERSIST failed on tun dev: %m"); return 0; }
Expected<const CodeRegions &> AsmCodeRegionGenerator::parseCodeRegions() { MCTargetOptions Opts; Opts.PreserveAsmComments = false; MCStreamerWrapper Str(Ctx, Regions); // Create a MCAsmParser and setup the lexer to recognize llvm-mca ASM // comments. std::unique_ptr<MCAsmParser> Parser( createMCAsmParser(Regions.getSourceMgr(), Ctx, Str, MAI)); MCAsmLexer &Lexer = Parser->getLexer(); MCACommentConsumer CC(Regions); Lexer.setCommentConsumer(&CC); // Create a target-specific parser and perform the parse. std::unique_ptr<MCTargetAsmParser> TAP( TheTarget.createMCAsmParser(STI, *Parser, MCII, Opts)); if (!TAP) return make_error<StringError>( "This target does not support assembly parsing.", inconvertibleErrorCode()); Parser->setTargetParser(*TAP); Parser->Run(false); // Get the assembler dialect from the input. llvm-mca will use this as the // default dialect when printing reports. AssemblerDialect = Parser->getAssemblerDialect(); return Regions; }
int AssembleInput( const Target *TheTarget, SourceMgr &SrcMgr, MCContext &Ctx, MCStreamer &Str, MCAsmInfo &MAI, MCSubtargetInfo &STI, MCInstrInfo &MCII, MCTargetOptions &MCOptions ) { std::unique_ptr<MCAsmParser> Parser(createMCAsmParser(SrcMgr, Ctx, Str, MAI)); std::unique_ptr<MCTargetAsmParser> TAP(TheTarget->createMCAsmParser(STI, *Parser, MCII, MCOptions)); if (!TAP) { errs() << ": error: this target does not support assembly parsing.\n"; return 1; } Parser->setTargetParser(*TAP); // AsmParser::Run in lib/MC/MCParser/AsmParser.cpp /* first param is NoInitialTextSection by supplying false -> YES initial text section (we don't have to do .text) */ int Res = Parser->Run(false); return Res; }
/* Stereo in, stereo out */ static void o_delay_process_mix_s(delay_t *d, int *in, int *out, unsigned frames) { int *delaybuf = d->delaybuf; int inspos = d->inspos; int cl = d->cl; int cr = d->cr; unsigned s = frames; int outl, outr; int vm = d->level >> 8; int i; while(s--) { /* Feedback with LP filters */ cl += (TTAP(0) + TTAP(3) + TTAP(4) - cl) >> 3; cr += (TTAP(1) + TTAP(2) + TTAP(5) - cr) >> 3; DB(0) = cl; DB(1) = cr; /* "Tap 0" */ outl = cl; outr = cr; /* Taps */ for(i = 0; i < d->taps; i += 2) { outl += TAP(i); outr += TAP(i+1); } /* Input */ DB(0) += in[0]; DB(1) += in[1]; /* Output */ out[0] += (outl*vm)>>8; out[1] += (outr*vm)>>8; inspos += 2; in += 2; out += 2; } d->cl = cl; d->cr = cr; d->inspos = inspos; }
static void tuntap_done(NetDev *netdev) { TunTap *t = NULL; assert(netdev); if (netdev->kind == NETDEV_KIND_TUN) t = TUN(netdev); else t = TAP(netdev); assert(t); t->user_name = mfree(t->user_name); t->group_name = mfree(t->group_name); }
#include "actionmap.h" #include "action_code.h" /* bjartek atreus layout for norwegian keyboard * - all the mods are oneshot. see here for information about this. https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/doc/keymap.md * - layer one has norwegian special characters at AEO positions * - needs us mac keyboard layout */ const uint16_t PROGMEM actionmaps[][MATRIX_ROWS][MATRIX_COLS] = { KEYMAP( Q , W , E , R , T , Y , U , I , O , P , \ A , S , D , F , G , H , J , K , L , SCLN , \ Z , X , C , V , B , N , M , COMM , DOT , SLSH , \ ESC , OSM(RALT), OSM(LCTL), OSM(LSFT), TAP(1,BSPC), OSM(LGUI), OSM(LALT), TAP(2,SPC), TAP(3,TAB), MINS , QUOT , ENT ), KEYMAP( AGK(F7) , GUI(F12) , RA(QUOT) , ACK(R) , AGSK(L) , SH(6) , SH(LBRC) , SH(RBRC), RA(O) , SH(1) , \ RA(A) , GUI(LBRC), CSK(ENT) , GUI(RBRC), GSK(T) , 0 , SH(9) , SH(0) , SH(BSLS) , SH(4) , \ GSK(A) , GSK(F) , CTRL(T) , ALT(V) , GUI(F9) , GRAVE , LBRC , RBRC , SH(7) , SH(GRAVE), \ GA , OSM(RALT), OSM(LCTL), OSM(LSFT), TRNS , OSM(LGUI), OSM(LALT), CTRL(F2) , OFF(1) , SH(2) , QUOT , OSM(LGUI)), KEYMAP( INS , HOME , UP , END , PGUP , SH(5) , 7 , 8 , 9 , SH(8) , \ DEL , LEFT , DOWN , RIGHT , PGDN , MINS , 4 , 5 , 6 , SH(EQUAL), \ VOLU , MPRV , MPLY , MNXT , GCK(Q) , SH(4) , 1 , 2 , 3 , BSLS , \ VOLD , MUTE , OSM(LCTL), OSM(LSFT), CSK(SPC) , OSM(LGUI), OSM(LALT), TRNS , OFF(1) , DOT , 0 , KP_EQUAL), KEYMAP( F1 , F2 , F3 , F4 , F5 , WH_D , BTN1 , MS_U , BTN2 , SH(3) , \