removed unnecessary lv1_hvcall.h include
[create_vflash7.git] / source / main.c
blob999f7155a550376320fbcd26a6196100818797ea
2 /*
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 #include <unistd.h>
19 #include <psl1ght/lv2/net.h>
21 #include <lv2_syscall.h>
22 #include <udp_printf.h>
24 #define VFLASH_DEV_ID 0x100000000000001ull
25 #define VFLASH_REGION_START_SECTOR 0x80000ull
26 #define VFLASH_REGION_SECTOR_COUNT 0x5000000ull /* 40GB for my beloved Linux */
27 #define VFLASH_REGION_LAID 0x1070000002000001ull
30 * main
32 int main(int argc, char **argv)
34 uint32_t dev_handle;
35 uint64_t region_id;
36 int result;
38 netInitialize();
40 udp_printf_init();
42 PRINTF("%s:%d: start\n", __func__, __LINE__);
44 dev_handle = 0;
46 result = lv2_storage_open(VFLASH_DEV_ID, &dev_handle);
47 if (result) {
48 PRINTF("%s:%d: lv2_storage_open failed (0x%08x)\n", __func__, __LINE__, result);
49 goto done;
52 result = lv2_storage_create_region(dev_handle, VFLASH_REGION_START_SECTOR, VFLASH_REGION_SECTOR_COUNT,
53 0, VFLASH_REGION_LAID, &region_id);
54 if (result) {
55 PRINTF("%s:%d: lv2_storage_create_region failed (0x%08x)\n", __func__, __LINE__, result);
56 goto done;
59 PRINTF("%s:%d: region_id (%d)\n", __func__, __LINE__, region_id);
61 PRINTF("%s:%d: end\n", __func__, __LINE__);
63 done:
65 result = lv2_storage_close(dev_handle);
66 if (result)
67 PRINTF("%s:%d: lv2_storage_close failed (0x%08x)\n", __func__, __LINE__, result);
69 udp_printf_deinit();
71 netDeinitialize();
73 return 0;