亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? dpram8xx.c

?? 這是單板上DPRAM的驅動程序
?? C
字號:
/* @(#) pSOSystem PowerPC/V2.2.2: bsps/e360/src/dpram360.c (mpc8xx) 2.7 97/07/31 18:35:55 */
/***********************************************************************/
/*                                                                     */
/*   MODULE: bsps/devices/icontrol/dpram8xx.c                          */
/*   DATE:    97/07/31                                                 */
/*   PURPOSE: MPC8xx dual ported RAM management functions              */
/*                                                                     */
/*---------------------------------------------------------------------*/
/*                                                                     */
/*           Copyright 1991 - 1997, Integrated Systems, Inc.           */
/*                      ALL RIGHTS RESERVED                            */
/*                                                                     */
/*   Permission is hereby granted to licensees of Integrated Systems,  */
/*   Inc. products to use or abstract this computer program for the    */
/*   sole purpose of implementing a product based on Integrated        */
/*   Systems, Inc. products.   No other rights to reproduce, use,      */
/*   or disseminate this computer program, whether in part or in       */
/*   whole, are granted.                                               */
/*                                                                     */
/*   Integrated Systems, Inc. makes no representation or warranties    */
/*   with respect to the performance of this computer program, and     */
/*   specifically disclaims any responsibility for any damages,        */
/*   special or consequential, connected with the use of this program. */
/*                                                                     */
/*---------------------------------------------------------------------*/
/*                                                                     */
/*                                                                     */
/*                                                                     */
/***********************************************************************/

#include "board.h"
#include <icontrol/mpc8xx.h>

#ifdef DEBUG
#undef DEBUG
#endif
#ifndef  ALIGN
#define ALIGN(addr, boundary) (((ULONG)(addr)+(ULONG)(boundary)-1) \
                               & ~((ULONG)(boundary)-1))
#endif

/*---------------------------------------------------------------------*/
/* THESE CONSTANTS ARE RELATED TO THE BIT-MAPPED MEMORY ALLOCATOR.     */
/*---------------------------------------------------------------------*/
#define BYTES_TO_ALLOC  4*1024     /*  Number of DPRAM bytes to manage */
#define CHUNK_SIZE      8          /*  Allocation size (DO NOT CHANGE) */
#define BITS_PER_UNIT   8          /*  Number of bits per bitmap unit  */

/*---------------------------------------------------------------------*/
/* DPRAM Bitmap table: one bit in the bitmap represents CHUNK_SIZE     */
/* bytes, which is the minimum size that can be allocated.             */
/*---------------------------------------------------------------------*/
static UCHAR bitmap[MAX_QUICCS][BYTES_TO_ALLOC / (CHUNK_SIZE * BITS_PER_UNIT)];

extern ULONG dpram_base[];
extern ULONG quicc_num[];

void dpram_init(void);
UCHAR *dpram_alloc(UINT, UINT);
void dpram_dealloc(UINT, UCHAR *, UINT);
static void bit_set(UCHAR *, UINT);
static void bit_clear(UCHAR *, UINT);
static UINT bit_get(UCHAR *, UINT);

/***********************************************************************/
/* BIT-MAPPED memory allocation routines.                              */
/***********************************************************************/
/* dpram_init:                                                         */
/* This routine sets-up the DP_RAM bitmap for all the SCCs supported,  */
/* possibly reserving some areas of the QUICC DP-RAM for other usages  */
/* like Ethernet, SPI, or SMCs.                                        */
/*                                                                     */
/***********************************************************************/
void dpram_init(void)
{
UINT i, n;
/* UCHAR   *map; --deleted by szg , not used */

/*---------------------------------------------------------------------*/
/* On the QUADS board, the master QUICC is fully available:            */
/* all these other functions are performed on the slave QUICC.         */
/* So just completely clear the bitmap.                                */
/*---------------------------------------------------------------------*/
for(n = 0; n < MAX_QUICCS; n++)
    {
        for (i = 0; i < (BYTES_TO_ALLOC / (CHUNK_SIZE * BITS_PER_UNIT)); i++)
            bitmap[n][i] = 0;
    }
#if 0
#if (BD_HAS_SLAVE == 1)
    map  = bitmap[1];
#else /* BD_HAS_SLAVE */
    map  = bitmap[0];
#endif /* BD_HAS_SLAVE */
#endif /* del by szg , not used */
}

