Changeset ed6365a in rtems
- Timestamp:
- Oct 14, 2014, 4:03:38 PM (6 years ago)
- Branches:
- 4.11, 5, master
- Children:
- c7e77ee
- Parents:
- c28f503
- git-author:
- Joel Sherrill <joel.sherrill@…> (10/14/14 16:03:38)
- git-committer:
- Joel Sherrill <joel.sherrill@…> (10/16/14 13:58:47)
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/bfin/TLL6527M/include/bsp.h
rc28f503 red6365a 1 1 /** 2 * @file 2 * @file bsp.h 3 3 * @ingroup bfin_tll6527m 4 4 * @brief Global BSP definitions. 5 * 6 * This include file contains all board IO definitions for TLL6527M. 5 7 */ 6 8 7 /** 8 *@file bsp.h 9 * 10 * This include file contains all board IO definitions for TLL6527M. 11 * 9 /* 12 10 * COPYRIGHT (c) 2010 by ECE Northeastern University. 13 11 * … … 16 14 * http://www.rtems.org/license 17 15 */ 18 19 16 20 17 #ifndef _BSP_H 21 18 #define _BSP_H 22 19 20 #ifndef ASM 23 21 24 22 #ifdef __cplusplus … … 96 94 /** @} */ 97 95 98 rtems_isr_entry set_vector( ///< @brief returns old vector */ 99 rtems_isr_entry handler, ///< @brief isr routine */ 100 rtems_vector_number vector, ///< @brief vector number */ 101 int type ///< @brief RTEMS or RAW intr */ 96 /** 97 * @brief Install an interrupt handler 98 * 99 * This method installs an interrupt handle. 100 * 101 * @param[in] handler is the isr routine 102 * @param[in] vector is the vector number 103 * @param[in] type indicates whether RTEMS or RAW intr 104 * 105 * @return returns old vector 106 */ 107 rtems_isr_entry set_vector( 108 rtems_isr_entry handler, 109 rtems_vector_number vector, 110 int type 102 111 ); 112 113 /* 114 * Internal BSP methods that are used across file boundaries 115 */ 116 void Init_RTC(void); 117 118 /* 119 * Prototype for methods in .S files that are referenced from C. 120 */ 121 void bfin_null_isr(void); 103 122 104 123 /** @} */ … … 108 127 #endif 109 128 129 #endif /* !ASM */ 130 110 131 #endif -
c/src/lib/libbsp/bfin/TLL6527M/startup/bspstart.c
rc28f503 red6365a 1 1 /* bspstart.c for TLL6527M 2 2 * 3 * This routine does the bulk of the system initiali sation.3 * This routine does the bulk of the system initialization. 4 4 */ 5 5 … … 11 11 * http://www.rtems.org/license 12 12 */ 13 14 13 15 14 #include <bsp.h> … … 62 61 }; 63 62 64 void Init_PLL (void);65 void Init_EBIU (void);66 void Init_Flags(void);67 void Init_RTC (void);68 void initCPLB(void);69 70 71 void null_isr(void);72 73 63 /* 74 * Function: bsp_pretasking_hook 75 * Created: 95/03/10 64 * Init_PLL 76 65 * 77 * Description: 78 * BSP pretasking hook. Called just before drivers are initialized. 79 * Used to setup libc and install any BSP extensions. 80 * 81 * NOTES: 82 * Must not use libc (to do io) from here, since drivers are 83 * not yet initialized. 84 * 66 * Routine to initialize the PLL. The TLL6527M uses a 25 Mhz XTAL. 85 67 */ 86 87 void bsp_pretasking_hook(void) 88 { 89 bfin_interrupt_init(); 90 } 91 92 void bsp_start( void ) 93 { 94 /* BSP Hardware Initialization*/ 95 Init_RTC(); /* Blackfin Real Time Clock initialization */ 96 Init_PLL(); /* PLL initialization */ 97 Init_EBIU(); /* EBIU initialization */ 98 Init_Flags(); /* GPIO initialization */ 99 100 /* 101 * Allocate the memory for the RTEMS Work Space. This can come from 102 * a variety of places: hard coded address, malloc'ed from outside 103 * RTEMS world (e.g. simulator or primitive memory manager), or (as 104 * typically done by stock BSPs) by subtracting the required amount 105 * of work space from the last physical address on the CPU board. 106 */ 107 int i=0; 108 for (i=5;i<16;i++) { 109 set_vector((rtems_isr_entry)null_isr, i, 1); 110 } 111 112 } 113 114 /* 115 * Init_PLL 116 * 117 * Routine to initialize the PLL. The TLL6527M uses a 25 Mhz XTAL. 118 */ 119 void Init_PLL (void) 68 static void Init_PLL (void) 120 69 { 121 70 unsigned short msel = 0; … … 139 88 } 140 89 141 /* 142 * Init_EBIU 143 * 144 * Configure extern memory 145 */ 146 147 void Init_EBIU (void) 90 /* 91 * Init_EBIU 92 * 93 * Configure extern memory 94 */ 95 static void Init_EBIU (void) 148 96 { 149 97 /* Check if SDRAM is already enabled */ … … 161 109 } 162 110 163 164 165 *166 167 168 void Init_Flags(void)111 /* 112 * Init_Flags 113 * 114 * Enable LEDs port 115 */ 116 static void Init_Flags(void) 169 117 { 170 118 *((uint16_t*)PORTH_FER) = 0x0; … … 174 122 } 175 123 124 /* 125 * bsp_pretasking_hook 126 */ 127 void bsp_pretasking_hook(void) 128 { 129 bfin_interrupt_init(); 130 } 176 131 132 void bsp_start( void ) 133 { 134 int i; 177 135 178 void initCPLB(void) { 136 /* BSP Hardware Initialization*/ 137 Init_RTC(); /* Blackfin Real Time Clock initialization */ 138 Init_PLL(); /* PLL initialization */ 139 Init_EBIU(); /* EBIU initialization */ 140 Init_Flags(); /* GPIO initialization */ 179 141 180 int i = 0; 181 unsigned int *addr; 182 unsigned int *data; 183 184 addr = (unsigned int *)0xffe00100; 185 data = (unsigned int *)0xffe00200; 142 /* 143 * Allocate the memory for the RTEMS Work Space. This can come from 144 * a variety of places: hard coded address, malloc'ed from outside 145 * RTEMS world (e.g. simulator or primitive memory manager), or (as 146 * typically done by stock BSPs) by subtracting the required amount 147 * of work space from the last physical address on the CPU board. 148 */ 149 for (i=5;i<16;i++) { 150 set_vector((rtems_isr_entry)bfin_null_isr, i, 1); 151 } 186 152 187 while ( dcplbs_table[i][0] != 0xffffffff ) {188 *addr = dcplbs_table[i][0];189 *data = dcplbs_table[i][1];190 191 addr++;192 data++;193 }194 153 } -
c/src/lib/libbsp/bfin/bf537Stamp/console/console.c
rc28f503 red6365a 1 1 /* Console driver for bf537Stamp 2 * 2 */ 3 4 /* 3 5 * Copyright (c) 2008 Kallisti Labs, Los Gatos, CA, USA 4 6 * written by Allan Hessenflow <allanh@kallisti.com> -
c/src/lib/libbsp/bfin/bf537Stamp/include/bsp.h
rc28f503 red6365a 15 15 #ifndef _BSP_H 16 16 #define _BSP_H 17 18 #ifndef ASM 17 19 18 20 #ifdef __cplusplus … … 90 92 * Helper Function to use the EzKits LEDS 91 93 */ 92 uint8_t getLED(void); 94 uint8_t getLEDs(void); 95 void setLEDs(uint8_t value); 96 uint8_t getButtons(void); 93 97 94 98 rtems_isr_entry set_vector( /* returns old vector */ … … 97 101 int type /* RTEMS or RAW intr */ 98 102 ); 103 104 /* 105 * Internal BSP methods that are used across file boundaries 106 */ 107 void Init_RTC(void); 99 108 100 109 /* … … 111 120 #endif 112 121 122 #endif /* !ASM */ 123 113 124 #endif -
c/src/lib/libbsp/bfin/bf537Stamp/startup/bspstart.c
rc28f503 red6365a 66 66 }; 67 67 68 void Init_RTC(void);69 70 68 static void initPLL(void); 71 69 static void initEBIU(void); -
c/src/lib/libbsp/bfin/eZKit533/include/bsp.h
rc28f503 red6365a 21 21 #ifndef _BSP_H 22 22 #define _BSP_H 23 24 #ifndef ASM 23 25 24 26 #include <libcpu/bf533.h> … … 127 129 uint8_t getLED (void); 128 130 129 rtems_isr_entry set_vector( ///< @brief returns old vector */ 130 rtems_isr_entry handler, ///< @brief isr routine */ 131 rtems_vector_number vector, ///< @brief vector number */ 132 int type ///< @brief RTEMS or RAW intr */ 131 /** 132 * @brief Install an interrupt handler 133 * 134 * This method installs an interrupt handle. 135 * 136 * @param[in] handler is the isr routine 137 * @param[in] vector is the vector number 138 * @param[in] type indicates whether RTEMS or RAW intr 139 * 140 * @return returns old vector 141 */ 142 rtems_isr_entry set_vector( 143 rtems_isr_entry handler, 144 rtems_vector_number vector, 145 int type 133 146 ); 147 148 /* 149 * Internal BSP methods that are used across file boundaries 150 */ 151 void Init_RTC(void); 152 153 /* 154 * Prototype for methods in .S files that are referenced from C. 155 */ 156 void bfin_null_isr(void); 134 157 135 158 /** @} */ … … 141 164 #endif 142 165 166 #endif /* !ASM */ 167 143 168 #endif -
c/src/lib/libbsp/bfin/eZKit533/startup/bspstart.c
rc28f503 red6365a 60 60 61 61 /* 62 * Use the shared implementations of the following routines63 */64 65 void Init_PLL (void);66 void Init_EBIU (void);67 void Init_Flags(void);68 void Init_RTC (void);69 70 void null_isr(void);71 72 /*73 * BSP pretasking hook. Called just before drivers are initialized.74 * Used to setup libc and install any BSP extensions.75 */76 77 void bsp_pretasking_hook(void)78 {79 bfin_interrupt_init();80 }81 82 void bsp_start( void )83 {84 /* BSP Hardware Initialization*/85 Init_RTC(); /* Blackfin Real Time Clock initialization */86 Init_PLL(); /* PLL initialization */87 Init_EBIU(); /* EBIU initialization */88 Init_Flags(); /* GPIO initialization */89 90 int i=0;91 for (i=5;i<16;i++) {92 set_vector((rtems_isr_entry)null_isr, i, 1);93 }94 }95 96 /*97 62 * Init_PLL 98 63 * … … 100 65 * See "../eZKit533/include/bsp.h" for more information. 101 66 */ 102 void Init_PLL (void)67 static void Init_PLL (void) 103 68 { 104 69 unsigned int n; … … 118 83 } 119 84 120 /* 121 * Init_EBIU 122 * 123 * Configure extern memory 124 */ 125 126 void Init_EBIU (void) 85 /* 86 * Init_EBIU 87 * 88 * Configure extern memory 89 */ 90 static void Init_EBIU (void) 127 91 { 128 92 /* Configure FLASH */ … … 143 107 * Enable LEDs port 144 108 */ 145 void Init_Flags(void)109 static void Init_Flags(void) 146 110 { 147 111 *((uint16_t*)FIO_INEN) = 0x0100; … … 152 116 *((uint8_t*)FlashA_PortB_Dir) = 0x3f; 153 117 *((uint8_t*)FlashA_PortB_Data) = 0x00; 118 } 119 120 /* 121 * BSP pretasking hook. Called just before drivers are initialized. 122 * Used to setup libc and install any BSP extensions. 123 */ 124 void bsp_pretasking_hook(void) 125 { 126 bfin_interrupt_init(); 127 } 128 129 void bsp_start( void ) 130 { 131 /* BSP Hardware Initialization*/ 132 Init_RTC(); /* Blackfin Real Time Clock initialization */ 133 Init_PLL(); /* PLL initialization */ 134 Init_EBIU(); /* EBIU initialization */ 135 Init_Flags(); /* GPIO initialization */ 136 137 int i=0; 138 for (i=5;i<16;i++) { 139 set_vector((rtems_isr_entry)bfin_null_isr, i, 1); 140 } 154 141 } 155 142 … … 170 157 return *((uint8_t*)FlashA_PortB_Data); 171 158 } 172 173 void initCPLB(void)174 {175 int i = 0;176 unsigned int *addr;177 unsigned int *data;178 179 addr = (unsigned int *)0xffe00100;180 data = (unsigned int *)0xffe00200;181 182 while ( dcplbs_table[i][0] != 0xffffffff ) {183 *addr = dcplbs_table[i][0];184 *data = dcplbs_table[i][1];185 addr++;186 data++;187 }188 } -
c/src/lib/libbsp/bfin/shared/start/start.S
rc28f503 red6365a 2 2 #include <rtems/bfin/bfin.h> 3 3 4 #include <bsp.h> 4 5 #include <bspopts.h> 5 6 … … 89 90 jump (p0) /* Should not return. */ 90 91 91 .global _ null_isr92 _ null_isr:92 .global _bfin_null_isr 93 _bfin_null_isr: 93 94 rti; 94 95 -
c/src/lib/libcpu/bfin/clock/clock.c
rc28f503 red6365a 38 38 _Thread_Heir == _Thread_Executing 39 39 && _Thread_Executing->Start.entry_point 40 == rtems_configuration_get_idle_task()40 == (Thread_Entry) rtems_configuration_get_idle_task() 41 41 ); 42 42 #else -
c/src/lib/libcpu/bfin/clock/rtc.c
rc28f503 red6365a 1 /* Real Time Clock Driver for Blackfin 1 /* 2 * Real Time Clock Driver for Blackfin 2 3 */ 3 4 -
c/src/lib/libcpu/bfin/serial/uart.c
rc28f503 red6365a 1 1 /* UART driver for Blackfin 2 * 2 */ 3 4 /* 3 5 * Copyright (c) 2008 Kallisti Labs, Los Gatos, CA, USA 4 6 * written by Allan Hessenflow <allanh@kallisti.com> … … 9 11 */ 10 12 11 12 13 #include <rtems.h> 13 14 #include <rtems/libio.h> … … 23 24 #define BFIN_UART_XMIT_BUSY 0x01 24 25 25 26 26 static bfin_uart_config_t *uartsConfig; 27 27 28 29 static int pollRead(int minor){28 static int pollRead(int minor) 29 { 30 30 int c; 31 31 uint32_t base; … … 45 45 } 46 46 47 char bfin_uart_poll_read(rtems_device_minor_number minor) { 47 char bfin_uart_poll_read(rtems_device_minor_number minor) 48 { 48 49 int c; 49 50 … … 55 56 } 56 57 57 void bfin_uart_poll_write(int minor, char c) { 58 void bfin_uart_poll_write(int minor, char c) 59 { 58 60 uint32_t base; 59 61 … … 65 67 } 66 68 67 /* begin BISON */68 void debug_write_char(char c) {69 bfin_uart_poll_write(0, c);70 }71 72 void debug_write_string(char *s) {73 74 while (s && *s) {75 if (*s == '\n')76 debug_write_char('\r');77 debug_write_char(*s++);78 }79 }80 81 void debug_write_crlf(void) {82 83 debug_write_char('\r');84 debug_write_char('\n');85 }86 87 void debug_write_nybble(int nybble) {88 89 nybble &= 0x0f;90 debug_write_char((nybble > 9) ? 'a' + (nybble - 10) : '0' + nybble);91 }92 93 void debug_write_byte(int byte) {94 95 byte &= 0xff;96 debug_write_nybble(byte >> 4);97 debug_write_nybble(byte & 0x0f);98 }99 100 void debug_write_half(int half) {101 102 half &= 0xffff;103 debug_write_byte(half >> 8);104 debug_write_byte(half & 0xff);105 }106 107 void debug_write_word(int word) {108 109 word &= 0xffffffff;110 debug_write_half(word >> 16);111 debug_write_half(word & 0xffff);112 }113 /* end BISON */114 115 69 /* 116 70 * Console Termios Support Entry Points … … 118 72 */ 119 73 120 static ssize_t pollWrite(int minor, const char *buf, size_t len) {121 74 static ssize_t pollWrite(int minor, const char *buf, size_t len) 75 { 122 76 size_t count; 123 77 for ( count = 0; count < len; count++ ) … … 127 81 } 128 82 129 130 83 /** 131 84 * Routine to initialize the hardware. It initialize the DMA, … … 133 86 * @param channel channel information 134 87 */ 135 static void initializeHardware(bfin_uart_channel_t *channel) { 88 static void initializeHardware(bfin_uart_channel_t *channel) 89 { 136 90 uint16_t divisor = 0; 137 91 uint32_t base = 0; … … 189 143 */ 190 144 } 191 192 return;193 145 } 194 146 … … 200 152 * @return 201 153 */ 202 static int setAttributes(int minor, const struct termios *termios) { 154 static int setAttributes(int minor, const struct termios *termios) 155 { 203 156 uint32_t base; 204 157 int baud; … … 208 161 base = uartsConfig->channels[minor].uart_baseAddress; 209 162 switch (termios->c_cflag & CBAUD) { 210 case B0: 211 baud = 0; 212 break; 213 case B50: 214 baud = 50; 215 break; 216 case B75: 217 baud = 75; 218 break; 219 case B110: 220 baud = 110; 221 break; 222 case B134: 223 baud = 134; 224 break; 225 case B150: 226 baud = 150; 227 break; 228 case B200: 229 baud = 200; 230 break; 231 case B300: 232 baud = 300; 233 break; 234 case B600: 235 baud = 600; 236 break; 237 case B1200: 238 baud = 1200; 239 break; 240 case B1800: 241 baud = 1800; 242 break; 243 case B2400: 244 baud = 2400; 245 break; 246 case B4800: 247 baud = 4800; 248 break; 249 case B9600: 250 baud = 9600; 251 break; 252 case B19200: 253 baud = 19200; 254 break; 255 case B38400: 256 baud = 38400; 257 break; 258 case B57600: 259 baud = 57600; 260 break; 261 case B115200: 262 baud = 115200; 263 break; 264 case B230400: 265 baud = 230400; 266 break; 267 case B460800: 268 baud = 460800; 269 break; 270 default: 271 baud = -1; 272 break; 163 case B0: baud = 0; break; 164 case B50: baud = 50; break; 165 case B75: baud = 75; break; 166 case B110: baud = 110; break; 167 case B134: baud = 134; break; 168 case B150: baud = 150; break; 169 case B200: baud = 200; break; 170 case B300: baud = 300; break; 171 case B600: baud = 600; break; 172 case B1200: baud = 1200; break; 173 case B1800: baud = 1800; break; 174 case B2400: baud = 2400; break; 175 case B4800: baud = 4800; break; 176 case B9600: baud = 9600; break; 177 case B19200: baud = 19200; break; 178 case B38400: baud = 38400; break; 179 case B57600: baud = 57600; break; 180 case B115200: baud = 115200; break; 181 case B230400: baud = 230400; break; 182 case B460800: baud = 460800; break; 183 default: baud = -1; break; 273 184 } 274 185 if (baud > 0 && uartsConfig->channels[minor].uart_baud) 275 186 baud = uartsConfig->channels[minor].uart_baud; 276 187 switch (termios->c_cflag & CSIZE) { 277 case CS5: 278 lcr = UART_LCR_WLS_5; 279 break; 280 case CS6: 281 lcr = UART_LCR_WLS_6; 282 break; 283 case CS7: 284 lcr = UART_LCR_WLS_7; 285 break; 286 case CS8: 188 case CS5: lcr = UART_LCR_WLS_5; break; 189 case CS6: lcr = UART_LCR_WLS_6; break; 190 case CS7: lcr = UART_LCR_WLS_7; break; 287 191 default: 288 lcr = UART_LCR_WLS_8; 289 break; 192 case CS8: lcr = UART_LCR_WLS_8; break; 290 193 } 291 194 switch (termios->c_cflag & (PARENB | PARODD)) { 292 case PARENB:293 lcr |= UART_LCR_PEN | UART_LCR_EPS;294 break;295 case PARENB | PARODD:296 lcr |= UART_LCR_PEN;297 break;298 default:299 break;195 case PARENB: 196 lcr |= UART_LCR_PEN | UART_LCR_EPS; 197 break; 198 case PARENB | PARODD: 199 lcr |= UART_LCR_PEN; 200 break; 201 default: 202 break; 300 203 } 301 204 if (termios->c_cflag & CSTOPB) … … 321 224 * @return 322 225 */ 323 static ssize_t uart_interruptWrite(int minor, const char *buf, size_t len) { 226 static ssize_t uart_interruptWrite(int minor, const char *buf, size_t len) 227 { 324 228 uint32_t base = 0; 325 229 bfin_uart_channel_t* channel = NULL; … … 352 256 353 257 /** 354 * This function implements RX ISR355 */258 * This function implements RX ISR 259 */ 356 260 void bfinUart_rxIsr(void *_arg) 357 261 { … … 359 263 * TODO: UART RX ISR implementation. 360 264 */ 361 362 } 363 265 } 364 266 365 267 /** … … 371 273 * @param _arg gets the channel information. 372 274 */ 373 void bfinUart_txIsr(void *_arg) { 275 void bfinUart_txIsr(void *_arg) 276 { 374 277 bfin_uart_channel_t* channel = NULL; 375 278 uint32_t base = 0; … … 391 294 392 295 rtems_termios_dequeue_characters(channel->termios, channel->length); 393 394 return; 395 } 396 397 398 296 } 399 297 400 298 /** … … 407 305 * @return data already written 408 306 */ 409 static ssize_t uart_DmaWrite(int minor, const char *buf, size_t len) { 307 static ssize_t uart_DmaWrite(int minor, const char *buf, size_t len) 308 { 410 309 uint32_t base = 0; 411 310 bfin_uart_channel_t* channel = NULL; … … 444 343 } 445 344 446 447 345 /** 448 346 * RX DMA ISR. … … 451 349 * @param _arg 452 350 */ 453 void bfinUart_rxDmaIsr(void *_arg) { 351 void bfinUart_rxDmaIsr(void *_arg) 352 { 454 353 /** 455 354 * TODO: Implementation of RX DMA … … 468 367 * channel argument. 469 368 */ 470 void bfinUart_txDmaIsr(void *_arg) { 369 void bfinUart_txDmaIsr(void *_arg) 370 { 471 371 bfin_uart_channel_t* channel = NULL; 472 372 uint32_t tx_dma_base = 0; … … 496 396 */ 497 397 } 498 499 return;500 398 } 501 399 … … 503 401 * Function called during exit 504 402 */ 505 void uart_exit(void)403 static void uart_exit(void) 506 404 { 507 405 /** 508 406 * TODO: Flushing of quques 509 407 */ 510 511 408 } 512 409 … … 572 469 }; 573 470 574 575 471 if ( NULL == uartsConfig || 0 > minor || minor >= uartsConfig->num_channels) { 576 472 return RTEMS_INVALID_NUMBER; … … 599 495 } 600 496 601 602 497 /** 603 498 * Uart initialization function. … … 606 501 * @return rtems status code 607 502 */ 608 rtems_status_code bfin_uart_initialize(rtems_device_major_number major, 609 bfin_uart_config_t *config) { 503 rtems_status_code bfin_uart_initialize( 504 rtems_device_major_number major, 505 bfin_uart_config_t *config 506 ) 507 { 610 508 rtems_status_code sc = RTEMS_NOT_DEFINED; 611 509 int i = 0; -
cpukit/score/cpu/bfin/rtems/bfin/bfin.h
rc28f503 red6365a 7 7 * Processors. 8 8 */ 9 9 10 /* 10 11 * COPYRIGHT (c) 2006 by Atos Automacao Industrial Ltda.
Note: See TracChangeset
for help on using the changeset viewer.