2 * Copyright (C) 2012 by Peter Hinkel
4 * This file is part of FFADO
5 * FFADO = Free Firewire (pro-)audio drivers for linux
7 * FFADO is based upon FreeBoB
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 2 of the License, or
12 * (at your option) version 3 of the License.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 * Implementation of the DICE firmware loader specification based upon
23 * TCAT public available document v3.2.0.0 (2008-06-20)
27 #ifndef __DICE_FIRMWARE_LOADER_H__
28 #define __DICE_FIRMWARE_LOADER_H__
31 #include "dice_defines.h"
33 /* private memory space offset for command interface */
34 #define DICE_FL_INTERFACE_SPACE 0x0000FFFFE0100000ULL
35 #define DICE_FL_OFFSET (DICE_FL_INTERFACE_SPACE ^ DICE_REGISTER_BASE)
37 /* memory space offsets relative to DICE_FL_INTERFACE_SPACE */
38 #define DICE_FL_VERSION 0x0 //unused
39 #define DICE_FL_OPCODE 0x4
40 #define DICE_FL_RETURN_STATUS 0x8
41 #define DICE_FL_PROGRESS 0xC
42 #define DICE_FL_CAPABILITIES 0x10
43 #define DICE_FL_RESERVED 0x14 //unused
44 #define DICE_FL_PARAMETER 0x2C
45 #define DICE_FL_TESTDELAY 0xFD8
46 #define DICE_FL_TESTBUF 0xFDC
48 #define DICE_FL_BUFFER 0x34 //offset for Upload buffer
50 /* Opcode IDs for implemented functions (firmware dependent) */
51 #define DICE_FL_OP_GET_IMAGE_DESC 0x0 // parameters: imageId return: imageDesc
52 #define DICE_FL_OP_DELETE_IMAGE 0x1 // parameters: name return: none
53 #define DICE_FL_OP_CREATE_IMAGE 0x2 // parameters: execAddr, entryAddr, name return: none
54 #define DICE_FL_OP_UPLOAD 0x3 // parameters: index, length, data, return none
55 #define DICE_FL_OP_UPLOAD_STAT 0x4 // parameters: length return checksum
56 #define DICE_FL_OP_RESET_IMAGE 0x5 // parameters: none
57 #define DICE_FL_OP_TEST_ACTION 0x6 // parameters: none
58 #define DICE_FL_OP_GET_FLASH_INFO 0x7 // parameters: none
59 #define DICE_FL_OP_READ_MEMORY 0x8 // parameters: none
60 #define DICE_FL_OP_NOOP 0x9 // parameters: none
61 #define DICE_FL_OP_GET_RUNNING_IMAGE_VINFO 0xA // parameters: none return: vendorInfo
62 #define DICE_FL_OP_CREATE_IMAGE2 0xB // parameters: none return: vendorInfo
63 #define DICE_FL_OP_GET_APP_INFO 0xC // parameters: none return: new info structure
65 /* return status #defines */
66 #define DICE_FL_RETURN_NO_ERROR 0x00000000 //Operation successful
67 #define DICE_FL_E_GEN_NOMATCH 0xFF000000 //for Opcode ID: 0x0
68 #define DICE_FL_E_FIS_ILLEGAL_IMAGE 0xC5000001 //for Opcode ID: 0x1, 0x2
69 //#define DICE_FL_E_FIS_FLASH_OP_FAILED 0x00000000 //for Opcode ID: 0x1, 0x2
70 //#define DICE_FL_E_FIS_NO_SPACE 0x00000000 //for Opcode ID: 0x2
71 #define DICE_FL_E_BAD_INPUT_PARAM 0xC3000003 //for Opcode ID: 0x3
72 //#define DICE_FL_E_FAIL 0x00000000 //for Opcode ID: 0x6
74 /* data structure #defines */
75 #define MAX_IMAGE_NAME 16
77 /* data structures input parameters */
82 char name
[MAX_IMAGE_NAME
];
83 } DICE_FL_CREATE_IMAGE_PARAM
;
86 char name
[MAX_IMAGE_NAME
];
87 } DICE_FL_DELETE_IMAGE_PARAM
;
89 //decomposition of upload parameter due to limited transfer-bandwidth (max 128 quadlets = 512 bytes)
90 //header part of upload parameter
94 } DICE_FL_UPLOAD_HEADER_PARAM
;
96 //data part of upload parameter
99 } DICE_FL_UPLOAD_DATA_PARAM
;
105 } DICE_FL_TEST_ACTION_PARAM
;
108 uint32_t uiStartAddress
;
109 uint32_t uiEndAddress
;
110 uint32_t uiNumBlocks
;
111 uint32_t uiBlockSize
;
112 } DICE_FL_INFO_PARAM
;
115 uint32_t uiStartAddress
;
117 char ReadBuffer
[500]/*[4000]*/;
118 } DICE_FL_READ_MEMORY
;
120 /* data structures output parameters */
122 char name
[MAX_IMAGE_NAME
];
129 uint32_t uiBoardSerialNumber
;
130 uint32_t uiVersionHigh
;
131 uint32_t uiVersionLow
;
132 uint32_t uiConfigurationFlags
;
135 } DICE_FL_GET_IMAGE_DESC_RETURN
;
138 uint32_t uiProductID
;
144 } DICE_FL_GET_VENDOR_IMAGE_DESC_RETURN
;
148 } DICE_FL_TEST_ACTION_RETURN
;
152 uint32_t uiBaseSDKVersion
; //The full version/revision of the SDK this build was based on
153 uint32_t uiApplicationVersion
; //The full version/revision of the Application
154 uint32_t uiVendorID
; //The Vendor ID
155 uint32_t uiProductID
; //The product ID
156 char BuildTime
[64]; //Build time
157 char BuildDate
[64]; //Build date
158 uint32_t uiBoardSerialNumber
; //The serial number of the board as obtained from persist. storage
159 } DICE_FL_GET_APP_INFO_RETURN
;