//============================================================================= // Setup I2C bus 0 //============================================================================= static void ea2468_i2c0_init(struct cyg_i2c_bus* bus) { // // The LPC24xx variant sets up the I2C0 clock and powers up the I2C0 // on-chip peripheral. We only need to setup the pins here and // leave the I2C driver to take care of the rest. // hal_set_pin_function(0, 27, 1); // SDA0 hal_set_pin_function(0, 28, 1); // SCL0 cyg_lpc2xxx_i2c_init(bus); }
static void CYGOPT_HAL_KINETIS_DIAG_FLASH_SECTION_ATTR cyg_hal_plf_serial_init_channel(void* __ch_data) { channel_data_t* chan = (channel_data_t*)__ch_data; CYG_ADDRESS uart_p = chan->base; // Configure PORT pins hal_set_pin_function(chan->rx_pin); hal_set_pin_function(chan->tx_pin); // 8-1-no parity. HAL_WRITE_UINT8(uart_p + CYGHWR_DEV_FREESCALE_UART_C1, 0); CYGHWR_IO_FREESCALE_UART_BAUD_SET(uart_p, chan->baud_rate); // Enable RX and TX HAL_WRITE_UINT8(uart_p + CYGHWR_DEV_FREESCALE_UART_C2, (CYGHWR_DEV_FREESCALE_UART_C2_TE | CYGHWR_DEV_FREESCALE_UART_C2_RE)); }
/*------------------------------------------- | Name:dev_twrk60n512_gpio_leds_load | Description: | Parameters: | Return Type: | Comments: | See: ---------------------------------------------*/ int dev_twrk60n512_gpio_leds_load(void){ volatile unsigned int reg_val = 0; hal_set_pin_function(LED_BLUE); hal_set_pin_function(LED_ORANGE); hal_set_pin_function(LED_GREEN); hal_set_pin_function(LED_YELLOW); //enable clock gating (SIM->SCGC5 |= SIM_SCGC5_PORTA_MASK) HAL_READ_UINT32(REG_SIM_SCGC5_ADDR, reg_val); reg_val |= REG_SIM_SCGC5_PORTA_MASK; HAL_WRITE_UINT32(REG_SIM_SCGC5_ADDR, reg_val); //set gpio as output HAL_WRITE_UINT32(gpio_base_addr + REG_GPIO_PDDR, (1<<LED_BLUE_PORTA_PIN) | (1<<LED_ORANGE_PORTA_PIN) | (1<<LED_GREEN_PORTA_PIN) | (1<<LED_YELLOW_PORTA_PIN)); return 0; }
/*------------------------------------------- | Name:dev_k60n512_dspi_2_load | Description: | Parameters: | Return Type: | Comments: | See: ---------------------------------------------*/ int dev_twrk60n512_enet_load(void) { volatile unsigned int reg_val = 0; //for tower hal_set_pin_function(ENET_RMMI_MDIO); hal_set_pin_function(ENET_RMMI_MDC); hal_set_pin_function(ENET_RMII_CRS_DV); hal_set_pin_function(ENET_RMMI_RXD1); hal_set_pin_function(ENET_RMMI_RXD0); hal_set_pin_function(ENET_RMMI_TXEN); hal_set_pin_function(ENET_RMMI_TXD0); hal_set_pin_function(ENET_RMMI_TXD1); #ifdef RXERR hal_set_pin_function(ENET_RMMI_RXER); #endif return dev_k60n512_enet_load(); }