support zynq7000-zc702
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @file shell_port.c
|
||||
* @author Letter (NevermindZZT@gmail.com)
|
||||
* @brief
|
||||
* @version 0.1
|
||||
* @date 2019-02-22
|
||||
*
|
||||
* @copyright (c) 2019 Letter
|
||||
*
|
||||
*/
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "libserial.h"
|
||||
#include "session.h"
|
||||
#include "shell.h"
|
||||
#include "usyscall.h"
|
||||
|
||||
Shell shell;
|
||||
char shellBuffer[512];
|
||||
struct Session session_fs;
|
||||
|
||||
signed short userShellWrite(char* data, unsigned short len)
|
||||
{
|
||||
unsigned short length = len;
|
||||
while (length--) {
|
||||
printf("%c", *data++);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
signed short userShellRead(char* data, unsigned short len)
|
||||
{
|
||||
unsigned short length = len;
|
||||
static char cur_read;
|
||||
while (length--) {
|
||||
cur_read = getc();
|
||||
if (cur_read == 0xff) {
|
||||
yield();
|
||||
}
|
||||
// *data++ = getc();
|
||||
*data++ = cur_read;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
shell.write = userShellWrite;
|
||||
shell.read = userShellRead;
|
||||
|
||||
shellInit(&shell, shellBuffer, 512);
|
||||
|
||||
connect_session(&session_fs, "MemFS", 8092);
|
||||
if (!session_fs.buf) {
|
||||
printf("session connect faield\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
shellTask(&shell);
|
||||
|
||||
free_session(&session_fs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user