GNU Radio 3.3.0 C++ API
buffer_pool.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2007 Free Software Foundation, Inc.
00003  *
00004  * This program is free software: you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation, either version 3 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #ifndef INCLUDED_BUFFER_POOL_H
00019 #define INCLUDED_BUFFER_POOL_H
00020 
00021 #include "memory_map.h"
00022 
00023 // Buffer Pool Management
00024 
00025 
00026 // define to have common buffer operations inlined
00027 #define INLINE_BUFFER_POOL 1
00028 
00029 void bp_init(void);
00030 
00031 #ifndef INLINE_BUFFER_POOL
00032 
00033 void bp_clear_buf(int bufnum);
00034 void bp_disable_port(int portnum);
00035 void bp_receive_to_buf(int bufnum, int port, int step, int fl, int ll);
00036 void bp_send_from_buf(int bufnum, int port, int step, int fl, int ll);
00037 
00038 #else
00039 
00040 static inline void
00041 bp_clear_buf(int bufnum)
00042 {
00043   buffer_pool_ctrl->ctrl = BPC_BUFFER(bufnum) | BPC_PORT_NIL | BPC_CLR;
00044 }
00045 
00046 static inline void
00047 bp_disable_port(int portnum) 
00048 {
00049   // disable buffer connections to this port
00050   buffer_pool_ctrl->ctrl = BPC_BUFFER_NIL | BPC_PORT(portnum);
00051 }
00052 
00053 static inline void
00054 bp_receive_to_buf(int bufnum, int port, int step, int fl, int ll)
00055 {
00056   buffer_pool_ctrl->ctrl = (BPC_READ
00057                             | BPC_BUFFER(bufnum)
00058                             | BPC_PORT(port)
00059                             | BPC_STEP(step)
00060                             | BPC_FIRST_LINE(fl)
00061                             | BPC_LAST_LINE(ll));
00062 }
00063 
00064 static inline void
00065 bp_send_from_buf(int bufnum, int port, int step, int fl, int ll)
00066 {
00067   buffer_pool_ctrl->ctrl = (BPC_WRITE
00068                             | BPC_BUFFER(bufnum)
00069                             | BPC_PORT(port)
00070                             | BPC_STEP(step)
00071                             | BPC_FIRST_LINE(fl)
00072                             | BPC_LAST_LINE(ll));
00073 }
00074 #endif
00075 #endif