/* * JR-IDE Project * - (c) 2017 Alan Hightower * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * 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, see . */ #ifndef __MACHXO2_INTERNAL_H__ #define __MACHXO2_INTERNAL_H__ #include "machxo2_api.h" typedef enum { MachXO2_256, MachXO2_640, MachXO2_1200, MachXO2_2000, MachXO2_4000, MachXO2_7000, MachXO2_DEVICE_COUNT } MachXO2_DEVICES; // Device parameters needed for accessing and programming. typedef struct _xo2_info { const char *name; // XO2 device name int pages_cfg; // Total count of configuration pages int pages_ufm; // Total count of user flash memory pages int cfg_erase; // Configuration sector erase time in milliseconds int ufm_erase; // UFM sector erase time in milliseconds int trefresh; // Programming time in seconds following refresh uint32_t heze_id; // Device ID for HE and ZE parts uint32_t hc_id; // Device ID for HC parts } xo2_info_t; /* * Database of XO2 device parameters needed for accessing, erasing * and programming the configuration and UFM sectors in different * sized XO2 parts. */ const xo2_info_t xo2_device_info[MachXO2_DEVICE_COUNT] = { { "MachXO2-256", 575, 0, 700, 0, 1, 0x012b0043, 0x012b8043 }, { "MachXO2-640", 1151, 191, 1100, 600, 1, 0x012b1043, 0x012b9043 }, { "MachXO2-1200", 2175, 511, 1400, 700, 1, 0x012b2043, 0x012ba043 }, { "MachXO2-2000", 3198, 639, 1900, 900, 2, 0x012b3043, 0x012bb043 }, { "MachXO2-4000", 5758, 767, 3100, 1000, 3, 0x012b4043, 0x012bc043 }, { "MachXO2-7000", 9212, 2046, 4800, 1600, 4, 0x012b5043, 0x012bd043 } }; #define XO2_PAGE_SIZE 16 // bytes // JPF format typedef struct _st_machxo2_hdr { uint32_t magic; #define MACHXO2_IMAGE_HDR_MAGIC 0x92a8b3f1 uint32_t device_id; uint32_t user_code; uint32_t cfg_pages; uint32_t ufm_pages; uint8_t feature_row[8]; uint8_t feature_bits[2]; uint8_t reserved[2]; } __attribute__((packed)) machxo2_hdr_t; #endif