root/trunk/libffado/src/dice/dice_firmware_loader.h

Revision 2802, 5.2 kB (checked in by jwoithe, 3 years ago)

Cosmetic: "Firewire" becomes "FireWire?".

Officially both the "F" and "W" were capitalised in the FireWire? name, so
reflect this throughout FFADO's source tree. This mostly affects comments.

This patch originated from pander on the ffado-devel mailing list. To
maintain consistency, the committed version has been expanded to include
files not originally included in the original patch.

Line 
1 /*
2  * Copyright (C) 2012 by Peter Hinkel
3  *
4  * This file is part of FFADO
5  * FFADO = Free FireWire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB
8  *
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.
13  *
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.
18  *
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/>.
21  *
22  * Implementation of the DICE firmware loader specification based upon
23  * TCAT public available document v3.2.0.0 (2008-06-20)
24  *
25  */
26
27 #ifndef __DICE_FIRMWARE_LOADER_H__
28 #define __DICE_FIRMWARE_LOADER_H__
29
30 #include <stdint.h>
31 #include "dice_defines.h"
32
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)
36
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
47
48 #define DICE_FL_BUFFER                  0x34 //offset for Upload buffer
49
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
64
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
73
74 /* data structure #defines */
75 #define MAX_IMAGE_NAME  16
76
77 /* data structures input parameters */
78 typedef struct {
79         uint32_t        length;
80         uint32_t        execAddr;
81         uint32_t        entryAddr;
82         char            name[MAX_IMAGE_NAME];
83 } DICE_FL_CREATE_IMAGE_PARAM;
84
85 typedef struct {
86         char            name[MAX_IMAGE_NAME];
87 } DICE_FL_DELETE_IMAGE_PARAM;
88
89 //decomposition of upload parameter due to limited transfer-bandwidth (max 128 quadlets = 512 bytes)
90 //header part of upload parameter
91 typedef struct {
92         uint32_t        index;
93         uint32_t        length;
94 } DICE_FL_UPLOAD_HEADER_PARAM;
95
96 //data part of upload parameter
97 typedef struct {
98         uint32_t        buffer[128];
99 } DICE_FL_UPLOAD_DATA_PARAM;
100
101 typedef struct {
102         uint32_t        cmdID;
103         uint32_t        lvalue0;
104         uint32_t        lvalue1;
105 } DICE_FL_TEST_ACTION_PARAM;
106
107 typedef struct {
108         uint32_t uiStartAddress;
109         uint32_t uiEndAddress;
110         uint32_t uiNumBlocks;
111         uint32_t uiBlockSize;
112 } DICE_FL_INFO_PARAM;
113
114 typedef struct {
115         uint32_t uiStartAddress;
116         uint32_t uiLen;
117         char ReadBuffer[500]/*[4000]*/;
118 } DICE_FL_READ_MEMORY;
119
120 /* data structures output parameters */
121 typedef struct {
122         char            name[MAX_IMAGE_NAME];
123         uint32_t        flashBase;
124         uint32_t        memBase;
125         uint32_t        size;
126         uint32_t        entryPoint;
127         uint32_t        length;
128         uint32_t        chkSum;
129         uint32_t        uiBoardSerialNumber;
130         uint32_t        uiVersionHigh;
131         uint32_t        uiVersionLow;
132         uint32_t        uiConfigurationFlags;
133         char            BuildTime[64];
134         char            BuildDate[64];
135 } DICE_FL_GET_IMAGE_DESC_RETURN;
136
137 typedef struct {
138         uint32_t        uiProductID;
139         char            uiVendorID[8];
140         uint32_t        uiVMajor;
141         uint32_t        uiVMinor;
142         uint32_t        user1;
143         uint32_t        user2;
144 } DICE_FL_GET_VENDOR_IMAGE_DESC_RETURN;
145
146 typedef struct {
147         uint32_t        data[100];
148 } DICE_FL_TEST_ACTION_RETURN;
149
150 typedef struct
151 {
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;
160
161 #endif
Note: See TracBrowser for help on using the browser.