Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:52

0001 #ifndef __TASK_API_TASKSETUP_BDTABLE_H
0002 #define __TASK_API_TASKSETUP_BDTABLE_H 1
0003 
0004 /******************************************************************************
0005 *
0006 * Copyright (c) 2004 Freescale Semiconductor, Inc.
0007 *
0008 * Permission is hereby granted, free of charge, to any person obtaining a
0009 * copy of this software and associated documentation files (the "Software"),
0010 * to deal in the Software without restriction, including without limitation
0011 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0012 * and/or sell copies of the Software, and to permit persons to whom the
0013 * Software is furnished to do so, subject to the following conditions:
0014 *
0015 * The above copyright notice and this permission notice shall be included
0016 * in all copies or substantial portions of the Software.
0017 *
0018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0019 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0020 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
0021 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
0022 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0023 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0024 * OTHER DEALINGS IN THE SOFTWARE.
0025 *
0026 ******************************************************************************/
0027 
0028 /*
0029  * Table of BD rings for all BestComm tasks indexed by task ID.
0030  *
0031  *    +-----+------+--------------+    +------+-------+
0032  * 0: |numBD|numPtr|BDTablePtr ---|--->|status|dataPtr|
0033  *    +-----+------+--------------+    +------+-------+
0034  * 1: |numBD|numPtr|BDTablePtr    |    |status|dataPtr|
0035  *    +-----+------+--------------+    .      .       .
0036  * 2: |numBD|numPtr|BDTablePtr ---|-+  .      .       .
0037  *    .            .              . |  .      .       .
0038  *    .            .              . |  |status|dataPtr|
0039  *    .            .              . |  +------+-------+
0040  * 15:|numBD|numPtr|BDTablePtr    | |
0041  *    +-----+------+--------------+ |
0042  *                                  |
0043  *                                  V
0044  *                                  +------+--------+--------+
0045  *                                  |status|dataPtr0|dataPtr1|
0046  *                                  +------+--------+--------+
0047  *                                  |status|dataPtr0|dataPtr1|
0048  *                                  .      .        .        .
0049  *                                  .      .        .        .
0050  *                                  .      .        .        .
0051  *                                  |status|dataPtr0|dataPtr1|
0052  *                                  +------+--------+--------+
0053  */
0054 typedef struct {
0055     uint16 numBD;       /* Size of BD ring                                  */
0056     uint8  numPtr;      /* Number of data buffer pointers per BD            */
0057     uint8  apiConfig;   /* API configuration flags                          */
0058     void   *BDTablePtr; /* Pointer to BD tables, must be cast to TaskBD1_t  */
0059                         /*   or TaskBD2_t                                   */
0060     volatile uint32
0061            *BDStartPtr; /* Task's current BD pointer. This pointer is
0062                          * used to set a task's BD pointer upon startup.
0063                          * It is only valid for BD tasks and only after
0064                          * TaskSetup() or TaskBDReset() are called. You
0065                          * cannot use this to track a task's BD pointer.
0066                          */
0067     uint16 currBDInUse; /* Current number of buffer descriptors assigned but*/
0068                         /*   not released yet.                              */
0069 } TaskBDIdxTable_t;
0070 
0071 typedef enum {
0072     API_CONFIG_NONE     = 0x00,
0073     API_CONFIG_BD_FLAG  = 0x01
0074 } ApiConfig_t;
0075 
0076 /*
0077  * Allocates BD table if needed and updates the BD index table.
0078  * Do we want to hide this from the C API since it operates on task API?
0079  */
0080 void TaskSetup_BDTable(volatile uint32 *BasePtr,
0081                        volatile uint32 *LastPtr,
0082                        volatile uint32 *StartPtr,
0083                        int TaskNum, uint32 NumBD, uint16 MaxBD,
0084                        uint8 NumPtr, ApiConfig_t ApiConfig, uint32 Status );
0085 
0086 #endif  /* __TASK_API_TASKSETUP_BDTABLE_H */