/***********************************************************************/
/*  dpram_reserve: Reserve portions of dpram for exclusive usage       */
/***********************************************************************/
UCHAR *
dpram_reserve(ULONG port, ULONG offset, ULONG size)
{
 
UCHAR  *map;
ULONG  BdOffset, BdCount, n;
 
#if (BD_HAS_SLAVE == 1)
    map  = bitmap[1];
#else /* BD_HAS_SLAVE */
    map  = bitmap[0];
#endif /* BD_HAS_SLAVE */
 
BdOffset = ALIGN(offset,CHUNK_SIZE)/CHUNK_SIZE;
BdCount  = ALIGN(size,CHUNK_SIZE)/CHUNK_SIZE;
 
#ifdef  DEBUG
LogPrint("DPRAM8xx.C: In dpram_reserve(), Off 0x%x, Count 0x%x",
          BdOffset, BdCount);
#endif
 
/*---------------------------------------------------------------------*/
/* Mask out those discriptors requested                                */
/*---------------------------------------------------------------------*/
for (n = BdOffset; n < (BdOffset + BdCount); n++)
    bit_set(map, n);
return NULL; /* this is an invalid return value */
}

/***********************************************************************/
/* dpram_alloc:                                                        */
/*              This routine allocates a "chunk" of the dual-port      */
/*               RAM associated with the specified SCC. The port       */
/*              number is used to determine which memory pool is       */
/*              to be allocated from.                                  */
/*                                                                     */
/*      INPUTS:                                                        */
/*              port channel to assign ram to                          */
/*              size amount of ram needed                              */
/*                                                                     */
/*     RETURNS:                                                        */
/*              pointer to Dual ported ram area assigned               */
/*     NOTE(S):                                                        */
/*                                                                     */
/***********************************************************************/
UCHAR   *dpram_alloc0(UINT port, UINT size);
UCHAR   *dpram_alloc(UINT port, UINT size){ return dpram_alloc0(port,size); }
UCHAR   *dpram_alloc0(UINT port, UINT size)
{
UCHAR   *map;
UINT    bits;
UINT    accumulate;
UINT    start;
UINT    i;

#ifdef  DEBUG
LogPrint("DPRA8XX.C: Allocating Dpram, Port %d, Size %d", port, size);
#endif
/*---------------------------------------------------------------------*/
/* Get the correct 68360 chip's bitmap                                 */
/*---------------------------------------------------------------------*/
map  = bitmap[quicc_num[port]];
bits = (size + CHUNK_SIZE - 1) / CHUNK_SIZE;

accumulate = 0;
start = 0;
i = 0;

while (i < (BYTES_TO_ALLOC / CHUNK_SIZE))
    {
    switch(accumulate)
        {
        case 0:
            /*---------------------------------------------------------*/
            /* Search for initial hole. See if chunk is free.          */
            /*---------------------------------------------------------*/
            if (bit_get(map, i) == 0)
                {
                start = i;
                accumulate = 1;
                }
            break;

        default:
            accumulate++;
            /*---------------------------------------------------------*/
            /* See if next chunk is free. If it isn't start over.      */
            /*---------------------------------------------------------*/
            if (bit_get(map, i) != 0)

                /*-----------------------------------------------------*/
                /* Next chunk is not free so start over again and look */
                /* for the next hole start.                            */
                /*-----------------------------------------------------*/
                accumulate = 0;

            break;
        }
    i++;

    /*-----------------------------------------------------------------*/
    /* If we have enough bits, set them and return the allocated       */
    /* pointer.                                                        */
    /*-----------------------------------------------------------------*/
    if (accumulate == bits)
        {
        for (i=start; accumulate--; i++)
            bit_set(map, i);

#ifdef  DEBUG
        LogPrint("DPRA8XX.C: returning from dpram_alloc(), 0x%08x",
                  (UCHAR *)dpram_base[port] + (start * CHUNK_SIZE));
#endif
        return ((UCHAR *)dpram_base[port] + (start * CHUNK_SIZE));
        }
    }
return ((UCHAR *)NULL);
}

/***********************************************************************/
/* dpram_dealloc:                                                      */
/*                This routine is used to deallocate a block of        */
/*                dual-port RAM. The port number is used to determine  */
/*                which pool to deallocate from. It is VERY important  */
/*                that the size parameter match that of the size of    */
/*                the requested block.                                 */
/*                                                                     */
/*      INPUTS:                                                        */
/*              port - channel number                                  */
/*              where - pointer to top of dual-port RAM to dealloc     */
/*              size - size of area to dealloc                         */
/*                                                                     */
/*      NOTE:   The dual-port RAM is controled by a bit map.           */
/*                                                                     */
/***********************************************************************/
void dpram_dealloc0(UINT port, UCHAR *where, UINT size);
void dpram_dealloc(UINT port, UCHAR *where, UINT size){ 
	dpram_dealloc0(port,where,size); 
	}
