2022-08-19

[개발노트]USB OTG ID 핀 상태 읽기 (0번비트임)

#include <stdio.h>
#include <sys/mman.h>
#include <fcntl.h>

int main(void)
{
        int fd = open("/dev/mem", O_RDWR);
        void* ptr = mmap(NULL, 4096, PROT_READ,
                 MAP_SHARED, fd, 0x49000000);
        close(fd);

        if(ptr == MAP_FAILED)
        {
                printf("mmap failed\n");
                return -1;
        }
        volatile unsigned* GINTSTS = (unsigned*)(ptr + 0x14);

        printf("%08X \n",*GINTSTS);

        munmap(ptr, 4096);

        return 0;
}

댓글 없음:

댓글 쓰기

gitea 설치

깃 서버 wget -O gitea https://dl.gitea.com/gitea/1.22.0/gitea-1.22.0-linux-amd64 chmod a+x gitea ./gitea web github 에서 미러링시에, access token을 넣어야...