Environment.h (BLACKSheep OS)
Introduction
This document describes the basic functionality of the header file Environment.h that must be included in a BLACKSheep® OS project.
The header file Environment.h contains many user-defined macros that describes the behavior of your BLACKSheep® OS firmware. Therefore you can i.e. specify which software-modules that should be loaded from BLACKSheep® OS, set the processor frequency or specify the UART used by the terminal.
Layout
The Environment.h is subdivided into several modules starting with a short description like this: <source lang="c"> /**********************************************************************************************
** Module Name ** **********************************************************************************************/
</source>
In most instances there follows two macros that specify if the module should be loaded or not and if the module should be able to print debug informations to the terminal. The syntax of the macros is: <source lang="c">
- define _USE_MODULE_NAME_ ///< Uncomment to use the module
//#define MODULE_NAME_DEBUG ///< Uncomment to get debug informations from module </source>
The following macros are used to define the behavior of the module.
Not all modules can be used by each processor, i.e. you cannot use the CAN Bus module on a BF561 processor!
Example
Following example shows how to configure the Environment.h to use the module Alive LED. This module starts a thread called led_thread that controls the blink period of a connected LED. <source lang="c"> /**********************************************************************************************
** Alive LED ** **********************************************************************************************/
- define _USE_ALIVE_LED_ ///< Uncomment to use a flashing LED for debug purposes
/**********************************************************************************************/
- define ALIVE_LED_PIN _PG10 ///< Alive LED pin
- define ALIVE_LED_INTERVAL 500 ///< Interval for flashing LED in ms
/**********************************************************************************************/ </source>
As you can see is the module in use, the LED is connected to the GPIO _PG10 and the blink interval is set to 500ms. In this case there are no debug informations available therefore the macro ALIVE_LED_DEBUG is obsolete.
Modules
Processor definitions
Defines the processor and the processor frequencies. <source lang="c"> /**********************************************************************************************
** Processor Definitions ** **********************************************************************************************/
- define PROC_CLOCK_FREQ_IN 30 ///< Input clock source frequency in MHz
- define PROC_CLOCK_FREQ_CORE 510 ///< Core frequency in MHz
- define PROC_CLOCK_FREQ_SYSTEM 128 ///< System frequency in MHz
- define PROC_CLOCK_USE_PLL_INPUT_DIV ///< Uncomment to use the PLL input divider
- define PROC_VARIANT ADI_PWR_PROC_BF537SKBC600 ///< Processor variant (see adi_pwr.h)
- define PROC_PACKAGE ADI_PWR_PACKAGE_MBGA ///< Processor package (see adi_pwr.h)
- define PROC_VDDEXT ADI_PWR_VDDEXT_330 ///< External Voltage supply (see adi_pwr.h)
- define PROC_USE_EXTERNAL_VCCINT ///< Uncomment to use an external VccINT
- define PROC_VDDINT ADI_PWR_VLEV_140 ///< Core voltage (see adi_pwr.h)
/*********************************************************************************************/ </source>
The macro PROC_USE_EXTERNAL_VCCINT can only be used with the BF561.
BS UART
Defines the UART interface for the BLACKSheep® OS terminal.
<source lang="c"> /**********************************************************************************************
** BS UART ** **********************************************************************************************/
- define _USE_UART_ ///< Uncomment to use Uart for the terminal
- define _USE_BSUART_ ///< Uncomment to use BSUart
- define BSUART_DEBUG ///< Uncomment to get BSUart debug information
- define _BSUART_FORCE_ISR_TO_L1_ ///< Uncomment to force the ISR of the BS UART into L1 memory
- define _BSUART_USE_TX_DMA_ ///< May not work on all blackfin types.
///< "give DMA priority over cpu in external memory" ///< has to be set, otherwise problems with xmodem transfer occurs
/**********************************************************************************************/
- define BSUART_UART_NR 0 ///< Number of the UART interface
- define BSUART_BAUDRATE 115200 ///< Baudrate of the terminal output
- define BSUART_RX_BUFFER_SIZE 2048 ///< Receive buffer size
- define BSUART_TX_BUFFER_SIZE 10000 ///< Transmit buffer size
- define BSUART_MESSAGE_MAX_LENGTH 256 ///< Maximal length of the message buffer
/*********************************************************************************************/ </source>
Bootloader Behavior
Defines the behavior of the BLACKSheep® OS bootloader
<source lang="c"> /**********************************************************************************************
** BOOTLOADER Behavior ** **********************************************************************************************/
- define BOOTLOADER_ENABLE_FLASH_KEY_CHECK ///< Uncomment to enable the fwupdate command support
- define BOOTLOADER_ENABLE_KEY_PRESSED_CHECK ///< Uncomment to enter the bootloader via press of 'c' during boot
- define BOOTLOADER_WAIT_FOR_KEY_TIMEOUT 300 ///< [ms]
/**********************************************************************************************/ </source>
BLACKSheep
Defines the version of the firmware and some basic settings for the BLACKSheep® OS framework.
<source lang="c"> /**********************************************************************************************
** BLACKSheep ** **********************************************************************************************/
- define BS_VERSION_1 "VDK BLACKSheep for CM-BF537U" ///< BLACKSheep version
- define BS_VERSION_2 "Developed by Roland Oberhammer (suedtirolli)" ///< BLACKSheep version
- define BS_VERSION_3 "Refer to www.bluetechnix.com for further information." ///< BLACKSheep version
- define BS_VERSION_4 "" ///< BLACKSheep version
- define BS_FIRMWARE_VERSION "1.1.0" ///< BLACKSheep firmware version
- define BS_BOOT_DELAY 100 ///< Boot delay in ms
- define BS_IDE "" ///< IDE used to compile this project. Leave blank to generate automaticaly.
- define BS_NOF_DXE_IN_FLASH 0 ///< Application number of BLACKSheep in flash. 0 mean that BS is first dxe in flash, without any bootloader
- define BS_SECONDS_PRIOR_BOOT_APP 3 ///< Time to wait prior to boot the application
- define BS_DXE_SIZE_MAX 0x200000 ///< Maximal possible size of an application that can be load
- define BS_IVG_PERIPHERAL_ERROR 7 ///< IVG for peripheral errors
- define BS_IVG_DMA_ERROR 7 ///< IVG for DMA errors
- define BS_INT_MNG_NOF_SECONDARY_HANDLER 25 ///< Number of secondary Interrupt handlers
- define BS_NOF_USER_IVGS 7 ///< Number of user IVGs
//#define BS_NO_BOOT_FLASHING ///< Uncomment to disable the -b option in the flash command
- define BS_ENABLE_EXECUTE_USER_CODE 0 ///< Enable the execution of the function executeUserCode after the boot process. The function must be declared in an extern file.
/*********************************************************************************************/ </source>
BLACKSheep commands
Here you can activate or deactivate the commands that should be supported by BLACKSheep® OS.
<source lang="c"> /**********************************************************************************************
** BLACKSheep Commands ** **********************************************************************************************/
- define BS_CMD_USE_HELLO ///< Uncomment to use command hello
- define BS_CMD_USE_CAN ///< Uncomment to use command can
- define BS_CMD_USE_CAT ///< Uncomment to use command cat
- define BS_CMD_USE_CD ///< Uncomment to use command cd
- define BS_CMD_USE_CP ///< Uncomment to use command cp
#define BS_CMD_CP_BUFFER_SIZE 1024 * 1024 * 1 ///< Buffer size for copy command
- define BS_CMD_USE_DATE ///< Uncomment to use command date
- define BS_CMD_USE_ENV ///< Uncomment to use the command env
- define BS_CMD_USE_EXTIME ///< Uncomment to use command extime
#define DO_CYCLE_COUNTS ///< Uncomment to use this function with better precision
- define BS_CMD_USE_FLASH ///< Uncomment to use command flash
- define BS_CMD_USE_FORMAT ///< Uncomment to use command format
- define BS_CMD_USE_FTP ///< Uncomment to use command ftp
- define BS_CMD_USE_GM ///< Uncomment to use command gm
- define BS_CMD_USE_GPIO ///< Uncomment to use command gpio
- define BS_CMD_USE_HELP ///< Uncomment to use command help
- define BS_CMD_USE_I2C ///< Uncomment to use command i2c
- define BS_CMD_USE_IFCONFIG ///< Uncomment to use command ifconfig
- define BS_CMD_USE_KILL ///< Uncomment to use command kill
- define BS_CMD_USE_LOAD ///< Uncomment to use command load
- define BS_CMD_USE_LS ///< Uncomment to use command ls
- define BS_CMD_USE_MD5 ///< Uncomment to use command md5
- define BS_CMD_USE_MKDIR ///< Uncomment to use command mkdir
- define BS_CMD_USE_MOUNT ///< Uncomment to use command mount
- define BS_CMD_USE_PASSWD ///< Uncomment to use command passwd
- define BS_CMD_USE_PINFO ///< Uncomment to use command pinfo
- define BS_CMD_USE_PROC_INFO ///< Uncomment to use command proc
- define BS_CMD_USE_PS ///< Uncomment to use command ps
- define BS_CMD_USE_PWD ///< Uncomment to use command pwd
- define BS_CMD_USE_REBOOT ///< Uncomment to use command reboot
- define BS_CMD_USE_REDIO ///< Uncomment to use command redio
- define BS_CMD_USE_RM ///< Uncomment to use command rm
- define BS_CMD_USE_TEST ///< Uncomment to use command test
- define BS_CMD_USE_TFTP ///< Uncomment to use command tftp
- define BS_CMD_USE_TIME ///< Uncomment to use command time
- define BS_CMD_USE_PWM ///< Uncomment to use command pwm
- define BS_CMD_USE_UMOUNT ///< Uncomment to use command umount
- define BS_CMD_USE_USBMOUNT ///< Uncomment to use command usbmount
- define BS_CMD_USE_VER ///< Uncomment to use command ver
- define BS_CMD_USE_VIEW ///< Uncomment to use command view
- define BS_CMD_USE_WDT ///< Uncomment to use command watchdog
- define BS_CMD_USE_XMR ///< Uncomment to use command xmr
- define BS_CMD_USE_XMT ///< Uncomment to use command xmt
/**********************************************************************************************/ </source>
Test facilities
Here you can define the behavior of the BLACKSheep® OS command test.
<source lang="c"> /**********************************************************************************************
** Test facilities ** **********************************************************************************************/
- define TEST_SDRAM_SIZE (0x200000) ///< Size of block to be tested (2MB)
- define TEST_FLASH_SECTOR (FLASH_NUM_SECTORS - 12) ///< Sector to be tested
- define TEST_DPRAM_BASE_ADDRESS_A 0x20300000 ///< Base address A of DPRAM
- define TEST_DPRAM_BASE_ADDRESS_B 0x20200000 ///< Base address B of DPRAM
- define TEST_DPRAM_SIZE 0x1000 ///< Size of DPRAM (4kb)
- define TEST_FRAME_BUFFER_SIZE 0 ///< Frame buffer size. 0 means not used
- define TEST_FRAME_BUFFER_BASE 0 ///< Frame buffer base address. 0 means not used
/**********************************************************************************************/ </source>
Terminal
Configures the BLACKSheep® OS terminal that is started after booting.
<source lang="c"> /**********************************************************************************************
** Terminal ** **********************************************************************************************/ #define _USE_TERMINAL_ ///< Uncomment to create the terminal after booting
/**********************************************************************************************/
- define TERMINAL_STANDARD_INPUT stdin ///< Input device
- define TERMINAL_STANDARD_OUTPUT stdout ///< Output device
- define TERMINAL_PROMPT "CM-BF537U boot" ///< Terminal prompt
/**********************************************************************************************/ </source>
Telnet
Here you can configure the Telnet tool supported by BLACKSheep.
<source lang="c"> /**********************************************************************************************
** Telnet ** **********************************************************************************************/
- define _USE_TELNET_ ///< Uncomment to use the Telnet service
/**********************************************************************************************/
- define TELNET_WELCOME_MESSAGE "Welcome on BLACKSheep Telnet terminal.\n\rType 'exit' to logout.\n\r\n\r" ///< Telnet welcome message
- define TELNET_PORT 23 ///< Port number
/**********************************************************************************************/ </source>
Web Server
In this section you can configure the embedded web server based on the free GoAhead Web Server. <source lang="c"> /**********************************************************************************************
** Web Server ** **********************************************************************************************/
- define _USE_WEB_SERVER_ ///< Uncomment to use the web server
- define WEB_SERVER_DEBUG ///< Uncomment to get web server debug informations
/**********************************************************************************************/
- define WEB_SERVER_ROOT_DIR "rd0:\\web" ///< Root directory
- define WEB_DEFAULT_PAGE "index.html" ///< Index page
- define WEB_SERVER_TCP_PORT 80 ///< TCP port
- define WEB_SERVER_STANDARD_OUTPUT stdout ///< Standard output device
- define WEB_SERVER_THREAD_PRIORITY 5 ///< Thread priority
- define WEB_SERVER_THREAD_NAME "httpd" ///< Thread name
/**********************************************************************************************/ </source>
Alive LED
In this section you can activate a simple thread that controls a LED.
<source lang="c"> /**********************************************************************************************
** Alive LED ** **********************************************************************************************/
- define _USE_ALIVE_LED_ ///< Uncomment to use a flashing LED for debug purposes
/**********************************************************************************************/
- define ALIVE_LED_PIN _PG10 ///< Alive LED pin
- define ALIVE_LED_INTERVAL 500 ///< Interval for flashing LED in ms
/**********************************************************************************************/ </source>
User Management
This section is used to set password requirements for telnet and terminal sessions.
<source lang="c"> /**********************************************************************************************
** User Management ** **********************************************************************************************/
- define _USE_USER_MANAGEMENT_ ///< Uncomment to use the User management
/**********************************************************************************************/
- define USER_MANAGEMENT_PP_TELNET_REQ_PASS 0 ///< Set 1 to enable password protection for Telnet
- define USER_MANAGEMENT_PP_TERMINAL_REQ_PASS 0 ///< Set 1 to enable password protection for UART terminal
- define USER_MANAGEMENT_PP_DEFAULT_USER_NAME "user" ///< Default user name
- define USER_MANAGEMENT_PP_DEFAULT_PASSWORD "pass" ///< Default password
/*********************************************************************************************/ </source>
System Management
<source lang="c"> /**********************************************************************************************
** System Management ** **********************************************************************************************/
- define SYSTEM_MGNT_SECTOR (FLASH_NUM_SECTORS - 8) ///< sector used to store system management settings
- define SYSTEM_USER_ARG_SIZE_MAX 10 ///< Number of arguments used for communication between bootloader and application
/*********************************************************************************************/ </source>
Asyncronous memory
Here you can set the values for the asyncronous memory interface of the Blackfin processor.
<source lang="c"> /**********************************************************************************************
** Asyncronous Memory ** **********************************************************************************************/
- define AMI_EBIU_AMBCTL0_VALUE 0x7bb07bb0 ///< Value of the EBIU_AMBCTL0 register
- define AMI_EBIU_AMBCTL1_VALUE 0x7bb07bb0 ///< Value of the EBIU_AMBCTL1 register
- define AMI_EBIU_AMGCTL_VALUE 0x01f8 ///< Value of the EBIU_AMGCTL register
/*********************************************************************************************/ </source>
Flash memory
This section is reserved for flash memory settings.
<source lang="c"> /**********************************************************************************************
** FLASH Memory ** **********************************************************************************************/
- define FLASH_INTEL_STRATA ///< Uncomment if Intel Strata compatible flash
- define FLASH_START_ADDRESS 0x20000000 ///< Start address of the flash memory
- define FLASH_NUM_SECTORS 64 ///< Number of flash sectors
- define FLASH_SECTOR_SIZE 0x8000 ///< Size of flash sectors
- define FLASH_NOF_BANKS 1 ///< Number of flash banks
- define FLASH_BANK_SIZE 0x200000 ///< Size of a bank
- define FLASH_BANK_SELECT0 0 ///< Bank select pin for bank 0 (set 0 if not support)
- define FLASH_BANK_SELECT1 0 ///< Bank select pin for bank 1 (set 0 if not support)
- define FLASH_BANK_SELECT2 0 ///< Bank select pin for bank 2 (set 0 if not support)
- define FLASH_BANK_SELECT3 0 ///< Bank select pin for bank 3 (set 0 if not support)
- define FLASH_BANK_SELECT4 0 ///< Bank select pin for bank 4 (set 0 if not support)
- define FLASH_BANK_SELECT5 0 ///< Bank select pin for bank 5 (set 0 if not support)
- define FLASH_APP_ERASE_END_ADDR FLASH_START_ADDRESS + ((FLASH_NUM_SECTORS - 16) * FLASH_SECTOR_SIZE) ///< End address for erasing applications in flash
- define FLASH_RSDEV_PASS_PROTECT ///< Uncomment to protect the erase device function by password
- define FLASH_USE_WORKAROUND ///< Uncomment to use the flash workaround
- define FLASH_RSDEV_PASSWORD "bsnorsdev" ///< Select the password for rsdev, rsmsec and flash as bootloader, uncomment to set default
- define FLASH_ENV_TABLE_APP_NAME "app0_name" ///< Name of the 'application name'-variable in the environment table
- define FLASH_ENV_TABLE_APP_NAME_LENGTH 100 ///< Maximal length of the application name
- define FLASH_ENV_TABLE_APP_CRC32 "app0_crc32"///< Name of the 'application crc32'-variable in the environment table
- define FLASH_ENV_TABLE_APP_SIZE "app0_size" ///< Name of the 'application size'-variable in the environment table
/*********************************************************************************************/ </source>
MDMA manager
Here you can activate, deactivate and configure the MDMA manager.
<source lang="c"> /**********************************************************************************************
** MDMA manager ** **********************************************************************************************/
- define _USE_MDMA_MNGR_ ///< Uncomment to use the MDMA manager
- define MDMA_MNGR__DEBUG ///< Uncomment to get MDMA manager debug information
/**********************************************************************************************/
- define MDMA_MNGR_IVG 0 ///< IVG for DMA interrupt
- define MDMA_MNGR_ERROR_IVG 0 ///< IVG for DMA error
/*********************************************************************************************/ </source>
RAM Drive
Configure the RAM drive.
<source lang="c"> /**********************************************************************************************
** RAM Drive ** **********************************************************************************************/
- define _USE_RAM_DRIVE_ ///< Uncomment to use the RAM drive
- define RAM_DRIVE_DEBUG ///< Uncomment to get RAM drive debug information
/**********************************************************************************************/
- define RAM_DRIVE_BLOCK_COUNT (8192*4) ///< Block count of RAM drive
- define RAM_DRIVE_FILE_SYSTEM FILE_SYSTEM_FULLFAT_NAME ///< File system used by the RAM drive
- define RAM_DRIVE_PARTITION_NAME "rd0" ///< Partition name (0 if unknown)
/*********************************************************************************************/ </source>
Environment Table
Configurations for the environment table used to store settings in the non-volatile flash memory.
<source lang="c"> /**********************************************************************************************
** Environment Table ** **********************************************************************************************/
- define EV_BASE_ADDRESS (FLASH_START_ADDRESS + ((FLASH_NUM_SECTORS - 4) * FLASH_SECTOR_SIZE)) ///< Address in flash where the environment table is stored
- define EV_STACK_SIZE 4096 ///< Size of the environment table
/*********************************************************************************************/ </source>
File system
Here you can choose which file systems should be supported by BLACKSheep® OS.
<source lang="c"> /**********************************************************************************************
** File system ** **********************************************************************************************/
- define _USE_FILE_SYSTEM_FREEDOS_ ///< Uncomment to use the FreeDOS file system
#define FILE_SYSTEM_FREEDOS_NAME "fat" ///< Name of the FreeDOS file system
- define _USE_FILE_SYSTEM_FULLFAT_ ///< Uncomment to use the FullFAT file system
#define FILE_SYSTEM_FULLFAT_NAME "fullfat" ///< Name of the FullFAT file system
- define _USE_FILE_SYSTEM_STREAMING_IO_ ///< Uncomment to use Streaming IO file system
#define FILE_SYSTEM_STREAMING_IO_NAME "strio" ///< Name of the Streaming IO file system
/*********************************************************************************************/ </source>
USB
Here you can activate the support for USB devices. <source lang="c"> /**********************************************************************************************
** USB ** **********************************************************************************************/
- define _USE_USB_ ///< Uncomment to use USB support
- define _USE_USB_NET2272_ ///< Uncomment to use net2272
- define _USE_CM_BF537U_SPECIFIC_USB_INIT_ ///< Uncomment for cm-bf537u usb support
- define _USE_USB_BULK_TRANSFER_ ///< Uncomment to initalize USB for Bulk Transfer
- define NET2272_DEBUG ///< Uncomment to get net2272 debug information
/**********************************************************************************************/
- ifdef _USE_USB_NET2272_
#define _ADI_USB_NET2272_CONTROLLER_
- endif
- define USB_VID USB_VID_ADI_TOOLS ///< Vendor ID
- define USB_PID USB_PID_BF527KIT_BULK ///< Product ID
- ifdef _USE_CM_BF537U_SPECIFIC_USB_INIT_
#define NET2272_BASE_ADDR 0x20200000 ///< Base address of the NET2272 device #define NET2272_ADDR_SHIFT 1 ///< Address shift for addressing the NET2272 #define NET2272_ADI_PERIPHERAL_ID ADI_INT_DMA1_ETHERNET_RX_PORTH_A ///< Interrupt ID for peripheral interrupt #define NET2272_PF_RESET _PH13 ///< Pin PF_RESET #define NET2272_PF_INT _PH14 ///< Pin PF_INT #define NET2272_IVG 0 // use default ///< IVG fot NET2272 #define NET2272_ADI_MDMA_ID ADI_DMA_MDMA_1 ///< MDMA ID
- else
#define NET2272_BASE_ADDR 0x20300000 ///< Base address of the NET2272 device #define NET2272_ADDR_SHIFT 1 ///< Address shift for addressing the NET2272 #define NET2272_ADI_PERIPHERAL_ID ADI_INT_PORTFG_A ///< Interrupt ID for peripheral interrupt #define NET2272_PF_RESET _PG14 ///< Pin PF_RESET #define NET2272_PF_INT _PG13 ///< Pin PF_INT #define NET2272_IVG 0 // use default ///< IVG fot NET2272 #define NET2272_ADI_MDMA_ID ADI_DMA_MDMA_1 ///< MDMA ID
- endif
/*********************************************************************************************/ </source>
Ethernet
In this section you can specify which Ethernet PHY should be used. Further you can set the configuration of the defined Ethernet PHY.
<source lang="c"> /**********************************************************************************************
** Ethernet ** **********************************************************************************************/
- define _USE_ETHERNET_ ///< Uncomment to use ethernet device
- define ETHERNET_DEBUG ///< Uncomment to get ethernet debug information
//#define _USE_ETH_MAC_INTERNAL_ ///< Uncomment to use the internal MAC
- define _USE_ETH_MAX_EXTERNAL ///< Uncomment to use the external MAC
/**********************************************************************************************/
- define ETH_PHY_DEVICE ETH_PHY_LAN9218 ///< PHY device defined in eth_dev.h
- define ETH_USE_RMII_DATA_INTERFACE ///< Uncomment to use the RMII data interface
- define ETH_MAC_ADDRESS "AC:DE:48:01:02:03" ///< MAC address of the device
- define ETH_IP_ADDRESS "192.168.0.10" ///< IP address of the device
- define ETH_SUBNET_MASK "255.255.255.0" ///< Subnet mask
- define ETH_GATEWAY_ADDRESS "0.0.0.0" ///< Gateway address
- define ETH_DHCP_ENABLED "0" ///< Set to 1 to enable the DHCP
- define ETH_MEM_BASE_SIZE ADI_ETHER_MEM_LAN9218_BASE_SIZE ///< Memory base size
- define ETH_MEM_PER_RECEIVE ADI_ETHER_MEM_LAN9218_PER_RECV ///< Memory per receive packet
- define ETH_MEM_PER_TRASMIT ADI_ETHER_MEM_LAN9218_PER_XMIT ///< Memory per trasmit packet
- define ETH_BASE_ADDR 0x20308000 ///< Base address for AMS
- define ETH_PERIPHERAL_ID 0 ///< Peripheral ID for external interrupt source
- define ETH_PF_INT_PIN _PG11 ///< Ethernet IRQ source pin
- define ETH_NO_RECEIVES 8 ///< Number of memory receives
- define ETH_NO_TRANSMITS 10 ///< Number of memory transmits
- define ETH_IP_STACK_ENABLE 1 ///< Enables the IP stack
- define ETH_STACK_SIZE 1024*1024*1 ///< Stack size
- define ETH_TCP_TEST_SERVER_PORT 5555 ///< Port number for TCP test
- define ETH_IVG_RXTX 13 ///< IVG for Ethernet RxTx
- define ETH_STACK_PRIORITY 3 ///< Stack priority
- define ETH_STACK_PERIOD 10 ///< Stack period
/*********************************************************************************************/ </source>
I2C interface
Here you can choose if you want to use the internal (if supported by processor) or the emulated I2C interface. You have to specify the I2C clock frequency of the slowest device on the bus.
<source lang="c"> /**********************************************************************************************
** I2C interface ** **********************************************************************************************/
- define _USE_I2C_INTERFACE_ ///< Uncomment to use the I2C interface
- define I2C_DEBUG ///< Uncomment to get I2C debug information
- define _USE_I2C_INTERNAL ///< Uncomment to use the internal I2C, if not available comment it out
/**********************************************************************************************/
- define I2C_GLOBAL_HANDLER_NR 0 ///< Number of the I2C interface that is used as global handler
- define I2C_BIT_RATE 100000 ///< Bitrate fot the I2C interface
- define I2C_ENABLE_SCANBUS 0 ///< Enable calling the function I2CScanbus after initialization
- define I2C_SCANBUS_MAX_DEVICES 10 ///< Max devices for the I2CScanbus function. Need for memory allocation of g_anI2CScanbusIDs
// for I2C emulator
- define I2C_EMU_SDA 0 ///< GPIO, used as data for I2C, emulated in software, currently not in use
- define I2C_EMU_SCL 0 ///< GPIO, used as clock for I2C, emulated in software, currently not in use
- define I2C_EMU_TIMER 0 ///< TIMER, used for I2C, emulated in software
/*********************************************************************************************/ </source>
SPI interface
Here you can specify which SPI interface should be initialized when BLACKSheep® OS boots. <source lang="c"> /**********************************************************************************************
** SPI interface ** **********************************************************************************************/
- define _USE_SPI_
//#define SPI_DEBUG /**********************************************************************************************/
- define SPI_INIT_BUS_0 ///< initialize SPI bus 0
- define SPI_INIT_BUS_1 ///< initialize SPI bus 1
- define SPI_INIT_BUS_2 ///< initialize SPI bus 2
/**********************************************************************************************/ </source>
SPI SD Card
This section is used to configure a connected SD Card over SPI interface.
<source lang="c"> /**********************************************************************************************
** SPI SD Card ** **********************************************************************************************/
- define _USE_SPI_SD_CARD_ ///< Uncomment to use the SPI SD Card
- define SPI_SD_CARD_DEBUG ///< Uncomment to get SPI SD card debug information
/**********************************************************************************************/
- define SPI_SD_CARD_BUS 0 ///< SPI Bus
- define SPI_SD_CARD_SLOT (_PF10 | 0x80000000) ///< CS Pin for the SD Card
- define SPI_SD_CARD_BAUDRATE 20000000 ///< Baudrate in transfer mode
- define SPI_SD_CARD_FILE_SYSTEM FILE_SYSTEM_FULLFAT_NAME ///< File system used by the SPI SD card
- define SPI_SD_CARD_PARTITION_NAME 0 ///< Partition name (0 if unknown)
/*********************************************************************************************/ </source> Supported file systems are: "fullfat" (FullFAT) and "fat" (FreeDOS). Be sure that the selected file system is initialized in the section File system.
SDH interface
Here you can configure the SDH interface of the processor. <source lang="c"> /***********************************************************************************************
** SDH interface ** ***********************************************************************************************/
- define _USE_SDH_INTERFACE_ ///< Uncomment to use the SDH interface
- define SDH_DEBUG ///< Uncomment to get SDH debug information
/***********************************************************************************************/
- define SDH_MAX_SDH_INTERFACES 1 ///< Number of avaiable SDH interfaces
- define SDH_IRQ_SDH_MASK0 IRQ_SDH_MASK0 ///< Interrupt request flag for SDH Mask 0
- define SDH_IRQ_SDH_MASK1 IRQ_SDH_MASK1 ///< Interrupt request flag for SDH Mask 1
- define SDH_IRQ_DMA IRQ_DMA22 ///< Interrupt request flag for DMA
- define SDH_PD_DAT3_EN 1 ///< Pull Down on DAT3 enable
- define SDH_PU_DAT3_EN 0 ///< Pull Up on DAT3 enable
- define SDH_PU_DAT02_CMD_EN 1 ///< Pull Up on DAT0-2 and CMD enable
- define SDH_PERIPHERAL_RXTX_IVG 0 ///< IVG for SDH Peripheral Rx Tx
- define SDH_PERIPHERAL_STATUS_IVG 0 ///< IVG for SDH Peripheral Status
- define SDH_DMA_ERROR_IVG 0 ///< IVG for DMA Error
/**********************************************************************************************/ </source>
SDH SD Card
This section is used to configure a connected SD Card over SDH interface.
<source lang="c"> /**********************************************************************************************
** SDH SD Card ** **********************************************************************************************/
- define _USE_SDH_SD_CARD_ ///< Uncomment to use the SDH SD Card
- define SDH_SD_CARD_DEBUG ///< Uncomment to get SDH SD card debug information
/**********************************************************************************************/
- define SDH_SD_CARD_SDH_SLOT 0 ///< SDH Slot
- define SDH_SD_CARD_FILE_SYSTEM FILE_SYSTEM_FULLFAT_NAME ///< File system used by the SDH SD card
- define SDH_SD_CARD_PARTITION_NAME 0 ///< Partition name (0 if unknown)
- define SDH_SD_CARD_PIN_CARD_DETECT _PC5 ///< Card Detect pin
- define SDH_SD_CARD_PIN_DAT0 _PC8 ///< DAT0 pin
- define SDH_SD_CARD_CD_IVG 12 ///< IVG for Card Detect interrupt
- define SDH_SD_CARD_MODE SDH_SDIO_4_BIT ///< SDH mode
- define SDH_SD_CARD_IDENT_BITRATE 400000 ///< Identification mode bitrate
- define SDH_SD_CARD_TRANSFER_BITRATE 20000000 ///< Transfer mode bitrate
- define SDH_SD_CARD_TIMEOUT_CD 0x000F0000 ///< Timeout for card detect
- define SDH_SD_CARD_TIMEOUT_RW 0x00F00000 ///< Timeout for read and write commands
/*********************************************************************************************/ </source> Supported file systems are: "fullfat" (FullFAT) and "fat" (FreeDOS). Be sure that the selected file system is initialized in the section File system.
CF Card
This section is used to configure a connected CF Card in True IDE mode.
<source lang="c"> /**********************************************************************************************
** CF Card ** **********************************************************************************************/
- define _USE_CF_CARD_ ///< Uncomment to use the CF Card
- define CF_CARD_DEBUG ///< Uncomment to get CF card debug information
/**********************************************************************************************/
- define CF_CARD_IDE_BASE_ADDRESS 0x2020C000 ///< Base address
- define CF_CARD_IDE_ADDRESS_SHIFT 1 ///< Address A2, A1, A0 shift in True IDE mode
- define CF_CARD_PIN_RESET _CF_RESET ///< Reset pin
- define CF_CARD_PIN_IRQ _PG1 ///< Interrupt request pin
- define CF_CARD_PARTITION_NAME 0 ///< Partition name (0 if unknown)
- define CF_CARD_FILE_SYSTEM FILE_SYSTEM_FULLFAT_NAME ///< File system used by the CF card
/*********************************************************************************************/ </source> Supported file systems are: "fullfat" (FullFAT) and "fat" (FreeDOS). Be sure that the selected file system is initialized in the section File system.
CAN interface
Configure the CAN Bus interface. <source lang="c"> /**********************************************************************************************
** CAN Interface ** **********************************************************************************************/
- define _USE_CAN_ ///< Uncomment to use the CAN interface
- define CAN_BUS_DEBUG ///< Uncomment to get CAN debug information
/**********************************************************************************************/
- define CAN_DEFAULT_INTERFACE 0 ///< Default interface
- define CAN_BIT_RATE 1000000 ///< Bit rate
/*********************************************************************************************/ </source>