NetBurner 3.5.8
PDF Version
MIMXRT11xx/include/semc.h
1/*NB_REVISION*/
2
3/*NB_COPYRIGHT*/
4
9
13
14#ifndef __SEMC_H
15#define __SEMC_H
16#include <predef.h>
17#include <stdint.h>
18#include <cpu_pins.h>
19
20
21/* These configuration enums are documented with the SOMRT1061 SEMC API
22 * (MIMXRT10xx/include/semc.h); the values are identical, except the
23 * non-multiplexed SEMC_AddrMux_t value is named None here (Bus there). */
25enum class SEMC_BusWidth_t {
26 Width_8 = 0,
27 Width_16 = 1,
28};
29
30enum class SEMC_AddrMux_t {
31 Mux = 0,
32 AdvMux = 1,
33 None = 2,
34};
35
36enum class SEMC_ColAddrWidth_t {
37 Width_12 = 0,
38 Width_11 = 1,
39 Width_10 = 2,
40 Width_9 = 3,
41 Width_8 = 4,
42 Width_7 = 5,
43 Width_6 = 6,
44 Width_5 = 7,
45 Width_4 = 8,
46 Width_3 = 9,
47 Width_2 = 10,
48 Width_0 = 12, // Do not configure ADDR Pins
49};
50
51enum class SEMC_ClkMode_t {
52 Async = 0,
53 Sync = 1,
54};
55
56enum class SEMC_Burst_t {
57 Burst_1 = 0,
58 Burst_2 = 1,
59 Burst_4 = 2,
60 Burst_8 = 3,
61 Burst_16 = 4,
62 Burst_32 = 5,
63 Burst_64 = 6,
64};
66
67// Configuration for an SEMC chip select. Each control register can be set
68// through its individual bit fields or written whole through the CR0/CR1/
69// CR2 overlay values. Timing fields are in SEMC clock cycles.
70struct SEMC_cfg_t {
71 // Control Register 0: basic interface configuration.
72 union {
73 struct {
74 SEMC_BusWidth_t busWidth : 1; // Data bus width (8-bit or 16-bit)
75 SEMC_ClkMode_t clkMode : 1; // Clock mode (asynchronous or synchronous)
76 uint8_t RESERVED0 : 2; // Reserved, must be 0
77 SEMC_Burst_t burstLen : 3; // Burst transfer length (synchronous mode)
78 uint8_t RESERVED1 : 1; // Reserved, must be 0
79 SEMC_AddrMux_t muxMode : 2; // Address/data multiplexing mode
80 bool advPol : 1; // Address valid (ADV) signal polarity
81 bool advHoldLvl : 1; // ADV signal hold level
82 SEMC_ColAddrWidth_t colAddrWidth : 4; // Column address bit width
83 };
84 uint32_t CR0; // Direct access to complete Control Register 0
85 };
86
87 // Control Register 1: setup/hold/enable timing for chip select,
88 // address, read enable, and write enable signals.
89 union {
90 struct {
91 uint8_t rd_en_hi : 4; // Read enable high period (async only)
92 uint8_t rd_en_lo : 4; // Read enable low pulse width (async only)
93 uint8_t we_en_hi : 4;
94 uint8_t we_en_lo : 4;
95 uint8_t addr_hold : 4; // Address hold time
96 uint8_t addr_setup : 4; // Address setup time
97 uint8_t cs_hold_min : 4; // Minimum chip select hold time after cycle end
98 uint8_t cs_setup : 4; // Chip select setup time before address valid
99 };
100 uint32_t CR1; // Direct access to complete Control Register 1
101 };
102 // Control Register 2: extended timing -- write data timing, latency,
103 // read cycle length, turnaround, and minimum chip select interval.
104 union {
105 struct {
106 uint8_t rd_hold : 4; // Read data hold time (sync/burst only)
107 uint8_t cs_min_intv : 4; // Minimum interval between chip select assertions
108 uint8_t rd_cycle : 4; // Total read cycle length (sync/burst only)
109 uint8_t latency : 4; // Read data latency cycles (sync/burst only)
110 uint8_t turnaround : 4; // Bus turnaround time between transfers (async only)
111 uint8_t wr_dat_hold : 4; // Write data hold time (sync/burst only)
112 uint8_t wr_dat_setup : 4; // Write data setup time (sync/burst only)
113 };
114 uint32_t CR2; // Direct access to complete Control Register 2
115 };
116 PinIO clkPin; // Clock output pin assignment (synchronous mode only)
117 PinIO csPin; // Chip select output pin assignment
118};
119
120// Symbol for the Base Address of the SEMC memory region
121extern uint8_t SEMC_Base[];
122extern uint8_t _s_data_bus[];
123extern uint8_t _e_data_bus[];
124
125
126// Configure an SEMC chip select for the external data bus.
127// baseAddr: base address of the memory region within the SEMC address
128// space (see SEMC_Base) that the chip select will decode.
129// siz: size of the region in bytes.
130// cfg: the bus width, mux mode, pins, and timing to use.
131// The two overloads accept a temporary or a named configuration structure.
132void ConfigureSEMC(uint32_t baseAddr, uint32_t siz, SEMC_cfg_t &&cfg);
133
134void ConfigureSEMC(uint32_t baseAddr, uint32_t siz, SEMC_cfg_t &cfg);
135
136#endif /* ----- #ifndef __SEMC_H ----- */
SEMC_ClkMode_t
Clock mode configuration for SEMC interface.
Definition MIMXRT10xx/include/semc.h:607
SEMC_AddrMux_t
Address multiplexing mode configuration.
Definition MIMXRT10xx/include/semc.h:514
SEMC_BusWidth_t
Data bus width configuration for SEMC interface.
Definition MIMXRT10xx/include/semc.h:491
SEMC_Burst_t
Burst transfer length configuration.
Definition MIMXRT10xx/include/semc.h:660
SEMC_ColAddrWidth_t
Column address width configuration for memory devices.
Definition MIMXRT10xx/include/semc.h:546
void ConfigureSEMC(uint32_t baseAddr, uint32_t siz, SEMC_cfg_t &&cfg)
Configure a Chip Select for the external data bus with rvalue reference configuration.
@ Async
Asynchronous mode. Timing based on fixed delays. No clock synchronization required....
Definition MIMXRT10xx/include/semc.h:608
@ Sync
Synchronous mode. All signals synchronized to SEMC clock. Supports burst transfers....
Definition MIMXRT10xx/include/semc.h:609
@ AdvMux
Advanced multiplexed mode. Enhanced multiplexing with additional control signals for complex timing.
Definition MIMXRT10xx/include/semc.h:516
@ Mux
Multiplexed address/data mode. Address and data share the same pins. Requires ADV signal to latch add...
Definition MIMXRT10xx/include/semc.h:515
@ Width_8
8-bit data bus (D[7:0]). Suitable for 8-bit memory devices or low pin-count designs.
Definition MIMXRT10xx/include/semc.h:492
@ Width_16
16-bit data bus (D[15:0]). Suitable for 16-bit memory devices. Provides 2x throughput compared to 8-b...
Definition MIMXRT10xx/include/semc.h:493
@ Burst_8
8-beat burst transfer. Address once, transfer 8 consecutive data words. Optimal for cache line fills ...
Definition MIMXRT10xx/include/semc.h:664
@ Burst_32
32-beat burst transfer. Address once, transfer 32 consecutive data words. Maximum sequential performa...
Definition MIMXRT10xx/include/semc.h:666
@ Burst_4
4-beat burst transfer. Address once, transfer 4 consecutive data words. Common burst length for many ...
Definition MIMXRT10xx/include/semc.h:663
@ Burst_16
16-beat burst transfer. Address once, transfer 16 consecutive data words. High-performance sequential...
Definition MIMXRT10xx/include/semc.h:665
@ Burst_1
Single-beat transfer. No burst mode. Each access requires full address cycle. Use for random access o...
Definition MIMXRT10xx/include/semc.h:661
@ Burst_2
2-beat burst transfer. Address once, transfer 2 consecutive data words. Minimal burst mode.
Definition MIMXRT10xx/include/semc.h:662
@ Burst_64
64-beat burst transfer. Address once, transfer 64 consecutive data words. Extreme burst length for sp...
Definition MIMXRT10xx/include/semc.h:667
@ Width_10
10-bit column address (A[9:0]). Common for standard SDRAM configurations.
Definition MIMXRT10xx/include/semc.h:549
@ Width_0
No column addressing. Do not configure address pins for column mode. Use for simple SRAM/NOR Flash wi...
Definition MIMXRT10xx/include/semc.h:558
@ Width_5
5-bit column address (A[4:0]). Very limited column addressing.
Definition MIMXRT10xx/include/semc.h:554
@ Width_9
9-bit column address (A[8:0]). Used in some SDRAM and synchronous memory devices.
Definition MIMXRT10xx/include/semc.h:550
@ Width_7
7-bit column address (A[6:0]). Used in specialized or smaller memory configurations.
Definition MIMXRT10xx/include/semc.h:552
@ Width_3
3-bit column address (A[2:0]). Extremely limited addressing, rarely used.
Definition MIMXRT10xx/include/semc.h:556
@ Width_4
4-bit column address (A[3:0]). Minimal configuration for small burst regions.
Definition MIMXRT10xx/include/semc.h:555
@ Width_6
6-bit column address (A[5:0]). Minimal column addressing for compact devices.
Definition MIMXRT10xx/include/semc.h:553
@ Width_11
11-bit column address (A[10:0]). Common for medium-density SDRAM.
Definition MIMXRT10xx/include/semc.h:548
@ Width_2
2-bit column address (A[1:0]). Minimal burst addressing capability.
Definition MIMXRT10xx/include/semc.h:557
@ Width_12
12-bit column address (A[11:0]). Maximum column address width, suitable for large SDRAM devices.
Definition MIMXRT10xx/include/semc.h:547
Configuration structure for SEMC (Smart External Memory Controller) interface.
Definition MIMXRT10xx/include/semc.h:799
PinIO clkPin
Definition MIMXRT10xx/include/semc.h:864
PinIO csPin
Definition MIMXRT10xx/include/semc.h:865