OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [devs/] [serial/] [cortexm/] [stm32/] [current/] [src/] [stm32_serial.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_CORTEXM_STM32_SERIAL_H
2
#define CYGONCE_CORTEXM_STM32_SERIAL_H
3
 
4
// ====================================================================
5
//
6
//      stm32_serial.h
7
//
8
//      Device I/O - Description of ST STM32 serial hardware
9
//
10
// ====================================================================
11
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
12
// -------------------------------------------                              
13
// This file is part of eCos, the Embedded Configurable Operating System.   
14
// Copyright (C) 2008 Free Software Foundation, Inc.                        
15
//
16
// eCos is free software; you can redistribute it and/or modify it under    
17
// the terms of the GNU General Public License as published by the Free     
18
// Software Foundation; either version 2 or (at your option) any later      
19
// version.                                                                 
20
//
21
// eCos is distributed in the hope that it will be useful, but WITHOUT      
22
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
24
// for more details.                                                        
25
//
26
// You should have received a copy of the GNU General Public License        
27
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
28
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
29
//
30
// As a special exception, if other files instantiate templates or use      
31
// macros or inline functions from this file, or you compile this file      
32
// and link it with other works to produce a work based on this file,       
33
// this file does not by itself cause the resulting work to be covered by   
34
// the GNU General Public License. However the source code for this file    
35
// must still be made available in accordance with section (3) of the GNU   
36
// General Public License v2.                                               
37
//
38
// This exception does not invalidate any other reasons why a work based    
39
// on this file might be covered by the GNU General Public License.         
40
// -------------------------------------------                              
41
// ####ECOSGPLCOPYRIGHTEND####                                              
42
// ====================================================================
43
//#####DESCRIPTIONBEGIN####
44
//
45
// Author(s):    nickg
46
// Date:         2008-09-10
47
// Purpose:      Internal interfaces for serial I/O drivers
48
// Description:
49
//
50
//####DESCRIPTIONEND####
51
//
52
// ====================================================================
53
 
54
#include <cyg/hal/hal_io.h>  // Register definitions
55
 
56
// ====================================================================
57
// Translate system stop bit selector into control register bits.
58
 
59
static cyg_uint32 select_stop_bits[] = {
60
    CYGHWR_HAL_STM32_UART_CR2_STOP_0_5, // 0.5 stop bits
61
    CYGHWR_HAL_STM32_UART_CR2_STOP_1,   // 1 stop bit
62
    CYGHWR_HAL_STM32_UART_CR2_STOP_1_5, // 1.5 stop bit
63
    CYGHWR_HAL_STM32_UART_CR2_STOP_2    // 2 stop bit
64
};
65
 
66
// Translate system parity selector into local values.
67
static cyg_uint32 select_parity[] = {
68
    0,                                                                  // No parity
69
    CYGHWR_HAL_STM32_UART_CR1_PCE|CYGHWR_HAL_STM32_UART_CR1_PS_EVEN,    // Even parity
70
    CYGHWR_HAL_STM32_UART_CR1_PCE|CYGHWR_HAL_STM32_UART_CR1_PS_ODD,     // Odd parity
71
    0,  // Mark (1) parity -- not supported
72
 
73
};
74
 
75
// ====================================================================
76
// Translate system baud selector into direct baud rate value. This is
77
// then used to calculate the clock divisor from the PCLK clock.
78
 
79
static cyg_int32 select_baud[] = {
80
    0,      // Unused
81
    50,     // 50
82
    75,     // 75
83
    110,    // 110
84
    0,      // 134.5
85
    150,    // 150
86
    200,    // 200
87
    300,    // 300
88
    600,    // 600
89
    1200,   // 1200
90
    1800,   // 1800
91
    2400,   // 2400
92
    3600,   // 3600
93
    4800,   // 4800
94
    7200,   // 7200
95
    9600,   // 9600
96
    14400,  // 14400
97
    19200,  // 19200
98
    38400,  // 38400
99
    57600,  // 57600
100
    115200, // 115200
101
    230400, // 230400
102
};
103
 
104
// ====================================================================
105
#endif // CYGONCE_CORTEXM_STM32_SERIAL_H

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.