00001 // sampalib.org ESL library and tools 00002 // Copyright (C) 2007 Thierry Grellier 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 version 2 as 00006 // published by the Free Software Foundation. 00007 // 00008 // This program is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 // GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License along 00014 // with this program; if not, write to the Free Software Foundation, Inc., 00015 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00016 // 00017 // contact: www.sampalib.org 00018 00019 #ifndef __SAMPA_DMA_H__ 00020 #define __SAMPA_DMA_H__ 00021 00022 #include "sampa/component/protocol.h" 00023 #include "sampa/core/gated.h" 00024 #include "sampa/core/fifo.h" 00025 00026 namespace Sampa { 00027 00028 class Dma : public Module { 00029 SAMPA_MODULE(Dma); 00030 public: 00031 Dma(const Name& name); 00032 00033 void bind_clock(Clock* clock); 00034 00035 void bind_read_target(Target*); 00036 void bind_write_target(Target*); 00037 00038 Initiator* get_read_initiator() { return &p_read; } 00039 Initiator* get_write_initiator() { return &p_write; } 00040 00041 protected: 00042 void complete_restart(); 00043 00044 bool recieve_read_response(const Response&); 00045 bool recieve_write_response(const Response&); 00046 00047 void request(); 00048 void forward(); 00049 00050 typedef AdaptingInitiator<Dma> AdaptingInitiator; 00051 int m_transfer; 00052 IntParameter m_word_size; 00053 IntParameter m_transfer_size; 00054 IntParameter m_burst_size; 00055 Time m_period; 00056 Time m_request_date; 00057 Burst m_read_burst; 00058 Burst m_write_burst; 00059 HexParameter m_read_address_base; // address generator? 00060 HexParameter m_write_address_base; // address generator? 00061 Address m_read_address; 00062 Address m_write_address; 00063 EventSingle e_request; 00064 AdaptingInitiator p_read; 00065 AdaptingInitiator p_write; 00066 EventListener e_push_or_write_request_accept_event; 00067 Request m_read_request; 00068 Request m_write_request; 00069 Fifo m_response_fifo; 00070 Gated<bool> m_pending; 00071 }; 00072 00073 } 00074 00075 #endif 00076
1.5.3