void dpram_dealloc0(UINT port, UCHAR *where, UINT size)
{
UCHAR   *map;
UINT    bits;
UINT    start;

#ifdef  DEBUG
LogPrint("DPRA8XX.C: De-allocating Dpram, Port %d, Size %d", port, size);
#endif

start = (where - (UCHAR *)dpram_base[port]) / CHUNK_SIZE;
map  = bitmap[quicc_num[port]];
bits = (size + CHUNK_SIZE - 1) / CHUNK_SIZE;
/* bits = (size + CHUNK_SIZE - 1) & ~(CHUNK_SIZE - 1); */
while(bits--)
    bit_clear(map, start++);
}

/***********************************************************************/
/* bit_clear:                                                          */
/*            Clear a bit in the specified bitmap.                     */
/*                                                                     */
/*      INPUTS:                                                        */
/*              map pointer to a bit map                               */
/*              bitnum number of the bit to clear                      */
/*                                                                     */
/***********************************************************************/
/*
 *  Clear a bit in the specified bitmap.
 */
static void bit_clear(UCHAR *map, UINT bitnum)
{
UINT    bit;
UINT    byte;

byte = bitnum /  BITS_PER_UNIT;
bit  = bitnum & (BITS_PER_UNIT - 1);
map[byte] &= ~(1 << bit);
}

/***********************************************************************/
/* bit_set:                                                            */
/*          Set a bit in the specified bit map.                        */
/*                                                                     */
/*      INPUTS:                                                        */
/*              map pointer to bit map                                 */
/*              bitnum bit number to set                               */
/*                                                                     */
/***********************************************************************/
static void bit_set(UCHAR *map, UINT bitnum)
{
UINT    bit;
UINT    byte;

byte = bitnum /  BITS_PER_UNIT;
bit  = bitnum & (BITS_PER_UNIT - 1);
map[byte] |= 1 << bit;
}

