ASF4 API Reference Manual - Microchip Technology

ASF4 API Reference Manual

ASF4 API Reference Manual

? 2017 Microchip Technology Inc.

Draft User Guide

DS50002633A-page 1

ASF4 API Reference Manual

Table of Contents

1. Advanced Software Framework Version 4 (ASF4) Introduction and Context ...........8

1.1. Introduction to ASF4.....................................................................................................................8 1.2. Atmel START, Software Content, and IDEs................................................................................. 9 1.3. Quick Start and Workflow Overview ..........................................................................................10 1.4. Documentation Resources......................................................................................................... 11

2. Software Architecture.............................................................................................. 13

2.1. Peripheral Driver - Architecture Overview.................................................................................. 13 2.2. ASF4 Project Folder Structure................................................................................................... 18 2.3. Hardware Abstraction Layer (HAL)............................................................................................ 25 2.4. I/O System..................................................................................................................................27 2.5. Hardware Proxy Layer (HPL)..................................................................................................... 29 2.6. Hardware Register Interface (HRI).............................................................................................31 2.7. RTOS Support............................................................................................................................34 2.8. ASF4 Project Folder Structure - Full.......................................................................................... 36

3. Driver Implementation and Design Conventions..................................................... 39

3.1. Introduction.................................................................................................................................39 3.2. ASF4 and Atmel START Configuration...................................................................................... 39 3.3. Driver Implementation................................................................................................................ 40 3.4. Design Conventions................................................................................................................... 42 3.5. Toolchain and Device-specific Support...................................................................................... 45 3.6. Embedded Software Coding Style............................................................................................. 47

4. AC Drivers............................................................................................................... 58

4.1. AC Basics and Best Practice......................................................................................................58 4.2. AC Asynchronous Driver............................................................................................................ 58 4.3. AC Synchronous Driver..............................................................................................................63

5. ADC Drivers.............................................................................................................68

5.1. ADC Basics and Best Practice................................................................................................... 68 5.2. ADC Asynchronous Driver......................................................................................................... 69 5.3. ADC DMA Driver........................................................................................................................ 82 5.4. ADC RTOS Driver...................................................................................................................... 91 5.5. ADC Synchronous Driver......................................................................................................... 103

6. Analog Glue Function............................................................................................ 113

6.1. Summary of the API's Functional Features.............................................................................. 113 6.2. Summary of Configuration Options.......................................................................................... 113 6.3. Driver Implementation Description........................................................................................... 113 6.4. Example of Usage.................................................................................................................... 113 6.5. Dependencies...........................................................................................................................113 6.6. Functions.................................................................................................................................. 113

7. CAN Driver.............................................................................................................115

? 2017 Microchip Technology Inc.

Draft User Guide

DS50002633A-page 2

ASF4 API Reference Manual

7.1. CAN Basics and Best Practice................................................................................................. 115 7.2. CAN Asynchronous Driver........................................................................................................115

8. CRC Driver............................................................................................................ 123

8.1. CRC Basics and Best Practice.................................................................................................123 8.2. CRC Synchronous Driver......................................................................................................... 123

9. Calendar Drivers....................................................................................................128

9.1. Calendar Basics and Best Practice.......................................................................................... 128 9.2. Calendar Bare-bone Driver...................................................................................................... 128 9.3. Calendar RTOS Driver............................................................................................................. 135

10. Camera Driver....................................................................................................... 142

10.1. Camera Basics and Best Practice............................................................................................142 10.2. Camera Asynchronous Driver.................................................................................................. 142

11. Cryptography (AES) Driver....................................................................................147

11.1. AES Basics and Best Practice................................................................................................. 147 11.2. AES Synchronous Driver..........................................................................................................147

12. DAC Drivers...........................................................................................................164

12.1. DAC Basics and Best Practice................................................................................................. 164 12.2. DAC Asynchronous Driver....................................................................................................... 164 12.3. DAC RTOS Driver.................................................................................................................... 170 12.4. DAC Synchronous Driver......................................................................................................... 175

13. Delay Driver...........................................................................................................179

13.1. Summary of the API's Functional Features..............................................................................179 13.2. Summary of Configuration Options.......................................................................................... 179 13.3. Driver Implementation Description........................................................................................... 179 13.4. Example of Usage.................................................................................................................... 179 13.5. Dependencies.......................................................................................................................... 179 13.6. Functions..................................................................................................................................179

14. Digital Glue Logic.................................................................................................. 181

14.1. Summary of the API's Functional Features..............................................................................181 14.2. Summary of Configuration Options.......................................................................................... 181 14.3. Driver Implementation Description........................................................................................... 181 14.4. Example of Usage.................................................................................................................... 181 14.5. Dependencies.......................................................................................................................... 181 14.6. Functions..................................................................................................................................181

15. Ethernet MAC Driver............................................................................................. 183

15.1. Ethernet Asynchronous Driver................................................................................................. 183

16. Event System Driver..............................................................................................191

16.1. Event System Basics and Best Practice.................................................................................. 191 16.2. Summary of the API's Functional Features..............................................................................192 16.3. Summary of Configuration Options.......................................................................................... 192

? 2017 Microchip Technology Inc.

Draft User Guide

DS50002633A-page 3

ASF4 API Reference Manual

16.4. Driver Implementation Description........................................................................................... 192 16.5. Example of Usage.................................................................................................................... 192 16.6. Dependencies.......................................................................................................................... 192 16.7. Functions..................................................................................................................................192

17. External Bus Driver................................................................................................196

17.1. Summary of the API's Functional Features..............................................................................196 17.2. Summary of Configuration Options.......................................................................................... 196 17.3. Example of Usage.................................................................................................................... 196 17.4. Dependencies.......................................................................................................................... 197

18. External IRQ Driver............................................................................................... 198

18.1. External IRQ Basics and Best Practice.................................................................................... 198 18.2. Summary of the API's Functional Features..............................................................................198 18.3. Summary of Configuration Options.......................................................................................... 198 18.4. Example of Usage.................................................................................................................... 198 18.5. Dependencies.......................................................................................................................... 198 18.6. Typedefs...................................................................................................................................199 18.7. Functions..................................................................................................................................199

19. Flash Driver........................................................................................................... 202

19.1. Summary of the API's Functional Features..............................................................................202 19.2. Summary of Configuration Options.......................................................................................... 202 19.3. Driver Implementation Description........................................................................................... 202 19.4. Example of Usage.................................................................................................................... 202 19.5. Dependencies.......................................................................................................................... 203 19.6. Structs...................................................................................................................................... 203 19.7. Enums...................................................................................................................................... 203 19.8. Typedefs...................................................................................................................................203 19.9. Functions..................................................................................................................................204

20. Frequency Meter Drivers....................................................................................... 210

20.1. Frequency Meter Basics and Best Practice............................................................................. 210 20.2. Frequency Meter Asynchronous Driver....................................................................................210 20.3. Frequency Meter Synchronous Driver......................................................................................216

21. Graphic LCD Driver............................................................................................... 221

21.1. Summary of the API's Functional Features..............................................................................221 21.2. Summary of Configuration Options.......................................................................................... 221 21.3. Driver Implementation Description........................................................................................... 221 21.4. Example of Usage.................................................................................................................... 221 21.5. Dependencies.......................................................................................................................... 222 21.6. Defines..................................................................................................................................... 222 21.7. Functions..................................................................................................................................222

22. Graphics Processing Unit Driver(2D).................................................................... 227

22.1. Summary of the API's Functional Features..............................................................................227 22.2. Summary of Configuration Options.......................................................................................... 227 22.3. Driver Implementation Description........................................................................................... 227

? 2017 Microchip Technology Inc.

Draft User Guide

DS50002633A-page 4

ASF4 API Reference Manual

22.4. Example of Usage.................................................................................................................... 227 22.5. Dependencies.......................................................................................................................... 228 22.6. Defines..................................................................................................................................... 228 22.7. Functions..................................................................................................................................228

23. Hash Algorithm Driver........................................................................................... 233

23.1. SHA Synchronous Driver......................................................................................................... 233

24. Helper Drivers........................................................................................................240

24.1. Atomic Driver............................................................................................................................240 24.2. I/O Driver.................................................................................................................................. 241 24.3. Init Driver.................................................................................................................................. 243 24.4. Reset Driver............................................................................................................................. 243 24.5. Sleep Driver..............................................................................................................................244

25. I2C Drivers.............................................................................................................246

25.1. I2C Basics and Best Practice................................................................................................... 246 25.2. I2C Master Asynchronous Driver............................................................................................. 246 25.3. I2C Master RTOS Driver.......................................................................................................... 256 25.4. I2C Master Synchronous Driver............................................................................................... 263 25.5. I2C Slave Asynchronous Driver............................................................................................... 271 25.6. I2C Slave Synchronous Driver................................................................................................. 278

26. I2S Controller Driver.............................................................................................. 284

26.1. I2S Controller Synchronous Driver...........................................................................................284

27. MCI Drivers............................................................................................................288

27.1. MCI RTOS Driver..................................................................................................................... 288 27.2. MCI Synchronous Driver.......................................................................................................... 297

28. PAC Driver.............................................................................................................305

28.1. Summary of the API's Functional Features..............................................................................305 28.2. Summary of Configuration Options.......................................................................................... 305 28.3. Driver Implementation Description........................................................................................... 305 28.4. Example of Usage.................................................................................................................... 305 28.5. Dependencies.......................................................................................................................... 305 28.6. Functions..................................................................................................................................306

29. PWM Driver........................................................................................................... 308

29.1. PWM Basics and Best Practice................................................................................................308 29.2. PWM Asynchronous Driver...................................................................................................... 308

30. Position Decoder Driver.........................................................................................313

30.1. PDEC Basics and Best Practice...............................................................................................313 30.2. PDEC Asynchronous Driver..................................................................................................... 313

31. Quad SPI Drivers...................................................................................................320

31.1. Quad SPI Basics and Best Practice......................................................................................... 320 31.2. Quad SPI DMA Driver.............................................................................................................. 320

? 2017 Microchip Technology Inc.

Draft User Guide

DS50002633A-page 5

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download