Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Unified Diff: host/lib/fmap.c

Issue 6465018: Add load_firmware_test utility program (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: Code review Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « host/include/fmap.h ('k') | utility/Makefile » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: host/lib/fmap.c
diff --git a/host/lib/fmap.c b/host/lib/fmap.c
new file mode 100644
index 0000000000000000000000000000000000000000..3c3f340bc53a018edf2b6ae6e28fac28d1308dd1
--- /dev/null
+++ b/host/lib/fmap.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include "fmap.h"
+
+const char* FmapFind(const char* ptr, size_t size)
+{
+ size_t i;
+ for (i=0; i<size; i += FMAP_SEARCH_STRIDE) {
+ if (0 == strncmp(ptr, FMAP_SIGNATURE, FMAP_SIGNATURE_SIZE))
+ return ptr;
+ ptr += FMAP_SEARCH_STRIDE;
+ }
+ return NULL;
+}
+
+int FmapAreaIndex(const FmapHeader* fh, const FmapAreaHeader* ah,
+ const char* name) {
+ int i;
+ for (i = 0; i < fh->fmap_nareas; i++)
+ if (!strcmp((const char*) ah[i].area_name, name))
+ return i;
+ return -1;
+}
« no previous file with comments | « host/include/fmap.h ('k') | utility/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698