source: rtems/c/src/lib/libbsp/powerpc/gen5200/bestcomm/load_task.c @ 82bd8d9d

4.104.114.9
Last change on this file since 82bd8d9d was 82bd8d9d, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on Sep 3, 2008 at 3:39:03 PM

Converted to use shared

exception and interrupt code.

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/******************************************************************************
2*
3* Copyright (c) 2004 Freescale Semiconductor, Inc.
4*
5* Permission is hereby granted, free of charge, to any person obtaining a
6* copy of this software and associated documentation files (the "Software"),
7* to deal in the Software without restriction, including without limitation
8* the rights to use, copy, modify, merge, publish, distribute, sublicense,
9* and/or sell copies of the Software, and to permit persons to whom the
10* Software is furnished to do so, subject to the following conditions:
11*
12* The above copyright notice and this permission notice shall be included
13* in all copies or substantial portions of the Software.
14*
15* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21* OTHER DEALINGS IN THE SOFTWARE.
22*
23******************************************************************************/
24
25#ifdef MPC5200_BAPI_LIBC_HEADERS
26#include <string.h>
27#endif
28
29#include "include/ppctypes.h"
30#include "include/mgt5200/sdma.h"
31#include "include/mgt5200/mgt5200.h"
32
33#include "dma_image.h"
34#include "bestcomm_api.h"
35
36#ifdef __MWERKS__
37__declspec(section ".text") extern const uint32 taskTable;
38__declspec(section ".text") extern const uint32 taskTableBytes;
39__declspec(section ".text") extern const uint32 taskTableTasks;
40__declspec(section ".text") extern const uint32 offsetEntry;
41#else
42extern const uint32 taskTable [];
43extern const uint32 taskTableBytes;
44extern const uint32 taskTableTasks;
45extern const uint32 offsetEntry;
46#endif
47
48typedef struct SCTDT {
49        uint32 start;
50        uint32 stop;
51        uint32 var;
52        uint32 fdt;
53        uint32 rsvd1;
54        uint32 rsvd2;
55        uint32 context;
56        uint32 litbase;
57} SCTDT_T;
58
59
60/*!
61 * \brief       Load BestComm tasks into SRAM.
62 * \param       sdma    Base address of the BestComm register set
63 *
64 * The BestComm tasks must be loaded before any task can be setup,
65 * enabled, etc. This might be called as part of a boot sequence before
66 * any BestComm drivers are required.
67 */
68void TasksLoadImage(sdma_regs *sdma)
69{
70        uint32 i;
71        SCTDT_T *tt;
72
73        /* copy task table from source to destination */
74        memcpy((void *)((uint8 *)(sdma->taskBar) - MBarPhysOffsetGlobal), taskTable, taskTableBytes);
75        /* adjust addresses in task table */
76        for (i=0; i < (uint32) taskTableTasks; i++) {
77                tt = (SCTDT_T *)(((uint8 *)(sdma->taskBar) - MBarPhysOffsetGlobal) + (uint32) offsetEntry + (i * sizeof (SCTDT_T)));
78                tt->start       += sdma->taskBar;
79                tt->stop        += sdma->taskBar;
80                tt->var         += sdma->taskBar;
81                tt->fdt         = (sdma->taskBar & 0xFFFFFF00) + tt->fdt;
82                tt->context     += sdma->taskBar;
83        }
84       
85        SramOffsetGlobal = taskTableBytes;
86}
Note: See TracBrowser for help on using the repository browser.