Last active
July 23, 2021 06:07
-
-
Save DhruvaG2000/3b2f1bf43e67335bd1ab097325b17c94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
- While play is running: | |
[offset 0]00000103 00000000 04000020 00000000 00000000 00000000 00000000 00000000 01050000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 | |
[offset 40]00074102 00000000 00000000 00000000 07000002 00000000 | |
- when aplay not running | |
[offset 0]00000103 00000000 04000020 00000000 00000000 00000000 00000000 00000000 01050000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 | |
[offset 40]00004102 00000000 00000000 00000000 07030000 00000000 | |
-----------edited code output for better visibility ---------------- | |
after aplay: | |
sharedStart address: 4a005500 | |
[offset 0]n=0: 0103 n=1: 0000 n=2: 4000020 n=3: 0000 n=4: 0000 n=5: 0000 n=6: 0000 n=7: 0000 n=8: 1050000 n=9: 0000 n=10: 0000 n=11: 0000 n=12: 0000 n=13: 0000 n=14: 0000 n=15: 0000 | |
[offset 40]n=16: 74102 n=17: 0000 n=18: 0000 n=19: 0000 n=20: 7000002 n=21: 0000 n=22: 30000 n=23: 0000 n=24: 30000 n=25: 0000 n=26: 30000 n=27: 0000 n=28: 30000 n=29: 0000 n=30: 30000 n=31: 0000 | |
[offset 80]n=32: 0002 n=33: 0000 n=34: 0000 n=35: 0000 n=36: 0000 n=37: 0000 n=38: 0000 n=39: 0000 n=40: 0000 n=41: 0000 n=42: 0000 n=43: 0000 n=44: 0000 n=45: 0000 n=46: 0000 n=47: 0000 | |
[offset c0]n=48: 0000 n=49: 0000 n=50: 0000 n=51: 0000 n=52: 0000 n=53: 0000 n=54: 0000 n=55: 0000 n=56: 0000 n=57: 0000 n=58: 0000 n=59: 0000 n=60: 0000 n=61: 0000 n=62: 0000 n=63: 0000 | |
before aplay: | |
sharedStart address: 4a005500 | |
[offset 0]n=0: 0103 n=1: 0000 n=2: 4000020 n=3: 0000 n=4: 0000 n=5: 0000 n=6: 0000 n=7: 0000 n=8: 1050000 n=9: 0000 n=10: 0000 n=11: 0000 n=12: 0000 n=13: 0000 n=14: 0000 n=15: 0000 | |
[offset 40]n=16: 4102 n=17: 0000 n=18: 0000 n=19: 0000 n=20: 7030000 n=21: 0000 n=22: 30000 n=23: 0000 n=24: 30000 n=25: 0000 n=26: 30000 n=27: 0000 n=28: 30000 n=29: 0000 n=30: 30000 n=31: 0000 | |
[offset 80]n=32: 0002 n=33: 0000 n=34: 0000 n=35: 0000 n=36: 0000 n=37: 0000 n=38: 0000 n=39: 0000 n=40: 0000 n=41: 0000 n=42: 0000 n=43: 0000 n=44: 0000 n=45: 0000 n=46: 0000 n=47: 0000 | |
[offset c0]n=48: 0000 n=49: 0000 n=50: 0000 n=51: 0000 n=52: 0000 n=53: 0000 n=54: 0000 n=55: 0000 n=56: 0000 n=57: 0000 n=58: 0000 n=59: 0000 n=60: 0000 | |
--------------------------------------------- | |
For more info, C program and also a package for mmap visit https://elinux.org/EBC_Exercise_11b_gpio_via_mmap | |
*/ | |
// The mmap code: | |
#include <Mmap.h> // this is in Bela/include, so you 'll have to also build and link in core/Mmap.cpp | |
#include <stdio.h> | |
#include <stdint.h> | |
// fill these in based on the TRM | |
uint32_t pruSharedRam = 0x4a005500; // pg 873 of AM57x manual: CM_IPU_MCASP1_CLKCTRL | |
uint32_t pruSharedRamSize = 0x58; // just before CM_IPU_TIMER5_CLKCTRL which is at 0x4a00 5558 | |
uint32_t pru0DataRam = 0; | |
uint32_t pru0DataRamSize = 0; | |
uint32_t pru1DataRam = 0; | |
uint32_t pru1DataRamSize = 0; | |
void map_and_print(const char* label, uint32_t start, uint32_t size) | |
{ | |
Mmap mem; | |
uint32_t* ptr = (uint32_t*)mem.map(start, size); | |
printf("%s", label); | |
for(unsigned int n = 0; n < size / sizeof(*ptr); ++n) | |
{ | |
if(0 == (n % 16)) | |
printf("\n[offset %8x]", n * sizeof(*ptr)); | |
printf("%08x ", ptr[n]); | |
} | |
} | |
int main() | |
{ | |
map_and_print("shared", pruSharedRam, pruSharedRamSize); | |
// map_and_print("pru 0 data", pru0DataRam, pru0DataRamSize); | |
// map_and_print("pru 1 data", pru1DataRam, pru1DataRamSize); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment