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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? bufftest.c

?? Ti公司DSP開發(fā)板DSK6711例程 開發(fā)工具CCS3.1
?? C
字號:
/*
 *  Copyright 2003 by Texas Instruments Incorporated.
 *  All rights reserved. Property of Texas Instruments Incorporated.
 *  Restricted rights to use, duplicate or disclose this code are
 *  granted through contract.
 *  
 */
/* "@(#) DSP/BIOS 4.90.270 01-13-05 (barracuda-o07)" */
/***************************************************************************/
/*                                                                         */
/*     B U F F T E S T . C                                                 */
/*                                                                         */
/*   Simulating a network environment where the server program gathers     */
/*   statistics about various requests from clients in real-time.          */
/*   CLK Object simulates hardware interrupts from clients. CLK Isr        */
/*   allocates buffers from a Buffer Pool created statically in CDB and    */
/*   make them available in a queue for processing task. A periodic object */
/*   prints the statistics about the Buffer Pool usage and type of         */
/*   requests from clients.                                                */
/*                                                                         */
/***************************************************************************/
 
 
#include <std.h>
#include <log.h>
#include <swi.h>
#include <clk.h>
#include <que.h>
#include <sys.h>
#include <buf.h>

#include "bufftestcfg.h"

#define TOTAL_SERVICES 4  /* Total number of various request types from clinets */

#define MAX_BUFFERS    5  /* Total number of buffers in the Buffer Pool */


/* define client request types (these services can be extended) */
typedef enum ServiceType {
     GET_SYSTEM_TIME_HIGH = 0,
     GET_SYSTEM_TIME_LOW,
     GET_CPU_LOAD,
     RUN_USER_FXN
}ServiceType;

/* 
 * define a structure for buffer header which contains information
 * about the type of request from clients
 */

typedef struct BufferHeader {
     QUE_Elem  elem; /*  elem will be used by QUE module */
     ServiceType service;    /*  client request type  */    
     Fxn userFxn;    /*  user function to be executed */
}BufferHeader;

extern BUF_Obj bufferPool;
extern QUE_Obj bufferQueue;
extern SWI_Obj buffSwi;
extern LOG_Obj trace;
extern Int SEG0;

BUF_Handle  buffPoolHandle = &bufferPool; 

QUE_Handle  bufferQueueHandle = &bufferQueue;

/* numberOfBuffers holds number of Buffers allocated by SWI */
Int numberOfBuffers; 

/* define an array for collecting statistics about various request types  */
Int requestStatistics[TOTAL_SERVICES];



/* service functions */

Void serviceClientRequest(Ptr buffPtr);
Void getSystemTimeHigh();
Void getSystemTimeLow();
Void getMemoryStatus(Int segid);
Void getCpuLoad();
Int  defaultUserFunction();
 
/*
 * ======== main ========
 */
Void main()
{
    LOG_printf(&trace,"Bufftest example started.\n");
}

/*
 *  ======== processingTskFxn ========
 *
 * FUNCTION: Called from DSP/BIOS startup to process the client requests
 *
 * PARAMETERS: none
 *
 * RETURN VALUE: none.
 */
Void processingTskFxn()
{
   Ptr buffPtr;
  
    for (;;) {

       if (QUE_empty(bufferQueueHandle)) {
       
           TSK_sleep(1);
           
       } else {
       
           while (!QUE_empty(bufferQueueHandle)) {
           
              /* get a request(i.e. buffer filled with request info) from buffer queue  */   
              buffPtr = QUE_get(bufferQueueHandle);
              
              /* update the statistics */
              serviceClientRequest(buffPtr);   
              
              /* free the buffer after servicing the request*/
              BUF_free(buffPoolHandle, buffPtr); 
              
           }
           
       }
       
    }        
}

/*
 *  ======== serviceClientRequest ========
 *
 * FUNCTION: Called from processingTskFxn function to service the client request
 *
 * PARAMETERS: none
 *
 * RETURN VALUE: none.
 */
 
Void serviceClientRequest(Ptr buffPtr)
{
   BufferHeader *header;
   ServiceType service;

     header = (BufferHeader *) buffPtr;
     
     service  =  header->service;
     
     /* update the statisics for each occurence of the request */
     requestStatistics[service]++ ; 
     
     /* service the request */
     switch (service) {
     
          case  GET_SYSTEM_TIME_HIGH : 
                  getSystemTimeHigh();
                  break;
                          
          case  GET_SYSTEM_TIME_LOW : 
                  getSystemTimeLow();
                  break;
                  
          case  GET_CPU_LOAD :
                  getCpuLoad();
                  break;                 
          
          case  RUN_USER_FXN :
                ( *(header->userFxn) )() ;
                
     }
     
}

/*
 *  ======== clkIsr ========
 *
 * FUNCTION: Called by CLK module for each timer interrupt. It generates the 
 *           number of buffers to be allocated and pass it to buffSwi
 *
 * PARAMETERS: none
 *
 * RETURN VALUE: none.
 */
Void clkIsr()
{
   BUF_Stat stat;
   Int randomBuffers;
   
     /*  Get the random number of buffers required */
      randomBuffers = getRandomNum(MAX_BUFFERS) + 1;
   
      /* Read the Buffer Pool statistics to get number of freebuffers */ 
      BUF_stat(buffPoolHandle, &stat);
      
      if ( randomBuffers > stat.freebuffers ){
            randomBuffers = stat.freebuffers;
      }
   
      numberOfBuffers = randomBuffers;
   
      /* post a SWI to allocate buffers (numberOfBuffers)*/
      SWI_post(&buffSwi);
}


/*
 *  ======== buffAllocate ========
 *
 * FUNCTION: Called from buffSwi to allocate buffers and fill them with client request info
 *
 * PARAMETERS: none
 *
 * RETURN VALUE: none.
 */
Void buffAllocate(Arg numberOfBuffers)
{

  BufferHeader * header;
  Ptr buffPtr;
  Int numbuff, i;
    
    numbuff = *(Int *) numberOfBuffers;
    
    for (i = 0; i < numbuff; i++) {       
          
          /* allocating a buffer in  SWI context*/
          buffPtr = BUF_alloc(buffPoolHandle); 
          if (buffPtr == NULL ) {
              SYS_abort("BUF_alloc failed");
          }
       
           /*  fill the buffer with info about request type */
           header = (BufferHeader *) buffPtr;
           header->service = (ServiceType) getRandomNum(TOTAL_SERVICES);
           
           if (header->service == RUN_USER_FXN ) {
               /* this is a dummy function used here and can be replaced */
               header->userFxn = defaultUserFunction; 
           }
                    
          /*  
           * make the buffer available to the processing task 
           * by putting the buffer in the buffer queue
           */
          QUE_put(bufferQueueHandle, buffPtr); 
    }
    
}


/*
 *  ======== printStatistics ========
 *
 * FUNCTION: Called from statisticsPrd to print statistics about client requests
 *           and Buffer Pool usage for every 16 ticks
 *
 * PARAMETERS: none
 *
 * RETURN VALUE: none.
 */
Void printStatistics()
{

  BUF_Stat stat;
  Int  maxbuff;
  Int service;
  Int totalRequests = 0;

    BUF_stat(buffPoolHandle, &stat);
 
    maxbuff = BUF_maxbuff(buffPoolHandle);
    
    LOG_printf(&trace, "After 16 ticks, Free buffers Available : %d, Max buffers used : %d ", stat.freebuffers, maxbuff);
    
    for (service = 0; service < TOTAL_SERVICES; service++ ) {
    
       /* print statistics for each request */
       switch (service) {
     
          case  GET_SYSTEM_TIME_HIGH : 
              LOG_printf(&trace, "Number of GET_SYSTEM_TIME_HIGH requests : %d", requestStatistics[service]);
              break;
                          
          case  GET_SYSTEM_TIME_LOW : 
              LOG_printf(&trace, "Number of GET_SYSTEM_TIME_LOW requests : %d", requestStatistics[service]);
              break;
                  
          case  GET_CPU_LOAD : 
              LOG_printf(&trace, "Number of GET_CPU_LOAD requests : %d", requestStatistics[service]);
              break;                 
          
          case  RUN_USER_FXN :
              LOG_printf(&trace, "Number of RUN_USER_FXN requests : %d", requestStatistics[service]);
     }
     
     totalRequests += requestStatistics[service];
       
       /*  Reset the count for the next statistics */
     requestStatistics[service] = 0; 
   }
    
    LOG_printf(&trace, "Total number of requests in 16 ticks : %d \n", totalRequests );
     
}

/*
 *  ======== getRandomNum ========
 *
 * FUNCTION: Called from clkIsr and buffAllocate generate a random number
 *           It returns a integer between 0 to maxValue-1 inclusive
 *
 * PARAMETERS: none
 *
 * RETURN VALUE: none.
 */
Int  getRandomNum(Int maxValue)
{ 
   LgInt randomNumber;

   randomNumber  =  CLK_gethtime() % maxValue;
   
   if (randomNumber < 0) {
      randomNumber *= -1;
   }
   
   return  randomNumber ;
}


/*
 *  ======== getSystemTimeHigh ========
 *
 * FUNCTION: Called from serviceClientRequest to service GET_SYSTEM_TIME_HIGH request
 *
 * PARAMETERS: none
 *
 * RETURN VALUE: none.
 */
Void getSystemTimeHigh()
{
     LgUns  currtime;

     currtime = CLK_gethtime();
     
     #ifdef _28_
        LOG_printf(&trace, "High Resolution System Time : 0x%04x%04x\n", (Arg)(currtime >> 16), (Arg)(currtime & 0xffff));
     #else
        LOG_printf(&trace, "High Resolution System Time : 0x%04x%04x\n", (Int)(currtime >> 16), (Int)(currtime & 0xffff));
     #endif
     
}

/*
 *  ======== getSystemTimeLow ========
 *
 * FUNCTION: Called from serviceClientRequest to service GET_SYSTEM_TIME_LOW request
 *
 * PARAMETERS: none
 *
 * RETURN VALUE: none.
 */
Void getSystemTimeLow()
{
     LgUns  currtime;

     currtime = CLK_getltime();
     
     #ifdef _28_
        LOG_printf(&trace, "Low Resolution System Time : 0x%04x%04x\n", (Arg)(currtime >> 16), (Arg)(currtime & 0xffff));
     #else
        LOG_printf(&trace, "Low Resolution System Time : 0x%04x%04x\n", (Int)(currtime >> 16), (Int)(currtime & 0xffff));
     #endif
     
}

 
/*
 *  ======== getCpuLoad ========
 *
 * FUNCTION: Called from serviceClientRequest to service GET_CPU_LOAD request
 *
 * PARAMETERS: none
 *
 * RETURN VALUE: none.
 */
Void getCpuLoad()
{

    LgInt max, num, acc;    /* max, num, acc fields of STS Object */
    Int cpuload;
    
     /*
      * Read BIOS defined STS object IDL_busyObj to get the following
      * num : number of times the DSP/BIOS idle loop is run in 1 second.
      * max : minimum number of CPU cycles taken for one idle loop execution.
      * acc : total number of CPU cycles elapsed in 1 second.
      *
      * cpu load =  app_cycles / total_cycles 
      *          =  (total_cycles - idleloop_cycles) / total_cycles
      *          =  1 -  (idleloop_cycles / total_cycles)
      * idleloop_cycles =  num * max / acc
      */ 
    
#if defined(_54_) /* Handle specific implementation for 54x */
    Int maxh, maxl, numh, numl, acch, accl;
    
    maxh = IDL_busyObj.maxh;
    maxl = IDL_busyObj.maxl;
    numh = IDL_busyObj.numh;
    numl = IDL_busyObj.numl;
    acch = IDL_busyObj.acch;
    accl = IDL_busyObj.accl;
   
    max = maxh;
    max = (max << 16) | (0x0000ffff & maxl);
    num = numh;
    num = (num << 16) | (0x0000ffff & numl);    
    acc = acch;
    acc = (acc << 16) | (0x0000ffff & accl);
#else
    max = IDL_busyObj.max;    
    num = IDL_busyObj.num;   
    acc = IDL_busyObj.acc;           
#endif
    
    /* Calculate approximate cpu load */
    
    cpuload = ( num * max * 1.0 / acc ) * 100; /* gives idleload%  */
    
    if (cpuload < 0) {  /* since STS maintains -ve numbers for max/acc field */
         cpuload *= -1;
    }     
    
    cpuload = 100 - cpuload ; /* cpuload% =  100 - idleload% */
    
 #ifndef _28_ /* due to 28x BIOS issue, num, acc and max fields are invalid */ 
    LOG_printf(&trace, "cpu load is : %d%%\n", cpuload);
 #endif
}

