irqreturn_t systracker_isr(void) { unsigned int con; #ifdef SYSTRACKER_TEST_SUIT systracker_test_cleanup(); #endif save_entry(); pr_notice("Sys Tracker ISR\n"); con = readl(IOMEM(BUS_DBG_CON)); writel(con | BUS_DBG_CON_IRQ_CLR, IOMEM(BUS_DBG_CON)); dsb(); if (con & BUS_DBG_CON_IRQ_WP_STA) pr_notice("[TRACKER] Watch address: 0x%x was touched\n", track_config.wp_phy_address); if (con & (BUS_DBG_CON_IRQ_AR_STA0|BUS_DBG_CON_IRQ_AR_STA1)) { pr_notice("[TRAKER] Read time out trigger\n"); tracker_print(); } if (con & (BUS_DBG_CON_IRQ_AW_STA0|BUS_DBG_CON_IRQ_AW_STA1)) { pr_notice("[TRAKER] Write time out trigger\n"); tracker_print(); } return IRQ_HANDLED; }
static int hash_and_save(git_indexer *idx, git_rawobj *obj, git_off_t entry_start) { git_oid oid; size_t entry_size; struct entry *entry; struct git_pack_entry *pentry = NULL; entry = (struct entry *) git__calloc(1, sizeof(*entry)); GITERR_CHECK_ALLOC(entry); if (git_odb__hashobj(&oid, obj) < 0) { giterr_set(GITERR_INDEXER, "Failed to hash object"); goto on_error; } pentry = (git_pack_entry*) git__calloc(1, sizeof(struct git_pack_entry)); GITERR_CHECK_ALLOC(pentry); git_oid_cpy(&pentry->sha1, &oid); git_oid_cpy(&entry->oid, &oid); entry->crc = crc32(0L, Z_NULL, 0); entry_size = (size_t)(idx->off - entry_start); if (crc_object(&entry->crc, &idx->pack->mwf, entry_start, entry_size) < 0) goto on_error; return save_entry(idx, entry, pentry, entry_start); on_error: git__free(pentry); git__free(entry); git__free(obj->data); return -1; }
static gboolean entry_focus_out_cb (GtkWidget *entry, GdkEventFocus *event, GnomeDesktopItem *item) { save_entry (GTK_ENTRY (entry), item); return FALSE; }
static void entry_activate_cb (GtkWidget *entry, GtkWidget *container) { const char *uri; GKeyFile *key_file; uri = g_object_get_data (G_OBJECT (container), "uri"); key_file = g_object_get_data (G_OBJECT (container), "keyfile"); save_entry (GTK_ENTRY (entry), key_file, uri); }
static gboolean entry_focus_out_cb (GtkWidget *entry, GdkEventFocus *event, GtkWidget *container) { const char *uri; GKeyFile *key_file; uri = g_object_get_data (G_OBJECT (container), "uri"); key_file = g_object_get_data (G_OBJECT (container), "keyfile"); save_entry (GTK_ENTRY (entry), key_file, uri); return FALSE; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { // Setup the UI ui->setupUi(this); // Set the fleur image on the left and right labels leftLabel = ui->leftLabel; rightLabel = ui->rightLabel; QImage *image = new QImage(":/fleur.png"); if (image != NULL) { QPixmap *pixmap = new QPixmap(); pixmap->convertFromImage(*image); leftLabel->setPixmap(*pixmap); rightLabel->setPixmap(*pixmap); } //Instantiate statusbar handler statusbar_handler = new tbStatusBar_Handler(ui->statusBar); statusbar_handler->update_status_bar(QString("Welcome to your private diary")); //Instantiate textedit handler textedit_handler = new tbTextEdit_Handler(ui->textEdit); textedit_handler->set_statusbar(statusbar_handler); //instantiate locker locker = new tbLocker(this, textedit_handler, statusbar_handler); //assign slots for menu items QObject::connect(ui->actionFont_Diary_Entry, SIGNAL(triggered()), (QObject*)textedit_handler, SLOT(font_selection())); QObject::connect(ui->actionNew_Diary_Entry, SIGNAL(triggered()), (QObject*)locker, SLOT(new_entry())); QObject::connect(ui->actionOpen_Diary_Entry, SIGNAL(triggered()), (QObject*)locker, SLOT(open_entry())); QObject::connect(ui->actionSave_Diary_Entry, SIGNAL(triggered()), (QObject*)locker, SLOT(save_entry())); QObject::connect(ui->actionAbout, SIGNAL(triggered()), (QObject*)locker, SLOT(about())); }
static int systracker_platform_probe_default(struct platform_device *pdev) { pr_notice("systracker probe\n"); /* iomap register */ BUS_DBG_BASE = of_iomap(pdev->dev.of_node, 0); if (!BUS_DBG_BASE) { pr_err("can't of_iomap for systracker!!\n"); return -ENOMEM; } else { pr_notice("of_iomap for systracker @ 0x%p\n", BUS_DBG_BASE); } /* get irq # */ systracker_irq = irq_of_parse_and_map(pdev->dev.of_node, 0); pr_notice("%s:%d: irq # %d\n", __func__, __LINE__, systracker_irq); #ifdef SYSTRACKER_TEST_SUIT if (!is_systracker_irq_registered) { if (request_irq(systracker_irq, (irq_handler_t)systracker_isr, IRQF_TRIGGER_LOW, "SYSTRACKER", NULL)) { pr_err("SYSTRACKER IRQ LINE NOT AVAILABLE!!\n"); return -1; } else { is_systracker_irq_registered = 1; } } #endif /* save entry info */ save_entry(); memset(&track_config, sizeof(struct systracker_config_t), 0); /* To latch last PC when tracker timeout, we need to enable interrupt mode */ track_config.enable_timeout = 1; track_config.enable_slave_err = 1; track_config.enable_irq = 1; track_config.timeout_ms = 100; track_config.timeout2_ms = 2000; systracker_reset(); systracker_enable(); return 0; }
static int ll_delete_value(reftab_entry ** list, const void *p) /* return number of references to p left */ { reftab_entry **prev = list, *tmp; while ((*list) && (*list)->p < p) { prev = list; list = &((*list)->next); } /* not found, must be last reference */ if (*list == 0 || (*list)->p > p) return 0; else { /* found */ /* not next to last reference */ if ((*list)->count > 2) return --((*list)->count); /* too few references */ else if ((*list)->count < 2) panic("Error when deleting reference: count too low"); /* next to last reference: remove entry */ else { /* count == 2 */ tmp = *list; (*prev)->next = (*list)->next; if (list == prev) /* head of list */ *prev = (*list)->next; save_entry(tmp); return 1; } } return -1; /* shouldn't reach here */ }
static void entry_activate_cb (GtkWidget *entry, GnomeDesktopItem *item) { save_entry (GTK_ENTRY (entry), item); }
static int inject_object(git_indexer *idx, git_oid *id) { git_odb_object *obj; struct entry *entry; struct git_pack_entry *pentry = NULL; git_oid foo = {{0}}; unsigned char hdr[64]; git_buf buf = GIT_BUF_INIT; git_off_t entry_start; const void *data; size_t len, hdr_len; int error; seek_back_trailer(idx); entry_start = idx->pack->mwf.size; if (git_odb_read(&obj, idx->odb, id) < 0) { giterr_set(GITERR_INDEXER, "missing delta bases"); return -1; } data = git_odb_object_data(obj); len = git_odb_object_size(obj); entry = (struct entry*) git__calloc(1, sizeof(*entry)); GITERR_CHECK_ALLOC(entry); entry->crc = crc32(0L, Z_NULL, 0); /* Write out the object header */ hdr_len = git_packfile__object_header(hdr, len, git_odb_object_type(obj)); if ((error = append_to_pack(idx, hdr, hdr_len)) < 0) goto cleanup; idx->pack->mwf.size += hdr_len; entry->crc = crc32(entry->crc, hdr, (uInt)hdr_len); if ((error = git_zstream_deflatebuf(&buf, data, len)) < 0) goto cleanup; /* And then the compressed object */ if ((error = append_to_pack(idx, buf.ptr, buf.size)) < 0) goto cleanup; idx->pack->mwf.size += buf.size; entry->crc = htonl(crc32(entry->crc, (unsigned char *)buf.ptr, (uInt)buf.size)); git_buf_free(&buf); /* Write a fake trailer so the pack functions play ball */ if ((error = append_to_pack(idx, &foo, GIT_OID_RAWSZ)) < 0) goto cleanup; idx->pack->mwf.size += GIT_OID_RAWSZ; pentry = (git_pack_entry*) git__calloc(1, sizeof(struct git_pack_entry)); GITERR_CHECK_ALLOC(pentry); git_oid_cpy(&pentry->sha1, id); git_oid_cpy(&entry->oid, id); idx->off = entry_start + hdr_len + len; error = save_entry(idx, entry, pentry, entry_start); cleanup: if (error) { git__free(entry); git__free(pentry); } git_odb_object_free(obj); return error; }