Banajit Goswami | de8271c | 2017-01-18 00:28:59 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 and |
| 6 | * only version 2 as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | */ |
| 13 | |
| 14 | #ifndef __WCD_DSP_UTILS_H__ |
| 15 | #define __WCD_DSP_UTILS_H__ |
| 16 | |
| 17 | #define WDSP_IMG_NAME_LEN_MAX 64 |
| 18 | |
| 19 | #define WDSP_ELF_FLAG_EXECUTE (1 << 0) |
| 20 | #define WDSP_ELF_FLAG_WRITE (1 << 1) |
| 21 | #define WDSP_ELF_FLAG_READ (1 << 2) |
| 22 | |
| 23 | #define WDSP_ELF_FLAG_RE (WDSP_ELF_FLAG_READ | WDSP_ELF_FLAG_EXECUTE) |
| 24 | |
| 25 | struct wdsp_img_segment { |
| 26 | |
| 27 | /* Firmware for the slit image */ |
| 28 | const struct firmware *split_fw; |
| 29 | |
| 30 | /* Name of the split firmware file */ |
| 31 | char split_fname[WDSP_IMG_NAME_LEN_MAX]; |
| 32 | |
| 33 | /* Address where the segment is to be loaded */ |
| 34 | u32 load_addr; |
| 35 | |
| 36 | /* Buffer to hold the data to be loaded */ |
| 37 | u8 *data; |
| 38 | |
| 39 | /* Size of the data to be loaded */ |
| 40 | size_t size; |
| 41 | |
| 42 | /* List node pointing to next segment */ |
| 43 | struct list_head list; |
| 44 | }; |
| 45 | |
| 46 | int wdsp_get_segment_list(struct device *dev, const char *img_fname, |
| 47 | unsigned int segment_type, struct list_head *seg_list, |
| 48 | u32 *entry_point); |
| 49 | void wdsp_flush_segment_list(struct list_head *seg_list); |
| 50 | |
| 51 | #endif /* __WCD_DSP_UTILS_H__ */ |