3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * This file is based on code
6 * (C) Copyright Motorola, Inc., 2000
12 /* BestComm/SmartComm microcode */
15 void loadtask(int basetask
, int tasks
)
17 int *sram
= (int *)MPC5XXX_SRAM
;
18 int *task_org
= &taskTable
;
19 unsigned int start
, offset
, end
;
23 printf("basetask = %d, tasks = %d\n", basetask
, tasks
);
24 printf("task_org = 0x%08x\n", (unsigned int)task_org
);
27 /* setup TaskBAR register */
28 *(vu_long
*)MPC5XXX_SDMA
= MPC5XXX_SRAM
;
30 /* relocate task table entries */
31 offset
= (unsigned int)sram
;
32 for (i
= basetask
; i
< basetask
+ tasks
; i
++) {
33 sram
[i
* 8 + 0] = task_org
[i
* 8 + 0] + offset
;
34 sram
[i
* 8 + 1] = task_org
[i
* 8 + 1] + offset
;
35 sram
[i
* 8 + 2] = task_org
[i
* 8 + 2] + offset
;
36 sram
[i
* 8 + 3] = task_org
[i
* 8 + 3] + offset
;
37 sram
[i
* 8 + 4] = task_org
[i
* 8 + 4];
38 sram
[i
* 8 + 5] = task_org
[i
* 8 + 5];
39 sram
[i
* 8 + 6] = task_org
[i
* 8 + 6] + offset
;
40 sram
[i
* 8 + 7] = task_org
[i
* 8 + 7];
43 /* relocate task descriptors */
44 start
= (sram
[basetask
* 8] - (unsigned int)sram
);
45 end
= (sram
[(basetask
+ tasks
- 1) * 8 + 1] - (unsigned int)sram
);
48 printf ("TDT start = 0x%08x, end = 0x%08x\n", start
, end
);
53 for (i
= start
; i
<= end
; i
++) {
54 sram
[i
] = task_org
[i
];
57 /* relocate variables */
58 start
= (sram
[basetask
* 8 + 2] - (unsigned int)sram
);
59 end
= (sram
[(basetask
+ tasks
- 1) * 8 + 2] + 256 - (unsigned int)sram
);
62 for (i
= start
; i
< end
; i
++) {
63 sram
[i
] = task_org
[i
];
66 /* relocate function decriptors */
67 start
= ((sram
[basetask
* 8 + 3] & 0xfffffffc) - (unsigned int)sram
);
68 end
= ((sram
[(basetask
+ tasks
- 1) * 8 + 3] & 0xfffffffc) + 256 - (unsigned int)sram
);
71 for (i
= start
; i
< end
; i
++) {
72 sram
[i
] = task_org
[i
];
75 asm volatile ("sync");