This commit is contained in:
Imbus 2025-07-16 19:33:35 +02:00
parent 32d8cf26f2
commit d78b2308f0
2 changed files with 7 additions and 7 deletions

View file

@ -5,7 +5,8 @@
volatile uint64_t ticks;
__attribute__((interrupt)) void sys_tick_handler(void);
void sys_tick_handler(void) { ticks++; }
void sys_tick_handler(void) { ticks++; }
uint64_t sys_ticks_get(void) { return ticks; }

11
uart.c
View file

@ -6,9 +6,13 @@
#include <unistd.h>
int _write(int file, char *ptr, int len);
int _close(int file);
int _fstat(int file, struct stat *st);
int _isatty(int file);
int _lseek(int file, int ptr, int dir);
int _read(int file, char *ptr, int len);
void usart_setup(void) {
/* Setup GPIO pin GPIO_USART1_RE_TX on GPIO port B for transmit. */
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX);
usart_set_baudrate(USART1, 115200);
@ -35,26 +39,22 @@ int _write(int file, char *ptr, int len) {
return -1;
}
int _close(int file);
int _close(int file) {
(void)file;
return -1;
}
int _fstat(int file, struct stat *st);
int _fstat(int file, struct stat *st) {
(void)file;
st->st_mode = S_IFCHR;
return 0;
}
int _isatty(int file);
int _isatty(int file) {
(void)file;
return 1;
}
int _lseek(int file, int ptr, int dir);
int _lseek(int file, int ptr, int dir) {
(void)file;
(void)ptr;
@ -63,7 +63,6 @@ int _lseek(int file, int ptr, int dir) {
}
// Optional — stubbed read (e.g. for scanf), returns 0 bytes
int _read(int file, char *ptr, int len);
int _read(int file, char *ptr, int len) {
(void)file;
(void)ptr;