-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
56 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* @file stdio.h | ||
* | ||
*/ | ||
/* Copyright (C) 2017-2020 by Arjan van Vught mailto:[email protected] | ||
/* Copyright (C) 2017-2024 by Arjan van Vught mailto:[email protected] | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -28,10 +28,29 @@ | |
|
||
#include <stddef.h> | ||
#include <stdarg.h> | ||
|
||
#define EOF -1 | ||
|
||
typedef void *FILE; | ||
#include <stdint.h> | ||
|
||
#define EOF (-1) | ||
|
||
typedef struct __sFILE { | ||
void *udata; | ||
#define __SLBF 0x0001 /* line buffered */ | ||
#define __SNBF 0x0002 /* unbuffered */ | ||
#define __SRD 0x0004 /* OK to read */ | ||
#define __SWR 0x0008 /* OK to write */ | ||
/* RD and WR are never simultaneously asserted */ | ||
#define __SRW 0x0010 /* open for reading & writing */ | ||
#define __SEOF 0x0020 /* found EOF */ | ||
#define __SERR 0x0040 /* found error */ | ||
uint8_t flags; | ||
} FILE; | ||
|
||
#if defined(CONFIG_POSIX_ENABLE_STDIN) | ||
#error Not supported | ||
extern FILE *stdin; | ||
extern FILE *stdout; | ||
extern FILE *stderr; | ||
#endif | ||
|
||
#ifndef SEEK_SET | ||
#define SEEK_SET 0 /* set file offset to offset */ | ||
|
@@ -49,36 +68,39 @@ typedef void *FILE; | |
extern "C" { | ||
#endif | ||
|
||
extern int puts(const char *s); | ||
extern int putchar(int c); | ||
int puts(const char *s); | ||
int putchar(int c); | ||
|
||
int fileno(FILE *stream); | ||
|
||
extern FILE *fopen(const char *path, const char *mode); | ||
extern int fclose(FILE *stream); | ||
FILE *fopen(const char *path, const char *mode); | ||
int fclose(FILE *stream); | ||
|
||
extern int fgetc(FILE *stream); | ||
int fgetc(FILE *stream); | ||
|
||
extern char *fgets(char *s, int size, FILE *stream); | ||
extern int fputs(const char *s, FILE *stream); | ||
char *fgets(char *s, int size, FILE *stream); | ||
int fputs(const char *s, FILE *stream); | ||
|
||
extern size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); | ||
extern size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); | ||
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); | ||
size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); | ||
|
||
extern int fseek(FILE *stream, long offset, int whence); | ||
int fseek(FILE *stream, long offset, int whence); | ||
|
||
extern long ftell(FILE *stream); | ||
long ftell(FILE *stream); | ||
|
||
extern void clearerr(FILE *stream); | ||
extern int ferror(FILE *stream); | ||
void clearerr(FILE *stream); | ||
int ferror(FILE *stream); | ||
int feof(FILE *stream); | ||
|
||
extern int printf(const char *format, ...); | ||
int printf(const char *format, ...); | ||
|
||
extern int sprintf(char *str, const char *format, ...); | ||
extern int snprintf(char *str, size_t size, const char *format, ...); | ||
int sprintf(char *str, const char *format, ...); | ||
int snprintf(char *str, size_t size, const char *format, ...); | ||
|
||
extern int vprintf(const char *format, va_list ap); | ||
extern int vsnprintf(char *str, size_t size, const char *format, va_list); | ||
int vprintf(const char *format, va_list ap); | ||
int vsnprintf(char *str, size_t size, const char *format, va_list); | ||
|
||
extern void perror(const char *s); | ||
void perror(const char *s); | ||
|
||
#ifdef __cplusplus | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* @file gd32_spi_dma_i2s.cpp | ||
* | ||
*/ | ||
/* Copyright (C) 2021-2022 by Arjan van Vught mailto:[email protected] | ||
/* Copyright (C) 2021-2024 by Arjan van Vught mailto:[email protected] | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -50,7 +50,7 @@ void i2s_psc_config_dump(uint32_t spi_periph, uint32_t audiosample, uint32_t fra | |
|
||
static uint16_t s_TxBuffer[SPI_BUFFER_SIZE] __attribute__ ((aligned (4))); | ||
|
||
static void _spi_i2s_dma_config() { | ||
static void spi_i2s_dma_config() { | ||
rcu_periph_clock_enable(RCU_DMA1); | ||
|
||
dma_deinit(SPI_DMAx, SPI_DMA_CHx); | ||
|
@@ -114,36 +114,12 @@ void gd32_spi_dma_begin() { | |
gpio_output_options_set(SPI_NSS_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, SPI_NSS_GPIO_PINx); | ||
#endif | ||
|
||
#if defined (GD32F10X_CL) || defined (GD32F20X_CL) | ||
/** | ||
* Setup PLL2 | ||
* | ||
* i2sclock=160000000 | ||
* i2sdiv=12, i2sof=256 | ||
*/ | ||
|
||
RCU_CTL &= ~RCU_CTL_PLL2EN; | ||
|
||
rcu_pll2_config(RCU_PLL2_MUL16); | ||
|
||
RCU_CTL |= RCU_CTL_PLL2EN; | ||
|
||
while ((RCU_CTL & RCU_CTL_PLL2STB) == 0U) { | ||
} | ||
|
||
if (SPI_PERIPH == SPI2) { | ||
rcu_i2s2_clock_config(RCU_I2S2SRC_CKPLL2_MUL2); | ||
} else { | ||
rcu_i2s1_clock_config(RCU_I2S1SRC_CKPLL2_MUL2); | ||
} | ||
#endif | ||
|
||
i2s_disable(SPI_PERIPH); | ||
i2s_psc_config(SPI_PERIPH, 200000, I2S_FRAMEFORMAT_DT16B_CH16B, I2S_MCKOUT_DISABLE); | ||
i2s_init(SPI_PERIPH, I2S_MODE_MASTERTX, I2S_STD_MSB, I2S_CKPL_LOW); | ||
i2s_enable(SPI_PERIPH); | ||
|
||
_spi_i2s_dma_config(); | ||
spi_i2s_dma_config(); | ||
|
||
#ifndef NDEBUG | ||
i2s_psc_config_dump(SPI_PERIPH, 200000, I2S_FRAMEFORMAT_DT16B_CH16B, I2S_MCKOUT_DISABLE); | ||
|
Oops, something went wrong.