diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2010-08-02 12:17:57 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-08-02 12:17:57 +0200 |
commit | 2c36d3842c83b21e0e15b79d3703b4df30bb202d (patch) | |
tree | 7cb6ce9530054724ad2e9061f5067b1db24c16ba /sdma-gen-image.c | |
parent | 97c2296ca448500e1a09b9bb03483659fb8543f8 (diff) | |
download | sdma-firmware-2c36d3842c83b21e0e15b79d3703b4df30bb202d.tar.gz sdma-firmware-2c36d3842c83b21e0e15b79d3703b4df30bb202d.tar.xz |
add i.MX51/25 support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'sdma-gen-image.c')
-rw-r--r-- | sdma-gen-image.c | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/sdma-gen-image.c b/sdma-gen-image.c index a63e669..848b312 100644 --- a/sdma-gen-image.c +++ b/sdma-gen-image.c @@ -1,18 +1,40 @@ +/* + * sdma-gen-image - generate Freescale i.MX SDMA firmware images suitable + * for Linux + * + * Copyright (c) 2010 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> +#include <endian.h> #include "sdma-firmware.h" - static struct sdma_firmware *firmwares[] = { + &sdma_imx25_v1, &sdma_imx31_v1, &sdma_imx31_v2, &sdma_imx35_v1, &sdma_imx35_v2, + &sdma_imx51_v1, }; static int gen_one(struct sdma_firmware *fw) @@ -22,20 +44,20 @@ static int gen_one(struct sdma_firmware *fw) char *name; FILE *f; - printf("name: %s %d\n", fw->name); - - header.magic = 0x414d4453; - header.version_major = 1; - header.version_minor = fw->version; - header.script_addrs_start = sizeof(header); - header.num_script_addrs = sizeof(struct sdma_script_start_addrs) / sizeof(uint32_t); - header.ram_code_start = header.script_addrs_start + sizeof(struct sdma_script_start_addrs); - header.ram_code_size = fw->blob_size * sizeof(uint16_t); - ret = asprintf(&name, "%s.bin", fw->name); if (ret < 0) return ret; + printf("generating %s\n", name); + + header.magic = htole32(SDMA_FIRMWARE_MAGIC); + header.version_major = htole32(1); + header.version_minor = htole32(fw->version); + header.script_addrs_start = htole32(sizeof(header)); + header.num_script_addrs = htole32(sizeof(struct sdma_script_start_addrs) / sizeof(uint32_t)); + header.ram_code_start = htole32(header.script_addrs_start + sizeof(struct sdma_script_start_addrs)); + header.ram_code_size = htole32(fw->blob_size * sizeof(uint16_t)); + f = fopen(name, "w"); if (!f) { perror("fopen"); |