Changeset 53fb03fe in rtems
- Timestamp:
- 09/12/18 08:24:56 (6 years ago)
- Branches:
- 5, master
- Children:
- 68920e7f
- Parents:
- 7b93d857
- git-author:
- Sebastian Huber <sebastian.huber@…> (09/12/18 08:24:56)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (09/17/18 06:56:32)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
bsps/powerpc/tqm8xx/console/console.c
r7b93d857 r53fb03fe 106 106 107 107 /* 108 * I/O buffers and pointers to buffer descriptors 109 */ 110 #define SCC_RXBD_CNT 4 111 #define SCC_TXBD_CNT 4 112 typedef volatile char sccRxBuf_t[SCC_RXBD_CNT][RXBUFSIZE]; 113 114 /* 108 115 * Interrupt-driven callback 109 116 */ … … 123 130 int cr_chan_code; 124 131 int brg_used; 132 sccRxBuf_t *rxBuf; 125 133 } m8xx_console_chan_desc_t; 126 134 127 135 m8xx_console_chan_desc_t m8xx_console_chan_desc[CONS_CHN_CNT] = { 128 136 /* SCC1 */ 129 { TRUE,130 {(m8xxSCCparms_t *)&(m8xx.scc1p),NULL},131 {&(m8xx.scc1),NULL},132 BSP_CPM_IRQ_SCC1,133 M8xx_CR_CHAN_SCC1,134 -1},137 { .is_scc = true, 138 .parms = {(m8xxSCCparms_t *)&(m8xx.scc1p),NULL}, 139 .regs = {&(m8xx.scc1),NULL}, 140 .ivec_src = BSP_CPM_IRQ_SCC1, 141 .cr_chan_code = M8xx_CR_CHAN_SCC1, 142 .brg_used = -1}, 135 143 /* SCC2 */ 136 { TRUE,137 {&(m8xx.scc2p),NULL},138 {&(m8xx.scc2),NULL},139 BSP_CPM_IRQ_SCC2,140 M8xx_CR_CHAN_SCC2,141 -1},144 { .is_scc = true, 145 .parms = {&(m8xx.scc2p),NULL}, 146 .regs = {&(m8xx.scc2),NULL}, 147 .ivec_src = BSP_CPM_IRQ_SCC2, 148 .cr_chan_code = M8xx_CR_CHAN_SCC2, 149 .brg_used = -1}, 142 150 /* SCC3 */ 143 { TRUE,144 {&(m8xx.scc3p),NULL},145 {&(m8xx.scc3),NULL},146 BSP_CPM_IRQ_SCC3,147 M8xx_CR_CHAN_SCC3,148 -1},151 { .is_scc = true, 152 .parms = {&(m8xx.scc3p),NULL}, 153 .regs = {&(m8xx.scc3),NULL}, 154 .ivec_src = BSP_CPM_IRQ_SCC3, 155 .cr_chan_code = M8xx_CR_CHAN_SCC3, 156 .brg_used = -1}, 149 157 /* SCC4 */ 150 { TRUE,151 {&(m8xx.scc4p),NULL},152 {&(m8xx.scc4),NULL},153 BSP_CPM_IRQ_SCC4,154 M8xx_CR_CHAN_SCC4,155 -1},158 { .is_scc = true, 159 .parms = {&(m8xx.scc4p),NULL}, 160 .regs = {&(m8xx.scc4),NULL}, 161 .ivec_src = BSP_CPM_IRQ_SCC4, 162 .cr_chan_code = M8xx_CR_CHAN_SCC4, 163 .brg_used = -1}, 156 164 /* SMC1 */ 157 { FALSE,158 {NULL,&(m8xx.smc1p)},159 {NULL,&(m8xx.smc1)},160 BSP_CPM_IRQ_SMC1,161 M8xx_CR_CHAN_SMC1,162 -1},165 { .is_scc = false, 166 .parms = {NULL,&(m8xx.smc1p)}, 167 .regs = {NULL,&(m8xx.smc1)}, 168 .ivec_src = BSP_CPM_IRQ_SMC1, 169 .cr_chan_code = M8xx_CR_CHAN_SMC1, 170 .brg_used = -1}, 163 171 /* SMC2 */ 164 { FALSE,165 {NULL,&(m8xx.smc2p)},166 {NULL,&(m8xx.smc2)},167 BSP_CPM_IRQ_SMC2_OR_PIP,168 M8xx_CR_CHAN_SMC2,169 -1}};172 { .is_scc = false, 173 .parms = {NULL,&(m8xx.smc2p)}, 174 .regs = {NULL,&(m8xx.smc2)}, 175 .ivec_src = BSP_CPM_IRQ_SMC2_OR_PIP, 176 .cr_chan_code = M8xx_CR_CHAN_SMC2, 177 .brg_used = -1}}; 170 178 171 179 #define CHN_PARAM_GET(chan,param) \ … … 207 215 }while (0) 208 216 209 210 /*211 * I/O buffers and pointers to buffer descriptors212 */213 #define SCC_RXBD_CNT 4214 #define SCC_TXBD_CNT 4215 typedef volatile char sccRxBuf_t[SCC_RXBD_CNT][RXBUFSIZE];216 static sccRxBuf_t *rxBuf[CONS_CHN_CNT];217 217 218 218 static volatile m8xxBufferDescriptor_t *sccFrstRxBd[CONS_CHN_CNT]; … … 503 503 504 504 static void 505 sccInitialize ( int chan)505 sccInitialize (m8xx_console_chan_desc_t *cd, int chan) 506 506 { 507 507 int i; … … 510 510 * FIXME: use a cache-line size boundary alloc here 511 511 */ 512 rxBuf[chan] = malloc(sizeof(*rxBuf[chan]) + 2*PPC_CACHE_ALIGNMENT);513 if ( rxBuf[chan]== NULL) {512 cd->rxBuf = rtems_cache_aligned_malloc(sizeof(*cd->rxBuf)); 513 if (cd->rxBuf == NULL) { 514 514 rtems_panic("Cannot allocate console rx buffer\n"); 515 515 } 516 else { 517 /* 518 * round up rxBuf[chan] to start at a cache line size 519 */ 520 rxBuf[chan] = (sccRxBuf_t *) 521 (((uint32_t)rxBuf[chan]) + 522 (PPC_CACHE_ALIGNMENT 523 - ((uint32_t)rxBuf[chan]) % PPC_CACHE_ALIGNMENT)); 524 } 516 525 517 /* 526 518 * Allocate buffer descriptors … … 650 642 } 651 643 sccFrstRxBd[chan][i].length = 0; 652 sccFrstRxBd[chan][i].buffer = (* rxBuf[chan])[i];644 sccFrstRxBd[chan][i].buffer = (*cd->rxBuf)[i]; 653 645 } 654 646 /* … … 896 888 chan = channel_list[entry].minor; 897 889 m8xx_scc_mode[chan] = channel_list[entry].driver_mode; 898 sccInitialize ( chan);890 sccInitialize (&m8xx_console_chan_desc[chan], chan); 899 891 900 892 /*
Note: See TracChangeset
for help on using the changeset viewer.