'잡동사니'에 해당되는 글 13451건

  1. 2022.10.26 mkpipe 와 poll
  2. 2022.10.24 닌텐도 스위치 방틴유리 깨짐
  3. 2022.10.24 FFT
  4. 2022.10.23 장보기 두렵다
  5. 2022.10.22 피곤 기절
  6. 2022.10.20 ‘F_SETPIPE_SZ’ undeclared
  7. 2022.10.19 fftw 예제 와 복소수 처리
  8. 2022.10.19 tlv
  9. 2022.10.19 fftw 테스트(tests/bench)
  10. 2022.10.19 fftw cross compile
Linux API/linux2022. 10. 26. 14:24

가능은 한 것 같은데..

[링크 : https://stackoverflow.com/questions/15055065/o-rdwr-on-named-pipes-with-poll]

[링크 : https://man7.org/linux/man-pages/man3/mkfifo.3.html]

 

Macro: int ENXIO“No such device or address.” The system tried to use the device represented by a file you specified, and it couldn’t find the device. This can mean that the device file was installed incorrectly, or that the physical device is missing or not correctly attached to the computer.

[링크 : https://www.gnu.org/software/libc/manual/html_node/Error-Codes.html]

 

+

2022.10.27

POLLIN으로 탐지가 되는 듯?

$ cat rx.c
//#define _GNU_SOURCE

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <linux/fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <sys/poll.h>

#define  FIFO_FILE   "/tmp/fifo"
#define  BUFF_SIZE  1024*768*4
struct pollfd pfd[1];

int main(int argc, char** argv)
{
                int ret = 0;
                int   counter = 0;
                int   fd;
                char  buff[BUFF_SIZE];

                //              printf("argc[%d]\n",argc);
                if ( -1 == mkfifo( FIFO_FILE, 0666)){
                                perror( "mkfifo() 실행에러");
                                exit( 1);
                }

                if ( -1 == ( fd = open( FIFO_FILE, O_RDONLY|O_NONBLOCK))){  //  <---- (A)
                                perror( "open() 실행에러");
                                exit( 1);
                }
                ret = fcntl(fd, F_SETPIPE_SZ, 1024 * 1024);
                pfd[0].fd = fd;
                pfd[0].events = POLLIN;

                printf("fd[%d]ret[%d]\n",fd,ret);

                while( 1 ){
                                int n = poll(pfd, 1, 10);
                                if (n > 0)
                                {
                                        memset( buff, 0, BUFF_SIZE);
                                        ret = read( fd, buff, BUFF_SIZE);
                                        if(ret > 0 )
                                                        printf("ret[%d]\n",ret);
                                        //      printf( "%d: %s\n", counter++, buff);
                                }
                                printf(".");
                                usleep(10000);
                }
                close( fd);
}
$ cat tx.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>

#define  FIFO_FILE   "/tmp/fifo"

int main_loop = 1;
int write_loop = 1;

void sigint_handler(int sig)
{
                main_loop = 0;
                write_loop = 0;
}

void sigpipe_handler(int sig)
{
                write_loop = 0;
}

int main(int argc, char **argv)
{
                int   fd;
                int   fd_r;
                //   char *str   = "badayak.com";
                char *str = NULL;
                char *temp = NULL;

                str = (char*)malloc(1024*768*4);
                temp = (char*)malloc(1024*768*4);
                memset(str, *argv[1], 1024*768*4);

//              signal(SIGPIPE, SIG_IGN);
                signal(SIGPIPE, &sigpipe_handler);
                signal(SIGINT, &sigint_handler);
                /*
                   printf("%d\n",__LINE__);
                   if ( -1 == mkfifo( FIFO_FILE, 0666)){
                   perror( "mkfifo() 실행에러");
                   exit( 1);
                   }
                 */
                while(main_loop)
                {
                                printf("%d\n",__LINE__);
                                do {
                                                fd = open( FIFO_FILE, O_WRONLY | O_NONBLOCK);
                                                usleep(100000);
                                                printf("fd[%d] %d\n",fd,__LINE__);
                                                if(main_loop == 0 && write_loop == 0) exit(1);
                                } while(fd == -1);
                                write_loop = 1;

                                int ret = 0;
                                while(write_loop)
                                {
                                                printf("%d\n",__LINE__);
                                                int a = write( fd, str, atoi(argv[1]));
                                                printf("%d a[%d]\n",__LINE__,a);
                                                usleep(1000000);
                                }
                }
                close( fd);
}

'Linux API > linux' 카테고리의 다른 글

pthread  (0) 2022.11.23
iio(industrial io) 문서  (0) 2022.11.11
‘F_SETPIPE_SZ’ undeclared  (0) 2022.10.20
linux fifo  (0) 2022.10.18
SIGPIPE  (0) 2022.10.17
Posted by 구차니
게임/닌텐도 스위치2022. 10. 24. 23:07

으앙 ㅠㅠ

Posted by 구차니

FFT

FFT Size - 몇 번의 샘플을 분석할 것인지

Window - 사용하지 않을때 Rectangular / Flat / Uniform

- Hannning Window(cosine?)

- Blackman 윈도우, Kaiser 윈도우(최근 제안, 사이드 로브가 적은 편)

 

사이드 로브(side libe, leakage) - 중심 주파수 하나가 아니라 주변부 주파수가 나오는 문제

 

대역폭(Bandwidth) - Hz 단위

 

[링크 : https://m.blog.naver.com/suya309/221467948212]

 

[링크 : https://scribblinganything.tistory.com/181]

'프로그램 사용 > fft, fftw' 카테고리의 다른 글

real to complex  (0) 2022.11.04
fftw wisdom  (0) 2022.11.04
fftw 예제 와 복소수 처리  (0) 2022.10.19
fftw 테스트(tests/bench)  (0) 2022.10.19
fftw cross compile  (0) 2022.10.19
Posted by 구차니

가격이 머 조금 집으면 10만원대..

'개소리 왈왈 > 육아관련 주저리' 카테고리의 다른 글

ko  (0) 2022.10.28
질러?  (0) 2022.10.27
피곤 기절  (0) 2022.10.22
기절기절  (0) 2022.10.09
일정 망함  (0) 2022.10.08
Posted by 구차니

자도자도 피곤하네

연혼이 피로한게야..

'개소리 왈왈 > 육아관련 주저리' 카테고리의 다른 글

질러?  (0) 2022.10.27
장보기 두렵다  (0) 2022.10.23
기절기절  (0) 2022.10.09
일정 망함  (0) 2022.10.08
내일 여의도 불꽃축제  (0) 2022.10.07
Posted by 구차니
Linux API/linux2022. 10. 20. 10:50

커널이 5.4.0 이라 그런가

해당 선언을 해주어야 에러가 사라진다.

 

#define _GNU_SOURCE

[링크 : https://stackoverflow.com/questions/25411892/f-setpipe-sz-undeclared]

 

 

Defining _GNU_SOURCE has nothing to do with license and everything to do with writing (non-)portable code. If you define _GNU_SOURCE, you will get:
  1. access to lots of nonstandard GNU/Linux extension functions
  2. access to traditional functions which were omitted from the POSIX standard (often for good reason, such as being replaced with better alternatives, or being tied to particular legacy implementations)
  3. access to low-level functions that cannot be portable, but that you sometimes need for implementing system utilities like mount, ifconfig, etc.
  4. broken behavior for lots of POSIX-specified functions, where the GNU folks disagreed with the standards committee on how the functions should behave and decided to do their own thing.
As long as you're aware of these things, it should not be a problem to define _GNU_SOURCE, but you should avoid defining it and instead define _POSIX_C_SOURCE=200809L or _XOPEN_SOURCE=700 when possible to ensure that your programs are portable.
In particular, the things from _GNU_SOURCE that you should never use are #2 and #4 above.
 

[링크 : https://stackoverflow.com/questions/5582211/what-does-define-gnu-source-imply]

 

호환성 지정 매크로

[링크 : https://m.blog.naver.com/netiz21/150015716721]

 

#include <fcntl.h> 대신

#include <linux/fcntl.h> 하면 _GNU_SOURCE를 해주지 않아도 되긴 한데

다른데서 경고가 뜨니 알아서 써야 할 듯.

/usr/include/linux/fcntl.h:28:#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
/usr/include/linux/fcntl.h:29:#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)

'Linux API > linux' 카테고리의 다른 글

iio(industrial io) 문서  (0) 2022.11.11
mkpipe 와 poll  (0) 2022.10.26
linux fifo  (0) 2022.10.18
SIGPIPE  (0) 2022.10.17
linux ipc 최대 데이터 길이  (0) 2022.10.11
Posted by 구차니

'프로그램 사용 > fft, fftw' 카테고리의 다른 글

fftw wisdom  (0) 2022.11.04
FFT  (0) 2022.10.24
fftw 테스트(tests/bench)  (0) 2022.10.19
fftw cross compile  (0) 2022.10.19
fft  (0) 2020.11.25
Posted by 구차니

tlv

 

http://www.ktword.co.kr/test/view/view.php?m_temp1=3739

'이론 관련 > 컴퓨터 관련' 카테고리의 다른 글

vRAN  (0) 2023.08.23
cordic (coordinate rotation digital computer)  (0) 2023.02.27
DR - Disaster Recovery Plan  (0) 2022.10.17
SLP - Superword Level Parallelism  (0) 2022.06.02
digital twin  (0) 2022.04.13
Posted by 구차니

도대체 저 옵션들은 먼지 모르겠다.

fftw-3.3.4/tests/bench -o nthreads=2 --verbose=1   --verify 'ok10bx6bx6e11x13b' --verify 'ik10bx6bx6e11x13b' --verify 'obrd7x13v16' --verify 'ibrd7x13v16' --verify 'ofrd7x13v16' --verify 'ifrd7x13v16' --verify '//obcd7x13v16' --verify '//ibcd7x13v16' --verify '//ofcd7x13v16' --verify '//ifcd7x13v16' --verify 'obcd7x13v16' --verify 'ibcd7x13v16' --verify 'ofcd7x13v16' --verify 'ifcd7x13v16' --verify 'okd10bv127' --verify 'ikd10bv127' --verify '//obr240' --verify '//ibr240' --verify '//ofr240' --verify '//ifr240' --verify 'obr240' --verify 'ibr240' --verify 'ofr240' --verify 'ifr240' --verify '//obc240' --verify '//ibc240' --verify '//ofc240' --verify '//ifc240' --verify 'obc240' --verify 'ibc240' --verify 'ofc240' --verify 'ifc240' --verify 'ok11760e00' --verify 'ik11760e00' --verify 'obr33v31' --verify 'ibr33v31' --verify 'ofr33v31' --verify 'ifr33v31' --verify '//obc33v31' --verify '//ibc33v31' --verify '//ofc33v31' --verify '//ifc33v31' --verify 'obc33v31' --verify 'ibc33v31'

[링크 : https://unix.stackexchange.com/questions/209753/how-do-i-check-if-fftw-installed-correctly]

 

 

+

[링크 : https://people.sc.fsu.edu/~jburkardt/c_src/fftw_test/]

[링크 : https://people.sc.fsu.edu/~jburkardt/c_src/fftw_test/fftw_test.html]

'프로그램 사용 > fft, fftw' 카테고리의 다른 글

FFT  (0) 2022.10.24
fftw 예제 와 복소수 처리  (0) 2022.10.19
fftw cross compile  (0) 2022.10.19
fft  (0) 2020.11.25
fftw  (0) 2020.11.25
Posted by 구차니

 

[링크 : https://www.fftw.org/download.html]

 

./configure --prefix=/home/zhouxiaoyong/fftw3_test --disable-fortran --with-slow-timer --host=arm-none-linux-gnueabi --enable-single  --enable-neon   --enable-shared CC=arm-none-linux-gnueabi-gcc CFLAGS="-march=armv7-a -mfpu=neon -fPIC -ldl -mfloat-abi=softfp"

[링크 : https://codeantenna.com/a/ztGG77F10Z]

 

 

The basic usage of FFTW is simple. A typical call to FFTW looks like:
#include <fftw.h>
...
{
     fftw_complex in[N], out[N];
     fftw_plan p;
     ...
     p = fftw_create_plan(N, FFTW_FORWARD, FFTW_ESTIMATE);
     ...
     fftw_one(p, in, out);
     ...
     fftw_destroy_plan(p);  
}


For example, code to perform an in-place FFT of a three-dimensional array might look like:
#include <fftw.h>
...
{
     fftw_complex in[L][M][N];
     fftwnd_plan p;
     ...
     p = fftw3d_create_plan(L, M, N, FFTW_FORWARD,
                            FFTW_MEASURE | FFTW_IN_PLACE);
     ...
     fftwnd_one(p, &in[0][0][0], NULL);
     ...
     fftwnd_destroy_plan(p);  
}

The following is a brief example in which the wisdom is read from a file, a plan is created (possibly generating more wisdom), and then the wisdom is exported to a string and printed to stdout.
{
     fftw_plan plan;
     char *wisdom_string;
     FILE *input_file;

     /* open file to read wisdom from */
     input_file = fopen("sample.wisdom", "r");
     if (FFTW_FAILURE == fftw_import_wisdom_from_file(input_file))
          printf("Error reading wisdom!\n");
     fclose(input_file); /* be sure to close the file! */

     /* create a plan for N=64, possibly creating and/or using wisdom */
     plan = fftw_create_plan(64,FFTW_FORWARD,
                             FFTW_MEASURE | FFTW_USE_WISDOM);

     /* ... do some computations with the plan ... */

     /* always destroy plans when you are done */
     fftw_destroy_plan(plan);

     /* write the wisdom to a string */
     wisdom_string = fftw_export_wisdom_to_string();
     if (wisdom_string != NULL) {
          printf("Accumulated wisdom: %s\n",wisdom_string);

          /* Just for fun, destroy and restore the wisdom */
          fftw_forget_wisdom(); /* all gone! */
          fftw_import_wisdom_from_string(wisdom_string);
          /* wisdom is back! */

          fftw_free(wisdom_string); /* deallocate it since we're done */
     }
}

[링크 : http://www.fftw.org/fftw2_doc/fftw_2.html]

'프로그램 사용 > fft, fftw' 카테고리의 다른 글

fftw 예제 와 복소수 처리  (0) 2022.10.19
fftw 테스트(tests/bench)  (0) 2022.10.19
fft  (0) 2020.11.25
fftw  (0) 2020.11.25
ffmpeg fft 분석 예제  (0) 2020.11.25
Posted by 구차니