Steve
2016-02-14 01:45:47 UTC
I was thinking you were creating a monster there with the memory alloc code.
I replaced all that with:
complex float f1_int[sizeof (complex float)*(nsym + 1) * P];
complex float f2_int[sizeof (complex float)*(nsym + 1) * P];
complex float f3_int[sizeof (complex float)*(nsym + 1) * P];
complex float f4_int[sizeof (complex float)*(nsym + 1) * P];
complex float f1_intbuf[sizeof (complex float) * Ts];
complex float f2_intbuf[sizeof (complex float) * Ts];
complex float f3_intbuf[sizeof (complex float) * Ts];
complex float f4_intbuf[sizeof (complex float) * Ts];
Poof!
I usually deprecate malloc, as it is old school. If I want true block
storage or dual-port memory, I just use shared memory.
int fd = open("/run/codec2/codecMemory", O_RDWR | O_CREAT, S_IRUSR |
S_IWUSR);
c2 = (struct codec2 *) mmap(0, sizeof(struct codec2), PROT_READ |
PROT_WRITE, MAP_SHARED, fd, 0);
if (c2 == MAP_FAILED) {
exit(1);
}
lseek (fd, sizeof(struct codec2)+1, SEEK_SET);
if (write (fd, "", 1) != 1) {
exit(1);
}
lseek (fd, 0, SEEK_SET);
close(fd);
I've been playing with it for C99. Haven't tested it yet though.
https://bitbucket.org/a-la-mode/fsk
Course, I haven't done firmware since the Z-80 :-)
Steve
I replaced all that with:
complex float f1_int[sizeof (complex float)*(nsym + 1) * P];
complex float f2_int[sizeof (complex float)*(nsym + 1) * P];
complex float f3_int[sizeof (complex float)*(nsym + 1) * P];
complex float f4_int[sizeof (complex float)*(nsym + 1) * P];
complex float f1_intbuf[sizeof (complex float) * Ts];
complex float f2_intbuf[sizeof (complex float) * Ts];
complex float f3_intbuf[sizeof (complex float) * Ts];
complex float f4_intbuf[sizeof (complex float) * Ts];
Poof!
I usually deprecate malloc, as it is old school. If I want true block
storage or dual-port memory, I just use shared memory.
int fd = open("/run/codec2/codecMemory", O_RDWR | O_CREAT, S_IRUSR |
S_IWUSR);
c2 = (struct codec2 *) mmap(0, sizeof(struct codec2), PROT_READ |
PROT_WRITE, MAP_SHARED, fd, 0);
if (c2 == MAP_FAILED) {
exit(1);
}
lseek (fd, sizeof(struct codec2)+1, SEEK_SET);
if (write (fd, "", 1) != 1) {
exit(1);
}
lseek (fd, 0, SEEK_SET);
close(fd);
I've been playing with it for C99. Haven't tested it yet though.
https://bitbucket.org/a-la-mode/fsk
Course, I haven't done firmware since the Z-80 :-)
Steve