apb_delay_Driver.h
113 lines
| 3.8 KiB
| text/x-c
|
CLexer
martin
|
r80 | /*------------------------------------------------------------------------------ | ||
-- This file is a part of the LPP VHDL IP LIBRARY | ||||
-- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS | ||||
-- | ||||
-- This program is free software; you can redistribute it and/or modify | ||||
-- it under the terms of the GNU General Public License as published by | ||||
-- the Free Software Foundation; either version 3 of the License, or | ||||
-- (at your option) any later version. | ||||
-- | ||||
-- This program is distributed in the hope that it will be useful, | ||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
-- GNU General Public License for more details. | ||||
-- | ||||
-- You should have received a copy of the GNU General Public License | ||||
-- along with this program; if not, write to the Free Software | ||||
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||
------------------------------------------------------------------------------- | ||||
-- Author : Martin Morlot | ||||
-- Mail : martin.morlot@lpp.polytechnique.fr | ||||
-----------------------------------------------------------------------------*/ | ||||
martin
|
r86 | #ifndef APB_DELAY_DRIVER_H | ||
#define APB_DELAY_DRIVER_H | ||||
martin
|
r80 | |||
martin
|
r86 | /*! \file apb_delay_Driver.h | ||
\brief LPP Interupt driver. | ||||
This library is written to work with LPP_APB_DELAY VHDL module from LPP's FreeVHDLIB. | ||||
martin
|
r80 | |||
martin
|
r86 | \author Martin Morlot martin.morlot@lpp.polytechnique.fr | ||
*/ | ||||
#define Delay_End 0x00001000 /**< Used to know when the VHDL delay counter stoped counting */ | ||||
martin
|
r80 | |||
/*=================================================== | ||||
T Y P E S D E F | ||||
====================================================*/ | ||||
martin
|
r86 | /*! \struct DELAY_REG | ||
\brief Sturcture representing the Delay registers | ||||
*/ | ||||
martin
|
r80 | struct DELAY_REG | ||
{ | ||||
martin
|
r86 | int Cfg; /**< \brief Configuration register composed of Reset function [HEX 0] | ||
Start Flag [HEX 1] | ||||
End Flag Received [HEX 2] | ||||
End Flag [HEX 3] */ | ||||
int Fboard; /**< \brief Board Frequency register */ | ||||
int Timer; /**< \brief Delay duration register */ | ||||
martin
|
r80 | }; | ||
typedef volatile struct DELAY_REG DELAY_Device; | ||||
/*=================================================== | ||||
F U N C T I O N S | ||||
====================================================*/ | ||||
martin
|
r86 | /*! \fn DELAY_Device* openDELAY(int count); | ||
\brief Return count Delay. | ||||
This Function scans APB devices table and returns count Delay. | ||||
\param count The number of the Delay you whant to get. For example if you have 3 Delays on your SOC you want | ||||
to use Delay1 so count = 1. | ||||
\return The pointer to the device. | ||||
*/ | ||||
DELAY_Device* openDELAY(int count); | ||||
martin
|
r80 | |||
martin
|
r86 | /*! \fn int Setup(DELAY_Device* dev,int X); | ||
\brief Setup the device | ||||
This function setup the device, reset and Board frequency. | ||||
\param dev The Delay pointer. | ||||
\param X the Board frequency. | ||||
*/ | ||||
int Setup(DELAY_Device* dev,int X); | ||||
/*! \fn int Delay_us(DELAY_Device* dev,int T); | ||||
\brief Generate delay | ||||
This function genrate a delay in microsecond. | ||||
\param dev The Delay pointer. | ||||
\param T the Delay duration in us. | ||||
*/ | ||||
martin
|
r80 | int Delay_us(DELAY_Device* dev,int T); | ||
martin
|
r86 | |||
/*! \fn int Delay_ms(DELAY_Device* dev,int T); | ||||
\brief Generate delay | ||||
This function genrate a delay in milisecond. | ||||
\param dev The Delay pointer. | ||||
\param T the Delay duration in ms. | ||||
*/ | ||||
martin
|
r80 | int Delay_ms(DELAY_Device* dev,int T); | ||
martin
|
r86 | |||
/*! \fn int Delay_s(DELAY_Device* dev,int T); | ||||
\brief Generate delay | ||||
This function genrate a delay in second. | ||||
\param dev The Delay pointer. | ||||
\param T the Delay duration in s. | ||||
*/ | ||||
martin
|
r80 | int Delay_s(DELAY_Device* dev,int T); | ||
martin
|
r86 | |||
martin
|
r80 | |||
#endif | ||||