/***********************************************************************/
/* bit_get:                                                            */
/*          Retrieve the state of a bit in the specified bitmap.       */
/*                                                                     */
/*      INPUTS:                                                        */
/*          map map pointer to use                                     */
/*          bitnum bit number                                          */
/*                                                                     */
/*     RETURNS:                                                        */
/*          bit value                                                  */
/*                                                                     */
/***********************************************************************/
static UINT bit_get(UCHAR *map, UINT bitnum)
{
UINT    bit;
UINT    byte;

byte = bitnum /  BITS_PER_UNIT;
bit  = bitnum & (BITS_PER_UNIT - 1);

if (map[byte] & (1 << bit))
     return 1;
else return 0;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人av在线网| 欧美人伦禁忌dvd放荡欲情| 亚洲一区二区三区中文字幕| 精品日韩在线一区| 色综合激情五月| 国产福利不卡视频| 亚洲va在线va天堂| 亚洲精品欧美在线| 国产精品视频一二| 久久久午夜精品| 777午夜精品免费视频| 91看片淫黄大片一级| 国产老女人精品毛片久久| 日本大胆欧美人术艺术动态| 亚洲欧美国产毛片在线| 欧美国产日韩在线观看| 欧美大片国产精品| 91精品欧美一区二区三区综合在 | 午夜视频在线观看一区二区| 日本一区二区三区视频视频| 欧美成人vps| 7777女厕盗摄久久久| 欧美亚洲一区二区在线观看| av福利精品导航| 9i在线看片成人免费| 国产99久久久久久免费看农村| 全国精品久久少妇| 午夜精品一区二区三区电影天堂| 一区二区国产视频| 亚洲女人的天堂| 中文字幕一区二区三区蜜月| 国产亚洲视频系列| 国产视频一区二区在线| 久久久精品黄色| www日韩大片| 国产亚洲欧美色| 欧美国产精品一区| 国产精品毛片久久久久久| 国产精品国产三级国产有无不卡 | 精品国产凹凸成av人导航| 91麻豆精品国产91久久久久久久久| 在线观看视频91| 欧美三电影在线| 欧美美女网站色| 欧美一卡二卡三卡四卡| 精品欧美乱码久久久久久| 欧美精品一区二区三区四区| 久久综合丝袜日本网| 欧美高清在线一区| 亚洲欧美在线另类| 亚洲自拍偷拍九九九| 天天综合天天做天天综合| 免费成人在线观看| 国产精品亚洲第一| 99精品欧美一区二区蜜桃免费 | 无码av中文一区二区三区桃花岛| 丝袜美腿亚洲色图| 精品无码三级在线观看视频| 成人免费视频一区| 91理论电影在线观看| 欧美日韩精品二区第二页| 欧美tickling网站挠脚心| 久久久久久久久久久久久夜| 国产精品麻豆欧美日韩ww| 亚洲精品福利视频网站| 日韩高清不卡一区二区| 国产精品99久久不卡二区| www.欧美精品一二区| 欧美视频日韩视频| 精品成人在线观看| 亚洲欧美综合在线精品| 日韩激情一区二区| 国产精品一区二区三区四区 | 99精品在线免费| 欧美色爱综合网| 欧美成人在线直播| 亚洲日韩欧美一区二区在线| 日韩影院精彩在线| 国v精品久久久网| 欧美人狂配大交3d怪物一区| 久久人人爽人人爽| 一级精品视频在线观看宜春院 | 欧美疯狂做受xxxx富婆| 亚洲精品一区二区三区影院| 国产精品欧美一区喷水| 日日夜夜免费精品视频| 懂色av一区二区在线播放| 欧美专区在线观看一区| 久久久久99精品国产片| 一区二区免费看| 国产aⅴ综合色| 5566中文字幕一区二区电影 | 日本一区二区三区视频视频| 亚洲成年人网站在线观看| 国产精品一区二区三区四区| 欧美日韩在线观看一区二区 | 青娱乐精品在线视频| 波多野结衣中文一区| 日韩午夜在线观看视频| 亚洲视频在线一区观看| 国产成人在线视频网址| 5858s免费视频成人| 一区二区三区在线视频观看| 亚洲国产一区二区三区青草影视| 成人国产电影网| 久久久影院官网| 蜜桃免费网站一区二区三区| 在线免费观看日本一区| 国产精品你懂的在线欣赏| 男人的天堂久久精品| 欧美性大战久久| 亚洲视频在线观看三级| 成人精品一区二区三区中文字幕| 日韩亚洲欧美在线观看| 视频一区二区国产| 在线这里只有精品| 中文字幕制服丝袜一区二区三区| 韩日欧美一区二区三区| 日韩精品中文字幕在线不卡尤物| 亚洲一区在线视频| 91九色02白丝porn| 亚洲色欲色欲www在线观看| 成人黄页毛片网站| 国产欧美日韩在线观看| 国产精品538一区二区在线| 欧美mv日韩mv国产网站| 日本视频一区二区三区| 678五月天丁香亚洲综合网| 亚洲成国产人片在线观看| 成人在线视频一区| 日本一区二区三区在线观看| 国产成人亚洲综合色影视| 精品国精品国产| 韩国欧美一区二区| 久久久精品日韩欧美| 国产一本一道久久香蕉| 久久精品欧美一区二区三区麻豆| 国产又黄又大久久| 久久精品综合网| 成人h版在线观看| 自拍偷拍国产亚洲| 91福利资源站| 午夜视频一区二区三区| 日韩一卡二卡三卡四卡| 日韩av成人高清| 欧美videossexotv100| 国产在线一区观看| 欧美韩国日本一区| 一本大道av伊人久久综合| 亚洲第一会所有码转帖| 538prom精品视频线放| 日本不卡视频一二三区| 久久夜色精品国产欧美乱极品| 国产精品一区二区三区99| 中文字幕免费不卡在线| 色网站国产精品| 日韩精品欧美成人高清一区二区| 欧美一区二区视频免费观看| 激情综合五月婷婷| 一色桃子久久精品亚洲| 欧美三级韩国三级日本一级| 久久av资源网| 日韩毛片在线免费观看| 欧美视频精品在线| 精品夜夜嗨av一区二区三区| 2019国产精品| 一本一道久久a久久精品综合蜜臀| 亚洲成人黄色小说| 久久久精品国产免费观看同学| 91免费观看国产| 性欧美大战久久久久久久久| 久久看人人爽人人| 色婷婷久久久久swag精品| 日本视频一区二区| 亚洲国产高清不卡| 欧美色涩在线第一页| 国产精品亚洲成人| 亚洲成人1区2区| 中文字幕二三区不卡| 欧美精品在线一区二区三区| 高清成人在线观看| 亚洲精品v日韩精品| 亚洲精品一区二区三区影院| 色婷婷av一区| 国产激情91久久精品导航| 亚洲国产一区视频| 国产欧美日韩麻豆91| 欧美二区乱c少妇| 不卡电影免费在线播放一区| 美女国产一区二区| 一个色妞综合视频在线观看| 国产午夜精品一区二区三区嫩草 | 欧美日韩免费电影| 国产盗摄视频一区二区三区| 五月婷婷久久丁香| 亚洲色图丝袜美腿| 国产欧美一区二区三区鸳鸯浴 | 亚洲成在人线在线播放| 欧美经典三级视频一区二区三区| 91精品国产91久久久久久一区二区 |