static void do_one_test (impl_t *impl, const CHAR *s, size_t exp_len) { size_t len = CALL (impl, s); if (len != exp_len) { error (0, 0, "Wrong result in function %s %zd %zd", impl->name, len, exp_len); ret = 1; return; } if (HP_TIMING_AVAIL) { hp_timing_t start __attribute ((unused)); hp_timing_t stop __attribute ((unused)); hp_timing_t best_time = ~ (hp_timing_t) 0; size_t i; for (i = 0; i < 32; ++i) { HP_TIMING_NOW (start); CALL (impl, s); HP_TIMING_NOW (stop); HP_TIMING_BEST (best_time, start, stop); } printf ("\t%zd", (size_t) best_time); } }
static void dequant_idct_block_8x8(int16_t *in_data, int16_t *out_data, float *quant_tbl) { float mb[8 * 8] __attribute((aligned(32))); float mb2[8 * 8] __attribute((aligned(32))); int i, v; for (i = 0; i < 64; ++i) { mb[i] = in_data[i]; } dequantize_block(mb, mb2, quant_tbl); scale_block(mb2, mb); /* Two 1D inverse DCT operations with transpose */ for (v = 0; v < 8; ++v) { dct_1d_general(mb + v * 8, mb2 + v * 8, dctlookup_trans); } transpose_block(mb2, mb); for (v = 0; v < 8; ++v) { dct_1d_general(mb + v * 8, mb2 + v * 8, dctlookup_trans); } transpose_block(mb2, mb); for (i = 0; i < 64; ++i) { out_data[i] = mb[i]; } }
void g() { __attribute((cleanup(dint))) __auto_type x = 3; __attribute((cleanup(dint))) __auto_type y = 3; f(); }
static void do_one_test (impl_t *impl, const char *s, int c, char *exp_res) { char *res = CALL (impl, s, c); if (res != exp_res) { error (0, 0, "Wrong result in function %s %p %p", impl->name, res, exp_res); ret = 1; return; } if (HP_TIMING_AVAIL) { hp_timing_t start __attribute ((unused)); hp_timing_t stop __attribute ((unused)); hp_timing_t best_time = ~ (hp_timing_t) 0; size_t i; for (i = 0; i < 32; ++i) { HP_TIMING_NOW (start); CALL (impl, s, c); HP_TIMING_NOW (stop); HP_TIMING_BEST (best_time, start, stop); } printf ("\t%zd", (size_t) best_time); } }
static int _read_uuids(struct disk_list *data) { unsigned num_read = 0; struct uuid_list *ul; char buffer[NAME_LEN] __attribute((aligned(8))); uint64_t pos = data->pvd.pv_uuidlist_on_disk.base; uint64_t end = pos + data->pvd.pv_uuidlist_on_disk.size; while (pos < end && num_read < data->vgd.pv_cur) { if (!dev_read(data->dev, pos, sizeof(buffer), buffer)) return_0; if (!(ul = dm_pool_alloc(data->mem, sizeof(*ul)))) return_0; memcpy(ul->uuid, buffer, NAME_LEN); ul->uuid[NAME_LEN - 1] = '\0'; dm_list_add(&data->uuids, &ul->list); pos += NAME_LEN; num_read++; } return 1; }
main() { int printf(char *, ...) __attribute((format(printf,1,2))); printf( "%Q\n"); // CARETS: // ^ warning: invalid conversion character }
main() { ((void (*__attribute((format(printf, 1, 2))))())0)(); typedef void (*__attribute((format(printf, 1, 2))) pfn)(); typedef void (__attribute((format(printf, 1, 2))) fn)(); // CHECK: warning: variadic function required for format attribute ((pfn)0)(); ((fn *)0)(); typedef void (*__attribute((format(printf, 1, 2))) pfn_arg)(const char *, ...); typedef void (__attribute((format(printf, 1, 2))) fn_arg)(const char *, ...); ((pfn)0)("hi %d", 3); ((fn *)0)("hello %.*s", 2, "x"); ((pfn)0)("hello %*.*s", 1, 2, "x"); }
main() { int printf(const char *, ...) __attribute((format(printf, 1, 2))); long long ll = 0; printf("%lld\n", ll); // CHECK: !/warn/ }
char *lvm_lv_get_uuid(const lv_t lv) { char uuid[64] __attribute((aligned(8))); if (!id_write_format(&lv->lvid.id[1], uuid, sizeof(uuid))) { log_error("Internal error converting uuid"); return NULL; } return strndup((const char *)uuid, 64); }
void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *buffer, int execute) { struct pthread *self __attribute ((unused)) = THREAD_SELF; THREAD_SETMEM (self, cleanup, buffer->__prev); /* If necessary call the cleanup routine after we removed the current cleanup block from the list. */ if (execute) buffer->__routine (buffer->__arg); }
void dequant_idct_block_8x8_dec(int16_t *in_data, int16_t *out_data, uint8_t *quant_tbl) { float mb[8*8] __attribute((aligned(16))); float mb2[8*8] __attribute((aligned(16))); int i, v; for (i = 0; i < 64; ++i) { mb[i] = in_data[i]; } dequantize_block_dec(mb, mb2, quant_tbl); scale_block_dec(mb2, mb); /* Two 1D inverse DCT operations with transpose */ for (v = 0; v < 8; ++v) { idct_1d_dec(mb+v*8, mb2+v*8); } transpose_block_dec(mb2, mb); for (v = 0; v < 8; ++v) { idct_1d_dec(mb+v*8, mb2+v*8); } transpose_block_dec(mb2, mb); for (i = 0; i < 64; ++i) { out_data[i] = mb[i]; } }
static void do_one_test (impl_t *impl, const CHAR *s1, const CHAR *s2, size_t len, int exp_result) { if (HP_TIMING_AVAIL) { hp_timing_t start __attribute ((unused)); hp_timing_t stop __attribute ((unused)); hp_timing_t best_time = ~ (hp_timing_t) 0; size_t i; for (i = 0; i < 32; ++i) { HP_TIMING_NOW (start); CALL (impl, s1, s2, len); HP_TIMING_NOW (stop); HP_TIMING_BEST (best_time, start, stop); } printf ("\t%zd", (size_t) best_time); } }
static void do_one_test (impl_t *impl, const char *s1, const char *s2, char *exp_result) { if (check_result (impl, s1, s2, exp_result) < 0) return; if (HP_TIMING_AVAIL) { hp_timing_t start __attribute ((unused)); hp_timing_t stop __attribute ((unused)); hp_timing_t best_time = ~(hp_timing_t) 0; size_t i; for (i = 0; i < 32; ++i) { HP_TIMING_NOW (start); CALL (impl, s1, s2); HP_TIMING_NOW (stop); HP_TIMING_BEST (best_time, start, stop); } printf ("\t%zd", (size_t) best_time); } }
int test_fft_64(int N, int width, i16 omega) { i16 A[N*width] __attribute ((aligned (16))); i16 B[N*width]; assert(N == 64 || N == 128); // initialise un tableau pseudo-aléatoire for(int i = 0; i < N*width; i++) { A[i] = reduce(5*i ^ 17*i ^ 42); } // calcule les [width] FFTs parallèles en O(width * N^2). // B[i] = sum(A[j] * (omega^i)^j, i=0..127) for(int w=0; w<width; w++) { i16 omega_i = 1; // contient omega^i for(int i = 0; i < N; i++) { i16 omega_ij = 1; // contient omega^(ij) B[w + i * width] = 0; for(int j = 0; j < N; j++) { B[w + i * width] = reduce(B[w + i * width] + A[w + j*width] * omega_ij); omega_ij = reduce(omega_ij * omega_i); } omega_i = reduce(omega_i * omega); } } if(N == 64) fft64(A); else fft128(A); /* //check */ /* for(int i = 0; i < N; i++){ */ /* printf("A[%d] = %d B = %d\n", i, A[i], B[i]); */ /* } */ for(int i = 0; i < N; i++){ if(A[i] != B[i]) { printf("A[%d] = %d vs B[%d] = %d\n", i, A[i], i, B[i]); return 0; } } return 1; }
dmin = MIN(dmin,data[k][j][i]); dmax = MAX(dmax,data[k][j][i]); } } } *dmino = dmin; *dmaxo = dmax; } /*----------------------------------------------------------------------------*/ /*! \fn void do_nothing_bc(GridS *pG) * * \brief DOES ABSOLUTELY NOTHING! THUS, WHATEVER THE BOUNDARY ARE SET TO * INITIALLY, THEY REMAIN FOR ALL TIME. */ void do_nothing_bc(GridS *pG __attribute((unused))) { } /*============================================================================ * ERROR-ANALYSIS FUNCTIONS *============================================================================*/ /*----------------------------------------------------------------------------*/ /*! \fn Real compute_div_b(GridS *pG) * \brief COMPUTE THE DIVERGENCE OF THE MAGNETIC FIELD USING FACE-CENTERED * FIELDS OVER THE ENTIRE ACTIVE GRID. RETURNS THE MAXIMUM OF |DIV B|. */ Real compute_div_b(GridS *pG) { #ifdef MHD
void PaletteWindow::DrawGrid (Glib::RefPtr<Gdk::Window> area, Glib::RefPtr<Gdk::GC>& gc) { gc->set_rgb_fg_color(Gdk::Color("black")); area->draw_rectangle(gc, true, 0, 0, 161, 161); gc->set_rgb_fg_color(Gdk::Color("white")); for (uint8_t c = 0; c <= 16; ++c) { area->draw_line(gc, c*10, 0, c*10, 161); area->draw_line(gc, 0, c*10, 161, c*10); } } bool PaletteWindow::on_bg_expose (GdkEventExpose* event __attribute((unused))) { if (!m_bgGc) m_bgGc = Gdk::GC::create(m_bgPalette.get_window()); DrawGrid(m_bgPalette.get_window(), m_bgGc); return true; } bool PaletteWindow::on_obj_expose (GdkEventExpose* event __attribute((unused))) { if (!m_objGc) m_objGc = Gdk::GC::create(m_objPalette.get_window()); DrawGrid(m_objPalette.get_window(), m_objGc);
void cfft2(unsigned int n,float x[][2],float y[][2],float w[][2], float sign) { /* altivec version of cfft2 from Petersen and Arbenz book, "Intro. to Parallel Computing", Oxford Univ. Press, 2003, Section 3.6 wpp 14. Dec. 2003 */ int jb,jc,jd,jw,k,k2,k4,lj,m,j,mj,mj2,pass,tgle; float rp,up,wr[4] __attribute((aligned(16))); float wu[4] __attribute((aligned(16))); float *a,*b,*c,*d; const vector float vminus = (vector float) { -0.,0.,-0.,0. }; const vector float vzero = (vector float) { 0.,0.,0.,0. }; const vector unsigned char pv3201 = (vector unsigned char) { 4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11 }; vector float V0,V1,V2,V3,V4,V5,V6,V7; vector float V8,V9,V10,V11,V12,V13,V14,V15; if(n<=1) { y[0][0] = x[0][0]; y[0][1] = x[0][1]; return; } m = (int) (log((float) n)/log(1.99)); mj = 1; mj2 = 2; lj = n/2; /* first pass thru data: x -> y */ for(j=0; j<lj; j++) { jb = n/2+j; jc = j*mj2; jd = jc + 1; rp = w[j][0]; up = w[j][1]; if(sign<0.0) up = -up; y[jd][0] = rp*(x[j][0] - x[jb][0]) - up*(x[j][1] - x[jb][1]); y[jd][1] = up*(x[j][0] - x[jb][0]) + rp*(x[j][1] - x[jb][1]); y[jc][0] = x[j][0] + x[jb][0]; y[jc][1] = x[j][1] + x[jb][1]; } if(n==2) return; /* next pass is mj = 2 */ mj = 2; mj2 = 4; lj = n/4; a = (float *)&y[0][0]; b = (float *)&y[n/2][0]; c = (float *)&x[0][0]; d = (float *)&x[mj][0]; if(n==4) { c = (float *)&y[0][0]; d = (float *)&y[mj][0]; } for(j=0; j<lj; j++) { jw = j*mj; jc = j*mj2; jd = 2*jc; rp = w[jw][0]; up = w[jw][1]; if(sign<0.0) up = -up; wr[0] = rp; wr[1] = rp; wr[2] = rp; wr[3] = rp; wu[0] = up; wu[1] = up; wu[2] = up; wu[3] = up; V6 = vec_ld(0,wr); V7 = vec_ld(0,wu); V7 = vec_xor(V7,vminus); V0 = vec_ld(0,(vector float *) (a+jc)); V1 = vec_ld(0,(vector float *) (b+jc)); V2 = vec_add(V0,V1); /* a + b */ vec_st(V2,0,(vector float *) (c+jd)); /* store c */ V3 = vec_sub(V0,V1); /* a - b */ V4 = vec_perm(V3,V3,pv3201); V0 = vec_madd(V6,V3,vzero); V1 = vec_madd(V7,V4,vzero); V2 = vec_add(V0,V1); /* w*(a - b) */ vec_st(V2,0,(vector float*) (d+jd)); /* store d */ } if(n==4) return; mj *= 2; mj2 = 2*mj; lj = n/mj2; tgle = 0; for(pass=2; pass<m-1; pass++) { if(tgle) { a = (float *)&y[0][0]; b = (float *)&y[n/2][0]; c = (float *)&x[0][0]; d = (float *)&x[mj][0]; tgle = 0; } else { a = (float *)&x[0][0]; b = (float *)&x[n/2][0]; c = (float *)&y[0][0]; d = (float *)&y[mj][0]; tgle = 1; } for(j=0; j<lj; j++) { jw = j*mj; jc = j*mj2; jd = 2*jc; rp = w[jw][0]; up = w[jw][1]; if(sign<0.0) up = -up; wr[0] = rp; wr[1] = rp; wr[2] = rp; wr[3] = rp; wu[0] = up; wu[1] = up; wu[2] = up; wu[3] = up; V6 = vec_ld(0,wr); V7 = vec_ld(0,wu); V7 = vec_xor(V7,vminus); for(k=0; k<mj; k+=4) { k2 = 2*k; k4 = k2+4; V0 = vec_ld(0,(vector float *) (a+jc+k2)); V1 = vec_ld(0,(vector float *) (b+jc+k2)); V2 = vec_add(V0,V1); /* a + b */ vec_st(V2,0,(vector float*) (c+jd+k2)); /* store c */ V3 = vec_sub(V0,V1); /* a - b */ V4 = vec_perm(V3,V3,pv3201); V0 = vec_madd(V6,V3,vzero); V1 = vec_madd(V7,V4,vzero); V2 = vec_add(V0,V1); /* w*(a - b) */ vec_st(V2,0,(vector float *) (d+jd+k2)); /* store d */ V8 = vec_ld(0,(vector float *) (a+jc+k4)); V9 = vec_ld(0,(vector float *) (b+jc+k4)); V10 = vec_add(V8,V9); /* a + b */ vec_st(V10,0,(vector float *) (c+jd+k4)); /* store c */ V11 = vec_sub(V8,V9); /* a - b */ V12 = vec_perm(V11,V11,pv3201); V8 = vec_madd(V6,V11,vzero); V9 = vec_madd(V7,V12,vzero); V10 = vec_add(V8,V9); /* w*(a - b) */ vec_st(V10,0,(vector float *) (d+jd+k4)); /* store d */ } } mj *= 2; mj2 = 2*mj; lj = n/mj2; } /* last pass thru data: in-place if previous in y */ c = (float *)&y[0][0]; d = (float *)&y[n/2][0]; if(tgle) { a = (float *)&y[0][0]; b = (float *)&y[n/2][0]; } else { a = (float *)&x[0][0]; b = (float *)&x[n/2][0]; } for(k=0; k<(n/2); k+=4) { k2 = 2*k; k4 = k2+4; V0 = vec_ld(0,(vector float *) (a+k2)); V1 = vec_ld(0,(vector float *) (b+k2)); V2 = vec_add(V0,V1); /* a + b */ vec_st(V2,0,(vector float*) (c+k2)); /* store c */ V3 = vec_sub(V0,V1); /* a - b */ vec_st(V3,0,(vector float *) (d+k2)); /* store d */ V4 = vec_ld(0,(vector float *) (a+k4)); V5 = vec_ld(0,(vector float *) (b+k4)); V6 = vec_add(V4,V5); /* a + b */ vec_st(V6,0,(vector float *) (c+k4)); /* store c */ V7 = vec_sub(V4,V5); /* a - b */ vec_st(V7,0,(vector float *) (d+k4)); /* store d */ } } // LLVM LOCAL begin // Implementations of sin() and cos() may vary slightly in the accuracy of // their results, typically only in the least significant bit. Round to make // the results consistent across platforms. typedef union { double d; unsigned long long ll; } dbl_ll_union; static double LLVMsin(double d) { dbl_ll_union u; u.d = sin(d); u.ll = (u.ll + 1) & ~1ULL; return u.d; } static double LLVMcos(double d) { dbl_ll_union u; u.d = cos(d); u.ll = (u.ll + 1) & ~1ULL; return u.d; } // LLVM LOCAL end void cffti(int n, float w[][2]) { /* initialization routine for cfft2: computes cos(twopi*k),sin(twopi*k) for k=0..n/2-1 - the "twiddle factors" for a binary radix FFT */ int i,n2; float aw,arg,pi; pi = 3.141592653589793; n2 = n/2; aw = 2.0*pi/((float)n); for(i=0; i<n2; i++) { arg = aw*((float)i); w[i][0] = LLVMcos(arg); w[i][1] = LLVMsin(arg); } }
/* * Send a message to a(or all) node(s) in the cluster and wait for replies */ static int _cluster_request(char clvmd_cmd, const char *node, void *data, int len, lvm_response_t ** response, int *num) { char outbuf[sizeof(struct clvm_header) + len + strlen(node) + 1] __attribute((aligned(8))); char *inptr; char *retbuf = NULL; int status; int i; int num_responses = 0; struct clvm_header *head = (struct clvm_header *) outbuf; lvm_response_t *rarray; *num = 0; if (_clvmd_sock == -1) _clvmd_sock = _open_local_sock(); if (_clvmd_sock == -1) return 0; _build_header(head, clvmd_cmd, node, len); memcpy(head->node + strlen(head->node) + 1, data, len); status = _send_request(outbuf, sizeof(struct clvm_header) + strlen(head->node) + len, &retbuf); if (!status) goto out; /* Count the number of responses we got */ head = (struct clvm_header *) retbuf; inptr = head->args; while (inptr[0]) { num_responses++; inptr += strlen(inptr) + 1; inptr += sizeof(int); inptr += strlen(inptr) + 1; } /* * Allocate response array. * With an extra pair of INTs on the front to sanity * check the pointer when we are given it back to free */ *response = dm_malloc(sizeof(lvm_response_t) * num_responses); if (!*response) { errno = ENOMEM; status = 0; goto out; } rarray = *response; /* Unpack the response into an lvm_response_t array */ inptr = head->args; i = 0; while (inptr[0]) { strcpy(rarray[i].node, inptr); inptr += strlen(inptr) + 1; memcpy(&rarray[i].status, inptr, sizeof(int)); inptr += sizeof(int); rarray[i].response = dm_malloc(strlen(inptr) + 1); if (rarray[i].response == NULL) { /* Free up everything else and return error */ int j; for (j = 0; j < i; j++) dm_free(rarray[i].response); free(*response); errno = ENOMEM; status = -1; goto out; } strcpy(rarray[i].response, inptr); rarray[i].len = strlen(inptr); inptr += strlen(inptr) + 1; i++; } *num = num_responses; *response = rarray; out: if (retbuf) dm_free(retbuf); return status; }
/* Send a request and return the status */ static int _send_request(char *inbuf, int inlen, char **retbuf) { char outbuf[PIPE_BUF] __attribute((aligned(8))); struct clvm_header *outheader = (struct clvm_header *) outbuf; int len; int off; int buflen; int err; /* Send it to CLVMD */ rewrite: if ( (err = write(_clvmd_sock, inbuf, inlen)) != inlen) { if (err == -1 && errno == EINTR) goto rewrite; log_error("Error writing data to clvmd: %s", strerror(errno)); return 0; } /* Get the response */ reread: if ((len = read(_clvmd_sock, outbuf, sizeof(struct clvm_header))) < 0) { if (errno == EINTR) goto reread; log_error("Error reading data from clvmd: %s", strerror(errno)); return 0; } if (len == 0) { log_error("EOF reading CLVMD"); errno = ENOTCONN; return 0; } /* Allocate buffer */ buflen = len + outheader->arglen; *retbuf = dm_malloc(buflen); if (!*retbuf) { errno = ENOMEM; return 0; } /* Copy the header */ memcpy(*retbuf, outbuf, len); outheader = (struct clvm_header *) *retbuf; /* Read the returned values */ off = 1; /* we've already read the first byte */ while (off <= outheader->arglen && len > 0) { len = read(_clvmd_sock, outheader->args + off, buflen - off - offsetof(struct clvm_header, args)); if (len > 0) off += len; } /* Was it an error ? */ if (outheader->status != 0) { errno = outheader->status; /* Only return an error here if there are no node-specific errors present in the message that might have more detail */ if (!(outheader->flags & CLVMD_FLAG_NODEERRS)) { log_error("cluster request failed: %s", strerror(errno)); return 0; } } return 1; }
/*#define LIB3DS_CHUNK_DEBUG*/ /*#define LIB3DS_CHUNK_WARNING*/ /*! * \defgroup chunk Chunk Handling */ static Lib3dsBool enable_dump=LIB3DS_FALSE; static Lib3dsBool enable_unknown=LIB3DS_FALSE; static char lib3ds_chunk_level[128]=""; static void lib3ds_chunk_debug_enter(Lib3dsChunk *c __attribute((unused))) { strcat(lib3ds_chunk_level, " "); } static void lib3ds_chunk_debug_leave(Lib3dsChunk *c __attribute((unused))) { lib3ds_chunk_level[strlen(lib3ds_chunk_level)-2]=0; } static void lib3ds_chunk_debug_dump(Lib3dsChunk *c) {
static const char * index_to_string(enum AGBMergeIndex idx) { if(idx==AGB_MERGE_BASE) { return "merge_base"; } if(idx==AGB_MERGE_LOCAL) { return "local"; } if(idx==AGB_MERGE_REMOTE) { return "remote"; } return "invalid"; } #include "utils/test_utils_x.h" static agbtu_cxxstrset * conflicts; static agbtu_cxxstrset * changed; static agbtu_cxxstrset * added; static agbtu_cxxstrset * deleted; static agbtu_cxxstrset * updated; static int merge_conflict(AGBMerger * self __attribute((unused)), AGBMergeEntry * entry) { agbtu_cxxstrset_add(conflicts, entry->name); return 0; } static int merge_every(AGBMerger * self __attribute((unused)), AGBMergeEntry * entry __attribute((unused))) { return 0; } static int merge_changed(AGBMerger * self __attribute((unused)), AGBMergeEntry * entry) { agbtu_cxxstrset_add(changed, entry->name); return 0; } static int merge_add(AGBMerger * self __attribute((unused)), AGBMergeEntry * entry, enum AGBMergeIndex idx __attribute((unused))) { agbtu_cxxstrset_add(added, entry->name);
main() { ((void (*__attribute((format(printf, 1, 2))))())0)(); }
job->job_class = class_id_it->second ; if ( (queue_it = class_to_queue.find(job->job_class)) != class_to_queue.end() ) { curr_queue = queue_it->second ; curr_queue->push_ignore_sim_object( job ) ; } } } return 0; } // Overload of Scheduler::add_sim_object that does nothing. int Trick::IntegLoopScheduler::add_sim_object(Trick::SimObject * sim_obj __attribute((unused))) { return 0; } /** Add a sim object to the set of objects integrated by this integration loop. The job queues for this loop are rebuild after adding the sim object. @param sim_obj Address of the sim object that should be added to scheduler. */ int Trick::IntegLoopScheduler::add_sim_object(Trick::SimObject & sim_obj) { // Disallow duplicate objects. if (find_sim_object (sim_obj) != sim_objects.end()) { message_publish ( MSG_ERROR, "Integ Scheduler ERROR: "
#include <std/draw.h> // for stderr void dump_state_printf(uint32_t* regs) { fprintf(stderr, " cpsr:%x sp:%x pc:%x\n" " r0:%x r1:%x r2:%x r3:%x\n" " r4:%x r5:%x r6:%x r7:%x\n" " r8:%x r9:%x r10:%x r11:%x\n" " r12:%x\n", (unsigned int)regs[0], (unsigned int)regs[1], (unsigned int)regs[2], (unsigned int)regs[3], (unsigned int)regs[4], (unsigned int)regs[5], (unsigned int)regs[6], (unsigned int)regs[7], (unsigned int)regs[8], (unsigned int)regs[9], (unsigned int)regs[10], (unsigned int)regs[11], (unsigned int)regs[12], (unsigned int)regs[13], (unsigned int)regs[14], (unsigned int)regs[15]); } void reset_INT(__attribute((unused)) uint32_t* regs) { fprintf(stderr, "Reset called.\n"); } void undef_INT(uint32_t* regs) { fprintf(stderr, "Undefined instruction.\n"); dump_state_printf(regs); panic("Cannot continue. Halting.\n"); } void swi_INT(__attribute__((unused)) uint32_t* regs) { fprintf(stderr, "SWI called. Returning.\n"); } void preabrt_INT(uint32_t* regs) { fprintf(stderr, "Prefetch abort.\n");
int main ( void ) { // enable nvic clock for dma // #if 1 NVIC_InitTypeDef NVIC_InitStructure; /* Enable the DMA Stream IRQ Channel */ NVIC_InitStructure.NVIC_IRQChannel = DMA_STREAM_IRQ; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); #endif // set us up the bomb // DMA_InitTypeDef DMA_InitStructure __attribute((aligned (4))); /* Enable the DMA clock */ RCC_AHB1PeriphClockCmd ( DMA_STREAM_CLOCK, ENABLE ); /* Configure the DMA Stream */ //DMA_Cmd ( DMA_STREAM, DISABLE ); DMA_DeInit ( DMA_STREAM ); while(DMA_GetCmdStatus(DMA_STREAM) != DISABLE); /* Set the parameters to be configured */ DMA_InitStructure.DMA_Channel = DMA_CHANNEL; // GPIO data register IDR input, ODR output DMA_InitStructure.DMA_BufferSize = (uint32_t) (BUFSIZE); #if 1 // M2M DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToMemory; DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)src; DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)dst; DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Enable; DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; #else #endif DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte; DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; DMA_InitStructure.DMA_Mode = DMA_Mode_Normal; //DMA_Mode_Circular; DMA_InitStructure.DMA_Priority = DMA_Priority_High; DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable; DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full; //Full 1QuarterFull DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single; // Single DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single; // Single INC4 INC8 INC16 DMA_Init(DMA_STREAM, &DMA_InitStructure); //DMA2_Stream1->CR &= ~DMA_SxCR_EN; //pixelclock_start(); //DMA2_Stream1->CR|=DMA_SxCR_EN; /* Enable DMA Transfer Complete interrupt */ DMA_ITConfig ( DMA_STREAM, DMA_IT_TC, ENABLE ); // interupts needed? DMA_Cmd ( DMA_STREAM, ENABLE ); //while(DMA_GetCmdStatus(DMA_STREAM) != ENABLE); RCC-> APB2ENR |= RCC_APB2ENR_TIM1EN; TIM1->PSC = 0; // clk is 16MHz, no prescaler TIM1->ARR = 100; // -> the whole 10-beat DMA transfer takes cca 1000 clk TIM1->DIER = TIM_DIER_UDE | TIM_DIER_UIE; /* Update DMA enable */ TIM1->CR1 = TIM_CR1_CEN; /* Counter enable */ while (!(DMA2->LISR & DMA_LISR_TCIF1)); // wait until DMA transfer finishes // wait forever while ( 1 ) { __asm__("nop"); // main spin } // while forever return 0; }
} /* * Write many blocks */ bool GenericSram::writeBlocks(void *dest,uint32_t blockIndex,uint32_t numBlocks) { MEM_DataCopy(_sramStartAddress+(blockIndex * BLOCK_SIZE),dest,numBlocks * BLOCK_SIZE); return true; } /* * Get the format type - no MBR */ BlockDevice::formatType GenericSram::getFormatType() { return BlockDevice::formatNoMbr; } /* * Cannot get the MBR */ bool GenericSram::getMbr(Mbr *mbr __attribute((unused))) { return errorProvider.set(ErrorProvider::ERROR_PROVIDER_SRAM,E_NO_MBR); } }
if (videoCutList->currentItem() != NULL && editItemIndex < 0) { // current index int index = videoCutList->indexOfTopLevelItem(videoCutList->currentItem()); // remove current item from list delete videoCutList->takeTopLevelItem(index); cutListData->removeAt(index); emit refreshDisplay(); //cutListData->print(); } } //! Entry selected; Selection changed void TTCutList::onEntrySelected(__attribute((unused))QTreeWidgetItem* item, __attribute__((unused))int column) { if (ttAssigned(cutListData)) { int index = videoCutList->indexOfTopLevelItem(videoCutList->currentItem()); emit entrySelected(cutListData->cutOutPos(index)); } } //! Edit selected entry void TTCutList::onEntryEdit() { if (ttAssigned(cutListData)) { QTreeWidgetItem* curItem = videoCutList->currentItem(); int index = videoCutList->indexOfTopLevelItem(curItem); curItem->setBackgroundColor(0, Qt::lightGray); curItem->setBackgroundColor(1, Qt::lightGray);
#include <stdlib.h> #include <stdio.h> #include <stdarg.h> #include <string.h> #include <assert.h> #include <ctype.h> #include "json_compatibility.h" #include "liblognorm.h" #include "lognorm.h" #include "samp.h" #include "internal.h" #include "parser.h" struct ln_sampRepos* ln_sampOpen(ln_ctx __attribute((unused)) ctx, const char *name) { struct ln_sampRepos *repo = NULL; FILE *fp; if((fp = fopen(name, "r")) == NULL) goto done; if((repo = calloc(1, sizeof(struct ln_sampRepos))) == NULL) { fclose(fp); goto done; } repo->fp = fp; done:
if (file[file.size()-4] == '.') file.replace(file.end()-3, file.end(), "mst"); else file.append(".mst"); file.insert(file.end()-4, 1, n+'0'); if (!AMeteor::LoadState(file.c_str())) { Gtk::MessageDialog dlg(*this, "Cannot load state !", false, Gtk::MESSAGE_ERROR); dlg.run(); } else m_statusbar.push("State loaded"); } bool MainWindow::on_delete_event(GdkEventAny* event __attribute((unused))) { on_quit(); return true; } bool MainWindow::on_key_press_event(GdkEventKey* key) { AMeteor::_keypad.KeyPressed(key->keyval); return Gtk::Window::on_key_press_event(key); } bool MainWindow::on_key_release_event(GdkEventKey* key) { AMeteor::_keypad.KeyReleased(key->keyval); return Gtk::Window::on_key_release_event(key);
git_commit * commit; git_commit_lookup(&commit, repo, oid); const git_oid * tree_oid = git_commit_tree_id(commit); git_tree_lookup(tree, repo, tree_oid); git_commit_free(commit); return 0; } //TODO: Add error handling. /* * Get the SHA of the two trees we're going to merge and create an iterator from them. */ __attribute__((unused)) static AGBMergeIterator * merge( AGBCore * core, AGBError * error __attribute((unused)) ) { git_oid local_oid; git_oid remote_oid; git_oid base_oid; git_tree * local_tree = NULL; git_tree * remote_tree = NULL; git_tree * base_tree = NULL; //TODO: Use a real error? assert(core); assert(core->repository); /* TODO: FIX THIS */ const char * local_branch_name = core->local_branch_name;