File indexing completed on 2025-05-11 08:23:46
0001
0002
0003
0004
0005
0006
0007 #ifndef _MCD_API_H
0008 #define _MCD_API_H
0009
0010
0011
0012
0013 #define MCD_INCLUDE_EU
0014
0015
0016
0017
0018 #define NCHANNELS 16
0019
0020
0021
0022
0023 #ifdef MCD_INCLUDE_EU
0024 #define NUMOFVARIANTS 6
0025 #else
0026 #define NUMOFVARIANTS 4
0027 #endif
0028
0029
0030
0031
0032 #define TASK_TABLE_SIZE (NCHANNELS*32)
0033 #define VAR_TAB_SIZE (128)
0034 #define CONTEXT_SAVE_SIZE (128)
0035 #define FUNCDESC_TAB_SIZE (256)
0036
0037 #ifdef MCD_INCLUDE_EU
0038 #define FUNCDESC_TAB_NUM 16
0039 #else
0040 #define FUNCDESC_TAB_NUM 1
0041 #endif
0042
0043
0044 #ifndef DEFINESONLY
0045
0046
0047
0048
0049 typedef int s32;
0050 typedef unsigned int u32;
0051 typedef short s16;
0052 typedef unsigned short u16;
0053 typedef char s8;
0054 typedef unsigned char u8;
0055
0056
0057
0058
0059
0060 struct dmaRegs_s {
0061 u32 taskbar;
0062 u32 currPtr;
0063 u32 endPtr;
0064 u32 varTablePtr;
0065 u16 dma_rsvd0;
0066 u16 ptdControl;
0067 u32 intPending;
0068 u32 intMask;
0069 u16 taskControl[16];
0070 u8 priority[32];
0071 u32 initiatorMux;
0072 u32 taskSize0;
0073 u32 taskSize1;
0074 u32 dma_rsvd1;
0075 u32 dma_rsvd2;
0076 u32 debugComp1;
0077 u32 debugComp2;
0078 u32 debugControl;
0079 u32 debugStatus;
0080 u32 ptdDebug;
0081 u32 dma_rsvd3[31];
0082 };
0083 typedef volatile struct dmaRegs_s dmaRegs;
0084
0085 #endif
0086
0087
0088
0089
0090 #define PTD_CTL_TSK_PRI 0x8000
0091 #define PTD_CTL_COMM_PREFETCH 0x0001
0092
0093
0094
0095
0096 #define TASK_CTL_EN 0x8000
0097 #define TASK_CTL_VALID 0x4000
0098 #define TASK_CTL_ALWAYS 0x2000
0099 #define TASK_CTL_INIT_MASK 0x1f00
0100 #define TASK_CTL_ASTRT 0x0080
0101 #define TASK_CTL_HIPRITSKEN 0x0040
0102 #define TASK_CTL_HLDINITNUM 0x0020
0103 #define TASK_CTL_ASTSKNUM_MASK 0x000f
0104
0105
0106
0107
0108 #define PRIORITY_HLD 0x80
0109 #define PRIORITY_PRI_MASK 0x07
0110
0111
0112
0113
0114 #define DBG_CTL_BLOCK_TASKS_MASK 0xffff0000
0115 #define DBG_CTL_AUTO_ARM 0x00008000
0116 #define DBG_CTL_BREAK 0x00004000
0117 #define DBG_CTL_COMP1_TYP_MASK 0x00003800
0118 #define DBG_CTL_COMP2_TYP_MASK 0x00000070
0119 #define DBG_CTL_EXT_BREAK 0x00000004
0120 #define DBG_CTL_INT_BREAK 0x00000002
0121
0122
0123
0124
0125
0126
0127 #define PTD_DBG_REQ 0x00
0128 #define PTD_DBG_TSK_VLD_INIT 0x01
0129
0130
0131
0132
0133
0134
0135 #define MCD_OK 0
0136 #define MCD_ERROR -1
0137 #define MCD_TABLE_UNALIGNED -2
0138 #define MCD_CHANNEL_INVALID -3
0139
0140
0141
0142
0143 #define MCD_RELOC_TASKS 0x00000001
0144 #define MCD_NO_RELOC_TASKS 0x00000000
0145 #define MCD_COMM_PREFETCH_EN 0x00000002
0146
0147
0148
0149
0150 #define MCD_NO_DMA 1
0151 #define MCD_IDLE 2
0152 #define MCD_RUNNING 3
0153 #define MCD_PAUSED 4
0154 #define MCD_HALTED 5
0155 #define MCD_DONE 6
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166 #define MCD_NO_BYTE_SWAP 0x00045670
0167 #define MCD_BYTE_REVERSE 0x00076540
0168 #define MCD_U16_REVERSE 0x00067450
0169
0170 #define MCD_U16_BYTE_REVERSE 0x00054760
0171
0172 #define MCD_NO_BIT_REV 0x00000000
0173 #define MCD_BIT_REV 0x00088880
0174
0175 #define MCD_CRC16 0xc0100000
0176 #define MCD_CRCCCITT 0xc0200000
0177 #define MCD_CRC32 0xc0300000
0178 #define MCD_CSUMINET 0xc0400000
0179 #define MCD_NO_CSUM 0xa0000000
0180
0181 #define MCD_FUNC_NOEU1 (MCD_NO_BYTE_SWAP | MCD_NO_BIT_REV | MCD_NO_CSUM)
0182 #define MCD_FUNC_NOEU2 (MCD_NO_BYTE_SWAP | MCD_NO_CSUM)
0183
0184
0185
0186
0187 #define MCD_TT_FLAGS_RL 0x00000001
0188 #define MCD_TT_FLAGS_CW 0x00000002
0189 #define MCD_TT_FLAGS_SP 0x00000004
0190 #define MCD_TT_FLAGS_MASK 0x000000ff
0191 #define MCD_TT_FLAGS_DEF (MCD_TT_FLAGS_RL | MCD_TT_FLAGS_CW)
0192
0193 #define MCD_SINGLE_DMA 0x00000100
0194 #define MCD_CHAIN_DMA
0195 #define MCD_EU_DMA
0196 #define MCD_FECTX_DMA 0x00001000
0197 #define MCD_FECRX_DMA 0x00002000
0198
0199
0200
0201 #define MCD_BUF_READY 0x80000000
0202 #define MCD_WRAP 0x20000000
0203 #define MCD_INTERRUPT 0x10000000
0204 #define MCD_END_FRAME 0x08000000
0205
0206 #define MCD_CRC_RESTART 0x40000000
0207
0208
0209
0210 #define MCD_FEC_BUF_READY 0x8000
0211 #define MCD_FEC_WRAP 0x2000
0212 #define MCD_FEC_INTERRUPT 0x1000
0213 #define MCD_FEC_END_FRAME 0x0800
0214
0215
0216
0217
0218
0219
0220 #define MCD_TRUE 1
0221 #define MCD_FALSE 0
0222
0223
0224
0225
0226 #define MINUS1 -1
0227 #define ZERO 0
0228 #define PLUS1 1
0229
0230 #ifndef DEFINESONLY
0231
0232
0233 typedef struct {
0234 u32 TDTstart;
0235 u32 TDTend;
0236 u32 varTab;
0237 u32 FDTandFlags;
0238 volatile u32 descAddrAndStatus;
0239 volatile u32 modifiedVarTab;
0240 u32 contextSaveSpace;
0241 u32 literalBases;
0242 } TaskTableEntry;
0243
0244
0245
0246 typedef volatile struct MCD_bufDesc_struct MCD_bufDesc;
0247 struct MCD_bufDesc_struct {
0248 u32 flags;
0249 u32 csumResult;
0250 s8 *srcAddr;
0251 s8 *destAddr;
0252 s8 *lastDestAddr;
0253 u32 dmaSize;
0254 MCD_bufDesc *next;
0255 u32 info;
0256 };
0257
0258
0259 typedef volatile struct MCD_XferProg_struct {
0260 s8 *lastSrcAddr;
0261 s8 *lastDestAddr;
0262 u32 dmaSize;
0263 MCD_bufDesc *currBufDesc;
0264 } MCD_XferProg;
0265
0266
0267
0268 typedef volatile struct MCD_bufDescFec_struct {
0269 u16 statCtrl;
0270 u16 length;
0271 u32 dataPointer;
0272 } MCD_bufDescFec;
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283 int MCD_startDma (
0284 int channel,
0285 s8 *srcAddr,
0286 s16 srcIncr,
0287 s8 *destAddr,
0288 s16 destIncr,
0289 u32 dmaSize,
0290 u32 xferSize,
0291 u32 initiator,
0292 int priority,
0293 u32 flags,
0294 u32 funcDesc
0295 );
0296
0297
0298
0299
0300
0301
0302 int MCD_initDma (dmaRegs *sDmaBarAddr, void *taskTableDest, u32 flags);
0303
0304
0305
0306
0307 int MCD_dmaStatus (int channel);
0308
0309
0310
0311
0312 int MCD_XferProgrQuery (int channel, MCD_XferProg *progRep);
0313
0314
0315
0316
0317
0318 int MCD_killDma (int channel);
0319
0320
0321
0322
0323
0324 int MCD_continDma (int channel);
0325
0326
0327
0328
0329
0330 int MCD_pauseDma (int channel);
0331
0332
0333
0334
0335
0336 int MCD_resumeDma (int channel);
0337
0338
0339
0340
0341 int MCD_csumQuery (int channel, u32 *csum);
0342
0343
0344
0345
0346
0347 int MCD_getCodeSize(void);
0348
0349
0350
0351
0352
0353 int MCD_getVersion(char **longVersion);
0354
0355
0356 #define MCD_SET_VAR(taskTab,idx,value) ((u32 *)(taskTab)->varTab)[idx] = value
0357
0358
0359
0360 #endif
0361
0362 #endif