LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
board_hitex_eva_18504350.c
Go to the documentation of this file.
1 /*
2  * @brief Hitex EVA 1850/4350 board file
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * All rights reserved.
7  *
8  * @par
9  * Software that is described herein is for illustrative purposes only
10  * which provides customers with programming information regarding the
11  * LPC products. This software is supplied "AS IS" without any warranties of
12  * any kind, and NXP Semiconductors and its licensor disclaim any and
13  * all warranties, express or implied, including all implied warranties of
14  * merchantability, fitness for a particular purpose and non-infringement of
15  * intellectual property rights. NXP Semiconductors assumes no responsibility
16  * or liability for the use of the software, conveys no license or rights under any
17  * patent, copyright, mask work right, or any other intellectual property rights in
18  * or to any products. NXP Semiconductors reserves the right to make changes
19  * in the software without notification. NXP Semiconductors also makes no
20  * representation or warranty that such application will be suitable for the
21  * specified use without further testing or modification.
22  *
23  * @par
24  * Permission to use, copy, modify, and distribute this software and its
25  * documentation is hereby granted, under NXP Semiconductors' and its
26  * licensor's relevant copyrights in the software, without fee, provided that it
27  * is used in conjunction with NXP Semiconductors microcontrollers. This
28  * copyright, permission, and disclaimer notice must appear in all copies of
29  * this code.
30  */
31 
32 #include "board.h"
33 #include "string.h"
34 
35 /* Include other sources files specific to this board */
36 #include "lpc_phy_dp83848.c"
37 #include "retarget.c"
38 
43 /*****************************************************************************
44  * Private types/enumerations/variables
45  ****************************************************************************/
46 
47 /* Port and bit mapping for LEDs on GPIOs */
48 static const uint8_t ledports[] = {4, 7, 7, 7};
49 static const uint8_t ledbits[] = {1, 5, 6, 8};
50 
51 /* TSC2046 control byte definitions */
52 #define TSC2046_CONVERSION_BITS 12
53 #define TSC_START (0x01 << 7)
54 #define TSC_CHANNEL_X (0x05 << 4) /* differential */
55 #define TSC_CHANNEL_Y (0x01 << 4) /* differential */
56 #define TSC_CHANNEL_Z1 (0x03 << 4) /* differential */
57 #define TSC_CHANNEL_Z2 (0x04 << 4) /* differential */
58 #define TSC_8BIT (0x01 << 3)
59 #define TSC_12BIT (0x00 << 3)
60 #define TSC_PD 0x00
61 #define TSC_ADC_ON 0x01
62 #define TSC_REF_ON 0x02
63 #if (TSC2046_CONVERSION_BITS == 12)
64 #define TSC_CONVERSION_MODE TSC_12BIT
65 #else
66 #define TSC_CONVERSION_MODE TSC_8BIT
67 #endif
68 
69 #define TSC_SER_MODE (0x01 << 2) /* Single-Ended Reference Mode */
70 #define TSC_DFR_MODE (0x00 << 2) /* Differential Reference Mode */
71 
72 #define X_MEASURE (TSC_START | TSC_CHANNEL_X | TSC_CONVERSION_MODE | TSC_DFR_MODE | TSC_ADC_ON)
73 #define Y_MEASURE (TSC_START | TSC_CHANNEL_Y | TSC_CONVERSION_MODE | TSC_DFR_MODE | TSC_ADC_ON)
74 #define Z1_MEASURE (TSC_START | TSC_CHANNEL_Z1 | TSC_CONVERSION_MODE | TSC_DFR_MODE | TSC_ADC_ON)
75 #define Z2_MEASURE (TSC_START | TSC_CHANNEL_Z2 | TSC_CONVERSION_MODE | TSC_DFR_MODE | TSC_ADC_ON)
76 #define PWRDOWN (TSC_START | TSC_CHANNEL_Y | TSC_CONVERSION_MODE | TSC_DFR_MODE | TSC_PD)
77 
78 typedef struct {
79  int16_t ad_left; /* left margin */
80  int16_t ad_right; /* right margin */
81  int16_t ad_top; /* top margin */
82  int16_t ad_bottom; /* bottom margin */
83  int16_t lcd_width; /* lcd horizontal size */
84  int16_t lcd_height; /* lcd vertical size */
85  uint8_t swap_xy; /* 1: swap x-y coords */
87 
88 #define LCD_DC_CMD (Chip_GPIO_WritePortBit(LPC_GPIO_PORT, 0x07, 8, false))
89 #define LCD_DC_DATA (Chip_GPIO_WritePortBit(LPC_GPIO_PORT, 0x07, 8, true))
90 
91 #if (TSC2046_CONVERSION_BITS == 12)
92 #define TSC2046_COORD_MAX (0xFFF)
93 #define TSC2046_DELTA_VARIANCE (0x50)
94 #else
95 #define TSC2046_COORD_MAX (0xFF)
96 #define TSC2046_DELTA_VARIANCE (0x03)
97 #endif
98 #define COORD_GET_NUM (10)
99 
102  3758, 149, 3914, 163, 240, 320, 1
103 };
104 
109  28, /* Horizontal back porch in clocks */
110  10, /* Horizontal front porch in clocks */
111  2, /* HSYNC pulse width in clocks */
112  240, /* Pixels per line */
113  2, /* Vertical back porch in clocks */
114  1, /* Vertical front porch in clocks */
115  2, /* VSYNC pulse width in clocks */
116  320, /* Lines per panel */
117  0, /* Invert output enable, 1 = invert */
118  1, /* Invert panel clock, 1 = invert */
119  1, /* Invert HSYNC, 1 = invert */
120  1, /* Invert VSYNC, 1 = invert */
121  1, /* AC bias frequency in clocks (not used) */
122  6, /* Maximum bits per pixel the display supports */
123  LCD_TFT, /* LCD panel type */
124  LCD_COLOR_FORMAT_BGR, /* BGR or RGB */
125  0 /* Dual panel, 1 = dual panel display */
126 };
127 
128 /*****************************************************************************
129  * Public types/enumerations/variables
130  ****************************************************************************/
131 
132 /*****************************************************************************
133  * Private functions
134  ****************************************************************************/
135 
136 /* Very simple (inaccurate) delay function */
137 static void delayMs(uint32_t ms)
138 {
139  uint32_t i;
140  for (i = 0; i < 100 * ms; i++) {}
141 }
142 
143 /* Additional (SPI) pin configuration for LCD interface signals */
144 static void lcdPinConfig(void)
145 {
146  /* PC.11 connected to GPIO = SSEL_MUX_A, PC.12 connected to GPIO = SSEL_MUX_B */
149  Chip_GPIO_WriteDirBit(LPC_GPIO_PORT, 0x6, 10, true);
150  Chip_GPIO_WriteDirBit(LPC_GPIO_PORT, 0x6, 11, true);
151 
152  /* Configure SSP0 pins */
153  /* PF.0 connected to SCL/SCLK */
155  /* PF.1 connected to nCS */
157  /* PF.2 connected to SO */
159  /* PF.3 connected to nSI */
161 
162  /* DC PIN */
165 }
166 
167 /* Write to a LCD register using SPI */
168 static void writeLCDReg(uint16_t addr, uint16_t data)
169 {
170  uint8_t buf[2];
171 
172  Chip_GPIO_WritePortBit(LPC_GPIO_PORT, 0x06, 10, true);
173  Chip_GPIO_WritePortBit(LPC_GPIO_PORT, 0x06, 11, false);
174 
175  LCD_DC_CMD;
176 
177  buf[0] = 0;
178  buf[1] = (addr & 0xff);
179 
181 
182  LCD_DC_DATA;
183  buf[0] = (data >> 8);
184  buf[1] = (data & 0xff);
186 
187  LCD_DC_CMD;
188 
189  buf[0] = (0);
190  buf[1] = (0x22);
192 }
193 
194 /* Initialize SSD1289 LCD Controller */
195 static void initSSD1289(void)
196 {
197  writeLCDReg(0x00, 0x0001);
198  delayMs(15);
199  writeLCDReg(0x03, 0x6E3E); // 0xAEAC
200  writeLCDReg(0x0C, 0x0007);
201  writeLCDReg(0x0D, 0x000E); // 0x000F
202  writeLCDReg(0x0E, 0x2C00); // 0x2900
203  writeLCDReg(0x1E, 0x00AE); // 0x00B3
204  delayMs(15);
205  writeLCDReg(0x07, 0x0021);
206  delayMs(50);
207  writeLCDReg(0x07, 0x0023);
208  delayMs(50);
209  writeLCDReg(0x07, 0x0033);
210  delayMs(50);
211 
212  writeLCDReg(0x01, 0x2B3F);
213  writeLCDReg(0x02, 0x0600);
214  writeLCDReg(0x10, 0x0000);
215  delayMs(15);
216  writeLCDReg(0x11, 0xC5B0); // 0x65b0
217  delayMs(20);
218  writeLCDReg(0x05, 0x0000);
219  writeLCDReg(0x06, 0x0000);
220  writeLCDReg(0x16, 0xEF1C);
221  writeLCDReg(0x17, 0x0003);
222  writeLCDReg(0x07, 0x0233);
223  writeLCDReg(0x0B, 0x5312);
224  writeLCDReg(0x0F, 0x0000);
225  writeLCDReg(0x25, 0xE000);
226  delayMs(20);
227  writeLCDReg(0x41, 0x0000);
228  writeLCDReg(0x42, 0x0000);
229  writeLCDReg(0x48, 0x0000);
230  writeLCDReg(0x49, 0x013F);
231  writeLCDReg(0x44, 0xEF00);
232  writeLCDReg(0x45, 0x0000);
233  writeLCDReg(0x46, 0x013F);
234  writeLCDReg(0x4A, 0x0000);
235  writeLCDReg(0x4B, 0x0000);
236  delayMs(20);
237  writeLCDReg(0x30, 0x0707);
238  writeLCDReg(0x31, 0x0704);
239  writeLCDReg(0x32, 0x0005); // 0x0204
240  writeLCDReg(0x33, 0x0402); // 0x0201
241  writeLCDReg(0x34, 0x0203);
242  writeLCDReg(0x35, 0x0204);
243  writeLCDReg(0x36, 0x0204);
244  writeLCDReg(0x37, 0x0401); // 0x0502
245  writeLCDReg(0x3A, 0x0302);
246  writeLCDReg(0x3B, 0x0500);
247  delayMs(20);
248  writeLCDReg(0x22, 0x0000);
249 }
250 
251 /* Send/Receive data to/from TSC2046. */
252 static void readWriteTSC2046(uint8_t command, uint16_t *data)
253 {
254  uint8_t rx_data[2], tx_data[1] = {0x00};
255 
256  tx_data[0] = command;
257  Chip_GPIO_WritePortBit(LPC_GPIO_PORT, 6, 10, false);
259 
260  Chip_GPIO_WritePortBit(LPC_GPIO_PORT, 7, 16, false);
261 
264 
265 #if (TSC2046_CONVERSION_BITS == 8)
266  *data = (((rx_data[0] << 8) | (rx_data[1])) >> 7) & 0xFF;
267 #else
268  *data = (((rx_data[0] << 8) | rx_data[1]) >> 3) & 0xFFF;
269 #endif
271 }
272 
273 /* Evaluate the coordinates received from TSC2046. */
274 static Status evalTSC2046Coord(uint8_t command, uint16_t *coord)
275 {
276  uint32_t i;
277  uint16_t Tmp = 0, previousTmp;
278  int16_t diff = 0;
279  *coord = 0;
280  for (i = 0; i < COORD_GET_NUM; i++) {
281  previousTmp = Tmp;
282  readWriteTSC2046(command, &Tmp);
283  if (Tmp > TSC2046_COORD_MAX) {
284  return ERROR;
285  }
286  if (i > 0) {
287  diff = Tmp - previousTmp;
288  }
289  if (diff < 0) {
290  diff = 0 - diff;
291  }
292  if (diff > TSC2046_DELTA_VARIANCE) {
293  return ERROR;
294  }
295  *coord += Tmp;
296  }
297  *coord /= COORD_GET_NUM;
298  return SUCCESS;
299 }
300 
301 /* Convert the coord received from TSC to a value on truly LCD */
302 static int16_t calibrateTSC2046(int16_t Coord, int16_t MinVal, int16_t MaxVal, int16_t TrueSize)
303 {
304  int16_t tmp;
305  int16_t ret;
306  uint8_t convert = 0;
307 
308  /* Swap value? */
309  if (MinVal > MaxVal) {
310  tmp = MaxVal;
311  MaxVal = MinVal;
312  MinVal = tmp;
313  convert = 1;
314  }
315 
316  ret = (Coord - MinVal) * TrueSize / (MaxVal - MinVal);
317  if (convert) {
318  ret = TrueSize - ret;
319  }
320 
321  return ret;
322 }
323 
324 static void delay(uint32_t i) {
325  while (i--) {}
326 }
327 
328 /* Initialize UDA1380 CODEC */
329 static Status Board_Audio_CodecInit(int micIn)
330 {
331  /* Reset UDA1380 on board Hitex A4*/
332  /* PE_9: UDA_RST on Hitex A4 */
336  /* delay 1us */
337  delay(100000);
339  delay(100000);
340 
341  if (!UDA1380_Init(UDA1380_MIC_IN_LR & - (micIn != 0))) {
342  return ERROR;
343  }
344 
345  return SUCCESS;
346 }
347 
348 /*****************************************************************************
349  * Public functions
350  ****************************************************************************/
351 
352 /* Initialize pin muxing for a UART */
354 {
355  if (pUART == LPC_USART0) {
356  Chip_SCU_PinMuxSet(0xF, 10, (SCU_MODE_MODE_REPEATER | SCU_MODE_FUNC1)); /* PF.10 : UART0_TXD */
358  }
359  else if (pUART == LPC_UART1) {
360  Chip_SCU_PinMuxSet(0xC, 13, (SCU_MODE_MODE_REPEATER | SCU_MODE_FUNC2)); /* PC.13 : UART1_TXD - pin 1 of SV14 */
361  Chip_SCU_PinMuxSet(0xC, 14, (SCU_MODE_MODE_PULLUP | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC2)); /* PC.14 : UART1_RX - pin 2 of SV14 */
362  }
363  else if (pUART == LPC_USART2) {
364  /* P1.15 : UART2_TXD - pin 11 of SV6, P1.16 : UART2_RXD - pin 3 of SV6 */
367  }
368  else if (pUART == LPC_USART3) {
369  /* P9.3 : UART3_TXD - pin 15 of SV6, P9.4 : UART3_RXD - pin 7 of SV3 */
372  }
373 }
374 
375 /* Initialize debug output via UART for board */
377 {
378 #if defined(DEBUG_UART)
380 
382  Chip_UART_SetBaud(DEBUG_UART, 115200);
384 
385  /* Enable UART Transmit */
387 #endif
388 }
389 
390 /* Sends a character on the UART */
391 void Board_UARTPutChar(char ch)
392 {
393 #if defined(DEBUG_UART)
394  while (Chip_UART_SendByte(DEBUG_UART, (uint8_t) ch) == ERROR) {}
395 #endif
396 }
397 
398 /* Gets a character from the UART, returns EOF if no character is ready */
400 {
401 #if defined(DEBUG_UART)
402  uint8_t data;
403 
404  if (Chip_UART_ReceiveByte(DEBUG_UART, &data) == SUCCESS) {
405  return (int) data;
406  }
407 #endif
408  return EOF;
409 }
410 
411 /* Outputs a string on the debug UART */
412 void Board_UARTPutSTR(char *str)
413 {
414 #if defined(DEBUG_UART)
415  while (*str != '\0') {
416  Board_UARTPutChar(*str++);
417  }
418 #endif
419 }
420 
421 /* Initializes board LED(s) */
422 static void Board_LED_Init()
423 {
424  int i;
425 
426  /* Set ports as outputs with initial states off */
427  for (i = 0; i < (sizeof(ledports) / sizeof(ledports[0])); i++) {
430  }
432 }
433 
434 /* Sets the state of a board LED to on or off */
435 void Board_LED_Set(uint8_t LEDNumber, bool On)
436 {
437  /* Must connect JP3 to see LED0 and JP4 to see LED1 */
438  if (LEDNumber == 0) {
439  On = !On;
440  }
441 
442  if (LEDNumber < 4) {
443  Chip_GPIO_WritePortBit(LPC_GPIO_PORT, ledports[LEDNumber], ledbits[LEDNumber], !On);
444  }
445 }
446 
447 /* Returns the current state of a board LED */
448 bool Board_LED_Test(uint8_t LEDNumber)
449 {
450  bool On = false;
451 
452  if (LEDNumber < 4) {
453  On = (bool) !Chip_GPIO_ReadPortBit(LPC_GPIO_PORT, ledports[LEDNumber], ledbits[LEDNumber]);
454 
455  if (LEDNumber == 0) {
456  On = ~On;
457  }
458  }
459 
460  return On;
461 }
462 
463 /* Initialize button(s) interface on board */
464 void Board_Buttons_Init(void) // FIXME not functional ATM
465 {
468 }
469 
470 /* Returns button(s) state on board */
472 {
473  uint8_t ret = NO_BUTTON_PRESSED;
475  ret |= BUTTONS_BUTTON1;
476  }
477  return ret;
478 }
479 
480 /* Initialize joystick interface on board */
482 {}
483 
484 /* Returns joystick states on board */
485 uint8_t Joystick_GetStatus(void)
486 {
487  return NO_BUTTON_PRESSED;
488 }
489 
494 
495 /* Update system core clock rate, should be called if the system has
496  a clock rate change */
498 {
499  /* CPU core speed */
501 }
502 
503 /* Returns the MAC address assigned to this board */
504 void Board_ENET_GetMacADDR(uint8_t *mcaddr)
505 {
506  const uint8_t boardmac[] = {0x00, 0x60, 0x37, 0x12, 0x34, 0x56};
507 
508  memcpy(mcaddr, boardmac, 6);
509 }
510 
511 /* Set up and initialize all required blocks and functions related to the
512  board hardware */
513 void Board_Init(void)
514 {
515  /* Sets up DEBUG UART */
516  DEBUGINIT();
517 
518  /* Updates SystemCoreClock global var with current clock speed */
520 
521  /* Initializes GPIO */
523 
524  /* Setup GPIOs for USB demos */
525 #if 0 /* FIXME: the following call removed on the Hitex board as it interferes with muxed MII state */
526  // Chip_SCU_PinMuxSet(0x9, 5, (SCU_MODE_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_FUNC2)); // P9_5 USB1_VBUS_EN, USB1 VBus function
527 #endif
528  Chip_SCU_PinMuxSet(0x2, 5, (SCU_MODE_MODE_PULLUP | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC2)); // P2_5 USB1_VBUS, MUST CONFIGURE THIS SIGNAL FOR USB1 NORMAL OPERATION
529  Chip_SCU_PinMuxSet(0x6, 3, (SCU_MODE_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_FUNC1)); // P6_3 USB0_PWR_EN, USB0 VBus function
530 
531  /* Initialize LEDs */
532  Board_LED_Init();
533 }
534 
535 /* Sets up board specific ADC interface */
536 void Board_ADC_Init(void)
537 {
538  /* Analog function ADC1_2 selected on pin PF_9 */
540 }
541 
542 /* Sets up board specific I2C interface */
544 {
545  if (id == I2C1) {
546  /* Configure pin function for I2C1 on PE.13 (I2C1_SDA) and PE.15 (I2C1_SCL) */
549  }
550  else {
552  }
553 }
554 
555 /* Initialize LCD Interface */
556 void Board_LCD_Init(void)
557 {
558  /* Reset LCD and wait for reset to complete */
560  while (Chip_RGU_InReset(RGU_LCD_RST)) {}
561 
562  lcdPinConfig();
564 }
565 
566 /* Initialize the LCD controller on the external QVGA (320x240) TFT LCD*/
568 {
570 
573  Chip_SSP_SetBitRate(LPC_SSP0, 1000000);
574 
575  ssp_format.frameFormat = SSP_FRAMEFORMAT_SPI;
576  ssp_format.bits = SSP_BITS_8;
577  ssp_format.clockMode = SSP_CLOCK_MODE0;
578 
579  Chip_SSP_SetFormat(LPC_SSP0, &ssp_format);
581 
582  delayMs(200);
583 
584  /* initialize LCD controller */
585  initSSD1289();
586 
589 }
590 
591 /* Initialize TSC2046 touchscreen controller */
593 {
594  uint16_t dummy_data;
596 
597  /* Configure SSP0 pins*/
598  lcdPinConfig();
600 
601  Chip_GPIO_WriteDirBit(LPC_GPIO_PORT, 7, 16, true);
602 
603  Chip_GPIO_WritePortBit(LPC_GPIO_PORT, 6, 10, false);
605 
607 
609  Chip_SSP_SetBitRate(LPC_SSP0, 200000);
610 
611  ssp_format.frameFormat = SSP_FRAMEFORMAT_SPI;
612  ssp_format.bits = SSP_BITS_8;
613  ssp_format.clockMode = SSP_CLOCK_MODE3;
614 
615  Chip_SSP_SetFormat(LPC_SSP0, &ssp_format);
617 
618  /* Enable Touch Screen Controller */
619  readWriteTSC2046(PWRDOWN, &dummy_data);
620 }
621 
622 /* Get Touch coordinates */
623 bool Board_GetTouchPos(int16_t *pX, int16_t *pY)
624 {
625  uint16_t tmp;
626  uint16_t x, y, z1, z2, z = 0;
627  Status Sts = SUCCESS;
628 
633 
634  if (z1 != 0) {
635  z = x * ((z2 / z1) - 1);
636  }
637  if ((z <= 0) || (z > 35000)) {
638  return false;
639  }
640  /* Get X-Coordinate */
641  Sts = evalTSC2046Coord(X_MEASURE, &x);
642 
643  if (Sts == ERROR) {
644  return false;
645  }
646  /* Get Y-Coordinate */
647  Sts = evalTSC2046Coord(Y_MEASURE, &y);
648  if (Sts == ERROR) {
649  return false;
650  }
651  /* Get Z1-Value */
652  Sts = evalTSC2046Coord(Z1_MEASURE, &z1);
653  if (Sts == ERROR) {
654  return false;
655  }
656  /* Get Z2-Value */
657  Sts = evalTSC2046Coord(Z2_MEASURE, &z2);
658  if (Sts == ERROR) {
659  return false;
660  }
661 
662  z = x * ((z2 / z1) - 1);
663  if ((z <= 0) || (z > 35000)) {
664  return false;
665  }
666  else {
667  /* Swap, adjust to truly size of LCD */
668  if (TSC_Config.swap_xy) {
669  *pY = calibrateTSC2046(x, TSC_Config.ad_top, TSC_Config.ad_bottom, TSC_Config.lcd_height);
670  *pX = calibrateTSC2046(y, TSC_Config.ad_left, TSC_Config.ad_right, TSC_Config.lcd_width);
671  }
672  else {
673  *pX = calibrateTSC2046(x, TSC_Config.ad_top, TSC_Config.ad_bottom, TSC_Config.lcd_width);
674  *pY = calibrateTSC2046(y, TSC_Config.ad_left, TSC_Config.ad_right, TSC_Config.lcd_height);
675  }
676  }
677  readWriteTSC2046(PWRDOWN, &tmp);
678 
679  return true;
680 }
681 
682 /* Turn on Board LCD Backlight */
683 void Board_SetLCDBacklight(uint8_t Intensity)
684 {
685  bool OnOff = (bool) (Intensity != 0);
686 
688 }
689 
690 /* Initialize pin muxing for SDMMC interface */
692 {
693  Chip_SCU_PinMuxSet(0xc, 9, (SCU_MODE_MODE_PULLUP | SCU_MODE_FUNC7)); /* Pc.9 SDIO power */
694  Chip_SCU_PinMuxSet(0xc, 2, (SCU_MODE_MODE_PULLUP | SCU_MODE_FUNC7)); /* Pc.2 SDIO LED */
695  Chip_SCU_PinMuxSet(0xf, 10, (SCU_MODE_MODE_PULLUP | SCU_MODE_INBUFF_EN | SCU_MODE_FUNC6)); /* Pf.10 SDIO WP */
697  Chip_SCU_PinMuxSet(0xc, 6, (SCU_PINIO_FAST | SCU_MODE_FUNC7)); /* Pc.6 SDIO D2 */
698  Chip_SCU_PinMuxSet(0xc, 5, (SCU_PINIO_FAST | SCU_MODE_FUNC7)); /* Pc.5 SDIO D1 */
699  Chip_SCU_PinMuxSet(0xc, 4, (SCU_PINIO_FAST | SCU_MODE_FUNC7)); /* Pc.4 SDIO D0 */
701  Chip_SCU_PinMuxSet(0xc, 10, (SCU_PINIO_FAST | SCU_MODE_FUNC7)); /* Pc.10 SDIO command */
702  Chip_SCU_PinMuxSet(0xc, 7, (SCU_PINIO_FAST | SCU_MODE_FUNC7)); /* Pc.7 SDIO D3 */
703 }
704 
705 /* Initialize pin muxing for SSP interface */
707 {
708  if (pSSP == LPC_SSP0) {
709  /* Set up clock and muxing for SSP0 interface */
710  // #if !defined(HITEX_LCD_TERM)
711  /* PC.11 connected to GPIO = SSEL_MUX_A, PC.12 connected to GPIO = SSEL_MUX_B */
714  Chip_GPIO_WriteDirBit(LPC_GPIO_PORT, 0x6, 10, true);
715  Chip_GPIO_WriteDirBit(LPC_GPIO_PORT, 0x6, 11, true);
716  // #endif
717  /* PF.0 connected to SCL/SCLK SCU_MODE_FUNC2=SSP0 SCK0 */
719  /* PF.1 connected to nCS SCU_MODE_FUNC2=SSP0 SSEL0 */
721  /* PF.2 connected to SO SCU_MODE_FUNC2=SSP0 MISO0 */
723  /* PF.3 connected to nSI SCU_MODE_FUNC2=SSP0 MOSI0 */
725  }
726  else if (pSSP == LPC_SSP1) {
727  /* Set up clock and muxing for SSP1 interface */
728  /* P1.19 connected to SCL/SCLK SCU_MODE_FUNC1=SSP1 SCK1 */
730  /* P1.20 connected to nCS SCU_MODE_FUNC1=SSP1 SSEL1 */
732  /* P0.0 connected to SO SCU_MODE_FUNC1=SSP1 MISO1 */
734  /* P0.1 connected to nSI SCU_MODE_FUNC2=SSP1 MOSI1 */
736  }
737 }
738 
739 /* Initialize I2S interface for the board and UDA1380 */
740 void Board_Audio_Init(LPC_I2S_T *pI2S, int micIn)
741 {
742  Chip_I2S_Audio_Format_T I2S_Config;
743 
744  I2S_Config.SampleRate = 48000;
745  I2S_Config.ChannelNumber = 2; // 1 is mono, 2 is stereo
746  I2S_Config.WordWidth = 16; // 8, 16 or 32 bits
747  Chip_I2S_Init(pI2S);
748  Chip_I2S_Config(pI2S, I2S_TX_MODE, &I2S_Config);
749 
750  /* Init UDA1380 CODEC */
751  while (Board_Audio_CodecInit(micIn) != SUCCESS) {}
752 
753 }
754 
755 /* Initialize DAC interface for the board */
757 {
759 }
760 
761 /* FIXME */
762 void Serial_CreateStream(void *Stream)
763 {
764  // implement later
765 }
766