/************************ * * hwt_stop * * Stop hardware timer. * * void hwt_stop( * struct s_smc *smc) ; * In * smc - A pointer to the SMT Context structure. * Out * Nothing. * ************************/ void hwt_stop(struct s_smc *smc) { outpw(ADDR(B2_TI_CRTL), TIM_STOP) ; outpw(ADDR(B2_TI_CRTL), TIM_CL_IRQ) ; smc->hw.timer_activ = FALSE ; }
void read_address(struct s_smc *smc, u_char *mac_addr) { char ConnectorType ; char PmdType ; int i ; #ifdef PCI for (i = 0; i < 6; i++) { /* read mac address from board */ smc->hw.fddi_phys_addr.a[i] = bitrev8(inp(ADDR(B2_MAC_0+i))); } #endif ConnectorType = inp(ADDR(B2_CONN_TYP)) ; PmdType = inp(ADDR(B2_PMD_TYP)) ; smc->y[PA].pmd_type[PMD_SK_CONN] = smc->y[PB].pmd_type[PMD_SK_CONN] = ConnectorType ; smc->y[PA].pmd_type[PMD_SK_PMD ] = smc->y[PB].pmd_type[PMD_SK_PMD ] = PmdType ; if (mac_addr) { for (i = 0; i < 6 ;i++) { smc->hw.fddi_canon_addr.a[i] = mac_addr[i] ; smc->hw.fddi_home_addr.a[i] = bitrev8(mac_addr[i]); } return ; } smc->hw.fddi_home_addr = smc->hw.fddi_phys_addr ; for (i = 0; i < 6 ;i++) { smc->hw.fddi_canon_addr.a[i] = bitrev8(smc->hw.fddi_phys_addr.a[i]); } }
/* i_igspill: spill node i, removing it from index j in interference graph g */ static void i_igspill (i_local_t i, i_local_t j, ig_t g) { SCLASS(i) = STACK; /* Update storage location */ if (TYPE(i) == I_B) ADDR(i) = v_localb(ADDR(i)); else ADDR(i) = v_local(TYPE(i)); i_igremove(j, g); /* Remove node i from integer IG */ }
JNIEXPORT jint JNICALL Java_au_notzed_jjmpeg_SwsContextNative_scaleByteArray (JNIEnv *env, jclass jc, jobject jptr, jobject jsrc, jint srcSliceY, jint srcSliceH, jintArray jdst, jint fmt, jint width, jint height) { struct SwsContext *sws = ADDR(jptr); struct AVFrame *src = ADDR(jsrc); return scaleArray(env, sws, src, srcSliceY, srcSliceH, jdst, 1, fmt, width, height); }
/** * @brief Checks access permissions to a memory area. * * @param addr Address to be checked. * @param size Size of memory area. * @param mask Access permissions mask. * * @returns Non-zero if access is authorized, and zero otherwise. */ PUBLIC int chkmem(const void *addr, size_t size, mode_t mask) { int ret; /* Return value. */ struct region *reg; /* Working memory region. */ struct pregion *preg; /* Working process region. */ /* Get associated process memory region. */ if ((preg = findreg(curr_proc, ADDR(addr))) == NULL) return (-1); lockreg(reg = preg->reg); /* Not allowed. */ if (!(accessreg(curr_proc, reg) & mask)) { unlockreg(reg); return (-1); } ret = withinreg(preg, ADDR(addr)); ret &= withinreg(preg, ADDR(addr) + size); unlockreg(reg); return (ret); }
VOID insa_icon(LONG tree, WORD obj, WORD nicon, ICONBLK *pic, BYTE *ptext) { memcpy(pic, &G.g_iblist[nicon], sizeof(ICONBLK)); pic->ib_ptext = ADDR( ptext ); LWSET(OB_TYPE(obj), G_ICON); LLSET(OB_SPEC(obj), ADDR(pic)); }
/*---------------------------------------------------------------------------* * USRobotics read register routine *---------------------------------------------------------------------------*/ static u_int8_t usrtai_read_reg(struct l1_softc *sc, int what, bus_size_t offs) { unsigned int base = 0; u_int8_t byte; USRTA_DEBUG(("usrtai_read_reg: what %d ADDR(%d) %d..", what, offs, ADDR(offs))) switch (what) { case ISIC_WHAT_ISAC: base = (unsigned int)ISAC_BASE; break; case ISIC_WHAT_HSCXA: base = (unsigned int)HSCX_A_BASE; break; case ISIC_WHAT_HSCXB: base = (unsigned int)HSCX_B_BASE; break; default: kprintf("usrtai_read_reg: invalid what %d\n", what); return(0); } byte = inb(base + ADDR(offs)); USRTA_DEBUG(("usrtai_read_reg: got %#x\n", byte)) return(byte); }
VOID ted_set(LONG taddr, BYTE *tmplt, BYTE *valid, BYTE *text) { WORD imap, itmp; if (!tmplt[0]) { tmplt[0] = '@'; LLSTRCPY(LLGET(TE_PVALID(taddr)), (LONG)ADDR(valid)); LLSTRCPY(LLGET(TE_PTEXT(taddr)), (LONG)ADDR(text)); if (!valid[0]) valid[0] = '@'; if (!text[0]) text[0] = '@'; } else { for (imap = itmp = 0; tmplt[itmp]; itmp++) if (tmplt[itmp] == '_') { tmplt[itmp] = '~'; valid[itmp] = LBGET(imap + LLGET(TE_PVALID(taddr))); text[itmp] = LBGET(imap + LLGET(TE_PTEXT(taddr))); imap++; } else valid[itmp] = text[itmp] = '~'; valid[itmp] = text[itmp] = '\0'; } }
JNIEXPORT void JNICALL Java_au_notzed_jjmpeg_AVPacketNative_setData (JNIEnv *env, jclass jc, jobject jptr, jobject jp, jint size) { AVPacket *packet = ADDR(jptr); uint8_t *p = ADDR(jp); packet->data = p; packet->size = size; }
VOID update_if(LONG taddr, BYTE *naddr) { if (!LLSTRCMP(LLGET(taddr), (LONG)ADDR(naddr))) { LLSET(taddr, get_mem( (UWORD) strlen(naddr)+1)); LLSTRCPY((LONG)ADDR(naddr), LLGET(taddr)); } }
void forker(void) { register FPD *f; register PD *oldrl; register LONG amt; FPD g; oldrl = rlr; rlr = (PD *) -1; while(fpcnt) { /* critical area */ cli(); fpcnt--; f = &D.g_fpdx[fph++]; /* copy FPD so an interrupt */ /* doesn't overwrite it. */ LBCOPY(ADDR(&g), ADDR(f), sizeof(FPD) ); if (fph == NFORKS) fph = 0; sti(); /* */ /* see if recording */ if (gl_recd) { /* check for stop key */ if ( ((void *)g.f_code == (void *)kchange) && ((g.f_data & 0x0000ffffL) == KEYSTOP) ) gl_recd = FALSE; /* if still recording */ /* then handle event */ if (gl_recd) { /* if its a time event &*/ /* previously recorded*/ /* was a time event */ /* then coalesce them */ /* else record the */ /* event */ if ( ((void *)g.f_code == (void *)tchange) && (LLGET(gl_rbuf - sizeof(FPD)) == (LONG)tchange) ) { amt = g.f_data + LLGET(gl_rbuf-sizeof(LONG)); LLSET(gl_rbuf - sizeof(LONG), amt); } else { LBCOPY(gl_rbuf, ADDR(f), sizeof(FPD)); gl_rbuf += sizeof(FPD); gl_rlen--; gl_recd = gl_rlen; } } } (*g.f_code)(g.f_data); } rlr = oldrl; }
/* ** 函数功能:SCL_EN引脚输出电平 ** 输入参数:a=HIGH 输出高电平, a=LOW 输出低电平 ** 输出参数:无 ** 返回值:无 ** 备注: */ void tx_scl_en(unsigned char a) { gpio_data = SCL_EN; if(a == HIGH){ iowrite32(gpio_data, ADDR(gpio_reg, gpio_t, set_data23)); }else{ iowrite32(gpio_data, ADDR(gpio_reg, gpio_t, clr_data23)); } }
static void pumpOn(UArm *uarm) { if(FALSE == uarm->status.pump) { Xil_Out32(ADDR(PUMP_EN),LOW); Xil_Out32(ADDR(VALVE_EN),HIGH); uarm->status.pump = TRUE; } }
JNIEXPORT jint JNICALL Java_au_notzed_jjmpeg_AVCodecContextNativeAbstract_open2 (JNIEnv *env, jclass jc, jobject jptr, jobject jcodec, jobject options) { AVCodecContext *cptr = ADDR(jptr); AVCodec * codec = ADDR(jcodec); AVDictionary *opts = ADDR(options); jint res = (*davcodec_open2)(cptr, codec, &opts); return res; }
// this rescale_q takes pointer arguments JNIEXPORT jlong JNICALL Java_au_notzed_jjmpeg_AVRationalNative_jjRescaleQ (JNIEnv *env, jclass jc, jlong ja, jobject jbq, jobject jcq) { AVRational *bqp = ADDR(jbq); AVRational *cqp = ADDR(jcq); jlong res; res = CALLDL(av_rescale_q)(ja, *bqp, *cqp); return res; }
/* ** 函数功能:设置SDA引脚方向,输入/输出 ** 输入参数:dir=IN 输入, dir=OUT 输出 ** 输出参数:无 ** 返回值:无 ** 备注: */ void set_dir_sda(int dir) { gpio_data = ioread32(ADDR(gpio_reg, gpio_t, dir01)); if(dir == OUT){ gpio_data &= ~SDA; }else{ gpio_data |= SDA; } iowrite32(gpio_data, ADDR(gpio_reg, gpio_t,dir01)); }
/* ** 函数功能:设置SCL_EN引脚方向,输入/输出 ** 输入参数:dir=IN 输入, dir=OUT 输出 ** 输出参数:无 ** 返回值:无 ** 备注: */ void set_dir_scl_en(int dir) { gpio_data = ioread32(ADDR(gpio_reg, gpio_t, dir23)); if(dir == OUT){ gpio_data &= ~SCL_EN; }else{ gpio_data |= SCL_EN; } iowrite32(gpio_data, ADDR(gpio_reg, gpio_t,dir23)); }
JNIEXPORT void JNICALL Java_au_notzed_jjmpeg_AVFormatContextNative_open (JNIEnv *env, jclass jc, jobject jptr, jstring jfilename, jobject jfmt, jobject options) { AVFormatContext *cptr = ADDR(jptr); const char * filename = STR(jfilename); AVInputFormat * fmt = ADDR(jfmt); AVDictionary * opts = ADDR(jptr); CALLDL(avformat_open_input)(&cptr, filename, fmt, &opts); RSTR(jfilename, filename); }
/* ** Drop a trigger given a pointer to that trigger. */ void sqlite3DropTriggerPtr(Parse *pParse, Trigger *pTrigger){ Table *pTable; Vdbe *v; sqlite3 *db = pParse->db; int iDb; iDb = sqlite3SchemaToIndex(pParse->db, pTrigger->pSchema); assert( iDb>=0 && iDb<db->nDb ); pTable = tableOfTrigger(pTrigger); assert( pTable ); assert( pTable->pSchema==pTrigger->pSchema || iDb==1 ); #ifndef SQLITE_OMIT_AUTHORIZATION { int code = SQLITE_DROP_TRIGGER; const char *zDb = db->aDb[iDb].zName; const char *zTab = SCHEMA_TABLE(iDb); if( iDb==1 ) code = SQLITE_DROP_TEMP_TRIGGER; if( sqlite3AuthCheck(pParse, code, pTrigger->zName, pTable->zName, zDb) || sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){ return; } } #endif /* Generate code to destroy the database record of the trigger. */ assert( pTable!=0 ); if( (v = sqlite3GetVdbe(pParse))!=0 ){ int base; static const int iLn = VDBE_OFFSET_LINENO(2); static const VdbeOpList dropTrigger[] = { { OP_Rewind, 0, ADDR(9), 0}, { OP_String8, 0, 1, 0}, /* 1 */ { OP_Column, 0, 1, 2}, { OP_Ne, 2, ADDR(8), 1}, { OP_String8, 0, 1, 0}, /* 4: "trigger" */ { OP_Column, 0, 0, 2}, { OP_Ne, 2, ADDR(8), 1}, { OP_Delete, 0, 0, 0}, { OP_Next, 0, ADDR(1), 0}, /* 8 */ }; sqlite3BeginWriteOperation(pParse, 0, iDb); sqlite3OpenMasterTable(pParse, iDb); base = sqlite3VdbeAddOpList(v, ArraySize(dropTrigger), dropTrigger, iLn); sqlite3VdbeChangeP4(v, base+1, pTrigger->zName, P4_TRANSIENT); sqlite3VdbeChangeP4(v, base+4, "trigger", P4_STATIC); sqlite3ChangeCookie(pParse, iDb); sqlite3VdbeAddOp2(v, OP_Close, 0, 0); sqlite3VdbeAddOp4(v, OP_DropTrigger, iDb, 0, 0, pTrigger->zName, 0); if( pParse->nMem<3 ){ pParse->nMem = 3; } } }
/* ** 函数功能:SCL引脚输出电平 ** 输入参数:a=HIGH 输出高电平, a=LOW 输出低电平 ** 输出参数:无 ** 返回值:无 ** 备注: */ void tx_scl(unsigned char a) { tx_scl_en(HIGH);// 使能CPLD中SCL的方向,ARM->LASER set_dir_scl(OUT); gpio_data = SCL; if(a == HIGH){ iowrite32(gpio_data, ADDR(gpio_reg, gpio_t, set_data01)); }else{ iowrite32(gpio_data, ADDR(gpio_reg, gpio_t, clr_data01)); } }
VOID spol_file(BYTE *fname, WORD tabexp, WORD prntr) { spol_path = (LONG)ADDR(fname); spol_pbuf = (LONG)ADDR( spol_bufr ); spol_prn = prntr; spol_sts = FALSE; spol_cntr = 0; spol_fcnt = 0; spol_texp = tabexp; spol_tcnt = 0; spol_gblk(); }
WORD file_exists(BYTE *dir, BYTE *name) { BYTE f_name[80]; strcpy( dir, f_name ); strcat( f_name, name ); #if GEMDOS return( Fsfirst( ADDR(f_name), 0 ) ); #else return( dos_sfirst( ADDR(f_name), 0 ) ); #endif }
int main() { START_MACHINE; void print_heap(){ int i; printf("printing heap\n"); for (i=ADDR(0); i>=0; i--){ printf("\t element %d: ", i); SHOW(" ",ADDR(i)); } }
VOID hndl_spbut(WORD ob) { BYTE *pstr; WORD isok; WORD i, j, k, remvd_1st, isgrafic; WORD exists; BYTE dir[ 80 ]; BYTE new_wc[ 14 ]; BYTE new_file[ 14 ]; BYTE dir_wc[ 80 ]; if ( ob == ADDNAME ) { strcpy(&gl_fname[0], ""); fsel_input(ADDR(&gl_fspec[0]), ADDR(&gl_fname[0]), &isok); strcpy( dir_wc, gl_fspec ); strcpy( new_file, gl_fname ); splt_dir( dir_wc, dir, new_wc ); exists = file_exists( dir, new_file ); if ( exists ) { if ( (isok) && (gl_fname[0]) && (gl_fspec[0]) ) { strcpy(&gl_fspol[0], &gl_fspec[0]); pstr = &gl_fspol[0]; while (*pstr) pstr++; pstr--; while ( (*pstr) && (*pstr != '\\') && (*pstr != ':') ) pstr--; if (*pstr) pstr++; strcpy(pstr, &gl_fname[0]); if ( istext( &gl_fname[0] ) ) hndl_spmsg((WORD)strlen(&gl_fspol[0]), (LONG)ADDR(&gl_fspol[0]), 1, FALSE, 0); else { form_alert(1, ADDR("[1][The Print Spooler is only able to|\ directly print text files. If you wish|\ to print a graphic file in background,|\ go to the OUTPUT application, and select|\ the Print in Background option.][ OK ]") ); } } }
void sqliteDropProc(Parse *pParse, Token *pName){ Object *pObj; char *zName; Vdbe *v = sqliteGetVdbe(pParse); sqlite *db = pParse->db; zName = sqliteStrNDup(pName->z, pName->n); sqliteDequote(zName); pObj = sqliteHashFind(&(db->aDb[0].objectHash), zName, pName->n+1); if( !pParse->explain && !pObj ){ sqliteErrorMsg(pParse, "no such object: %T", pName); goto dropobject_cleanup; } /* Generate code to destroy the database record of the trigger. */ if( v ){ int base; static VdbeOpList dropObject[] = { { OP_Rewind, 0, ADDR(9), 0}, { OP_String, 0, 0, 0}, /* 1 */ { OP_Column, 0, 1, 0}, { OP_Ne, 0, ADDR(8), 0}, { OP_String, 0, 0, "procedure"}, { OP_Column, 0, 0, 0}, { OP_Ne, 0, ADDR(8), 0}, { OP_Delete, 0, 0, 0}, { OP_Next, 0, ADDR(1), 0}, /* 8 */ }; sqliteBeginWriteOperation(pParse, 0, 0); sqliteOpenMasterTable(v, 0); base = sqliteVdbeAddOpList(v, ArraySize(dropObject), dropObject); sqliteVdbeChangeP3(v, base+1, zName, 0); if( pObj && pObj->iDb==0 ){ sqliteChangeCookie(db, v); } sqliteVdbeAddOp(v, OP_Close, 0, 0); sqliteEndWriteOperation(pParse); } /* * If this is not an "explain", then delete the trigger structure. */ if( !pParse->explain ){ sqliteHashInsert(&(db->aDb[pObj->iDb].objectHash), zName, pName->n+1, 0); sqliteDeleteObject(pObj); } dropobject_cleanup: sqliteFree(zName); }
R_API int r_anal_fcn_label_set (RAnal *anal, RAnalFunction *fcn, const char *name, ut64 addr) { if (!anal || !fcn) return R_FALSE; if (sdb_add (DB, ADDR(addr), name, 0)) { if (sdb_num_add (DB, LABEL(name), addr, 0)) { sdb_array_add (DB, LABELS, ADDRLABEL (addr, name), 0); return R_TRUE; } else { sdb_unset (DB, ADDR(addr), 0); } } return R_FALSE; }
JNIEXPORT jint JNICALL Java_au_notzed_jjmpeg_SwsContextNative_scale (JNIEnv *env, jclass jc, jobject jptr, jobject jsrc, jint srcSliceY, jint srcSliceH, jobject jdst) { struct SwsContext *sws = ADDR(jptr); struct AVFrame *src = ADDR(jsrc); struct AVFrame *dst = ADDR(jdst); jint res; res = CALLDL(sws_scale)(sws, (const uint8_t * const *)src->data, src->linesize, srcSliceY, srcSliceH, dst->data, dst->linesize); return res; }
int main() { START_MACHINE; /* test functions section */ void print_heap(){ int i; printf("\n"); printf("printing heap\n"); for (i=ADDR(0); i>=0; i--){ printf("\t element %d: %d\n", i, ADDR(i)); } }
/* ** Drop a trigger given a pointer to that trigger. If nested is false, ** then also generate code to remove the trigger from the SQLITE_MASTER ** table. */ void sqlite3DropTriggerPtr(Parse *pParse, Trigger *pTrigger, int nested){ Table *pTable; Vdbe *v; sqlite3 *db = pParse->db; int iDb; iDb = pTrigger->iDb; assert( iDb>=0 && iDb<db->nDb ); pTable = tableOfTrigger(db, pTrigger); assert(pTable); assert( pTable->iDb==iDb || iDb==1 ); #ifndef SQLITE_OMIT_AUTHORIZATION { int code = SQLITE_DROP_TRIGGER; const char *zDb = db->aDb[iDb].zName; const char *zTab = SCHEMA_TABLE(iDb); if( iDb==1 ) code = SQLITE_DROP_TEMP_TRIGGER; if( sqlite3AuthCheck(pParse, code, pTrigger->name, pTable->zName, zDb) || sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){ return; } } #endif /* Generate code to destroy the database record of the trigger. */ if( pTable!=0 && (v = sqlite3GetVdbe(pParse))!=0 ){ int base; static const VdbeOpList dropTrigger[] = { { OP_Rewind, 0, ADDR(9), 0}, { OP_String8, 0, 0, 0}, /* 1 */ { OP_Column, 0, 1, 0}, { OP_Ne, 0, ADDR(8), 0}, { OP_String8, 0, 0, "trigger"}, { OP_Column, 0, 0, 0}, { OP_Ne, 0, ADDR(8), 0}, { OP_Delete, 0, 0, 0}, { OP_Next, 0, ADDR(1), 0}, /* 8 */ }; sqlite3BeginWriteOperation(pParse, 0, iDb); sqlite3OpenMasterTable(v, iDb); base = sqlite3VdbeAddOpList(v, ArraySize(dropTrigger), dropTrigger); sqlite3VdbeChangeP3(v, base+1, pTrigger->name, 0); sqlite3ChangeCookie(db, v, iDb); sqlite3VdbeAddOp(v, OP_Close, 0, 0); sqlite3VdbeOp3(v, OP_DropTrigger, iDb, 0, pTrigger->name, 0); } }
/* * replacement of malloc */ extern void * xmalloc (unsigned int size, char * file, unsigned int line) { char * raw_addr = malloc (size + (2 * sizeof(int))); char * user_addr; MEM_INFO * curr = NULL; if (raw_addr == NULL) { fprintf (stderr, "ERROR: malloc failed for %d bytes (%s, line %d)\n", size, file, line); return (NULL); } else { user_addr = ADDR (raw_addr, sizeof (int)); SET_MAGIC_CODE (raw_addr, 0); SET_MAGIC_CODE (user_addr, size); curr = (MEM_INFO *) malloc (sizeof(MEM_INFO)); curr->addr = user_addr; curr->size = size; curr->file = file; curr->line = line; curr->next = head; head = curr; } return ((void *) user_addr); }