/*------------------------------------------------------------------------------ -- This file is a part of the libuc, microcontroler library -- Copyright (C) 2013, Alexis Jeandet -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------- -- Author : Alexis Jeandet -- Mail : alexis.jeandet@member.fsf.org -------------------------------------------------------------------------------*/ #include "bsp.h" #include #include #include #include #include #include #include #include #include #include #include "bsp_gpio.h" #include "bsp_i2c.h" #include "bsp_i2c.h" uint32_t OSC0 =12000000; uint32_t INTOSC =16000000; uint32_t RTCOSC =32768; uint32_t currentCpuFreq=0; extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__]; float VREF0 =(float)3.3; sdcardDev sdcard2; blkdevice sdcard2blkdev; dikpartition sdcard2Part1; FAT32fs sdcard2FAT32part1; dikpartition sdcard2Part2; FAT32fs sdcard2FAT32part2; dikpartition sdcard2Part3; FAT32fs sdcard2FAT32part3; dikpartition sdcard2Part4; FAT32fs sdcard2FAT32part4; int bsp_init() { int i=0; for(i=0;i<__MAX_OPENED_FILES__;i++) { __opnfiles__[i] = NULL; } bsp_GPIO_init(); bsp_uart_init(); bsp_iic_init(); bsp_spi_init(); bsp_SD_init(); printf("\r=====================\n\r"); printf( "=====================\n\r"); printf(BSP); printf(" initialised\n\r"); printf( "=====================\n\r"); #if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__ printf( "BIG ENDIAN MACHINE\n\r"); #else printf( "LITLE ENDIAN MACHINE\n\r"); #endif return 1; } void bsp_GPIO_init() { gpio_t GPIO_Out_init_List[]={LED1}; gpio_t GPIO_In_init_List[]={BP1}; bsp_gpio_set_outputs(GPIO_Out_init_List,1); bsp_gpio_set_inputs(GPIO_In_init_List,1); } void bsp_uart_init() { if(__opnfiles__[1]==NULL) { streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice)); uart_t uart = uartopenandconfig(uart6,uartparitynone | uart8bits | uartonestop,115200,PC6,PC7,-1,-1); uartmkstreamdev(uart,fd1); __opnfiles__[1] = fd1; } else { uartopenandconfig(uart6,uartparitynone | uart8bits | uartonestop,115200,PC6,PC7,-1,-1); } } void bsp_iic_init() { // i2copenandconfig(i2c2,0,10000,PF0,PF1); } void bsp_GTerm_init() { }