Line 1... |
Line 1... |
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
--
|
--
|
-- SD/MMC Bootloader
|
-- SD/MMC Bootloader
|
--
|
--
|
-- $Id: spi_boot.vhd,v 1.9 2007-02-25 18:24:12 arniml Exp $
|
-- $Id: spi_boot.vhd,v 1.10 2007-08-06 23:31:05 arniml Exp $
|
--
|
--
|
-- Copyright (c) 2005, Arnim Laeuger (arniml@opencores.org)
|
-- Copyright (c) 2005, Arnim Laeuger (arniml@opencores.org)
|
--
|
--
|
-- All rights reserved, see COPYING.
|
-- All rights reserved, see COPYING.
|
--
|
--
|
Line 48... |
Line 48... |
|
|
|
|
entity spi_boot is
|
entity spi_boot is
|
|
|
generic (
|
generic (
|
-- width of set selection
|
|
width_set_sel_g : integer := 4;
|
|
-- width of bit counter: minimum 6, maximum 12
|
-- width of bit counter: minimum 6, maximum 12
|
width_bit_cnt_g : integer := 6;
|
width_bit_cnt_g : integer := 6;
|
-- width of image counter: minimum 0, maximum n
|
-- width of image counter: minimum 0, maximum n
|
width_img_cnt_g : integer := 2;
|
width_img_cnt_g : integer := 2;
|
-- number of bits required to address one image
|
-- number of bits required to address one image
|
Line 69... |
Line 67... |
|
|
port (
|
port (
|
-- System Interface -------------------------------------------------------
|
-- System Interface -------------------------------------------------------
|
clk_i : in std_logic;
|
clk_i : in std_logic;
|
reset_i : in std_logic;
|
reset_i : in std_logic;
|
set_sel_i : in std_logic_vector(width_set_sel_g-1 downto 0);
|
set_sel_i : in std_logic_vector(31-width_img_cnt_g-num_bits_per_img_g
|
|
downto 0);
|
-- Card Interface ---------------------------------------------------------
|
-- Card Interface ---------------------------------------------------------
|
spi_clk_o : out std_logic;
|
spi_clk_o : out std_logic;
|
spi_cs_n_o : out std_logic;
|
spi_cs_n_o : out std_logic;
|
spi_data_in_i : in std_logic;
|
spi_data_in_i : in std_logic;
|
spi_data_out_o : out std_logic;
|
spi_data_out_o : out std_logic;
|
Line 633... |
Line 632... |
else
|
else
|
ctrl_fsm_s <= CMD18_DATA;
|
ctrl_fsm_s <= CMD18_DATA;
|
end if;
|
end if;
|
|
|
|
|
-- Issued CMD12: STOP_TRANSMISSION --------------------------------------
|
-- Issued CMD12: STOP_TRANSMISSION -------------------------------------
|
when CMD12 =>
|
when CMD12 =>
|
if cmd_finished_s then
|
if cmd_finished_s then
|
ctrl_fsm_s <= INC_IMG_CNT;
|
ctrl_fsm_s <= INC_IMG_CNT;
|
else
|
else
|
ctrl_fsm_s <= CMD12;
|
ctrl_fsm_s <= CMD12;
|
Line 847... |
Line 846... |
cmd_v(cmd_r) := cmd18_c;
|
cmd_v(cmd_r) := cmd18_c;
|
-- insert image counter
|
-- insert image counter
|
cmd_v(8 + num_bits_per_img_g + width_img_cnt_g
|
cmd_v(8 + num_bits_per_img_g + width_img_cnt_g
|
downto 8 + num_bits_per_img_g) := img_cnt_s;
|
downto 8 + num_bits_per_img_g) := img_cnt_s;
|
-- insert set selection
|
-- insert set selection
|
cmd_v(8 + num_bits_per_img_g + width_img_cnt_g + width_set_sel_g-1
|
cmd_v(8 + 31
|
downto 8 + num_bits_per_img_g + width_img_cnt_g) := set_sel_i;
|
downto 8 + num_bits_per_img_g + width_img_cnt_g) := set_sel_i;
|
tx_v := true;
|
tx_v := true;
|
when CMD18_DATA =>
|
when CMD18_DATA =>
|
cmd_v(cmd_r) := cmd12_c;
|
cmd_v(cmd_r) := cmd12_c;
|
|
|
Line 946... |
Line 945... |
|
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-- File History:
|
-- File History:
|
--
|
--
|
-- $Log: not supported by cvs2svn $
|
-- $Log: not supported by cvs2svn $
|
|
-- Revision 1.9 2007/02/25 18:24:12 arniml
|
|
-- fix type handling of resets
|
|
--
|
-- Revision 1.8 2006/09/11 23:03:36 arniml
|
-- Revision 1.8 2006/09/11 23:03:36 arniml
|
-- disable outputs with reset
|
-- disable outputs with reset
|
--
|
--
|
-- Revision 1.7 2005/04/07 20:44:23 arniml
|
-- Revision 1.7 2005/04/07 20:44:23 arniml
|
-- add new port detached_o
|
-- add new port detached_o
|