Tivaware Peripheral Driver Library User's Guide
Total Page:16
File Type:pdf, Size:1020Kb
TivaWare™ Peripheral Driver Library USER’S GUIDE SW-TM4C-DRL-UG-2.0 Copyright © 2006-2013 Texas Instruments Incorporated Copyright Copyright © 2006-2013 Texas Instruments Incorporated. All rights reserved. Tiva and TivaWare are trademarks of Texas Instruments Instruments. ARM and Thumb are registered trademarks and Cortex is a trademark of ARM Limited. Other names and brands may be claimed as the property of others. Please be aware that an important notice concerning availability, standard warranty, and use in critical applications of Texas Instruments semicon- ductor products and disclaimers thereto appears at the end of this document. Texas Instruments 108 Wild Basin, Suite 350 Austin, TX 78746 www.ti.com/tiva-c Revision Information This is version 2.0 of this document, last updated on August 29, 2013. 2 August 29, 2013 Table of Contents Table of Contents Copyright ..................................................... 2 Revision Information ............................................... 2 1 Introduction ................................................. 7 2 Programming Model ............................................ 11 2.1 Introduction .................................................. 11 2.2 Direct Register Access Model ....................................... 11 2.3 Software Driver Model ............................................ 12 2.4 Combining The Models ........................................... 13 3 Analog Comparator ............................................ 15 3.1 Introduction .................................................. 15 3.2 API Functions ................................................ 15 3.3 Programming Example ........................................... 21 4 Analog to Digital Converter (ADC) .................................... 23 4.1 Introduction .................................................. 23 4.2 API Functions ................................................ 24 4.3 Programming Example ........................................... 45 5 AES ...................................................... 47 5.1 Introduction .................................................. 47 5.2 API Functions ................................................ 47 5.3 Programming Example ........................................... 62 6 Controller Area Network (CAN) ...................................... 65 6.1 Introduction .................................................. 65 6.2 API Functions ................................................ 65 6.3 CAN Message Objects ........................................... 87 6.4 Programming Examples ........................................... 89 7 CRC ...................................................... 93 7.1 Introduction .................................................. 93 7.2 API Functions ................................................ 93 7.3 Programming Example ........................................... 96 8 DES ...................................................... 99 8.1 Introduction .................................................. 99 8.2 API Functions ................................................ 99 8.3 DES Programming Example ........................................ 108 8.4 TDES Programming Example ....................................... 110 9 EEPROM ................................................... 113 9.1 Introduction .................................................. 113 9.2 API Functions ................................................ 114 9.3 Programming Example ........................................... 128 10 Ethernet Controller (New Device Classes) ............................... 129 10.1 Introduction .................................................. 129 10.2 Data Transfer with the Ethernet MAC Controller ............................. 129 10.3 API Functions ................................................ 129 10.4 Programming Example ........................................... 190 11 External Peripheral Interface (EPI) .................................... 191 11.1 Introduction .................................................. 191 August 29, 2013 3 Table of Contents 11.2 API Functions ................................................ 191 11.3 Programming Example ........................................... 218 12 Fan Controller ................................................ 219 12.1 Introduction .................................................. 219 12.2 API Functions ................................................ 219 12.3 Programming Example ........................................... 221 13 Flash ..................................................... 223 13.1 Introduction .................................................. 223 13.2 API Functions ................................................ 223 13.3 Programming Example ........................................... 230 14 Floating-Point Unit (FPU) ......................................... 231 14.1 Introduction .................................................. 231 14.2 API Functions ................................................ 232 14.3 Programming Example ........................................... 236 15 GPIO ..................................................... 237 15.1 Introduction .................................................. 237 15.2 API Functions ................................................ 238 15.3 Programming Example ........................................... 266 16 Hibernation Module ............................................ 269 16.1 Introduction .................................................. 269 16.2 API Functions ................................................ 269 16.3 Programming Example ........................................... 295 17 Inter-Integrated Circuit (I2C) ....................................... 301 17.1 Introduction .................................................. 301 17.2 API Functions ................................................ 302 17.3 Programming Example ........................................... 329 18 Interrupt Controller (NVIC) ........................................ 331 18.1 Introduction .................................................. 331 18.2 API Functions ................................................ 332 18.3 Programming Example ........................................... 339 19 LCD Controller (LCD) ........................................... 341 19.1 Introduction .................................................. 341 19.2 API Functions ................................................ 341 19.3 Programming Example ........................................... 365 20 Low Pin Count Interface (LPC) ...................................... 367 20.1 Introduction .................................................. 367 20.2 API Functions ................................................ 367 21 Memory Protection Unit (MPU) ...................................... 369 21.1 Introduction .................................................. 369 21.2 API Functions ................................................ 369 21.3 Programming Example ........................................... 376 22 Platform Environment Control Interface (PECI) ............................ 379 22.1 Introduction .................................................. 379 22.2 API Functions ................................................ 379 23 Pulse Width Modulator (PWM) ...................................... 381 23.1 Introduction .................................................. 381 23.2 API Functions ................................................ 381 23.3 Programming Example ........................................... 403 4 August 29, 2013 Table of Contents 24 Quadrature Encoder (QEI) ........................................ 405 24.1 Introduction .................................................. 405 24.2 API Functions ................................................ 405 24.3 Programming Example ........................................... 414 25 SHA/MD5 ................................................... 415 25.1 Introduction .................................................. 415 25.2 API Functions ................................................ 415 25.3 Hashing Programming Example ...................................... 425 25.4 HMAC Programming Example ....................................... 425 26 Synchronous Serial Interface (SSI) ................................... 427 26.1 Introduction .................................................. 427 26.2 API Functions ................................................ 427 26.3 Programming Example ........................................... 440 27 Software CRC Module ........................................... 443 27.1 Introduction .................................................. 443 27.2 API Functions ................................................ 443 27.3 Programming Example ........................................... 446 28 System Control ............................................... 447 28.1 Introduction .................................................. 447 28.2 API Functions ................................................ 448 28.3 Programming Example ........................................... 482 29 System Exception Module ........................................ 483 29.1 Introduction .................................................. 483 29.2 API Functions ................................................ 483 29.3 Programming Example ........................................... 486 30 System Tick (SysTick) ........................................... 489 30.1 Introduction .................................................