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