tinyusb  0.4
Click here to lend your support to tinyusb donation and make a donation at pledgie.com
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
board_hitex4350.c
Go to the documentation of this file.
1 /**************************************************************************/
37 /**************************************************************************/
38 
39 #include "../board.h"
40 
41 #if BOARD == BOARD_HITEX4350
42 
43 //--------------------------------------------------------------------+
44 // MACRO CONSTANT TYPEDEF
45 //--------------------------------------------------------------------+
46 
47 //--------------------------------------------------------------------+
48 // INTERNAL OBJECT & FUNCTION DECLARATION
49 //--------------------------------------------------------------------+
50 
51 //--------------------------------------------------------------------+
52 // IMPLEMENTATION
53 //--------------------------------------------------------------------+
54 void board_init(void)
55 {
56  CGU_Init();
57  SysTick_Config(CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE) / TUSB_CFG_TICKS_HZ); // 1 msec tick timer
58 
59  //------------- USB Bus power HOST ONLY-------------//
60  // Hitex VBUS0 is P2_3
61  scu_pinmux(0x2, 3, MD_PUP | MD_EZI, FUNC7); // USB0_PWR_EN, USB0 VBus function
62  scu_pinmux(0x6, 3, MD_PUP | MD_EZI, FUNC1); // P6_3 USB0_PWR_EN, USB0 VBus function
63 
64  // Hitex VBUS1 is P9_5
65  scu_pinmux(0x9, 5, MD_PUP | MD_EZI, FUNC2); // USB1_PWR_EN, USB1 VBus function
66 
67  //------------- LEDs init -------------//
68  // TODO Leds for hitex
69 
70  //------------- UART init -------------//
71  #if CFG_UART_ENABLE
72  scu_pinmux(BOARD_UART_PIN_PORT, BOARD_UART_PIN_TX, MD_PDN , FUNC1);
73  scu_pinmux(BOARD_UART_PIN_PORT, BOARD_UART_PIN_RX, MD_PLN|MD_EZI|MD_ZI, FUNC1);
74 
75  UART_CFG_Type UARTConfigStruct;
76  UART_ConfigStructInit(&UARTConfigStruct);
77  UARTConfigStruct.Baud_rate = CFG_UART_BAUDRATE;
78  UARTConfigStruct.Clock_Speed = 0;
79 
80  UART_Init(BOARD_UART_PORT, &UARTConfigStruct);
81  UART_TxCmd(BOARD_UART_PORT, ENABLE); // Enable UART Transmit
82  #endif
83 
84 }
85 
86 //--------------------------------------------------------------------+
87 // LEDS
88 //--------------------------------------------------------------------+
89 void board_leds(uint32_t on_mask, uint32_t off_mask)
90 {
91  // TODO LED for hitex
92 }
93 
94 //--------------------------------------------------------------------+
95 // UART
96 //--------------------------------------------------------------------+
97 #if CFG_UART_ENABLE
98 uint32_t board_uart_send(uint8_t *buffer, uint32_t length)
99 {
100  return UART_Send(BOARD_UART_PORT, buffer, length, BLOCKING);
101 }
102 
103 uint32_t board_uart_recv(uint8_t *buffer, uint32_t length)
104 {
105  return UART_Receive(BOARD_UART_PORT, buffer, length, BLOCKING);
106 }
107 #endif
108 
109 #endif
void board_init(void)
Initialize all required peripherals on board including uart, led, buttons etc ... ...
void board_leds(uint32_t on_mask, uint32_t off_mask)
Turns on and off leds on the board.
#define TUSB_CFG_TICKS_HZ
The rate ticks in hert. This is used in conjunction with tusb_tick_get to calculate timing...
#define CFG_UART_BAUDRATE
Baudrate for UART.
Definition: board.h:119