Skip to content
Snippets Groups Projects
Commit 068da045 authored by 201221016Kim Haeram's avatar 201221016Kim Haeram
Browse files

1911

parent 561a1367
No related branches found
No related tags found
No related merge requests found
Pipeline #3858 failed
No preview for this file type
......@@ -23,6 +23,7 @@ int main(void)
int fd;
int txrx;
char buf[1024];
char cbuf = '\0';
// led_ioctl = makedev(LED_MAJOR_NUMBER, LED_MINOR_NUMBER);
// mknod(LED_DEV_PATH_NAME, S_IFCHR|0666, led_dev);
......@@ -41,8 +42,8 @@ int main(void)
if(txrx == 0){
printf("now RPi keep reading..\n");
while(1){
ioctl(fd, IOCTL_CMD_RECEIVE, &buf);
printf("%1023s",buf);
ioctl(fd, IOCTL_CMD_RECEIVE, &cbuf);
printf("%c",cbuf);
}
}else if(txrx == 1){
printf("now RPi keep writing..\n");
......
......@@ -63,7 +63,7 @@ long uart_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
int i=0;
char cbuf[1024];
int writelen = 0;
char singlechar = '\0';
int singlechar = '\0';
switch (cmd){
case IOCTL_CMD_DIRECTION:
......@@ -100,15 +100,8 @@ long uart_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
rxfe = (*uart_fr>>4); // read RXFE
} // now rx is not empty
*/
i=0;
//while(!rxfe){
cbuf[i] = (char) (*uart_dr); // read DATA
i++;
//if(i>1022) break;
//rxfe = (*uart_fr>>4); // read RXFE
//}
cbuf[i]='\n';
copy_to_user((const void*)arg, cbuf, 1024);
singlechar = (*uart_dr); // read DATA
copy_to_user((void*)arg, (const void*)&singlechar, 4);
break;
case IOCTL_CMD_TRANSMIT:
......
No preview for this file type
......@@ -47,4 +47,4 @@ __attribute__((section(".modinfo"))) =
"depends=";
MODULE_INFO(srcversion, "B707601F40932A4E255B12B");
MODULE_INFO(srcversion, "81AA5E0020DD316577913D2");
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment