RTEMS  5.1
tasksetup_bdtable.h
1 #ifndef __TASK_API_TASKSETUP_BDTABLE_H
2 #define __TASK_API_TASKSETUP_BDTABLE_H 1
3 
4 /******************************************************************************
5 *
6 * Copyright (c) 2004 Freescale Semiconductor, Inc.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
25 *
26 ******************************************************************************/
27 
28 /*
29  * Table of BD rings for all BestComm tasks indexed by task ID.
30  *
31  * +-----+------+--------------+ +------+-------+
32  * 0: |numBD|numPtr|BDTablePtr ---|--->|status|dataPtr|
33  * +-----+------+--------------+ +------+-------+
34  * 1: |numBD|numPtr|BDTablePtr | |status|dataPtr|
35  * +-----+------+--------------+ . . .
36  * 2: |numBD|numPtr|BDTablePtr ---|-+ . . .
37  * . . . | . . .
38  * . . . | |status|dataPtr|
39  * . . . | +------+-------+
40  * 15:|numBD|numPtr|BDTablePtr | |
41  * +-----+------+--------------+ |
42  * |
43  * V
44  * +------+--------+--------+
45  * |status|dataPtr0|dataPtr1|
46  * +------+--------+--------+
47  * |status|dataPtr0|dataPtr1|
48  * . . . .
49  * . . . .
50  * . . . .
51  * |status|dataPtr0|dataPtr1|
52  * +------+--------+--------+
53  */
54 typedef struct {
55  uint16 numBD; /* Size of BD ring */
56  uint8 numPtr; /* Number of data buffer pointers per BD */
57  uint8 apiConfig; /* API configuration flags */
58  void *BDTablePtr; /* Pointer to BD tables, must be cast to TaskBD1_t */
59  /* or TaskBD2_t */
60  volatile uint32
61  *BDStartPtr; /* Task's current BD pointer. This pointer is
62  * used to set a task's BD pointer upon startup.
63  * It is only valid for BD tasks and only after
64  * TaskSetup() or TaskBDReset() are called. You
65  * cannot use this to track a task's BD pointer.
66  */
67  uint16 currBDInUse; /* Current number of buffer descriptors assigned but*/
68  /* not released yet. */
70 
71 typedef enum {
72  API_CONFIG_NONE = 0x00,
73  API_CONFIG_BD_FLAG = 0x01
74 } ApiConfig_t;
75 
76 /*
77  * Allocates BD table if needed and updates the BD index table.
78  * Do we want to hide this from the C API since it operates on task API?
79  */
80 void TaskSetup_BDTable(volatile uint32 *BasePtr,
81  volatile uint32 *LastPtr,
82  volatile uint32 *StartPtr,
83  int TaskNum, uint32 NumBD, uint16 MaxBD,
84  uint8 NumPtr, ApiConfig_t ApiConfig, uint32 Status );
85 
86 #endif /* __TASK_API_TASKSETUP_BDTABLE_H */
Definition: tasksetup_bdtable.h:54