@@ -1,16 +1,15 | |||
|
1 | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
2 | 2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
|
3 | 3 | <head> |
|
4 | 4 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
|
5 | 5 | <title>lib-lpp: Main Page</title> |
|
6 | 6 | <link href="search/search.css" rel="stylesheet" type="text/css"/> |
|
7 | 7 | <script type="text/javaScript" src="search/search.js"></script> |
|
8 | 8 | <link href="doxygen.css" rel="stylesheet" type="text/css"/> |
|
9 | 9 | </head> |
|
10 | 10 | <body onload='searchBox.OnSelectItem(0);'> |
|
11 | 11 | <div id="wrap"> |
|
12 | 12 | <div id="header"> |
|
13 | <h1><a name="Free_VHDL_library" /><a href="../../">Free | |
|
14 | VHDL library<br /> | |
|
13 | <h1><a href="../../" TARGET="_top">Free VHDL library<br /> | |
|
15 | 14 | </a></h1> |
|
16 | 15 | </div> |
@@ -1,51 +1,31 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the LPP VHDL IP LIBRARY |
|
3 | 3 | -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | #include "stdio.h" |
|
20 | //remember to include: | |
|
20 | 21 | #include "lpp_apb_functions.h" |
|
21 | 22 | |
|
22 | 23 | |
|
23 | 24 | |
|
24 | 25 | int main() |
|
25 | 26 | { |
|
26 | int d=0; | |
|
27 | while(d!=10) | |
|
28 | { | |
|
29 | scanf("%d",&d); | |
|
30 | switch(d) | |
|
31 | { | |
|
32 | case 0: | |
|
33 | printf("cursor OFF \n"); | |
|
34 | break; | |
|
35 | case 1: | |
|
36 | printf("cursor ON \n"); | |
|
37 | break; | |
|
38 | case 2: | |
|
39 | break; | |
|
40 | case 3: | |
|
41 | apbprintdeviceslist(); | |
|
42 | break; | |
|
43 | case 10: | |
|
44 | return 0; | |
|
45 | break; | |
|
46 | default: | |
|
47 | break; | |
|
48 | } | |
|
49 | } | |
|
50 | return 0; | |
|
27 | //to print devices lilst | |
|
28 | apbprintdeviceslist(); | |
|
29 | //if you whant to get a second device with 0x01/0x02 as VID/PID | |
|
30 | int * dev = apbgetdevice(0x02, 0x01, 1); | |
|
51 | 31 | } |
@@ -1,134 +1,135 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the LPP VHDL IP LIBRARY |
|
3 | 3 | -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef LPP_APB_FUNCTIONS_H |
|
23 | 23 | #define LPP_APB_FUNCTIONS_H |
|
24 | 24 | |
|
25 | 25 | #define APB_TBL_HEAD 0x800FF000 /**< Start address of APB devices list on AHB2APB bridge*/ |
|
26 | 26 | #define APB_BASE_ADDRS 0x80000000 /**< Start address of APB bus*/ |
|
27 | 27 | #define APB_MAX_DEVICES 256 /**< Maximun device count on APB bus*/ |
|
28 | 28 | |
|
29 | 29 | #include "apb_devices_list.h" |
|
30 | 30 | |
|
31 | 31 | |
|
32 | 32 | /*! \file lpp_apb_functions.h |
|
33 | 33 | \brief General purpose APB functions. |
|
34 | 34 | |
|
35 | 35 | This library is written to work with AHB2APB VHDL module from Gaisler's GRLIB. It help you to find your device |
|
36 | 36 | on the APB bus by providing scan functions, it extract information such as device Version, IRQ value, Address mask. |
|
37 | 37 | You can use it to print the APB devices list on your SOC. |
|
38 | 38 | |
|
39 | 39 | \author Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr |
|
40 | 40 | \todo implemente a descriptor structure for any APB device |
|
41 | 41 | |
|
42 | 42 | */ |
|
43 | 43 | |
|
44 | 44 | |
|
45 | 45 | /*! \struct apbPnPreg |
|
46 | 46 | \brief Structure representing a device descriptor register on Grlib's AHB2APB brige with plug and play feature |
|
47 | 47 | */ |
|
48 | 48 | struct apbPnPreg |
|
49 | 49 | { |
|
50 | 50 | int idReg; /**< \brief id register composed of Vendor ID [31:24], Device ID [23:12], CT [11:10], Version [9:5], IRQ [4:0] */ |
|
51 | 51 | int bar; /**< \brief Bank Address Register composed of Device's ADDRESS [31:20], MASK [14:4], TYPE [3:0] */ |
|
52 | 52 | }; |
|
53 | 53 | |
|
54 | 54 | |
|
55 | 55 | /*! \struct apbdevinfo |
|
56 | 56 | \brief Structure holding an APB device informations |
|
57 | 57 | |
|
58 | 58 | This information are extracted from the descriptor registers on Grlib's AHB2APB brige with plug and play feature |
|
59 | 59 | */ |
|
60 | 60 | struct apbdevinfo |
|
61 | 61 | { |
|
62 | 62 | int vendorID; /**< \brief Stores the Vendor ID of the current device */ |
|
63 | 63 | int productID; /**< \brief Stores the Product ID of the current device */ |
|
64 | 64 | int version; /**< \brief Stores the Version of the current device */ |
|
65 | 65 | int irq; /**< \brief Stores the interrupt Number of the current device */ |
|
66 | 66 | int address; /**< \brief Stores the base address of the current device */ |
|
67 | 67 | int mask; /**< \brief Stores the address mask of the current device, it gives the address space of this device */ |
|
68 | 68 | }; |
|
69 | 69 | |
|
70 | 70 | |
|
71 | 71 | |
|
72 | 72 | |
|
73 | 73 | /*! \fn int* apbgetdevice(int PID,int VID,int count); |
|
74 | 74 | \brief Find device with given VID/PID |
|
75 | 75 | |
|
76 | 76 | This Function scans APB devices table and returns counth device according to VID and PID |
|
77 | 77 | |
|
78 | 78 | \param PID The PID of the device you whant to get. |
|
79 | 79 | \param VID The VID of the device you whant to get. |
|
80 | 80 | \param count The number of the device you whant to get. For example if you have 3 UARTS on your SOC you whant |
|
81 | 81 | to use UART1 so count = 2. |
|
82 | 82 | |
|
83 | 83 | \return The pointer to the device. |
|
84 | 84 | */ |
|
85 | 85 | int* apbgetdevice(int PID,int VID,int count); |
|
86 | 86 | |
|
87 | 87 | /*! \fn void apbgetdeviceinfofromid(int PID,int VID,int count,struct apbdevinfo* devinfo); |
|
88 | 88 | \brief Record device informations with given VID/PID |
|
89 | 89 | |
|
90 | 90 | This Function scans APB devices table and returns counth device informations according VID and PID. |
|
91 | 91 | |
|
92 | 92 | \param PID The PID of the device you whant to get. |
|
93 | 93 | \param VID The VID of the device you whant to get. |
|
94 | 94 | \param count The number of the device you whant to get. For example if you have 3 UARTS on your SOC you whant |
|
95 | 95 | to use UART1 so count = 2. |
|
96 | 96 | \param devinfo The device information structure to be populated. |
|
97 | 97 | \example scanAPB.c |
|
98 | 98 | */ |
|
99 | 99 | void apbgetdeviceinfofromid(int PID,int VID,int count,struct apbdevinfo* devinfo); |
|
100 | 100 | |
|
101 | 101 | |
|
102 | 102 | /*! \fn void apbgetdeviceinfofromdevptr(const struct apbPnPreg* dev,struct apbdevinfo* devinfo); |
|
103 | 103 | \brief Record device informations with given AHB2APB Plugn'Play register. |
|
104 | 104 | |
|
105 | 105 | This Function extract device informations from the given AHB2APB Plugn'Play register end write them in devinfo. |
|
106 | 106 | |
|
107 | 107 | \param dev AHB2APB Plugn'Play register corresponding to the device. |
|
108 | 108 | \param devinfo The device information structure to be populated. |
|
109 | 109 | */ |
|
110 | 110 | void apbgetdeviceinfofromdevptr(const struct apbPnPreg* dev,struct apbdevinfo* devinfo); |
|
111 | 111 | |
|
112 | 112 | |
|
113 | 113 | |
|
114 | 114 | /*! \fn void apbprintdeviceinfo(struct apbdevinfo devinfo); |
|
115 | 115 | \brief Print given device informations in stdout. |
|
116 | 116 | |
|
117 | 117 | \param devinfo The device information structure to be printed. |
|
118 | 118 | */ |
|
119 | 119 | void apbprintdeviceinfo(struct apbdevinfo devinfo); |
|
120 | 120 | |
|
121 | 121 | |
|
122 | 122 | |
|
123 | 123 | /*! \fn void apbprintdeviceslist(); |
|
124 | 124 | \brief Print APB devices informations in stdout. |
|
125 | 125 | |
|
126 | 126 | This function list all devices on APB bus and print theirs informations. |
|
127 | ||
|
127 | ||
|
128 | \example scanAPB.c | |
|
128 | 129 | */ |
|
129 | 130 | void apbprintdeviceslist(); |
|
130 | 131 | |
|
131 | 132 | |
|
132 | 133 | |
|
133 | 134 | #endif // LPP_APB_FUNCTIONS_H |
|
134 | 135 |
@@ -1,14 +1,14 | |||
|
1 | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
2 | 2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
|
3 | 3 | <head> |
|
4 | 4 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
|
5 | 5 | <title>lib-lpp: Main Page</title> |
|
6 | 6 | <link href="search/search.css" rel="stylesheet" type="text/css"/> |
|
7 | 7 | <script type="text/javaScript" src="search/search.js"></script> |
|
8 | 8 | <link href="doxygen.css" rel="stylesheet" type="text/css"/> |
|
9 | 9 | </head> |
|
10 | 10 | <body > |
|
11 | 11 | <div id="wrap"> |
|
12 | 12 | <div id="header"> |
|
13 | <h1><a href="../../index.html">Free VHDL library</a></h1> | |
|
13 | <h1><a href="../../index.html" TARGET="_top">Free VHDL library</a></h1> | |
|
14 | 14 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now