目标:驱动CH382通过串口发送数据
问题:PCIe的RC访问PCIe时要求4字节对齐访问,目前串口可以发送数据,但是波特率不对,看上去就像是波特率分频寄存器的值全是FF,程序如下:
初始化:
/*
*(uint32_t *)((char*)pcieIOBase + 0xC0 + LCR) = 0x80;
*(uint32_t *)((char*)pcieIOBase + 0xC0 + DLL) = 0x0C;
*(uint32_t *)((char*)pcieIOBase + 0xC0 + DLM) = 0x00;
*(uint32_t *)((char*)pcieIOBase + 0xC0 + LCR) = 0x03;
*(uint32_t *)((char*)pcieIOBase + 0xC0 + FCR) = 0x01;
*/
*(uint32_t *)((char*)pcieIOBase + 0xC0) = 0x80000000;
*(uint32_t *)((char*)pcieIOBase + 0xC0) = 0x8000000C;
*(uint32_t *)((char*)pcieIOBase + 0xC0) = 0x0300000C;
*(uint32_t *)((char*)pcieIOBase + 0xC0) = 0x03010000;
发送:
*(uint32_t *)((char*)pcieIOBase + 0xC0 + 0) = i + 0x03010000;
由于对CH382内部PCIe处理情况不是很了解,上述代码是否存在问题呢?