Stair56E UART project
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
|
||||
#include "DMA_uart_debug.h"
|
||||
|
||||
volatile uint8_t __attribute__((aligned(4))) DMA_buf[16] = {0XAA, 0XAA, 0XAA, 0XAA};
|
||||
#define DMAS_BASE 0x50001000
|
||||
|
||||
// #define DMAS_CHx_SAR(a) ((volatile unsigned *)(DMAS_BASE + 0x40 + (a * 0x20)))
|
||||
// #define DMAS_CHx_DAR(a) ((volatile unsigned *)(DMAS_BASE + 0x44 + (a * 0x20)))
|
||||
// #define DMAS_CHx_CTL0(a) ((volatile unsigned *)(DMAS_BASE + 0x48 + (a * 0x20)))
|
||||
// #define DMAS_CHx_CTL1(a) ((volatile unsigned *)(DMAS_BASE + 0x4C + (a * 0x20)))
|
||||
// #define DMAS_CHx_CA(a) ((volatile unsigned *)(DMAS_BASE + 0x50 + (a * 0x20)))
|
||||
// #define DMAS_EN ((volatile unsigned *)(DMAS_BASE + 0))
|
||||
#define DMAS_STA ((volatile unsigned *)(DMAS_BASE + 0x08))
|
||||
|
||||
__XIP_RAM_CODE void DMA_Uart(uint8_t ch)
|
||||
{
|
||||
__write_hw_reg32(DMAS_CHx_SAR(ch), (uint32_t)DMA_buf);
|
||||
__write_hw_reg32(DMAS_CHx_DAR(ch), (ch * 0x1000 + 0x40010000));
|
||||
__write_hw_reg32(DMAS_CHx_CTL1(ch), ((2 << 8)));
|
||||
__write_hw_reg32(DMAS_CHx_CTL0(ch), 4);
|
||||
}
|
||||
__XIP_RAM_CODE void DMA_Uart_SendChar(uint8_t ch)
|
||||
{
|
||||
__write_hw_reg32(DMAS_CHx_CTL0(ch), 4);
|
||||
while ((*(DMAS_STA)) & (0x01 << ch))
|
||||
;
|
||||
*(DMAS_EN) = ch;
|
||||
}
|
||||
|
||||
__XIP_RAM_CODE void DMA_Uart_SendNumChar(uint8_t ch, uint8_t bt)
|
||||
{
|
||||
__write_hw_reg32(DMAS_CHx_CTL0(ch), bt);
|
||||
while ((*(DMAS_STA)) & (0x01 << ch))
|
||||
;
|
||||
*(DMAS_EN) = ch;
|
||||
}
|
||||
|
||||
/*
|
||||
void DMA_Uart_SendChar_1(uint8_t ch)
|
||||
{
|
||||
while((*(DMAS_STA))&(0x01<<ch));
|
||||
*(DMAS_EN)=ch;
|
||||
}*/
|
||||
Reference in New Issue
Block a user