⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ops.h

📁 mips cpu 君正4730 4740的 ucosii 源码 包括系统 摄像头 网络 文件系统等等测试
💻 H
📖 第 1 页 / 共 5 页
字号:
#define __scc_enable_rx_intr(base)	( REG_SCC_CR(base) |= SCC_CR_RXIE)#define __scc_disable_rx_intr(base)	( REG_SCC_CR(base) &= ~SCC_CR_RXIE)#define __scc_set_tsend(base)		( REG_SCC_CR(base) |= SCC_CR_TSEND )#define __scc_clear_tsend(base)		( REG_SCC_CR(base) &= ~SCC_CR_TSEND )#define __scc_set_clockstop(base)	( REG_SCC_CR(base) |= SCC_CR_CLKSTP )#define __scc_clear_clockstop(base)	( REG_SCC_CR(base) &= ~SCC_CR_CLKSTP )#define __scc_clockstop_low(base)		\do {						\  REG_SCC_CR(base) &= ~SCC_CR_PX_MASK;		\  REG_SCC_CR(base) |= SCC_CR_PX_STOP_LOW;	\} while (0)#define __scc_clockstop_high(base)		\do {						\  REG_SCC_CR(base) &= ~SCC_CR_PX_MASK;		\  REG_SCC_CR(base) |= SCC_CR_PX_STOP_HIGH;	\} while (0)/* SCC status checking */#define __scc_check_transfer_status(base)  ( REG_SCC_SR(base) & SCC_SR_TRANS )#define __scc_check_rx_overrun_error(base) ( REG_SCC_SR(base) & SCC_SR_ORER )#define __scc_check_rx_timeout(base)	   ( REG_SCC_SR(base) & SCC_SR_RTO )#define __scc_check_parity_error(base)	   ( REG_SCC_SR(base) & SCC_SR_PER )#define __scc_check_txfifo_trigger(base)   ( REG_SCC_SR(base) & SCC_SR_TFTG )#define __scc_check_rxfifo_trigger(base)   ( REG_SCC_SR(base) & SCC_SR_RFTG )#define __scc_check_tx_end(base)	   ( REG_SCC_SR(base) & SCC_SR_TEND )#define __scc_check_retx_3(base)	   ( REG_SCC_SR(base) & SCC_SR_RETR_3 )#define __scc_check_ecnt_overflow(base)	   ( REG_SCC_SR(base) & SCC_SR_ECNTO )/*************************************************************************** * WDT ***************************************************************************/#define __wdt_set_count(count) ( REG_WDT_WTCNT = (count) )#define __wdt_start()          ( REG_WDT_WTCSR |= WDT_WTCSR_START )#define __wdt_stop()           ( REG_WDT_WTCSR &= ~WDT_WTCSR_START )/*************************************************************************** * OST ***************************************************************************/#define __ost_enable_all()         ( REG_OST_TER |= 0x07 )#define __ost_disable_all()        ( REG_OST_TER &= ~0x07 )#define __ost_enable_channel(n)    ( REG_OST_TER |= (1 << (n)) )#define __ost_disable_channel(n)   ( REG_OST_TER &= ~(1 << (n)) )#define __ost_set_reload(n, val)   ( REG_OST_TRDR(n) = (val) )#define __ost_set_count(n, val)    ( REG_OST_TCNT(n) = (val) )#define __ost_get_count(n)         ( REG_OST_TCNT(n) )#define __ost_set_clock(n, cs)			\do {						\    REG_OST_TCSR(n) &= ~OST_TCSR_CKS_MASK; 	\    REG_OST_TCSR(n) |= cs; 			\} while (0)#define __ost_set_mode(n, val)     ( REG_OST_TCSR(n) = (val) )#define __ost_enable_interrupt(n)  ( REG_OST_TCSR(n) |= OST_TCSR_UIE )#define __ost_disable_interrupt(n) ( REG_OST_TCSR(n) &= ~OST_TCSR_UIE )#define __ost_uf_detected(n)       ( REG_OST_TCSR(n) & OST_TCSR_UF )#define __ost_clear_uf(n)          ( REG_OST_TCSR(n) &= ~OST_TCSR_UF )#define __ost_is_busy(n)           ( REG_OST_TCSR(n) & OST_TCSR_BUSY )#define __ost_clear_busy(n)        ( REG_OST_TCSR(n) &= ~OST_TCSR_BUSY )/*************************************************************************** * UART ***************************************************************************/#define __uart_enable(n) \  ( REG8(UART_BASE + UART_OFF*(n) + OFF_FCR) |= UARTFCR_UUE | UARTFCR_FE )#define __uart_disable(n) \  ( REG8(UART_BASE + UART_OFF*(n) + OFF_FCR) = ~UARTFCR_UUE )#define __uart_enable_transmit_irq(n) \  ( REG8(UART_BASE + UART_OFF*(n) + OFF_IER) |= UARTIER_TIE )#define __uart_disable_transmit_irq(n) \  ( REG8(UART_BASE + UART_OFF*(n) + OFF_IER) &= ~UARTIER_TIE )#define __uart_enable_receive_irq(n) \  ( REG8(UART_BASE + UART_OFF*(n) + OFF_IER) |= UARTIER_RIE | UARTIER_RLIE | UARTIER_RTIE )#define __uart_disable_receive_irq(n) \  ( REG8(UART_BASE + UART_OFF*(n) + OFF_IER) &= ~(UARTIER_RIE | UARTIER_RLIE | UARTIER_RTIE) )#define __uart_enable_loopback(n) \  ( REG8(UART_BASE + UART_OFF*(n) + OFF_MCR) |= UARTMCR_LOOP )#define __uart_disable_loopback(n) \  ( REG8(UART_BASE + UART_OFF*(n) + OFF_MCR) &= ~UARTMCR_LOOP )#define __uart_set_8n1(n) \  ( REG8(UART_BASE + UART_OFF*(n) + OFF_LCR) = UARTLCR_WLEN_8 )#define __uart_set_baud(n, devclk, baud)						\  do {											\	REG8(UART_BASE + UART_OFF*(n) + OFF_LCR) |= UARTLCR_DLAB;			\	REG8(UART_BASE + UART_OFF*(n) + OFF_DLLR) = (devclk / 16 / baud) & 0xff;	\	REG8(UART_BASE + UART_OFF*(n) + OFF_DLHR) = ((devclk / 16 / baud) >> 8) & 0xff;	\	REG8(UART_BASE + UART_OFF*(n) + OFF_LCR) &= ~UARTLCR_DLAB;			\  } while (0)#define __uart_parity_error(n) \  ( (REG8(UART_BASE + UART_OFF*(n) + OFF_LSR) & UARTLSR_PER) != 0 )#define __uart_clear_errors(n) \  ( REG8(UART_BASE + UART_OFF*(n) + OFF_LSR) &= ~(UARTLSR_ORER | UARTLSR_BRK | UARTLSR_FER | UARTLSR_PER | UARTLSR_RFER) )#define __uart_transmit_fifo_empty(n) \  ( (REG8(UART_BASE + UART_OFF*(n) + OFF_LSR) & UARTLSR_TDRQ) != 0 )#define __uart_transmit_end(n) \  ( (REG8(UART_BASE + UART_OFF*(n) + OFF_LSR) & UARTLSR_TEMT) != 0 )#define __uart_transmit_char(n, ch) \  REG8(UART_BASE + UART_OFF*(n) + OFF_TDR) = (ch)#define __uart_receive_fifo_full(n) \  ( (REG8(UART_BASE + UART_OFF*(n) + OFF_LSR) & UARTLSR_DR) != 0 )#define __uart_receive_ready(n) \  ( (REG8(UART_BASE + UART_OFF*(n) + OFF_LSR) & UARTLSR_DR) != 0 )#define __uart_receive_char(n) \  REG8(UART_BASE + UART_OFF*(n) + OFF_RDR)#define __uart_disable_irda() \  ( REG8(IRDA_BASE + OFF_SIRCR) &= ~(SIRCR_TSIRE | SIRCR_RSIRE) )#define __uart_enable_irda() \  /* Tx high pulse as 0, Rx low pulse as 0 */ \  ( REG8(IRDA_BASE + OFF_SIRCR) = SIRCR_TSIRE | SIRCR_RSIRE | SIRCR_RXPL | SIRCR_TPWS )/*************************************************************************** * INTC ***************************************************************************/#define __intc_unmask_irq(n)	( REG_INTC_IMCR = (1 << (n)) )#define __intc_mask_irq(n)	( REG_INTC_IMSR = (1 << (n)) )#define __intc_ack_irq(n)	( REG_INTC_IPR = (1 << (n)) )/*************************************************************************** * CIM ***************************************************************************/#define __cim_enable()	( REG_CIM_CTRL |= CIM_CTRL_ENA )#define __cim_disable()	( REG_CIM_CTRL &= ~CIM_CTRL_ENA )#define __cim_input_data_inverse()	( REG_CIM_CFG |= CIM_CFG_INV_DAT )#define __cim_input_data_normal()	( REG_CIM_CFG &= ~CIM_CFG_INV_DAT )#define __cim_vsync_active_low()	( REG_CIM_CFG |= CIM_CFG_VSP )#define __cim_vsync_active_high()	( REG_CIM_CFG &= ~CIM_CFG_VSP )#define __cim_hsync_active_low()	( REG_CIM_CFG |= CIM_CFG_HSP )#define __cim_hsync_active_high()	( REG_CIM_CFG &= ~CIM_CFG_HSP )#define __cim_sample_data_at_pclk_falling_edge() \  ( REG_CIM_CFG |= CIM_CFG_PCP )#define __cim_sample_data_at_pclk_rising_edge() \  ( REG_CIM_CFG &= ~CIM_CFG_PCP )#define __cim_enable_dummy_zero()	( REG_CIM_CFG |= CIM_CFG_DUMMY_ZERO )#define __cim_disable_dummy_zero()	( REG_CIM_CFG &= ~CIM_CFG_DUMMY_ZERO )#define __cim_select_external_vsync()	( REG_CIM_CFG |= CIM_CFG_EXT_VSYNC )#define __cim_select_internal_vsync()	( REG_CIM_CFG &= ~CIM_CFG_EXT_VSYNC )/* n=0-7 */#define __cim_set_data_packing_mode(n) 		\do {						\    REG_CIM_CFG &= ~CIM_CFG_PACK_MASK; 		\    REG_CIM_CFG |= (CIM_CFG_PACK_##n); 		\} while (0)#define __cim_enable_ccir656_progressive_mode()	\do {						\    REG_CIM_CFG &= ~CIM_CFG_DSM_MASK; 		\    REG_CIM_CFG |= CIM_CFG_DSM_CPM; 		\} while (0)#define __cim_enable_ccir656_interlace_mode()	\do {						\    REG_CIM_CFG &= ~CIM_CFG_DSM_MASK; 		\    REG_CIM_CFG |= CIM_CFG_DSM_CIM; 		\} while (0)#define __cim_enable_gated_clock_mode()		\do {						\    REG_CIM_CFG &= ~CIM_CFG_DSM_MASK; 		\    REG_CIM_CFG |= CIM_CFG_DSM_GCM; 		\} while (0)#define __cim_enable_nongated_clock_mode()	\do {						\    REG_CIM_CFG &= ~CIM_CFG_DSM_MASK; 		\    REG_CIM_CFG |= CIM_CFG_DSM_NGCM; 		\} while (0)/* sclk:system bus clock * mclk: CIM master clock */#define __cim_set_master_clk(sclk, mclk)			\do {								\    REG_CIM_CTRL &= ~CIM_CTRL_MCLKDIV_MASK;			\    REG_CIM_CTRL |= (((sclk)/(mclk) - 1) << CIM_CTRL_MCLKDIV_BIT);	\} while (0)#define __cim_enable_sof_intr() \  ( REG_CIM_CTRL |= CIM_CTRL_DMA_SOFM )#define __cim_disable_sof_intr() \  ( REG_CIM_CTRL &= ~CIM_CTRL_DMA_SOFM )#define __cim_enable_eof_intr() \  ( REG_CIM_CTRL |= CIM_CTRL_DMA_EOFM )#define __cim_disable_eof_intr() \  ( REG_CIM_CTRL &= ~CIM_CTRL_DMA_EOFM )#define __cim_enable_stop_intr() \  ( REG_CIM_CTRL |= CIM_CTRL_DMA_STOPM )#define __cim_disable_stop_intr() \  ( REG_CIM_CTRL &= ~CIM_CTRL_DMA_STOPM )#define __cim_enable_trig_intr() \  ( REG_CIM_CTRL |= CIM_CTRL_RXF_TRIGM )#define __cim_disable_trig_intr() \  ( REG_CIM_CTRL &= ~CIM_CTRL_RXF_TRIGM )#define __cim_enable_rxfifo_overflow_intr() \  ( REG_CIM_CTRL |= CIM_CTRL_RXF_OFM )#define __cim_disable_rxfifo_overflow_intr() \  ( REG_CIM_CTRL &= ~CIM_CTRL_RXF_OFM )/* n=1-16 */#define __cim_set_frame_rate(n) 		\do {						\    REG_CIM_CTRL &= ~CIM_CTRL_FRC_MASK; 	\    REG_CIM_CTRL |= CIM_CTRL_FRC_##n; 		\} while (0)#define __cim_enable_dma()   ( REG_CIM_CTRL |= CIM_CTRL_DMA_EN )#define __cim_disable_dma()  ( REG_CIM_CTRL &= ~CIM_CTRL_DMA_EN )#define __cim_reset_rxfifo() ( REG_CIM_CTRL |= CIM_CTRL_RXF_RST )#define __cim_unreset_rxfifo() ( REG_CIM_CTRL &= ~CIM_CTRL_RXF_RST )/* n=4,8,12,16,20,24,28,32 */#define __cim_set_rxfifo_trigger(n) 		\do {						\    REG_CIM_CTRL &= ~CIM_CTRL_RXF_TRIG_MASK; 	\    REG_CIM_CTRL |= CIM_CTRL_RXF_TRIG_##n; 	\} while (0)#define __cim_clear_state()   	     ( REG_CIM_STATE = 0 )#define __cim_disable_done()   	     ( REG_CIM_STATE & CIM_STATE_VDD )#define __cim_rxfifo_empty()   	     ( REG_CIM_STATE & CIM_STATE_RXF_EMPTY )#define __cim_rxfifo_reach_trigger() ( REG_CIM_STATE & CIM_STATE_RXF_TRIG )#define __cim_rxfifo_overflow()      ( REG_CIM_STATE & CIM_STATE_RXF_OF )#define __cim_clear_rxfifo_overflow() ( REG_CIM_STATE &= ~CIM_STATE_RXF_OF )#define __cim_dma_stop()   	     ( REG_CIM_STATE & CIM_STATE_DMA_STOP )#define __cim_dma_eof()   	     ( REG_CIM_STATE & CIM_STATE_DMA_EOF )#define __cim_dma_sof()   	     ( REG_CIM_STATE & CIM_STATE_DMA_SOF )#define __cim_get_iid()   	     ( REG_CIM_IID )#define __cim_get_image_data()       ( REG_CIM_RXFIFO )#define __cim_get_dam_cmd()          ( REG_CIM_CMD )#define __cim_set_da(a)              ( REG_CIM_DA = (a) )/*************************************************************************** * PWM ***************************************************************************//* n is the pwm channel (0,1,..) */#define __pwm_enable_module(n)		( REG_PWM_CTR(n) |= PWM_CTR_EN )#define __pwm_disable_module(n)		( REG_PWM_CTR(n) &= ~PWM_CTR_EN )#define __pwm_graceful_shutdown_mode(n)	( REG_PWM_CTR(n) &= ~PWM_CTR_SD )#define __pwm_abrupt_shutdown_mode(n)	( REG_PWM_CTR(n) |= PWM_CTR_SD )#define __pwm_set_full_duty(n)		( REG_PWM_DUT(n) |= PWM_DUT_FDUTY )#define __pwm_set_prescale(n, p) \  ( REG_PWM_CTR(n) = ((REG_PWM_CTR(n) & ~PWM_CTR_PRESCALE_MASK) | (p) ) )#define __pwm_set_period(n, p) \  ( REG_PWM_PER(n) = ( (REG_PWM_PER(n) & ~PWM_PER_PERIOD_MASK) | (p) ) )#define __pwm_set_duty(n, d) \  ( REG_PWM_DUT(n) = ( (REG_PWM_DUT(n) & ~PWM_DUT_FDUTY) | (d) ) )/*************************************************************************** * EMC ***************************************************************************/#define __emc_enable_split() ( REG_EMC_BCR = EMC_BCR_BRE )#define __emc_disable_split() ( REG_EMC_BCR = 0 )#define __emc_smem_bus_width(n) /* 8, 16 or 32*/		\	( REG_EMC_SMCR = (REG_EMC_SMCR & EMC_SMCR_BW_MASK) |	\			 EMC_SMCR_BW_##n##BIT )#define __emc_smem_byte_control() \	( REG_EMC_SMCR = (REG_EMC_SMCR | EMC_SMCR_BCM )#define __emc_normal_smem() \	( REG_EMC_SMCR = (REG_EMC_SMCR & ~EMC_SMCR_SMT )#define __emc_burst_smem() \	( REG_EMC_SMCR = (REG_EMC_SMCR | EMC_SMCR_SMT )#define __emc_smem_burstlen(n) /* 4, 8, 16 or 32 */ \	( REG_EMC_SMCR = (REG_EMC_SMCR & EMC_SMCR_BL_MASK) | (EMC_SMCR_BL_##n )/*************************************************************************** * GPIO ***************************************************************************//* p is the port number (0,1,2,3) * o is the pin offset (0-31) inside the port * n is the absolute number of a pin (0-124), regardless of the port * m is the interrupt manner (low/high/falling/rising) */#define __gpio_port_data(p)	( REG_GPIO_GPDR(p) )#define __gpio_port_as_output(p, o)		\do {						\    unsigned int tmp;				\    REG_GPIO_GPIER(p) &= ~(1 << (o));		\    REG_GPIO_GPDIR(p) |= (1 << (o));		\    if (o < 16) {				\	tmp = REG_GPIO_GPALR(p);		\	tmp &= ~(3 << ((o) << 1));		\	REG_GPIO_GPALR(p) = tmp;		\    } else {					\	tmp = REG_GPIO_GPAUR(p);		\	tmp &= ~(3 << (((o) - 16)<< 1));	\	REG_GPIO_GPAUR(p) = tmp;		\    }						\} while (0)#define __gpio_port_as_input(p, o)		\do {						\    unsigned int tmp;				\    REG_GPIO_GPIER(p) &= ~(1 << (o));		\    REG_GPIO_GPDIR(p) &= ~(1 << (o));		\    if (o < 16) {				\	tmp = REG_GPIO_GPALR(p);		\	tmp &= ~(3 << ((o) << 1));		\	REG_GPIO_GPALR(p) = tmp;		\    } else {					\	tmp = REG_GPIO_GPAUR(p);		\	tmp &= ~(3 << (((o) - 16)<< 1));	\	REG_GPIO_GPAUR(p) = tmp;		\    }						\} while (0)#define __gpio_as_output(n)			\do {						\	unsigned int p, o;			\	p = (n) / 32;				\	o = (n) % 32;				\	__gpio_port_as_output(p, o);		\} while (0)#define __gpio_as_input(n)			\do {						\	unsigned int p, o;			\

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -