// Set the 4 digits Int value void SEVENSEGHW::setIntValue(unsigned int value, unsigned int pos_dot) { REGISTER( IO_SLOT(wishboneSlot), 7 ) = int_to_7seg( value %10) | (pos_dot==4 ? 0x80:0x00); REGISTER( IO_SLOT(wishboneSlot), 6 ) = int_to_7seg((value/10 )%10) | (pos_dot==3 ? 0x80:0x00); REGISTER( IO_SLOT(wishboneSlot), 5 ) = int_to_7seg((value/100 )%10) | (pos_dot==2 ? 0x80:0x00); REGISTER( IO_SLOT(wishboneSlot), 4 ) = int_to_7seg((value/1000)%10) | (pos_dot==1 ? 0x80:0x00); }
// Set 16 bits Hex value void SEVENSEGHW::setHexValue(unsigned int value) { REGISTER( IO_SLOT(wishboneSlot), 7 ) = int_to_7seg( value %16) ; REGISTER( IO_SLOT(wishboneSlot), 6 ) = int_to_7seg((value/16 )%16) ; REGISTER( IO_SLOT(wishboneSlot), 5 ) = int_to_7seg((value/(16*16) )%16) ; REGISTER( IO_SLOT(wishboneSlot), 4 ) = int_to_7seg((value/(16*16*16))%16) ; }
int ompt_initialize(ompt_function_lookup_t lookup, const char *runtime_version, int ompt_version) { printf("Init: %s ver %i\n",runtime_version,ompt_version); LOOKUP(lookup,ompt_get_parallel_id); LOOKUP(lookup,ompt_set_callback); REGISTER(ompt_event_parallel_begin); REGISTER(ompt_event_parallel_end); return 1; }
NS_IMETHODIMP nsMemoryReporterManager::Init() { #if HAVE_JEMALLOC_STATS && defined(XP_LINUX) if (!jemalloc_stats) return NS_ERROR_FAILURE; #endif #define REGISTER(_x) RegisterReporter(new NS_MEMORY_REPORTER_NAME(_x)) REGISTER(HeapUsed); REGISTER(HeapUnused); REGISTER(Resident); #if defined(XP_LINUX) || defined(XP_MACOSX) REGISTER(Vsize); #elif defined(XP_WIN) && MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN REGISTER(Private); #endif #if defined(HAVE_JEMALLOC_STATS) REGISTER(HeapCommitted); REGISTER(HeapDirty); #elif defined(XP_MACOSX) && !defined(MOZ_MEMORY) REGISTER(HeapZone0Committed); REGISTER(HeapZone0Used); #endif return NS_OK; }
void Pigeon_init(void *_self) { if (!_self) return; Pigeon *self = _self; INIT(Entity, self->parent); // init super class INIT_ENT("pigeon", Pigeon, self); INIT(TransformComponent, self->transform_cmp); INIT(PhysicsComponent, self->physics_cmp); INIT(RenderComponent, self->render_cmp); /* Register Each Component To Itself */ /* Extra Components Can Be Added Externally */ REGISTER(self->parent, Component, self->transform_cmp); REGISTER(self->parent, Component, self->physics_cmp); REGISTER(self->parent, Component, self->render_cmp); sprintf(self->render_cmp.image_filename, "%s", "./res/images/Pigeon64x32.png"); self->render_cmp.src_rect.w = 64; self->render_cmp.src_rect.h = 32; self->render_cmp.src_rect.x=0; self->render_cmp.src_rect.y=0; self->render_cmp.src_rect.w=64; self->render_cmp.src_rect.h=32; self->render_cmp.dst_rect.x=0; self->render_cmp.dst_rect.y=0; self->render_cmp.dst_rect.w=64; self->render_cmp.dst_rect.h=32; self->transform_cmp.x = 320; /* // Iterate through components_list Component *cmp = NULL; GSList *iterator = NULL; for (iterator = self->component_list; iterator; iterator = iterator->next) { cmp = iterator->data; _INFO("%s", cmp->component_type); } */ }
CUiWindowFactory() { REGISTER(IUiWindow, CUiButton, "button"); REGISTER(IUiWindow, CUiCheck, "check"); REGISTER(IUiWindow, CUiEdit, "edit"); REGISTER(IUiWindow, CUiImage, "image"); REGISTER(IUiWindow, CUiList, "list"); // REGISTER(IUiWindow, CUiScene, "scene"); REGISTER(IUiWindow, CUiProgress, "progress"); REGISTER(IUiWindow, CUiSlider, "slider"); REGISTER(IUiWindow, CUiText, "text"); REGISTER(IUiWindow, CUiTooltip, "tooltip"); REGISTER(IUiWindow, CUiWindowBase, "window"); };
static int null_init(void) { dprintk("%s(%p)\n", __FUNCTION__, null_init); memset(&nulldev, 0, sizeof(nulldev)); softc_device_init(&nulldev, "ocfnull", 0, null_methods); null_id = crypto_get_driverid(softc_get_device(&nulldev), CRYPTOCAP_F_HARDWARE); if (null_id < 0) panic("ocfnull: crypto device cannot initialize!"); #define REGISTER(alg) \ crypto_register(null_id,alg,0,0) REGISTER(CRYPTO_DES_CBC); REGISTER(CRYPTO_3DES_CBC); REGISTER(CRYPTO_RIJNDAEL128_CBC); REGISTER(CRYPTO_MD5); REGISTER(CRYPTO_SHA1); REGISTER(CRYPTO_MD5_HMAC); REGISTER(CRYPTO_SHA1_HMAC); #undef REGISTER return 0; }
// Get Dot position unsigned int SEVENSEGHW::getDotPosition() { if ((REGISTER( IO_SLOT(wishboneSlot), 7 ) & 0x80) == 0x80) { return 1; } else if ((REGISTER( IO_SLOT(wishboneSlot), 6 ) & 0x80) == 0x80) { return 2; } else if ((REGISTER( IO_SLOT(wishboneSlot), 5 ) & 0x80) == 0x80) { return 3; } else if ((REGISTER( IO_SLOT(wishboneSlot), 4 ) & 0x80) == 0x80) { return 4; } return 0; }
void Entity_registerComponent(void *_self, Component *component) { if (!_self) return; Entity *self = _self; self->component_list = g_slist_append(self->component_list, component); REGISTER(*component, Entity, *self) _INFO("Added %s to %s's Component list", component->component_type, self->entity_type); }
void SceneManager_init(void *_self) { if (!_self) return; SceneManager *self = _self; INIT(Manager, self->parent); // init superclass INIT_MAN("scenemanager", SceneManager, self); // assign function pointers self->registerApp = SceneManager_registerApp; INIT(EventSubsystem, self->event_ssys); INIT(MovementSubsystem, self->move_ssys); REGISTER(self->parent, Subsystem, self->event_ssys); REGISTER(self->parent, Subsystem, self->move_ssys); _INFO("Initialized %s", self->manager_type); }
RecordingStatus::Enum assign_record(Thread & thread, Instruction const & inst, Instruction const ** pc) { *pc = assign_op(thread,inst); Value& r = REGISTER(thread, inst.c); //Inline this logic here would make the recorder more fragile, // so for now we simply construct the pointer again: if(r.isFuture()) { thread.trace.outputs.push_back(thread.frame.environment->makePointer((String)inst.a)); thread.trace.Commit(thread); } //thread.trace.SetMaxLiveRegister(thread.base,inst.c); return RecordingStatus::NO_ERROR; }
int DeviceRegistry::getPPSPin(int masterslot, int offset, int shift) { unsigned count = REGISTER(SYSCTLBASE, 32+shift); //unsigned i; register_t startreg = ®ISTER(SYSCTLBASE, 64); //for (i=0;i<count;i++) { while(count--) { unsigned val = *startreg++;//REGISTER(SYSCTLBASE, 64+i); unsigned char dev = (val>>shift)&0xff; if (dev!=masterslot) { continue; } else { int pin = (val>>(8+shift))&0xff; if (offset==0) return pin; offset--; } } return -1; }
int main() { REGISTER(RA); REGISTER(RB); REGISTER(RC); int a, b; printf("Numbers A, B:\n"); scanf("%i %i", &a, &b); store(RA, a); store(RB, b); add(RA, RB, RC); printf("\n\n"); dump(RA); dump(RB); printf("--------------------\n"); dump(RC); return 0; }
static uint32_t spiRec32(uint8_t wishboneSlot) { spiSend(0XFF); spiSend(0XFF); spiSend(0XFF); spiSend(0XFF); // Serial.print(USPIDATA&0xff); // Serial.print(" "); //return USPIDATA&0xff; //return USPIDATA; //return SPI.transfer32(0xFFFFFFFF); //REGISTER(IO_SLOT(12),5) = 0xFFFFFFFF; return REGISTER(IO_SLOT(wishboneSlot),1); //return SPI.transfer32(0xFFFFFFFF); }
CachedReadAccessorUnitTest(bool keep_temp_bundle) : BaseClass("CachedReadAccessorUnitTest"), keep_temp_bundle_(keep_temp_bundle) { REGISTER(TestCacheBlockAddress); REGISTER(TestCacheBlock); REGISTER(TestCachedReadAccessorBasics); REGISTER(TestCachedReadAccessorPread); REGISTER(TestCachedReadAccessorPreadPerformance); // Create a temporary test segment. // WARNING: this directory will be deleted on exit! segment_size_ = 100 * 1024 * 1024; file_bundle_size_ = segment_size_ / 3; path_base_ = "/tmp/tests/cachedreadaccessor_unittest_data/"; test_buffer_ = new char[file_bundle_size_]; char next_char = 0; for(uint32 i = 0; i < file_bundle_size_; ++i) { test_buffer_[i] = next_char++; } bundle_name_ = path_base_ + "TestBasics"; if (khDirExists(path_base_)) { khPruneDir(path_base_); } CreateTestBundle(); }
void via_padlock_attach(void) { #define VIA_ACE (CPUID_VIA_HAS_ACE|CPUID_VIA_DO_ACE) if ((cpu_feature_padlock & VIA_ACE) != VIA_ACE) return; struct via_padlock_softc *vp_sc; if ((vp_sc = malloc(sizeof(*vp_sc), M_DEVBUF, M_NOWAIT)) == NULL) return; memset(vp_sc, 0, sizeof(*vp_sc)); vp_sc->sc_cid = crypto_get_driverid(0); if (vp_sc->sc_cid < 0) { printf("PadLock: Could not get a crypto driver ID\n"); free(vp_sc, M_DEVBUF); return; } /* * Ask the opencrypto subsystem to register ourselves. Although * we don't support hardware offloading for various HMAC algorithms, * we will handle them, because opencrypto prefers drivers that * support all requested algorithms. */ #define REGISTER(alg) \ crypto_register(vp_sc->sc_cid, alg, 0, 0, \ via_padlock_crypto_newsession, via_padlock_crypto_freesession, \ via_padlock_crypto_process, vp_sc); REGISTER(CRYPTO_AES_CBC); REGISTER(CRYPTO_MD5_HMAC_96); REGISTER(CRYPTO_MD5_HMAC); REGISTER(CRYPTO_SHA1_HMAC_96); REGISTER(CRYPTO_SHA1_HMAC); REGISTER(CRYPTO_RIPEMD160_HMAC_96); REGISTER(CRYPTO_RIPEMD160_HMAC); REGISTER(CRYPTO_SHA2_HMAC); printf("PadLock: registered support for AES_CBC\n"); }
//------------------------------------------------------------------------------ //! void initialize() { #define REGISTER( sTypeVar, str, type ) \ sTypeVar = str; \ Stimulus::registerStimulus( sTypeVar, create<Stimulus,type> ) REGISTER( _sType_ActionCompleted, "actionCompleted", ActionCompleted ); REGISTER( _sType_Begin , "begin" , BeginStimulus ); REGISTER( _sType_ContactBegin , "contactBegin" , ContactBeginStimulus ); REGISTER( _sType_ContactEnd , "contactEnd" , ContactEndStimulus ); REGISTER( _sType_Fall , "fall" , FallStimulus ); REGISTER( _sType_Land , "land" , LandStimulus ); #undef REGISTER }
void settings_init() { memset(setting_data, 0, sizeof(void*) * MAX_KEY); REGISTER(TRIGGER_KEY, hotkey_t, __hotkey_enc, __hotkey_dec); REGISTER(ENG_KEY, hotkey_t, __hotkey_enc, __hotkey_dec); REGISTER(ICBAR_POS, position_t, __position_enc, __position_dec); REGISTER(PREEDIT_OPACITY, double, __double_enc, __double_dec); REGISTER(PREEDIT_COLOR, varchar, __varchar_enc, __varchar_dec); REGISTER(PREEDIT_FONT, varchar, __varchar_enc, __varchar_dec); REGISTER(PREEDIT_FONT_COLOR, varchar, __varchar_enc, __varchar_dec); REGISTER(CANDIDATES_SIZE, int, __int_enc, __int_dec); __init_default_values(); }
int main(int argc, gchar **argv) { BenchmarkData data; BenchReporter *reporter; gint n = 1000; grn_init(); bench_init(&argc, &argv); data.report_result = g_getenv("GROONGA_BENCH_REPORT_RESULT") != NULL; data.context = g_new(grn_ctx, 1); { const gchar *groonga_bench_n; groonga_bench_n = g_getenv("GROONGA_BENCH_N"); if (groonga_bench_n) { n = atoi(groonga_bench_n); } } reporter = bench_reporter_new(); #define REGISTER(label, setup) \ bench_reporter_register(reporter, label, n, \ bench_setup_ ## setup, \ bench_geo_distance, \ bench_teardown, \ &data) REGISTER("rectangular (WGS84)", rectangular_wgs84); REGISTER("rectangular (TOKYO)", rectangular_tgs); REGISTER("spherical (WGS84)", spherical_wgs84); REGISTER("spherical (TOKYO)", spherical_tgs); REGISTER("hubeny (WGS84)", hubeny_wgs84); REGISTER("hubeny (TOKYO)", hubeny_tgs); #undef REGISTER bench_reporter_run(reporter); g_object_unref(reporter); g_free(data.context); bench_quit(); grn_fin(); return 0; }
static int null_init(void) { dprintk("%s(%p)\n", __FUNCTION__, null_init); null_id = crypto_get_driverid(0); if (null_id < 0) panic("ocfnull: crypto device cannot initialize!"); crypto_register(null_id, CRYPTO_DES_CBC, 0, 0, null_newsession, null_freesession, null_process, NULL); #define REGISTER(alg) \ crypto_register(null_id,alg,0,0,NULL,NULL,NULL,NULL) REGISTER(CRYPTO_3DES_CBC); REGISTER(CRYPTO_RIJNDAEL128_CBC); REGISTER(CRYPTO_MD5); REGISTER(CRYPTO_SHA1); REGISTER(CRYPTO_MD5_HMAC); REGISTER(CRYPTO_SHA1_HMAC); #undef REGISTER return 0; }
// DalvikVM calls this on startup, so we can statically register all our native methods. jint JNI_OnLoad(JavaVM* vm, void*) { JNIEnv* env; if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) { ALOGE("JavaVM::GetEnv() failed"); abort(); } ScopedLocalFrame localFrame(env); #define REGISTER(FN) extern void FN(JNIEnv*); FN(env) REGISTER(register_android_system_OsConstants); // REGISTER(register_java_lang_StringToReal); REGISTER(register_java_lang_invoke_MethodHandle); REGISTER(register_java_math_NativeBN); REGISTER(register_java_util_regex_Matcher); REGISTER(register_java_util_regex_Pattern); REGISTER(register_libcore_icu_ICU); REGISTER(register_libcore_icu_NativeConverter); REGISTER(register_libcore_icu_TimeZoneNames); REGISTER(register_libcore_io_AsynchronousCloseMonitor); REGISTER(register_libcore_io_Memory); REGISTER(register_libcore_io_Posix); REGISTER(register_libcore_util_NativeAllocationRegistry); REGISTER(register_org_apache_harmony_dalvik_NativeTestTarget); REGISTER(register_org_apache_harmony_xml_ExpatParser); REGISTER(register_sun_misc_Unsafe); #undef REGISTER return JNI_VERSION_1_6; }
void render_camera_init(render_camera_t *camera, int threads) { camera->type = RENDER_CAMERA_PERSPECTIVE; camera->view_num = 1; camera->view_list = (render_camera_view_t *) bu_malloc (sizeof(render_camera_view_t), "render_camera_init"); camera->dof = 0; camera->tilt = 0; /* The camera will use a thread for every cpu the machine has. */ camera->thread_num = threads ? threads : (uint8_t)bu_avail_cpus(); bu_semaphore_init(TIE_SEM_LAST); /* Initialize camera to rendering surface normals */ render_normal_init(&camera->render, NULL); camera->rm = RENDER_METHOD_PHONG; if (shaders == NULL) { #define REGISTER(x) render_shader_register((const char *)#x, render_##x##_init); REGISTER(component); REGISTER(cut); REGISTER(depth); REGISTER(flat); REGISTER(flos); REGISTER(grid); REGISTER(normal); REGISTER(path); REGISTER(phong); REGISTER(spall); REGISTER(surfel); #undef REGISTER } }
void ZPUino_2::writeLEDs(unsigned long value) { REGISTER(IO_SLOT(wishboneSlot),0) = value; }
unsigned long ZPUino_2::readButtons() { return REGISTER(IO_SLOT(wishboneSlot),1); }
// waits until swap is complete before returning void SmartMatrix::apply(void) { uint8_t r,g,b,brightness; uint16_t temp0red,temp0green,temp0blue,temp1red,temp1green,temp1blue; bool bHasForeground = hasForeground; bool bHasCC = SmartMatrix::_ccmode != ccNone; int x,y; unsigned offset = 32*128; unsigned soff = offset; rgb24 *pix = ¤tDrawBufferPtr[0][0]; rgb24 tempPixel0; for (y=0;y<MATRIX_HEIGHT;y++) { for (x=0;x<MATRIX_WIDTH;x++) { brightness = dimmingFactor; /* if (bHasForeground && getForegroundPixel(x, y, &tempPixel0)) { if(bHasCC) { // load foreground pixel with color correction r = colorCorrection(tempPixel0.red); g = colorCorrection(tempPixel0.green); b = colorCorrection(tempPixel0.blue); } else { // load foreground pixel without color correction r = tempPixel0.red; g = tempPixel0.green; b = tempPixel0.blue; } } else { if(bHasCC) { // load background pixel with color correction r = backgroundColorCorrection(pix->red); g = backgroundColorCorrection(pix->green); b = backgroundColorCorrection(pix->blue); } else { // load background pixel without color correction r = pix->red; g = pix->green; b = pix->blue; } } */ if (bHasForeground && getForegroundPixel(x, y, &tempPixel0)) { r = tempPixel0.red; g = tempPixel0.green; b = tempPixel0.blue; } else { r = pix->red; g = pix->green; b = pix->blue; } r = ((unsigned)r * brightness)>>8; g = ((unsigned)g * brightness)>>8; b = ((unsigned)b * brightness)>>8; unsigned v = ((unsigned)r<<16) + ((unsigned)g<<8) + ((unsigned)b); REGISTER(IO_SLOT(9),soff + x) = v; pix++; } soff+=128; handleBufferSwap(); handleForegroundDrawingCopy(); calculateBackgroundLUT(); updateForeground(); } }
uint16_t parse_operand(debugger_state_t *state, const char *start, const char **end) { if (*start >= '0' && *start <= '9') { return strtol(start, (char **)end, 0); } else { #define REGISTER(num, len, print) \ if (strncasecmp(start, print, len) == 0) {\ *end += len; \ return state->asic->cpu->registers. num; \ } REGISTER(IXH, 3, "IXH"); REGISTER(IXL, 3, "IXL"); REGISTER(IYH, 3, "IYH"); REGISTER(IYL, 3, "IYL"); REGISTER(_BC, 3, "BC'"); REGISTER(_DE, 3, "DE'"); REGISTER(_HL, 3, "HL'"); REGISTER(_AF, 3, "AF'"); REGISTER(IX, 2, "IX"); REGISTER(IY, 2, "IY"); REGISTER(AF, 2, "AF"); REGISTER(BC, 2, "BC"); REGISTER(DE, 2, "DE"); REGISTER(HL, 2, "HL"); REGISTER(PC, 2, "PC"); REGISTER(SP, 2, "SP"); REGISTER(A, 1, "A"); REGISTER(B, 1, "B"); REGISTER(C, 1, "C"); REGISTER(D, 1, "D"); REGISTER(E, 1, "E"); REGISTER(F, 1, "F"); REGISTER(H, 1, "H"); REGISTER(L, 1, "L"); REGISTER(I, 1, "I"); REGISTER(R, 1, "R"); state->print(state, "ERROR: Unknown register/number!\n"); while(!strchr("+-*/(){} \n", *start)) { start++; } *end = 0; return 0; } }
static void psb_upload_fw(struct drm_psb_private *dev_priv, uint32_t address, const unsigned int words, int fw_sel) { uint32_t reg_val=0; uint32_t cmd; uint32_t uCountReg, offset, mmu_ptd; uint32_t size = (words*4 ); /* byte count */ uint32_t dma_channel = 0; /* Setup a Simple DMA for Ch0 */ struct msvdx_private *msvdx_priv = dev_priv->msvdx_private; PSB_DEBUG_GENERAL("MSVDX: Upload firmware by DMA\n"); psb_get_mtx_control_from_dash(dev_priv); // dma transfers to/from the mtx have to be 32-bit aligned and in multiples of 32 bits PSB_WMSVDX32(address, REGISTER(MTX_CORE, CR_MTX_SYSC_CDMAA)); REGIO_WRITE_FIELD_LITE(reg_val, MTX_CORE_CR_MTX_SYSC_CDMAC, BURSTSIZE, 4 );// burst size in multiples of 64 bits (allowed values are 2 or 4) REGIO_WRITE_FIELD_LITE(reg_val, MTX_CORE_CR_MTX_SYSC_CDMAC, RNW, 0); // false means write to mtx mem, true means read from mtx mem REGIO_WRITE_FIELD_LITE(reg_val, MTX_CORE_CR_MTX_SYSC_CDMAC, ENABLE, 1); // begin transfer REGIO_WRITE_FIELD_LITE(reg_val, MTX_CORE_CR_MTX_SYSC_CDMAC, LENGTH, words ); // This specifies the transfer size of the DMA operation in terms of 32-bit words PSB_WMSVDX32(reg_val, REGISTER(MTX_CORE, CR_MTX_SYSC_CDMAC)); // toggle channel 0 usage between mtx and other msvdx peripherals { reg_val = PSB_RMSVDX32(REGISTER( MSVDX_CORE, CR_MSVDX_CONTROL)); REGIO_WRITE_FIELD(reg_val, MSVDX_CORE_CR_MSVDX_CONTROL, DMAC_CH0_SELECT, 0 ); PSB_WMSVDX32(reg_val, REGISTER( MSVDX_CORE, CR_MSVDX_CONTROL)); } /* Clear the DMAC Stats */ PSB_WMSVDX32(0 , REGISTER(DMAC, DMAC_IRQ_STAT ) + dma_channel); offset = msvdx_priv->fw->offset; if(fw_sel) offset += ((msvdx_priv->mtx_mem_size + 8192) & ~0xfff); /* use bank 0 */ cmd = 0; PSB_WMSVDX32(cmd, REGISTER(MSVDX_CORE, CR_MMU_BANK_INDEX)); /* Write PTD to mmu base 0*/ mmu_ptd = psb_get_default_pd_addr(dev_priv->mmu); PSB_WMSVDX32(mmu_ptd, REGISTER( MSVDX_CORE, CR_MMU_DIR_LIST_BASE) + 0); /* Invalidate */ reg_val = PSB_RMSVDX32(REGISTER(MSVDX_CORE, CR_MMU_CONTROL0)); reg_val &= ~0xf; REGIO_WRITE_FIELD(reg_val, MSVDX_CORE_CR_MMU_CONTROL0, CR_MMU_INVALDC, 1 ); PSB_WMSVDX32(reg_val, REGISTER(MSVDX_CORE, CR_MMU_CONTROL0 )); PSB_WMSVDX32(offset, REGISTER(DMAC, DMAC_SETUP ) + dma_channel); /* Only use a single dma - assert that this is valid */ if( (size / 4 ) >= (1<<15) ) { DRM_ERROR("psb: DMA size beyond limited, aboart firmware uploading\n"); return; } uCountReg = PSB_DMAC_VALUE_COUNT(PSB_DMAC_BSWAP_NO_SWAP, 0, /* 32 bits */ PSB_DMAC_DIR_MEM_TO_PERIPH, 0, (size / 4 ) ); /* Set the number of bytes to dma*/ PSB_WMSVDX32(uCountReg, REGISTER(DMAC, DMAC_COUNT ) + dma_channel); cmd = PSB_DMAC_VALUE_PERIPH_PARAM(PSB_DMAC_ACC_DEL_0, PSB_DMAC_INCR_OFF, PSB_DMAC_BURST_2); PSB_WMSVDX32(cmd, REGISTER(DMAC, DMAC_PERIPH ) + dma_channel); /* Set destination port for dma */ cmd = 0; REGIO_WRITE_FIELD(cmd, DMAC_DMAC_PERIPHERAL_ADDR, ADDR, MTX_CORE_CR_MTX_SYSC_CDMAT_OFFSET); PSB_WMSVDX32(cmd, REGISTER(DMAC, DMAC_PERIPHERAL_ADDR ) + dma_channel); /* Finally, rewrite the count register with the enable bit set*/ PSB_WMSVDX32(uCountReg | DMAC_DMAC_COUNT_EN_MASK, REGISTER(DMAC, DMAC_COUNT ) + dma_channel); /* Wait for all to be done */ if(psb_wait_for_register(dev_priv, REGISTER(DMAC, DMAC_IRQ_STAT ) + dma_channel, DMAC_DMAC_IRQ_STAT_TRANSFER_FIN_MASK, DMAC_DMAC_IRQ_STAT_TRANSFER_FIN_MASK, 10000,100)) { psb_release_mtx_control_from_dash(dev_priv); return; } /* Assert that the MTX DMA port is all done aswell */ if(psb_wait_for_register(dev_priv, REGISTER(MTX_CORE, CR_MTX_SYSC_CDMAS0), 1, 1, 10, 10)) { psb_release_mtx_control_from_dash(dev_priv); return; } psb_release_mtx_control_from_dash(dev_priv); PSB_DEBUG_GENERAL("MSVDX: Upload done\n"); }
void osc_register_methods(sosc_state_t *state) { char *prefix, *cmd_buf; monome_t *monome; lo_server srv; prefix = state->config.app.osc_prefix; monome = state->monome; srv = state->server; #define REGISTER(typetags, cb) \ lo_server_add_method(srv, cmd_buf, typetags, cb, monome) METHOD("grid/led/set") REGISTER("iii", led_set_handler); METHOD("grid/led/all") REGISTER("i", led_all_handler); METHOD("grid/led/map") REGISTER("iiiiiiiiii", led_map_handler); METHOD("grid/led/col") REGISTER(NULL, led_col_handler); METHOD("grid/led/row") REGISTER(NULL, led_row_handler); METHOD("grid/led/intensity") REGISTER("i", led_intensity_handler); METHOD("grid/led/level/set") REGISTER("iii", led_level_set_handler); METHOD("grid/led/level/all") REGISTER("i", led_level_all_handler); METHOD("grid/led/level/map") REGISTER("ii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii", led_level_map_handler); METHOD("grid/led/level/col") REGISTER(NULL, led_level_col_handler); METHOD("grid/led/level/row") REGISTER(NULL, led_level_row_handler); METHOD("ring/set") REGISTER("iii", led_ring_set_handler); METHOD("ring/all") REGISTER("ii", led_ring_all_handler); METHOD("ring/map") REGISTER("i" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii", led_ring_map_handler); METHOD("ring/range") REGISTER("iiii", led_ring_range_handler); METHOD("tilt/set") REGISTER("ii", tilt_set_handler); #undef REGISTER }
void SPIClass::begin(int wishboneSlot) { this->wishboneSlot = wishboneSlot; REGISTER(IO_SLOT(wishboneSlot),0)=BIT(SPICP1)|BIT(SPIEN)|BIT(SPIBLOCK); }
/* init library */ extern void picoc_platform_library_init(void) { REGISTER("picoc.h", NULL, &picoc_library[0]); }