2024-07-13 15:22:46 +08:00
|
|
|
#ifndef __SYSCALLS_H
|
|
|
|
#define __SYSCALLS_H
|
2024-07-14 16:07:46 +08:00
|
|
|
|
2024-07-13 15:22:46 +08:00
|
|
|
#include <errno.h>
|
|
|
|
#include <signal.h>
|
2024-07-14 17:27:15 +08:00
|
|
|
#include <stdarg.h>
|
2024-07-13 15:22:46 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2024-07-14 19:37:35 +08:00
|
|
|
#include <string.h>
|
2024-07-13 15:22:46 +08:00
|
|
|
#include <time.h>
|
2024-07-20 10:44:59 +08:00
|
|
|
|
2024-07-14 21:03:50 +08:00
|
|
|
#include "usart.h"
|
2024-07-13 15:22:46 +08:00
|
|
|
|
2024-07-20 10:44:59 +08:00
|
|
|
#define DEFAULT_HUART 1
|
2024-07-14 17:27:15 +08:00
|
|
|
#define HUART1 (&huart1)
|
|
|
|
#define HUART2 (&huart2)
|
|
|
|
|
2024-07-20 10:44:59 +08:00
|
|
|
#if DEFAULT_HUART == 1
|
|
|
|
#define HUART HUART1
|
|
|
|
#else
|
|
|
|
#define HUART HUART2
|
|
|
|
#endif
|
|
|
|
|
2024-07-14 21:03:50 +08:00
|
|
|
// 条件编译,适配不同平台 (GNU, GCC)
|
2024-07-13 15:22:46 +08:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
|
|
|
|
#define GETCHAR_PROTOTYPE int __io_getchar(void)
|
|
|
|
#else
|
|
|
|
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
|
|
|
|
#define GETCHAR_PROTOTYPE int fgetc(FILE *f)
|
|
|
|
#endif /* __GNUC__ */
|
|
|
|
|
2024-07-14 21:03:50 +08:00
|
|
|
int _read(int file, char *ptr, int len);
|
|
|
|
int _write(int file, char *ptr, int len);
|
2024-07-13 15:22:46 +08:00
|
|
|
|
2024-07-20 10:44:59 +08:00
|
|
|
int myprintf(const char *format, ...);
|
2024-07-14 21:03:50 +08:00
|
|
|
void my_printf(UART_HandleTypeDef *huart, const char *buf, ...);
|
2024-07-14 17:27:15 +08:00
|
|
|
|
2024-07-13 15:22:46 +08:00
|
|
|
#endif
|