1 / 29

The System Services way of doing Lab. 2 Task 8

The System Services way of doing Lab. 2 Task 8. What was Lab. 2. Activate EBIU, Flash memory, Flash LED, GPIO flags Connect light sensor to PF11 Each time an interrupt occurs on PF11, record the CYCLES counter.

Download Presentation

The System Services way of doing Lab. 2 Task 8

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The System Services way of doing Lab. 2 Task 8

  2. What was Lab. 2 • Activate EBIU, Flash memory, Flash LED, GPIO flags • Connect light sensor to PF11 • Each time an interrupt occurs on PF11, record the CYCLES counter. • Every second time an interrupt occurs, calculate the frequency of the light sensor voltage, and calculate light level • Display the light level on the LED lights

  3. All true, the third timeyou try using it However, that’s what you do inan industrial environment

  4. VDK All the non-hardwarestuff from Lab. 1, 2 and3 stays the same All the hardwarestuff from Lab. 1, 2 and3 – “better?”

  5. Shopping list ?????

  6. Something related to Lab. 2

  7. Sounds like Lab. 2

  8. Where to start? • Make sure we understand the following • Lab. 1 – Setting up the EBIU • Lab. 1 – Activating the LED • Lab. 1 – Activating the GPIO switches • Lab. 2 – software interrupts on GPIO • Lab. 2 – hardware interrupts on GPIO • Lab. 2 – ISR for measuring light sensor output • Assignment 3 – Activating CYCLES

  9. Next step – look for an example This VDSP directory looks promising for GPIO and LED control

  10. File LEDButtonCallback.c This is a .c fileWhat happens ifwant to use an.cpp and asmcompatible to C++? WAIL

  11. Callback function What is a “client handle”? What’s a “u32Event”? What’s a “void *pArg”? Why is function “static”?The rest we can guess This is NOT an ISR – this is a function calledfrom the ISR activated on PF interrupts

  12. We can guess functionality Whats “ezErrorCheck( )? Same as Lab. 1 InitGPIOFlags( ) but 1 button at a time

  13. We can guess functionality Guess – interrupts on PF8 and PF9 Guess – ADI_FLAG_TRIGGER_BOTH_EDGESGuess – ADI_FLAG_POLARITY????? Look in service.h files

  14. More complicated thanInitLEDPort( ) Uses “memory variables”to remember “LED state” Improved WriteLEDASM( ) ?

  15. Improved WriteLEDASM( ) This is ReadGPIO( ) & SW3Pressed == true Terminate services neededfopen( )fclose( ) equivalent

  16. Still a lot more to understand • Many questions still unanswered • In principle we could fix this code to handle Lab. 2 and 3 since we know what Lab. 2 and 3 are supposed to do • We could re-use most of the code • Switch 4 for light sensor • Switch 3 and 2 for thermal sensors • Switch 1 for “stop” • Cut and paste that code

  17. Call back function • Using this “*pArg” thing I could fix it so • If button 4 interrupt then read CYCLES and store in light sensor array • If button 3 interrupt store CYCLES in temp 1 array • If button 2 interrupt store CYCLES in temp 2 array • Once 4 values stored in array, leave “message” for main( ) to do necessary calculation

  18. Main( ) • Do all the same init manager stuff • Make all three buttons call Callback • While loop • If light sensor values ready, calculate light level and display • If temp1 values ready, calculate temperature and print • If temp2 values ready, calculate emperature and print

  19. Quote from Arthur C Clarke • The technology of any sufficiently advanced civilization is indistinguishable from magic. • It may be magic, but based on how I got Labs 1, 2 and 3, I reckon I could hack main( ) to get something to happen. • How I would test it, debug it or customize it – I have not got a clue – meaning I could not extend the ideas to use SDMA or SPI service

  20. I recognize this stuff

  21. I can guess about this stuff

  22. Next Stage • Not entirely sure what is happening • But I believe that if I do good code review, frequently check my syntax, and am lucky, I could do Lab. 1, Lab. 2 and Lab 3 tasks using Services • Debugging things – especially if services are not written as expected, or I have misunderstood something – may be problematic • My code follows

  23. 4 ISR equivalents here

  24. We know enough to “fake” calling CPP ASM codefrom C code without rewriting the code

  25. Don’t know what we didBut that’s Lab. 1, 2 and 3

More Related