Skip to content

Commit

Permalink
进行formtting格式化调整
Browse files Browse the repository at this point in the history
  • Loading branch information
CXSforHPU committed Sep 12, 2024
1 parent e4c3029 commit 53ecf55
Show file tree
Hide file tree
Showing 479 changed files with 60,399 additions and 56,432 deletions.
2 changes: 1 addition & 1 deletion bsp/bouffalo_lab/bl808/m0/board/wlan_port/drv_wifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ static rt_err_t drv_wlan_softap(struct rt_wlan_device *wlan, struct rt_ap_info *
}

if (ret < 0)
return RT_ERROR;
return -RT_ERROR;

return RT_EOK;
}
Expand Down
160 changes: 80 additions & 80 deletions bsp/microblaze/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,83 +33,83 @@
#include "drivers/dev_serial.h"
#endif

#define TIMER_CNTR_0 0
#define PIV (XPAR_PROC_BUS_0_FREQ_HZ / RT_TICK_PER_SECOND)
#define LEDS_DEVICE_ID XPAR_LEDS_4BITS_DEVICE_ID
#define RS232_DEVICE_ID XPAR_USB_UART_DEVICE_ID
#define TIMER_CNTR_0 0
#define PIV (XPAR_PROC_BUS_0_FREQ_HZ / RT_TICK_PER_SECOND)
#define LEDS_DEVICE_ID XPAR_LEDS_4BITS_DEVICE_ID
#define RS232_DEVICE_ID XPAR_USB_UART_DEVICE_ID

#ifdef RT_USING_UART1
#define USB_UART_BASE ((struct uartport *)XPAR_USB_UART_BASEADDR)
#define USB_UART_BASE ((struct uartport *)XPAR_USB_UART_BASEADDR)
#endif

/* Global Variables: */
XTmrCtr timer; /* The instance of the timer */
XGpio gpio_output; /* The driver instance for GPIO Device configured as O/P */
XUartLite uart_lite; /* Instance of the UartLite device */
XIntc int_ctl; /* The instance of the Interrupt Controller */
static rt_uint32_t led_data;
XTmrCtr timer; /* The instance of the timer */
XGpio gpio_output; /* The driver instance for GPIO Device configured as O/P */
XUartLite uart_lite; /* Instance of the UartLite device */
XIntc int_ctl; /* The instance of the Interrupt Controller */
static rt_uint32_t led_data;
static int cnt;



static void rt_hw_board_led_init(void);

/**
/**
* This function will init led on the board
*/
static void rt_hw_board_led_init()
{
rt_uint32_t status;
led_data = 0;
cnt = 0;
status = XGpio_Initialize(&gpio_output, LEDS_DEVICE_ID);
if (status != XST_SUCCESS)
{
return;
}

/*
* Set the direction for all signals to be outputs
*/
XGpio_SetDataDirection(&gpio_output, 1, 0x0);
/*
* Set the GPIO outputs to high
*/
XGpio_DiscreteWrite(&gpio_output, 1, 3);
rt_uint32_t status;
led_data = 0;
cnt = 0;
status = XGpio_Initialize(&gpio_output, LEDS_DEVICE_ID);
if (status != XST_SUCCESS)
{
return;
}

/*
* Set the direction for all signals to be outputs
*/
XGpio_SetDataDirection(&gpio_output, 1, 0x0);
/*
* Set the GPIO outputs to high
*/
XGpio_DiscreteWrite(&gpio_output, 1, 3);
}

/**
/**
* This function will take the led on board on.
*
* @param n the number nth led
*/
void rt_hw_board_led_on(rt_uint32_t led)
{
led_data |= led;
XGpio_DiscreteWrite(&gpio_output, 1, led_data);
led_data |= led;
XGpio_DiscreteWrite(&gpio_output, 1, led_data);
}

/**
/**
* This function will take the led on board off.
*
* @param n the number nth led
*/
void rt_hw_board_led_off(rt_uint32_t led)
{
led_data &= ~led;
XGpio_DiscreteWrite(&gpio_output, 1, led_data);
led_data &= ~led;
XGpio_DiscreteWrite(&gpio_output, 1, led_data);
}


void rt_hw_led_flash(void)
{
volatile rt_uint32_t i;
volatile rt_uint32_t i;

rt_hw_board_led_off(1);
for (i = 0; i < 20000; i ++);
rt_hw_board_led_off(1);
for (i = 0; i < 20000; i ++);

rt_hw_board_led_on(1);
for (i = 0; i < 20000; i ++);
rt_hw_board_led_on(1);
for (i = 0; i < 20000; i ++);
}


