document/gpio.htm

Sat, 06 Aug 2011 01:43:24 +0100

author
Philip Pemberton <philpem@philpem.me.uk>
date
Sat, 06 Aug 2011 01:43:24 +0100
changeset 1
dfc32cad81ba
parent 0
267b5a25932f
permissions
-rw-r--r--

Update to latest Lattice code dump (LM32 V3.8, GPIO V3.2)

Version : 3.2
Mod. Data : Jun 6, 2010
Changes Made : 1. Provide capability to read/write bytes (when GPIO larger than 8 bits wide)
2. Provide capability to use a 32-bit or 8-bit data bus on the WISHBONE slave port
3. Perform a big-endian to little-endian conversion in hardware

     1 <!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
     3 <html>
     5 <head>
     6 <title>GPIO Core</title>
     7 <meta http-equiv="content-type" content="text/html; charset=windows-1252">
     8 <meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com">
     9 <link rel="stylesheet" href="lever40_ns.css"><script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">
    10 <!--
    11 if (navigator.appName !="Netscape")
    12 {   document.write("<link rel='stylesheet' href='lever40.css'>");}
    13 //-->
    14 </script>
    15 <style type="text/css">
    16 <!--
    17 img_whs1 { border:none; width:29px; height:31px; float:none; border-style:none; }
    18 p.whs2 { font-style:italic; }
    19 table.whs3 { height:84px; margin-left:14px; left:0px; top:129px; width:637px; x-cell-content-align:Top; border-spacing:0px; }
    20 col.whs4 { width:85px; }
    21 col.whs5 { width:505px; }
    22 tr.whs6 { x-cell-content-align:top; height:22px; }
    23 td.whs7 { width:85px; padding-right:10px; padding-left:10px; border-left-style:Solid; border-left-color:#c0c0c0; border-top-style:Solid; border-top-color:#c0c0c0; border-right-color:#c0c0c0; border-right-style:Solid; border-bottom-color:#c0c0c0; border-bottom-style:Solid; border-right-width:1px; border-left-width:1px; border-top-width:1px; border-bottom-width:1px; background-color:#dee8f4; }
    24 td.whs8 { width:505px; padding-right:10px; padding-left:10px; border-top-style:Solid; border-top-color:#c0c0c0; border-right-color:#c0c0c0; border-right-style:Solid; border-bottom-color:#c0c0c0; border-bottom-style:Solid; border-top-width:1px; border-bottom-width:1px; border-right-width:1px; background-color:#dee8f4; }
    25 td.whs9 { width:85px; padding-right:10px; padding-left:10px; border-left-color:#c0c0c0; border-left-width:1px; border-left-style:Solid; border-right-color:#c0c0c0; border-right-style:Solid; border-right-width:1px; border-bottom-color:#c0c0c0; border-bottom-style:Solid; border-bottom-width:1px; }
    26 td.whs10 { width:505px; padding-right:10px; padding-left:10px; border-right-color:#c0c0c0; border-right-style:Solid; border-right-width:1px; border-bottom-color:#c0c0c0; border-bottom-style:Solid; border-bottom-width:1px; }
    27 table.whs11 { x-cell-content-align:top; margin-left:15px; border-spacing:0px; }
    28 col.whs12 { width:503px; }
    29 tr.whs13 { x-cell-content-align:top; }
    30 td.whs14 { width:85px; padding-right:10px; padding-left:10px; border-left-style:Solid; border-left-color:#c0c0c0; border-top-color:#c0c0c0; border-top-style:Solid; border-right-color:#c0c0c0; border-right-style:Solid; border-bottom-color:#c0c0c0; border-bottom-style:Solid; border-right-width:1px; border-left-width:1px; border-top-width:1px; border-bottom-width:1px; background-color:#dee8f4; }
    31 td.whs15 { width:503px; padding-right:10px; padding-left:10px; border-top-color:#c0c0c0; border-top-style:Solid; border-right-color:#c0c0c0; border-right-style:Solid; border-bottom-color:#c0c0c0; border-bottom-style:Solid; border-top-width:1px; border-bottom-width:1px; border-right-width:1px; background-color:#dee8f4; }
    32 td.whs16 { width:85px; padding-right:10px; padding-left:10px; border-left-style:Solid; border-left-width:1px; border-left-color:#c0c0c0; border-right-width:1px; border-right-color:#c0c0c0; border-right-style:Solid; border-bottom-width:1px; border-bottom-color:#c0c0c0; border-bottom-style:Solid; }
    33 td.whs17 { width:503px; padding-right:10px; padding-left:10px; border-right-width:1px; border-right-color:#c0c0c0; border-right-style:Solid; border-bottom-width:1px; border-bottom-color:#c0c0c0; border-bottom-style:Solid; }
    34 td.whs18 { width:588px; padding-right:10px; padding-left:10px; border-left-style:Solid; border-left-width:1px; border-left-color:#c0c0c0; border-right-width:1px; border-right-color:#c0c0c0; border-right-style:Solid; border-bottom-width:1px; border-bottom-color:#c0c0c0; border-bottom-style:Solid; }
    35 td.whs19 { width:85px; padding-right:10px; padding-left:10px; border-left-color:#c0c0c0; border-left-width:1px; border-left-style:Solid; border-right-style:Solid; border-right-color:#c0c0c0; border-right-width:1px; border-bottom-style:Solid; border-bottom-color:#c0c0c0; border-bottom-width:1px; }
    36 td.whs20 { width:503px; padding-right:10px; padding-left:10px; border-right-style:Solid; border-right-color:#c0c0c0; border-right-width:1px; border-bottom-style:Solid; border-bottom-color:#c0c0c0; border-bottom-width:1px; }
    37 td.whs21 { width:588px; padding-right:10px; padding-left:10px; border-left-color:#c0c0c0; border-left-width:1px; border-left-style:Solid; border-right-style:Solid; border-right-color:#c0c0c0; border-right-width:1px; border-bottom-style:Solid; border-bottom-color:#c0c0c0; border-bottom-width:1px; }
    38 img_whs22 { border:none; width:14px; height:16px; float:none; border-style:none; }
    39 -->
    40 </style><script type="text/javascript" language="JavaScript">
    41 <!--
    42 function ehlp_showtip(current,e,text)
    43 {
    44   if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == 'Netscape'))
    45   {
    46     document.tooltip.document.write("<layer bgColor='yellow' style='border:1px solid black;font-size:12px;'>"+ text + "</layer>");
    47     document.tooltip.document.close();
    48     document.tooltip.left=e.pageX+5;
    49     document.tooltip.top=e.pageY+5;
    50     document.tooltip.visibility="show";
    51   }
    52 }
    53 function ehlp_hidetip()
    54 {
    55   document.tooltip.visibility="hidden";
    56 }
    57 //-->
    58 </script>
    59 <script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
    60 <!--
    61 function reDo() {
    62   if (innerWidth != origWidth || innerHeight != origHeight)
    63      location.reload();
    64 }
    65 if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
    66 	origWidth = innerWidth;
    67 	origHeight = innerHeight;
    68 	onresize = reDo;
    69 }
    70 onerror = null; 
    71 //-->
    72 </script>
    73 <style type="text/css">
    74 <!--
    75 div.WebHelpPopupMenu { position:absolute; left:0px; top:0px; z-index:4; visibility:hidden; }
    76 p.WebHelpNavBar { text-align:right; }
    77 -->
    78 </style><script type="text/javascript" language="javascript1.2" src="whmsg.js"></script>
    79 <script type="text/javascript" language="javascript" src="whver.js"></script>
    80 <script type="text/javascript" language="javascript1.2" src="whproxy.js"></script>
    81 <script type="text/javascript" language="javascript1.2" src="whutils.js"></script>
    82 <script type="text/javascript" language="javascript1.2" src="whtopic.js"></script>
    83 <script type="text/javascript" language="javascript1.2">
    84 <!--
    85 if (window.gbWhTopic)
    86 {
    87 	if (window.setRelStartPage)
    88 	{
    89 	addTocInfo("GPIO");
    91 	}
    94 	if (window.setRelStartPage)
    95 	{
    96 	setRelStartPage("msb_peripherals.htm");
    98 		autoSync(0);
    99 		sendSyncInfo();
   100 		sendAveInfoOut();
   101 	}
   103 }
   104 else
   105 	if (window.gbIE4)
   106 		document.location.reload();
   107 //-->
   108 </script>
   109 </head>
   110 <body><script type="text/javascript" language="javascript1.2">
   111 <!--
   112 if (window.writeIntopicBar)
   113 	writeIntopicBar(4);
   114 //-->
   115 </script>
   116 <h1>LatticeMico GPIO &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a title="View Data Sheet" href="gpio.pdf" target="_blank" onmouseover="if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == 'Netscape')) ehlp_showtip(this,event,'View Data Sheet');" onmouseout="if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == 'Netscape')) ehlp_hidetip();"><img src="ds_icon_ast.jpg" x-maintain-ratio="TRUE" width="29px" height="31px" border="0" class="img_whs1"></a></h1>
   118 <p>The LatticeMico general-purpose input/output core (GPIO) provides a 
   119  memory-mapped interface between a WISHBONE slave port and general-purpose 
   120  I/O ports. The I/O ports can connect to either on-chip or off-chip logic.</p>
   122 <p class="whs2">*If the data sheet fails to open, see the 
   123  note at the bottom of this page.</p>
   125 <h2>Revision History</h2>
   127 &nbsp; 
   129 <table x-use-null-cells cellspacing="0" width="637" height="84" class="whs3">
   130 <script language='JavaScript'><!--
   131 if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4)) document.write("</table><table x-use-null-cells cellspacing='0' width='637' height='84' border='1' bordercolor='silver' bordercolorlight='silver' bordercolordark='silver'>");
   132 //--></script>
   133 <col class="whs4">
   134 <col class="whs5">
   136 <tr valign="top" class="whs6">
   137 <td bgcolor="#DEE8F4" width="85px" class="whs7">
   138 <p class=Table
   139 	style="font-weight: bold;">Version</td>
   140 <td bgcolor="#DEE8F4" width="505px" class="whs8">
   141 <p class=Table
   142 	style="font-weight: bold;">Description</td></tr>
   144 <tr valign="top" class="whs6">
   145 <td colspan="1" rowspan="1" width="85px" class="whs9">
   146 <p class=Table
   147 	style="font-weight: normal;">3.3</td>
   148 <td colspan="1" rowspan="1" width="505px" class="whs10">
   149 <p class=Table>Added software support for LatticeMico8.
   150 </td></tr>
   152 <tr valign="top" class="whs6">
   153 <td colspan="1" rowspan="1" width="85px" class="whs9">
   154 <p class=Table
   155 	style="font-weight: normal;">3.2 (8.1 SP1)</td>
   156 <td colspan="1" rowspan="1" width="505px" class="whs10">
   157 <p class=Table>WISHBONE data bus size is configurable to 8 or 32 bits. 
   158  Register map is updated to accommodate 8/32-bit WISHBONE data bus. </td></tr>
   160 <tr valign="top" class="whs6">
   161 <td colspan="1" rowspan="1" width="85px" class="whs9">
   162 <p class=Table
   163 	style="font-weight: normal;">3.1 (7.2)</td>
   164 <td colspan="1" rowspan="1" width="505px" class="whs10">
   165 <p class=Table>Updated the Edge Capture Register clean method</p>
   166 <p class=Table>Made IRQ Mask register readable</td></tr>
   168 <tr valign="top" class="whs6">
   169 <td colspan="1" rowspan="1" width="85px" class="whs9">
   170 <p class=Table
   171 	style="font-weight: normal;">3.0 (7.0 SP2)</td>
   172 <td colspan="1" rowspan="1" width="505px" class="whs10">
   173 <p class=Table>Cleaned up code. No function change.</td></tr>
   175 <tr valign="top" class="whs6">
   176 <td colspan="1" rowspan="1" width="85px" class="whs9">
   177 <p class=Table
   178 	style="font-weight: normal;">1.0</td>
   179 <td colspan="1" rowspan="1" width="505px" class="whs10">
   180 <p class=Table>Initial release.</td></tr>
   181 <script language='JavaScript'><!--
   182 if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4)) document.write("</table></table><table>");
   183 //--></script>
   184 </table>
   186 <h2>Dialog Box Parameters</h2>
   188 <table x-use-null-cells cellspacing="0" class="whs11">
   189 <col class="whs4">
   190 <col class="whs12">
   192 <tr valign="top" class="whs13">
   193 <td bgcolor="#DEE8F4" width="85px" class="whs14">
   194 <p class=Table
   195 	style="font-weight: bold;">Parameter</td>
   196 <td bgcolor="#DEE8F4" width="503px" class="whs15">
   197 <p class=Table
   198 	style="font-weight: bold;">Description</td></tr>
   200 <tr valign="top" class="whs13">
   201 <td colspan="1" rowspan="1" width="85px" class="whs16">
   202 <p class=Table>Instance Name</td>
   203 <td colspan="1" rowspan="1" width="503px" class="whs17">
   204 <p class=Table>Specifies the name of the GPIO instance. Alphanumeric values 
   205  and underscores are supported. The default is gpio.</td></tr>
   207 <tr valign="top" class="whs13">
   208 <td width="85px" class="whs16">
   209 <p class=Table>Base Address</td>
   210 <td width="503px" class="whs17">
   211 <p class=Table>Specifies the base address for the device. The minimum boundary 
   212  alignment is 0X80. Supported values are 0X80000000 to 0XFFFFFF80. The 
   213  default is 0x80000000. If other components are included in the platform, 
   214  the allowable values will vary.</td></tr>
   216 <tr valign="top" class="whs13">
   217 <td colspan="2" rowspan="1" width="588px" class="whs18">
   218 <p class=Table
   219 	style="font-weight: bold;">Port Types</td>
   220 </tr>
   222 <tr valign="top" class="whs13">
   223 <td colspan="1" rowspan="1" width="85px" class="whs16">
   224 <p class=Table>Output Ports Only</td>
   225 <td colspan="1" rowspan="1" width="503px" class="whs17">
   226 <p class=Table>Specifies the transfer mode of PIO ports as output only. 
   227  This option is selected by default.</td></tr>
   229 <tr valign="top" class="whs13">
   230 <td colspan="1" rowspan="1" width="85px" class="whs19">
   231 <p class=Table>Input Ports Only</td>
   232 <td colspan="1" rowspan="1" width="503px" class="whs20">
   233 <p class=Table>Specifies the transfer mode of PIO ports as input only. 
   234  This option is deselected by default.</td></tr>
   236 <tr valign="top" class="whs13">
   237 <td colspan="1" rowspan="1" width="85px" class="whs16">
   238 <p class=Table>Tristate Ports</td>
   239 <td colspan="1" rowspan="1" width="503px" class="whs17">
   240 <p class=Table>Specifies the transfer mode of PIO ports as tristate only. 
   241  This option is deselected by default.</td></tr>
   243 <tr valign="top" class="whs13">
   244 <td colspan="1" rowspan="1" width="85px" class="whs19">
   245 <p class=Table>Both Input and Output</td>
   246 <td colspan="1" rowspan="1" width="503px" class="whs20">
   247 <p class=Table>Specifies the transfer mode of PIO ports as both input and 
   248  output. This option is deselected by default.</td></tr>
   250 <tr valign="top" class="whs13">
   251 <td colspan="2" rowspan="1" width="588px" class="whs18">
   252 <p class=Table
   253 	style="font-weight: bold;">Port Width</td>
   254 </tr>
   256 <tr valign="top" class="whs13">
   257 <td colspan="1" rowspan="1" width="85px" class="whs16">
   258 <p class=Table>Data Width</td>
   259 <td colspan="1" rowspan="1" width="503px" class="whs17">
   260 <p class=Table>Specifies the width of the I/O port, in bits. Supported 
   261  values are 1 to 32. The default is 1.</td></tr>
   263 <tr valign="top" class="whs13">
   264 <td colspan="1" rowspan="1" width="85px" class="whs19">
   265 <p class=Table>Input Width</td>
   266 <td colspan="1" rowspan="1" width="503px" class="whs20">
   267 <p class=Table>Specifies the input data bus width for an independent input/output 
   268  GPIO, in bits. Supported values are 1 to 32. The default is 1.</td></tr>
   270 <tr valign="top" class="whs13">
   271 <td colspan="1" rowspan="1" width="85px" class="whs16">
   272 <p class=Table>Output Width</td>
   273 <td colspan="1" rowspan="1" width="503px" class="whs17">
   274 <p class=Table>Specifies the output data bus width for an independent input/output 
   275  GPIO, in bits. Supported values are 1 to 32. The default is 1.</td></tr>
   277 <tr valign="top" class="whs13">
   278 <td colspan="2" rowspan="1" width="588px" class="whs21">
   279 <p class=Table
   280 	style="font-weight: bold;">IRQ Mode</td>
   281 </tr>
   283 <tr valign="top" class="whs13">
   284 <td colspan="1" rowspan="1" width="85px" class="whs19">
   285 <p class=Table>IRQ Mode</td>
   286 <td colspan="1" rowspan="1" width="503px" class="whs20">
   287 <p class=Table>Provides IRQ signal output when a specified event occurs 
   288  on input ports. This option is deselected by default.</td></tr>
   290 <tr valign="top" class="whs13">
   291 <td colspan="1" rowspan="1" width="85px" class="whs16">
   292 <p class=Table>Level</td>
   293 <td colspan="1" rowspan="1" width="503px" class="whs17">
   294 <p class=Table>Generates an IRQ whenever a specific input is high and interrupts 
   295  have been enabled for that input in the IRQ-MASK register. This option 
   296  is deselected by default.</td></tr>
   298 <tr valign="top" class="whs13">
   299 <td colspan="1" rowspan="1" width="85px" class="whs19">
   300 <p class=Table>Edge</td>
   301 <td colspan="1" rowspan="1" width="503px" class="whs20">
   302 <p class=Table>Generates an IRQ whenever a specific bit in the edge capture 
   303  register is high and interrupts have been enabled for that bit in the 
   304  IRQ-MASK register. This option is selected by default.</td></tr>
   306 <tr valign="top" class="whs13">
   307 <td colspan="2" rowspan="1" width="588px" class="whs18">
   308 <p class=Table
   309 	style="font-weight: bold;">Edge Response</td>
   310 </tr>
   312 <tr valign="top" class="whs13">
   313 <td colspan="1" rowspan="1" width="85px" class="whs16">
   314 <p class=Table>Either Edge</td>
   315 <td colspan="1" rowspan="1" width="503px" class="whs17">
   316 <p class=Table>Generates an IRQ on either low-to-high or high-to-low transitions. 
   317  This option is deselected by default.</td></tr>
   319 <tr valign="top" class="whs13">
   320 <td colspan="1" rowspan="1" width="85px" class="whs19">
   321 <p class=Table>Positive Edge</td>
   322 <td colspan="1" rowspan="1" width="503px" class="whs20">
   323 <p class=Table>Generates an IRQ on low-to-high transitions. This option 
   324  is selected by default.</td></tr>
   326 <tr valign="top" class="whs13">
   327 <td colspan="1" rowspan="1" width="85px" class="whs16">
   328 <p class=Table>Negative Edge</td>
   329 <td colspan="1" rowspan="1" width="503px" class="whs17">
   330 <p class=Table>Generates an IRQ on high-to-low transitions. This option 
   331  is deselected by default.</td></tr>
   333 <tr valign="top" class="whs13">
   334 <td colspan="2" rowspan="1" width="85px" class="whs16">
   335 <p class=Table
   336 	style="font-weight: bold;">WISHBONE Configuration</td>
   337 </tr>
   339 <tr valign="top" class="whs13">
   340 <td colspan="1" rowspan="1" width="85px" class="whs16">
   341 <p class=Table>WISHBONE Data Bus Width</td>
   342 <td colspan="1" rowspan="1" width="503px" class="whs17">
   343 <p class=Table>Specifies the WISHBONE data bus width in bits. Supported 
   344  values are 8 and 32. The default is 32.</td></tr>
   345 </table>
   347 &nbsp; 
   349 <p><span style="font-weight: bold;"><B>Note</B></span>: If the data sheet fails 
   350  to open, click <img src="qm_icon.jpg" x-maintain-ratio="TRUE" width="14px" height="16px" border="0" class="img_whs22"> on the Available Components toolbar, and 
   351  then click the note button.</p>
   353 <script type="text/javascript" language="JavaScript">
   354 <!--
   355  if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == 'Netscape'))
   356   document.write("<div id='tooltip' class='WebHelpPopupMenu'></div>");
   357 //-->
   358 </script><script type="text/javascript" language="javascript1.2">
   359 <!--
   360 if (window.writeIntopicBar)
   361 	writeIntopicBar(0);
   362 //-->
   363 </script>
   364 </body>
   365 </html>