/*
 *  ======== defaultUserFunction ========
 *
 * FUNCTION: Called from serviceClientRequest to service RUN_USER_FXN request
 *
 * PARAMETERS: none
 *
 * RETURN VALUE: Int ( dummy return since Fxn type returns integer).
 */
Int defaultUserFunction()
{
  LOG_printf(&trace, "User Function called\n"); 
  return 1;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91色porny在线视频| 欧美日韩一区二区在线观看 | 久久综合狠狠综合| 94-欧美-setu| 国产麻豆精品95视频| 亚洲成人av电影| 国产精品久久久99| 欧美精品一区二区三区蜜臀| 在线观看日韩av先锋影音电影院| 国产盗摄一区二区| 蜜乳av一区二区三区| 一区二区三区在线不卡| 国产亚洲女人久久久久毛片| 6080日韩午夜伦伦午夜伦| 91在线云播放| 丁香婷婷综合激情五月色| 日韩电影免费在线看| 亚洲黄色小说网站| 中文字幕成人网| 久久久午夜精品| 欧美一区二区黄| 欧美丝袜丝nylons| 欧美在线播放高清精品| www.欧美日韩国产在线| 国产69精品久久99不卡| 国产精品一卡二| 国产一区二区三区高清播放| 全国精品久久少妇| 全国精品久久少妇| 日韩精品一二区| 亚洲123区在线观看| 一区二区三区国产精品| 亚洲啪啪综合av一区二区三区| 日本一二三不卡| 欧美国产一区二区| 中国av一区二区三区| 国产日韩av一区二区| 国产亚洲午夜高清国产拍精品| 精品久久久久久最新网址| 欧美一区二区精品在线| 日韩欧美成人一区二区| 精品日韩av一区二区| 欧美videofree性高清杂交| 欧美一区二区播放| 精品国产乱码久久久久久图片| 精品国产乱子伦一区| 久久这里只有精品首页| 久久综合久久综合久久综合| wwww国产精品欧美| 国产精品女主播av| 亚洲三级理论片| 亚洲一区二区三区中文字幕 | 麻豆91在线观看| 久久91精品国产91久久小草| 狠狠色狠狠色合久久伊人| 国产麻豆精品在线| 99热99精品| 欧美日韩一卡二卡三卡| 日韩三级伦理片妻子的秘密按摩| 精品国产成人系列| 国产精品乱码人人做人人爱| 中文字幕亚洲电影| 亚洲国产成人高清精品| 日本欧美一区二区| 成人免费av在线| 在线免费一区三区| 精品久久99ma| 国产精品国产三级国产aⅴ入口| 洋洋成人永久网站入口| 蜜乳av一区二区三区| 夫妻av一区二区| 欧美系列一区二区| wwww国产精品欧美| 一区二区三区毛片| 狠狠v欧美v日韩v亚洲ⅴ| 99视频在线精品| 91精品在线观看入口| 国产女主播一区| 丝瓜av网站精品一区二区| 激情文学综合插| 色视频一区二区| 欧美成人综合网站| 亚洲欧洲在线观看av| 欧美aaaaa成人免费观看视频| 国产成人精品一区二区三区网站观看| 91在线看国产| 久久综合久久综合久久综合| 亚洲综合久久久久| 国产a精品视频| 欧美精品xxxxbbbb| 亚洲欧美日韩系列| 国产毛片精品视频| 欧美三级三级三级| 成人免费在线视频| 久久电影网电视剧免费观看| 色婷婷久久综合| 亚洲国产精品成人综合| 青椒成人免费视频| 欧美性感一区二区三区| 中文字幕欧美激情| 久久97超碰色| 欧美一三区三区四区免费在线看 | 精品国产1区2区3区| 亚洲国产一区在线观看| 国产白丝精品91爽爽久久| 欧美精三区欧美精三区| 国产精品不卡在线| 国产91丝袜在线观看| 欧美一区二区三区啪啪| 亚洲二区视频在线| 一本久久a久久精品亚洲| 国产夜色精品一区二区av| 美腿丝袜在线亚洲一区| 欧美日韩dvd在线观看| 亚洲免费观看高清完整版在线观看| 国产一区二区三区免费在线观看| 欧美日韩一区精品| 亚洲国产视频网站| 色先锋aa成人| 亚洲视频你懂的| 99久久国产综合色|国产精品| 久久久欧美精品sm网站| 久久99精品国产麻豆婷婷洗澡| 欧美一区二区三区视频在线观看 | 麻豆成人av在线| 亚洲欧美色图小说| 国产精品久久久久影院色老大| 91.com在线观看| 韩国成人精品a∨在线观看| 欧美久久久久久久久| 午夜精品成人在线视频| 91福利视频久久久久| 一区二区三区日韩欧美| 日本久久一区二区三区| 亚洲欧美日韩国产另类专区 | 精品视频在线看| 一级中文字幕一区二区| 在线精品视频免费观看| 亚洲尤物在线视频观看| 欧美三级日韩三级国产三级| 午夜伦欧美伦电影理论片| 欧美肥大bbwbbw高潮| 麻豆精品一区二区| 久久久国产精品不卡| 国产经典欧美精品| 国产精品女同一区二区三区| 99久久伊人精品| 一区二区三区日韩| 欧美日韩黄色影视| 麻豆精品国产传媒mv男同| 久久综合九色综合欧美98| 丁香婷婷深情五月亚洲| 中文字幕亚洲区| 精品视频一区三区九区| 另类小说色综合网站| 久久中文娱乐网| 91亚洲国产成人精品一区二三| 一区二区在线观看不卡| 欧美日高清视频| 国产一区二区三区免费播放| 国产农村妇女毛片精品久久麻豆| 91免费看`日韩一区二区| 亚洲午夜三级在线| 2021中文字幕一区亚洲| 99久精品国产| 日韩和欧美一区二区三区| 2023国产一二三区日本精品2022| 成人精品鲁一区一区二区| 一区二区三区 在线观看视频| 欧美一区二区观看视频| 成人夜色视频网站在线观看| 亚洲午夜精品17c| 精品剧情在线观看| 91麻豆精品秘密| 久久电影网电视剧免费观看| 综合久久国产九一剧情麻豆| 欧美精品视频www在线观看| 精品亚洲国内自在自线福利| 国产精品国产三级国产有无不卡 | 成人av网站免费观看| 亚洲综合免费观看高清在线观看| 欧美xingq一区二区| 色哟哟一区二区三区| 看片网站欧美日韩| 亚洲精品综合在线| 久久先锋影音av鲁色资源| 色婷婷亚洲婷婷| 国产精品 欧美精品| 丝袜美腿亚洲一区| 自拍偷拍欧美激情| 亚洲精品在线电影| 欧美专区亚洲专区| 成人一区在线观看| 蜜臀av性久久久久蜜臀aⅴ| 亚洲天堂网中文字| www国产成人免费观看视频 深夜成人网| 91黄视频在线| 成人一区在线看| 激情欧美日韩一区二区| 五月天激情综合|