Expand All @@ -126,47 +126,47 @@ void rt_hw_led_flash(void)
*/
void rt_hw_console_output(const char* str)
{
while (*str)
{
while (*str)
{

/* Transmit Character */
/* Transmit Character */

XUartLite_SendByte(STDOUT_BASEADDRESS, *str);
if (*str == '\n')
XUartLite_SendByte(STDOUT_BASEADDRESS, '\r');
str++;
}
XUartLite_SendByte(STDOUT_BASEADDRESS, *str);
if (*str == '\n')
XUartLite_SendByte(STDOUT_BASEADDRESS, '\r');
str++;
}
}

static void rt_hw_console_init()
{
rt_uint32_t status;
rt_uint32_t status;

/*
* Initialize the UartLite driver so that it is ready to use.
*/
status = XUartLite_Initialize(&uart_lite, RS232_DEVICE_ID);
if (status != XST_SUCCESS)
{
return;
}
/*
* Initialize the UartLite driver so that it is ready to use.
*/
status = XUartLite_Initialize(&uart_lite, RS232_DEVICE_ID);
if (status != XST_SUCCESS)
{
return;
}

}
#endif


void rt_hw_timer_handler(void)
{
rt_uint32_t csr;
csr = XTmrCtr_ReadReg(timer.BaseAddress, TIMER_CNTR_0, XTC_TCSR_OFFSET);
/*
* Check if timer expired and interrupt occured
*/
if (csr & XTC_CSR_INT_OCCURED_MASK)
{
rt_tick_increase();
XTmrCtr_WriteReg(timer.BaseAddress, TIMER_CNTR_0, XTC_TCSR_OFFSET, csr | XTC_CSR_INT_OCCURED_MASK);
}
rt_uint32_t csr;
csr = XTmrCtr_ReadReg(timer.BaseAddress, TIMER_CNTR_0, XTC_TCSR_OFFSET);
/*
* Check if timer expired and interrupt occured
*/
if (csr & XTC_CSR_INT_OCCURED_MASK)
{
rt_tick_increase();
XTmrCtr_WriteReg(timer.BaseAddress, TIMER_CNTR_0, XTC_TCSR_OFFSET, csr | XTC_CSR_INT_OCCURED_MASK);
}

}

Expand All @@ -192,24 +192,24 @@ void rt_intc_init (void)

status = XIntc_Initialize(&int_ctl, XPAR_INTC_0_DEVICE_ID);

/* install interrupt handler */
/* install interrupt handler */
rt_hw_interrupt_install(XPAR_INTC_0_TMRCTR_0_VEC_ID, (rt_isr_handler_t)rt_hw_timer_handler, RT_NULL);
rt_hw_interrupt_umask(XPAR_INTC_0_TMRCTR_0_VEC_ID);
rt_hw_interrupt_umask(XPAR_INTC_0_TMRCTR_0_VEC_ID);

XIntc_Start(&int_ctl, XIN_REAL_MODE);
XIntc_Start(&int_ctl, XIN_REAL_MODE);

}


void rt_tmr_init (void)
{
rt_uint32_t ctl;
XStatus status;
rt_uint32_t ctl;
XStatus status;

status = XTmrCtr_Initialize(&timer,XPAR_AXI_TIMER_0_DEVICE_ID);
XTmrCtr_WriteReg(timer.BaseAddress, TIMER_CNTR_0, XTC_TLR_OFFSET, PIV);
XTmrCtr_WriteReg(timer.BaseAddress, TIMER_CNTR_0, XTC_TLR_OFFSET, PIV);
ctl = XTC_CSR_ENABLE_TMR_MASK | XTC_CSR_ENABLE_INT_MASK | XTC_CSR_AUTO_RELOAD_MASK | XTC_CSR_DOWN_COUNT_MASK;
XTmrCtr_WriteReg(timer.BaseAddress, TIMER_CNTR_0, XTC_TCSR_OFFSET, ctl);
XTmrCtr_WriteReg(timer.BaseAddress, TIMER_CNTR_0, XTC_TCSR_OFFSET, ctl);
}


Expand All @@ -219,15 +219,15 @@ void rt_tmr_init (void)
*/
void rt_hw_board_init()
{
microblaze_disable_icache();
microblaze_disable_dcache();
/* init hardware console */
rt_hw_console_init();
microblaze_disable_icache();
microblaze_disable_dcache();
/* init hardware console */
rt_hw_console_init();

/* init led */
rt_hw_board_led_init();
/* init led */
rt_hw_board_led_init();

/* init intc */
/* init intc */
rt_intc_init();

/* timer init */
Expand Down
Loading

0 comments on commit 53ecf55

Please sign in to comment.