change uart_init to take a baud so you don't need a second call to

setbaud
This commit is contained in:
Mariano Alvira 2012-10-24 13:22:20 -04:00
parent e7e149d354
commit b3e2f30674
20 changed files with 18 additions and 27 deletions

View File

@ -152,6 +152,7 @@ static volatile struct UART_struct * const UART2 = (void *) (UART2_BASE);
#endif /* REG_NO_COMPAT */
void uart_init(volatile struct UART_struct * uart, uint32_t baud);
void uart_setbaud(volatile struct UART_struct * uart, uint32_t baud);
extern volatile uint32_t u1_head, u1_tail;

View File

@ -65,7 +65,7 @@ void uart_setbaud(volatile struct UART_struct * uart, uint32_t baud) {
};
}
void uart_init(volatile struct UART_struct * uart) {
void uart_init(volatile struct UART_struct * uart, uint32_t baud) {
/* enable the uart so we can set the gpio mode */
/* see Section 11.5.1.2 Alternate Modes */
/* you must enable the peripheral first BEFORE setting the function in GPIO_FUNC_SEL */
@ -113,5 +113,8 @@ void uart_init(volatile struct UART_struct * uart) {
enable_irq(UART2);
}
uart_setbaud(uart, baud);
}

View File

@ -45,7 +45,6 @@ int main(void)
uint8_t c;
trim_xtal();
uart_init(UART1);
uart_init(UART1, 115200);
adc_init();

View File

@ -52,8 +52,7 @@ void main(void) {
/* trim the reference osc. to 24MHz */
trim_xtal();
uart_init(UART1);
uart_setbaud(UART1, 115200);
uart_init(UART1, 115200);
vreg_init();

View File

@ -64,7 +64,6 @@ void main(void) {
/* trim the reference osc. to 24MHz */
trim_xtal();
uart_init(UART1);
uart_init(UART1, 115200);
vreg_init();

View File

@ -99,7 +99,6 @@ void main(void) {
/* trim the reference osc. to 24MHz */
trim_xtal();
uart_init(UART1);
uart_init(UART1, 115200);
vreg_init();

View File

@ -84,7 +84,6 @@ void main(void) {
volatile uint32_t state = SCAN_X;
volatile uint32_t addr,data;
uart_init(UART1);
uart_init(UART1, 115200);
disable_irq(UART1);

View File

@ -46,12 +46,18 @@ void main(void) {
uint32_t buf[READ_NBYTES/4];
uint32_t i;
uart_init(UART1);
uart_init(UART1, 115200);
print_welcome("nvm-read");
vreg_init();
// buck_init();
while(CRM->STATUSbits.VREG_1P5V_RDY == 0) { continue; }
while(CRM->STATUSbits.VREG_1P8V_RDY == 0) { continue; }
printf("Sys cntl %08x\n\r", (unsigned int)CRM->SYS_CNTL);
printf("vreg cntl %08x\n\r", (unsigned int)CRM->VREG_CNTL);
printf("crm status %08x\n\r", (unsigned int)CRM->STATUS);
if(NVM_INTERFACE == gNvmInternalInterface_c)
{
@ -75,7 +81,7 @@ void main(void) {
err = nvm_read(NVM_INTERFACE, type, (uint8_t *)buf, READ_ADDR, READ_NBYTES);
printf("nvm_read returned: 0x%02x\r\n", err);
for(i=0; i<READ_NBYTES/4; i++) {
for(i=0; i<16/4; i++) {
printf("0x%08x\r\n", (unsigned int)buf[i]);
}

View File

@ -46,7 +46,6 @@ void main(void) {
uint32_t buf[WRITE_NBYTES/4];
uint32_t i;
uart_init(UART1);
uart_init(UART1, 115200);
print_welcome("nvm-write");

View File

@ -117,7 +117,6 @@ void main(void) {
/* trim the reference osc. to 24MHz */
pack_XTAL_CNTL(CTUNE_4PF, CTUNE, FTUNE, IBIAS);
uart_init(UART1);
uart_init(UART1, 115200);
vreg_init();

View File

@ -76,8 +76,7 @@ int main(void)
int mi;
// char buf[80];
uart_init(UART1);
uart_setbaud(UART1, 115200);
uart_init(UART1, 115200);
print_size(int8_t);
print_size(uint8_t);

View File

@ -46,7 +46,6 @@ int main(void)
int x = 32768;
trim_xtal();
uart_init(UART1);
uart_init(UART1, 115200);
rtc_init();

View File

@ -62,7 +62,6 @@ void main(void) {
/* trim the reference osc. to 24MHz */
trim_xtal();
uart_init(UART1);
uart_init(UART1, 115200);
vreg_init();

View File

@ -70,7 +70,6 @@ void main(void) {
/* trim the reference osc. to 24MHz */
trim_xtal();
uart_init(UART1);
uart_init(UART1, 115200);
vreg_init();

View File

@ -42,7 +42,6 @@
void main(void) {
volatile uint8_t *data;
uart_init(UART1);
uart_init(UART1, 115200);
for(data = DUMP_BASE; data < ((uint8_t *)(DUMP_BASE+DUMP_LEN)); data++) {

View File

@ -41,7 +41,6 @@
void main(void) {
uart_init(UART1);
uart_init(UART1, 115200);
*mem32(0x00401ffc) = 0x01234567;

View File

@ -41,10 +41,8 @@
void main(void) {
uart_init(UART1);
uart_init(UART2);
uart_setbaud(UART1, 115200);
uart_setbaud(UART2, 115200);
uart_init(UART1, 115200);
uart_init(UART2, 115200);
while(1) {
if(uart1_can_get()) {

View File

@ -41,9 +41,7 @@
void main(void) {
// uart1_init(INC,MOD,SAMP);
uart_init(UART1);
uart_setbaud(UART1, 1200);
uart_init(UART1, 115200);
while(1) {
if(uart1_can_get()) {

View File

@ -46,7 +46,6 @@
void main(void) {
volatile uint32_t i;
uart_init(UART1);
uart_init(UART1, 115200);
printf("reset\n\r");

View File

@ -48,7 +48,6 @@ int main(void)
ctune = 0;
ftune = 0;
uart_init(UART1);
uart_init(UART1, 115200);
print_welcome("pwm test\r\n");