For SD card, use parameters generated by kernel config utility.
This commit is contained in:
@@ -49,9 +49,6 @@ controller spi4 # SD card
|
||||
device sd0 at spi4
|
||||
pins RF3, RB13 # select pin, enable pin
|
||||
options "SD0_MHZ=10" # speed 10 MHz
|
||||
options "SD0_PORT=4" # at spi4 TODO: delete
|
||||
options "SD0_CS_PORT=TRISF" # for chip select... TODO: delete
|
||||
options "SD0_CS_PIN=3" # ...use pin RF3 TODO: delete
|
||||
signal "SD0_ENA" pin RB13 # SD enable signal
|
||||
|
||||
# ADC driver
|
||||
|
||||
@@ -14,9 +14,6 @@ PARAM += -DLED_KERNEL_PORT=TRISA -DLED_KERNEL_PIN=15
|
||||
PARAM += -DNMOUNT=3
|
||||
PARAM += -DPARTITION='sdramp0:sa@2048,fs@14000'
|
||||
PARAM += -DKERNEL_EXECUTABLE_RAM
|
||||
PARAM += -DSD0_CS_PIN=3
|
||||
PARAM += -DSD0_CS_PORT=TRISF
|
||||
PARAM += -DSD0_PORT=4
|
||||
PARAM += -DSD0_MHZ=10
|
||||
PARAM += -DCONS_MINOR=2
|
||||
PARAM += -DCONS_MAJOR=UART_MAJOR
|
||||
|
||||
@@ -44,6 +44,3 @@ controller spi2 # SD card
|
||||
# SD card
|
||||
device sd0 at spi2 pin RD1 # select pin
|
||||
options "SD0_MHZ=16" # speed 16 MHz
|
||||
options "SD0_PORT=2" # at spi2 TODO: delete
|
||||
options "SD0_CS_PORT=TRISD" # for chip select... TODO: delete
|
||||
options "SD0_CS_PIN=1" # ...use pin RD1 TODO: delete
|
||||
|
||||
@@ -6,9 +6,6 @@ PARAM += -DSD_ENABLED
|
||||
PARAM += -DLED_TTY_PORT=TRISD -DLED_TTY_PIN=12
|
||||
PARAM += -DLED_DISK_PORT=TRISD -DLED_DISK_PIN=2
|
||||
PARAM += -DLED_KERNEL_PORT=TRISD -DLED_KERNEL_PIN=3
|
||||
PARAM += -DSD0_CS_PIN=1
|
||||
PARAM += -DSD0_CS_PORT=TRISD
|
||||
PARAM += -DSD0_PORT=2
|
||||
PARAM += -DSD0_MHZ=16
|
||||
PARAM += -DCONS_MINOR=0
|
||||
PARAM += -DCONS_MAJOR=UART_MAJOR
|
||||
|
||||
@@ -46,9 +46,6 @@ controller spi3 # SD card
|
||||
# microSD card
|
||||
device sd0 at spi3
|
||||
pins RG12, RG13 # select pin, enable pin
|
||||
options "SD0_PORT=3" # at spi3 TODO: delete
|
||||
options "SD0_CS_PORT=TRISG" # for chip select... TODO: delete
|
||||
options "SD0_CS_PIN=12" # ...use pin RG12 TODO: delete
|
||||
signal "SD0_ENA" pin RG13 # SD card enable signal TODO: delete
|
||||
|
||||
# General purpose I/O ports
|
||||
|
||||
@@ -46,9 +46,6 @@ controller spi3 # SD card
|
||||
# microSD card
|
||||
device sd0 at spi3
|
||||
pins RG12, RG13 # select pin, enable pin
|
||||
options "SD0_PORT=3" # at spi3 TODO: delete
|
||||
options "SD0_CS_PORT=TRISG" # for chip select... TODO: delete
|
||||
options "SD0_CS_PIN=12" # ...use pin RG12 TODO: delete
|
||||
signal "SD0_ENA" pin RG13 # SD card enable signal TODO: delete
|
||||
|
||||
# General purpose I/O ports
|
||||
|
||||
@@ -15,9 +15,6 @@ PARAM += -DPWM_ENABLED
|
||||
PARAM += -DSD0_ENA_PORT=TRISG -DSD0_ENA_PIN=13
|
||||
PARAM += -DLED_DISK_PORT=TRISC -DLED_DISK_PIN=1
|
||||
PARAM += -DLED_KERNEL_PORT=TRISB -DLED_KERNEL_PIN=15
|
||||
PARAM += -DSD0_CS_PIN=12
|
||||
PARAM += -DSD0_CS_PORT=TRISG
|
||||
PARAM += -DSD0_PORT=3
|
||||
PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3
|
||||
PARAM += -DUSB_MAX_EP_NUMBER=3
|
||||
PARAM += -DCONS_MAJOR=UARTUSB_MAJOR
|
||||
|
||||
@@ -45,9 +45,6 @@ controller spi3 # SD card
|
||||
# microSD card
|
||||
device sd0 at spi3
|
||||
pins RD5, RB13 # select pin, enable pin
|
||||
options "SD0_PORT=3" # at spi3 TODO: delete
|
||||
options "SD0_CS_PORT=TRISD" # for chip select... TODO: delete
|
||||
options "SD0_CS_PIN=5" # ...use pin RD5 TODO: delete
|
||||
signal "SD0_ENA" pin RB13 # SD card enable signal TODO: delete
|
||||
|
||||
# General purpose I/O ports
|
||||
|
||||
@@ -45,9 +45,6 @@ controller spi3 # SD card
|
||||
# microSD card
|
||||
device sd0 at spi3
|
||||
pins RD5, RB13 # select pin, enable pin
|
||||
options "SD0_PORT=3" # at spi3 TODO: delete
|
||||
options "SD0_CS_PORT=TRISD" # for chip select... TODO: delete
|
||||
options "SD0_CS_PIN=5" # ...use pin RD5 TODO: delete
|
||||
signal "SD0_ENA" pin RB13 # SD card enable signal TODO: delete
|
||||
|
||||
# General purpose I/O ports
|
||||
|
||||
@@ -14,9 +14,6 @@ PARAM += -DPWM_ENABLED
|
||||
PARAM += -DSD0_ENA_PORT=TRISB -DSD0_ENA_PIN=13
|
||||
PARAM += -DLED_DISK_PORT=TRISB -DLED_DISK_PIN=12
|
||||
PARAM += -DLED_KERNEL_PORT=TRISB -DLED_KERNEL_PIN=15
|
||||
PARAM += -DSD0_CS_PIN=5
|
||||
PARAM += -DSD0_CS_PORT=TRISD
|
||||
PARAM += -DSD0_PORT=3
|
||||
PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3
|
||||
PARAM += -DUSB_MAX_EP_NUMBER=3
|
||||
PARAM += -DCONS_MAJOR=UARTUSB_MAJOR
|
||||
|
||||
@@ -375,9 +375,7 @@ exception(frame)
|
||||
#endif
|
||||
#ifdef UART6_ENABLED
|
||||
case PIC32_VECT_U6: /* UART6 */
|
||||
if (SD0_PORT != 2) {
|
||||
uartintr(makedev(UART_MAJOR, 5));
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef UARTUSB_ENABLED
|
||||
|
||||
@@ -45,9 +45,6 @@ controller spi1 # SD card
|
||||
# SD card
|
||||
device sd0 at spi1 pin RB1 # select pin
|
||||
options "SD0_MHZ=10" # speed 10 MHz
|
||||
options "SD0_PORT=1" # at spi1 TODO: delete
|
||||
options "SD0_CS_PORT=TRISB" # for chip select... TODO: delete
|
||||
options "SD0_CS_PIN=1" # ...use pin RB1 TODO: delete
|
||||
|
||||
# General purpose I/O ports
|
||||
# Flags define a mask of available pins
|
||||
|
||||
@@ -16,9 +16,6 @@ PARAM += -DLED_SWAP_PORT=TRISA -DLED_SWAP_PIN=3
|
||||
PARAM += -DLED_TTY_PORT=TRISA -DLED_TTY_PIN=2
|
||||
PARAM += -DLED_KERNEL_PORT=TRISA -DLED_KERNEL_PIN=1
|
||||
PARAM += -DLED_DISK_PORT=TRISA -DLED_DISK_PIN=0
|
||||
PARAM += -DSD0_CS_PIN=1
|
||||
PARAM += -DSD0_CS_PORT=TRISB
|
||||
PARAM += -DSD0_PORT=1
|
||||
PARAM += -DSD0_MHZ=10
|
||||
PARAM += -DCONS_MINOR=1
|
||||
PARAM += -DCONS_MAJOR=UART_MAJOR
|
||||
|
||||
@@ -43,9 +43,6 @@ controller spi2 # SD card
|
||||
|
||||
# microSD card
|
||||
device sd0 at spi2 pin RG9 # select pin
|
||||
options "SD0_PORT=2" # sd0 at spi2 TODO: delete
|
||||
options "SD0_CS_PORT=TRISG" # for chip select... TODO: delete
|
||||
options "SD0_CS_PIN=9" # ...use pin RA9 TODO: delete
|
||||
|
||||
# General purpose I/O ports
|
||||
# Flags define a mask of available pins
|
||||
|
||||
@@ -48,9 +48,6 @@ controller spi2 # SD card
|
||||
|
||||
# microSD card
|
||||
device sd0 at spi2 pin RG9 # select pin
|
||||
options "SD0_PORT=2" # sd0 at spi2 TODO: delete
|
||||
options "SD0_CS_PORT=TRISG" # for chip select... TODO: delete
|
||||
options "SD0_CS_PIN=9" # ...use pin RA9 TODO: delete
|
||||
options "SD0_MHZ=20" # increase data speed
|
||||
|
||||
# General purpose I/O ports
|
||||
|
||||
@@ -13,9 +13,6 @@ PARAM += -DADC_ENABLED
|
||||
PARAM += -DPWM_ENABLED
|
||||
PARAM += -DGLCD_ENABLED
|
||||
PARAM += -DLED_KERNEL_PORT=TRISE -DLED_KERNEL_PIN=5
|
||||
PARAM += -DSD0_CS_PIN=9
|
||||
PARAM += -DSD0_CS_PORT=TRISG
|
||||
PARAM += -DSD0_PORT=2
|
||||
PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3
|
||||
PARAM += -DUSB_MAX_EP_NUMBER=3
|
||||
PARAM += -DCONS_MAJOR=UARTUSB_MAJOR
|
||||
|
||||
111
sys/pic32/gpio.c
111
sys/pic32/gpio.c
@@ -93,17 +93,6 @@ const struct devspec gpiodevs[] = {
|
||||
(a<<15 | b<<14 | c<<13 | d<<12 | e<<11 | f<<10 | g<<9 | h<<8 | \
|
||||
i<<7 | j<<6 | k<<5 | l<<4 | m<<3 | n<<2 | o<<1 | p)
|
||||
|
||||
static const u_int gpio_pins_mx7 [NGPIO] =
|
||||
{ /* Missing pins: */
|
||||
MASK (1,1,0,0,0,1,1,0,1,1,1,1,1,1,1,1), /* A8, A11-A13 */
|
||||
MASK (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),
|
||||
MASK (1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,0), /* C0, C5-C11 */
|
||||
MASK (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),
|
||||
MASK (0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1), /* E10-E15 */
|
||||
MASK (0,0,1,1,0,0,0,1,0,0,1,1,1,1,1,1), /* F6-F7, F9-F11, F14-F15 */
|
||||
MASK (1,1,1,1,0,0,1,1,1,1,0,0,0,0,1,1), /* G2-G5, G10-G11 */
|
||||
};
|
||||
|
||||
/*
|
||||
* Mask of configured pins, default empty.
|
||||
*/
|
||||
@@ -116,104 +105,6 @@ u_int gpio_confmask [NGPIO];
|
||||
#define PRINTDBG(...) /*empty*/
|
||||
//#define PRINTDBG printf
|
||||
|
||||
/*
|
||||
* If a port address matches a port number,
|
||||
* clear a given bit in pin mask.
|
||||
*/
|
||||
static u_int
|
||||
filter_out (mask, portnum, portaddr, pin)
|
||||
register u_int mask;
|
||||
u_int portnum;
|
||||
volatile unsigned *portaddr;
|
||||
{
|
||||
register struct gpioreg *reg = portnum + (struct gpioreg*) &TRISA;
|
||||
|
||||
if ((unsigned) reg == (unsigned) portaddr)
|
||||
mask &= ~(1 << pin);
|
||||
return mask;
|
||||
}
|
||||
|
||||
/*
|
||||
* Some pins are not available in hardware or used by other drivers.
|
||||
* Remove them from the mask.
|
||||
*/
|
||||
static u_int
|
||||
gpio_filter (mask, portnum)
|
||||
u_int mask;
|
||||
u_int portnum;
|
||||
{
|
||||
mask &= gpio_pins_mx7 [portnum];
|
||||
|
||||
#ifdef LED_SWAP_PORT
|
||||
mask = filter_out (mask, portnum, &LED_SWAP_PORT, LED_SWAP_PIN);
|
||||
#endif
|
||||
#ifdef LED_DISK_PORT
|
||||
mask = filter_out (mask, portnum, &LED_DISK_PORT, LED_DISK_PIN);
|
||||
#endif
|
||||
#ifdef LED_KERNEL_PORT
|
||||
mask = filter_out (mask, portnum, &LED_KERNEL_PORT, LED_KERNEL_PIN);
|
||||
#endif
|
||||
#ifdef LED_TTY_PORT
|
||||
mask = filter_out (mask, portnum, &LED_TTY_PORT, LED_TTY_PIN);
|
||||
#endif
|
||||
#ifdef SD0_CS_PORT
|
||||
mask = filter_out (mask, portnum, &SD0_CS_PORT, SD0_CS_PIN);
|
||||
#endif
|
||||
#ifdef SD1_CS_PORT
|
||||
mask = filter_out (mask, portnum, &SD1_CS_PORT, SD1_CS_PIN);
|
||||
#endif
|
||||
#ifdef SD0_ENA_PORT
|
||||
mask = filter_out (mask, portnum, &SD0_ENA_PORT, SD0_ENA_PIN);
|
||||
#endif
|
||||
#ifdef SD1_ENA_PORT
|
||||
mask = filter_out (mask, portnum, &SD1_ENA_PORT, SD1_ENA_PIN);
|
||||
#endif
|
||||
#ifdef UART1_ENA_PORT
|
||||
mask = filter_out (mask, portnum, &UART1_ENA_PORT, UART1_ENA_PIN);
|
||||
#endif
|
||||
#ifdef UART2_ENA_PORT
|
||||
mask = filter_out (mask, portnum, &UART2_ENA_PORT, UART2_ENA_PIN);
|
||||
#endif
|
||||
#ifdef UART3_ENA_PORT
|
||||
mask = filter_out (mask, portnum, &UART3_ENA_PORT, UART3_ENA_PIN);
|
||||
#endif
|
||||
#ifdef UART4_ENA_PORT
|
||||
mask = filter_out (mask, portnum, &UART4_ENA_PORT, UART4_ENA_PIN);
|
||||
#endif
|
||||
#ifdef UART5_ENA_PORT
|
||||
mask = filter_out (mask, portnum, &UART5_ENA_PORT, UART5_ENA_PIN);
|
||||
#endif
|
||||
#ifdef UART6_ENA_PORT
|
||||
mask = filter_out (mask, portnum, &UART6_ENA_PORT, UART6_ENA_PIN);
|
||||
#endif
|
||||
#ifdef SW_DATA_PORT
|
||||
mask = filter_out (mask, portnum, &SW_DATA_PORT, SW_DATA_PIN);
|
||||
#endif
|
||||
#ifdef SW_LDA_PORT
|
||||
mask = filter_out (mask, portnum, &SW_LDA_PORT, SW_LDA_PIN);
|
||||
#endif
|
||||
#ifdef SW_RD_PORT
|
||||
mask = filter_out (mask, portnum, &SW_RD_PORT, SW_RD_PIN);
|
||||
#endif
|
||||
#ifdef SW_WR_PORT
|
||||
mask = filter_out (mask, portnum, &SW_WR_PORT, SW_WR_PIN);
|
||||
#endif
|
||||
|
||||
#ifdef POWER_ENABLED
|
||||
#ifdef POWER_SWITCH_PORT
|
||||
mask = filter_out (mask, portnum, &POWER_SWITCH_PORT, POWER_SWITCH_PIN);
|
||||
#endif
|
||||
#ifdef POWER_LED_PORT
|
||||
mask = filter_out (mask, portnum, &POWER_LED_PORT, POWER_LED_PIN);
|
||||
#endif
|
||||
#ifdef POWER_CONTROL_PORT
|
||||
mask = filter_out (mask, portnum, &POWER_CONTROL_PORT, POWER_CONTROL_PIN);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
static void
|
||||
gpio_print (dev, buf)
|
||||
dev_t dev;
|
||||
@@ -539,7 +430,7 @@ gpioioctl (dev, cmd, addr, flag)
|
||||
reg = unit + (struct gpioreg*) &TRISA;
|
||||
mask = (u_int) addr & 0xffff;
|
||||
if (cmd & GPIO_COMMAND & (GPIO_CONFIN | GPIO_CONFOUT | GPIO_CONFOD))
|
||||
mask = gpio_filter (mask, unit);
|
||||
mask = mask;
|
||||
else
|
||||
mask &= gpio_confmask[unit];
|
||||
|
||||
|
||||
@@ -45,9 +45,6 @@ controller spi2 # SD card
|
||||
# microSD card
|
||||
device sd0 at spi2 pin RC14 # select pin
|
||||
options "SD0_MHZ=10" # speed 10 MHz
|
||||
options "SD0_PORT=2" # at spi2 TODO: delete
|
||||
options "SD0_CS_PORT=TRISC" # for chip select... TODO: use flags
|
||||
options "SD0_CS_PIN=14" # ...use pin RC14 TODO: use flags
|
||||
|
||||
# General purpose I/O ports
|
||||
# Flags define a mask of available pins
|
||||
|
||||
@@ -15,9 +15,6 @@ PARAM += -DGPIO6_ENABLED
|
||||
PARAM += -DADC_ENABLED
|
||||
PARAM += -DPWM_ENABLED
|
||||
PARAM += -DLED_KERNEL_PORT=TRISA -DLED_KERNEL_PIN=3
|
||||
PARAM += -DSD0_CS_PIN=14
|
||||
PARAM += -DSD0_CS_PORT=TRISC
|
||||
PARAM += -DSD0_PORT=2
|
||||
PARAM += -DSD0_MHZ=10
|
||||
PARAM += -DCONS_MINOR=0
|
||||
PARAM += -DCONS_MAJOR=UART_MAJOR
|
||||
|
||||
@@ -43,9 +43,6 @@ controller spi4 # SD card
|
||||
|
||||
# microSD card
|
||||
device sd0 at spi4 pin RA1 # select pin
|
||||
options "SD0_PORT=4" # at spi3 TODO: delete
|
||||
options "SD0_CS_PORT=TRISA" # for chip select... TODO: delete
|
||||
options "SD0_CS_PIN=1" # ...use pin RA1 TODO: delete
|
||||
|
||||
# General purpose I/O ports
|
||||
# Flags define a mask of available pins
|
||||
|
||||
@@ -14,9 +14,6 @@ PARAM += -DADC_ENABLED
|
||||
PARAM += -DPWM_ENABLED
|
||||
PARAM += -DLED_DISK_PORT=TRISE -DLED_DISK_PIN=1
|
||||
PARAM += -DLED_KERNEL_PORT=TRISE -DLED_KERNEL_PIN=0 -DLED_KERNEL_INVERT
|
||||
PARAM += -DSD0_CS_PIN=1
|
||||
PARAM += -DSD0_CS_PORT=TRISA
|
||||
PARAM += -DSD0_PORT=4
|
||||
PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3
|
||||
PARAM += -DUSB_MAX_EP_NUMBER=3
|
||||
PARAM += -DCONS_MAJOR=UARTUSB_MAJOR
|
||||
|
||||
@@ -44,9 +44,6 @@ controller spi4 # SD card
|
||||
|
||||
# microSD card
|
||||
device sd0 at spi4 pin RE0 # select pin
|
||||
options "SD0_PORT=4" # at spi3 TODO: delete
|
||||
options "SD0_CS_PORT=TRISE" # for chip select... TODO: delete
|
||||
options "SD0_CS_PIN=0" # ...use pin RE0 TODO: delete
|
||||
|
||||
# General purpose I/O ports
|
||||
# Flags define a mask of available pins
|
||||
|
||||
@@ -14,9 +14,6 @@ PARAM += -DADC_ENABLED
|
||||
PARAM += -DPWM_ENABLED
|
||||
PARAM += -DLED_DISK_PORT=TRISE -DLED_DISK_PIN=1
|
||||
PARAM += -DLED_KERNEL_PORT=TRISF -DLED_KERNEL_PIN=0 -DLED_KERNEL_INVERT
|
||||
PARAM += -DSD0_CS_PIN=0
|
||||
PARAM += -DSD0_CS_PORT=TRISE
|
||||
PARAM += -DSD0_PORT=4
|
||||
PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3
|
||||
PARAM += -DUSB_MAX_EP_NUMBER=3
|
||||
PARAM += -DCONS_MAJOR=UARTUSB_MAJOR
|
||||
|
||||
@@ -47,9 +47,6 @@ controller spi1 # SD card
|
||||
|
||||
# microSD card
|
||||
device sd0 at spi1 pin RA9 # select pin
|
||||
options "SD0_PORT=1" # sd0 at spi1 TODO: delete
|
||||
options "SD0_CS_PORT=TRISA" # for sd0 chip select...TODO: delete
|
||||
options "SD0_CS_PIN=9" # ...use pin RA9 TODO: delete
|
||||
options "SD0_MHZ=8" # speed 8 MHz
|
||||
|
||||
# General purpose I/O ports
|
||||
|
||||
@@ -18,9 +18,6 @@ PARAM += -DLED_TTY_PORT=TRISA -DLED_TTY_PIN=1 -DLED_TTY_INVERT
|
||||
PARAM += -DLED_SWAP_PORT=TRISD -DLED_SWAP_PIN=9 -DLED_SWAP_INVERT
|
||||
PARAM += -DLED_KERNEL_PORT=TRISA -DLED_KERNEL_PIN=0 -DLED_KERNEL_INVERT
|
||||
PARAM += -DSD0_MHZ=8
|
||||
PARAM += -DSD0_CS_PIN=9
|
||||
PARAM += -DSD0_CS_PORT=TRISA
|
||||
PARAM += -DSD0_PORT=1
|
||||
PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3
|
||||
PARAM += -DUSB_MAX_EP_NUMBER=3
|
||||
PARAM += -DCONS_MAJOR=UARTUSB_MAJOR
|
||||
|
||||
@@ -40,9 +40,6 @@ controller spi2 # SD card
|
||||
# microSD card
|
||||
device sd0 at spi2 pin RG9 # select pin
|
||||
options "SD0_MHZ=10" # speed 10 MHz
|
||||
options "SD0_PORT=2" # at spi2 TODO: delete
|
||||
options "SD0_CS_PORT=TRISG" # for chip select... TODO: delete
|
||||
options "SD0_CS_PIN=9" # ...use pin RG9 TODO: delete
|
||||
|
||||
# ADC driver
|
||||
device adc
|
||||
|
||||
@@ -40,9 +40,6 @@ controller spi4 # RAM disk: spirams
|
||||
# microSD card
|
||||
device sd0 at spi2 pin RG9 # select pin
|
||||
options "SD0_MHZ=10" # speed 10 MHz
|
||||
options "SD0_PORT=2" # at spi2 TODO: delete
|
||||
options "SD0_CS_PORT=TRISG" # for chip select... TODO: delete
|
||||
options "SD0_CS_PIN=9" # ...use pin RG9 TODO: delete
|
||||
|
||||
# ADC driver
|
||||
device adc
|
||||
|
||||
@@ -6,9 +6,6 @@ PARAM += -DSD_ENABLED
|
||||
PARAM += -DADC_ENABLED
|
||||
PARAM += -DPWM_ENABLED
|
||||
PARAM += -DHXTFT_ENABLED
|
||||
PARAM += -DSD0_CS_PIN=9
|
||||
PARAM += -DSD0_CS_PORT=TRISG
|
||||
PARAM += -DSD0_PORT=2
|
||||
PARAM += -DSD0_MHZ=10
|
||||
PARAM += -DCONS_MINOR=0
|
||||
PARAM += -DCONS_MAJOR=UART_MAJOR
|
||||
|
||||
@@ -42,9 +42,6 @@ controller spi2 # SD card
|
||||
|
||||
# microSD card
|
||||
device sd0 at spi2 pin RB13 # select pin
|
||||
options "SD0_PORT=2" # at spi2 TODO: delete
|
||||
options "SD0_CS_PORT=TRISB" # for chip select... TODO: delete
|
||||
options "SD0_CS_PIN=13" # ...use pin RB13 TODO: delete
|
||||
|
||||
# General purpose I/O ports
|
||||
# Flags define a mask of available pins
|
||||
|
||||
@@ -12,9 +12,6 @@ PARAM += -DGPIO6_ENABLED
|
||||
PARAM += -DADC_ENABLED
|
||||
PARAM += -DPWM_ENABLED
|
||||
PARAM += -DLED_KERNEL_PORT=TRISD -DLED_KERNEL_PIN=1 -DLED_KERNEL_INVERT
|
||||
PARAM += -DSD0_CS_PIN=13
|
||||
PARAM += -DSD0_CS_PORT=TRISB
|
||||
PARAM += -DSD0_PORT=2
|
||||
PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3
|
||||
PARAM += -DUSB_MAX_EP_NUMBER=3
|
||||
PARAM += -DCONS_MAJOR=UARTUSB_MAJOR
|
||||
|
||||
@@ -254,7 +254,6 @@ int card_init(int unit)
|
||||
sd_type[unit] = 2;
|
||||
}
|
||||
|
||||
|
||||
/* Send repeatedly SEND_OP until Idle terminates. */
|
||||
for (i=0; ; i++)
|
||||
{
|
||||
@@ -296,13 +295,9 @@ int card_init(int unit)
|
||||
sd_type[unit] = 3;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fast speed. */
|
||||
if(unit == 0)
|
||||
spi_brg(sd_fd[unit],SD0_MHZ * 1000);
|
||||
#ifdef SD1_PORT
|
||||
if(unit == 1)
|
||||
spi_brg(sd_fd[unit],SD1_MHZ * 1000);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -532,45 +527,6 @@ again:
|
||||
|
||||
void sd_preinit (int unit)
|
||||
{
|
||||
if (unit >= NSD)
|
||||
return;
|
||||
|
||||
int fd = -1;
|
||||
if(unit==0)
|
||||
fd = spi_open(SD0_PORT,(unsigned int *)&SD0_CS_PORT,SD0_CS_PIN);
|
||||
|
||||
#ifdef SD1_PORT
|
||||
if(unit==1)
|
||||
fd = spi_open(SD1_PORT,(unsigned int *)&SD1_CS_PORT,SD1_CS_PIN);
|
||||
#endif
|
||||
|
||||
if(fd==-1)
|
||||
{
|
||||
printf("sd%d: Cannot open port\n",unit);
|
||||
return;
|
||||
}
|
||||
|
||||
sd_fd[unit] = fd;
|
||||
|
||||
#ifdef SD0_ENA_PORT
|
||||
/* Enable SD0 phy - pin is assumed to be active low */
|
||||
TRIS_CLR(SD0_ENA_PORT) = 1 << SD0_ENA_PIN;
|
||||
LAT_CLR(SD0_ENA_PORT) = 1 << SD0_ENA_PIN;
|
||||
udelay (1000);
|
||||
#endif
|
||||
|
||||
#ifdef SD1_ENA_PORT
|
||||
/* Enable SD1 phy - pin is assumed to be active low */
|
||||
TRIS_CLR(SD1_ENA_PORT) = 1 << SD1_ENA_PIN;
|
||||
LAT_CLR(SD1_ENA_PORT) = 1 << SD1_ENA_PIN;
|
||||
udelay (1000);
|
||||
#endif
|
||||
|
||||
spi_brg(fd, SD0_MHZ * 1000);
|
||||
spi_set(fd, PIC32_SPICON_CKE);
|
||||
|
||||
//printf ("sd%d: port %s, select pin R%c%d\n", unit,
|
||||
// spi_name(fd), spi_csname(fd), spi_cspin(fd));
|
||||
}
|
||||
|
||||
int sdinit (int unit, int flag)
|
||||
@@ -655,13 +611,44 @@ sdprobe(config)
|
||||
struct conf_device *config;
|
||||
{
|
||||
int unit = config->dev_unit;
|
||||
int cs;
|
||||
int cs = config->dev_pins[0];
|
||||
|
||||
if (unit < 0 || unit >= NSD)
|
||||
return 0;
|
||||
cs = config->dev_pins[0];
|
||||
printf("sd%u: port SPI%d, pin cs=R%c%d\n", unit,
|
||||
config->dev_ctlr, gpio_portname(cs), gpio_pinno(cs));
|
||||
|
||||
int port = (cs >> 4) - 1;
|
||||
int pin = cs & 15;
|
||||
struct gpioreg *base = port + (struct gpioreg*) &TRISA;
|
||||
|
||||
int fd = spi_open(config->dev_ctlr, (unsigned int*) base, pin);
|
||||
if (fd < 0) {
|
||||
printf("sd%d: Cannot open SPI port\n", unit);
|
||||
return 0;
|
||||
}
|
||||
sd_fd[unit] = fd;
|
||||
|
||||
#ifdef SD0_ENA_PORT
|
||||
if (unit == 0) {
|
||||
/* Enable SD0 phy - pin is assumed to be active low */
|
||||
TRIS_CLR(SD0_ENA_PORT) = 1 << SD0_ENA_PIN;
|
||||
LAT_CLR(SD0_ENA_PORT) = 1 << SD0_ENA_PIN;
|
||||
udelay (1000);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SD1_ENA_PORT
|
||||
if (unit == 1) {
|
||||
/* Enable SD1 phy - pin is assumed to be active low */
|
||||
TRIS_CLR(SD1_ENA_PORT) = 1 << SD1_ENA_PIN;
|
||||
LAT_CLR(SD1_ENA_PORT) = 1 << SD1_ENA_PIN;
|
||||
udelay (1000);
|
||||
}
|
||||
#endif
|
||||
|
||||
spi_brg(fd, SD0_MHZ * 1000);
|
||||
spi_set(fd, PIC32_SPICON_CKE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,9 +44,6 @@ controller spi2 # SD card
|
||||
|
||||
# microSD card
|
||||
device sd0 at spi2 pin RG9 # select pin
|
||||
options "SD0_PORT=2" # sd0 at spi2 TODO: delete
|
||||
options "SD0_CS_PORT=TRISG" # for chip select... TODO: delete
|
||||
options "SD0_CS_PIN=9" # ...use pin RA9 TODO: delete
|
||||
|
||||
# General purpose I/O ports
|
||||
# Flags define a mask of available pins
|
||||
|
||||
@@ -13,9 +13,6 @@ PARAM += -DADC_ENABLED
|
||||
PARAM += -DPWM_ENABLED
|
||||
PARAM += -DGLCD_ENABLED
|
||||
PARAM += -DLED_KERNEL_PORT=TRISE -DLED_KERNEL_PIN=7
|
||||
PARAM += -DSD0_CS_PIN=9
|
||||
PARAM += -DSD0_CS_PORT=TRISG
|
||||
PARAM += -DSD0_PORT=2
|
||||
PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3
|
||||
PARAM += -DUSB_MAX_EP_NUMBER=3
|
||||
PARAM += -DCONS_MAJOR=UARTUSB_MAJOR
|
||||
|
||||
@@ -44,9 +44,6 @@ controller spi1 # SD card
|
||||
|
||||
# SD card
|
||||
device sd0 at spi1 pin RB1 # select pin RB1
|
||||
options "SD0_PORT=1" # at spi1 TODO: delete
|
||||
options "SD0_CS_PORT=TRISB" # for chip select... TODO: delete
|
||||
options "SD0_CS_PIN=1" # ...use pin RB1 TODO: delete
|
||||
|
||||
# General purpose I/O ports
|
||||
# Flags define a mask of available pins
|
||||
|
||||
@@ -14,9 +14,6 @@ PARAM += -DADC_ENABLED
|
||||
PARAM += -DPWM_ENABLED
|
||||
PARAM += -DLED_KERNEL_PORT=TRISD -DLED_KERNEL_PIN=2
|
||||
PARAM += -DLED_DISK_PORT=TRISD -DLED_DISK_PIN=1
|
||||
PARAM += -DSD0_CS_PIN=1
|
||||
PARAM += -DSD0_CS_PORT=TRISB
|
||||
PARAM += -DSD0_PORT=1
|
||||
PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3
|
||||
PARAM += -DUSB_MAX_EP_NUMBER=3
|
||||
PARAM += -DCONS_MAJOR=UARTUSB_MAJOR
|
||||
|
||||
@@ -48,12 +48,6 @@ controller spi1 # SD card
|
||||
# microSD card
|
||||
device sd0 at spi1 pin RA9 # select pin
|
||||
device sd1 at spi1 pin RA10 # select pin
|
||||
options "SD0_PORT=1" # sd0 at spi1 TODO: delete
|
||||
options "SD0_CS_PORT=TRISA" # for sd0 chip select...TODO: delete
|
||||
options "SD0_CS_PIN=9" # ...use pin RA9 TODO: delete
|
||||
options "SD1_PORT=1" # sd1 at spi1 TODO: delete
|
||||
options "SD1_CS_PORT=TRISA" # for sd1 chip select...TODO: delete
|
||||
options "SD1_CS_PIN=10" # ...use pin RA9 TODO: delete
|
||||
|
||||
# General purpose I/O ports
|
||||
# Flags define a mask of available pins
|
||||
|
||||
@@ -46,12 +46,6 @@ controller spi1 # SD card
|
||||
# microSD card
|
||||
device sd0 at spi1 pin RA9 # select pin
|
||||
device sd1 at spi1 pin RA10 # select pin
|
||||
options "SD0_PORT=1" # sd0 at spi1 TODO: delete
|
||||
options "SD0_CS_PORT=TRISA" # for sd0 chip select...TODO: delete
|
||||
options "SD0_CS_PIN=9" # ...use pin RA9 TODO: delete
|
||||
options "SD1_PORT=1" # sd1 at spi1 TODO: delete
|
||||
options "SD1_CS_PORT=TRISA" # for sd1 chip select...TODO: delete
|
||||
options "SD1_CS_PIN=10" # ...use pin RA9 TODO: delete
|
||||
|
||||
# General purpose I/O ports
|
||||
# Flags define a mask of available pins
|
||||
|
||||
@@ -17,12 +17,6 @@ PARAM += -DLED_TTY_PORT=TRISE -DLED_TTY_PIN=3 -DLED_TTY_INVERT
|
||||
PARAM += -DLED_SWAP_PORT=TRISE -DLED_SWAP_PIN=0 -DLED_SWAP_INVERT
|
||||
PARAM += -DLED_DISK_PORT=TRISE -DLED_DISK_PIN=1 -DLED_DISK_INVERT
|
||||
PARAM += -DLED_KERNEL_PORT=TRISE -DLED_KERNEL_PIN=2 -DLED_KERNEL_INVERT
|
||||
PARAM += -DSD1_CS_PIN=10
|
||||
PARAM += -DSD1_CS_PORT=TRISA
|
||||
PARAM += -DSD1_PORT=1
|
||||
PARAM += -DSD0_CS_PIN=9
|
||||
PARAM += -DSD0_CS_PORT=TRISA
|
||||
PARAM += -DSD0_PORT=1
|
||||
PARAM += -DUSB_NUM_STRING_DESCRIPTORS=3
|
||||
PARAM += -DUSB_MAX_EP_NUMBER=3
|
||||
PARAM += -DCONS_MAJOR=UARTUSB_MAJOR
|
||||
|
||||
@@ -42,9 +42,6 @@ controller spi2 # SD card
|
||||
# microSD card
|
||||
device sd0 at spi2 pin RD4 # select pin RD4
|
||||
options "SD0_MHZ=10" # speed 10 MHz
|
||||
options "SD0_PORT=2" # at spi2 TODO: delete
|
||||
options "SD0_CS_PORT=TRISD" # for chip select... TODO: delete
|
||||
options "SD0_CS_PIN=4" # ...use pin RD4 TODO: delete
|
||||
|
||||
# General purpose I/O ports
|
||||
# Flags define a mask of available pins
|
||||
|
||||
@@ -15,9 +15,6 @@ PARAM += -DPWM_ENABLED
|
||||
PARAM += -DLED_TTY_PORT=TRISA -DLED_TTY_PIN=1
|
||||
PARAM += -DLED_DISK_PORT=TRISF -DLED_DISK_PIN=0
|
||||
PARAM += -DLED_KERNEL_PORT=TRISA -DLED_KERNEL_PIN=0
|
||||
PARAM += -DSD0_CS_PIN=4
|
||||
PARAM += -DSD0_CS_PORT=TRISD
|
||||
PARAM += -DSD0_PORT=2
|
||||
PARAM += -DSD0_MHZ=10
|
||||
PARAM += -DCONS_MINOR=0
|
||||
PARAM += -DCONS_MAJOR=UART_MAJOR
|
||||
|
||||
Reference in New Issue
Block a user