static int module_set_stream(struct i2c_client *client,int enable) { struct camera_module_priv *priv = to_camera_priv(client); int ret = 0; unsigned int analog1; mdelay(10); //struct i2c_adapter *i2c_adap = client->adapter; camera_i2c_read(client->adapter, 0x1a, &analog1); GC_INFO(""); if (!enable) { GC_INFO("stream down"); /* power down all analog modules */ analog1 |= 0x01; ret = camera_i2c_write(client->adapter, 0x1a,analog1 ); /* power down data, pclk, vsync, hsync */ ret = camera_i2c_write(client->adapter, 0x25, 0x00); return ret; } if (NULL == priv->win || NULL == priv->cfmt) { GC_ERR("cfmt or win select error"); return (-EPERM); } GC_INFO("stream on"); analog1 &= 0xfe; ret = camera_i2c_write(client->adapter, 0x1a,analog1); ret = camera_i2c_write(client->adapter, 0x25, 0xff); return ret; }
/* static int module_set_prev_capt_mode(struct v4l2_subdev *sd, struct v4l2_ctrl *ctrl) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct camera_module_priv *priv = to_camera_priv(client); int mode = ctrl->val; switch(mode) { case PREVIEW_MODE: priv->prev_capt_mode = mode; break; case CAPTURE_MODE: priv->prev_capt_mode = mode; break; default: return -ERANGE; } ctrl->cur.val = mode; return 0; } static int module_pause_af(struct i2c_client *client) { int ret = 0; msleep(50); return ret; } static int module_set_af_mode(struct v4l2_subdev *sd, struct v4l2_ctrl *ctrl) { return 0; } static int module_get_af_status(struct camera_module_priv *priv, struct v4l2_ctrl *ctrl) { return 0; } static int module_set_exposure(struct v4l2_subdev *sd) { int ret = 0; return ret; } */ static int module_set_stream(struct i2c_client *client,int enable) { struct camera_module_priv *priv = to_camera_priv(client); int ret = 0; unsigned char reg_0xfe = 0x00; unsigned char reg_0xf3 = 0xff; struct i2c_adapter *i2c_adap = client->adapter; GC_INFO(""); if (!enable) { GC_INFO("stream down"); reg_0xf3 = 0x00; camera_i2c_write(i2c_adap, 0xfe, reg_0xfe); camera_i2c_write(i2c_adap, 0xf3, reg_0xf3); return ret; } if (NULL == priv->win || NULL == priv->cfmt) { GC_ERR("cfmt or win select error"); return (-EPERM); } GC_INFO("stream on"); reg_0xf3 = 0xff; camera_i2c_write(i2c_adap, 0xfe, reg_0xfe); camera_i2c_write(i2c_adap, 0xf3, reg_0xf3); return 0; }
ZEND_API void ZEND_FASTCALL gc_possible_root(zend_refcounted *ref) { uint32_t idx; gc_root_buffer *newRoot; if (UNEXPECTED(GC_G(gc_protected))) { return; } GC_BENCH_INC(zval_possible_root); if (EXPECTED(GC_HAS_UNUSED())) { idx = GC_FETCH_UNUSED(); } else if (EXPECTED(GC_HAS_NEXT_UNUSED_UNDER_THRESHOLD())) { idx = GC_FETCH_NEXT_UNUSED(); } else { gc_possible_root_when_full(ref); return; } ZEND_ASSERT(GC_TYPE(ref) == IS_ARRAY || GC_TYPE(ref) == IS_OBJECT); ZEND_ASSERT(GC_INFO(ref) == 0); newRoot = GC_IDX2PTR(idx); newRoot->ref = ref; /* GC_ROOT tag is 0 */ GC_TRACE_SET_COLOR(ref, GC_PURPLE); idx = gc_compress(idx); GC_REF_SET_INFO(ref, idx | GC_PURPLE); GC_G(num_roots)++; GC_BENCH_INC(zval_buffered); GC_BENCH_INC(root_buf_length); GC_BENCH_PEAK(root_buf_peak, root_buf_length); }
static zend_never_inline void ZEND_FASTCALL gc_possible_root_when_full(zend_refcounted *ref) { uint32_t idx; gc_root_buffer *newRoot; ZEND_ASSERT(GC_TYPE(ref) == IS_ARRAY || GC_TYPE(ref) == IS_OBJECT); ZEND_ASSERT(GC_INFO(ref) == 0); if (GC_G(gc_enabled) && !GC_G(gc_active)) { GC_ADDREF(ref); gc_adjust_threshold(gc_collect_cycles()); if (UNEXPECTED(GC_DELREF(ref)) == 0) { rc_dtor_func(ref); return; } else if (UNEXPECTED(GC_INFO(ref))) { return; } } if (GC_HAS_UNUSED()) { idx = GC_FETCH_UNUSED(); } else if (EXPECTED(GC_HAS_NEXT_UNUSED())) { idx = GC_FETCH_NEXT_UNUSED(); } else { gc_grow_root_buffer(); if (UNEXPECTED(!GC_HAS_NEXT_UNUSED())) { return; } idx = GC_FETCH_NEXT_UNUSED(); } newRoot = GC_IDX2PTR(idx); newRoot->ref = ref; /* GC_ROOT tag is 0 */ GC_TRACE_SET_COLOR(ref, GC_PURPLE); idx = gc_compress(idx); GC_REF_SET_INFO(ref, idx | GC_PURPLE); GC_G(num_roots)++; GC_BENCH_INC(zval_buffered); GC_BENCH_INC(root_buf_length); GC_BENCH_PEAK(root_buf_peak, root_buf_length); }
static int module_set_stream(struct i2c_client *client,int enable) { struct camera_module_priv *priv = to_camera_priv(client); int ret = 0; GC_INFO(""); if (!enable) { GC_INFO("stream down"); return ret; } if (NULL == priv->win || NULL == priv->cfmt) { GC_ERR("cfmt or win select error"); return (-EPERM); } GC_INFO("stream on"); return 0; }
static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *stack) { int count = 0; HashTable *ht = NULL; Bucket *p, *end; zval *zv; GC_STACK_DCL(stack); do { /* don't count references for compatibility ??? */ if (GC_TYPE(ref) != IS_REFERENCE) { count++; } if (GC_TYPE(ref) == IS_OBJECT) { zend_object *obj = (zend_object*)ref; if (EXPECTED(!(OBJ_FLAGS(ref) & IS_OBJ_FREE_CALLED))) { int n; zval *zv, *end; /* optimization: color is GC_BLACK (0) */ if (!GC_INFO(ref)) { gc_add_garbage(ref); } if (obj->handlers->dtor_obj != zend_objects_destroy_object || obj->ce->destructor != NULL) { *flags |= GC_HAS_DESTRUCTORS; } ht = obj->handlers->get_gc(obj, &zv, &n); end = zv + n; if (EXPECTED(!ht)) { if (!n) goto next; while (!Z_REFCOUNTED_P(--end)) { /* count non-refcounted for compatibility ??? */ if (Z_TYPE_P(zv) != IS_UNDEF) { count++; } if (zv == end) goto next; } } while (zv != end) { if (Z_REFCOUNTED_P(zv)) { ref = Z_COUNTED_P(zv); GC_ADDREF(ref); if (GC_REF_CHECK_COLOR(ref, GC_WHITE)) { GC_REF_SET_BLACK(ref); GC_STACK_PUSH(ref); } /* count non-refcounted for compatibility ??? */ } else if (Z_TYPE_P(zv) != IS_UNDEF) { count++; } zv++; } if (EXPECTED(!ht)) { ref = Z_COUNTED_P(zv); GC_ADDREF(ref); if (GC_REF_CHECK_COLOR(ref, GC_WHITE)) { GC_REF_SET_BLACK(ref); continue; } goto next; } } else { goto next; } } else if (GC_TYPE(ref) == IS_ARRAY) { /* optimization: color is GC_BLACK (0) */ if (!GC_INFO(ref)) { gc_add_garbage(ref); } ht = (zend_array*)ref; } else if (GC_TYPE(ref) == IS_REFERENCE) { if (Z_REFCOUNTED(((zend_reference*)ref)->val)) { ref = Z_COUNTED(((zend_reference*)ref)->val); GC_ADDREF(ref); if (GC_REF_CHECK_COLOR(ref, GC_WHITE)) { GC_REF_SET_BLACK(ref); continue; } } goto next; } else { goto next; } if (!ht->nNumUsed) goto next; p = ht->arData; end = p + ht->nNumUsed; while (1) { end--; zv = &end->val; if (Z_TYPE_P(zv) == IS_INDIRECT) { zv = Z_INDIRECT_P(zv); } if (Z_REFCOUNTED_P(zv)) { break; } /* count non-refcounted for compatibility ??? */ if (Z_TYPE_P(zv) != IS_UNDEF) { count++; } if (p == end) goto next; } while (p != end) { zv = &p->val; if (Z_TYPE_P(zv) == IS_INDIRECT) { zv = Z_INDIRECT_P(zv); } if (Z_REFCOUNTED_P(zv)) { ref = Z_COUNTED_P(zv); GC_ADDREF(ref); if (GC_REF_CHECK_COLOR(ref, GC_WHITE)) { GC_REF_SET_BLACK(ref); GC_STACK_PUSH(ref); } /* count non-refcounted for compatibility ??? */ } else if (Z_TYPE_P(zv) != IS_UNDEF) { count++; } p++; } zv = &p->val; if (Z_TYPE_P(zv) == IS_INDIRECT) { zv = Z_INDIRECT_P(zv); } ref = Z_COUNTED_P(zv); GC_ADDREF(ref); if (GC_REF_CHECK_COLOR(ref, GC_WHITE)) { GC_REF_SET_BLACK(ref); continue; } next: ref = GC_STACK_POP(); } while (ref); return count; }